Skip to content

Commit

Permalink
Merge branch '19.0' of [email protected]:Dolibarr/dolibarr.git into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Mar 13, 2024
2 parents 9c876b2 + 8bfc077 commit c867bc2
Show file tree
Hide file tree
Showing 18 changed files with 159 additions and 106 deletions.
2 changes: 1 addition & 1 deletion htdocs/accountancy/bookkeeping/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@
setEventMessages($object->error, $object->errors, 'errors');
$error++;
break;
} elseif (isset($object->date_validation) || $object->date_validation != '') {
} elseif (isset($object->date_validation) && $object->date_validation != '') {
setEventMessages($langs->trans("ValidatedRecordWhereFound"), null, 'errors');
$error++;
break;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/bookkeeping/listbyaccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@
setEventMessages($object->error, $object->errors, 'errors');
$error++;
break;
} elseif (isset($object->date_validation) || $object->date_validation != '') {
} elseif (isset($object->date_validation) && $object->date_validation != '') {
setEventMessages($langs->trans("ValidatedRecordWhereFound"), null, 'errors');
$error++;
break;
Expand Down
34 changes: 22 additions & 12 deletions htdocs/admin/invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -617,13 +617,14 @@
print '<form action="'.$_SERVER["PHP_SELF"].'#default-pdf-modules-by-type-table" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'" />';
print '<input type="hidden" name="action" value="setDefaultPDFModulesByType" >';
print '<input type="hidden" name="page_y" value="" />';

print '<div class="div-table-responsive-no-min">';
print '<table id="default-pdf-modules-by-type-table" class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Type").'</td>';
print '<td>'.$langs->trans("Name").'</td>';
print '<td class="right"><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'"></td>';
print '<td class="right"><input type="submit" class="button button-edit reposition" value="'.$langs->trans("Modify").'"></td>';
print "</tr>\n";

$listtype = array(
Expand Down Expand Up @@ -659,6 +660,7 @@

print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'" />';
print '<input type="hidden" name="page_y" value="" />';

print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
Expand All @@ -667,17 +669,16 @@
print '<td>';
print '<input type="hidden" name="action" value="setribchq">';
print $langs->trans("PaymentMode").'</td>';
print '<td class="right"><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'"></td>';
print '<td class="right"><input type="submit" class="button button-edit reposition" value="'.$langs->trans("Modify").'"></td>';
print "</tr>\n";

print '<tr class="oddeven">';
print "<td>".$langs->trans("SuggestPaymentByRIBOnAccount")."</td>";
print "<td>";
if (isModEnabled('bank')) {
$sql = "SELECT rowid, label";
$sql = "SELECT rowid, label, clos";
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
$sql .= " WHERE clos = 0";
$sql .= " AND courant = 1";
$sql .= " WHERE courant = 1";
$sql .= " AND entity IN (".getEntity('bank_account').")";
$resql = $db->query($sql);
if ($resql) {
Expand All @@ -687,15 +688,19 @@
print '<select name="rib" class="flat" id="rib">';
print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>';
while ($i < $num) {
$row = $db->fetch_row($resql);
$obj = $db->fetch_object($resql);

print '<option value="'.$row[0].'"';
print $conf->global->FACTURE_RIB_NUMBER == $row[0] ? ' selected' : '';
print '>'.$row[1].'</option>';
print '<option value="'.$obj->rowid.'"';
print getDolGlobalString('FACTURE_RIB_NUMBER') == $obj->rowid ? ' selected' : '';
if (!empty($obj->clos)) {
print ' disabled';
}
print '>'.dol_escape_htmltag($obj->label).'</option>';

$i++;
}
print "</select>";
print ajax_combobox("rib");
} else {
print '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
}
Expand Down Expand Up @@ -735,6 +740,8 @@
}
}
print "</select>";
print ajax_combobox("chq", array(), 0, 0, 'resolve', -2);

print "</td></tr>";
print "</table>";
print '</div>';
Expand All @@ -757,12 +764,13 @@
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'" />';
print '<input type="hidden" name="action" value="setforcedate" />';
print '<input type="hidden" name="page_y" value="" />';
print '<tr class="oddeven"><td>';
print $langs->trans("ForceInvoiceDate");
print '</td><td width="60" class="center">';
print $form->selectyesno("forcedate", getDolGlobalInt('FAC_FORCE_DATE_VALIDATION', 0), 1);
print '</td><td class="right">';
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'" />';
print '<input type="submit" class="button button-edit reposition" value="'.$langs->trans("Modify").'" />';
print "</td></tr>\n";
print '</form>';

Expand All @@ -777,6 +785,7 @@
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'" />';
print '<input type="hidden" name="action" value="set_INVOICE_FREE_TEXT" />';
print '<input type="hidden" name="page_y" value="" />';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename = 'INVOICE_FREE_TEXT';
Expand All @@ -788,20 +797,21 @@
print $doleditor->Create();
}
print '</td><td class="right">';
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'" />';
print '<input type="submit" class="button button-edit reposition" value="'.$langs->trans("Modify").'" />';
print "</td></tr>\n";
print '</form>';


