FIX Debug setup of receipt printer module
This commit is contained in:
parent
255dc71823
commit
d4e21538db
@ -65,13 +65,13 @@ if (!function_exists('gzdecode')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'addprinter' && $user->admin) {
|
if ($action == 'addprinter' && $user->admin) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
|
||||||
if (empty($printername)) {
|
if (empty($printername)) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("PrinterNameEmpty"), null, 'errors');
|
setEventMessages($langs->trans("PrinterNameEmpty"), null, 'errors');
|
||||||
@ -82,6 +82,7 @@ if ($action == 'addprinter' && $user->admin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
|
$db->begin();
|
||||||
$result = $printer->addPrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter);
|
$result = $printer->addPrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter);
|
||||||
if ($result > 0) $error++;
|
if ($result > 0) $error++;
|
||||||
|
|
||||||
@ -101,13 +102,13 @@ if ($action == 'addprinter' && $user->admin) {
|
|||||||
|
|
||||||
if ($action == 'deleteprinter' && $user->admin) {
|
if ($action == 'deleteprinter' && $user->admin) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
|
||||||
if (empty($printerid)) {
|
if (empty($printerid)) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
|
$db->begin();
|
||||||
$result = $printer->deletePrinter($printerid);
|
$result = $printer->deletePrinter($printerid);
|
||||||
if ($result > 0) $error++;
|
if ($result > 0) $error++;
|
||||||
|
|
||||||
@ -127,13 +128,13 @@ if ($action == 'deleteprinter' && $user->admin) {
|
|||||||
|
|
||||||
if ($action == 'updateprinter' && $user->admin) {
|
if ($action == 'updateprinter' && $user->admin) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
|
||||||
if (empty($printerid)) {
|
if (empty($printerid)) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
|
$db->begin();
|
||||||
$result = $printer->updatePrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter, $printerid);
|
$result = $printer->updatePrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter, $printerid);
|
||||||
if ($result > 0) $error++;
|
if ($result > 0) $error++;
|
||||||
|
|
||||||
@ -193,13 +194,13 @@ if ($action == 'testtemplate' && $user->admin) {
|
|||||||
|
|
||||||
if ($action == 'updatetemplate' && $user->admin) {
|
if ($action == 'updatetemplate' && $user->admin) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
|
||||||
if (empty($templateid)) {
|
if (empty($templateid)) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("TemplateIdEmpty"), null, 'errors');
|
setEventMessages($langs->trans("TemplateIdEmpty"), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
|
$db->begin();
|
||||||
$result = $printer->updateTemplate($templatename, $template, $templateid);
|
$result = $printer->updateTemplate($templatename, $template, $templateid);
|
||||||
if ($result > 0) $error++;
|
if ($result > 0) $error++;
|
||||||
|
|
||||||
@ -216,13 +217,13 @@ if ($action == 'updatetemplate' && $user->admin) {
|
|||||||
|
|
||||||
if ($action == 'addtemplate' && $user->admin) {
|
if ($action == 'addtemplate' && $user->admin) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
|
||||||
if (empty($templatename)) {
|
if (empty($templatename)) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("TemplateNameEmpty"), null, 'errors');
|
setEventMessages($langs->trans("TemplateNameEmpty"), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
|
$db->begin();
|
||||||
$result = $printer->addTemplate($templatename, $template);
|
$result = $printer->addTemplate($templatename, $template);
|
||||||
if ($result > 0) $error++;
|
if ($result > 0) $error++;
|
||||||
|
|
||||||
@ -237,6 +238,29 @@ if ($action == 'addtemplate' && $user->admin) {
|
|||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($action == 'deletetemplate' && $user->admin) {
|
||||||
|
$error = 0;
|
||||||
|
if (empty($templateid)) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("TemplateIdEmpty"), null, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
$db->begin();
|
||||||
|
$result = $printer->deleteTemplate($templateid);
|
||||||
|
if ($result > 0) $error++;
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
$db->commit();
|
||||||
|
setEventMessages($langs->trans("TemplateDeleted", $templatename), null);
|
||||||
|
} else {
|
||||||
|
$db->rollback();
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$action = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -251,6 +275,7 @@ print load_fiche_titre($langs->trans("ReceiptPrinterSetup"), $linkback, 'title_s
|
|||||||
|
|
||||||
$head = receiptprinteradmin_prepare_head($mode);
|
$head = receiptprinteradmin_prepare_head($mode);
|
||||||
|
|
||||||
|
// mode = config
|
||||||
if ($mode == 'config' && $user->admin) {
|
if ($mode == 'config' && $user->admin) {
|
||||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=config" autocomplete="off">';
|
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=config" autocomplete="off">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
@ -263,7 +288,7 @@ if ($mode == 'config' && $user->admin) {
|
|||||||
|
|
||||||
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), -1, 'technic');
|
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), -1, 'technic');
|
||||||
|
|
||||||
print $langs->trans("ReceiptPrinterDesc")."<br><br>\n";
|
print '<span class="opacitymedium">'.$langs->trans("ReceiptPrinterDesc")."</span><br><br>\n";
|
||||||
|
|
||||||
print '<table class="noborder centpercent">'."\n";
|
print '<table class="noborder centpercent">'."\n";
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -276,6 +301,22 @@ if ($mode == 'config' && $user->admin) {
|
|||||||
$ret = $printer->listprinters();
|
$ret = $printer->listprinters();
|
||||||
$nbofprinters = count($printer->listprinters);
|
$nbofprinters = count($printer->listprinters);
|
||||||
|
|
||||||
|
if ($action != 'editprinter') {
|
||||||
|
print '<tr>';
|
||||||
|
print '<td><input size="50" type="text" name="printername"></td>';
|
||||||
|
$ret = $printer->selectTypePrinter();
|
||||||
|
print '<td>'.$printer->resprint.'</td>';
|
||||||
|
$ret = $printer->selectProfilePrinter();
|
||||||
|
print '<td>'.$printer->profileresprint.'</td>';
|
||||||
|
print '<td><input size="60" type="text" name="parameter"></td>';
|
||||||
|
print '<td class="right">';
|
||||||
|
if ($action != 'editprinter') {
|
||||||
|
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
if ($ret > 0) {
|
if ($ret > 0) {
|
||||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
@ -289,7 +330,9 @@ if ($mode == 'config' && $user->admin) {
|
|||||||
$ret = $printer->selectProfilePrinter($printer->listprinters[$line]['fk_profile']);
|
$ret = $printer->selectProfilePrinter($printer->listprinters[$line]['fk_profile']);
|
||||||
print '<td>'.$printer->profileresprint.'</td>';
|
print '<td>'.$printer->profileresprint.'</td>';
|
||||||
print '<td><input size="60" type="text" name="parameter" value="'.$printer->listprinters[$line]['parameter'].'"></td>';
|
print '<td><input size="60" type="text" name="parameter" value="'.$printer->listprinters[$line]['parameter'].'"></td>';
|
||||||
print '<td></td>';
|
print '<td>';
|
||||||
|
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
||||||
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
} else {
|
} else {
|
||||||
print '<td>'.$printer->listprinters[$line]['name'].'</td>';
|
print '<td>'.$printer->listprinters[$line]['name'].'</td>';
|
||||||
@ -297,15 +340,15 @@ if ($mode == 'config' && $user->admin) {
|
|||||||
print '<td>'.$langs->trans($printer->listprinters[$line]['fk_profile_name']).'</td>';
|
print '<td>'.$langs->trans($printer->listprinters[$line]['fk_profile_name']).'</td>';
|
||||||
print '<td>'.$printer->listprinters[$line]['parameter'].'</td>';
|
print '<td>'.$printer->listprinters[$line]['parameter'].'</td>';
|
||||||
// edit icon
|
// edit icon
|
||||||
print '<td><a href="'.$_SERVER['PHP_SELF'].'?mode=config&action=editprinter&printerid='.$printer->listprinters[$line]['rowid'].'">';
|
print '<td class="right"><a class="editfielda marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&action=editprinter&printerid='.$printer->listprinters[$line]['rowid'].'">';
|
||||||
print img_picto($langs->trans("Edit"), 'edit');
|
print img_picto($langs->trans("Edit"), 'edit');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
// delete icon
|
// delete icon
|
||||||
print '<a href="'.$_SERVER['PHP_SELF'].'?mode=config&action=deleteprinter&printerid='.$printer->listprinters[$line]['rowid'].'&printername='.$printer->listprinters[$line]['name'].'">';
|
print '<a class="marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&action=deleteprinter&printerid='.$printer->listprinters[$line]['rowid'].'&printername='.$printer->listprinters[$line]['name'].'">';
|
||||||
print img_picto($langs->trans("Delete"), 'delete');
|
print img_picto($langs->trans("Delete"), 'delete');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
// test icon
|
// test icon
|
||||||
print '<a href="'.$_SERVER['PHP_SELF'].'?mode=config&action=testprinter&printerid='.$printer->listprinters[$line]['rowid'].'&printername='.$printer->listprinters[$line]['name'].'">';
|
print '<a class="marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&action=testprinter&printerid='.$printer->listprinters[$line]['rowid'].'&printername='.$printer->listprinters[$line]['name'].'">';
|
||||||
print img_picto($langs->trans("TestPrinter"), 'printer');
|
print img_picto($langs->trans("TestPrinter"), 'printer');
|
||||||
print '</a></td>';
|
print '</a></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -313,38 +356,10 @@ if ($mode == 'config' && $user->admin) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action != 'editprinter') {
|
|
||||||
if ($nbofprinters > 0) {
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<th>'.$langs->trans("Name").'</th>';
|
|
||||||
print '<th>'.$langs->trans("Type").'</th>';
|
|
||||||
print '<th>'.$langs->trans("Profile").'</th>';
|
|
||||||
print '<th>'.$langs->trans("Parameters").'</th>';
|
|
||||||
print '<th></th>';
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<tr>';
|
|
||||||
print '<td><input size="50" type="text" name="printername"></td>';
|
|
||||||
$ret = $printer->selectTypePrinter();
|
|
||||||
print '<td>'.$printer->resprint.'</td>';
|
|
||||||
$ret = $printer->selectProfilePrinter();
|
|
||||||
print '<td>'.$printer->profileresprint.'</td>';
|
|
||||||
print '<td><input size="60" type="text" name="parameter"></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
if ($action != 'editprinter') {
|
|
||||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
|
|
||||||
} else {
|
|
||||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
|
||||||
}
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -374,6 +389,7 @@ if ($mode == 'config' && $user->admin) {
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// mode = template
|
||||||
if ($mode == 'template' && $user->admin) {
|
if ($mode == 'template' && $user->admin) {
|
||||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=template" autocomplete="off">';
|
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=template" autocomplete="off">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
@ -383,16 +399,13 @@ if ($mode == 'template' && $user->admin) {
|
|||||||
print '<input type="hidden" name="action" value="updatetemplate">';
|
print '<input type="hidden" name="action" value="updatetemplate">';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print load_fiche_titre($langs->trans("ReceiptPrinterTemplateDesc"), '', '');
|
||||||
print load_fiche_titre($langs->trans("ReceiptPrinterTemplateDesc"), '', '')."<br><br>\n";
|
|
||||||
|
|
||||||
print '<table class="noborder centpercent">'."\n";
|
print '<table class="noborder centpercent">'."\n";
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<th>'.$langs->trans("Name").'</th>';
|
print '<th>'.$langs->trans("Name").'</th>';
|
||||||
print '<th>'.$langs->trans("Template").'</th>';
|
print '<th>'.$langs->trans("Template").'</th>';
|
||||||
print '<th></th>';
|
print '<th></th>';
|
||||||
print '<th></th>';
|
|
||||||
print '<th></th>';
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$ret = $printer->listPrintersTemplates();
|
$ret = $printer->listPrintersTemplates();
|
||||||
//print '<pre>'.print_r($printer->listprinterstemplates, true).'</pre>';
|
//print '<pre>'.print_r($printer->listprinterstemplates, true).'</pre>';
|
||||||
@ -405,22 +418,23 @@ if ($mode == 'template' && $user->admin) {
|
|||||||
if ($action == 'edittemplate' && $printer->listprinterstemplates[$line]['rowid'] == $templateid) {
|
if ($action == 'edittemplate' && $printer->listprinterstemplates[$line]['rowid'] == $templateid) {
|
||||||
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
|
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
|
||||||
print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>';
|
print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>';
|
||||||
print '<td><textarea name="template" wrap="soft" cols="120" rows="12">'.$printer->listprinterstemplates[$line]['template'].'</textarea>';
|
print '<td>';
|
||||||
|
print '<textarea name="template" wrap="soft" cols="120" rows="12">'.$printer->listprinterstemplates[$line]['template'].'</textarea>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
} else {
|
} else {
|
||||||
print '<td>'.$printer->listprinterstemplates[$line]['name'].'</td>';
|
print '<td>'.$printer->listprinterstemplates[$line]['name'].'</td>';
|
||||||
print '<td>'.nl2br(htmlentities($printer->listprinterstemplates[$line]['template'])).'</td>';
|
print '<td>'.nl2br(htmlentities($printer->listprinterstemplates[$line]['template'])).'</td>';
|
||||||
// edit icon
|
// edit icon
|
||||||
print '<td><a class="editfielda paddingleftonly paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=edittemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'">';
|
print '<td><a class="editfielda paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=edittemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'">';
|
||||||
print img_picto($langs->trans("Edit"), 'edit');
|
print img_picto($langs->trans("Edit"), 'edit');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
// delete icon
|
// delete icon
|
||||||
print '<a class="paddingleftonly paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=deletetemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&templatename='.$printer->listprinterstemplates[$line]['name'].'">';
|
print '<a class="paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=deletetemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&templatename='.$printer->listprinterstemplates[$line]['name'].'">';
|
||||||
print img_picto($langs->trans("Delete"), 'delete');
|
print img_picto($langs->trans("Delete"), 'delete');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
// test icon
|
// test icon
|
||||||
print '<a class="paddingleftonly paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=testtemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&templatename='.$printer->listprinterstemplates[$line]['name'].'">';
|
print '<a class="paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=testtemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&templatename='.$printer->listprinterstemplates[$line]['name'].'">';
|
||||||
print img_picto($langs->trans("TestPrinterTemplate"), 'printer');
|
print img_picto($langs->trans("TestPrinterTemplate"), 'printer');
|
||||||
print '</a></td>';
|
print '</a></td>';
|
||||||
}
|
}
|
||||||
@ -428,14 +442,22 @@ if ($mode == 'template' && $user->admin) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
if ($action != 'edittemplate') {
|
if ($action != 'edittemplate') {
|
||||||
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
|
print '<tr>';
|
||||||
print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>';
|
print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>';
|
||||||
print '<td><textarea name="template" wrap="soft" cols="120" rows="12">'.$printer->listprinterstemplates[$line]['template'].'</textarea>';
|
print '<td>';
|
||||||
|
print '<textarea name="template" wrap="soft" cols="120" rows="12">';
|
||||||
|
print GETPOSTISSET('template') ? GETPOST('template', 'alpha') : $printer->listprinterstemplates[$line]['template'];
|
||||||
|
print '</textarea>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
if ($action != 'edittemplate') {
|
||||||
|
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
|
||||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
|
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
|
||||||
} else {
|
} else {
|
||||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
||||||
|
|||||||
@ -468,6 +468,26 @@ class dolReceiptPrinter extends Printer
|
|||||||
return $error;
|
return $error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to delete a printer template in db
|
||||||
|
*
|
||||||
|
* @param int $templateid Template ID
|
||||||
|
* @return int 0 if OK; >0 if KO
|
||||||
|
*/
|
||||||
|
public function deleteTemplate($templateid)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
$error = 0;
|
||||||
|
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'printer_receipt_template';
|
||||||
|
$sql .= " WHERE rowid = ".((int) $this->db->escape($templateid));
|
||||||
|
$sql .= " AND entity = ".$conf->entity;
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (!$resql) {
|
||||||
|
$error++;
|
||||||
|
$this->errors[] = $this->db->lasterror;
|
||||||
|
}
|
||||||
|
return $error;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to Update a printer template in db
|
* Function to Update a printer template in db
|
||||||
|
|||||||
@ -2008,3 +2008,6 @@ RssNote=Note: Each RSS feed definition provides a widget that you must enable to
|
|||||||
JumpToBoxes=Jump to Setup -> Widgets
|
JumpToBoxes=Jump to Setup -> Widgets
|
||||||
MeasuringUnitTypeDesc=Use here a value like "size", "surface", "volume", "weight", "time"
|
MeasuringUnitTypeDesc=Use here a value like "size", "surface", "volume", "weight", "time"
|
||||||
MeasuringScaleDesc=The scale is the number of places you have to move the decimal part to match the default reference unit. For "time" unit type, it is the number of seconds. Values between 80 and 99 are reserved values.
|
MeasuringScaleDesc=The scale is the number of places you have to move the decimal part to match the default reference unit. For "time" unit type, it is the number of seconds. Values between 80 and 99 are reserved values.
|
||||||
|
TemplateAdded=Template added
|
||||||
|
TemplateUpdated=Template updated
|
||||||
|
TemplateDeleted=Template deleted
|
||||||
Loading…
Reference in New Issue
Block a user