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

(-)a/C4/Creators/Lib.pm (-2 / +2 lines)
Lines 67-73 C4::Creators::Lib Link Here
67
67
68
sub _SELECT {
68
sub _SELECT {
69
    my @params = @_;
69
    my @params = @_;
70
    my $query = "SELECT $params[0] FROM $params[1]";
70
    my $query = "SELECT `$params[0]` FROM $params[1]";
71
    $params[2] ? $query .= " WHERE $params[2];" : $query .= ';';
71
    $params[2] ? $query .= " WHERE $params[2];" : $query .= ';';
72
    my $sth = C4::Context->dbh->prepare($query);
72
    my $sth = C4::Context->dbh->prepare($query);
73
#    $sth->{'TraceLevel'} = 3;
73
#    $sth->{'TraceLevel'} = 3;
Lines 145-151 my $output_formats = [ Link Here
145
sub _build_query {
145
sub _build_query {
146
    my ( $params, $table ) = @_;
146
    my ( $params, $table ) = @_;
147
    my @fields = exists $params->{fields} ? @{ $params->{fields} } : ();
147
    my @fields = exists $params->{fields} ? @{ $params->{fields} } : ();
148
    my $query = "SELECT " . ( @fields ? join(', ', @fields ) : '*' ) . " FROM $table";
148
    my $query = "SELECT " . ( @fields ? join(', ', map {"`$_`"} @fields ) : '*' ) . " FROM $table";
149
    my @where_args;
149
    my @where_args;
150
    if ( exists $params->{filters} ) {
150
    if ( exists $params->{filters} ) {
151
        $query .= ' WHERE 1 ';
151
        $query .= ' WHERE 1 ';
(-)a/installer/data/mysql/patroncards_upgrade.pl (-1 / +1 lines)
Lines 136-142 $sth->do("INSERT INTO `creator_batches_tmp` (label_id, batch_id, item_number, ti Link Here
136
136
137
$sth->do("INSERT INTO `creator_layouts_tmp` (layout_id, barcode_type, printing_type, layout_name, guidebox, callnum_split, text_justify, format_string) SELECT layout_id, barcode_type, printing_type, layout_name, guidebox, callnum_split, text_justify, format_string FROM labels_layouts;") or die "DB ERROR: " . $sth->errstr . "\n";
137
$sth->do("INSERT INTO `creator_layouts_tmp` (layout_id, barcode_type, printing_type, layout_name, guidebox, callnum_split, text_justify, format_string) SELECT layout_id, barcode_type, printing_type, layout_name, guidebox, callnum_split, text_justify, format_string FROM labels_layouts;") or die "DB ERROR: " . $sth->errstr . "\n";
138
138
139
$sth->do("INSERT INTO `creator_templates_tmp` (template_id, template_code, template_desc, page_width, page_height, label_width, label_height, top_margin, left_margin, cols, rows, col_gap, row_gap, units) SELECT template_id, template_code, template_desc, page_width, page_height, label_width, label_height, top_margin, left_margin, cols, rows, col_gap, row_gap, units FROM labels_templates;") or die "DB ERROR: " . $sth->errstr . "\n";
139
$sth->do("INSERT INTO `creator_templates_tmp` (template_id, template_code, template_desc, page_width, page_height, label_width, label_height, top_margin, left_margin, cols, `rows`, col_gap, row_gap, units) SELECT template_id, template_code, template_desc, page_width, page_height, label_width, label_height, top_margin, left_margin, cols, `rows`, col_gap, row_gap, units FROM labels_templates;") or die "DB ERROR: " . $sth->errstr . "\n";
140
140
141
# Drop old tables....
141
# Drop old tables....
142
142
(-)a/t/db_dependent/Creators/Lib.t (-3 / +2 lines)
Lines 87-93 my $query = ' Link Here
87
     (profile_id      , template_code, template_desc, page_width,
87
     (profile_id      , template_code, template_desc, page_width,
88
      page_height     , label_width  , label_height , top_text_margin,
88
      page_height     , label_width  , label_height , top_text_margin,
89
      left_text_margin, top_margin   , left_margin  , cols,
89
      left_text_margin, top_margin   , left_margin  , cols,
90
      rows            , col_gap      , row_gap      , units,
90
      `rows`            , col_gap      , row_gap      , units,
91
      creator)
91
      creator)
92
  VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)';
92
  VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)';
93
my $insert_sth = $dbh->prepare($query);
93
my $insert_sth = $dbh->prepare($query);
Lines 369-375 $templates = get_all_templates( { filters => { rows => 7} } ); Link Here
369
$query = '
369
$query = '
370
  SELECT count(*)
370
  SELECT count(*)
371
  FROM   creator_templates
371
  FROM   creator_templates
372
  WHERE  rows = 7
372
  WHERE  `rows` = 7
373
  ';
373
  ';
374
$count = $dbh->selectrow_array($query);
374
$count = $dbh->selectrow_array($query);
375
is( $count,      1,      'There is 1 template matching' );
375
is( $count,      1,      'There is 1 template matching' );
376
- 

Return to bug 21281