Debug v20

This commit is contained in:
Laurent Destailleur 2024-06-29 13:23:05 +02:00
parent e9487a2c90
commit 2f4c84f4b5
7 changed files with 51 additions and 38 deletions

View file

@ -3390,9 +3390,6 @@ if ($action == 'create') {
if (empty($reshook)) {
print '<table class="border centpercent">';
// Ref
//print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>';
$exampletemplateinvoice = new FactureRec($db);
$invoice_predefined = new FactureRec($db);
if (empty($origin) && empty($originid) && GETPOSTINT('fac_rec') > 0) {
@ -3532,7 +3529,7 @@ if ($action == 'create') {
$tmp = '<input type="radio" id="radio_standard" name="type" value="0"'.(GETPOSTINT('type') ? '' : ' checked').'> ';
$tmp = $tmp.'<label for="radio_standard" >'.$langs->trans("InvoiceStandardAsk").'</label>';
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
$desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3, 'standardonsmartphone');
$desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', 'nowraponall', 0, 3, 'standardonsmartphone');
print '<table class="nobordernopadding"><tr>';
print '<td>';
print $desc;
@ -3719,7 +3716,7 @@ if ($action == 'create') {
$tmp = '<input type="radio" name="type" id="radio_situation" value="0" disabled> ';
$text = $tmp.'<label>'.$langs->trans("InvoiceSituationAsk").'</label> ';
$text .= '<span class="opacitymedium">('.$langs->trans("YouMustCreateInvoiceFromThird").')</span> ';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3, 'firstsituationonsmartphone');
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', 'nowraponall', 0, 3, 'firstsituationonsmartphone');
print $desc;
print '</div></div>';
}
@ -3728,7 +3725,7 @@ if ($action == 'create') {
$tmp = '<input type="radio" name="type" id="radio_replacement" value="0" disabled> ';
$text = $tmp.'<label for="radio_replacement" class="opacitymedium">'.$langs->trans("InvoiceReplacement").'</label> ';
//$text .= '<span class="opacitymedium hideonsmartphone">('.$langs->trans("YouMustCreateInvoiceFromThird").')</span> ';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc").'<br><br>'.$langs->trans("YouMustCreateInvoiceFromThird"), 1, 'help', '', 0, 3, 'replacementonsmartphone');
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc").'<br><br>'.$langs->trans("YouMustCreateInvoiceFromThird"), 1, 'help', 'nowraponall', 0, 3, 'replacementonsmartphone');
print $desc;
print '</div></div>';
}
@ -3884,12 +3881,12 @@ if ($action == 'create') {
print '</td></tr>';
}
// Discounts for the known third party
if ($socid > 0) {
// Discounts for third party
print '<tr><td>'.$langs->trans('DiscountStillRemaining').'</td><td colspan="2">';
$thirdparty = $soc;
$discount_type = 0;
$thirdparty = $soc; // used by object_discounts.tpl.php
$discount_type = 0; // used by object_discounts.tpl.php
$backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode((string) (GETPOST('origin'))).'&originid='.urlencode((string) (GETPOSTINT('originid')));
include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
@ -3919,7 +3916,7 @@ if ($action == 'create') {
print $form->getSelectConditionsPaiements($cond_reglement_id, 'cond_reglement_id', -1, 1, 0, 'maxwidth500 widthcentpercentminusx');
print '</td></tr>';
// Warranty
if (getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY')) {
$rwStyle = 'display:none;';
if (in_array(GETPOSTINT('type'), $retainedWarrantyInvoiceAvailableType)) {
@ -4048,7 +4045,7 @@ if ($action == 'create') {
print '<td>'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'</td>';
print '<td colspan="2" class="maxwidthonsmartphone">';
print img_picto('', 'currency', 'class="pictofixedwidth"');
print $form->selectMultiCurrency(((GETPOSTISSET('multicurrency_code') && !GETPOST('changecompany')) ? GETPOST('multicurrency_code') : $currency_code), 'multicurrency_code');
print $form->selectMultiCurrency(((GETPOSTISSET('multicurrency_code') && !GETPOST('changecompany')) ? GETPOST('multicurrency_code') : $currency_code), 'multicurrency_code', 0, '', false, 'maxwidth100 widthcentpercentminusx');
print '</td></tr>';
}

View file

@ -9064,7 +9064,7 @@ abstract class CommonObject
}
$out .= ($display_type == 'card' ? '</td>' : '</div>');
$out .= ($display_type == 'card' ? '</tr>' : '</div>');
$out .= ($display_type == 'card' ? '</tr>'."\n" : '</div>');
$e++;
}
}

View file

@ -6490,16 +6490,16 @@ class Form
}
/**
* Return array of currencies in user language
* Return array of currencies in user language
*
* @param string $selected Preselected currency code
* @param string $htmlname Name of HTML select list
* @param integer $useempty 1=Add empty line
* @param string $filter Optional filters criteras (example: 'code <> x', ' in (1,3)')
* @param bool $excludeConfCurrency false = If company current currency not in table, we add it into list. Should always be available.
* true = we are in currency_rate update , we don't want to see conf->currency in select
* @param string $morecss More css
* @return string
* @param string $selected Preselected currency code
* @param string $htmlname Name of HTML select list
* @param integer $useempty 1=Add empty line
* @param string $filter Optional filters criteras (example: 'code <> x', ' in (1,3)')
* @param bool $excludeConfCurrency false = If company current currency not in table, we add it into list. Should always be available.
* true = we are in currency_rate update , we don't want to see conf->currency in select
* @param string $morecss More css
* @return string HTML component
*/
public function selectMultiCurrency($selected = '', $htmlname = 'multicurrency_code', $useempty = 0, $filter = '', $excludeConfCurrency = false, $morecss = '')
{

View file

@ -32,10 +32,10 @@ $isInvoice = in_array($object->element, array('facture', 'invoice', 'facture_fou
$isNewObject = empty($object->id) && empty($object->rowid);
// Clean variables not defined
if (!isset($absolute_discount)) {
if (empty($absolute_discount)) {
$absolute_discount = 0;
}
if (!isset($absolute_creditnote)) {
if (empty($absolute_creditnote)) {
$absolute_creditnote = 0;
}
@ -52,28 +52,31 @@ if (!empty($discount_type)) {
if ($fixedDiscount > 0) {
$translationKey = (empty($discount_type)) ? 'CompanyHasRelativeDiscount' : 'HasRelativeDiscountFromSupplier';
print $langs->trans($translationKey, $fixedDiscount).'.';
print $langs->trans($translationKey, $fixedDiscount);
} else {
$translationKey = (empty($discount_type)) ? 'CompanyHasNoRelativeDiscount' : 'HasNoRelativeDiscountFromSupplier';
print '<span class="opacitymedium hideonsmartphone">'.$langs->trans($translationKey).'.</span>';
}
if ($isNewObject) {
print ' '.$addrelativediscount;
if ($conf->dol_optimize_smallscreen) {
$translationKey = 'RelativeDiscount';
} else {
$translationKey = (empty($discount_type)) ? 'CompanyHasNoRelativeDiscount' : 'HasNoRelativeDiscountFromSupplier';
}
print '<span class="opacitymedium">'.$langs->trans($translationKey).'</span>';
}
// Add link to edit the relative discount
print ' '.$addrelativediscount;
// Is there is commercial discount or down payment available ?
if ($absolute_discount > 0) {
if (!empty($cannotApplyDiscount) || !$isInvoice || $isNewObject || $object->statut > $objclassname::STATUS_DRAFT || $object->type == $objclassname::TYPE_CREDIT_NOTE || $object->type == $objclassname::TYPE_DEPOSIT) {
$translationKey = empty($discount_type) ? 'CompanyHasDownPaymentOrCommercialDiscount' : 'HasDownPaymentOrCommercialDiscountFromSupplier';
$text = $langs->trans($translationKey, price($absolute_discount, 1, $outlangs, 1, -1, -1, $conf->currency)).'.';
$text = $langs->trans($translationKey, price($absolute_discount, 1, $outlangs, 1, -1, -1, $conf->currency));
if ($isInvoice && !$isNewObject && $object->statut > $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_CREDIT_NOTE && $object->type != $objclassname::TYPE_DEPOSIT) {
$text = $form->textwithpicto($text, $langs->trans('AbsoluteDiscountUse'));
}
if ($isNewObject) {
$text .= $addabsolutediscount;
$text .= ' '.$addabsolutediscount;
}
if ($isNewObject) {
@ -94,7 +97,7 @@ if ($absolute_creditnote > 0) {
// If validated, we show link "add credit note to payment"
if (!empty($cannotApplyDiscount) || !$isInvoice || $isNewObject || $object->statut != $objclassname::STATUS_VALIDATED || $object->type == $objclassname::TYPE_CREDIT_NOTE) {
$translationKey = empty($discount_type) ? 'CompanyHasCreditNote' : 'HasCreditNoteFromSupplier';
$text = $langs->trans($translationKey, price($absolute_creditnote, 1, $langs, 1, -1, -1, $conf->currency)).'.';
$text = $langs->trans($translationKey, price($absolute_creditnote, 1, $langs, 1, -1, -1, $conf->currency));
if ($isInvoice && !$isNewObject && $object->statut == $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_DEPOSIT) {
$text = $form->textwithpicto($text, $langs->trans('CreditNoteDepositUse'));
@ -117,8 +120,12 @@ if ($absolute_creditnote > 0) {
}
if ($absolute_discount <= 0 && $absolute_creditnote <= 0) {
$translationKey = !empty($discount_type) ? 'HasNoAbsoluteDiscountFromSupplier' : 'CompanyHasNoAbsoluteDiscount';
print '<br class="hideonsmartphone"><span class="opacitymedium hideonsmartphone">'.$langs->trans($translationKey).'.</span>';
if ($conf->dol_optimize_smallscreen) {
$translationKey = 'AbsoluteDiscount';
} else {
$translationKey = !empty($discount_type) ? 'HasNoAbsoluteDiscountFromSupplier' : 'CompanyHasNoAbsoluteDiscount';
}
print '<br><span class="opacitymedium">'.$langs->trans($translationKey).'</span>';
if ($isInvoice && $object->statut == $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_CREDIT_NOTE && $object->type != $objclassname::TYPE_DEPOSIT) {
print ' '.$addabsolutediscount;

View file

@ -327,6 +327,7 @@ ShowDiscount=Show discount
ShowReduc=Show the discount
ShowSourceInvoice=Show the source invoice
RelativeDiscount=Relative discount
AbsoluteDiscount=Absolute discount
GlobalDiscount=Global discount
CreditNote=Credit note
CreditNotes=Credit notes

View file

@ -2015,9 +2015,14 @@ select.widthcentpercentminusxx, span.widthcentpercentminusxx:not(.select2-select
text-overflow: ellipsis;
white-space: nowrap;
}
.border tbody tr, .border tbody tr td, div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col {
.border tbody tr, .border tbody tr td, div.tabBar table.border tr, div.tabBar table.border tr td,
div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col {
height: 40px !important;
}
div.tabBar .listofinvoicetype table tr, div.tabBar .listofinvoicetype table tr td {
height: 28px !important;
}
div.tabs div.tab a.tab {
max-width: 200px;
@ -2070,8 +2075,8 @@ select.widthcentpercentminusxx, span.widthcentpercentminusxx:not(.select2-select
.minwidth300imp { min-width: 120px !important; }
.minwidth400imp { min-width: 200px !important; }
.minwidth500imp { min-width: 250px !important; }
.titlefield { width: auto; min-width: unset; }
.titlefieldcreate { width: auto !important; }
.titlefield { width: auto; min-width: 125px; }
.titlefieldcreate { width: auto !important; min-width: 125px; }
#tooltip {
position: absolute;

View file

@ -2181,6 +2181,9 @@ select.widthcentpercentminusxx, span.widthcentpercentminusxx:not(.select2-select
.border tbody tr, .border tbody tr td, div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col {
height: 40px !important;
}
div.tabBar .listofinvoicetype table tr, div.tabBar .listofinvoicetype table tr td {
height: 28px !important;
}
div.tabs div.tab a.tab {
max-width: 200px;
@ -2230,7 +2233,7 @@ select.widthcentpercentminusxx, span.widthcentpercentminusxx:not(.select2-select
.minwidth400imp { min-width: 150px !important; }
.minwidth500imp { min-width: 250px !important; }
.titlefield { width: auto; min-width: unset; }
.titlefieldcreate { width: auto; }
.titlefieldcreate { min-width: 125px; /* width: auto !important; */ }
#tooltip {
position: absolute;