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

Conflicts:
	htdocs/langs/en_US/main.lang
This commit is contained in:
Laurent Destailleur 2021-07-14 14:49:06 +02:00
commit 638a66fbb9
10 changed files with 104 additions and 95 deletions

View File

@ -549,110 +549,111 @@ class BlockedLog
$totalamount = 0; $totalamount = 0;
if (!is_array($object->amounts) && $object->amount) { // Loop on each invoice payment amount
$object->amounts = array($object->id => $object->amount); if (is_array($object->amounts) && !empty($object->amounts)) {
} $paymentpartnumber = 0;
foreach ($object->amounts as $objid => $amount) {
if (empty($amount)) {
continue;
}
$paymentpartnumber = 0; $totalamount += $amount;
foreach ($object->amounts as $objid => $amount) {
if (empty($amount)) {
continue;
}
$totalamount += $amount; $tmpobject = null;
if ($this->element == 'payment_supplier') {
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$tmpobject = new FactureFournisseur($this->db);
} elseif ($this->element == 'payment') {
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$tmpobject = new Facture($this->db);
} elseif ($this->element == 'payment_donation') {
include_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
$tmpobject = new Don($this->db);
} elseif ($this->element == 'payment_various') {
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
$tmpobject = new PaymentVarious($this->db);
}
$tmpobject = null; if (!is_object($tmpobject)) {
if ($this->element == 'payment_supplier') { continue;
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; }
$tmpobject = new FactureFournisseur($this->db);
} elseif ($this->element == 'payment') {
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$tmpobject = new Facture($this->db);
} elseif ($this->element == 'payment_donation') {
include_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
$tmpobject = new Don($this->db);
} elseif ($this->element == 'payment_various') {
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
$tmpobject = new PaymentVarious($this->db);
}
if (!is_object($tmpobject)) { $result = $tmpobject->fetch($objid);
continue;
}
$result = $tmpobject->fetch($objid); if ($result <= 0) {
if ($result <= 0) {
$this->error = $tmpobject->error;
$this->errors = $tmpobject->errors;
dol_syslog("Failed to fetch object with id ".$objid, LOG_ERR);
return -1;
}
$paymentpart = new stdClass();
$paymentpart->amount = $amount;
if (!in_array($this->element, array('payment_donation', 'payment_various'))) {
$result = $tmpobject->fetch_thirdparty();
if ($result == 0) {
$this->error = 'Failed to fetch thirdparty for object with id '.$tmpobject->id;
$this->errors[] = $this->error;
dol_syslog("Failed to fetch thirdparty for object with id ".$tmpobject->id, LOG_ERR);
return -1;
} elseif ($result < 0) {
$this->error = $tmpobject->error; $this->error = $tmpobject->error;
$this->errors = $tmpobject->errors; $this->errors = $tmpobject->errors;
dol_syslog("Failed to fetch object with id ".$objid, LOG_ERR);
return -1; return -1;
} }
$paymentpart->thirdparty = new stdClass(); $paymentpart = new stdClass();
foreach ($tmpobject->thirdparty as $key => $value) { $paymentpart->amount = $amount;
if (in_array($key, $arrayoffieldstoexclude)) {
continue; // Discard some properties
}
if (!in_array($key, array(
'name', 'name_alias', 'ref_ext', 'address', 'zip', 'town', 'state_code', 'country_code', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', 'phone', 'fax', 'email', 'barcode',
'tva_intra', 'localtax1_assuj', 'localtax1_value', 'localtax2_assuj', 'localtax2_value', 'managers', 'capital', 'typent_code', 'forme_juridique_code', 'code_client', 'code_fournisseur'
))) {
continue; // Discard if not into a dedicated list
}
if (!is_object($value) && !is_null($value) && $value !== '') {
$paymentpart->thirdparty->{$key} = $value;
}
}
}
// Init object to avoid warnings if (!in_array($this->element, array('payment_donation', 'payment_various'))) {
if ($this->element == 'payment_donation') { $result = $tmpobject->fetch_thirdparty();
$paymentpart->donation = new stdClass(); if ($result == 0) {
} else { $this->error = 'Failed to fetch thirdparty for object with id '.$tmpobject->id;
$paymentpart->invoice = new stdClass(); $this->errors[] = $this->error;
} dol_syslog("Failed to fetch thirdparty for object with id ".$tmpobject->id, LOG_ERR);
return -1;
} elseif ($result < 0) {
$this->error = $tmpobject->error;
$this->errors = $tmpobject->errors;
return -1;
}
if ($this->element != 'payment_various') { $paymentpart->thirdparty = new stdClass();
foreach ($tmpobject as $key => $value) { foreach ($tmpobject->thirdparty as $key => $value) {
if (in_array($key, $arrayoffieldstoexclude)) { if (in_array($key, $arrayoffieldstoexclude)) {
continue; // Discard some properties continue; // Discard some properties
} }
if (!in_array($key, array( if (!in_array($key, array(
'ref', 'ref_client', 'ref_supplier', 'date', 'datef', 'type', 'total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'revenuestamp', 'datepointoftax', 'note_public' 'name', 'name_alias', 'ref_ext', 'address', 'zip', 'town', 'state_code', 'country_code', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', 'phone', 'fax', 'email', 'barcode',
))) { 'tva_intra', 'localtax1_assuj', 'localtax1_value', 'localtax2_assuj', 'localtax2_value', 'managers', 'capital', 'typent_code', 'forme_juridique_code', 'code_client', 'code_fournisseur'
continue; // Discard if not into a dedicated list ))) {
} continue; // Discard if not into a dedicated list
if (!is_object($value) && !is_null($value) && $value !== '') { }
if ($this->element == 'payment_donation') { if (!is_object($value) && !is_null($value) && $value !== '') {
$paymentpart->donation->{$key} = $value; $paymentpart->thirdparty->{$key} = $value;
} elseif ($this->element == 'payment_various') {
$paymentpart->various->{$key} = $value;
} else {
$paymentpart->invoice->{$key} = $value;
} }
} }
} }
$paymentpartnumber++; // first payment will be 1 // Init object to avoid warnings
$this->object_data->payment_part[$paymentpartnumber] = $paymentpart; if ($this->element == 'payment_donation') {
$paymentpart->donation = new stdClass();
} else {
$paymentpart->invoice = new stdClass();
}
if ($this->element != 'payment_various') {
foreach ($tmpobject as $key => $value) {
if (in_array($key, $arrayoffieldstoexclude)) {
continue; // Discard some properties
}
if (!in_array($key, array(
'ref', 'ref_client', 'ref_supplier', 'date', 'datef', 'type', 'total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'revenuestamp', 'datepointoftax', 'note_public'
))) {
continue; // Discard if not into a dedicated list
}
if (!is_object($value) && !is_null($value) && $value !== '') {
if ($this->element == 'payment_donation') {
$paymentpart->donation->{$key} = $value;
} elseif ($this->element == 'payment_various') {
$paymentpart->various->{$key} = $value;
} else {
$paymentpart->invoice->{$key} = $value;
}
}
}
$paymentpartnumber++; // first payment will be 1
$this->object_data->payment_part[$paymentpartnumber] = $paymentpart;
}
} }
} elseif (!empty($object->amount)) {
$totalamount = $object->amount;
} }
$this->object_data->amount = $totalamount; $this->object_data->amount = $totalamount;

View File

@ -1043,7 +1043,7 @@ if ($resql) {
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250'); $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250');
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
} }
// If the user can view prospects other than his' // Filter on product tags
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) {
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';

View File

@ -226,7 +226,7 @@ if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) {
print $thirdpartystatic->getNomUrl(1, 'customer', 44); print $thirdpartystatic->getNomUrl(1, 'customer', 44);
print '</td>'; print '</td>';
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) { if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
print '<td class="nowrap right">'.price($obj->total_ht).'</td>'; print '<td class="nowrap right"><span class="amount">'.price($obj->total_ht).'</span></td>';
} }
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>'; print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
print '<td class="right">'.dol_print_date($db->jdate($obj->tms), 'day').'</td>'; print '<td class="right">'.dol_print_date($db->jdate($obj->tms), 'day').'</td>';

