2
0
forked from Wavyzz/dolibarr

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

Conflicts:
	htdocs/bom/tpl/objectline_create.tpl.php
	htdocs/compta/bank/releve.php
	htdocs/core/class/html.formsetup.class.php
	htdocs/takepos/freezone.php
This commit is contained in:
Laurent Destailleur
2024-03-22 02:35:37 +01:00
13 changed files with 56 additions and 36 deletions

View File

@@ -94,12 +94,12 @@ $search_zip = GETPOST('search_zip', 'alpha');
$search_state = GETPOST('search_state', 'alpha'); $search_state = GETPOST('search_state', 'alpha');
$search_country = GETPOSTINT('search_country'); $search_country = GETPOSTINT('search_country');
$search_type_thirdparty = GETPOSTINT('search_type_thirdparty'); $search_type_thirdparty = GETPOSTINT('search_type_thirdparty');
$search_user = GETPOSTINT('search_user'); $search_user = GETPOST('search_user', 'intcomma');
$search_sale = GETPOSTINT('search_sale'); $search_sale = GETPOST('search_sale', 'intcomma');
$search_total_ht = GETPOST('search_total_ht', 'alpha'); $search_total_ht = GETPOST('search_total_ht', 'alpha');
$search_total_vat = GETPOST('search_total_vat', 'alpha'); $search_total_vat = GETPOST('search_total_vat', 'alpha');
$search_total_ttc = GETPOST('search_total_ttc', 'alpha'); $search_total_ttc = GETPOST('search_total_ttc', 'alpha');
$search_warehouse = GETPOSTINT('search_warehouse'); $search_warehouse = GETPOST('search_warehouse', 'intcomma');
$search_multicurrency_code = GETPOST('search_multicurrency_code', 'alpha'); $search_multicurrency_code = GETPOST('search_multicurrency_code', 'alpha');
$search_multicurrency_tx = GETPOST('search_multicurrency_tx', 'alpha'); $search_multicurrency_tx = GETPOST('search_multicurrency_tx', 'alpha');

View File

@@ -106,12 +106,12 @@ $search_country = GETPOSTINT("search_country");
$search_type_thirdparty = GETPOSTINT("search_type_thirdparty"); $search_type_thirdparty = GETPOSTINT("search_type_thirdparty");
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$socid = GETPOSTINT('socid'); $socid = GETPOSTINT('socid');
$search_user = GETPOSTINT('search_user'); $search_user = GETPOST('search_user', 'intcomma');
$search_sale = GETPOSTINT('search_sale'); $search_sale = GETPOST('search_sale', 'intcomma');
$search_total_ht = GETPOST('search_total_ht', 'alpha'); $search_total_ht = GETPOST('search_total_ht', 'alpha');
$search_total_vat = GETPOST('search_total_vat', 'alpha'); $search_total_vat = GETPOST('search_total_vat', 'alpha');
$search_total_ttc = GETPOST('search_total_ttc', 'alpha'); $search_total_ttc = GETPOST('search_total_ttc', 'alpha');
$search_warehouse = GETPOSTINT('search_warehouse'); $search_warehouse = GETPOST('search_warehouse', 'intcomma');
$search_multicurrency_code = GETPOST('search_multicurrency_code', 'alpha'); $search_multicurrency_code = GETPOST('search_multicurrency_code', 'alpha');
$search_multicurrency_tx = GETPOST('search_multicurrency_tx', 'alpha'); $search_multicurrency_tx = GETPOST('search_multicurrency_tx', 'alpha');
$search_multicurrency_montant_ht = GETPOST('search_multicurrency_montant_ht', 'alpha'); $search_multicurrency_montant_ht = GETPOST('search_multicurrency_montant_ht', 'alpha');

View File

