Skip to content

Commit

Permalink
Merge branch 'Dolibarr:develop' into fix-add-state-province-filter-field
Browse files Browse the repository at this point in the history
  • Loading branch information
bradley-jarvis authored Mar 22, 2024
2 parents b2d27fb + 7997db3 commit e34d4ec
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 39 deletions.
6 changes: 3 additions & 3 deletions htdocs/commande/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@
$search_state = GETPOST('search_state', 'alpha');
$search_country = GETPOSTINT('search_country');
$search_type_thirdparty = GETPOSTINT('search_type_thirdparty');
$search_user = GETPOSTINT('search_user');
$search_sale = GETPOSTINT('search_sale');
$search_user = GETPOST('search_user', 'intcomma');
$search_sale = GETPOST('search_sale', 'intcomma');
$search_total_ht = GETPOST('search_total_ht', 'alpha');
$search_total_vat = GETPOST('search_total_vat', '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_tx = GETPOST('search_multicurrency_tx', 'alpha');
Expand Down
6 changes: 3 additions & 3 deletions htdocs/commande/list_det.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@
$search_type_thirdparty = GETPOSTINT("search_type_thirdparty");
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$socid = GETPOSTINT('socid');
$search_user = GETPOSTINT('search_user');
$search_sale = GETPOSTINT('search_sale');
$search_user = GETPOST('search_user', 'intcomma');
$search_sale = GETPOST('search_sale', 'intcomma');
$search_total_ht = GETPOST('search_total_ht', 'alpha');
$search_total_vat = GETPOST('search_total_vat', '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_tx = GETPOST('search_multicurrency_tx', 'alpha');
$search_multicurrency_montant_ht = GETPOST('search_multicurrency_montant_ht', 'alpha');
Expand Down
7 changes: 4 additions & 3 deletions htdocs/compta/bank/releve.php
Original file line number Diff line number Diff line change
Expand Up @@ -528,11 +528,12 @@
print '<td valign="center">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$objp->rowid.'&account='.$object->id.'">';
$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]);
} else {
print $objp->label;
print dol_escape_htmltag($objp->label);
}
print '</a>';

Expand Down
4 changes: 2 additions & 2 deletions htdocs/compta/facture/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@
$search_country = GETPOST("search_country", 'alpha');
$search_customer_code = GETPOST("search_customer_code", 'alphanohtml');
$search_type_thirdparty = GETPOSTINT("search_type_thirdparty");
$search_user = GETPOSTINT('search_user');
$search_sale = GETPOSTINT('search_sale');
$search_user = GETPOST('search_user', 'intcomma');
$search_sale = GETPOST('search_sale', 'intcomma');
$search_date_startday = GETPOSTINT('search_date_startday');
$search_date_startmonth = GETPOSTINT('search_date_startmonth');
$search_date_startyear = GETPOSTINT('search_date_startyear');
Expand Down
16 changes: 12 additions & 4 deletions htdocs/core/class/html.formsetup.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ class FormSetup
*/
public $db;

/** @var int */
public $entity;

/** @var FormSetupItem[] */
public $items = array();

