From 4ecab54c28c4040e2eed8cc9096385de3851fd27 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 14 Nov 2023 12:02:09 +0100 Subject: [PATCH 01/16] Fix phpunit --- test/phpunit/SecurityTest.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index d6fad65c570..9ff1b0da4b5 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -576,7 +576,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase $result=GETPOST("param15", 'restricthtml'); // param15 = src=>0xbeefed that is a dangerous string print __METHOD__." result=".$result."\n"; - $this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b'); // With some PHP and libxml version, we got this result when parsing invalid HTML, but ... + // $this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b'); // With some PHP and libxml version, we got this result when parsing invalid HTML, but ... //$this->assertEquals(' src=>0xbeefed', $result, 'Test 15b'); // ... on other PHP and libxml versions, we got a HTML that has been cleaned @@ -641,7 +641,22 @@ class SecurityTest extends PHPUnit\Framework\TestCase $_POST["pagecontentwithlinks"]=''; $result=GETPOST("pagecontentwithlinks", 'restricthtml'); print __METHOD__." result=".$result."\n"; - $this->assertEquals('TooManyLinksIntoHTMLString', $result, 'Test on limit on GETPOST fails'); + $this->assertEquals('ErrorTooManyLinksIntoHTMLString', $result, 'Test on limit on GETPOST fails'); + + // Test that img src="data:..." is excluded from the count of external links + $conf->global->MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT = 3; + $_POST["pagecontentwithlinks"]=''; + $result=GETPOST("pagecontentwithlinks", 'restricthtml'); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('', $result, 'Test on limit on GETPOST fails'); + + // Test that no links is allowed + $conf->global->MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = 1; + $_POST["pagecontentwithlinks"]=''; + $result=GETPOST("pagecontentwithlinks", 'restricthtml'); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('ErrorHTMLLinksNotAllowed', $result, 'Test on limit on GETPOST fails'); + return $result; } From b56b93e901a81fa18c4dc50b587ec26a5b4462ed Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 14 Nov 2023 12:02:58 +0100 Subject: [PATCH 02/16] Cheque - List - Dolibarize (#26583) * Cheque - List - Dolibarize * Double * Remove double printFieldListWhere * fix removefilter on date --- htdocs/compta/paiement/cheque/list.php | 378 ++++++++++++++++++++----- htdocs/compta/paiement/list.php | 3 +- 2 files changed, 312 insertions(+), 69 deletions(-) diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 5a17bba35d9..52ed7a2b3c7 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -42,6 +42,14 @@ if ($user->socid) { $result = restrictedArea($user, 'banque', '', ''); $search_ref = GETPOST('search_ref', 'alpha'); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); $search_account = GETPOST('search_account', 'int'); $search_amount = GETPOST('search_amount', 'alpha'); $mode = GETPOST('mode', 'alpha'); @@ -63,8 +71,6 @@ if (!$sortfield) { $sortfield = "bc.date_bordereau"; } -$year = GETPOST("year"); -$month = GETPOST("month"); $optioncss = GETPOST('optioncss', 'alpha'); $view = GETPOST("view", 'alpha'); @@ -83,18 +89,48 @@ foreach ($arrayofpaymentmodetomanage as $key => $val) { $arrayoflabels[$key] = $labelval; } +$arrayfields = array( + 'bc.ref' => array('label'=>"Ref", 'checked'=>1, 'position'=>10), + 'bc.type' => array('label'=>"Type", 'checked'=>1, 'position'=>20), + 'bc.date_bordereau' => array('label'=>"DateCreation", 'checked'=>1, 'position'=>30), + 'ba.label' => array('label'=>"Account", 'checked'=>1, 'position'=>40), + 'bc.nbcheque' => array('label'=>"NbOfCheques", 'checked'=>1, 'position'=>50), + 'bc.amount' => array('label'=>"Amount", 'checked'=>1, 'position'=>60), + 'bc.statut' => array('label'=>"Status", 'checked'=>1, 'position'=>70) +); +$arrayfields = dol_sort_array($arrayfields, 'position'); + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('chequelist')); +$object = new RemiseCheque($db); /* * Actions */ -// If click on purge search criteria ? -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers - $search_ref = ''; - $search_amount = ''; - $search_account = ''; - $year = ''; - $month = ''; +$parameters = array('socid'=>$socid); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + +if (empty($reshook)) { + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // All tests are required to be compatible with all browsers + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + $search_ref = ''; + $search_amount = ''; + $search_account = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; + $search_date_start = ''; + $search_date_end = ''; + } } @@ -103,12 +139,19 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' * View */ +$form = new Form($db); + llxHeader('', $langs->trans("ChequeDeposits")); $sql = "SELECT bc.rowid, bc.ref, bc.date_bordereau,"; $sql .= " bc.nbcheque, bc.amount, bc.statut, bc.type,"; $sql .= " ba.rowid as bid, ba.label"; +// Add fields from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + $sqlfields = $sql; // $sql fields to remove for count total $sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc,"; @@ -126,7 +169,17 @@ if ($search_account > 0) { if ($search_amount) { $sql .= natural_search("bc.amount", price2num($search_amount)); } -$sql .= dolSqlDateFilter('bc.date_bordereau', 0, $month, $year); +if ($search_date_start) { + $sql .= " AND bc.date_bordereau >= '" . $db->idate($search_date_start) . "'"; +} +if ($search_date_end) { + $sql .= " AND bc.date_bordereau <= '" . $db->idate($search_date_end) . "'"; +} + +// Add where from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; // Count total nb of records $nbtotalofrecords = ''; @@ -149,6 +202,7 @@ if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { $db->free($resql); } +// Complete request and execute it with limit $sql .= $db->order($sortfield, $sortorder); if ($limit) { $sql .= $db->plimit($limit + 1, $offset); @@ -166,9 +220,33 @@ if ($resql) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.$contextpage; } + if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); + } + if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + } + if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); + } + if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); + } + if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + } + if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); + } if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.$limit; } + if ($search_amount != '') { + $param .= '&search_amount='.urlencode($search_amount); + } + if ($search_account > 0) { + $param .= '&search_account='.urlencode($search_account); + } $url = DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new'; if (!empty($socid)) { @@ -195,54 +273,157 @@ if ($resql) { print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bank_account', 0, $newcardbutton, '', $limit); - $moreforfilter = ''; + $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; + $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields + $massactionbutton = ''; + if ($massactionbutton) { + $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); + } + $moreforfilter = ''; print '
'; - print ''."\n"; + print '
'; // Fields title search - print ''; - print ''; - // Type - print ''; - print ''; + + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; } - print ''; - print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 5); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + + // Filter: Ref + if (!empty($arrayfields['bc.ref']['checked'])) { + print ''; + } + + // Filter: Type + if (!empty($arrayfields['bc.type']['checked'])) { + print ''; + } + + // Filter: Date + if (!empty($arrayfields['bc.date_bordereau']['checked'])) { + print ''; + } + + // Filter: Bank account + if (!empty($arrayfields['ba.label']['checked'])) { + print ''; + } + + // Filter: Number of cheques + if (!empty($arrayfields['bc.nbcheque']['checked'])) { + print ''; + } + + // Filter: Amount + if (!empty($arrayfields['bc.amount']['checked'])) { + print ''; + } + + // Filter: Status (only placeholder) + if (!empty($arrayfields['bc.statut']['checked'])) { + print ''; + } + + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields); + $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + print "\n"; + $totalarray = array(); + $totalarray['nbfield'] = 0; + + // Fields title label + // -------------------------------------------------------------------- print ''; - print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "bc.ref", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "bc.type", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "bc.date_bordereau", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("NbOfCheques", $_SERVER["PHP_SELF"], "bc.nbcheque", "", $param, 'class="right"', $sortfield, $sortorder); - print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "bc.amount", "", $param, 'class="right"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "bc.statut", "", $param, 'class="right"', $sortfield, $sortorder); - print_liste_field_titre(''); + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + $totalarray['nbfield']++; + } + if (!empty($arrayfields['bc.ref']['checked'])) { + print_liste_field_titre($arrayfields['bc.ref']['label'], $_SERVER["PHP_SELF"], "bc.ref", "", $param, "", $sortfield, $sortorder); + $totalarray['nbfield']++; + } + if (!empty($arrayfields['bc.type']['checked'])) { + print_liste_field_titre($arrayfields['bc.type']['label'], $_SERVER["PHP_SELF"], "bc.type", "", $param, "", $sortfield, $sortorder); + $totalarray['nbfield']++; + } + if (!empty($arrayfields['bc.date_bordereau']['checked'])) { + print_liste_field_titre($arrayfields['bc.date_bordereau']['label'], $_SERVER["PHP_SELF"], "bc.date_bordereau", "", $param, 'align="center"', $sortfield, $sortorder); + $totalarray['nbfield']++; + } + if (!empty($arrayfields['ba.label']['checked'])) { + print_liste_field_titre($arrayfields['ba.label']['label'], $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); + $totalarray['nbfield']++; + } + if (!empty($arrayfields['bc.nbcheque']['checked'])) { + print_liste_field_titre($arrayfields['bc.nbcheque']['label'], $_SERVER["PHP_SELF"], "bc.nbcheque", "", $param, 'class="right"', $sortfield, $sortorder); + $totalarray['nbfield']++; + } + if (!empty($arrayfields['bc.amount']['checked'])) { + print_liste_field_titre($arrayfields['bc.amount']['label'], $_SERVER["PHP_SELF"], "bc.amount", "", $param, 'class="right"', $sortfield, $sortorder); + $totalarray['nbfield']++; + } + if (!empty($arrayfields['bc.statut']['checked'])) { + print_liste_field_titre($arrayfields['bc.statut']['label'], $_SERVER["PHP_SELF"], "bc.statut", "", $param, 'class="right"', $sortfield, $sortorder); + $totalarray['nbfield']++; + } + + // Hook fields + $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); + $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + $totalarray['nbfield']++; + } + print "\n"; + $checkedCount = 0; + foreach ($arrayfields as $column) { + if ($column['checked']) { + $checkedCount++; + } + } + if ($num > 0) { $savnbfield = 8; + $i = 0; + $totalarray = array(); + $totalarray['nbfield'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); while ($i < $imaxinloop) { $objp = $db->fetch_object($resql); @@ -273,48 +454,111 @@ if ($resql) { } else { print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Num ref cheque - print ''; + if (!empty($arrayfields['bc.ref']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } // Type - $labelpaymentmode = ($langs->transnoentitiesnoconv("PaymentType".$checkdepositstatic->type) != "PaymentType".$checkdepositstatic->type ? $langs->transnoentitiesnoconv("PaymentType".$checkdepositstatic->type) : $checkdepositstatic->type); - print ''; + if (!empty($arrayfields['bc.type']['checked'])) { + $labelpaymentmode = ($langs->transnoentitiesnoconv("PaymentType".$checkdepositstatic->type) != "PaymentType".$checkdepositstatic->type ? $langs->transnoentitiesnoconv("PaymentType".$checkdepositstatic->type) : $checkdepositstatic->type); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } // Date - print ''; + if (!empty($arrayfields['bc.date_bordereau']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } // Bank - print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - print ''; // Number of cheques - print ''; + if (!empty($arrayfields['bc.nbcheque']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } // Amount - print ''; + if (!empty($arrayfields['bc.amount']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (empty($totalarray['val']['amount'])) { + $totalarray['val']['amount'] = $objp->amount; + } else { + $totalarray['val']['amount'] += $objp->amount; + } + } - // Statut - print ''; + // Status + if (!empty($arrayfields['bc.statut']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } - print ''; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } print "\n"; } $i++; } } else { - print ''; - print '"; - print ''; + // If no record found + if ($num == 0) { + $colspan = 1; + foreach ($arrayfields as $key => $val) { + if (!empty($val['checked'])) { + $colspan++; + } + } + print ''; + print '"; + print ''; + } } print "
'; - print ''; - print ''; - print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; + // -------------------------------------------------------------------- + print '
'; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; - $form->select_comptes($search_account, 'search_account', 0, '', 1); - print ' '; - print ''; - print ''; - $searchpicto = $form->showFilterAndCheckAddButtons(0); - print $searchpicto; - print ''; + print ''; + print ''; + print ''; + print '
'; + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; + print '
'; + $form->select_comptes($search_account, 'search_account', 0, '', 1); + print ' '; + print ''; + print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print '
'; - print $checkdepositstatic->getNomUrl(1); - print ''; + print $checkdepositstatic->getNomUrl(1); + print ''.dol_escape_htmltag($labelpaymentmode).''.dol_escape_htmltag($labelpaymentmode).''.dol_print_date($db->jdate($objp->date_bordereau), 'dayhour', 'tzuser').''.dol_print_date($db->jdate($objp->date_bordereau), 'dayhour', 'tzuser').''; - if ($objp->bid) { - print ''.img_object($langs->trans("ShowAccount"), 'account').' '.$objp->label.''; - } else { - print ' '; + if (!empty($arrayfields['ba.label']['checked'])) { + print ''; + if ($objp->bid) { + print ''.img_object($langs->trans("ShowAccount"), 'account').' '.$objp->label.''; + } else { + print ' '; + } + print ''.$objp->nbcheque.''.$objp->nbcheque.''.price($objp->amount).''.price($objp->amount).''; - print $checkdepositstatic->LibStatut($objp->statut, 5); - print ''; + print $checkdepositstatic->LibStatut($objp->statut, 5); + print '
'.$langs->trans("None")."
' . $langs->trans("NoRecordFound") . "
"; print "
"; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 755c620446e..360bc46a6f3 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -5,7 +5,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Juanjo Menent - * Copyright (C) 2017-2021 Alexandre Spangaro + * Copyright (C) 2017-2023 Alexandre Spangaro * Copyright (C) 2018-2021 Ferran Marcet * Copyright (C) 2018 Charlene Benke * Copyright (C) 2020 Tobias Sekan @@ -381,7 +381,6 @@ print ''; // Filters: Lines (placeholder) -print ''; if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { print ''; From e9fc774afc01f74489a89d8be4f38484ffb5bb8c Mon Sep 17 00:00:00 2001 From: Thibault Fiacre <57494317+atm-thibaultf@users.noreply.github.com> Date: Tue, 14 Nov 2023 14:22:32 +0100 Subject: [PATCH 03/16] NEW stock transfert module is now stable (#26594) --- htdocs/core/modules/modStockTransfer.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modStockTransfer.class.php b/htdocs/core/modules/modStockTransfer.class.php index b0b616e3b36..74f324ecace 100644 --- a/htdocs/core/modules/modStockTransfer.class.php +++ b/htdocs/core/modules/modStockTransfer.class.php @@ -63,7 +63,7 @@ class modStockTransfer extends DolibarrModules // Used only if file README.md and README-LL.md not found. $this->descriptionlong = "Advanced management of stock transfer orders with generation of stock transfer sheets"; // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' - $this->version = 'experimental'; + $this->version = 'dolibarr'; // Url to the file with your last numberversion of this module //$this->url_last_version = 'http://www.example.com/versionmodule.txt'; From 213ebc5e26a353efcd4eed25512f7eadba1c858d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 14 Nov 2023 14:25:04 +0100 Subject: [PATCH 04/16] fix phpstan (#26592) htdocs/core/modules/propale/doc/pdf_azur.modules.php 1312 Undefined variable: $resteapayer --- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index de07c221bb2..c2fa8d38aa5 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1272,6 +1272,7 @@ class pdf_azur extends ModelePDFPropales $pdf->SetTextColor(0, 0, 0); + $resteapayer = 0; /* $resteapayer = $object->total_ttc - $deja_regle; if (!empty($object->paye)) $resteapayer=0; @@ -1287,8 +1288,7 @@ class pdf_azur extends ModelePDFPropales $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0); /* - if ($object->close_code == 'discount_vat') - { + if ($object->close_code == 'discount_vat') { $index++; $pdf->SetFillColor(255,255,255); From 79b4c0f1b98f281422bd92584c030445f97a407b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 14 Nov 2023 14:43:54 +0100 Subject: [PATCH 05/16] clean code (#26585) * clean code * Update commoninvoice.class.php * Update commoninvoice.class.php --- htdocs/core/class/commoninvoice.class.php | 49 +++++++---------------- 1 file changed, 14 insertions(+), 35 deletions(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index fbd4db0883b..a08357071b5 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -687,51 +687,30 @@ abstract class CommonInvoice extends CommonObject */ public function getSubtypeLabel($table = '') { + $subtypeLabel = ''; if ($table === 'facture' || $table === 'facture_fourn') { $sql = "SELECT s.label FROM " . MAIN_DB_PREFIX . $table . " AS f"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "c_invoice_subtype AS s ON f.subtype = s.rowid"; $sql .= " WHERE f.ref = '".$this->db->escape($this->ref)."'"; - - $resql = $this->db->query($sql); - - if ($resql) { - $subtypeLabel = ''; - - while ($obj = $this->db->fetch_object($resql)) { - $subtypeLabel = $obj->label; - } - - if (!empty($subtypeLabel)) { - return $subtypeLabel; - } - } else { - dol_print_error($this->db); - return -1; - } } elseif ($table === 'facture_rec' || $table === 'facture_fourn_rec') { $sql = "SELECT s.label FROM " . MAIN_DB_PREFIX . $table . " AS f"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "c_invoice_subtype AS s ON f.subtype = s.rowid"; $sql .= " WHERE f.titre = '".$this->db->escape($this->titre)."'"; - - $resql = $this->db->query($sql); - - if ($resql) { - $subtypeLabel = ''; - - while ($obj = $this->db->fetch_object($resql)) { - $subtypeLabel = $obj->label; - } - - if (!empty($subtypeLabel)) { - return $subtypeLabel; - } - } else { - dol_print_error($this->db); - return -1; - } + } else { + return -1; } - return ''; + $resql = $this->db->query($sql); + if ($resql) { + while ($obj = $this->db->fetch_object($resql)) { + $subtypeLabel = $obj->label; + } + } else { + dol_print_error($this->db); + return -1; + } + + return $subtypeLabel; } /** From 0fbc5bd42377a7d34cc770987cbae74ef517bca6 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Tue, 14 Nov 2023 15:46:48 +0200 Subject: [PATCH 06/16] NEW: Supplier template invoive extrafields (#26570) * NEW: Supplier template invoive extrafields * NEW: Supplier template invoive extrafields * NEW: Supplier template invoive extrafields --- .../admin/supplierinvoice_rec_extrafields.php | 109 +++++++++++++++++ .../supplierinvoicedet_rec_extrafields.php | 111 ++++++++++++++++++ htdocs/core/lib/fourn.lib.php | 21 ++++ htdocs/langs/en_US/admin.lang | 2 + 4 files changed, 243 insertions(+) create mode 100644 htdocs/admin/supplierinvoice_rec_extrafields.php create mode 100644 htdocs/admin/supplierinvoicedet_rec_extrafields.php diff --git a/htdocs/admin/supplierinvoice_rec_extrafields.php b/htdocs/admin/supplierinvoice_rec_extrafields.php new file mode 100644 index 00000000000..2fda69ff695 --- /dev/null +++ b/htdocs/admin/supplierinvoice_rec_extrafields.php @@ -0,0 +1,109 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2012 Florian Henry + * Copyright (C) 2013-2018 Philippe Grand + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2023 Nick Fragoulis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/supplierinvoice_rec_extrafields.php + * \ingroup fourn + * \brief Page to setup extra fields of recurring supplierinvoice + */ + +// Load Dolibarr environment +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + +// Load translation files required by the page +$langs->loadLangs(array("admin", "other", "bills", "orders", "suppliers")); + +if (!$user->admin) { + accessforbidden(); +} + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label = ExtraFields::$type2label; +$type2label = array(''); +foreach ($tmptype2label as $key => $val) { + $type2label[$key] = $langs->transnoentitiesnoconv($val); +} + +$action = GETPOST('action', 'aZ09'); +$attrname = GETPOST('attrname', 'alpha'); +$elementtype = 'facture_fourn_rec'; //Must be the $table_element of the class that manage extrafield + +if (!$user->admin) { + accessforbidden(); +} + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + +$textobject = $langs->transnoentitiesnoconv("BillsSuppliers"); + +llxHeader('', $langs->trans("SuppliersSetup")); + +$linkback = ''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("SuppliersSetup"), $linkback, 'title_setup'); +print "
\n"; + +$head = supplierorder_admin_prepare_head(); + +print dol_get_fiche_head($head, 'attributesrec', $langs->trans("Suppliers"), -1, 'company'); + +require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; + +print dol_get_fiche_end(); + + +// Creation of an optional field +if ($action == 'create') { + print '
'; + print load_fiche_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +// Edition of an optional field +if ($action == 'edit' && !empty($attrname)) { + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/supplierinvoicedet_rec_extrafields.php b/htdocs/admin/supplierinvoicedet_rec_extrafields.php new file mode 100644 index 00000000000..666430611d8 --- /dev/null +++ b/htdocs/admin/supplierinvoicedet_rec_extrafields.php @@ -0,0 +1,111 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2012 Florian Henry + * Copyright (C) 2013 Philippe Grand + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2015 Claudio Aschieri + * Copyright (C) 2023 Nick Fragoulis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/supplierinvoicedet_rec_extrafields.php + * \ingroup fourn + * \brief Page to setup extra fields of recurring supplierinvoice line + */ + +// Load Dolibarr environment +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + + +if (!$user->admin) { + accessforbidden(); +} + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'other', 'bills', 'orders', 'suppliers')); + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label = ExtraFields::$type2label; +$type2label = array(''); +foreach ($tmptype2label as $key => $val) { + $type2label[$key] = $langs->transnoentitiesnoconv($val); +} + +$action = GETPOST('action', 'aZ09'); +$attrname = GETPOST('attrname', 'alpha'); +$elementtype = 'facture_fourn_det_rec'; //Must be the $table_element of the class that manage extrafield + +if (!$user->admin) { + accessforbidden(); +} + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + +$textobject = $langs->transnoentitiesnoconv("BillsSuppliers"); + +llxHeader('', $langs->trans("SuppliersSetup")); + +$linkback = ''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("SuppliersSetup"), $linkback, 'title_setup'); +print "
\n"; + +$head = supplierorder_admin_prepare_head(); + +print dol_get_fiche_head($head, 'attributeslinesrec', $langs->trans("Suppliers"), -1, 'company'); + +require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; + +print dol_get_fiche_end(); + + +// Creation of an optional field +if ($action == 'create') { + print '
'; + print load_fiche_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +// Edition of an optional field +if ($action == 'edit' && !empty($attrname)) { + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 3f2bcd48da7..767d1912bb2 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -4,6 +4,7 @@ * Copyright (C) 2006 Marc Barilley * Copyright (C) 2011-2013 Philippe Grand * Copyright (C) 2022-2023 Frédéric France + * Copyright (C) 2023 Nick Fragoulis * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -258,6 +259,8 @@ function supplierorder_admin_prepare_head() $extrafields->fetch_name_optionals_label('commande_fournisseurdet'); $extrafields->fetch_name_optionals_label('facture_fourn'); $extrafields->fetch_name_optionals_label('facture_fourn_det'); + $extrafields->fetch_name_optionals_label('facture_fourn_rec'); + $extrafields->fetch_name_optionals_label('facture_fourn_det_rec'); $h = 0; $head = array(); @@ -315,6 +318,24 @@ function supplierorder_admin_prepare_head() $head[$h][2] = 'supplierinvoicedet'; $h++; + $head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoice_rec_extrafields.php'; + $head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoicesRec"); + $nbExtrafields = $extrafields->attributes['facture_fourn_rec']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } + $head[$h][2] = 'attributesrec'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoicedet_rec_extrafields.php'; + $head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoicesLinesRec"); + $nbExtrafields = $extrafields->attributes['facture_fourn_det_rec']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } + $head[$h][2] = 'attributeslinesrec'; + $h++; + complete_head_from_modules($conf, $langs, null, $head, $h, 'supplierorder_admin', 'remove'); return $head; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index d41cdccec91..3844ee142c0 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2427,3 +2427,5 @@ LargeModern=Large - Modern SpecialCharActivation=Enable the button to open a virtual keyboard to enter special characters DeleteExtrafield=Delete extrafield ConfirmDeleteExtrafield=Confirm delete %s extrafield ? All data is going to be lost +ExtraFieldsSupplierInvoicesRec=Complementary attributes (templates invoices) +ExtraFieldsSupplierInvoicesLinesRec=Complementary attributes (invoice lines) From d9df238ac47e36c12d26b4329bd15cb4b1fa5df6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 14 Nov 2023 17:30:50 +0100 Subject: [PATCH 07/16] Clean code and prepare database for reception from any source --- htdocs/core/class/commonobject.class.php | 28 ++++++++++++++++--- htdocs/expedition/card.php | 5 ++-- .../install/mysql/migration/18.0.0-19.0.0.sql | 2 ++ .../llx_commande_fournisseur_dispatch.sql | 10 ++++--- .../install/mysql/tables/llx_expedition.sql | 7 +++-- htdocs/install/mysql/tables/llx_reception.sql | 3 +- htdocs/reception/card.php | 10 +++---- 7 files changed, 46 insertions(+), 19 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a53e9cbaf0d..2bb9df4724e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -260,6 +260,21 @@ abstract class CommonObject */ public $origin_id; + /** + * @var Object Origin object. This is set by fetch_origin() from this->origin and this->origin_id. + */ + public $origin_object; + + // TODO Remove this. Has been replaced with ->origin_object. + // This is set by fetch_origin() from this->origin and this->origin_id + /** @deprecated */ + public $expedition; + /** @deprecated */ + public $livraison; + /** @deprecated */ + public $commandeFournisseur; + + /** * @var string The object's reference */ @@ -1870,7 +1885,9 @@ abstract class CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Read linked origin object + * Read linked origin object. + * Set ->origin_object + * Set also ->expedition or ->livraison or ->commandFournisseur (deprecated) * * @return void */ @@ -1883,15 +1900,18 @@ abstract class CommonObject if ($this->origin == 'delivery') { $this->origin = 'livraison'; } - if ($this->origin == 'order_supplier') { + if ($this->origin == 'order_supplier' || $this->origin == 'supplier_order') { $this->origin = 'commandeFournisseur'; } $origin = $this->origin; $classname = ucfirst($origin); - $this->$origin = new $classname($this->db); - $this->$origin->fetch($this->origin_id); + $this->origin_object = new $classname($this->db); + $this->origin_object->fetch($this->origin_id); + + // TODO Remove this line + $this->$origin = $this->origin_object; } /** diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 3690c6e75d4..50ca67b83ab 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1755,7 +1755,8 @@ if ($action == 'create') { $typeobject = $object->origin; $origin = $object->origin; $origin_id = $object->origin_id; - $object->fetch_origin(); // Load property $object->commande, $object->propal, ... + + $object->fetch_origin(); // Load property $object->origin_object (old $object->commande, $object->propal, ...) } $soc = new Societe($db); @@ -1768,7 +1769,7 @@ if ($action == 'create') { $formconfirm = ''; - // Confirm deleteion + // Confirm deletion if ($action == 'delete') { $formquestion = array(); if ($object->statut == Expedition::STATUS_CLOSED && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { diff --git a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql index 4dc0417d54d..13433b716fd 100644 --- a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql +++ b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql @@ -191,3 +191,5 @@ CREATE TABLE llx_mrp_production_extrafields ) ENGINE=innodb; ALTER TABLE llx_mrp_production_extrafields ADD INDEX idx_mrp_production_fk_object(fk_object); + +ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN element_type varchar(50) DEFAULT 'supplier_order' NOT NULL; diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql index fa7cd92ba1f..6bbaea61c45 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql @@ -14,21 +14,23 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- --- This table is just an history table to track all receiving done for a +-- This table is just an history table to track all receiption to do or done for a -- particular supplier order. A movement with same information is also done -- into stock_movement so this table may be useless. -- -- Detail of each lines of a reception (qty, batch and into which warehouse must be -- received or has been receveived a purchase order line). --- This table should have been named llx_receptiondet_batch +-- +-- This table should be renamed into llx_receptiondet_batch -- =================================================================== create table llx_commande_fournisseur_dispatch ( rowid integer AUTO_INCREMENT PRIMARY KEY, fk_product integer, - fk_commande integer, - fk_commandefourndet integer, + fk_commande integer, -- should be renamed into fk_element + fk_commandefourndet integer, -- should be renamed into fk_elementdet + element_type varchar(50) DEFAULT 'supplier_order' NOT NULL, -- Type of source ('supplier_order', ...) fk_projet integer DEFAULT NULL, fk_reception integer DEFAULT NULL, qty float, -- qty to move diff --git a/htdocs/install/mysql/tables/llx_expedition.sql b/htdocs/install/mysql/tables/llx_expedition.sql index f61ab8224f0..f5c910af583 100644 --- a/htdocs/install/mysql/tables/llx_expedition.sql +++ b/htdocs/install/mysql/tables/llx_expedition.sql @@ -17,6 +17,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- +-- Note: a shipment is linked to an order or other object using llx_element_element table. -- =================================================================== create table llx_expedition @@ -31,11 +32,11 @@ create table llx_expedition ref_ext varchar(255), -- reference into an external system (not used by dolibarr) ref_customer varchar(255), -- customer number - date_creation datetime, -- date de creation + date_creation datetime, -- date of creation fk_user_author integer, -- author of creation fk_user_modif integer, -- author of last change - date_valid datetime, -- date de validation - fk_user_valid integer, -- valideur + date_valid datetime, -- date of validation + fk_user_valid integer, -- user that validate date_delivery datetime DEFAULT NULL, -- date planned of delivery date_expedition datetime, -- not used (deprecated) fk_address integer DEFAULT NULL, -- delivery address (deprecated) diff --git a/htdocs/install/mysql/tables/llx_reception.sql b/htdocs/install/mysql/tables/llx_reception.sql index d506215ee4a..26f9ed00863 100644 --- a/htdocs/install/mysql/tables/llx_reception.sql +++ b/htdocs/install/mysql/tables/llx_reception.sql @@ -17,6 +17,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- +-- Note: a reception is linked to a supplier order or other object using llx_element_element table. -- =================================================================== create table llx_reception @@ -29,7 +30,7 @@ create table llx_reception fk_projet integer DEFAULT NULL, ref_ext varchar(30), -- reference into an external system (not used by dolibarr) - ref_supplier varchar(255), -- supplier number + ref_supplier varchar(255), -- reference of reception on supplier side date_creation datetime, -- date de creation fk_user_author integer, -- author of creation diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 913bfa11e94..131359ca999 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -122,6 +122,7 @@ if ($id > 0 || !empty($ref)) { $object->fetch($id, $ref); $object->fetch_thirdparty(); + $typeobject = ''; if (!empty($object->origin)) { $origin = $object->origin; @@ -129,11 +130,10 @@ if ($id > 0 || !empty($ref)) { $typeobject = $object->origin; } - // Linked documents - if ($origin == 'order_supplier' && $object->$typeobject->id && isModEnabled("supplier_order")) { - $origin_id = $object->$typeobject->id; - $objectsrc = new CommandeFournisseur($db); - $objectsrc->fetch($object->$typeobject->id); + // Set $origin_id and $objectsrc + if (($origin == 'order_supplier' || $origin == 'supplier_order') && is_object($object->origin_object) && isModEnabled("supplier_order")) { + $origin_id = $object->origin_object->id; + $objectsrc = $object->origin_object; } } From 849b1488133562f2708543da7b166b2353bfb1e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Benke?= <1179011+defrance@users.noreply.github.com> Date: Tue, 14 Nov 2023 18:01:54 +0100 Subject: [PATCH 08/16] positioning arrayfields definition befor doactions hook (#26595) If the definition of arrayfields are after, we can't change the content of the array list like on the other page --- htdocs/projet/tasks/time.php | 51 +++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 73c6bcbefe0..2bd89809c95 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -158,6 +158,33 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } +// Definition of fields for list +$arrayfields = array(); +$arrayfields['t.element_date'] = array('label'=>$langs->trans("Date"), 'checked'=>1); +$arrayfields['p.fk_soc'] = array('label'=>$langs->trans("ThirdParty"), 'type'=>'integer:Societe:/societe/class/societe.class.php:1','checked'=>1); +$arrayfields['s.name_alias'] = array('label'=>$langs->trans("AliasNameShort"), 'type'=>'integer:Societe:/societe/class/societe.class.php:1'); +if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) { // Not a dedicated task + if (! empty($allprojectforuser)) { + $arrayfields['p.project_ref'] = ['label' => $langs->trans('RefProject'), 'checked' => 1]; + $arrayfields['p.project_label'] = ['label' => $langs->trans('ProjectLabel'), 'checked' => 1]; + } + $arrayfields['t.element_ref'] = array('label'=>$langs->trans("RefTask"), 'checked'=>1); + $arrayfields['t.element_label'] = array('label'=>$langs->trans("LabelTask"), 'checked'=>1); +} +$arrayfields['author'] = array('label' => $langs->trans("By"), 'checked' => 1); +$arrayfields['t.note'] = array('label' => $langs->trans("Note"), 'checked' => 1); +if (isModEnabled('service') && !empty($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0 && $projectstatic->usage_bill_time) { + $arrayfields['t.fk_product'] = array('label' => $langs->trans("Product"), 'checked' => 1); +} +$arrayfields['t.element_duration'] = array('label'=>$langs->trans("Duration"), 'checked'=>1); +$arrayfields['value'] = array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>isModEnabled("salaries")); +$arrayfields['valuebilled'] = array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>(((getDolGlobalInt('PROJECT_HIDE_TASKS') || !getDolGlobalInt('PROJECT_BILL_TIME_SPENT')) ? 0 : 1) && $projectstatic->usage_bill_time)); +// Extra fields +include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php'; + +$arrayfields = dol_sort_array($arrayfields, 'position'); + + $parameters = array('socid' => $socid, 'projectid' => $projectid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -1264,31 +1291,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser // Print form confirm print $formconfirm; - // Definition of fields for list - $arrayfields = array(); - $arrayfields['t.element_date'] = array('label'=>$langs->trans("Date"), 'checked'=>1); - $arrayfields['p.fk_soc'] = array('label'=>$langs->trans("ThirdParty"), 'type'=>'integer:Societe:/societe/class/societe.class.php:1','checked'=>1); - $arrayfields['s.name_alias'] = array('label'=>$langs->trans("AliasNameShort"), 'type'=>'integer:Societe:/societe/class/societe.class.php:1'); - if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) { // Not a dedicated task - if (! empty($allprojectforuser)) { - $arrayfields['p.project_ref'] = ['label' => $langs->trans('RefProject'), 'checked' => 1]; - $arrayfields['p.project_label'] = ['label' => $langs->trans('ProjectLabel'), 'checked' => 1]; - } - $arrayfields['t.element_ref'] = array('label'=>$langs->trans("RefTask"), 'checked'=>1); - $arrayfields['t.element_label'] = array('label'=>$langs->trans("LabelTask"), 'checked'=>1); - } - $arrayfields['author'] = array('label' => $langs->trans("By"), 'checked' => 1); - $arrayfields['t.note'] = array('label' => $langs->trans("Note"), 'checked' => 1); - if (isModEnabled('service') && !empty($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0 && $projectstatic->usage_bill_time) { - $arrayfields['t.fk_product'] = array('label' => $langs->trans("Product"), 'checked' => 1); - } - $arrayfields['t.element_duration'] = array('label'=>$langs->trans("Duration"), 'checked'=>1); - $arrayfields['value'] = array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>isModEnabled("salaries")); - $arrayfields['valuebilled'] = array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>(((getDolGlobalInt('PROJECT_HIDE_TASKS') || !getDolGlobalInt('PROJECT_BILL_TIME_SPENT')) ? 0 : 1) && $projectstatic->usage_bill_time)); - // Extra fields - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php'; - $arrayfields = dol_sort_array($arrayfields, 'position'); $param = ''; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { From 6d51b53ff4beea14b3add04b3739d10dc8320596 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 14 Nov 2023 18:03:56 +0100 Subject: [PATCH 09/16] Doc --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index a70b7b6da76..73a452abaee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ English Dolibarr ChangeLog For users: ---------- NEW: Compatibility with PHP 8.2 +NEW: Module for Advanced stock transfert is now stable (#26594) NEW: Add a confirmation popup when deleting extrafields NEW: Close #20930 Use ajax for state loading after country change NEW: #23331 Add support for parent projects (#24856) From c08207412941394c34fbe440f83d9f2f457b62c3 Mon Sep 17 00:00:00 2001 From: lamrani abdelwadoud Date: Tue, 14 Nov 2023 18:21:15 +0100 Subject: [PATCH 10/16] NEW functionality for clone job profile (#26599) * NEW functionality for combined salary invoice and supplier invoice * remove print_r * NEW functionality for clone jobProfile --- htdocs/hrm/class/job.class.php | 30 +++++++++++++ htdocs/hrm/class/skillrank.class.php | 12 ++++- htdocs/hrm/job_card.php | 65 ++++++++++++++++++++++++++-- 3 files changed, 103 insertions(+), 4 deletions(-) diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php index 4d737f98a51..b3ee63c311c 100644 --- a/htdocs/hrm/class/job.class.php +++ b/htdocs/hrm/class/job.class.php @@ -1103,6 +1103,36 @@ class Job extends CommonObject $return .= ''; return $return; } + /** + * function for get required skills associate to job object + * @param int $id Id of object + * @return array|int list of ids skillranks + */ + public function getSkillRankForJob($id) + { + if (empty($id)) { + return -1; + } + $skillranks = array(); + $sql = "SELECT rowid"; + $sql .= " FROM ".MAIN_DB_PREFIX."hrm_skillrank"; + $sql .= " WHERE fk_object = ".((int) $id); + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + $skillranks[] = $obj; + $i++; + } + $this->db->free($resql); + } else { + dol_print_error($this->db); + } + return $skillranks; + } } diff --git a/htdocs/hrm/class/skillrank.class.php b/htdocs/hrm/class/skillrank.class.php index b14ab679c30..3edb8e0eb90 100644 --- a/htdocs/hrm/class/skillrank.class.php +++ b/htdocs/hrm/class/skillrank.class.php @@ -234,9 +234,10 @@ class SkillRank extends CommonObject * * @param User $user User that creates * @param int $fromid Id of object to clone + * @param int $fk_object id of Job object (if new job object) * @return mixed New object created, <0 if KO */ - public function createFromClone(User $user, $fromid) + public function createFromClone(User $user, $fromid, $fk_object = 0) { global $langs, $extrafields; $error = 0; @@ -261,6 +262,10 @@ class SkillRank extends CommonObject unset($object->id); unset($object->fk_user_creat); unset($object->import_key); + if (!empty($fk_object) && $fk_object > 0) { + unset($object->fk_object); + } + // Clear fields if (property_exists($object, 'ref')) { @@ -278,6 +283,11 @@ class SkillRank extends CommonObject if (property_exists($object, 'date_modification')) { $object->date_modification = null; } + if (!empty($fk_object) && $fk_object > 0) { + if (property_exists($object, 'fk_object')) { + $object->fk_object = ($fk_object = 0 ? $this->fk_object : $fk_object); + } + } // ... // Clear extrafields that are unique if (is_array($object->array_options) && count($object->array_options) > 0) { diff --git a/htdocs/hrm/job_card.php b/htdocs/hrm/job_card.php index 89c8c0a2412..0d458e7806e 100644 --- a/htdocs/hrm/job_card.php +++ b/htdocs/hrm/job_card.php @@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_job.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/hrm/class/skillrank.class.php'; // Load translation files required by the page $langs->loadLangs(array('hrm', 'other', 'products')); // why products? @@ -120,7 +121,9 @@ if (empty($reshook)) { // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen - include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php'; + if ($action != 'confirm_clone') { + include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php'; + } // Actions when linking object each other include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; @@ -146,6 +149,56 @@ if (empty($reshook)) { $autocopy = 'MAIN_MAIL_AUTOCOPY_JOB_TO'; $trackid = 'job' . $object->id; include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php'; + + if ($action == 'confirm_clone' && $confirm != 'yes') { + $action = ''; + } + + if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->hasRight('salaries', 'write'))) { + $db->begin(); + + $originalId = $id; + + $object->fetch($id); + $skillRequire = $object->getSkillRankForJob($originalId); + if ($object->id > 0) { + $object->id = $object->ref = null; + + if (GETPOST('clone_label', 'alphanohtml')) { + $object->label = GETPOST('clone_label', 'alphanohtml'); + } else { + $object->label = $langs->trans("CopyOf").' '.$object->label; + } + if (GETPOST('clone_skills_required')) { + $cloneSkillRequired = GETPOST('clone_skills_required'); + } + + $id = $object->create($user); + if ($id > 0) { + if (!empty($cloneSkillRequired)) { + $i = 0; + while ($i < count($skillRequire)) { + $skillrank = new SkillRank($db); + $skillrank->createFromClone($user, $skillRequire[$i]->rowid, $id); + $i++; + } + } + $db->commit(); + $db->close(); + + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); + exit; + } else { + $id = $originalId; + $db->rollback(); + + setEventMessages($object->error, $object->errors, 'errors'); + } + } else { + $db->rollback(); + dol_print_error($db, $object->error); + } + } } @@ -275,8 +328,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Clone confirmation if ($action == 'clone') { // Create an array for form - $formquestion = array(); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + $formquestion = array( + array('type' => 'text', 'name' => 'clone_label', 'label' => $langs->trans("Label"), 'value' => $langs->trans("CopyOf").' '.$object->label), + array('type' => 'checkbox', 'name' => 'clone_skills_required', 'label' => $langs->trans("RequiredSkills"), 'value' => '',), + + ); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->label), 'confirm_clone', $formquestion, 'yes', 1, 280); } // Confirmation of action xxxx @@ -413,6 +470,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken(), '', $permissiontoadd); + print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=clone&token=' . newToken(), '', $permissiontoadd); + // Delete (need delete permission, or if draft, just need create/modify permission) print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=delete&token=' . newToken(), '', $permissiontodelete); } From 8c8e806a8fd44a1f7f1dadea53f4ff85dec68e9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Benke?= <1179011+defrance@users.noreply.github.com> Date: Tue, 14 Nov 2023 20:51:43 +0100 Subject: [PATCH 11/16] NEW : extrafields based on fontawesome (#26598) * NEW : extrafields based on fontawesome allow to define a field contain a icon based on fontawesome on input we have an icon picker on ouput we display the icon * Update extrafields.class.php * Update extrafields.class.php * Update extrafields.class.php --- htdocs/core/class/extrafields.class.php | 31 +++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 4aebc763344..fe0b2a358dd 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -87,6 +87,7 @@ class ExtraFields 'mail'=>'ExtrafieldMail', 'url'=>'ExtrafieldUrl', 'ip'=>'ExtrafieldIP', + 'icone'=>'Icone', 'password' => 'ExtrafieldPassword', 'select' => 'ExtrafieldSelect', 'sellist' => 'ExtrafieldSelectList', @@ -225,7 +226,7 @@ class ExtraFields } elseif ($type == 'phone') { $typedb = 'varchar'; $lengthdb = '20'; - } elseif ($type == 'mail' || $type == 'ip') { + } elseif ($type == 'mail' || $type == 'ip' || $type == 'icone') { $typedb = 'varchar'; $lengthdb = '128'; } elseif ($type == 'url') { @@ -579,7 +580,7 @@ class ExtraFields } elseif ($type == 'phone') { $typedb = 'varchar'; $lengthdb = '20'; - } elseif ($type == 'mail' || $type == 'ip') { + } elseif ($type == 'mail' || $type == 'ip' || $type == 'icone') { $typedb = 'varchar'; $lengthdb = '128'; } elseif ($type == 'url') { @@ -1070,6 +1071,26 @@ class ExtraFields $out = ''; } elseif (in_array($type, array('mail', 'ip', 'phone', 'url'))) { $out = ''; + } elseif ($type == 'icone') { + $out =''; + $out.=''; + $out.= ''; + $out.=''; } elseif ($type == 'text') { if (!preg_match('/search_/', $keyprefix)) { // If keyprefix is search_ or search_options_, we must just use a simple text field require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -1652,6 +1673,8 @@ class ExtraFields $value = dol_print_email($value, 0, 0, 0, 64, 1, 1); } elseif ($type == 'ip') { $value = dol_print_ip($value, 0); + } elseif ($type == 'icone') { + $value = ''; } elseif ($type == 'url') { $value = dol_print_url($value, '_blank', 32, 1); } elseif ($type == 'phone') { @@ -1948,11 +1971,11 @@ class ExtraFields $cssstring = ''; - if (in_array($type, array('date', 'datetime', 'datetimegmt'))) { + if (in_array($type, array('date', 'datetime', 'datetimegmt',))) { $cssstring = "center"; } elseif (in_array($type, array('int', 'price', 'double'))) { $cssstring = "right"; - } elseif (in_array($type, array('boolean', 'radio', 'checkbox', 'ip'))) { + } elseif (in_array($type, array('boolean', 'radio', 'checkbox', 'ip', 'icone'))) { $cssstring = "center"; } From c0510fc0f534758b9f28ef377df98a36290bb6a3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 14 Nov 2023 20:59:31 +0100 Subject: [PATCH 12/16] Debug v19 --- ChangeLog | 1 + htdocs/core/class/extrafields.class.php | 12 ++++++------ htdocs/core/class/html.formother.class.php | 2 +- htdocs/core/lib/files.lib.php | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 73a452abaee..f1b67b79cfd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,7 @@ For users: NEW: Compatibility with PHP 8.2 NEW: Module for Advanced stock transfert is now stable (#26594) NEW: Add a confirmation popup when deleting extrafields +NEW: Add type 'icon' type for extrafields NEW: Close #20930 Use ajax for state loading after country change NEW: #23331 Add support for parent projects (#24856) NEW: #22531 Expense report - Add two fields into export : Qty & Unit price (excl.) (#26309) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index fe0b2a358dd..9fae05f39e0 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -87,7 +87,7 @@ class ExtraFields 'mail'=>'ExtrafieldMail', 'url'=>'ExtrafieldUrl', 'ip'=>'ExtrafieldIP', - 'icone'=>'Icone', + 'icon'=>'Icon', 'password' => 'ExtrafieldPassword', 'select' => 'ExtrafieldSelect', 'sellist' => 'ExtrafieldSelectList', @@ -226,7 +226,7 @@ class ExtraFields } elseif ($type == 'phone') { $typedb = 'varchar'; $lengthdb = '20'; - } elseif ($type == 'mail' || $type == 'ip' || $type == 'icone') { + } elseif ($type == 'mail' || $type == 'ip' || $type == 'icon') { $typedb = 'varchar'; $lengthdb = '128'; } elseif ($type == 'url') { @@ -580,7 +580,7 @@ class ExtraFields } elseif ($type == 'phone') { $typedb = 'varchar'; $lengthdb = '20'; - } elseif ($type == 'mail' || $type == 'ip' || $type == 'icone') { + } elseif ($type == 'mail' || $type == 'ip' || $type == 'icon') { $typedb = 'varchar'; $lengthdb = '128'; } elseif ($type == 'url') { @@ -1071,7 +1071,7 @@ class ExtraFields $out = ''; } elseif (in_array($type, array('mail', 'ip', 'phone', 'url'))) { $out = ''; - } elseif ($type == 'icone') { + } elseif ($type == 'icon') { $out =''; $out.=''; $out.= ''; } elseif ($type == 'url') { $value = dol_print_url($value, '_blank', 32, 1); @@ -1975,7 +1975,7 @@ class ExtraFields $cssstring = "center"; } elseif (in_array($type, array('int', 'price', 'double'))) { $cssstring = "right"; - } elseif (in_array($type, array('boolean', 'radio', 'checkbox', 'ip', 'icone'))) { + } elseif (in_array($type, array('boolean', 'radio', 'checkbox', 'ip', 'icon'))) { $cssstring = "center"; } diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 817521f954b..d8dfe544584 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -996,7 +996,7 @@ class FormOther $file = $conf->$module->dir_temp.'/'.$name.'.png'; - // On cree le repertoire contenant les icones + // We create temp directory if (!file_exists($conf->$module->dir_temp)) { dol_mkdir($conf->$module->dir_temp); } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 7f45bc2e4ab..411cc3f4234 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2882,7 +2882,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, //$original_file=$conf->barcode->dir_temp.'/'.$original_file; $original_file = ''; } elseif ($modulepart == 'iconmailing' && !empty($conf->mailing->dir_temp)) { - // Wrapping pour les icones de background des mailings + // Wrapping for icon of background of mailings $accessallowed = 1; $original_file = $conf->mailing->dir_temp.'/'.$original_file; } elseif ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp)) { From d5bb63df5da9ea8615b5ee12846377d79205bad6 Mon Sep 17 00:00:00 2001 From: thomas-Ngr Date: Tue, 14 Nov 2023 22:39:18 +0100 Subject: [PATCH 13/16] Reception dispatch : copy previous entrepot (#26597) --- htdocs/fourn/js/lib_dispatch.js.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/js/lib_dispatch.js.php b/htdocs/fourn/js/lib_dispatch.js.php index d8df7dc2da8..1b4b799fc8f 100644 --- a/htdocs/fourn/js/lib_dispatch.js.php +++ b/htdocs/fourn/js/lib_dispatch.js.php @@ -125,7 +125,10 @@ function addDispatchLine(index, type, mode) { //create new select2 to avoid duplicate id of cloned one $row.find("select[name='" + 'entrepot_' + nbrTrs + '_' + index + "']").select2(); - // TODO find solution to copy selected option to new select + // Copy selected option to new select + let $prevRow = $("tr[name^='" + type + "_'][name$='_" + index + "']:last") + let $prevEntr = Number($prevRow.find("select[name='" + 'entrepot_' + (nbrTrs-1) + '_' + index + "']").val()) + $row.find("select[name='" + 'entrepot_' + nbrTrs + '_' + index + "']").val($prevEntr) // TODO find solution to keep new tr's after page refresh //clear value $row.find("input[name^='qty']").val(''); From db8662f8e276308dcfa2ac9f0c248921119d7998 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 14 Nov 2023 23:14:59 +0100 Subject: [PATCH 14/16] Doc --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f1b67b79cfd..8cbe117b234 100644 --- a/ChangeLog +++ b/ChangeLog @@ -103,7 +103,6 @@ NEW: Date d'entree en stock sur les exped au moment de la création NEW: Date field for shipment export (#25574) NEW: Date format dayhoursec is using year on 2 char on smartphones NEW: Default customer, category and product when enable TakePOS (#25031) -NEW: Disable not used PHP streams NEW: do not add default value in list NEW: drop down for action button show a simple button if only 1 action NEW: Enhance github_commits_perversion to get more stats on git commits @@ -174,6 +173,7 @@ NEW: When an user unset the batch management of products, transformation of each SEC: #25512 applicative anti bruteforce - security on too many login attempts (#25520) SEC: Add action confirm_... as sensitive to need a CSRF token +SEC: Disable not used PHP streams For developers or integrators: From 0cc541bb4af15a6245f7b816b14fbdd6648c6cd0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Nov 2023 11:47:15 +0100 Subject: [PATCH 15/16] Standardize fields --- htdocs/install/mysql/migration/18.0.0-19.0.0.sql | 4 ++++ htdocs/install/mysql/tables/llx_salary.sql | 12 +++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql index 4dc0417d54d..c4cf413dd37 100644 --- a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql +++ b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql @@ -191,3 +191,7 @@ CREATE TABLE llx_mrp_production_extrafields ) ENGINE=innodb; ALTER TABLE llx_mrp_production_extrafields ADD INDEX idx_mrp_production_fk_object(fk_object); + +ALTER TABLE llx_salary ADD COLUM ref_ext varchar(255); +ALTER TABLE llx_salary ADD COLUM note_public text; + diff --git a/htdocs/install/mysql/tables/llx_salary.sql b/htdocs/install/mysql/tables/llx_salary.sql index b68ac1e7a1e..92ac93511b9 100644 --- a/htdocs/install/mysql/tables/llx_salary.sql +++ b/htdocs/install/mysql/tables/llx_salary.sql @@ -1,6 +1,7 @@ -- =================================================================== --- Copyright (C) 2011-2018 Alexandre Spangaro --- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2011-2018 Alexandre Spangaro +-- Copyright (C) 2021 Gauthier VERDOL +-- Copyright (C) 2023 Laurent Destailleur -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -14,13 +15,13 @@ -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . --- -- =================================================================== create table llx_salary ( rowid integer AUTO_INCREMENT PRIMARY KEY, ref varchar(30) NULL, -- payment reference number (currently NULL because there is no numbering manager yet) + ref_ext varchar(255), -- reference into an external system (not used by dolibarr) tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- Create date fk_user integer NOT NULL, @@ -29,13 +30,14 @@ create table llx_salary salary double(24,8), -- salary of user when payment was done amount double(24,8) NOT NULL DEFAULT 0, fk_projet integer DEFAULT NULL, - fk_typepayment integer NOT NULL, - num_payment varchar(50), -- num cheque or other + fk_typepayment integer NOT NULL, -- default expected payment + num_payment varchar(50), -- num cheque or other (deprecated, now stored into the payment) label varchar(255), datesp date, -- date start period dateep date, -- date end period entity integer DEFAULT 1 NOT NULL, -- multi company id note text, + note_public text, fk_bank integer, paye smallint default 0 NOT NULL, fk_account integer, From 29e616fa8baf440f5261a204ee047f1b8c658db8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Nov 2023 19:26:14 +0100 Subject: [PATCH 16/16] CSS --- htdocs/compta/sociales/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index d9199baa03c..a12f14741cb 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -748,14 +748,14 @@ if ($id > 0) { print '
'; } - print '\n"; - print '\n"; + print '\n"; + print '\n"; $resteapayer = $object->amount - $totalpaid; $cssforamountpaymentcomplete = 'amountpaymentcomplete'; print '"; - print '\n"; + print '\n"; print "
'; print '
'.$langs->trans("AlreadyPaid").' :'.price($totalpaid)."
'.$langs->trans("AmountExpected").' :'.price($object->amount)."
'.$langs->trans("AlreadyPaid").' :'.price($totalpaid)."
'.$langs->trans("AmountExpected").' :'.price($object->amount)."
'.$langs->trans("RemainderToPay")." :'.price($resteapayer)."
'.price($resteapayer)."
"; print '';