Skip to content

Commit

Permalink
Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Feb 1, 2024
2 parents 6b5aba1 + a237f5d commit 9dd1646
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 15 deletions.
6 changes: 3 additions & 3 deletions htdocs/core/class/commonobject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -9139,7 +9139,7 @@ public function setVarsFromFetchObj(&$obj)

foreach ($this->fields as $field => $info) {
if ($this->isDate($info)) {
if (is_null($obj->$field) || $obj->$field === '' || $obj->$field === '0000-00-00 00:00:00' || $obj->$field === '1000-01-01 00:00:00') {
if (!isset($obj->$field) || is_null($obj->$field) || $obj->$field === '' || $obj->$field === '0000-00-00 00:00:00' || $obj->$field === '1000-01-01 00:00:00') {
$this->$field = '';
} else {
$this->$field = $db->jdate($obj->$field);
Expand All @@ -9155,7 +9155,7 @@ public function setVarsFromFetchObj(&$obj)
$this->$field = (double) $obj->$field;
}
} else {
if (!is_null($obj->$field) || (isset($info['notnull']) && $info['notnull'] == 1)) {
if (isset($obj->$field) && !is_null($obj->$field) || (isset($info['notnull']) && $info['notnull'] == 1)) {
$this->$field = (int) $obj->$field;
} else {
$this->$field = null;
Expand All @@ -9170,7 +9170,7 @@ public function setVarsFromFetchObj(&$obj)
$this->$field = (double) $obj->$field;
}
} else {
if (!is_null($obj->$field) || (isset($info['notnull']) && $info['notnull'] == 1)) {
if (isset($obj->$field) && !is_null($obj->$field) || (isset($info['notnull']) && $info['notnull'] == 1)) {
$this->$field = (double) $obj->$field;
} else {
$this->$field = null;
Expand Down
8 changes: 4 additions & 4 deletions htdocs/core/class/extrafields.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function __construct($db)
*
* @param string $attrname Code of attribute
* @param string $label label of attribute
* @param string $type Type of attribute ('boolean','int','varchar','text','html','date','datehour','price', 'pricecy', 'phone','mail','password','url','select','checkbox','separate',...)
* @param string $type Type of attribute ('boolean','int','varchar','text','html','date','datetime','price', 'pricecy', 'phone','mail','password','url','select','checkbox','separate',...)
* @param int $pos Position of attribute
* @param string $size Size/length definition of attribute ('5', '24,8', ...). For float, it contains 2 numeric separated with a comma.
* @param string $elementtype Element type. Same value than object->table_element (Example 'member', 'product', 'thirdparty', ...)
Expand Down Expand Up @@ -185,7 +185,7 @@ public function addExtraField($attrname, $label, $type, $pos, $size, $elementtyp
* This is a private method. For public method, use addExtraField.
*
* @param string $attrname code of attribute
* @param int $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datehour','price','pricecy','phone','mail','password','url','select','checkbox', ...)
* @param int $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datetime','price','pricecy','phone','mail','password','url','select','checkbox', ...)
* @param string $length Size/length of attribute ('5', '24,8', ...)
* @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...)
* @param int $unique Is field unique or not
Expand Down Expand Up @@ -281,7 +281,7 @@ private function create($attrname, $type = 'varchar', $length = 255, $elementtyp
*
* @param string $attrname code of attribute
* @param string $label label of attribute
* @param int $type Type of attribute ('int', 'varchar', 'text', 'html', 'date', 'datehour', 'float')
* @param int $type Type of attribute ('int', 'varchar', 'text', 'html', 'date', 'datetime', 'float')
* @param int $pos Position of attribute
* @param string $size Size/length of attribute ('5', '24,8', ...)
* @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)
Expand Down Expand Up @@ -529,7 +529,7 @@ private function delete_label($attrname, $elementtype = 'member')
*
* @param string $attrname Name of attribute
* @param string $label Label of attribute
* @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...)
* @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datetime','price','phone','mail','password','url','select','checkbox', ...)
* @param int $length Length of attribute
* @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...)
* @param int $unique Is field unique or not
Expand Down
8 changes: 5 additions & 3 deletions htdocs/fourn/class/fournisseur.facture-rec.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,8 @@ public function update(User $user, $notrigger = 0)
$sql .= " auto_validate = ". (!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0);
$sql .= " WHERE rowid = ". (int) $this->id;

$this->db->begin();

dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
Expand Down Expand Up @@ -981,7 +983,7 @@ public function addline($fk_product, $ref, $label, $desc, $pu_ht, $pu_ttc, $qty,
$sql .= ', fk_user_author';
$sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc';
$sql .= ') VALUES (';
$sql .= ' ' . (int) $facid; // source supplier invoie id
$sql .= ' ' . (int) $facid; // source supplier invoice id
$sql .= ', ' . (!empty($fk_product) ? "'" . $this->db->escape($fk_product) . "'" : 'null');
$sql .= ', ' . (!empty($ref) ? "'" . $this->db->escape($ref) . "'" : 'null');
$sql .= ', ' . (!empty($label) ? "'" . $this->db->escape($label) . "'" : 'null');
Expand Down Expand Up @@ -1009,7 +1011,7 @@ public function addline($fk_product, $ref, $label, $desc, $pu_ht, $pu_ttc, $qty,
$sql .= ', ' . (int) $special_code;
$sql .= ', ' . (int) $rang;
$sql .= ', ' . ($fk_unit ? (int) $fk_unit : 'NULL');
$sql .= ', ' . (int) $user;
$sql .= ', ' . (int) $user->id;
$sql .= ', ' . (int) $this->fk_multicurrency;
$sql .= ", '" . $this->db->escape($this->multicurrency_code) . "'";
$sql .= ', ' . price2num($pu_ht_devise, 'CU');
Expand Down Expand Up @@ -2192,7 +2194,7 @@ public function update(User $user, $notrigger = 0)
$sql .= ', special_code =' . (int) $this->special_code;
$sql .= ', rang = ' . (int) $this->rang;
$sql .= ', fk_unit = ' .($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null');
$sql .= ', fk_user_modif = ' . (int) $user;
$sql .= ', fk_user_modif = ' . (int) $user->id;
$sql .= ' WHERE rowid = ' . (int) $this->id;

$this->db->begin();
Expand Down
40 changes: 35 additions & 5 deletions htdocs/takepos/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,18 @@ function LoadProducts(position, issubcat) {
}
?>
if (data[parseInt(idata)]['price_formated']) {
$("#proprice"+ishow).attr("class", "productprice");
$("#proprice"+ishow).html(data[parseInt(idata)]['price_ttc_formated']);
$("#proprice" + ishow).attr("class", "productprice");
<?php
if (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT')) {
?>
$("#proprice" + ishow).html(data[parseInt(idata)]['price_formated']);
<?php
} else {
?>
$("#proprice" + ishow).html(data[parseInt(idata)]['price_ttc_formated']);
<?php
}
?>
}
console.log("#prodiv"+ishow+".data(rowid)="+data[idata]['id']);
console.log($("#prodiv"+ishow));
Expand Down Expand Up @@ -458,8 +468,18 @@ function MoreProducts(moreorless) {
$("#probutton"+ishow).html(data[parseInt(idata)]['label']);
$("#probutton"+ishow).show();
if (data[parseInt(idata)]['price_formated']) {
$("#proprice"+ishow).attr("class", "productprice");
$("#proprice"+ishow).html(data[parseInt(idata)]['price_ttc_formated']);
$("#proprice" + ishow).attr("class", "productprice");
<?php
if (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT')) {
?>
$("#proprice" + ishow).html(data[parseInt(idata)]['price_formated']);
<?php
} else {
?>
$("#proprice" + ishow).html(data[parseInt(idata)]['price_ttc_formated']);
<?php
}
?>
}
$("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']);
$("#prodiv"+ishow).data("rowid",data[idata]['id']);
Expand Down Expand Up @@ -670,7 +690,17 @@ function Search2(keyCodeForEnter, moreorless) {
$("#probutton" + i).show();
if (data[i]['price_formated']) {
$("#proprice" + i).attr("class", "productprice");
$("#proprice" + i).html(data[i]['price_ttc_formated']);
<?php
if (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT')) {
?>
$("#proprice" + i).html(data[i]['price_formated']);
<?php
} else {
?>
$("#proprice" + i).html(data[i]['price_ttc_formated']);
<?php
}
?>
}
$("#proimg" + i).attr("title", titlestring);
if( undefined !== data[i]['img']) {
Expand Down
4 changes: 4 additions & 0 deletions htdocs/takepos/invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ function fail($message)
if ($pay != "delayed") {
$payment->create($user);
$payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', '');
if ($res < 0) {
$error++;
dol_htmloutput_errors($langs->trans('ErrorNoPaymentDefined'), $payment->errors, 1);
}
$remaintopay = $invoice->getRemainToPay(); // Recalculate remain to pay after the payment is recorded
} elseif (getDolGlobalInt("TAKEPOS_DELAYED_TERMS")) {
$invoice->setPaymentTerms(getDolGlobalInt("TAKEPOS_DELAYED_TERMS"));
Expand Down

0 comments on commit 9dd1646

Please sign in to comment.