2
0
forked from Wavyzz/dolibarr

Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/core/class/extrafields.class.php
	htdocs/core/class/html.form.class.php
	htdocs/langs/en_US/cashdesk.lang
	htdocs/product/stock/list.php
This commit is contained in:
Laurent Destailleur
2020-08-02 16:06:51 +02:00
20 changed files with 214 additions and 129 deletions

View File

@@ -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++;
@@ -99,13 +100,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++;
@@ -123,13 +124,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++;
@@ -189,13 +190,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++;
@@ -212,13 +213,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++;
@@ -233,6 +234,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
@@ -247,6 +271,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().'">';
@@ -259,7 +284,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">';
@@ -272,6 +297,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 {
@@ -285,7 +326,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>';
@@ -293,15 +336,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&amp;action=editprinter&amp;printerid='.$printer->listprinters[$line]['rowid'].'">'; print '<td class="right"><a class="editfielda marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&amp;action=editprinter&amp;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&amp;action=deleteprinter&amp;printerid='.$printer->listprinters[$line]['rowid'].'&amp;printername='.$printer->listprinters[$line]['name'].'">'; print '<a class="marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&amp;action=deleteprinter&amp;printerid='.$printer->listprinters[$line]['rowid'].'&amp;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&amp;action=testprinter&amp;printerid='.$printer->listprinters[$line]['rowid'].'&amp;printername='.$printer->listprinters[$line]['name'].'">'; print '<a class="marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&amp;action=testprinter&amp;printerid='.$printer->listprinters[$line]['rowid'].'&amp;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>';
@@ -309,38 +352,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>';
@@ -370,7 +385,11 @@ if ($mode == 'config' && $user->admin) {
print '</table>'; print '</table>';
} }
// mode = template
if ($mode == 'template' && $user->admin) { if ($mode == 'template' && $user->admin) {
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), -1, 'technic');
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().'">';
if ($action != 'edittemplate') { if ($action != 'edittemplate') {
@@ -379,16 +398,11 @@ 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"), '', '')."<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>';
@@ -401,22 +415,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&amp;action=edittemplate&amp;templateid='.$printer->listprinterstemplates[$line]['rowid'].'">'; print '<td><a class="editfielda paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&amp;action=edittemplate&amp;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&amp;action=deletetemplate&amp;templateid='.$printer->listprinterstemplates[$line]['rowid'].'&amp;templatename='.$printer->listprinterstemplates[$line]['name'].'">'; print '<a class="paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&amp;action=deletetemplate&amp;templateid='.$printer->listprinterstemplates[$line]['rowid'].'&amp;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&amp;action=testtemplate&amp;templateid='.$printer->listprinterstemplates[$line]['rowid'].'&amp;templatename='.$printer->listprinterstemplates[$line]['name'].'">'; print '<a class="paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&amp;action=testtemplate&amp;templateid='.$printer->listprinterstemplates[$line]['rowid'].'&amp;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>';
} }
@@ -424,20 +439,30 @@ 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>';
} }
print '</form>'; print '</form>';
dol_fiche_end();
print '<br>'; print '<br>';
print '<table class="noborder centpercent">'."\n"; print '<table class="noborder centpercent">'."\n";

View File