Expand Down Expand Up @@ -92,7 +95,8 @@ class FormSetup
*/
public function __construct($db, $outputLangs = null)
{
global $langs;
global $conf, $langs;

$this->db = $db;

$this->form = new Form($this->db);
Expand All @@ -101,6 +105,8 @@ public function __construct($db, $outputLangs = null)
$this->formHiddenInputs['token'] = newToken();
$this->formHiddenInputs['action'] = 'update';

$this->entity = (is_null($this->entity) ? $conf->entity : $this->entity);

if ($outputLangs) {
$this->langs = $outputLangs;
} else {
Expand Down Expand Up @@ -461,6 +467,8 @@ public function newItem($confKey, $targetItemKey = '', $insertAfterTarget = fals
{
$item = new FormSetupItem($confKey);

$item->entity = $this->entity;

// set item rank if not defined as last item
if (empty($item->rank)) {
$item->rank = $this->getCurentItemMaxRank() + 1;
Expand Down Expand Up @@ -657,7 +665,7 @@ class FormSetupItem
/**
* Constructor
*
* @param string $confKey the conf key used in database
* @param string $confKey the conf key used in database
*/
public function __construct($confKey)
{
Expand All @@ -671,7 +679,7 @@ public function __construct($confKey)
}

$this->langs = $langs;
$this->entity = $conf->entity;
$this->entity = (is_null($this->entity) ? $conf->entity : ((int) $this->entity));

$this->confKey = $confKey;
$this->loadValueFromConf();
Expand Down Expand Up @@ -1184,7 +1192,7 @@ public function generateOutputField()
$out .= $this->generateOutputFieldColor();
} elseif ($this->type == 'yesno') {
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 {
if ($this->fieldValue == 1) {
$out .= $langs->trans('yes');
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/db/pgsql.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,7 @@ public function DDLCreateTable($table, $fields, $primary_key, $type, $unique_key
$sql .= ")";
//$sql .= " engine=".$this->sanitize($type);

if (!$this->query($sql)) {
if (!$this->query($sql, 1)) {
return -1;
} else {
return 1;
Expand All @@ -1158,7 +1158,7 @@ public function DDLDropTable($table)

$sql = "DROP TABLE ".$this->sanitize($tmptable);

if (!$this->query($sql)) {
if (!$this->query($sql, 1)) {
return -1;
} else {
return 1;
Expand Down
4 changes: 2 additions & 2 deletions htdocs/expedition/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
$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_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$search_user = GETPOSTINT('search_user');
$search_sale = GETPOSTINT('search_sale');
$search_user = GETPOST('search_user', 'intcomma');
$search_sale = GETPOST('search_sale', 'intcomma');
$search_categ_cus = GETPOSTINT("search_categ_cus");
$search_product_category = GETPOSTINT('search_product_category');

Expand Down
4 changes: 2 additions & 2 deletions htdocs/fourn/commande/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@
$search_state = GETPOST("search_state", 'alpha');
$search_country = GETPOSTINT("search_country");
$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');
$optioncss = GETPOST('optioncss', 'alpha');
$socid = GETPOSTINT('socid');
$search_sale = GETPOSTINT('search_sale');
$search_sale = GETPOST('search_sale', 'intcomma');
$search_total_ht = GETPOST('search_total_ht', 'alpha');
$search_total_tva = GETPOST('search_total_tva', 'alpha');
$search_total_ttc = GETPOST('search_total_ttc', 'alpha');
Expand Down
4 changes: 2 additions & 2 deletions htdocs/fourn/facture/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@
$search_state = GETPOST("search_state");
$search_country = GETPOST("search_country", 'alpha');
$search_type_thirdparty = GETPOSTINT("search_type_thirdparty");
$search_user = GETPOSTINT('search_user');
$search_sale = GETPOSTINT('search_sale');
$search_user = GETPOST('search_user', 'intcomma');
$search_sale = GETPOST('search_sale', 'intcomma');
$search_date_start = GETPOSTDATE('search_date_start', '', 'tzserver');
$search_date_end = GETPOSTDATE('search_date_end', '23:59:59', 'tzserver');
$search_datelimit_startday = GETPOSTINT('search_datelimit_startday');
Expand Down
2 changes: 1 addition & 1 deletion htdocs/install/mysql/migration/19.0.0-20.0.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ ALTER TABLE llx_ticket ADD COLUMN fk_barcode_type integer DEFAULT NULL after bar
ALTER TABLE llx_ticket ADD UNIQUE INDEX uk_ticket_barcode_barcode_type (barcode, fk_barcode_type, entity);
ALTER TABLE llx_ticket ADD CONSTRAINT llx_ticket_fk_product_barcode_type FOREIGN KEY (fk_barcode_type) REFERENCES llx_c_barcode_type (rowid);

ALTER TABLE llx_societe ADD COLUMN fk_parent integer NULL;
ALTER TABLE llx_socpeople ADD COLUMN fk_parent integer NULL;

ALTER TABLE llx_expeditiondet ADD COLUMN fk_element integer;
ALTER TABLE llx_expeditiondet ADD COLUMN element_type varchar(50) DEFAULT 'order' NOT NULL;
Expand Down
4 changes: 2 additions & 2 deletions htdocs/projet/tasks/time.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
$search_value = GETPOSTINT('search_value');
$search_task_ref = GETPOST('search_task_ref', 'alpha');
$search_task_label = GETPOST('search_task_label', 'alpha');
$search_user = GETPOSTINT('search_user');
$search_valuebilled = GETPOSTINT('search_valuebilled');
$search_user = GETPOST('search_user', 'intcomma');
$search_valuebilled = GETPOST('search_valuebilled', 'intcomma');
$search_product_ref = GETPOST('search_product_ref', 'alpha');
$search_company = GETPOST('$search_company', 'alpha');
$search_company_alias = GETPOST('$search_company_alias', 'alpha');
Expand Down
4 changes: 2 additions & 2 deletions htdocs/supplier_proposal/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'supplierproposallist';
$mode = GETPOST('mode', 'alpha');

$search_user = GETPOSTINT('search_user');
$search_sale = GETPOSTINT('search_sale');
$search_user = GETPOST('search_user', 'intcomma');
$search_sale = GETPOST('search_sale', 'intcomma');
$search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha');
$search_societe = GETPOST('search_societe', 'alpha');
$search_societe_alias = GETPOST('search_societe_alias', 'alpha');
Expand Down
11 changes: 7 additions & 4 deletions htdocs/takepos/freezone.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@

$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : '0'); // $place is id of table for Bar or Restaurant

$invoiceid = GETPOST('invoiceid', 'int');

$idline = GETPOSTINT('idline');
$action = GETPOST('action', 'aZ09');

Expand All @@ -60,12 +62,13 @@

// get invoice
$invoice = new Facture($db);
if ($place > 0) {
$invoice->fetch($place);
if ($invoiceid > 0) {
$invoice->fetch($invoiceid);
} else {
$invoice->fetch('', '(PROV-POS'.$_SESSION['takeposterminal'].'-'.$place.')');
}


// get default vat rate
$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION['takeposterminal'];
$soc = new Societe($db);
Expand Down Expand Up @@ -108,8 +111,8 @@ function ApplyVATRate(id, rate) {
* Save (validate)
*/
function Save() {
console.log("We click so we call page invoice.php with place=<?php echo $place; ?> 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()});
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(); ?>&invoiceid=<?php echo $invoiceid; ?>&place=<?php echo $place; ?>&number="+$("#number").val()+"&tva_tx="+vatRate, {desc:$("#desc").val()});
parent.$.colorbox.close();
}

Expand Down
15 changes: 9 additions & 6 deletions htdocs/takepos/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -535,11 +535,12 @@ function ClickProduct(position, qty = 1) {
}
else{
console.log($('#prodiv4').data('rowid'));
invoiceid = $("#invoiceid").val();
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;
// 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')) {
echo "CustomerDisplay();";
}?>
Expand All @@ -559,8 +560,9 @@ function ChangeThirdparty(idcustomer) {
}

function deleteline() {
console.log("Delete line");
$("#poslines").load("invoice.php?action=deleteline&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline, function() {
invoiceid = $("#invoiceid").val();
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);
});
ClearSearch(false);
Expand Down Expand Up @@ -633,8 +635,9 @@ function Floors() {
}

function FreeZone() {
console.log("Open box to enter a free product");
$.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"); ?>"});
invoiceid = $("#invoiceid").val();
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() {
Expand Down
7 changes: 6 additions & 1 deletion htdocs/takepos/invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ function fail($message)
}
}

// 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'))) {
$prod = new Product($db);
$prod->fetch($idproduct);
Expand Down Expand Up @@ -711,6 +712,7 @@ function fail($message)
$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')) {
$customer = new Societe($db);
$customer->fetch($invoice->socid);
Expand All @@ -728,7 +730,10 @@ function fail($message)
$localtax1_tx = get_localtax($tva_tx, 1, $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);
}

Expand Down

0 comments on commit e34d4ec

Please sign in to comment.