@@ -528,11 +528,12 @@ if (empty($numref)) {
print '<td valign="center">'; print '<td valign="center">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$objp->rowid.'&account='.$object->id.'">'; print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$objp->rowid.'&account='.$object->id.'">';
$reg = array(); $reg = array();
preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parentheses on tente recherche de traduction
if ($reg[1] && $langs->trans($reg[1]) != $reg[1]) { preg_match('/\((.+)\)/i', $objp->label, $reg); // If text rounded by parenthesis, we try to search translation
if (!empty($reg[1]) && $langs->trans($reg[1]) != $reg[1]) {
print $langs->trans($reg[1]); print $langs->trans($reg[1]);
} else { } else {
print $objp->label; print dol_escape_htmltag($objp->label);
} }
print '</a>'; print '</a>';

View File

@@ -115,8 +115,8 @@ $search_state = GETPOST("search_state");
$search_country = GETPOST("search_country", 'alpha'); $search_country = GETPOST("search_country", 'alpha');
$search_customer_code = GETPOST("search_customer_code", 'alphanohtml'); $search_customer_code = GETPOST("search_customer_code", 'alphanohtml');
$search_type_thirdparty = GETPOSTINT("search_type_thirdparty"); $search_type_thirdparty = GETPOSTINT("search_type_thirdparty");
$search_user = GETPOSTINT('search_user'); $search_user = GETPOST('search_user', 'intcomma');
$search_sale = GETPOSTINT('search_sale'); $search_sale = GETPOST('search_sale', 'intcomma');
$search_date_startday = GETPOSTINT('search_date_startday'); $search_date_startday = GETPOSTINT('search_date_startday');
$search_date_startmonth = GETPOSTINT('search_date_startmonth'); $search_date_startmonth = GETPOSTINT('search_date_startmonth');
$search_date_startyear = GETPOSTINT('search_date_startyear'); $search_date_startyear = GETPOSTINT('search_date_startyear');

View File

@@ -27,6 +27,9 @@ class FormSetup
*/ */
public $db; public $db;
/** @var int */
public $entity;
/** @var FormSetupItem[] */ /** @var FormSetupItem[] */
public $items = array(); public $items = array();
@@ -92,7 +95,8 @@ class FormSetup
*/ */
public function __construct($db, $outputLangs = null) public function __construct($db, $outputLangs = null)
{ {
global $langs; global $conf, $langs;
$this->db = $db; $this->db = $db;
$this->form = new Form($this->db); $this->form = new Form($this->db);
@@ -101,6 +105,8 @@ class FormSetup
$this->formHiddenInputs['token'] = newToken(); $this->formHiddenInputs['token'] = newToken();
$this->formHiddenInputs['action'] = 'update'; $this->formHiddenInputs['action'] = 'update';
$this->entity = (is_null($this->entity) ? $conf->entity : $this->entity);
if ($outputLangs) { if ($outputLangs) {
$this->langs = $outputLangs; $this->langs = $outputLangs;
} else { } else {
@@ -461,6 +467,8 @@ class FormSetup
{ {
$item = new FormSetupItem($confKey); $item = new FormSetupItem($confKey);
$item->entity = $this->entity;
// set item rank if not defined as last item // set item rank if not defined as last item
if (empty($item->rank)) { if (empty($item->rank)) {
$item->rank = $this->getCurentItemMaxRank() + 1; $item->rank = $this->getCurentItemMaxRank() + 1;
@@ -671,7 +679,7 @@ class FormSetupItem
} }
$this->langs = $langs; $this->langs = $langs;
$this->entity = $conf->entity; $this->entity = (is_null($this->entity) ? $conf->entity : ((int) $this->entity));
$this->confKey = $confKey; $this->confKey = $confKey;
$this->loadValueFromConf(); $this->loadValueFromConf();
@@ -1184,7 +1192,7 @@ class FormSetupItem
$out .= $this->generateOutputFieldColor(); $out .= $this->generateOutputFieldColor();
} elseif ($this->type == 'yesno') { } elseif ($this->type == 'yesno') {
if (!empty($conf->use_javascript_ajax)) { if (!empty($conf->use_javascript_ajax)) {
$out .= ajax_constantonoff($this->confKey); $out .= ajax_constantonoff($this->confKey, array(), $this->entity); // TODO possibility to add $input parameter
} else { } else {
if ($this->fieldValue == 1) { if ($this->fieldValue == 1) {
$out .= $langs->trans('yes'); $out .= $langs->trans('yes');

View File

@@ -69,8 +69,8 @@ $search_datedelivery_end = dol_mktime(23, 59, 59, GETPOSTINT('search_datedeliver
$search_datereceipt_start = dol_mktime(0, 0, 0, GETPOSTINT('search_datereceipt_startmonth'), GETPOSTINT('search_datereceipt_startday'), GETPOSTINT('search_datereceipt_startyear')); $search_datereceipt_start = dol_mktime(0, 0, 0, GETPOSTINT('search_datereceipt_startmonth'), GETPOSTINT('search_datereceipt_startday'), GETPOSTINT('search_datereceipt_startyear'));
$search_datereceipt_end = dol_mktime(23, 59, 59, GETPOSTINT('search_datereceipt_endmonth'), GETPOSTINT('search_datereceipt_endday'), GETPOSTINT('search_datereceipt_endyear')); $search_datereceipt_end = dol_mktime(23, 59, 59, GETPOSTINT('search_datereceipt_endmonth'), GETPOSTINT('search_datereceipt_endday'), GETPOSTINT('search_datereceipt_endyear'));
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$search_user = GETPOSTINT('search_user'); $search_user = GETPOST('search_user', 'intcomma');
$search_sale = GETPOSTINT('search_sale'); $search_sale = GETPOST('search_sale', 'intcomma');
$search_categ_cus = GETPOSTINT("search_categ_cus"); $search_categ_cus = GETPOSTINT("search_categ_cus");
$search_product_category = GETPOSTINT('search_product_category'); $search_product_category = GETPOSTINT('search_product_category');

View File

@@ -108,11 +108,11 @@ $search_zip = GETPOST('search_zip', 'alpha');
$search_state = GETPOST("search_state", 'alpha'); $search_state = GETPOST("search_state", 'alpha');
$search_country = GETPOSTINT("search_country"); $search_country = GETPOSTINT("search_country");
$search_type_thirdparty = GETPOSTINT("search_type_thirdparty"); $search_type_thirdparty = GETPOSTINT("search_type_thirdparty");
$search_user = GETPOSTINT('search_user'); $search_user = GETPOST('search_user', 'intcomma');
$search_request_author = GETPOST('search_request_author', 'alpha'); $search_request_author = GETPOST('search_request_author', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$socid = GETPOSTINT('socid'); $socid = GETPOSTINT('socid');
$search_sale = GETPOSTINT('search_sale'); $search_sale = GETPOST('search_sale', 'intcomma');
$search_total_ht = GETPOST('search_total_ht', 'alpha'); $search_total_ht = GETPOST('search_total_ht', 'alpha');
$search_total_tva = GETPOST('search_total_tva', 'alpha'); $search_total_tva = GETPOST('search_total_tva', 'alpha');
$search_total_ttc = GETPOST('search_total_ttc', 'alpha'); $search_total_ttc = GETPOST('search_total_ttc', 'alpha');

View File

@@ -92,8 +92,8 @@ $search_zip = GETPOST('search_zip', 'alpha');
$search_state = GETPOST("search_state"); $search_state = GETPOST("search_state");
$search_country = GETPOST("search_country", 'alpha'); $search_country = GETPOST("search_country", 'alpha');
$search_type_thirdparty = GETPOSTINT("search_type_thirdparty"); $search_type_thirdparty = GETPOSTINT("search_type_thirdparty");
$search_user = GETPOSTINT('search_user'); $search_user = GETPOST('search_user', 'intcomma');
$search_sale = GETPOSTINT('search_sale'); $search_sale = GETPOST('search_sale', 'intcomma');
$search_date_start = GETPOSTDATE('search_date_start', '', 'tzserver'); $search_date_start = GETPOSTDATE('search_date_start', '', 'tzserver');
$search_date_end = GETPOSTDATE('search_date_end', '23:59:59', 'tzserver'); $search_date_end = GETPOSTDATE('search_date_end', '23:59:59', 'tzserver');
$search_datelimit_startday = GETPOSTINT('search_datelimit_startday'); $search_datelimit_startday = GETPOSTINT('search_datelimit_startday');

View File

@@ -81,8 +81,8 @@ $search_duration = GETPOSTINT('search_duration');
$search_value = GETPOSTINT('search_value'); $search_value = GETPOSTINT('search_value');
$search_task_ref = GETPOST('search_task_ref', 'alpha'); $search_task_ref = GETPOST('search_task_ref', 'alpha');
$search_task_label = GETPOST('search_task_label', 'alpha'); $search_task_label = GETPOST('search_task_label', 'alpha');
$search_user = GETPOSTINT('search_user'); $search_user = GETPOST('search_user', 'intcomma');
$search_valuebilled = GETPOSTINT('search_valuebilled'); $search_valuebilled = GETPOST('search_valuebilled', 'intcomma');
$search_product_ref = GETPOST('search_product_ref', 'alpha'); $search_product_ref = GETPOST('search_product_ref', 'alpha');
$search_company = GETPOST('$search_company', 'alpha'); $search_company = GETPOST('$search_company', 'alpha');
$search_company_alias = GETPOST('$search_company_alias', 'alpha'); $search_company_alias = GETPOST('$search_company_alias', 'alpha');

View File

@@ -60,8 +60,8 @@ $toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'supplierproposallist'; $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'supplierproposallist';
$mode = GETPOST('mode', 'alpha'); $mode = GETPOST('mode', 'alpha');
$search_user = GETPOSTINT('search_user'); $search_user = GETPOST('search_user', 'intcomma');
$search_sale = GETPOSTINT('search_sale'); $search_sale = GETPOST('search_sale', 'intcomma');
$search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha'); $search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha');
$search_societe = GETPOST('search_societe', 'alpha'); $search_societe = GETPOST('search_societe', 'alpha');
$search_societe_alias = GETPOST('search_societe_alias', 'alpha'); $search_societe_alias = GETPOST('search_societe_alias', 'alpha');

View File

@@ -51,6 +51,8 @@ $langs->loadLangs(array("bills", "cashdesk"));
$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : '0'); // $place is id of table for Bar or Restaurant $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : '0'); // $place is id of table for Bar or Restaurant
$invoiceid = GETPOST('invoiceid', 'int');
$idline = GETPOSTINT('idline'); $idline = GETPOSTINT('idline');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
@@ -60,12 +62,13 @@ if (!$user->hasRight('takepos', 'run')) {
// get invoice // get invoice
$invoice = new Facture($db); $invoice = new Facture($db);
if ($place > 0) { if ($invoiceid > 0) {
$invoice->fetch($place); $invoice->fetch($invoiceid);
} else { } else {
$invoice->fetch('', '(PROV-POS'.$_SESSION['takeposterminal'].'-'.$place.')'); $invoice->fetch('', '(PROV-POS'.$_SESSION['takeposterminal'].'-'.$place.')');
} }
// get default vat rate // get default vat rate
$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION['takeposterminal']; $constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION['takeposterminal'];
$soc = new Societe($db); $soc = new Societe($db);
@@ -108,8 +111,8 @@ top_htmlhead('', '', 0, 0, $arrayofjs, $arrayofcss);
* Save (validate) * Save (validate)
*/ */
function Save() { function Save() {
console.log("We click so we call page invoice.php with place=<?php echo $place; ?> tva_tx="+vatRate); console.log("We click so we call page invoice.php with invoiceid=<?php echo $invoiceid; ?>, place=<?php echo $place; ?>, amount="+$("#number").val()+", tva_tx="+vatRate);
parent.$("#poslines").load("invoice.php?action=freezone&token=<?php echo newToken(); ?>&place=<?php echo $place; ?>&number="+$('#number').val()+"&tva_tx="+vatRate, {desc:$('#desc').val()}); parent.$("#poslines").load("invoice.php?action=freezone&token=<?php echo newToken(); ?>&invoiceid=<?php echo $invoiceid; ?>&place=<?php echo $place; ?>&number="+$("#number").val()+"&tva_tx="+vatRate, {desc:$("#desc").val()});
parent.$.colorbox.close(); parent.$.colorbox.close();
} }

View File

@@ -535,11 +535,12 @@ function ClickProduct(position, qty = 1) {
} }
else{ else{
console.log($('#prodiv4').data('rowid')); console.log($('#prodiv4').data('rowid'));
invoiceid = $("#invoiceid").val();
idproduct=$('#prodiv'+position).data('rowid'); idproduct=$('#prodiv'+position).data('rowid');
console.log("Click on product at position "+position+" for idproduct "+idproduct+", qty="+qty); console.log("Click on product at position "+position+" for idproduct "+idproduct+", qty="+qty+" invoicdeid="+invoiceid);
if (idproduct=="") return; if (idproduct=="") return;
// Call page invoice.php to generate the section with product lines // Call page invoice.php to generate the section with product lines
$("#poslines").load("invoice.php?action=addline&token=<?php echo newToken() ?>&place="+place+"&idproduct="+idproduct+"&qty="+qty, function() { $("#poslines").load("invoice.php?action=addline&token=<?php echo newToken() ?>&place="+place+"&idproduct="+idproduct+"&qty="+qty+"&invoiceid="+invoiceid, function() {
<?php if (getDolGlobalString('TAKEPOS_CUSTOMER_DISPLAY')) { <?php if (getDolGlobalString('TAKEPOS_CUSTOMER_DISPLAY')) {
echo "CustomerDisplay();"; echo "CustomerDisplay();";
}?> }?>
@@ -559,8 +560,9 @@ function ChangeThirdparty(idcustomer) {
} }
function deleteline() { function deleteline() {
console.log("Delete line"); invoiceid = $("#invoiceid").val();
$("#poslines").load("invoice.php?action=deleteline&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline, function() { console.log("Delete line invoiceid="+invoiceid);
$("#poslines").load("invoice.php?action=deleteline&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline+"&invoiceid="+invoiceid, function() {
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight); //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
}); });
ClearSearch(false); ClearSearch(false);
@@ -633,8 +635,9 @@ function Floors() {
} }
function FreeZone() { function FreeZone() {
console.log("Open box to enter a free product"); invoiceid = $("#invoiceid").val();
$.colorbox({href:"freezone.php?action=freezone&token=<?php echo newToken(); ?>&place="+place, width:"80%", height:"40%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("FreeZone"); ?>"}); console.log("Open box to enter a free product on invoiceid="+invoiceid);
$.colorbox({href:"freezone.php?action=freezone&token=<?php echo newToken(); ?>&place="+place+"&invoiceid="+invoiceid, width:"80%", height:"40%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("FreeZone"); ?>"});
} }
function TakeposOrderNotes() { function TakeposOrderNotes() {

View File

@@ -520,6 +520,7 @@ if (empty($reshook)) {
} }
} }
// If we add a line by click on product (invoice exists here because it was created juste before if it didn't exists)
if ($action == "addline" && ($user->hasRight('takepos', 'run') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))) { if ($action == "addline" && ($user->hasRight('takepos', 'run') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))) {
$prod = new Product($db); $prod = new Product($db);
$prod->fetch($idproduct); $prod->fetch($idproduct);
@@ -711,6 +712,7 @@ if (empty($reshook)) {
$invoice->fetch($placeid); $invoice->fetch($placeid);
} }
// If we add a line by submitting freezone form (invoice exists here because it was created juste before if it didn't exists)
if ($action == "freezone" && $user->hasRight('takepos', 'run')) { if ($action == "freezone" && $user->hasRight('takepos', 'run')) {
$customer = new Societe($db); $customer = new Societe($db);
$customer->fetch($invoice->socid); $customer->fetch($invoice->socid);
@@ -728,7 +730,10 @@ if (empty($reshook)) {
$localtax1_tx = get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr); $localtax1_tx = get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr);
$localtax2_tx = get_localtax($tva_tx, 2, $customer, $mysoc, $tva_npr); $localtax2_tx = get_localtax($tva_tx, 2, $customer, $mysoc, $tva_npr);
$invoice->addline($desc, $number, 1, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', 0, 0, 0, '', getDolGlobalInt('TAKEPOS_DISCOUNT_TTC') ? ($number >= 0 ? 'HT' : 'TTC') : (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT') ? 'HT' : 'TTC'), $number, 0, -1, 0, '', 0, 0, null, '', '', 0, 100, '', null, 0); $res = $invoice->addline($desc, $number, 1, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', 0, 0, 0, '', getDolGlobalInt('TAKEPOS_DISCOUNT_TTC') ? ($number >= 0 ? 'HT' : 'TTC') : (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT') ? 'HT' : 'TTC'), $number, 0, -1, 0, '', 0, 0, null, '', '', 0, 100, '', null, 0);
if ($res < 0) {
dol_htmloutput_errors($invoice->error, $invoice->errors, 1);
}
$invoice->fetch($placeid); $invoice->fetch($placeid);
} }