From 0884678264111e3744bf5987a59745b6cd2d20ac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Aug 2020 11:10:38 +0200 Subject: [PATCH 1/7] Look and feel v12 --- htdocs/product/stock/product.php | 6 +- .../product/stock/tpl/stockcorrection.tpl.php | 114 +++++++++--------- 2 files changed, 58 insertions(+), 62 deletions(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 5ae9e06f2ca..69f9dc89d9a 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -770,11 +770,7 @@ else } -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ +// Actions buttons $parameters = array(); diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 6d63d258c9c..1f24e44a266 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -66,67 +66,67 @@ if (empty($conf) || !is_object($conf)) { // Warehouse or product print ''; -if ($object->element == 'product') -{ - print ''.$langs->trans("Warehouse").''; - print ''; - print $formproduct->selectWarehouses((GETPOST("dwid") ?GETPOST("dwid", 'int') : (GETPOST('id_entrepot') ?GETPOST('id_entrepot', 'int') : ($object->element == 'product' && $object->fk_default_warehouse ? $object->fk_default_warehouse : 'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100'); - print '   '; - print ''; -} -if ($object->element == 'stock') -{ - print ''.$langs->trans("Product").''; - print ''; - $form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES) ? '0' : ''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500'); - print '   '; - print ''; -} + if ($object->element == 'product') + { + print ''.$langs->trans("Warehouse").''; + print ''; + print $formproduct->selectWarehouses((GETPOST("dwid") ?GETPOST("dwid", 'int') : (GETPOST('id_entrepot') ?GETPOST('id_entrepot', 'int') : ($object->element == 'product' && $object->fk_default_warehouse ? $object->fk_default_warehouse : 'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100'); + print '   '; + print ''; + } + if ($object->element == 'stock') + { + print ''.$langs->trans("Product").''; + print ''; + $form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES) ? '0' : ''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500'); + print '   '; + print ''; + } print ''.$langs->trans("NumberOfUnit").''; - print ''; - print ''; - - // Purchase price - print ''; - print ''.$langs->trans("UnitPurchaseValue").''; - print ''; -if (!empty($conf->projet->enabled)) -{ - print ''.$langs->trans('Project').''; - print ''; - $formproject->select_projects(-1, '', 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth300'); - print ''; -} + print ''; print ''; // Serial / Eat-by date -if (!empty($conf->productbatch->enabled) && - (($object->element == 'product' && $object->hasbatch()) - || ($object->element == 'stock')) - ) -{ - print ''; - print 'element == 'stock' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").''; - print ''; - print ''; - print ''; - print ''; - print ''.$langs->trans("EatByDate").''; - $eatbyselected = dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); - print $form->selectDate($eatbyselected, 'eatby', '', '', 1, ""); - print ''; - print ''.$langs->trans("SellByDate").''; - $sellbyselected = dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); - print $form->selectDate($sellbyselected, 'sellby', '', '', 1, ""); - print ''; - print ''; -} + if (!empty($conf->productbatch->enabled) && + (($object->element == 'product' && $object->hasbatch()) + || ($object->element == 'stock')) + ) + { + print ''; + print 'element == 'stock' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").''; + print ''; + print ''; + print ''; + print ''; + print ''.$langs->trans("EatByDate").''; + $eatbyselected = dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); + print $form->selectDate($eatbyselected, 'eatby', '', '', 1, ""); + print ''; + print ''.$langs->trans("SellByDate").''; + $sellbyselected = dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); + print $form->selectDate($sellbyselected, 'sellby', '', '', 1, ""); + print ''; + print ''; + } + + // Purchase price and project + print ''; + print ''.$langs->trans("UnitPurchaseValue").''; + print ''; + if (!empty($conf->projet->enabled)) + { + print ''.$langs->trans('Project').''; + print ''; + $formproject->select_projects(-1, '', 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth300'); + print ''; + } + print ''; // Label of mouvement of id of inventory $valformovementlabel = ((GETPOST("label") && (GETPOST('label') != $langs->trans("MovementCorrectStock", ''))) ? GETPOST("label") : $langs->trans("MovementCorrectStock", $productref)); From 76624122dd0f47e9d016c54557a15651d90bb951 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Aug 2020 16:05:29 +0200 Subject: [PATCH 2/7] Fix regression: Restore filter on "alerte" --- htdocs/compta/facture/list.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 6d12483e303..3926eb9f9b6 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -842,12 +842,15 @@ if ($resql) { print ''; print '
'; + /* print $langs->trans('From').' '; print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1); print '
'; print '
'; - print $langs->trans('to').' '; + print $langs->trans('to').' ';*/ + print $langs->trans("Before").' '; print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1); + print '
'.$langs->trans("Alert"); print '
'; print ''; } From fb5b29a32bbb5ae2924f54e3c9cbf1d7af99443c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Aug 2020 19:39:38 +0200 Subject: [PATCH 3/7] FIX Restore the links on late badge --- htdocs/index.php | 26 ++++++++++++++++++++------ htdocs/theme/eldy/info-box.inc.php | 7 +++++++ htdocs/theme/md/info-box.inc.php | 7 +++++++ 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/htdocs/index.php b/htdocs/index.php index 20e2d5f9c9a..dc0a05ae98b 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -358,7 +358,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { $dashboardlines[$board->element] = $board->load_board($user); } - // Number of commercial proposals opened (expired) + // Number of commercial proposals open (expired) if (!empty($conf->propal->enabled) && $user->rights->propale->lire) { include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $board = new Propal($db); @@ -367,7 +367,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { $dashboardlines[$board->element.'_signed'] = $board->load_board($user, "signed"); } - // Number of commercial proposals opened (expired) + // Number of commercial proposals open (expired) if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) { include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; $board = new SupplierProposal($db); @@ -409,14 +409,14 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { //$dashboardlines[$board->element.'_active'] = $board->load_board($user, "active"); } - // Number of invoices customers (has paid) + // Number of invoices customers (paid) if (!empty($conf->facture->enabled) && $user->rights->facture->lire) { include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $board = new Facture($db); $dashboardlines[$board->element] = $board->load_board($user); } - // Number of supplier invoices (has paid) + // Number of supplier invoices (paid) if (!empty($conf->supplier_invoice->enabled) && !empty($user->rights->fournisseur->facture->lire)) { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $board = new FactureFournisseur($db); @@ -717,21 +717,35 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { $textLate = ''; if ($board->nbtodolate > 0) { - $textLate .= ' '; + $textLate .= ''; $textLate .= ' '.$board->nbtodolate; $textLate .= ''; } + $openedDashBoard .= '
'; + $nbtodClass = ''; if ($board->nbtodo > 0) { $nbtodClass = 'badge badge-info'; } - $openedDashBoard .= ' '.$infoName.' : '.$board->nbtodo.''.$textLate.''."\n"; + $openedDashBoard .= ' '.$infoName.' : '.$board->nbtodo.''; + if ($textLate) { + if ($board->url_late) { + $openedDashBoard .= ''; + $openedDashBoard .= ' '; + } else { + $openedDashBoard .= ' '; + } + $openedDashBoard .= $textLate; + } + $openedDashBoard .= ''."\n"; if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) { $openedDashBoard .= ''.$langs->trans('Total').' : '.price($board->total).''; } + + $openedDashBoard .= '
'; } $openedDashBoard .= ' '."\n"; diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 3b6bf98a1f9..e7c8d388aa0 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -95,6 +95,13 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> max-width: 60%; } +a.info-box-text.info-box-text-a { + display: table-cell; +} +a.info-box-text-a i.fa.fa-exclamation-triangle { + font-size: 0.9em; +} + .info-box-icon-text{ box-sizing: border-box; display: block; diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index 86e6411a923..966717e3ca8 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -92,6 +92,13 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO = background: #bbb; } +a.info-box-text.info-box-text-a { + display: table-cell; +} +a.info-box-text-a i.fa.fa-exclamation-triangle { + font-size: 0.9em; +} + .info-box { display: block; position: relative; From 24a9a5ac2d87e77dff1b9b80ea1ba90ef6240dd8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Aug 2020 19:42:36 +0200 Subject: [PATCH 4/7] CSS --- htdocs/compta/facture/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 3926eb9f9b6..9b9b986324f 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1461,7 +1461,7 @@ if ($resql) { $userstatic->id = $obj->fk_user_author; $userstatic->login = $obj->login; - print ''; + print ''; if ($userstatic->id) print $userstatic->getLoginUrl(1); else print ' '; print "\n"; From 1cf3422e05ae4f426e6730794eca54451ca2a158 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Aug 2020 01:56:42 +0200 Subject: [PATCH 5/7] FIX Bad adress of vendor in PDF for PDF of supplier payment FIX dol_convertToWord() Bad conversion of number into a string --- htdocs/core/lib/functionsnumtoword.lib.php | 15 ++++++--- .../doc/pdf_standard.modules.php | 17 +++++----- htdocs/langs/en_US/main.lang | 33 +++++++++++++++++++ 3 files changed, 52 insertions(+), 13 deletions(-) diff --git a/htdocs/core/lib/functionsnumtoword.lib.php b/htdocs/core/lib/functionsnumtoword.lib.php index 26db2bbec90..401e97e1de4 100644 --- a/htdocs/core/lib/functionsnumtoword.lib.php +++ b/htdocs/core/lib/functionsnumtoword.lib.php @@ -24,20 +24,20 @@ /** - * Function to return number in text. + * Function to return a number into a text. * May use module NUMBERWORDS if found. * - * @param float $num Number to convert + * @param float $num Number to convert (must be a numeric value, like reported by price2num()) * @param Translate $langs Language * @param boolean $currency 0=number to translate | 1=currency to translate - * @param boolean $centimes 0=no centimes | 1=centimes to translate + * @param boolean $centimes 0=no cents/centimes | 1=there is cents/centimes to translate * @return string|false Text of the number */ function dol_convertToWord($num, $langs, $currency = false, $centimes = false) { global $conf; - $num = str_replace(array(',', ' '), '', trim($num)); + //$num = str_replace(array(',', ' '), '', trim($num)); This should be useless since $num MUST be a php numeric value if (!$num) { return false; } @@ -56,6 +56,7 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false) $concatWords = $langs->getLabelFromNumber($num, $type); return $concatWords; } else { + $TNum = explode('.', $num); $num = (int) $TNum[0]; $words = array(); @@ -140,7 +141,11 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false) // If we need to write cents call again this function for cents if (!empty($TNum[1])) { if (!empty($currency)) $concatWords .= ' '.$langs->transnoentities('and'); - $concatWords .= ' '.dol_convertToWord($TNum[1], $langs, $currency, true); + + $decimalpart = $TNum[1]; + $decimalpart = preg_replace('/0+$/', '', $decimalpart); + + $concatWords .= ' '.dol_convertToWord($decimalpart, $langs, '', true); if (!empty($currency)) $concatWords .= ' '.$langs->transnoentities('centimes'); } return $concatWords; diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php index 0ad8b391faf..58ef22172bf 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -223,7 +223,7 @@ class pdf_standard extends ModelePDFSuppliersPayments } } - $total = $object->montant; + $total = $object->amount; // Definition of $dir and $file if ($object->specimen) @@ -550,12 +550,12 @@ class pdf_standard extends ModelePDFSuppliersPayments // Total payments $pdf->SetXY($this->page_largeur - $this->marge_droite - 50, $posy); - $pdf->MultiCell(50, 4, price($object->montant), 0, 'R', 1); + $pdf->MultiCell(50, 4, price($object->amount), 0, 'R', 1); $posy += 20; // translate amount $currency = $conf->currency; - $translateinletter = strtoupper(dol_convertToWord($object->montant, $outputlangs, $currency)); + $translateinletter = strtoupper(dol_convertToWord($object->amount, $outputlangs, $currency)); $pdf->SetXY($this->marge_gauche + 50, $posy); $pdf->MultiCell(90, 8, $translateinletter, 0, 'L', 1); $posy += 8; @@ -565,10 +565,9 @@ class pdf_standard extends ModelePDFSuppliersPayments $pdf->MultiCell(150, 4, $object->thirdparty->nom, 0, 'L', 1); $pdf->SetXY($this->page_largeur - $this->marge_droite - 30, $posy); - $pdf->MultiCell(35, 4, str_pad(price($object->montant).' '.$currency, 18, '*', STR_PAD_LEFT), 0, 'R', 1); + $pdf->MultiCell(35, 4, str_pad(price($object->amount).' '.$currency, 18, '*', STR_PAD_LEFT), 0, 'R', 1); $posy += 10; - // City $pdf->SetXY($this->page_largeur - $this->marge_droite - 30, $posy); $pdf->MultiCell(150, 4, $mysoc->town, 0, 'L', 1); @@ -608,9 +607,9 @@ class pdf_standard extends ModelePDFSuppliersPayments $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); - $titre = strtoupper($mysoc->town).', le '.date("d").' '.$outputlangs->transnoentitiesnoconv(date("F")).' '.date("Y"); + /*$titre = strtoupper($mysoc->town).' - '.dol_print_date(dol_now(), 'day', 'tzserver', $outputlangs); $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3) - 60, $tab_top - 6); - $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); + $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);*/ $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency)); $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top); @@ -774,7 +773,9 @@ class pdf_standard extends ModelePDFSuppliersPayments $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); - $carac_client = pdf_build_address($outputlangs, $this->emetteur, $mysoc, ((!empty($object->contact)) ? $object->contact : null), $usecontact, 'target', $object); + $usecontact = 0; + + $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ((!empty($object->contact)) ? $object->contact : null), $usecontact, 'target', $object); // Show recipient $widthrecbox = 90; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index f87f3a277de..ce9e5b6264e 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -941,6 +941,39 @@ ShortThursday=T ShortFriday=F ShortSaturday=S ShortSunday=S +one=one +two=two +three=three +four=four +five=five +six=six +seven=seven +eight=eight +nine=nine +ten=ten +eleven=eleven +twelve=twelve +thirteen=thirdteen +fourteen=fourteen +fifteen=fifteen +sixteen=sixteen +seventeen=seventeen +eighteen=eighteen +nineteen=nineteen +twenty=twenty +thirty=thirty +forty=forty +fifty=fifty +sixty=sixty +seventy=seventy +eighty=eighty +ninety=ninety +hundred=hundred +thousand=thousand +million=million +billion=billion +trillion=trillion +quadrillion=quadrillion SelectMailModel=Select an email template SetRef=Set ref Select2ResultFoundUseArrows=Some results found. Use arrows to select. From c8bff3a71ed93a572eaa77b8668c711cbbfbd645 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Aug 2020 02:05:04 +0200 Subject: [PATCH 6/7] FIX Cannot redeclare class --- htdocs/fourn/paiement/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/paiement/card.php b/htdocs/fourn/paiement/card.php index 56aa565ee4b..7e5c52795c9 100644 --- a/htdocs/fourn/paiement/card.php +++ b/htdocs/fourn/paiement/card.php @@ -27,10 +27,10 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; -require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; -require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; -require DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; $langs->loadLangs(array('bills', 'banks', 'companies', 'suppliers')); @@ -210,7 +210,7 @@ if ($result > 0) */ // Amount - print ''.$langs->trans('Amount').''.price($object->montant,'',$langs,0,0,-1,$conf->currency).''; + print ''.$langs->trans('Amount').''.price($object->amount,'',$langs,0,0,-1,$conf->currency).''; if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { From 9cb5735165dff97b8d9cb96f37ba365ae9d23f64 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Aug 2020 02:05:55 +0200 Subject: [PATCH 7/7] FIX Bad address used for vendor on PDF standard of supplier payment --- .../modules/supplier_payment/doc/pdf_standard.modules.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php index 5eeedb9dcfc..d438e19c7bf 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -766,7 +766,9 @@ class pdf_standard extends ModelePDFSuppliersPayments $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); - $carac_client=pdf_build_address($outputlangs,$this->emetteur,$mysoc,((!empty($object->contact))?$object->contact:null),$usecontact,'target',$object); + $usecontact = 0; + + $carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ((!empty($object->contact))?$object->contact:null), $usecontact, 'target', $object); // Show recipient $widthrecbox=90;