View File

@ -180,7 +180,7 @@ class box_factures extends ModeleBoxes
); );
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'class="right nowraponall"', 'td' => 'class="right nowraponall amount"',
'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency), 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
); );

View File

@ -182,7 +182,7 @@ class box_factures_imp extends ModeleBoxes
); );
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'class="nowraponall right"', 'td' => 'class="nowraponall right amount"',
'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency), 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
); );

View File

@ -118,6 +118,8 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
foreach ($object->amounts as $amount) { foreach ($object->amounts as $amount) {
$amounts += price2num($amount); $amounts += price2num($amount);
} }
} elseif (!empty($object->amount)) {
$amounts = $object->amount;
} }
} elseif (strpos($action, 'PAYMENT') !== false && !in_array($action, array('PAYMENT_ADD_TO_BANK'))) { } elseif (strpos($action, 'PAYMENT') !== false && !in_array($action, array('PAYMENT_ADD_TO_BANK'))) {
$qualified++; $qualified++;

View File

@ -1251,6 +1251,8 @@ class Holiday extends CommonObject
public function LibStatut($status, $mode = 0, $startdate = '') public function LibStatut($status, $mode = 0, $startdate = '')
{ {
// phpcs:enable // phpcs:enable
global $langs;
if (empty($this->labelStatus) || empty($this->labelStatusShort)) { if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
global $langs; global $langs;
//$langs->load("mymodule"); //$langs->load("mymodule");
@ -1266,9 +1268,11 @@ class Holiday extends CommonObject
$this->labelStatusShort[self::STATUS_REFUSED] = $langs->trans('RefuseCP'); $this->labelStatusShort[self::STATUS_REFUSED] = $langs->trans('RefuseCP');
} }
$params = array();
$statusType = 'status6'; $statusType = 'status6';
if (!empty($startdate) && $startdate > dol_now()) { if (!empty($startdate) && $startdate >= dol_now()) { // If not yet passed, we use a green "in live" color
$statusType = 'status4'; $statusType = 'status4';
$params = array('tooltip'=>$this->labelStatus[$status].' - '.$langs->trans("Forthcoming"));
} }
if ($status == self::STATUS_DRAFT) { if ($status == self::STATUS_DRAFT) {
$statusType = 'status0'; $statusType = 'status0';
@ -1283,7 +1287,7 @@ class Holiday extends CommonObject
$statusType = 'status5'; $statusType = 'status5';
} }
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode, '', $params);
} }

