Bug 7280 - can't place hold without selecting on list
[koha.git] / admin / marctagstructure.pl
index acd8cd7..92e0d99 100755 (executable)
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 use strict;
+use warnings;
 use CGI;
 use C4::Auth;
 use C4::Koha;
@@ -117,12 +118,12 @@ if ($op eq 'add_form') {
        if ($searchfield) {
         $template->param(searchfield => $searchfield);
                $template->param(action => "Modify tag");
-               $template->param('heading-modify-tag-p' => 1);
+               $template->param('heading_modify_tag_p' => 1);
        } else {
                $template->param(action => "Add tag");
-               $template->param('heading-add-tag-p' => 1);
+               $template->param('heading_add_tag_p' => 1);
        }
-       $template->param('use-heading-flags-p' => 1);
+       $template->param('use_heading_flags_p' => 1);
        $template->param(liblibrarian => $data->{'liblibrarian'},
                        libopac => $data->{'libopac'},
                        repeatable => CGI::checkbox(-name=>'repeatable',
@@ -148,7 +149,7 @@ if ($op eq 'add_form') {
        my $repeatable       = $input->param('repeatable') ? 1 : 0;
        my $mandatory        = $input->param('mandatory')  ? 1 : 0;
        my $authorised_value = $input->param('authorised_value');
-    unless (C4::Context->config('demo') eq 1) {
+    unless (C4::Context->config('demo') == 1) {
         if ($input->param('modif')) {
             $sth = $dbh->prepare(
             "UPDATE marc_tag_structure SET liblibrarian=? ,libopac=? ,repeatable=? ,mandatory=? ,authorised_value=? WHERE frameworkcode=? AND tagfield=?"
@@ -193,7 +194,7 @@ if ($op eq 'add_form') {
 ################## DELETE_CONFIRMED ##################################
 # called by delete_confirm, used to effectively confirm deletion of data in DB
 } elsif ($op eq 'delete_confirmed') {
-       unless (C4::Context->config('demo') eq 1) {
+       unless (C4::Context->config('demo') == 1) {
         my $sth1 = $dbh->prepare("DELETE FROM marc_tag_structure      WHERE tagfield=? AND frameworkcode=?");
         my $sth2 = $dbh->prepare("DELETE FROM marc_subfield_structure WHERE tagfield=? AND frameworkcode=?");
         $sth1->execute($searchfield, $frameworkcode);
@@ -254,7 +255,7 @@ if ($op eq 'add_form') {
                my @loop_data = ();
                my $j=1;
                my $i=$offset;
-               while ($i < ($offset+$pagesize<$cnt?$offset+$pagesize:$cnt)) {
+        while ( $i < $cnt ) {
                        my %row_data;  # get a fresh hash for the row data
                        $row_data{tagfield}         = $results[$i]->{'mts_tagfield'};
                        $row_data{liblibrarian}     = $results[$i]->{'mts_liblibrarian'};
@@ -266,7 +267,7 @@ if ($op eq 'add_form') {
                        $row_data{delete}        = "$script_name?op=delete_confirm&amp;searchfield="      .$results[$i]->{'mts_tagfield'}."&amp;frameworkcode=".$frameworkcode;
                        $j=$i;
                        my @internal_loop = ();
-                       while (($results[$i]->{'tagfield'}==$results[$j]->{'tagfield'}) and ($j< ($offset+$pagesize<$cnt?$offset+$pagesize:$cnt))) {
+                       while ( ( $results[$i]->{'tagfield'} == $results[$j]->{'tagfield'} ) and ( $j < $cnt ) ) {
                                my %subfield_data;
                                $subfield_data{tagsubfield}      = $results[$j]->{'tagsubfield'};
                                $subfield_data{liblibrarian}     = $results[$j]->{'liblibrarian'};
@@ -293,7 +294,7 @@ if ($op eq 'add_form') {
                my ($count,$results)=StringSearch($searchfield,$frameworkcode);
                $cnt = $count;
                my @loop_data = ();
-               for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
+        for ( my $i = $offset ; $i < $count ; $i++ ) {
                        my %row_data;  # get a fresh hash for the row data
                        $row_data{tagfield}         = $results->[$i]{'tagfield'};
                        $row_data{liblibrarian}     = $results->[$i]{'liblibrarian'};