Merge branch 'develop' into patch-10

This commit is contained in:
Frédéric FRANCE 2024-12-06 13:28:42 +01:00 committed by GitHub
commit 3678143bb7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 55 additions and 159 deletions

View file

@ -8724,24 +8724,12 @@ parameters:
count: 1
path: ../../htdocs/core/boxes/box_actions.php
-
message: '#^Variable \$nblines might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../htdocs/core/boxes/box_actions.php
-
message: '#^Constructor of class box_actions_future has an unused parameter \$param\.$#'
identifier: constructor.unusedParameter
count: 1
path: ../../htdocs/core/boxes/box_actions_future.php
-
message: '#^Variable \$nblines might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../htdocs/core/boxes/box_actions_future.php
-
message: '#^Constructor of class box_activity has an unused parameter \$param\.$#'
identifier: constructor.unusedParameter
@ -8850,12 +8838,6 @@ parameters:
count: 1
path: ../../htdocs/core/boxes/box_dolibarr_state_board.php
-
message: '#^Property box_external_rss\:\:\$paramdef has no type specified\.$#'
identifier: missingType.property
count: 1
path: ../../htdocs/core/boxes/box_external_rss.php
-
message: '#^Constructor of class box_factures has an unused parameter \$param\.$#'
identifier: constructor.unusedParameter
@ -8952,12 +8934,6 @@ parameters:
count: 1
path: ../../htdocs/core/boxes/box_graph_invoices_supplier_permonth.php
-
message: '#^Variable \$mesg might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/core/boxes/box_graph_invoices_supplier_permonth.php
-
message: '#^Constructor of class box_graph_nb_ticket_last_x_days has an unused parameter \$param\.$#'
identifier: constructor.unusedParameter
@ -8994,12 +8970,6 @@ parameters:
count: 1
path: ../../htdocs/core/boxes/box_graph_orders_permonth.php
-
message: '#^Variable \$mesg might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/core/boxes/box_graph_orders_permonth.php
-
message: '#^Constructor of class box_graph_orders_supplier_permonth has an unused parameter \$param\.$#'
identifier: constructor.unusedParameter
@ -9018,12 +8988,6 @@ parameters:
count: 1
path: ../../htdocs/core/boxes/box_graph_orders_supplier_permonth.php
-
message: '#^Variable \$mesg might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/core/boxes/box_graph_orders_supplier_permonth.php
-
message: '#^Comparison operation "\>" between 0 and 0 is always false\.$#'
identifier: greater.alwaysFalse
@ -9042,30 +9006,6 @@ parameters:
count: 1
path: ../../htdocs/core/boxes/box_graph_product_distribution.php
-
message: '#^Variable \$mesg might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/core/boxes/box_graph_product_distribution.php
-
message: '#^Variable \$px1 might not be defined\.$#'
identifier: variable.undefined
count: 3
path: ../../htdocs/core/boxes/box_graph_product_distribution.php
-
message: '#^Variable \$px2 might not be defined\.$#'
identifier: variable.undefined
count: 3
path: ../../htdocs/core/boxes/box_graph_product_distribution.php
-
message: '#^Variable \$px3 might not be defined\.$#'
identifier: variable.undefined
count: 4
path: ../../htdocs/core/boxes/box_graph_product_distribution.php
-
message: '#^Constructor of class box_graph_propales_permonth has an unused parameter \$param\.$#'
identifier: constructor.unusedParameter
@ -9078,12 +9018,6 @@ parameters:
count: 1
path: ../../htdocs/core/boxes/box_graph_propales_permonth.php
-
message: '#^Variable \$mesg might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/core/boxes/box_graph_propales_permonth.php
-
message: '#^Constructor of class box_graph_ticket_by_severity has an unused parameter \$param\.$#'
identifier: constructor.unusedParameter
@ -9192,24 +9126,12 @@ parameters:
count: 1
path: ../../htdocs/core/boxes/box_project.php
-
message: '#^Variable \$num might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/core/boxes/box_project.php
-
message: '#^Constructor of class box_project_opportunities has an unused parameter \$param\.$#'
identifier: constructor.unusedParameter
count: 1
path: ../../htdocs/core/boxes/box_project_opportunities.php
-
message: '#^Variable \$num might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../htdocs/core/boxes/box_project_opportunities.php
-
message: '#^Constructor of class box_propales has an unused parameter \$param\.$#'
identifier: constructor.unusedParameter
@ -9786,24 +9708,6 @@ parameters:
count: 1
path: ../../htdocs/core/class/commonorder.class.php
-
message: '#^Property CommonOrderLine\:\:\$localtax1_type has no type specified\.$#'
identifier: missingType.property
count: 1
path: ../../htdocs/core/class/commonorder.class.php
-
message: '#^Property CommonOrderLine\:\:\$localtax2_type has no type specified\.$#'
identifier: missingType.property
count: 1
path: ../../htdocs/core/class/commonorder.class.php
-
message: '#^Property CommonOrderLine\:\:\$price has no type specified\.$#'
identifier: missingType.property
count: 1
path: ../../htdocs/core/class/commonorder.class.php
-
message: '#^Parameter \#2 \$pt of method CommonStickerGenerator\:\:Set_Char_Size\(\) expects int, float given\.$#'
identifier: argument.type
@ -11688,12 +11592,6 @@ parameters:
count: 1
path: ../../htdocs/core/lib/company.lib.php
-
message: '#^Property Contact\:\:\$fields .*$#'
identifier: assign.propertyType
count: 3
path: ../../htdocs/core/lib/company.lib.php
-
message: '#^Ternary operator condition is always false\.$#'
identifier: ternary.alwaysFalse
@ -31716,12 +31614,6 @@ parameters:
count: 2
path: ../../htdocs/societe/class/societe.class.php
-
message: '#^Property Societe\:\:\$fields .*$#'
identifier: assign.propertyType
count: 3
path: ../../htdocs/societe/class/societe.class.php
-
message: '#^Property Societe\:\:\$fournisseur \(int\) in isset\(\) is not nullable\.$#'
identifier: isset.property
@ -32808,12 +32700,6 @@ parameters:
count: 1
path: ../../htdocs/theme/md/flags-sprite.inc.php
-
message: '#^Variable \$conf might not be defined\.$#'
identifier: variable.undefined
count: 4
path: ../../htdocs/theme/md/info-box.inc.php
-
message: '#^Variable \$left might not be defined\.$#'
identifier: variable.undefined

