View | Details | Raw Unified | Return to bug 20346
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt (-13 / +54 lines)
Lines 274-279 Link Here
274
            $("#searchform").on("submit", function(e) {
274
            $("#searchform").on("submit", function(e) {
275
                e.preventDefault();
275
                e.preventDefault();
276
                search = 1;
276
                search = 1;
277
                update_searched();
277
                dtMemberResults.fnDraw();
278
                dtMemberResults.fnDraw();
278
            });
279
            });
279
        });
280
        });
Lines 444-468 Link Here
444
        }
445
        }
445
        // Update the string "Results found ..."
446
        // Update the string "Results found ..."
446
        function update_searched(){
447
        function update_searched(){
447
            var searched = $("#searchfieldstype_filter").find("option:selected").text();
448
            var first_query = document.getElementById("searchmember").value;
448
            if ( $("#searchmember_filter").val() ) {
449
            var searchmember = document.getElementById("searchmember_filter").value;
449
                if ( $("#searchtype_filter").val() == 'start_with' ) {
450
            var searched = $("#searchfieldstype").find("option:selected").text();
451
            var filtered;
452
453
            //Creating the searched message for the settings set for the search event
454
            if ( $("#searchmember").val() ) {
455
                if ( $("#searchtype").val() == 'start_with' ) {
450
                    searched += _(" starting with ");
456
                    searched += _(" starting with ");
451
                } else {
457
                } else {
452
                    searched += _(" containing ");
458
                    searched += _(" containing ");
453
                }
459
                }
454
                searched += "'" + $("#searchmember_filter").val() + "'";
460
                searched += "'" + $("#searchmember").val() + "'";
455
            }
456
            if ( $("#firstletter_filter").val() ) {
457
                searched += _(" begins with ") + "'" + $("#firstletter_filter").val() +"'";
458
            }
461
            }
459
            if ( $("#categorycode_filter").val() ) {
462
            if ( $("#categorycode").val() ) {
460
                searched += _(" with category ") + "'" + $("#categorycode_filter").find("option:selected").text() + "'";
463
                searched += _(" with category ") + "'" + $("#categorycode").find("option:selected").text() + "'";
461
            }
464
            }
462
            if ( $("#branchcode_filter").val() ) {
465
            if ( $("#branchcode").val() ) {
463
                searched += _(" in library ") + $("#branchcode_filter").find("option:selected").text();
466
                searched += _(" in library ") + $("#branchcode").find("option:selected").text();
464
            }
467
            }
465
            $("#searchpattern").text(searched);
468
469
            //Creating the searched message for the settings set for the filtered event
470
            if ( $("#searchmember_filter").val() ) {
471
               if ( $("#searchtype_filter").val() == 'start_with' ) {
472
                     filtered = " starting with ";
473
               } else {
474
                     filtered = " containing ";
475
               }
476
               filtered += "'" + $("#searchmember_filter").val() + "'";
477
             }
478
             if ( $("#firstletter_filter").val() ) {
479
                 if ( $("#searchmember_filter").val() || $("#categorycode_filter").val() || $("#branchcode_filter").val()) {
480
                    filtered += " begins with " + "'" + $("#firstletter_filter").val() +"'";
481
                 } else {
482
                    filtered = " begins with " + "'" + $("#firstletter_filter").val() +"'";
483
                 }
484
             }
485
             if ( $("#categorycode_filter").val() ) {
486
                  if ( $("#searchmember_filter").val() || $("#firstletter_filter").val() || $("#branchcode_filter").val()) {
487
                    filtered += " with category " + "'" + $("#categorycode_filter").find("option:selected").text() + "'";
488
                  } else {
489
                    filtered = " with category " + "'" + $("#categorycode_filter").find("option:selected").text() + "'";
490
                  }
491
             }
492
             if ( $("#branchcode_filter").val() ) {
493
                 if ( $("#searchmember_filter").val() || $("#firstletter_filter").val() ||  $("#categorycode_filter").val()) {
494
                    filtered += " in library " + $("#branchcode_filter").find("option:selected").text();
495
                 } else {
496
                    filtered = " in library " + $("#branchcode_filter").find("option:selected").text();
497
                 }
498
             }
499
500
             var searchevent;
501
             //Concatenate the searched and filtered messages into a single message 
502
             if (first_query != searchmember) {
503
                searchevent = searched + " filtered by " + filtered;
504
                $("#searchpattern").text(searchevent);
505
             } else {
506
                $("#searchpattern").text(searched);
507
             }
466
        }
508
        }
467
509
468
        // Redraw the table
510
        // Redraw the table
469
- 

Return to bug 20346