Debug v23

This commit is contained in:
Laurent Destailleur 2025-11-05 21:24:19 +01:00
parent c5cf6f58a6
commit 6df93d0fb9
8 changed files with 36 additions and 43 deletions

View file

@ -26,9 +26,6 @@
// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
/**
* @var Conf $conf
* @var DoliDB $db
@ -36,6 +33,8 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
// Load translation files required by the page
$langs->loadLangs(array('companies', 'orders', 'bills'));
@ -166,28 +165,17 @@ print '<br>';
print load_fiche_titre($langs->trans("NewRelativeDiscount"), '', '');
print '<div class="underbanner clearboth"></div>';
/*if (! ($isCustomer && $isSupplier))
{
if ($isCustomer && ! $isSupplier) {
print '<input type="hidden" name="discount_type" value="0" />';
}
if (! $isCustomer && $isSupplier) {
print '<input type="hidden" name="discount_type" value="1" />';
}
}*/
print '<table class="border centpercent marginbottomonly">';
print '<table class="noborder centpercent marginbottomonly">';
if ($isCustomer || $isSupplier) {
// Discount type
print '<tr><td class="titlefield fieldrequired">'.$langs->trans('DiscountType').'</td><td>';
print '<tr class="trfirstline"><td class="titlefield fieldrequired">'.$langs->trans('DiscountType').'</td><td>';
if ($isCustomer) {
print '<input type="radio" name="discount_type" id="discount_type_0" '.(GETPOSTISSET('discount_type') ? (GETPOSTINT('discount_type') == 0 ? ' checked' : '') : ' checked').' value="0"> <label for="discount_type_0">'.$langs->trans('Customer').'</label>';
}
if ($isCustomer && $isSupplier) {
print ' &nbsp; ';
print ' &nbsp; &nbsp; ';
}
if ($isSupplier) {
print ' <input type="radio" name="discount_type" id="discount_type_1"'.(GETPOSTISSET('discount_type') ? (GETPOSTINT('discount_type') ? ' checked' : '') : ($isCustomer ? '' : ' checked')).' value="1"> <label for="discount_type_1">'.$langs->trans('Supplier').'</label>';
@ -197,10 +185,10 @@ if ($isCustomer || $isSupplier) {
// New value
print '<tr><td class="titlefield fieldrequired">';
print $langs->trans("NewValue").'</td><td><input type="text" size="5" name="remise" value="'.dol_escape_htmltag(GETPOST("remise")).'">%</td></tr>';
print $langs->trans("NewValue").'</td><td><input type="text" size="5" name="remise" value="'.dol_escape_htmltag(GETPOST("remise")).'"> <span class="opacitymedium">%</span></td></tr>';
// Motif/Note
print '<tr><td class="fieldrequired">';
print '<tr class="lastline"><td class="fieldrequired">';
print $langs->trans("NoteReason").'</td><td><input type="text" size="60" name="note" value="'.dol_escape_htmltag(GETPOST("note", "alphanohtml")).'"></td></tr>';
print "</table>";

View file

@ -5715,7 +5715,7 @@ if ($action == 'create') {
// Amount HT
print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
print '<td class="nowraponall amountcard right">' . price($sign * $object->total_ht, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
if (isModEnabled("multicurrency") && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
// Multicurrency Amount HT
print '<td class="nowraponall amountcard right">' . price($sign * $object->multicurrency_total_ht, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
}
@ -5725,7 +5725,7 @@ if ($action == 'create') {
// Amount VAT
print '<td>' . $langs->trans('AmountVAT') . '</td>';
print '<td class="nowraponall amountcard right">' . price($sign * $object->total_tva, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
if (isModEnabled("multicurrency") && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
// Multicurrency Amount VAT
print '<td class="nowraponall amountcard right">' . price($sign * $object->multicurrency_total_tva, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
}
@ -5736,7 +5736,7 @@ if ($action == 'create') {
print '<tr>';
print '<td class="titlefieldmiddle">' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
print '<td class="nowraponall 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)) {
if (isModEnabled("multicurrency") && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
$object->multicurrency_total_localtax1 = (float) price2num($object->total_localtax1 * $object->multicurrency_tx, 'MT');
print '<td class="nowraponall amountcard right">' . price($sign * $object->multicurrency_total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
@ -5748,7 +5748,7 @@ if ($action == 'create') {
print '<tr>';
print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
print '<td class="nowraponall 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)) {
if (isModEnabled("multicurrency") && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
$object->multicurrency_total_localtax2 = (float) price2num($object->total_localtax2 * $object->multicurrency_tx, 'MT');
print '<td class="nowraponall amountcard right">' . price($sign * $object->multicurrency_total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
@ -5813,7 +5813,7 @@ if ($action == 'create') {
// Amount TTC
print '<td>' . $langs->trans('AmountTTC') . '</td>';
print '<td class="nowraponall amountcard right">' . price($sign * $object->total_ttc, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
if (isModEnabled("multicurrency") && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
// Multicurrency Amount TTC
print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
}
@ -6227,7 +6227,7 @@ if ($action == 'create') {
print '<td class="right'.($resteapayeraffiche ? ' amountremaintopay' : (' '.$cssforamountpaymentcomplete)).'">'.price($resteapayeraffiche).'</td><td>&nbsp;</td></tr>';
// Remainder to pay Multicurrency
if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) {
if (isModEnabled('multicurrency') && $object->multicurrency_code && ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1)) {
print '<tr><td colspan="'.$nbcols.'" class="right">';
print '<span class="opacitymedium">';
print $langs->trans('RemainderToPayMulticurrency');

View file

@ -92,7 +92,7 @@ if (empty($inputalsopricewithtax)) {
}
// Define colspan for the button 'Add'
$colspan = 3; // Columns: total ht + col edit + col delete
if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) {
if (isModEnabled("multicurrency") && $this->multicurrency_code && $this->multicurrency_code != $conf->currency) {
$colspan++; //Add column for Total (currency) if required
}
if (in_array($object->element, array('propal', 'commande', 'order', 'facture', 'facturerec', 'invoice', 'supplier_proposal', 'order_supplier', 'invoice_supplier', 'invoice_supplier_rec'))) {
@ -145,13 +145,13 @@ if ($nolinesbefore) {
} ?>
<td class="linecolvat right"><span id="title_vat"><?php echo $langs->trans('VAT'); ?></span></td>
<td class="linecoluht right"><span id="title_up_ht"><?php echo $langs->trans('PriceUHT'); ?></span></td>
<?php if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { ?>
<?php if (isModEnabled("multicurrency") && $this->multicurrency_code && $this->multicurrency_code != $conf->currency) { ?>
<td class="linecoluht_currency right"><span id="title_up_ht_currency"><?php echo $langs->trans('PriceUHT').'&nbsp;<span class="opacitymedium">('.$langs->getCurrencySymbol($this->multicurrency_code).')</span>'; ?></span></td>
<?php } ?>
<?php if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { ?>
<td class="linecoluttc right"><span id="title_up_ttc"><?php echo $langs->trans('PriceUTTC'); ?></span></td>
<?php } ?>
<?php if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency && !empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { ?>
<?php if (isModEnabled("multicurrency") && $this->multicurrency_code && $this->multicurrency_code != $conf->currency && !empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { ?>
<td class="linecoluttc_currency right"><span id="title_up_ttc_currency"><?php echo $langs->trans('PriceUTTC').'&nbsp;<span class="opacitymedium">('.$langs->getCurrencySymbol($this->multicurrency_code).')</span>'; ?></td>
<?php } ?>
<td class="linecolqty right"><?php echo $langs->trans('Qty'); ?></td>
@ -497,7 +497,7 @@ if ($nolinesbefore) {
</td>
<?php
if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) {
if (isModEnabled("multicurrency") && $this->multicurrency_code && $this->multicurrency_code != $conf->currency) {
$coldisplay++; ?>
<td class="nobottom linecoluht_currency right">
<input type="text" name="multicurrency_price_ht" id="multicurrency_price_ht" class="flat right width50" value="<?php echo(GETPOSTISSET("multicurrency_price_ht") ? GETPOST("multicurrency_price_ht", 'alpha', 2) : ''); ?>">
@ -511,7 +511,7 @@ if ($nolinesbefore) {
</td>
<?php
}
if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency && !empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) {
if (isModEnabled("multicurrency") && $this->multicurrency_code && $this->multicurrency_code != $conf->currency && !empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) {
$coldisplay++; ?>
<td class="nobottom linecoluttc_currency right">
<input type="text" name="multicurrency_price_ttc" id="multicurrency_price_ttc" class="flat right width50" value="<?php echo(GETPOSTISSET("multicurrency_price_ttc") ? GETPOST("multicurrency_price_ttc", 'alpha', 2) : ''); ?>">

View file

@ -102,7 +102,7 @@ if (!empty($inputalsopricewithtax)) {
if (in_array($object->element, array('propal', 'supplier_proposal', 'facture', 'facturerec', 'invoice', 'commande', 'order', 'order_supplier', 'invoice_supplier', 'invoice_supplier_rec'))) {
$colspan++; // With this, there is a column move button
}
if (isModEnabled("multicurrency") && $object->multicurrency_code != $conf->currency) {
if (isModEnabled("multicurrency") && $this->multicurrency_code && $object->multicurrency_code != $conf->currency) {
$colspan += 2;
}
if (isModEnabled('asset') && $object->element == 'invoice_supplier') {
@ -260,7 +260,7 @@ $coldisplay++;
}
print '></td>';
if (isModEnabled("multicurrency") && $object->multicurrency_code != $conf->currency) {
if (isModEnabled("multicurrency") && $this->multicurrency_code && $object->multicurrency_code != $conf->currency) {
$coldisplay++;
print '<td class="right"><input rel="'.$object->multicurrency_tx.'" type="text" class="flat right width50" id="multicurrency_subprice" name="multicurrency_subprice" value="'.(GETPOSTISSET('multicurrency_subprice') ? GETPOST('multicurrency_subprice', 'alpha') : price($line->multicurrency_subprice)).'" /></td>';
}
@ -278,7 +278,7 @@ $coldisplay++;
print '></td>';
}
if (isModEnabled("multicurrency") && $object->multicurrency_code != $conf->currency && !empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) {
if (isModEnabled("multicurrency") && $this->multicurrency_code && $object->multicurrency_code != $conf->currency && !empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) {
$coldisplay++;
$multicurrency_upinctax = $line->multicurrency_subprice_ttc ? $line->multicurrency_subprice_ttc : null;
if (!$multicurrency_upinctax) {

View file

@ -115,7 +115,7 @@ print '</th>';
print '<th class="linecoluht right nowraponall">'.$langs->trans('PriceUHT').'</th>';
// Multicurrency HT / excl tax
if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) {
if (isModEnabled("multicurrency") && $this->multicurrency_code && $this->multicurrency_code != $conf->currency) {
print '<th class="linecoluht_currency right" style="width: 80px">'.$langs->trans('PriceUHT');
print '&nbsp;<span class="opacitymedium">('.$langs->getCurrencySymbol($this->multicurrency_code).')<span></th>';
}
@ -126,7 +126,7 @@ if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH
}
// Multicurrency TTC / incl tax
if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency && !empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) {
if (isModEnabled("multicurrency") && $this->multicurrency_code && $this->multicurrency_code != $conf->currency && !empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) {
print '<th class="linecoluttc_currency right " style="width: 80px">'.$langs->trans('PriceUTTC');
print '&nbsp;<span class="opacitymedium">('.$langs->getCurrencySymbol($this->multicurrency_code).')<span></th>';
}
@ -212,7 +212,7 @@ if ($usemargins && isModEnabled('margin') && empty($user->socid)) {
print '<th class="linecolht right">'.$langs->trans('TotalHTShort').'</th>';
// Multicurrency
if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) {
if (isModEnabled("multicurrency") && $this->multicurrency_code && $this->multicurrency_code != $conf->currency) {
print '<th class="linecoltotalht_currency right">'.$langs->trans('TotalHTShort');
print '&nbsp;<span class="opacitymedium">('.$langs->getCurrencySymbol($this->multicurrency_code).')<span></th>';
}

View file

@ -409,7 +409,7 @@ print $tooltiponpriceend;
<td class="linecoluht nowraponall right"><?php $coldisplay++; ?><?php print price($sign * $line->subprice); ?></td>
<?php if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { ?>
<?php if (isModEnabled("multicurrency") && $this->multicurrency_code && $this->multicurrency_code != $conf->currency) { ?>
<td class="linecoluht_currency nowraponall right"><?php $coldisplay++; ?><?php print price($sign * $line->multicurrency_subprice); ?></td>
<?php }
@ -424,7 +424,7 @@ if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH
<?php }
// Multicurrency TTC
if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency && !empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { ?>
if (isModEnabled("multicurrency") && $this->multicurrency_code && $this->multicurrency_code != $conf->currency && !empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { ?>
<td class="linecoluttc_currency nowraponall right"><?php $coldisplay++; ?><?php
$multicurrency_upinctax = isset($line->pu_ttc_devise) ? $line->pu_ttc_devise : null;
if (!$multicurrency_upinctax) {
@ -517,7 +517,7 @@ if ($line->special_code == 3) {
print price($sign * $line->total_ht);
print $tooltiponpriceend;
print '</td>';
if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) {
if (isModEnabled("multicurrency") && $this->multicurrency_code && $this->multicurrency_code != $conf->currency) {
print '<td class="linecolutotalht_currency nowrap right">';
print $tooltiponpricemultiprice;
print price($sign * $line->multicurrency_total_ht);

View file

@ -94,7 +94,7 @@ if ($line->qty > 0) { ?>
</td>
<td class="linecoluht"></td>
<?php
if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) {
if (isModEnabled("multicurrency") && $this->multicurrency_code && $this->multicurrency_code != $conf->currency) {
print '<td class="linecoluht_currency"></td>';
}
// Handling colspan if MAIN_NO_INPUT_PRICE_WITH_TAX conf is enabled
@ -160,7 +160,7 @@ if ($line->qty > 0) { ?>
}
?>
<td class="linecolht"></td>
<?php if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { ?>
<?php if (isModEnabled("multicurrency") && $this->multicurrency_code && $this->multicurrency_code != $conf->currency) { ?>
<td class="linecolutotalht_currency"></td>
<?php } ?>
<?php } elseif ($line->qty < 0) {

View file

@ -816,9 +816,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<div class="center'.(in_array($action, array('consumeorproduce', 'consumeandproduceall')) ? ' formconsumeproduce' : '').'">';
print '<div class="opacitymedium hideonsmartphone paddingbottom">'.$langs->trans("ConfirmProductionDesc", $langs->transnoentitiesnoconv("Confirm")).'<br></div>';
print '<span class="fieldrequired">'.$langs->trans("InventoryCode").':</span> <input type="text" class="minwidth150 maxwidth200" name="inventorycode" value="'.$defaultstockmovementcode.'"> &nbsp; ';
print '<span class="paddingright">'.$langs->trans("InventoryCode").':</span>';
print '<span class="clearbothonsmartphone"></span>';
print $langs->trans("MovementLabel").': <input type="text" class="minwidth300" name="inventorylabel" value="'.$defaultstockmovementlabel.'"><br><br>';
print '<input type="text" class="minwidth125 maxwidth150" name="inventorycode" value="'.$defaultstockmovementcode.'">';
print '<span class="hideonsmartphone">&nbsp; &nbsp;</span>';
print '<span class="clearbothonsmartphone"></span>';
print '<span class="paddingright">'.$langs->trans("MovementLabel").':</span>';
print '<span class="clearbothonsmartphone"></span>';
print '<input type="text" class="minwidth300" name="inventorylabel" value="'.$defaultstockmovementlabel.'"><br><br>';
print '<input type="checkbox" id="autoclose" name="autoclose" value="1"'.(GETPOSTISSET('inventorylabel') ? (GETPOST('autoclose') ? ' checked="checked"' : '') : ' checked="checked"').'> <label for="autoclose">'.$langs->trans("AutoCloseMO").'</label><br>';
print '<input type="submit" class="button" value="'.$langs->trans("Confirm").'" name="confirm">';
print ' &nbsp; ';