View file

@ -55,7 +55,7 @@
preg_match('/:([!<>=\s]+|in|notin|like|notlike):/', $tmpcrit, $reg);
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=transfert&token='.newToken().'">'.$langs->trans("TransferStock").'</a>';
print '<span class="opacitymedium">'.$langs->trans("ClinkOnALinkOfColumn", $langs->transnoentitiesnoconv("Referers")).'</span>';
print '<td class="center nowraponall">'.dol_print_date($db->jdate($obj->periode), 'day').'</td>';
print '<td class="center nowraponall">'.dol_print_date($db->jdate($obj->period), 'day').'</td>';
"sme",
$action = 'transfert';
$cle_rib = strtolower(checkES($rib, $CCC));
@ -71,7 +71,7 @@
$reday = GETPOSTINT('reday');
$sql .= " (cs.periode IS NOT NULL AND cs.periode between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
$sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
$sql .= ", '".$this->db->idate($this->periode)."'";
$sql .= ", '".$this->db->idate($this->period)."'";
$sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode as period, cs.import_key";
$sql .= ", periode = '".$this->db->idate($this->period ? $this->period : $this->periode)."'";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, fk_projet, entity, fk_user_author, fk_user, date_creation)";
@ -83,14 +83,12 @@
$title = $langs->trans('Product')." ".$shortlabel." - ".$langs->trans('Referers');
$title = $langs->trans('Service')." ".$shortlabel." - ".$langs->trans('Referers');
$title = $langs->transnoentities("Balance")." - ".$langs->transnoentities("AllTime");
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
if (!empty($arrayfields['cs.periode']['checked'])) {
if ($newamount == 0 || empty($this->date_ech) || (empty($this->period) && empty($this->periode))) {
if ($user->hasRight('stock', 'mouvement', 'creer')) {
if (GETPOSTISSET("reday") && GETPOSTISSET("remonth") && GETPOSTISSET("reyear")) {
if (empty($reyear) || empty($remonth) || empty($reday)) {
* @param float|string $selectedrate Force preselected vat rate. Can be '8.5' or '8.5 (NOO)' for example. Use '' for no forcing.
$date = $obj->periode;
$datepaid = dol_mktime(12, 0, 0, GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear"));
$datepaid = dol_mktime(12, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear"));
$datepaye = dol_mktime(12, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear"));
@ -128,7 +126,6 @@
print '<select name="mouvement" id="mouvement" class="minwidth100 valignmiddle">';
print '<td class="left" width="25%">'.$langs->trans("Referers").'</td>';
print '<td class="right">'.$langs->trans("NbOfMembers").' <span class="opacitymedium">('.$langs->trans("AllTime").')</span></td>';
print '<tr><td>'.$langs->trans("Period")."</td><td>".dol_print_date($charge->periode, 'day')."</td></tr>\n";
print ajax_combobox("mouvement");
print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.lastname,cs.periode", "", $param, 'class="left"', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['cs.amount']['label'], $_SERVER["PHP_SELF"], "cs.amount,cs.periode", '', $param, 'class="right"', $sortfield, $sortorder);
@ -150,8 +147,8 @@ $permissiontoadd = $user->hasRight('stock', 'mouvement', 'creer');
$permissiontodelete = $user->hasRight('stock', 'mouvement', 'creer'); // There is no deletion permission for stock movement as we should never delete
$permissiontoread = $user->hasRight('stock', 'mouvement', 'lire');
$sql .= " GROUP BY cs.rowid, cs.fk_type, cs.fk_user, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, cs.fk_account, c.libelle, c.accountancy_code, ba.label, ba.ref, ba.number, ba.account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos, pay.code";
$sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode, cs.fk_account,";
$sql .= " cs.rowid, cs.libelle as label_sc, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total, cs.paye,";
$sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode as period, cs.fk_account,";
$sql .= " cs.rowid, cs.libelle as label_sc, cs.fk_type as type, cs.periode as period, cs.date_ech, cs.amount as total, cs.paye,";
$sql = "SELECT id_users, nom as name, id_sondage, reponses";
$sql = 'SELECT nom as name, reponses';
$title = $langs->trans("Referers", $object->name);

View file

@ -971,9 +971,10 @@ if (empty($reshook)) {
// Define date start and date end for all line
$alldate_start = dol_mktime(GETPOSTINT('alldate_starthour'), GETPOSTINT('alldate_startmin'), 0, GETPOSTINT('alldate_startmonth'), GETPOSTINT('alldate_startday'), GETPOSTINT('alldate_startyear'));
$alldate_end = dol_mktime(GETPOSTINT('alldate_endhour'), GETPOSTINT('alldate_endmin'), 0, GETPOSTINT('alldate_endmonth'), GETPOSTINT('alldate_endday'), GETPOSTINT('alldate_endyear'));
foreach ($object->lines as $line) {
foreach ($object->lines as $key => $line) {
if ($line->product_type == 1) { // only service line
$result = $object->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $alldate_start, $alldate_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
$object->lines[$key] = $object->line;
}
}
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha') !== '' && $usercancreate) {
@ -982,24 +983,26 @@ if (empty($reshook)) {
$vat_rate = str_replace('*', '', $vat_rate);
$localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty, $mysoc);
$localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty, $mysoc);
foreach ($object->lines as $line) {
foreach ($object->lines as $key => $line) {
$result = $object->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
$object->lines[$key] = $object->line;
}
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('remiseforalllines', 'alpha') !== '' && $usercancreate) {
// Define a discount for all lines
$remise_percent = (GETPOST('remiseforalllines') ? GETPOST('remiseforalllines') : 0);
$remise_percent = str_replace('*', '', $remise_percent);
foreach ($object->lines as $line) {
foreach ($object->lines as $key => $line) {
$tvatx = $line->tva_tx;
if (!empty($line->vat_src_code)) {
$tvatx .= ' ('.$line->vat_src_code.')';
}
$result = $object->updateline($line->id, $line->subprice, $line->qty, $remise_percent, $tvatx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
$object->lines[$key] = $object->line;
}
} elseif ($action == 'addline' && GETPOST('submitforallmargins', 'alpha') && GETPOST('marginforalllines') !== '' && $usercancreate) {
// Define margin
$margin_rate = (GETPOST('marginforalllines') ? GETPOST('marginforalllines') : 0);
foreach ($object->lines as &$line) {
foreach ($object->lines as $key => $line) {
$subprice = price2num($line->pa_ht * (1 + $margin_rate / 100), 'MU');
$prod = new Product($db);
$prod->fetch($line->fk_product);
@ -1009,23 +1012,28 @@ if (empty($reshook)) {
setEventMessages($prod->ref.' - '.$prod->label.' ('.$price_subprice.' < '.$price_price_min.' '.strtolower($langs->trans("MinPrice")).')'."\n", null, 'warnings');
}
// Manage $line->subprice and $line->multicurrency_subprice
$multicurrency_subprice = (float) $subprice * $line->multicurrency_subprice / $line->subprice;
if ($line->subprice <> 0) {
$multicurrency_subprice = (float) $subprice * $line->multicurrency_subprice / $line->subprice;
} else {
$multicurrency_subprice = 0;
}
// Update DB
$result = $object->updateline($line->id, $subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $multicurrency_subprice);
$object->lines[$key] = $object->line;
// Update $object with new margin info
$line->price = $subprice;
$line->marge_tx = $margin_rate;
$line->marque_tx = $margin_rate * $line->pa_ht / (float) $subprice;
$line->total_ht = $line->qty * (float) $subprice;
$line->total_tva = $line->tva_tx * $line->qty * (float) $subprice;
$line->total_ttc = (1 + $line->tva_tx) * $line->qty * (float) $subprice;
// Manage $line->subprice and $line->multicurrency_subprice
$line->multicurrency_total_ht = $line->qty * (float) $subprice * $line->multicurrency_subprice / $line->subprice;
$line->multicurrency_total_tva = $line->tva_tx * $line->qty * (float) $subprice * $line->multicurrency_subprice / $line->subprice;
$line->multicurrency_total_ttc = (1 + $line->tva_tx) * $line->qty * (float) $subprice * $line->multicurrency_subprice / $line->subprice;
// Used previous $line->subprice and $line->multicurrency_subprice above, now they can be set to their new values
$line->subprice = (float) $subprice;
$line->multicurrency_subprice = $multicurrency_subprice;
// $line->price = $subprice;
// $line->marge_tx = $margin_rate;
// $line->marque_tx = $margin_rate * $line->pa_ht / (float) $subprice;
// $line->total_ht = $line->qty * (float) $subprice;
// $line->total_tva = $line->tva_tx * $line->qty * (float) $subprice;
// $line->total_ttc = (1 + $line->tva_tx) * $line->qty * (float) $subprice;
// // Manage $line->subprice and $line->multicurrency_subprice
// $line->multicurrency_total_ht = $line->qty * (float) $subprice * $line->multicurrency_subprice / $line->subprice;
// $line->multicurrency_total_tva = $line->tva_tx * $line->qty * (float) $subprice * $line->multicurrency_subprice / $line->subprice;
// $line->multicurrency_total_ttc = (1 + $line->tva_tx) * $line->qty * (float) $subprice * $line->multicurrency_subprice / $line->subprice;
// // Used previous $line->subprice and $line->multicurrency_subprice above, now they can be set to their new values
// $line->subprice = (float) $subprice;
// $line->multicurrency_subprice = $multicurrency_subprice;
}
} elseif ($action == 'addline' && !GETPOST('submitforalllines', 'alpha') && !GETPOST('submitforallmargins', 'alpha') && $usercancreate) { // Add line
// Set if we used free entry or predefined product

View file

@ -195,7 +195,7 @@ if ($action == 'create') {
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td><a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$chid.'">'.$chid.'</a></td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$charge->label."</td></tr>\n";
print '<tr><td>'.$langs->trans("Type")."</td><td>".$charge->type_label."</td></tr>\n";
print '<tr><td>'.$langs->trans("Period")."</td><td>".dol_print_date($charge->periode, 'day')."</td></tr>\n";
print '<tr><td>'.$langs->trans("Period")."</td><td>".dol_print_date($charge->period, 'day')."</td></tr>\n";
/*print '<tr><td>'.$langs->trans("DateDue")."</td><td>".dol_print_date($charge->date_ech,'day')."</td></tr>\n";
print '<tr><td>'.$langs->trans("Amount")."</td><td>".price($charge->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';*/

View file

@ -293,12 +293,13 @@ if (empty($reshook)) {
$object->date_ech = dol_time_plus_duree($object->date_ech, 1, 'm');
} else {
// Note date_ech is often a little bit higher than dateperiod
$newdateech = dol_mktime(0, 0, 0, GETPOSTINT('clone_date_echmonth'), GETPOSTINT('clone_date_echday'), GETPOSTINT('clone_date_echyear')); // = date of creation or due date
$newdateperiod = dol_mktime(0, 0, 0, GETPOSTINT('clone_periodmonth'), GETPOSTINT('clone_periodday'), GETPOSTINT('clone_periodyear'));
$newdateech = dol_mktime(0, 0, 0, GETPOSTINT('clone_date_echmonth'), GETPOSTINT('clone_date_echday'), GETPOSTINT('clone_date_echyear'));
if ($newdateperiod) {
$object->period = $newdateperiod;
if (empty($newdateech)) {
$object->date_ech = $object->periode;
$object->date_ech = $object->period;
}
}
if ($newdateech) {

View file

@ -300,7 +300,7 @@ class ChargeSociales extends CommonObject
$sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : "NULL");
$sql .= ", '".$this->db->escape($this->label ? $this->label : $this->lib)."'";
$sql .= ", '".$this->db->idate($this->date_ech)."'";
$sql .= ", '".$this->db->idate($this->periode)."'";
$sql .= ", '".$this->db->idate($this->period)."'";
$sql .= ", '".price2num($newamount)."'";
$sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 'NULL');
$sql .= ", ".((int) $conf->entity);

View file

@ -210,7 +210,7 @@ llxHeader('', $title, '', '', 0, 0, '', '', '', 'bodyforlist');
$arrayofselected = is_array($toselect) ? $toselect : array();
$sql = "SELECT cs.rowid, cs.fk_type as type, cs.fk_user,";
$sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode, cs.fk_account,";
$sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode as period, cs.fk_account,";
if (isModEnabled('project')) {
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
}
@ -748,7 +748,7 @@ while ($i < $imaxinloop) {
// Date end period
if (!empty($arrayfields['cs.periode']['checked'])) {
print '<td class="center nowraponall">'.dol_print_date($db->jdate($obj->periode), 'day').'</td>';
print '<td class="center nowraponall">'.dol_print_date($db->jdate($obj->period), 'day').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}

View file

@ -154,7 +154,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
$sql = "SELECT c.id, c.libelle as type_label,";
$sql .= " cs.rowid, cs.libelle as label_sc, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total, cs.paye,";
$sql .= " cs.rowid, cs.libelle as label_sc, cs.fk_type as type, cs.periode as period, cs.date_ech, cs.amount as total, cs.paye,";
$sql .= " pc.rowid as pid, pc.datep, pc.amount as totalpaid, pc.num_paiement as num_payment, pc.fk_bank,";
$sql .= " pct.code as payment_code,";
$sql .= " u.rowid as uid, u.lastname, u.firstname, u.email, u.login, u.admin, u.statut,";
@ -175,8 +175,8 @@ if ($search_sc_type > 0) {
}
if ($year > 0) {
$sql .= " AND (";
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
// If period defined, we use it as a date criteria, elsewe use the dure date,
// so we are compatible with case where period is not mandatory.
$sql .= " (cs.periode IS NOT NULL AND cs.periode between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
$sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
$sql .= ")";
@ -296,9 +296,9 @@ while ($i < min($num, $limit)) {
print $socialcontrib->getNomUrl(1, '');
print '</td>';
// Type
print '<td title="'.dol_escape_htmltag($obj->type_label).'" class="tdoverflowmax300">'.$obj->type_label.'</td>';
print '<td title="'.dolPrintHTMLForAttribute($obj->type_label).'" class="tdoverflowmax300">'.dolPrintHTML($obj->type_label).'</td>';
// Date
$date = $obj->periode;
$date = $obj->period;
if (empty($date)) {
$date = $obj->date_ech;
}

View file

@ -7158,10 +7158,11 @@ class Form
* @param string $labeladddateof Label to use for the $adddateof parameter. Deprecated. Used only when $adddateof is not an array.
* @param string $placeholder Placeholder
* @param 'auto'|'gmt'|'tzserver'|'tzuserrel' $gm 'auto' (for backward compatibility, avoid this), 'gmt' or 'tzserver' or 'tzuserrel'
* @param string $calendarpicto URL of the icon/image used to display the calendar
* @return string Html for selectDate
* @see form_date(), select_month(), select_year(), select_dayofweek()
*/
public function selectDate($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '', $openinghours = '', $stepminutes = 1, $labeladddateof = '', $placeholder = '', $gm = 'auto')
public function selectDate($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '', $openinghours = '', $stepminutes = 1, $labeladddateof = '', $placeholder = '', $gm = 'auto', $calendarpicto = '')
{
global $conf, $langs;
@ -7312,9 +7313,10 @@ class Form
}
// Note: We don't need monthNames, monthNamesShort, dayNames, dayNamesShort, dayNamesMin, they are set globally on datepicker component in lib_head.js.php
if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) {
$buttonImage = $calendarpicto ?: DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png";
$retstring .= "
showOn: 'button', /* both has problem with autocompletion */
buttonImage: '" . DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png',
buttonImage: '" . $buttonImage . "',
buttonImageOnly: true";
}
$retstring .= "

View file

@ -109,6 +109,7 @@ class FormMargin
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) { // Special case for old situation mode
'@phan-var-force Facture $object';
/** @var Facture $object */
if (($object->element == 'facture' && $object->type == $object::TYPE_SITUATION)
|| ($object->element == 'facture' && $object->type == $object::TYPE_CREDIT_NOTE && getDolGlobalInt('INVOICE_USE_SITUATION_CREDIT_NOTE') && $object->situation_counter > 0)) {
// We need a compensation relative to $line->situation_percent

View file

@ -952,6 +952,9 @@ class Notify
$arraydefaultmessage = $formmail->getEMailTemplate($this->db, $object_type.'_send', $user, $outputlangs, 0, 1, $labeltouse);
}
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
if (method_exists($object, 'fetch_thirdparty') && empty($object->thirdparty)) {
$object->fetch_thirdparty();
}
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs);

View file

@ -309,7 +309,7 @@ if (empty($reshook)) {
}
if (!$error && !getDolGlobalString('EXPENSEREPORT_ALLOW_OVERLAPPING_PERIODS')) {
$overlappingExpenseReportID = $object->periode_existe($fuser, $object->date_debut, $object->date_fin);
$overlappingExpenseReportID = $object->periodExists($fuser, $object->date_debut, $object->date_fin);
if ($overlappingExpenseReportID > 0) {
$error++;

View file

@ -2378,26 +2378,24 @@ class ExpenseReport extends CommonObject
return 1;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* periode_existe
* periodExists
*
* @param User $fuser User
* @param integer $date_debut Start date
* @param integer $date_fin End date
* @return int Return integer <0 if KO, >0 if OK
*/
public function periode_existe($fuser, $date_debut, $date_fin)
public function periodExists($fuser, $date_debut, $date_fin)
{
global $conf;
// phpcs:enable
$sql = "SELECT rowid, date_debut, date_fin";
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " WHERE entity = ".((int) $conf->entity); // not shared, only for the current entity
$sql .= " AND fk_user_author = ".((int) $fuser->id);
dol_syslog(get_class($this)."::periode_existe sql=".$sql);
dol_syslog(get_class($this)."::periodExists sql=".$sql);
$result = $this->db->query($sql);
if ($result) {
$num_rows = $this->db->num_rows($result);
@ -2426,7 +2424,7 @@ class ExpenseReport extends CommonObject
}
} else {
$this->error = $this->db->lasterror();
dol_syslog(get_class($this)."::periode_existe Error ".$this->error, LOG_ERR);
dol_syslog(get_class($this)."::periodExists Error ".$this->error, LOG_ERR);
return -1;
}
}