@@ -130,7 +130,7 @@ if ($object->id > 0)
// Object card // Object card
// ------------------------------------------------------------ // ------------------------------------------------------------
$linkback = '<a href="'.dol_buildpath('/bom/myobject_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.dol_buildpath('/bom/bom_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">'; $morehtmlref = '<div class="refidno">';
/* /*

View File

@@ -86,7 +86,11 @@ if (empty($reshook))
$res = $object->delete($user); $res = $object->delete($user);
if ($res > 0) if ($res > 0)
{ {
header("Location: index.php"); if ($object->type == 'bank-transfer') {
header("Location: ".DOL_URL_ROOT.'/compta/paymentbybanktransfer/index.php');
} else {
header("Location: ".DOL_URL_ROOT.'/compta/prelevement/index.php');
}
exit; exit;
} }
} }

View File

@@ -206,7 +206,7 @@ if ($action == "update_extras" && !empty($permissiontoadd))
$object->array_options['options_'.$attributekey] = dol_mktime(GETPOST($attributekeylong.'hour', 'int'), GETPOST($attributekeylong.'min', 'int'), GETPOST($attributekeylong.'sec', 'int'), GETPOST($attributekeylong.'month', 'int'), GETPOST($attributekeylong.'day', 'int'), GETPOST($attributekeylong.'year', 'int')); $object->array_options['options_'.$attributekey] = dol_mktime(GETPOST($attributekeylong.'hour', 'int'), GETPOST($attributekeylong.'min', 'int'), GETPOST($attributekeylong.'sec', 'int'), GETPOST($attributekeylong.'month', 'int'), GETPOST($attributekeylong.'day', 'int'), GETPOST($attributekeylong.'year', 'int'));
//var_dump(dol_print_date($object->array_options['options_'.$attributekey]));exit; //var_dump(dol_print_date($object->array_options['options_'.$attributekey]));exit;
} else { } else {
$object->array_options['options_'.$attributekey] = GETPOST($attributekeylong, ' alpha'); $object->array_options['options_'.$attributekey] = GETPOST($attributekeylong, 'alpha');
} }
$result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user); $result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user);

View File

@@ -7611,18 +7611,17 @@ abstract class CommonObject
$now = dol_now(); $now = dol_now();
$fieldvalues = $this->setSaveQuery(); $fieldvalues = $this->setSaveQuery();
if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) $fieldvalues['date_creation'] = $this->db->idate($now); if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) $fieldvalues['date_creation'] = $this->db->idate($now);
if (array_key_exists('fk_user_creat', $fieldvalues) && !($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat'] = $user->id; if (array_key_exists('fk_user_creat', $fieldvalues) && !($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat'] = $user->id;
unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert. unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert.
if (array_key_exists('ref', $fieldvalues)) $fieldvalues['ref'] = dol_string_nospecial($fieldvalues['ref']); // If field is a ref, we sanitize data if (array_key_exists('ref', $fieldvalues)) $fieldvalues['ref'] = dol_string_nospecial($fieldvalues['ref']); // If field is a ref, we sanitize data
$keys = array(); $keys = array();
$values = array(); $values = array(); // Array to store string forged for SQL syntax
foreach ($fieldvalues as $k => $v) { foreach ($fieldvalues as $k => $v) {
$keys[$k] = $k; $keys[$k] = $k;
$value = $this->fields[$k]; $value = $this->fields[$k];
$values[$k] = $this->quote($v, $value); $values[$k] = $this->quote($v, $value); // May return string 'NULL' if $value is null
} }
// Clean and check mandatory // Clean and check mandatory
@@ -7632,8 +7631,7 @@ abstract class CommonObject
if (preg_match('/^integer:/i', $this->fields[$key]['type']) && $values[$key] == '-1') $values[$key] = ''; if (preg_match('/^integer:/i', $this->fields[$key]['type']) && $values[$key] == '-1') $values[$key] = '';
if (!empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key] = ''; if (!empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key] = '';
//var_dump($key.'-'.$values[$key].'-'.($this->fields[$key]['notnull'] == 1)); if (isset($this->fields[$key]['notnull']) && $this->fields[$key]['notnull'] == 1 && (!isset($values[$key]) || $values[$key] === 'NULL') && is_null($this->fields[$key]['default']))
if (isset($this->fields[$key]['notnull']) && $this->fields[$key]['notnull'] == 1 && !isset($values[$key]) && is_null($this->fields[$key]['default']))
{ {
$error++; $error++;
$this->errors[] = $langs->trans("ErrorFieldRequired", $this->fields[$key]['label']); $this->errors[] = $langs->trans("ErrorFieldRequired", $this->fields[$key]['label']);

View File

@@ -467,6 +467,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

View File

@@ -154,8 +154,8 @@ class ExtraFields
public static $type2label = array( public static $type2label = array(
'varchar'=>'String', 'varchar'=>'String1Line',
'text'=>'TextLong', 'text'=>'TextLongNLines',
'html'=>'HtmlText', 'html'=>'HtmlText',
'int'=>'Int', 'int'=>'Int',
'double'=>'Float', 'double'=>'Float',
@@ -2025,6 +2025,8 @@ class ExtraFields
$value_key = price2num($value_arr); $value_key = price2num($value_arr);
} elseif (in_array($key_type, array('html'))) { } elseif (in_array($key_type, array('html'))) {
$value_key = GETPOST("options_".$key, 'alpha'); $value_key = GETPOST("options_".$key, 'alpha');
} elseif (in_array($key_type, array('text'))) {
$value_key = GETPOST("options_".$key, 'alphanohtml');
} else { } else {
$value_key = GETPOST("options_".$key); $value_key = GETPOST("options_".$key);
if (in_array($key_type, array('link')) && $value_key == '-1') $value_key = ''; if (in_array($key_type, array('link')) && $value_key == '-1') $value_key = '';

View File

@@ -2641,9 +2641,9 @@ class Form
$outval .= ' - '.$langs->transnoentities("VirtualStock").':'; $outval .= ' - '.$langs->transnoentities("VirtualStock").':';
if ($virtualstock > 0) { if ($virtualstock > 0) {
$outval .= ' - <span class="product_line_stock_ok">'; $outval .= '<span class="product_line_stock_ok">';
} elseif ($virtualstock <= 0) { } elseif ($virtualstock <= 0) {
$outval .= ' - <span class="product_line_stock_too_low">'; $outval .= '<span class="product_line_stock_too_low">';
} }
$outval .= $virtualstock; $outval .= $virtualstock;
$outval .= '</span>'; $outval .= '</span>';

View File

@@ -591,7 +591,7 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
// '"' is dangerous because param in url can close the href= or src= and add javascript functions. // '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals // '../' is dangerous because it allows dir transversals
$out = str_replace(array('"', '../'), '', trim($out)); $out = str_replace(array('"', '../'), '', trim($out));
$out = dol_string_nohtmltag($out, 1); $out = dol_string_nohtmltag($out, 0);
} }
break; break;
case 'restricthtml': // Recommended for most html textarea case 'restricthtml': // Recommended for most html textarea

View File

@@ -239,7 +239,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
!empty($user->rights->supplier_proposal->lire) || !empty($user->rights->supplier_proposal->lire) ||
!empty($user->rights->supplier_order->lire) || !empty($user->rights->supplier_order->lire) ||
!empty($user->rights->contrat->lire) || !empty($user->rights->contrat->lire) ||
!empty($user->rights->ficheinter->lire) !empty($user->rights->ficheinter->lire) ||
!empty($user->rights->supplier_order->lire) ||
!empty($user->rights->fournisseur->commande->lire)
), ),
'module'=>'propal|commande|supplier_proposal|supplier_order|contrat|ficheinter' 'module'=>'propal|commande|supplier_proposal|supplier_order|contrat|ficheinter'
); );

View File

@@ -185,8 +185,10 @@ if ((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_a
?> ?>
<!-- Label --> <!-- Label -->
<tr><td class="titlefield fieldrequired"><?php echo $langs->trans("LabelOrTranslationKey"); ?></td><td class="valeur"><input type="text" name="label" size="40" value="<?php echo $label; ?>"></td></tr> <tr><td class="titlefield fieldrequired"><?php echo $langs->trans("LabelOrTranslationKey"); ?></td><td class="valeur"><input type="text" name="label" size="40" value="<?php echo $label; ?>"></td></tr>
<!-- Code --> <!-- Code -->
<tr><td class="fieldrequired"><?php echo $langs->trans("AttributeCode"); ?></td><td class="valeur"><?php echo $attrname; ?></td></tr> <tr><td class="fieldrequired"><?php echo $langs->trans("AttributeCode"); ?></td><td class="valeur"><?php echo $attrname; ?></td></tr>
<!-- Type --> <!-- Type -->
<tr><td class="fieldrequired"><?php echo $langs->trans("Type"); ?></td><td class="valeur"> <tr><td class="fieldrequired"><?php echo $langs->trans("Type"); ?></td><td class="valeur">
<?php <?php
@@ -203,6 +205,10 @@ $typewecanchangeinto = array(
'phone'=>array('varchar', 'phone', 'mail', 'url', 'select'), 'phone'=>array('varchar', 'phone', 'mail', 'url', 'select'),
'select'=>array('varchar', 'phone', 'mail', 'url', 'select') 'select'=>array('varchar', 'phone', 'mail', 'url', 'select')
); );
/* Disabled because text is text on several lines, when varchar is text on 1 line, we should not be able to convert
if ($size <= 255 && in_array($type, array('text', 'html'))) {
$typewecanchangeinto['text'][] = 'varchar';
}*/
if (in_array($type, array_keys($typewecanchangeinto))) if (in_array($type, array_keys($typewecanchangeinto)))
{ {
@@ -222,8 +228,10 @@ if (in_array($type, array_keys($typewecanchangeinto)))
} }
?> ?>
</td></tr> </td></tr>
<!-- Size --> <!-- Size -->
<tr class="extra_size"><td class="fieldrequired"><?php echo $langs->trans("Size"); ?></td><td><input id="size" type="text" name="size" size="5" value="<?php echo $size; ?>"></td></tr> <tr class="extra_size"><td class="fieldrequired"><?php echo $langs->trans("Size"); ?></td><td><input id="size" type="text" name="size" size="5" value="<?php echo $size; ?>"></td></tr>
<!-- Value (for some fields like password, select list, radio, ...) --> <!-- Value (for some fields like password, select list, radio, ...) -->
<tr id="value_choice"> <tr id="value_choice">
<td> <td>
@@ -244,33 +252,44 @@ if (in_array($type, array_keys($typewecanchangeinto)))
</table> </table>
</td> </td>
</tr> </tr>
<!-- Position --> <!-- Position -->
<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo dol_escape_htmltag($pos); ?>"></td></tr> <tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo dol_escape_htmltag($pos); ?>"></td></tr>
<!-- Language file --> <!-- Language file -->
<tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag($langfile); ?>"></td></tr> <tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag($langfile); ?>"></td></tr>
<!-- Computed value --> <!-- Computed value -->
<?php if (empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) { ?> <?php if (empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) { ?>
<tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?></td><td class="valeur"><input id="computed_value" class="quatrevingtpercent" type="text" name="computed_value" value="<?php echo dol_escape_htmltag($computed); ?>"></td></tr> <tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?></td><td class="valeur"><input id="computed_value" class="quatrevingtpercent" type="text" name="computed_value" value="<?php echo dol_escape_htmltag($computed); ?>"></td></tr>
<?php } else { ?> <?php } else { ?>
<tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc")).$form->textwithpicto($langs->trans("Computedpersistent"), $langs->trans("ComputedpersistentDesc"), 1, 'warning'); ?></td><td class="valeur"><input id="computed_value" class="quatrevingtpercent" type="text" name="computed_value" value="<?php echo dol_escape_htmltag($computed); ?>"></td></tr> <tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc")).$form->textwithpicto($langs->trans("Computedpersistent"), $langs->trans("ComputedpersistentDesc"), 1, 'warning'); ?></td><td class="valeur"><input id="computed_value" class="quatrevingtpercent" type="text" name="computed_value" value="<?php echo dol_escape_htmltag($computed); ?>"></td></tr>
<?php } ?> <?php } ?>
<!-- Default Value (at sql setup level) --> <!-- Default Value (at sql setup level) -->
<tr class="extra_default_value"><td><?php echo $langs->trans("DefaultValue").' ('.$langs->trans("Database").')'; ?></td><td class="valeur"><input id="default_value" type="text" name="default_value" size="5" value="<?php echo dol_escape_htmltag($default); ?>"></td></tr> <tr class="extra_default_value"><td><?php echo $langs->trans("DefaultValue").' ('.$langs->trans("Database").')'; ?></td><td class="valeur"><input id="default_value" type="text" name="default_value" size="5" value="<?php echo dol_escape_htmltag($default); ?>"></td></tr>
<!-- Unique --> <!-- Unique -->
<tr class="extra_unique"><td><?php echo $langs->trans("Unique"); ?></td><td class="valeur"><input id="unique" type="checkbox" name="unique"<?php echo ($unique ? ' checked' : ''); ?>></td></tr> <tr class="extra_unique"><td><?php echo $langs->trans("Unique"); ?></td><td class="valeur"><input id="unique" type="checkbox" name="unique"<?php echo ($unique ? ' checked' : ''); ?>></td></tr>
<!-- Required --> <!-- Required -->
<tr class="extra_required"><td><?php echo $langs->trans("Required"); ?></td><td class="valeur"><input id="required" type="checkbox" name="required"<?php echo ($required ? ' checked' : ''); ?>></td></tr> <tr class="extra_required"><td><?php echo $langs->trans("Required"); ?></td><td class="valeur"><input id="required" type="checkbox" name="required"<?php echo ($required ? ' checked' : ''); ?>></td></tr>
<!-- Always editable --> <!-- Always editable -->
<tr class="extra_alwayseditable"><td><?php echo $langs->trans("AlwaysEditable"); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable"<?php echo ($alwayseditable ? ' checked' : ''); ?>></td></tr> <tr class="extra_alwayseditable"><td><?php echo $langs->trans("AlwaysEditable"); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable"<?php echo ($alwayseditable ? ' checked' : ''); ?>></td></tr>
<!-- Visibility --> <!-- Visibility -->
<tr><td class="extra_list"><?php echo $form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc")); ?> <tr><td class="extra_list"><?php echo $form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc")); ?>
</td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo ($list != '' ? $list : '1'); ?>"></td></tr> </td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo ($list != '' ? $list : '1'); ?>"></td></tr>
<!-- Visibility for PDF--> <!-- Visibility for PDF-->
<tr><td class="extra_pdf"><?php echo $form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")); ?> <tr><td class="extra_pdf"><?php echo $form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")); ?>
</td><td class="valeur"><input id="printable" class="minwidth100" type="text" name="printable" value="<?php echo dol_escape_htmltag($printable); ?>"></td></tr> </td><td class="valeur"><input id="printable" class="minwidth100" type="text" name="printable" value="<?php echo dol_escape_htmltag($printable); ?>"></td></tr>
<tr class="extra_totalizable"><td><?php echo $form->textwithpicto($langs->trans("Totalizable"), $langs->trans("TotalizableDesc")); ?></td><td class="valeur"><input id="totalizable" type="checkbox" name="totalizable"<?php echo ($totalizable ? ' checked' : ''); ?>></td></tr> <tr class="extra_totalizable"><td><?php echo $form->textwithpicto($langs->trans("Totalizable"), $langs->trans("TotalizableDesc")); ?></td><td class="valeur"><input id="totalizable" type="checkbox" name="totalizable"<?php echo ($totalizable ? ' checked' : ''); ?>></td></tr>
<!-- Help tooltip --> <!-- Help tooltip -->
<tr class="help"><td><?php echo $form->textwithpicto($langs->trans("HelpOnTooltip"), $langs->trans("HelpOnTooltipDesc")); ?></td><td class="valeur"><input id="help" class="quatrevingtpercent" type="text" name="help" value="<?php echo dol_escape_htmltag($help); ?>"></td></tr> <tr class="help"><td><?php echo $form->textwithpicto($langs->trans("HelpOnTooltip"), $langs->trans("HelpOnTooltipDesc")); ?></td><td class="valeur"><input id="help" class="quatrevingtpercent" type="text" name="help" value="<?php echo dol_escape_htmltag($help); ?>"></td></tr>
<?php if ($conf->multicompany->enabled) { ?> <?php if ($conf->multicompany->enabled) { ?>
<!-- Multicompany entity --> <!-- Multicompany entity -->
<tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (empty($entitycurrentorall) ? ' checked' : ''); ?>></td></tr> <tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (empty($entitycurrentorall) ? ' checked' : ''); ?>></td></tr>

View File

@@ -40,7 +40,7 @@ if (!empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_e
} else { } else {
// for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid') // for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid')
$morecss = ''; $morecss = '';
if (in_array($typeofextrafield, array('link', 'sellist'))) $morecss = 'maxwidth200'; if (in_array($typeofextrafield, array('link', 'sellist', 'text', 'html'))) $morecss = 'maxwidth200';
echo $extrafields->showInputField($key, $search_array_options[$search_options_pattern.$tmpkey], '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1); echo $extrafields->showInputField($key, $search_array_options[$search_options_pattern.$tmpkey], '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1);
} }
print '</td>'; print '</td>';

View File

@@ -98,7 +98,7 @@ ALTER TABLE llx_bom_bomline ADD COLUMN position integer NOT NULL DEFAULT 0;
ALTER TABLE llx_bom_bomline ADD COLUMN qty_frozen smallint DEFAULT 0; ALTER TABLE llx_bom_bomline ADD COLUMN qty_frozen smallint DEFAULT 0;
ALTER TABLE llx_bom_bomline ADD COLUMN disable_stock_change smallint DEFAULT 0; ALTER TABLE llx_bom_bomline ADD COLUMN disable_stock_change smallint DEFAULT 0;
ALTER TABLE llx_bom_bomline DROP COLUMN rank; ALTER TABLE llx_bom_bomline DROP COLUMN `rank`;
create table llx_categorie_warehouse create table llx_categorie_warehouse
( (

View File

@@ -409,7 +409,9 @@ PriceBaseTypeToChange=Modify on prices with base reference value defined on
MassConvert=Launch bulk conversion MassConvert=Launch bulk conversion
PriceFormatInCurrentLanguage=Price Format In Current Language PriceFormatInCurrentLanguage=Price Format In Current Language
String=String String=String
String1Line=String (1 line)
TextLong=Long text TextLong=Long text
TextLongNLines=Long text (n lines)
HtmlText=Html text HtmlText=Html text
Int=Integer Int=Integer
Float=Float Float=Float
@@ -2008,3 +2010,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

View File

@@ -119,3 +119,4 @@ NumberOfLinesToShow=Number of lines of images to show
DefineTablePlan=Define tables plan DefineTablePlan=Define tables plan
GiftReceiptButton=Gift receipt button GiftReceiptButton=Gift receipt button
GiftReceipt=Gift receipt GiftReceipt=Gift receipt
ModuleReceiptPrinterMustBeEnabled=Module Receipt printer must have been enabled first

View File

@@ -563,7 +563,7 @@ class Product extends CommonObject
return -1; return -1;
} }
if (empty($this->ref)) { if (empty($this->ref) || $this->ref == 'auto') {
// Load object modCodeProduct // Load object modCodeProduct
$module = (!empty($conf->global->PRODUCT_CODEPRODUCT_ADDON) ? $conf->global->PRODUCT_CODEPRODUCT_ADDON : 'mod_codeproduct_leopard'); $module = (!empty($conf->global->PRODUCT_CODEPRODUCT_ADDON) ? $conf->global->PRODUCT_CODEPRODUCT_ADDON : 'mod_codeproduct_leopard');
if ($module != 'mod_codeproduct_leopard') // Do not load module file for leopard if ($module != 'mod_codeproduct_leopard') // Do not load module file for leopard
@@ -3490,7 +3490,7 @@ class Product extends CommonObject
$sql = "SELECT sum(d.qty), date_format(d.date_valid, '%Y%m')"; $sql = "SELECT sum(d.qty), date_format(d.date_valid, '%Y%m')";
if ($mode == 'bynumber') { if ($mode == 'bynumber') {
$sql .= ", count(DISTINCT c.rowid)"; $sql .= ", count(DISTINCT d.rowid)";
} }
$sql .= " FROM ".MAIN_DB_PREFIX."mrp_mo as d LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON d.fk_soc = s.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."mrp_mo as d LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON d.fk_soc = s.rowid";
if ($filteronproducttype >= 0) { if ($filteronproducttype >= 0) {

View File

@@ -657,7 +657,7 @@ if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $n
$genallowed = $user->rights->stock->lire; $genallowed = $user->rights->stock->lire;
$delallowed = $user->rights->stock->creer; $delallowed = $user->rights->stock->creer;
print $formfile->showdocuments('massfilesarea_mymodule', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); print $formfile->showdocuments('massfilesarea_stock', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
} }
// End of page // End of page

View File

@@ -105,14 +105,16 @@ print "</tr>\n";
if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOS_PRINT_METHOD != "browser") { if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOS_PRINT_METHOD != "browser") {
print '<tr class="oddeven value"><td>'; print '<tr class="oddeven value"><td>';
print $langs->trans("OrderPrinters").' (<a href="'.DOL_URL_ROOT.'/takepos/admin/orderprinters.php?leftmenu=setup">'.$langs->trans("Setup").'</a>)'; print $langs->trans("OrderPrinters").' (<a href="'.DOL_URL_ROOT.'/takepos/admin/orderprinters.php?leftmenu=setup">'.$langs->trans("Setup").'</a>)';
print '<td colspan="2">'; print '</td>';
print '<td>';
print ajax_constantonoff("TAKEPOS_ORDER_PRINTERS", array(), $conf->entity, 0, 0, 1, 0); print ajax_constantonoff("TAKEPOS_ORDER_PRINTERS", array(), $conf->entity, 0, 0, 1, 0);
//print $form->selectyesno("TAKEPOS_ORDER_PRINTERS", $conf->global->TAKEPOS_ORDER_PRINTERS, 1); //print $form->selectyesno("TAKEPOS_ORDER_PRINTERS", $conf->global->TAKEPOS_ORDER_PRINTERS, 1);
print '</td></tr>'; print '</td></tr>';
print '<tr class="oddeven value"><td>'; print '<tr class="oddeven value"><td>';
print $langs->trans("OrderNotes"); print $langs->trans("OrderNotes");
print '<td colspan="2">'; print '</td>';
print '<td>';
print ajax_constantonoff("TAKEPOS_ORDER_NOTES", array(), $conf->entity, 0, 0, 1, 0); print ajax_constantonoff("TAKEPOS_ORDER_NOTES", array(), $conf->entity, 0, 0, 1, 0);
//print $form->selectyesno("TAKEPOS_ORDER_NOTES", $conf->global->TAKEPOS_ORDER_NOTES, 1); //print $form->selectyesno("TAKEPOS_ORDER_NOTES", $conf->global->TAKEPOS_ORDER_NOTES, 1);
print '</td></tr>'; print '</td></tr>';
@@ -120,14 +122,16 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOS_PRINT_METHOD
print '<tr class="oddeven value"><td>'; print '<tr class="oddeven value"><td>';
print $langs->trans("BasicPhoneLayout"); print $langs->trans("BasicPhoneLayout");
print '<td colspan="2">'; print '</td>';
print '<td>';
//print $form->selectyesno("TAKEPOS_PHONE_BASIC_LAYOUT", $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT, 1); //print $form->selectyesno("TAKEPOS_PHONE_BASIC_LAYOUT", $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT, 1);
print ajax_constantonoff("TAKEPOS_PHONE_BASIC_LAYOUT", array(), $conf->entity, 0, 0, 1, 0); print ajax_constantonoff("TAKEPOS_PHONE_BASIC_LAYOUT", array(), $conf->entity, 0, 0, 1, 0);
print '</td></tr>'; print '</td></tr>';
print '<tr class="oddeven value"><td>'; print '<tr class="oddeven value"><td>';
print $langs->trans("ProductSupplements"); print $langs->trans("ProductSupplements");
print '<td colspan="2">'; print '</td>';
print '<td>';
//print $form->selectyesno("TAKEPOS_SUPPLEMENTS", $conf->global->TAKEPOS_SUPPLEMENTS, 1); //print $form->selectyesno("TAKEPOS_SUPPLEMENTS", $conf->global->TAKEPOS_SUPPLEMENTS, 1);
print ajax_constantonoff("TAKEPOS_SUPPLEMENTS", array(), $conf->entity, 0, 0, 1, 0); print ajax_constantonoff("TAKEPOS_SUPPLEMENTS", array(), $conf->entity, 0, 0, 1, 0);
print '</td></tr>'; print '</td></tr>';
@@ -136,33 +140,54 @@ if ($conf->global->TAKEPOS_SUPPLEMENTS)
{ {
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $langs->trans("SupplementCategory"); print $langs->trans("SupplementCategory");
print '<td colspan="2">'; print '</td>';
print '<td>';
print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0); print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0);
print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY'); print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY');
print "</td></tr>\n"; print "</td></tr>\n";
} }
print '<tr class="oddeven value"><td>'; print '<tr class="oddeven value"><td>';
print 'QR - '.$langs->trans("AutoOrder"); print 'QR - '.$langs->trans("CustomerMenu");
print '<td colspan="2">'; print '</td>';
print ajax_constantonoff("TAKEPOS_AUTO_ORDER", array(), $conf->entity, 0, 0, 1, 0); print '<td>';
print ajax_constantonoff("TAKEPOS_QR_MENU", array(), $conf->entity, 0, 0, 1, 0);
print '</td></tr>'; print '</td></tr>';
print '<tr class="oddeven value"><td>'; print '<tr class="oddeven value"><td>';
print 'QR - '.$langs->trans("CustomerMenu"); print 'QR - '.$langs->trans("AutoOrder");
print '<td colspan="2">'; print '</td>';
print ajax_constantonoff("TAKEPOS_QR_MENU", array(), $conf->entity, 0, 0, 1, 0); print '<td>';
print ajax_constantonoff("TAKEPOS_AUTO_ORDER", array(), $conf->entity, 0, 0, 1, 0);
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
if ($conf->global->TAKEPOS_QR_MENU)
{
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
print '<br>';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("URL").'</td><td class="right">'.$langs->trans("QR").'</td>';
print "</tr>\n";
print '<tr class="oddeven value"><td>';
print "<a target='_blank' href='".$urlwithroot."/takepos/public/menu.php'>".$urlwithroot."/takepos/public/menu.php</a>";
print '</td>';
print '<td class="right">';
print "<a target='_blank' href='printqr.php'><img src='".DOL_URL_ROOT."/takepos/genimg/qr.php' height='42' width='42'></a>";
print '</td></tr>';
print '</table>';
}
if ($conf->global->TAKEPOS_AUTO_ORDER) if ($conf->global->TAKEPOS_AUTO_ORDER)
{ {
print '<br>'; print '<br>';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Table").'</td><td>'.$langs->trans("URL").'</td><td>'.$langs->trans("QR").'</td>'; print '<td>'.$langs->trans("Table").'</td><td>'.$langs->trans("URL").'</td><td class="right">'.$langs->trans("QR").'</td>';
print "</tr>\n"; print "</tr>\n";
//global $dolibarr_main_url_root; //global $dolibarr_main_url_root;
@@ -174,9 +199,11 @@ if ($conf->global->TAKEPOS_AUTO_ORDER)
while ($row = $db->fetch_array($resql)) { while ($row = $db->fetch_array($resql)) {
print '<tr class="oddeven value"><td>'; print '<tr class="oddeven value"><td>';
print $langs->trans("Table")." ".$row['label']; print $langs->trans("Table")." ".$row['label'];
print '</td>';
print '<td>'; print '<td>';
print "<a target='_blank' href='".$urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($row['rowid'])."'>".$urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($row['rowid'])."</a>"; print "<a target='_blank' href='".$urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($row['rowid'])."'>".$urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($row['rowid'])."</a>";
print '<td>'; print '</td>';
print '<td class="right">';
print "<a target='_blank' href='printqr.php?id=".$row['rowid']."'><img src='".DOL_URL_ROOT."/takepos/genimg/qr.php?key=".dol_encode($row['rowid'])."' height='42' width='42'></a>"; print "<a target='_blank' href='printqr.php?id=".$row['rowid']."'><img src='".DOL_URL_ROOT."/takepos/genimg/qr.php?key=".dol_encode($row['rowid'])."' height='42' width='42'></a>";
print '</td></tr>'; print '</td></tr>';
} }
@@ -184,24 +211,6 @@ if ($conf->global->TAKEPOS_AUTO_ORDER)
print '</table>'; print '</table>';
} }
if ($conf->global->TAKEPOS_QR_MENU)
{
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
print '<br>';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("URL").'</td><td>'.$langs->trans("QR").'</td>';
print "</tr>\n";
print '<tr class="oddeven value"><td>';
print "<a target='_blank' href='".$urlwithroot."/takepos/public/menu.php'>".$urlwithroot."/takepos/public/menu.php</a>";
print '<td>';
print "<a target='_blank' href='printqr.php'><img src='".DOL_URL_ROOT."/takepos/genimg/qr.php' height='42' width='42'></a>";
print '</td></tr>';
print '</table>';
}
print '</div>'; print '</div>';
print '<br>'; print '<br>';

View File

@@ -89,7 +89,7 @@ print load_fiche_titre($langs->trans("PrintMethod"), '', '');
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td><td>'.$langs->trans("Description").'</td><td class="center" width="60">'.$langs->trans("Status").'</td>'; print '<td>'.$langs->trans("Name").'</td><td>'.$langs->trans("Description").'</td><td class="right">'.$langs->trans("Status").'</td>';
print "</tr>\n"; print "</tr>\n";
// Browser method // Browser method
@@ -97,7 +97,7 @@ print '<tr class="oddeven"><td>';
print $langs->trans('Browser'); print $langs->trans('Browser');
print '<td>'; print '<td>';
print $langs->trans('BrowserMethodDescription'); print $langs->trans('BrowserMethodDescription');
print '</td><td class="center">'; print '</td><td class="right">';
if ($conf->global->TAKEPOS_PRINT_METHOD == "browser") if ($conf->global->TAKEPOS_PRINT_METHOD == "browser")
{ {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
@@ -114,7 +114,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 1) {
print $langs->trans('ReceiptPrinterMethodDescription'); print $langs->trans('ReceiptPrinterMethodDescription');
print '<br>'; print '<br>';
print '<a href="'.DOL_URL_ROOT.'/admin/receiptprinter.php">'.$langs->trans("Setup").'</a>'; print '<a href="'.DOL_URL_ROOT.'/admin/receiptprinter.php">'.$langs->trans("Setup").'</a>';
print '</td><td class="center">'; print '</td><td class="right">';
if ($conf->receiptprinter->enabled) { if ($conf->receiptprinter->enabled) {
if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
@@ -134,7 +134,7 @@ print '<tr class="oddeven"><td>';
print "TakePOS Connector"; print "TakePOS Connector";
print '<td>'; print '<td>';
print $langs->trans('TakeposConnectorMethodDescription'); print $langs->trans('TakeposConnectorMethodDescription');
print '</td><td class="center">'; print '</td><td class="right">';
if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector")
{ {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');

View File

@@ -45,7 +45,7 @@ if (!$conf->global->TAKEPOS_QR_MENU) accessforbidden(); // If Restaurant Menu is
<div class="grid-container"> <div class="grid-container">
<div class="grid-x grid-padding-x menu2"> <div class="grid-x grid-padding-x menu2">
<div class="cell small-12"> <div class="cell small-12">
<h1><?php print $mysoc->name; ?> <small><?php print $langs->trans('RestaurantMenu'); ?></small></h1> <h1><?php print $mysoc->name; ?> - <small><?php print $langs->trans('RestaurantMenu'); ?></small></h1>
<?php <?php
$categorie = new Categorie($db); $categorie = new Categorie($db);