View File

@ -730,6 +730,7 @@ if ($resql) {
$holidaystatic->id = $obj->rowid; $holidaystatic->id = $obj->rowid;
$holidaystatic->ref = ($obj->ref ? $obj->ref : $obj->rowid); $holidaystatic->ref = ($obj->ref ? $obj->ref : $obj->rowid);
$holidaystatic->statut = $obj->status; $holidaystatic->statut = $obj->status;
$holidaystatic->date_debut = $db->jdate($obj->date_debut);
// User // User
$userstatic->id = $obj->fk_user; $userstatic->id = $obj->fk_user;
@ -790,7 +791,7 @@ if ($resql) {
} }
if (!empty($arrayfields['duration']['checked'])) { if (!empty($arrayfields['duration']['checked'])) {
print '<td class="right">'; print '<td class="right">';
$nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates
print $nbopenedday.' '.$langs->trans('DurationDays'); print $nbopenedday.' '.$langs->trans('DurationDays');
print '</td>'; print '</td>';
if (!$i) { if (!$i) {

View File

@ -1147,3 +1147,4 @@ RecordsEnabled=%s record(s) enabled
RecordsDisabled=%s record(s) disabled RecordsDisabled=%s record(s) disabled
RecordEnabled=Record enabled RecordEnabled=Record enabled
RecordDisabled=Record disabled RecordDisabled=Record disabled
Forthcoming=Forthcoming

View File

@ -1095,7 +1095,7 @@ $( document ).ready(function() {
$max_sale = 0; $max_sale = 0;
while ($obj = $db->fetch_object($resql)) { while ($obj = $db->fetch_object($resql)) {
echo '$("#customerandsales").append(\''; echo '$("#customerandsales").append(\'';
echo '<a class="valignmiddle" title="'.dol_escape_js($langs->trans("SaleStartedAt", dol_print_date($db->jdate($obj->datec), '%H:%M', 'tzuser'))).'" onclick="place=\\\''; echo '<a class="valignmiddle" title="'.dol_escape_js($langs->trans("SaleStartedAt", dol_print_date($db->jdate($obj->datec), '%H:%M', 'tzuser')).' - '.$obj->ref).'" onclick="place=\\\'';
$num_sale = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref)); $num_sale = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
echo $num_sale; echo $num_sale;
if (str_replace("-", "", $num_sale) > $max_sale) { if (str_replace("-", "", $num_sale) > $max_sale) {