print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'" />';
print '<input type="hidden" name="action" value="set_FACTURE_DRAFT_WATERMARK" />';
print '<input type="hidden" name="page_y" value="" />';
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftBill"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
print '</td>';
print '<td><input class="flat minwidth200imp" type="text" name="FACTURE_DRAFT_WATERMARK" value="'.dol_escape_htmltag(getDolGlobalString('FACTURE_DRAFT_WATERMARK')).'">';
print '</td><td class="right">';
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'" />';
print '<input type="submit" class="button button-edit reposition" value="'.$langs->trans("Modify").'" />';
print "</td></tr>\n";
print '</form>';

Expand Down
22 changes: 13 additions & 9 deletions htdocs/comm/propal/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -2903,19 +2903,23 @@
print '<td class="titlefieldmiddle">' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
print '<td class="nowrap amountcard right">' . price($object->total_localtax1, 0, $langs, 1, -1, -1, $conf->currency) . '</td>';
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
print '<td class="nowrap amountcard right">' . price($object->total_localtax1, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '</td>';
$object->multicurrency_total_localtax1 = price2num($object->total_localtax1 * $object->multicurrency_tx, 'MT');

print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_localtax1, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '</td>';
}
print '</tr>';
}

if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) {
print '<tr>';
print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
print '<td class="nowrap amountcard right">' . price($object->total_localtax2, 0, $langs, 1, -1, -1, $conf->currency) . '</td>';
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
print '<td class="nowrap amountcard right">' . price($object->total_localtax2, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '</td>';
}
print '</tr>';
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) {
print '<tr>';
print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
print '<td class="nowrap amountcard right">' . price($object->total_localtax2, 0, $langs, 1, -1, -1, $conf->currency) . '</td>';
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
$object->multicurrency_total_localtax2 = price2num($object->total_localtax2 * $object->multicurrency_tx, 'MT');

print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_localtax2, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '</td>';
}
print '</tr>';
}

print '<tr>';
Expand Down
12 changes: 0 additions & 12 deletions htdocs/comm/propal/class/propal.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,18 +281,6 @@ class Propal extends CommonObject
public $labelStatus = array();
public $labelStatusShort = array();

// Multicurrency
/**
* @var int ID
*/
public $fk_multicurrency;

public $multicurrency_code;
public $multicurrency_tx;
public $multicurrency_total_ht;
public $multicurrency_total_tva;
public $multicurrency_total_ttc;


