Disabled "use for print" if no paper given, catching error if those label was active

这个提交包含在:
int2001 2023-08-03 08:55:16 +00:00
父节点 85a2299322
当前提交 2824f31ac6
找不到此签名对应的密钥
GPG 密钥 ID: DFB1C13CD2DB037B
共有 2 个文件被更改,包括 31 次插入17 次删除

查看文件

@ -162,7 +162,7 @@ class Labels extends CI_Controller {
try {
if ($label) {
$ptype=$this->labels_model->getPaperType($label->paper_type_id); // fetch papersize out of paper-table
// var_dump($ptype);
if (($ptype->paper_id ?? '') != '') {
$pdf = new PDF_Label(array(
'paper-size' => 'custom', // $label->paper_type, // The only Type left is "custom" because A4 and so on are also defined at paper_types
'metric' => $label->metric,
@ -178,6 +178,16 @@ class Labels extends CI_Controller {
'pgX' => $ptype->width,
'pgY' => $ptype->height
));
} else {
if ($jscall) {
header('Content-Type: application/json');
echo json_encode(array('message' => 'You need to assign a paperType to the label before printing'));
return;
} else {
$this->session->set_flashdata('error', 'You need to assign a paperType to the label before printing');
redirect('labels');
}
}
} else {
if ($jscall) {
header('Content-Type: application/json');
@ -204,7 +214,7 @@ class Labels extends CI_Controller {
if ($label->font == 'DejaVuSans') { // leave this here, for future Use
$pdf->AddFont($label->font,'','DejaVuSansMono.ttf',true);
$pdf->SetFont($label->font);
$pdf->SetFont($label->font,'');
} else {
$pdf->AddFont($label->font);
$pdf->SetFont($label->font);

查看文件

@ -95,7 +95,11 @@
<td><?php echo $label->font_size; ?></td>
<td><?php echo $label->qsos; ?></td>
<td><?php echo $label->last_modified; ?></td>
<?php if (($label->paper_name ?? '') == '') { ?>
<td></td>
<?php } else { ?>
<td><input type="checkbox" <?php if ($label->useforprint == 1) {echo 'checked';}?>></td>
<?php } ?>
<td><a href="<?php echo site_url('labels/edit/' . $label->id); ?>" class="btn btn-outline-primary btn-sm"><i class="fas fa-edit"></i></a></td>
<td><a href="<?php echo site_url('labels/delete/' . $label->id); ?>" class="btn btn-outline-danger btn-sm"><i class="fas fa-trash-alt"></i></a></td>
</tr>