/**
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
Expand Down
24 changes: 14 additions & 10 deletions htdocs/commande/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -2804,20 +2804,24 @@
print '<td class="titlefieldmiddle">' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
print '<td class="nowrap amountcard right">' . price($object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
print '<td class="nowrap amountcard right">' . price($object->total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
$object->multicurrency_total_localtax1 = price2num($object->total_localtax1 * $object->multicurrency_tx, 'MT');

print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
}
print '</tr>';
}

// Amount Local Taxes
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) {
print '<tr>';
print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
print '<td class="nowrap amountcard right">' . price($object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
print '<td class="nowrap amountcard right">' . price($object->total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
}
print '</tr>';
// Amount Local Taxes
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) {
print '<tr>';
print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
print '<td class="nowrap amountcard right">' . price($object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
$object->multicurrency_total_localtax2 = price2num($object->total_localtax2 * $object->multicurrency_tx, 'MT');

print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
}
print '</tr>';
}

print '<tr>';
Expand Down
14 changes: 0 additions & 14 deletions htdocs/commande/class/commande.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,20 +253,6 @@ class Commande extends CommonOrder
*/
public $lines = array();

// Multicurrency
/**
* @var int Currency ID
*/
public $fk_multicurrency;

/**
* @var string multicurrency code
*/
public $multicurrency_code;
public $multicurrency_tx;
public $multicurrency_total_ht;
public $multicurrency_total_tva;
public $multicurrency_total_ttc;

//! key of module source when order generated from a dedicated module ('cashdesk', 'takepos', ...)
public $module_source;
Expand Down
23 changes: 13 additions & 10 deletions htdocs/compta/facture/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -5014,22 +5014,25 @@ function setRadioForTypeOfInvoice() {
print '<td class="titlefieldmiddle">' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
print '<td class="nowrap amountcard right">' . price($sign * $object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
print '<td class="nowrap amountcard right">' . price($sign * $object->total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
$object->multicurrency_total_localtax1 = price2num($object->total_localtax1 * $object->multicurrency_tx, 'MT');

print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
}
print '</tr>';
}

if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) {
print '<tr>';
print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
print '<td class="nowrap amountcard right">' . price($sign * $object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
print '<td class="nowrap amountcard right">' . price($sign * $object->total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
}
print '</tr>';
if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) {
print '<tr>';
print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
print '<td class="nowrap amountcard right">' . price($sign * $object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
$object->multicurrency_total_localtax2 = price2num($object->total_localtax2 * $object->multicurrency_tx, 'MT');

print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
}
print '</tr>';
}


// Add the revenue stamp
if ($selleruserevenustamp) {
print '<tr><td class="titlefieldmiddle">';
Expand Down
1 change: 1 addition & 0 deletions htdocs/compta/facture/class/facture.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ class Facture extends CommonInvoice

public $date_pointoftax;


/**
* @var int Situation cycle reference number
*/
Expand Down
10 changes: 10 additions & 0 deletions htdocs/core/class/commonobject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,16 @@ abstract class CommonObject
*/
public $multicurrency_total_ttc;

/**
* @var float Multicurrency total localta1
*/
public $multicurrency_total_localtax1; // not in database

/**
* @var float Multicurrency total localtax2
*/
public $multicurrency_total_localtax2; // not in database

/**
* @var string
* @see SetDocModel()
Expand Down
17 changes: 13 additions & 4 deletions htdocs/core/modules/commande/doc/pdf_einstein.modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -947,8 +947,10 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);

$total_localtax = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? price2num($tvaval * $object->multicurrency_tx, 'MT') : $tvaval);

$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_localtax, 0, $outputlangs), 0, 'R', 1);
}
}
}
Expand Down Expand Up @@ -977,8 +979,10 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);

$total_localtax = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? price2num($tvaval * $object->multicurrency_tx, 'MT') : $tvaval);

$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_localtax, 0, $outputlangs), 0, 'R', 1);
}
}
}
Expand Down Expand Up @@ -1038,8 +1042,11 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs

$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);

$total_localtax = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? price2num($tvaval * $object->multicurrency_tx, 'MT') : $tvaval);

$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_localtax, 0, $outputlangs), 0, 'R', 1);
}
}
}
Expand Down Expand Up @@ -1071,8 +1078,10 @@ protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs
$totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);

$total_localtax = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? price2num($tvaval * $object->multicurrency_tx, 'MT') : $tvaval);

$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_localtax, 0, $outputlangs), 0, 'R', 1);
}
}
}
Expand Down
Loading

0 comments on commit c867bc2

Please sign in to comment.