From 6acf10c0d43487816ee9d434b298017e1d1bcedf Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 19 Feb 2020 11:54:55 +0100 Subject: [PATCH 01/62] extend retained warranty to be available for all invoices --- htdocs/admin/facture_situation.php | 4 +- htdocs/compta/facture/card.php | 247 ++++++++++-------- htdocs/compta/facture/class/facture.class.php | 49 +++- htdocs/compta/facture/list.php | 4 +- .../facture/doc/pdf_sponge.modules.php | 57 ++-- .../install/mysql/migration/11.0.0-12.0.0.sql | 4 +- htdocs/langs/en_US/bills.lang | 2 + 7 files changed, 204 insertions(+), 163 deletions(-) diff --git a/htdocs/admin/facture_situation.php b/htdocs/admin/facture_situation.php index 408b762358e..aced29bc125 100644 --- a/htdocs/admin/facture_situation.php +++ b/htdocs/admin/facture_situation.php @@ -96,7 +96,9 @@ print "\n"; _printOnOff('INVOICE_USE_SITUATION', $langs->trans('UseSituationInvoices')); _printOnOff('INVOICE_USE_SITUATION_CREDIT_NOTE', $langs->trans('UseSituationInvoicesCreditNote')); -_printOnOff('INVOICE_USE_SITUATION_RETAINED_WARRANTY', $langs->trans('Retainedwarranty')); +_printOnOff('INVOICE_USE_RETAINED_WARRANTY',$langs->trans('Retainedwarranty')); +_printOnOff('USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION',$langs->trans('RetainedwarrantyOnlyForSituation')); +_printOnOff('USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL',$langs->trans('RetainedwarrantyOnlyForSituationFinal')); $metas = array( 'type' => 'number', diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 5038079085b..593e33734c5 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -136,7 +136,12 @@ if ($user->socid) $socid = $user->socid; $isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft); - +// retained warranty invoice available type +if(empty($conf->global->USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION)) { + $RetainedWarrantyInvoiceAvailableType = array( Facture::TYPE_SITUATION, Facture::TYPE_STANDARD); +} else { + $RetainedWarrantyInvoiceAvailableType = array( Facture::TYPE_SITUATION ); +} /* * Actions @@ -1308,18 +1313,17 @@ if (empty($reshook)) $object->situation_counter = 1; $object->situation_final = 0; $object->situation_cycle_ref = $object->newCycle(); - - - $object->retained_warranty = GETPOST('retained_warranty', 'int'); - $object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); - - $retained_warranty_date_limit = GETPOST('retained_warranty_date_limit'); - if (!empty($retained_warranty_date_limit) && $db->jdate($retained_warranty_date_limit)) { - $object->retained_warranty_date_limit = $db->jdate($retained_warranty_date_limit); - } - $object->retained_warranty_date_limit = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement); } + $object->retained_warranty = GETPOST('retained_warranty', 'int'); + $object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); + + $retained_warranty_date_limit = GETPOST('retained_warranty_date_limit'); + if(!empty($retained_warranty_date_limit) && $db->jdate($retained_warranty_date_limit)){ + $object->retained_warranty_date_limit = $db->jdate($retained_warranty_date_limit); + } + $object->retained_warranty_date_limit = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement); + $object->fetch_thirdparty(); // If creation from another object of another module (Example: origin=propal, originid=1) @@ -1714,6 +1718,23 @@ if (empty($reshook)) $object->origin = $origin; $object->origin_id = $originid; + // retained warranty + if(!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) + { + $retained_warranty = GETPOST('retained_warranty'); + if(price2num($retained_warranty) > 0) + { + $object->retained_warranty = price2num($retained_warranty); + } + + if(GETPOST('retained_warranty_fk_cond_reglement', 'int') > 0) + { + $object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); + } + + $object->retained_warranty_date_limit = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement); + } + foreach ($object->lines as $i => &$line) { $line->origin = $object->origin; @@ -3309,40 +3330,41 @@ if ($action == 'create') $form->select_conditions_paiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id'); print ''; - if (!empty($conf->global->INVOICE_USE_SITUATION)) - { - if ($conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY) { - $rwStyle = 'display:none;'; - if (GETPOST('type', 'int') == Facture::TYPE_SITUATION) { - $rwStyle = ''; - } - $retained_warranty = GETPOST('retained_warranty', 'int'); - $retained_warranty = !empty($retained_warranty) ? $retained_warranty : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT; - print ''.$langs->trans('RetainedWarranty').''; - print '%'; + if($conf->global->INVOICE_USE_RETAINED_WARRANTY){ - // Retained warranty payment term - print ''.$langs->trans('PaymentConditionsShortRetainedWarranty').''; - $retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); - $retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement) ? $retained_warranty_fk_cond_reglement : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; - $form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1); - print ''; + $rwStyle = 'display:none;'; + if(in_array(GETPOST('type', 'int'), $RetainedWarrantyInvoiceAvailableType)){ + $rwStyle = ''; + } - print ''; - } + + $retained_warranty = GETPOST('retained_warranty', 'int'); + $retained_warranty = !empty($retained_warranty)?$retained_warranty:$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT; + print '' . $langs->trans('RetainedWarranty') . ''; + print '%'; + + // Retained warranty payment term + print '' . $langs->trans('PaymentConditionsShortRetainedWarranty') . ''; + $retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); + $retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement)? $retained_warranty_fk_cond_reglement : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; + $form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1); + print ''; + + print ''; } // Payment mode @@ -4243,89 +4265,82 @@ elseif ($id > 0 || !empty($ref)) print ''; } - $displayWarranty = false; - if (($object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty) || !empty($conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY)))) - { - // Check if this situation invoice is 100% for real - if (!empty($object->situation_final) && !empty($object->lines)) { - $displayWarranty = true; - foreach ($object->lines as $i => $line) { - if ($line->product_type < 2 && $line->situation_percent < 100) { - $displayWarranty = false; - break; - } - } - } + if(!empty($object->retained_warranty) || !empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) { - // Retained Warranty - print ''; - print ''; - if ($action != 'editretainedwarranty' && $user->rights->facture->creer) { - print ''; - } + $displayWarranty = true; + if(!in_array($object->type, $RetainedWarrantyInvoiceAvailableType) && empty($object->retained_warranty)){ + $displayWarranty = false; + } - print '
'; - print $langs->trans('RetainedWarranty'); - print 'id.'">'.img_edit($langs->trans('setretainedwarranty'), 1).'
'; - print ''; - if ($action == 'editretainedwarranty') - { - print '
'; - print ''; - print ''; - print ''; - print ''; - print '
'; - } - else - { - print price($object->retained_warranty).'%'; - } - print ''; + if($displayWarranty) + { - // Retained warranty payment term - print ''; - print ''; - if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer) { - print ''; - } + // Retained Warranty + print '
'; - print $langs->trans('PaymentConditionsShortRetainedWarranty'); - print 'id.'">'.img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1).'
'; + print ''; + if ($action != 'editretainedwarranty' && $user->rights->facture->creer) { + print ''; + } - print '
'; + print $langs->trans('RetainedWarranty'); + print 'id.'">'.img_edit($langs->trans('setretainedwarranty'), 1).'
'; - print '
'; - $defaultDate = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : strtotime('-1 years', $object->date_lim_reglement); - if ($object->date > $defaultDate) { - $defaultDate = $object->date; - } + print '
'; + print ''; + if ($action == 'editretainedwarranty') + { + print '
'; + print ''; + print ''; + print ''; + print ''; + print '
'; + } + else + { + print price($object->retained_warranty).'%'; + } + print ''; - if ($action == 'editretainedwarrantypaymentterms') - { - //date('Y-m-d',$object->date_lim_reglement) - print '
'; - print ''; - print ''; - $retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); - $retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement) ? $retained_warranty_fk_cond_reglement : $object->retained_warranty_fk_cond_reglement; - $retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement) ? $retained_warranty_fk_cond_reglement : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; - $form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1); - print ''; - print '
'; - } - else - { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none'); - if (!$displayWarranty) { - print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" '); - } - } - print ''; + // Retained warranty payment term + print ''; + print ''; + if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer) { + print ''; + } + print '
'; + print $langs->trans('PaymentConditionsShortRetainedWarranty'); + print 'id.'">'.img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1).'
'; + print ''; + $defaultDate = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : strtotime('-1 years', $object->date_lim_reglement); + if ($object->date > $defaultDate) { + $defaultDate = $object->date; + } + + if ($action == 'editretainedwarrantypaymentterms') + { + //date('Y-m-d',$object->date_lim_reglement) + print '
'; + print ''; + print ''; + $retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); + $retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement) ? $retained_warranty_fk_cond_reglement : $object->retained_warranty_fk_cond_reglement; + $retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement) ? $retained_warranty_fk_cond_reglement : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; + $form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1); + print ''; + print '
'; + } + else + { + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none'); + if (!$displayWarranty) { + print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" '); + } + } + print ''; - if ($displayWarranty) - { // Retained Warranty payment date limit print ''; print '\n"; _printOnOff('INVOICE_USE_SITUATION', $langs->trans('UseSituationInvoices')); _printOnOff('INVOICE_USE_SITUATION_CREDIT_NOTE', $langs->trans('UseSituationInvoicesCreditNote')); -_printOnOff('INVOICE_USE_RETAINED_WARRANTY',$langs->trans('Retainedwarranty')); -_printOnOff('USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION',$langs->trans('RetainedwarrantyOnlyForSituation')); -_printOnOff('USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL',$langs->trans('RetainedwarrantyOnlyForSituationFinal')); +_printOnOff('INVOICE_USE_RETAINED_WARRANTY', $langs->trans('Retainedwarranty')); +_printOnOff('USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituation')); +_printOnOff('USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL', $langs->trans('RetainedwarrantyOnlyForSituationFinal')); $metas = array( 'type' => 'number', diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 593e33734c5..75e56b580a4 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3332,7 +3332,6 @@ if ($action == 'create') if($conf->global->INVOICE_USE_RETAINED_WARRANTY){ - $rwStyle = 'display:none;'; if(in_array(GETPOST('type', 'int'), $RetainedWarrantyInvoiceAvailableType)){ $rwStyle = ''; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 30f3867a843..135d30ef576 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4610,7 +4610,8 @@ class Facture extends CommonInvoice * Currently used for documents generation : to know if retained warranty need to be displayed * @return bool */ - function displayRetainedWarranty(){ + function displayRetainedWarranty() + { global $conf; // TODO : add a flag on invoices to store this conf : USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL From d65c17df7dd323c3743f68a733699c283d8040a6 Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 19 Feb 2020 12:30:52 +0100 Subject: [PATCH 03/62] Add retained warranty for all invoice for crabe PDF --- .../modules/facture/doc/pdf_crabe.modules.php | 52 +++++++------------ 1 file changed, 19 insertions(+), 33 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 6e8918920a6..7dc9aa245e9 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1377,47 +1377,33 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1); // Retained warranty - if (!empty($object->situation_final) && ($object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty)))) + if ($object->displayRetainedWarranty()) { - $displayWarranty = false; + $pdf->SetTextColor(40, 40, 40); + $pdf->SetFillColor(255, 255, 255); - // Check if this situation invoice is 100% for real - if (!empty($object->lines)) { - $displayWarranty = true; - foreach ($object->lines as $i => $line) { - if ($line->product_type < 2 && $line->situation_percent < 100) { - $displayWarranty = false; - break; - } - } - } + $retainedWarranty = $object->getRetainedWarrantyAmount(); + $billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty; - if ($displayWarranty) { - $pdf->SetTextColor(40, 40, 40); - $pdf->SetFillColor(255, 255, 255); + // Billed - retained warranty + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("ToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1); - $retainedWarranty = $object->total_ttc * $object->retained_warranty / 100; - $billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty; + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1); - // Billed - retained warranty - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("ToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1); + // retained warranty + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1); + $retainedWarrantyToPayOn = $outputlangs->transnoentities("RetainedWarranty").' ('.$object->retained_warranty.'%)'; + $retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit) ? ' '.$outputlangs->transnoentities("toPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : ''; - // retained warranty - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1); - $retainedWarrantyToPayOn = $outputlangs->transnoentities("RetainedWarranty").' ('.$object->retained_warranty.'%)'; - $retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit) ? ' '.$outputlangs->transnoentities("toPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : ''; - - $pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1); - } } } } From 729048a1131f7e5402edc01d5cc8f01dfde79c31 Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 19 Feb 2020 12:33:36 +0100 Subject: [PATCH 04/62] Fix langs --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 5ab59275666..82a55fbf319 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1674,7 +1674,7 @@ class pdf_sponge extends ModelePDFFactures // Billed - retained warranty $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFEVOLToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("ToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1); @@ -1683,8 +1683,8 @@ class pdf_sponge extends ModelePDFFactures $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $retainedWarrantyToPayOn = $outputlangs->transnoentities("PDFEVOLRetainedWarranty").' ('.$object->retained_warranty.'%)'; - $retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit) ? ' '.$outputlangs->transnoentities("PDFEVOLtoPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : ''; + $retainedWarrantyToPayOn = $outputlangs->transnoentities("RetainedWarranty").' ('.$object->retained_warranty.'%)'; + $retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit) ? ' '.$outputlangs->transnoentities("toPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : ''; $pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); From 4865e34cc2610dd66561bc838d160306cab8ad5c Mon Sep 17 00:00:00 2001 From: ATM john Date: Tue, 25 Feb 2020 23:02:13 +0100 Subject: [PATCH 05/62] fix missing visibility --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 24d4b40d339..30a607afc0a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4713,7 +4713,7 @@ class Facture extends CommonInvoice * Currently used for documents generation : to know if retained warranty need to be displayed * @return bool */ - function displayRetainedWarranty() + public function displayRetainedWarranty() { global $conf; From 035bb671f25f601bc4680639dec36d2da065af5f Mon Sep 17 00:00:00 2001 From: ATM john Date: Tue, 31 Mar 2020 16:32:07 +0200 Subject: [PATCH 06/62] Fix sql ; missing --- htdocs/install/mysql/migration/11.0.0-12.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 4959d3afdc5..70eb7c7357c 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -189,7 +189,7 @@ DELETE FROM llx_const WHERE name = __ENCRYPT('DONATION_ART885')__; ALTER TABLE llx_extrafields MODIFY COLUMN printable integer DEFAULT 0; ALTER TABLE llx_extrafields ADD COLUMN printable integer DEFAULT 0; -UPDATE llx_const SET name = 'INVOICE_USE_RETAINED_WARRANTY' WHERE name = 'INVOICE_USE_SITUATION_RETAINED_WARRANTY' +UPDATE llx_const SET name = 'INVOICE_USE_RETAINED_WARRANTY' WHERE name = 'INVOICE_USE_SITUATION_RETAINED_WARRANTY'; ALTER TABLE llx_accounting_account DROP COLUMN pcg_subtype; From 004d9381f51f65de155ff3aa266457b1d398b52d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 31 Mar 2020 14:36:42 +0000 Subject: [PATCH 07/62] Fixing style errors. --- htdocs/compta/facture/card.php | 20 +++++++++---------- htdocs/compta/facture/class/facture.class.php | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 8495bc8be70..8dec5123623 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3359,18 +3359,18 @@ if ($action == 'create') if($conf->global->INVOICE_USE_RETAINED_WARRANTY){ $rwStyle = 'display:none;'; - if(in_array(GETPOST('type', 'int'), $RetainedWarrantyInvoiceAvailableType)){ - $rwStyle = ''; - } + if(in_array(GETPOST('type', 'int'), $RetainedWarrantyInvoiceAvailableType)){ + $rwStyle = ''; + } $retained_warranty = GETPOST('retained_warranty', 'int'); - if(empty($retained_warranty)){ - if(!empty($objectsrc->retained_warranty)){ // use previous situation value - $retained_warranty = $objectsrc->retained_warranty; - }else{ - $retained_warranty = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT; - } - } + if(empty($retained_warranty)){ + if(!empty($objectsrc->retained_warranty)){ // use previous situation value + $retained_warranty = $objectsrc->retained_warranty; + }else{ + $retained_warranty = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT; + } + } print '\n"; _printOnOff('INVOICE_USE_SITUATION', $langs->trans('UseSituationInvoices')); _printOnOff('INVOICE_USE_SITUATION_CREDIT_NOTE', $langs->trans('UseSituationInvoicesCreditNote')); -_printOnOff('INVOICE_USE_RETAINED_WARRANTY', $langs->trans('Retainedwarranty')); -_printOnOff('USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituation')); -_printOnOff('USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL', $langs->trans('RetainedwarrantyOnlyForSituationFinal')); +//_printOnOff('INVOICE_USE_RETAINED_WARRANTY', $langs->trans('Retainedwarranty')); + +$confkey = 'INVOICE_USE_RETAINED_WARRANTY'; + +$arrayAvailableType = array( + Facture::TYPE_SITUATION => $langs->trans("InvoiceSituation"), + Facture::TYPE_STANDARD.'+'.Facture::TYPE_SITUATION => $langs->trans("InvoiceSituation").' + '.$langs->trans("InvoiceStandard"), +); +$selected = array(); +$implodeglue = '+'; +if(!empty($conf->global->{$confkey}) && !is_array($conf->global->{$confkey})){ + $selected = explode('+', $conf->global->{$confkey}); +} + +$curentInput = (empty($inputCount)?1:($inputCount+1)); +$formSelectInvoiceType = $form->selectarray('value'. $curentInput, $arrayAvailableType, $selected, 1); +_printInputFormPart($confkey, $langs->trans('AllowedInvoiceForRetainedWarranty'), '', array(), $formSelectInvoiceType); + +//_printOnOff('INVOICE_RETAINED_WARRANTY_LIMITED_TO_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituation')); +_printOnOff('INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituationFinal')); $metas = array( 'type' => 'number', @@ -228,9 +245,13 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra print ''; if ($type=='textarea') { - print ''; - } else { + print ''; + }elseif($type=='input'){ print ''; } + else{ + // custom + print $type; + } print ''; } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 62a84a51245..ada61efae91 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -140,10 +140,9 @@ $isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft); // retained warranty invoice available type -if(empty($conf->global->USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION)) { - $retainedWarrantyInvoiceAvailableType = array( Facture::TYPE_SITUATION, Facture::TYPE_STANDARD); -} else { - $retainedWarrantyInvoiceAvailableType = array( Facture::TYPE_SITUATION ); +$retainedWarrantyInvoiceAvailableType=array(); +if(!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) { + $retainedWarrantyInvoiceAvailableType = explode('+', $conf->global->INVOICE_USE_RETAINED_WARRANTY); } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0b1915a6fc9..af709cec2c4 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4750,15 +4750,15 @@ class Facture extends CommonInvoice { global $conf; - // TODO : add a flag on invoices to store this conf : USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL + // TODO : add a flag on invoices to store this conf : INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION - // note : we dont need to test USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION because if $this->retained_warranty is not empty it's because it was set when this conf was active + // note : we dont need to test INVOICE_USE_RETAINED_WARRANTY because if $this->retained_warranty is not empty it's because it was set when this conf was active $displayWarranty = false; if(!empty($this->retained_warranty)) { $displayWarranty = true; - if ($this->type == Facture::TYPE_SITUATION && !empty($conf->global->USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL)) { + if ($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION)) { // Check if this situation invoice is 100% for real $displayWarranty = false; if (!empty($this->situation_final)) { @@ -4794,7 +4794,7 @@ class Facture extends CommonInvoice $retainedWarrantyAmount = 0; // Billed - retained warranty - if($this->type == Facture::TYPE_SITUATION && !empty($conf->global->USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL)) + if($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION)) { $displayWarranty = true; // Check if this situation invoice is 100% for real diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index d2b830119ca..36747c4625a 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -219,6 +219,7 @@ ShowInvoiceSituation=Show situation invoice UseSituationInvoices=Allow situation invoice UseSituationInvoicesCreditNote=Allow situation invoice credit note Retainedwarranty=Retained warranty +AllowedInvoiceForRetainedWarranty=Retained warranty usable on the following types of invoices RetainedwarrantyDefaultPercent=Retained warranty default percent RetainedwarrantyOnlyForSituation=Make "retained warranty" available only for situation invoices RetainedwarrantyOnlyForSituationFinal=On situation invoices the global "retained warranty" deduction is applied only on the final situation From 26befa3b93f2f2fb51d03296f1e9ac7cbb64ce17 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Mon, 13 Apr 2020 15:38:50 +0200 Subject: [PATCH 10/62] New fields on usergroup object + card uses common tpl --- htdocs/user/class/usergroup.class.php | 10 ++ htdocs/user/group/card.php | 135 ++++++++++++-------------- 2 files changed, 70 insertions(+), 75 deletions(-) diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 1f8040a83ea..9c48c321196 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -100,6 +100,16 @@ class UserGroup extends CommonObject public $oldcopy; // To contains a clone of this when we need to save old properties of object + public $fields = array( + 'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), + 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5), + 'nom'=>array('type'=>'varchar(180)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Group name'), + 'note' => array('type'=>'html', 'label'=>'Description', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>-1,), + 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>50, 'notnull'=>1,), + 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>60, 'notnull'=>1,), + 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>0, 'position'=>100), + ); + /** * Constructor de la classe diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 335b66ebdd2..f3ae62beed8 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -54,6 +54,7 @@ $action = GETPOST('action', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'groupcard'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); $userid = GETPOST('user', 'int'); @@ -91,19 +92,20 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) { + + $backurlforlist = DOL_URL_ROOT.'/user/group/list.php'; + + if (empty($backtopage) || ($cancel && empty($id))) { + if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist; + else $backtopage = dol_buildpath('/user/group/card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); + } + } + if ($cancel) { - if (!empty($backtopage)) - { - header("Location: ".$backtopage); - exit; - } - else - { - header("Location: ".DOL_URL_ROOT.'/user/group/list.php'); - exit; - } - $action = ''; + header("Location: ".$backtopage); + exit; } // Action remove group @@ -215,7 +217,7 @@ if (empty($reshook)) { $object->oldcopy = clone $object; - $object->name = trim(GETPOST("group", 'nohtml')); + $object->name = trim(GETPOST("nom", 'nohtml')); $object->nom = $object->name; // For backward compatibility $object->note = dol_htmlcleanlastbr(trim(GETPOST("note", 'none'))); @@ -273,14 +275,11 @@ if ($action == 'create') print ''; print ''; print ''; + print ''; dol_fiche_head('', '', '', 0, ''); - print '
'; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index cb2bf087652..30f3867a843 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -297,9 +297,9 @@ class Facture extends CommonInvoice 'situation_cycle_ref' =>array('type'=>'smallint(6)', 'label'=>'Situation cycle ref', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION', 'visible'=>-1, 'position'=>230), 'situation_counter' =>array('type'=>'smallint(6)', 'label'=>'Situation counter', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION', 'visible'=>-1, 'position'=>235), 'situation_final' =>array('type'=>'smallint(6)', 'label'=>'Situation final', 'enabled'=>'empty($conf->global->INVOICE_USE_SITUATION) ? 0 : 1', 'visible'=>-1, 'position'=>240), - 'retained_warranty' =>array('type'=>'double', 'label'=>'Retained warranty', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>245), - 'retained_warranty_date_limit' =>array('type'=>'date', 'label'=>'Retained warranty date limit', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>250), - 'retained_warranty_fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Retained warranty fk cond reglement', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>255), + 'retained_warranty' =>array('type'=>'double', 'label'=>'Retained warranty', 'enabled'=>'$conf->global->INVOICE_USE_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>245), + 'retained_warranty_date_limit' =>array('type'=>'date', 'label'=>'Retained warranty date limit', 'enabled'=>'$conf->global->INVOICE_USE_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>250), + 'retained_warranty_fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Retained warranty fk cond reglement', 'enabled'=>'$conf->global->INVOICE_USE_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>255), 'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermsCode', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>260), 'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermsLocation', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>265), 'date_pointoftax' =>array('type'=>'date', 'label'=>'DatePointOfTax', 'enabled'=>'$conf->global->INVOICE_POINTOFTAX_DATE', 'visible'=>-1, 'position'=>270), @@ -4606,6 +4606,42 @@ class Facture extends CommonInvoice return $hasDelay; } + /** + * Currently used for documents generation : to know if retained warranty need to be displayed + * @return bool + */ + function displayRetainedWarranty(){ + global $conf; + + // TODO : add a flag on invoices to store this conf : USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL + + // note : we dont need to test USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION because if $this->retained_warranty is not empty it's because it was set when this conf was active + + $displayWarranty = false; + if(!empty($this->retained_warranty)) { + $displayWarranty = true; + + if ($this->type == Facture::TYPE_SITUATION && !empty($conf->global->USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL)) { + // Check if this situation invoice is 100% for real + $displayWarranty = false; + if (!empty($this->situation_final)) { + $displayWarranty = true; + } elseif (!empty($this->lines) && $this->status == Facture::STATUS_DRAFT) { + // $object->situation_final need validation to be done so this test is need for draft + $displayWarranty = true; + + foreach ($this->lines as $i => $line) { + if ($line->product_type < 2 && $line->situation_percent < 100) { + $displayWarranty = false; + break; + } + } + } + } + } + + return $displayWarranty; + } /** * @param int $rounding Minimum number of decimal to show. If 0, no change, if -1, we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT) @@ -4621,7 +4657,7 @@ class Facture extends CommonInvoice $retainedWarrantyAmount = 0; // Billed - retained warranty - if ($this->type == Facture::TYPE_SITUATION) + if($this->type == Facture::TYPE_SITUATION && !empty($conf->global->USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL)) { $displayWarranty = true; // Check if this situation invoice is 100% for real @@ -4659,7 +4695,10 @@ class Facture extends CommonInvoice if ($rounding < 0){ $rounding=min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); - return round($retainedWarrantyAmount, 2); + } + + if($rounding>0){ + return round($retainedWarrantyAmount, $rounding); } return $retainedWarrantyAmount; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index b32d82a08cb..dc685c0a893 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -188,7 +188,7 @@ $arrayfields = array( 'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), ); -if ($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY) +if ($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_RETAINED_WARRANTY) { $arrayfields['f.retained_warranty'] = array('label'=>$langs->trans("RetainedWarranty"), 'checked'=>0, 'position'=>86); } @@ -1002,7 +1002,7 @@ if ($resql) $facturestatic->date_lim_reglement = $db->jdate($obj->datelimite); $facturestatic->note_public = $obj->note_public; $facturestatic->note_private = $obj->note_private; - if ($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY) + if ($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_RETAINED_WARRANTY) { $facturestatic->retained_warranty = $obj->retained_warranty; $facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit; diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index a9d1230fdec..5ab59275666 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1663,51 +1663,32 @@ class pdf_sponge extends ModelePDFFactures // Retained warranty - if (!empty($object->situation_final) && ($object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty)))) + if ($object->displayRetainedWarranty()) { - $displayWarranty = false; + $pdf->SetTextColor(40, 40, 40); + $pdf->SetFillColor(255, 255, 255); - // Check if this situation invoice is 100% for real - if (!empty($object->situation_final)) { - $displayWarranty = true; - } - elseif (!empty($object->lines) && $object->status == Facture::STATUS_DRAFT) { - // $object->situation_final need validation to be done so this test is need for draft - $displayWarranty = true; - foreach ($object->lines as $i => $line) { - if ($line->product_type < 2 && $line->situation_percent < 100) { - $displayWarranty = false; - break; - } - } - } + $retainedWarranty = $object->getRetainedWarrantyAmount(); + $billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty; - if ($displayWarranty) { - $pdf->SetTextColor(40, 40, 40); - $pdf->SetFillColor(255, 255, 255); + // Billed - retained warranty + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFEVOLToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1); - $retainedWarranty = $total_a_payer_ttc * $object->retained_warranty / 100; - $billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty; + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1); - // Billed - retained warranty - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFEVOLToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1); + // retained warranty + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1); + $retainedWarrantyToPayOn = $outputlangs->transnoentities("PDFEVOLRetainedWarranty").' ('.$object->retained_warranty.'%)'; + $retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit) ? ' '.$outputlangs->transnoentities("PDFEVOLtoPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : ''; - // retained warranty - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - - $retainedWarrantyToPayOn = $outputlangs->transnoentities("PDFEVOLRetainedWarranty").' ('.$object->retained_warranty.'%)'; - $retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit) ? ' '.$outputlangs->transnoentities("PDFEVOLtoPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : ''; - - $pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1); - } + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1); } } } diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 447630e7eb2..bf641871be9 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -163,4 +163,6 @@ INSERT INTO llx_c_ticket_resolution (code, pos, label, active, use_default, desc INSERT INTO llx_c_ticket_resolution (code, pos, label, active, use_default, description) VALUES('CANCELED', '50', 'Canceled', 1, 0, NULL); INSERT INTO llx_c_ticket_resolution (code, pos, label, active, use_default, description) VALUES('OTHER', '90', 'Other', 1, 0, NULL); -DELETE FROM llx_const WHERE name = __ENCRYPT('DONATION_ART885')__; \ No newline at end of file +DELETE FROM llx_const WHERE name = __ENCRYPT('DONATION_ART885')__; + +UPDATE llx_const SET name = 'INVOICE_USE_RETAINED_WARRANTY' WHERE name = 'INVOICE_USE_SITUATION_RETAINED_WARRANTY' diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 6d7c61784f7..fe33c173cea 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -220,6 +220,8 @@ UseSituationInvoices=Allow situation invoice UseSituationInvoicesCreditNote=Allow situation invoice credit note Retainedwarranty=Retained warranty RetainedwarrantyDefaultPercent=Retained warranty default percent +RetainedwarrantyOnlyForSituation=Make "retained warranty" available only for situation invoices +RetainedwarrantyOnlyForSituationFinal=On situation invoices the global "retained warranty" deduction is applied only on the final situation ToPayOn=To pay on %s toPayOn=to pay on %s RetainedWarranty=Retained Warranty From 028566616d5f4210383afa249ad338f8e0586a25 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 19 Feb 2020 11:07:42 +0000 Subject: [PATCH 02/62] Fixing style errors. --- htdocs/admin/facture_situation.php | 6 +++--- htdocs/compta/facture/card.php | 1 - htdocs/compta/facture/class/facture.class.php | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/facture_situation.php b/htdocs/admin/facture_situation.php index aced29bc125..0a4c36cb8a8 100644 --- a/htdocs/admin/facture_situation.php +++ b/htdocs/admin/facture_situation.php @@ -96,9 +96,9 @@ print "
'.$langs->trans('RetainedWarranty').''; print '%'; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 7860ee93f0a..0b1915a6fc9 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3724,10 +3724,10 @@ class Facture extends CommonInvoice $moduleSourceName = 'Invoice'; $addonConstName = 'FACTURE_ADDON'; - // Clean parameters (if not defined or using deprecated value) - if (empty($conf->global->FACTURE_ADDON)) $conf->global->FACTURE_ADDON = 'mod_facture_terre'; - elseif ($conf->global->FACTURE_ADDON == 'terre') $conf->global->FACTURE_ADDON = 'mod_facture_terre'; - elseif ($conf->global->FACTURE_ADDON == 'mercure') $conf->global->FACTURE_ADDON = 'mod_facture_mercure'; + // Clean parameters (if not defined or using deprecated value) + if (empty($conf->global->FACTURE_ADDON)) $conf->global->FACTURE_ADDON = 'mod_facture_terre'; + elseif ($conf->global->FACTURE_ADDON == 'terre') $conf->global->FACTURE_ADDON = 'mod_facture_terre'; + elseif ($conf->global->FACTURE_ADDON == 'mercure') $conf->global->FACTURE_ADDON = 'mod_facture_mercure'; $addon = $conf->global->FACTURE_ADDON; } From 79fe66436525005b90c75975dcadb04692507775 Mon Sep 17 00:00:00 2001 From: ATM john Date: Tue, 31 Mar 2020 16:43:38 +0200 Subject: [PATCH 08/62] fix merge not applied --- htdocs/compta/facture/card.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 8dec5123623..62a84a51245 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -141,9 +141,9 @@ $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isd // retained warranty invoice available type if(empty($conf->global->USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION)) { - $RetainedWarrantyInvoiceAvailableType = array( Facture::TYPE_SITUATION, Facture::TYPE_STANDARD); + $retainedWarrantyInvoiceAvailableType = array( Facture::TYPE_SITUATION, Facture::TYPE_STANDARD); } else { - $RetainedWarrantyInvoiceAvailableType = array( Facture::TYPE_SITUATION ); + $retainedWarrantyInvoiceAvailableType = array( Facture::TYPE_SITUATION ); } @@ -3359,7 +3359,7 @@ if ($action == 'create') if($conf->global->INVOICE_USE_RETAINED_WARRANTY){ $rwStyle = 'display:none;'; - if(in_array(GETPOST('type', 'int'), $RetainedWarrantyInvoiceAvailableType)){ + if(in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)){ $rwStyle = ''; } @@ -3393,7 +3393,7 @@ if ($action == 'create') $(document).ready(function() { $("[name=\'type\']").change(function() { - if($( this ).prop("checked") && $.inArray(parseInt($( this ).val()), '.json_encode($RetainedWarrantyInvoiceAvailableType).' ) !== -1) + if($( this ).prop("checked") && $.inArray(parseInt($( this ).val()), '.json_encode($retainedWarrantyInvoiceAvailableType).' ) !== -1) { $(".retained-warranty-line").show(); } @@ -4308,7 +4308,7 @@ elseif ($id > 0 || !empty($ref)) if(!empty($object->retained_warranty) || !empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) { $displayWarranty = true; - if(!in_array($object->type, $RetainedWarrantyInvoiceAvailableType) && empty($object->retained_warranty)){ + if(!in_array($object->type, $retainedWarrantyInvoiceAvailableType) && empty($object->retained_warranty)){ $displayWarranty = false; } @@ -4983,7 +4983,7 @@ elseif ($id > 0 || !empty($ref)) } print '
- + @@ -5179,7 +5179,7 @@ elseif ($id > 0 || !empty($ref)) } // Classify paid - if (($object->statut == 1 && $object->paye == 0 && $usercanissuepayment && (($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && $resteapayer <= 0) || ($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0))) + if (($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercanissuepayment && (($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && $resteapayer <= 0) || ($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0))) || ($object->type == Facture::TYPE_DEPOSIT && $object->paye == 0 && $object->total_ttc > 0 && $resteapayer == 0 && $usercanissuepayment && empty($discount->id)) ) { From 81adc6913e2eec36643b455ff390dbed3a3f0cff Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 1 Apr 2020 12:12:30 +0200 Subject: [PATCH 09/62] change conf usage --- htdocs/admin/facture_situation.php | 31 ++++++++++++++++--- htdocs/compta/facture/card.php | 7 ++--- htdocs/compta/facture/class/facture.class.php | 8 ++--- htdocs/langs/en_US/bills.lang | 1 + 4 files changed, 34 insertions(+), 13 deletions(-) diff --git a/htdocs/admin/facture_situation.php b/htdocs/admin/facture_situation.php index 0a4c36cb8a8..65f7ca4b8de 100644 --- a/htdocs/admin/facture_situation.php +++ b/htdocs/admin/facture_situation.php @@ -96,9 +96,26 @@ print "
'; - - print ""; - print ''; - print ''; + print '
'.$langs->trans("Name").'
'; // Multicompany if (!empty($conf->multicompany->enabled) && is_object($mc)) @@ -297,27 +296,18 @@ if ($action == 'create') } } - print "".'\n"; + // Common attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; // Other attributes - $parameters = array('object' => $object); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (empty($reshook)) - { - print $object->showOptionals($extrafields, 'edit'); - } + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; - print "
'.$langs->trans("Description").''; - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('note', '', '', 240, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_8, '90%'); - $doleditor->Create(); - print "
\n"; + print "\n"; dol_fiche_end(); print '
'; - print ''; + print ''; print '   '; print ''; print '
'; @@ -359,6 +349,7 @@ else dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin); print '
'; + print '
'; print '
'; print ''; @@ -384,19 +375,18 @@ else print "\n"; } - // Note - print ''; - print ''; - print "\n"; + // Common attributes + $keyforbreak = ''; + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; // Other attributes - $parameters = array('colspan' => ' colspan="2"'); include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - print "
'.$langs->trans("Description").''; - print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note)); - print '
\n"; - print '
'; + print ''; + print '
'; + print ''; + + print '
'; dol_fiche_end(); @@ -407,6 +397,10 @@ else print '
'; + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if ($caneditperms) { print ''.$langs->trans("Modify").''; @@ -421,7 +415,7 @@ else // List users in group - print load_fiche_titre($langs->trans("ListOfUsersInGroup"), '', ''); + print load_fiche_titre($langs->trans("ListOfUsersInGroup"), '', 'user'); // On selectionne les users qui ne sont pas deja dans le groupe $exclude = array(); @@ -485,7 +479,7 @@ else print ''; print ''.$useringroup->lastname.''; print ''.$useringroup->firstname.''; - print ''.$useringroup->getLibStatut(3).''; + print ''.$useringroup->getLibStatut(5).''; print ''; if (!empty($user->admin)) { print ''; @@ -542,53 +536,44 @@ else if ($action == 'edit' && $caneditperms) { - print ''; + print ''; print ''; print ''; + print ''; + print ''; dol_fiche_head($head, 'group', $title, 0, 'group'); - print ''; - print ''; - print '\n"; + print '
'.$langs->trans("Name").''; - print "
'."\n"; - // Multicompany - if (!empty($conf->multicompany->enabled) && is_object($mc)) - { - if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) - { - print "".''; - print "\n"; - } - else - { + // Multicompany + if (!empty($conf->multicompany->enabled) && is_object($mc)) + { + if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) + { + print "".''; + print "\n"; + } + else + { print ''; } - } + } + + // Common attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; - print ''; - print ''; - print "\n"; // Other attributes - $parameters = array(); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (empty($reshook)) - { - print $object->showOptionals($extrafields, 'edit'); - } + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; - print "
'.$langs->trans("Entity").'".$mc->select_entities($object->entity); - print "
'.$langs->trans("Entity").'".$mc->select_entities($object->entity); + print "
'.$langs->trans("Description").''; - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('note', $object->note, '', 240, 'dolibarr_notes', '', true, false, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_8, '90%'); - $doleditor->Create(); - print '
\n"; + print ''; dol_fiche_end(); - print '
'; + print '
'; + print '   '; + print '
'; print ''; } From 2e004e93ea2161b53260d67abab8a8c7452140c4 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Mon, 13 Apr 2020 19:02:19 +0200 Subject: [PATCH 11/62] Commonobject : delete extrafields + syslog --- htdocs/core/class/commonobject.class.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4b94f87c65f..dcbb25775e7 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7876,6 +7876,7 @@ abstract class CommonObject public function createCommon(User $user, $notrigger = false) { global $langs; + dol_syslog(get_class($this)."::createCommon create", LOG_DEBUG); $error = 0; @@ -8114,6 +8115,7 @@ abstract class CommonObject public function updateCommon(User $user, $notrigger = false) { global $conf, $langs; + dol_syslog(get_class($this)."::updateCommon update", LOG_DEBUG); $error = 0; @@ -8203,6 +8205,8 @@ abstract class CommonObject */ public function deleteCommon(User $user, $notrigger = false, $forcechilddeletion = 0) { + dol_syslog(get_class($this)."::deleteCommon delete", LOG_DEBUG); + $error = 0; $this->db->begin(); @@ -8260,17 +8264,10 @@ abstract class CommonObject } } - if (!$error && !empty($this->isextrafieldmanaged)) + if (!$error) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields"; - $sql .= " WHERE fk_object=".$this->id; - - $resql = $this->db->query($sql); - if (!$resql) - { - $this->errors[] = $this->db->lasterror(); - $error++; - } + $result = $this->deleteExtraFields(); + if ($result < 0) { $error++; } } if (!$error) From b8a0b4b6e4b86e6576fb7b3bbc4e3d2ffa4e9967 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Mon, 13 Apr 2020 19:03:48 +0200 Subject: [PATCH 12/62] New class UserGroup works with common functions now --- htdocs/user/class/usergroup.class.php | 212 ++++---------------------- htdocs/user/group/card.php | 14 +- 2 files changed, 37 insertions(+), 189 deletions(-) diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 9c48c321196..269089c73f2 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -110,6 +110,21 @@ class UserGroup extends CommonObject 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>0, 'position'=>100), ); + /** + * @var int Field with ID of parent key if this field has a parent + */ + public $fk_element = 'fk_usergroup'; + + /** + * @var array List of child tables. To test if we can delete object. + */ + protected $childtables=array(); + + /** + * @var array List of child tables. To know object to delete on cascade. + */ + protected $childtablesoncascade = array('usergroup_rights','usergroup_user'); + /** * Constructor de la classe @@ -135,47 +150,23 @@ class UserGroup extends CommonObject { global $conf; - $sql = "SELECT g.rowid, g.entity, g.nom as name, g.note, g.datec, g.tms as datem"; - $sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g"; - if ($groupname) + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); + if (!empty($groupname)) { - $sql .= " WHERE g.nom = '".$this->db->escape($groupname)."'"; + $result = $this->fetchCommon(0, '', ' AND nom = \''.$this->db->escape($groupname).'\''); } else { - $sql .= " WHERE g.rowid = ".$id; + $result = $this->fetchCommon($id); } - dol_syslog(get_class($this)."::fetch", LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) + if($result) { - if ($this->db->num_rows($result)) + if ($load_members) { - $obj = $this->db->fetch_object($result); - - $this->id = $obj->rowid; - $this->ref = $obj->rowid; - $this->entity = $obj->entity; - $this->name = $obj->name; - $this->nom = $obj->name; // Deprecated - $this->note = $obj->note; - $this->datec = $obj->datec; - $this->datem = $obj->datem; - - if ($load_members) - $this->members = $this->listUsersForGroup(); - - - // Retreive all extrafield - // fetch optionals attributes and labels - $this->fetch_optionals(); - - - // Sav current LDAP Current DN - //$this->ldap_dn = $this->_load_ldap_dn($this->_load_ldap_info(),0); + $this->members = $this->listUsersForGroup(); } - $this->db->free($result); + return 1; } else @@ -647,50 +638,7 @@ class UserGroup extends CommonObject */ public function delete(User $user) { - global $conf, $langs; - - $error = 0; - - $this->db->begin(); - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_rights"; - $sql .= " WHERE fk_usergroup = ".$this->id; - $this->db->query($sql); - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_user"; - $sql .= " WHERE fk_usergroup = ".$this->id; - $this->db->query($sql); - - // Remove extrafields - if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used - { - $result = $this->deleteExtraFields(); - if ($result < 0) - { - $error++; - dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); - } - } - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup"; - $sql .= " WHERE rowid = ".$this->id; - $result = $this->db->query($sql); - if ($result) - { - // Call trigger - $result = $this->call_trigger('GROUP_DELETE', $user); - if ($result < 0) { $error++; $this->db->rollback(); return -1; } - // End call triggers - - $this->db->commit(); - return 1; - } - else - { - $this->db->rollback(); - dol_print_error($this->db); - return -1; - } + return $this->deleteCommon($user); } /** @@ -701,67 +649,15 @@ class UserGroup extends CommonObject */ public function create($notrigger = 0) { - global $user, $conf, $langs, $hookmanager; + global $user, $conf; - $error = 0; - $now = dol_now(); + $this->datec = dol_now(); if (!isset($this->entity)) $this->entity = $conf->entity; // If not defined, we use default value - $entity = $this->entity; if (!empty($conf->multicompany->enabled) && $conf->entity == 1) $entity = $this->entity; - $this->db->begin(); - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."usergroup ("; - $sql .= "datec"; - $sql .= ", nom"; - $sql .= ", entity"; - $sql .= ") VALUES ("; - $sql .= "'".$this->db->idate($now)."'"; - $sql .= ",'".$this->db->escape($this->nom)."'"; - $sql .= ",".$this->db->escape($entity); - $sql .= ")"; - - dol_syslog(get_class($this)."::create", LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) - { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."usergroup"); - - if ($this->update(1) < 0) return -2; - - $action = 'create'; - - // Actions on extra fields (by external module or standard code) - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used - { - $result = $this->insertExtraFields(); - if ($result < 0) - { - $error++; - } - } - - if (!$error && !$notrigger) - { - // Call trigger - $result = $this->call_trigger('GROUP_CREATE', $user); - if ($result < 0) { $error++; $this->db->rollback(); return -1; } - // End call triggers - } - - if ($error > 0) { $error++; $this->db->rollback(); return -1; } - else $this->db->commit(); - - return $this->id; - } - else - { - $this->db->rollback(); - $this->error = $this->db->lasterror(); - return -1; - } + return $this->createCommon($user, $notrigger); } /** @@ -772,9 +668,7 @@ class UserGroup extends CommonObject */ public function update($notrigger = 0) { - global $user, $conf, $langs, $hookmanager; - - $error = 0; + global $user, $conf; $entity = $conf->entity; if (!empty($conf->multicompany->enabled) && $conf->entity == 1) @@ -782,55 +676,7 @@ class UserGroup extends CommonObject $entity = $this->entity; } - $this->db->begin(); - - $sql = "UPDATE ".MAIN_DB_PREFIX."usergroup SET "; - $sql .= " nom = '".$this->db->escape($this->name)."'"; - $sql .= ", entity = ".$this->db->escape($entity); - $sql .= ", note = '".$this->db->escape($this->note)."'"; - $sql .= " WHERE rowid = ".$this->id; - - dol_syslog(get_class($this)."::update", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) - { - $action = 'update'; - - // Actions on extra fields (by external module or standard code) - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used - { - $result = $this->insertExtraFields(); - if ($result < 0) - { - $error++; - } - } - - if (!$error && !$notrigger) - { - // Call trigger - $result = $this->call_trigger('GROUP_MODIFY', $user); - if ($result < 0) { $error++; } - // End call triggers - } - - if (!$error) - { - $this->db->commit(); - return 1; - } - else - { - $this->db->rollback(); - return -$error; - } - } - else - { - $this->db->rollback(); - dol_print_error($this->db); - return -1; - } + return $this->updateCommon($user, $notrigger); } diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index f3ae62beed8..7285c9ad5f3 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -68,16 +68,14 @@ if (!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global-> } $object = new Usergroup($db); -if ($id > 0) -{ - $object->fetch($id); - $object->getrights(); -} - $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. +$object->getrights(); + // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('groupcard', 'globalcard')); @@ -325,6 +323,8 @@ else { if ($id) { + $res = $object->fetch_optionals(); + $head = group_prepare_head($object); $title = $langs->trans("Group"); @@ -375,6 +375,8 @@ else print "\n"; } + unset($object->fields['nom']); // Name already displayed in banner + // Common attributes $keyforbreak = ''; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; From 261e6cbc52197460849377a51105a6916d42ac36 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Mon, 13 Apr 2020 19:08:03 +0200 Subject: [PATCH 13/62] Fix delete extrafield test --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index dcbb25775e7..41a7107b8d9 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8264,7 +8264,7 @@ abstract class CommonObject } } - if (!$error) + if (!$error && !empty($this->isextrafieldmanaged)) { $result = $this->deleteExtraFields(); if ($result < 0) { $error++; } From 92b6b6e1f56c2e5cdc95b7b02b868360ee2f76c3 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 13 Apr 2020 17:16:14 +0000 Subject: [PATCH 14/62] Fixing style errors. --- htdocs/user/group/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 7285c9ad5f3..25a0db9d633 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -90,7 +90,6 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) { - $backurlforlist = DOL_URL_ROOT.'/user/group/list.php'; if (empty($backtopage) || ($cancel && empty($id))) { From f4c346cdbbc45c123d4b05145001a9e2abf6c0ef Mon Sep 17 00:00:00 2001 From: oscim Date: Tue, 14 Apr 2020 07:48:34 +0200 Subject: [PATCH 15/62] Update llx_commandedet.key.sql add external key --- htdocs/install/mysql/tables/llx_commandedet.key.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/install/mysql/tables/llx_commandedet.key.sql b/htdocs/install/mysql/tables/llx_commandedet.key.sql index bba65d62aa0..849ff70a5e9 100644 --- a/htdocs/install/mysql/tables/llx_commandedet.key.sql +++ b/htdocs/install/mysql/tables/llx_commandedet.key.sql @@ -25,3 +25,8 @@ ALTER TABLE llx_commandedet ADD INDEX idx_commandedet_fk_product (fk_product); ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_unit FOREIGN KEY (fk_unit) REFERENCES llx_c_units (rowid); ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_commande FOREIGN KEY (fk_commande) REFERENCES llx_commande (rowid); +ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_commandefourndet FOREIGN KEY (fk_commandefourndet) REFERENCES llx_commande_fournisseurdet (rowid); +ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_multicurrency FOREIGN KEY (fk_multicurrency) REFERENCES llx_multicurrency (rowid); +ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_product_fournisseur_price FOREIGN KEY (fk_product_fournisseur_price) REFERENCES llx_product_fournisseur_price (rowid); +ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_remise_except FOREIGN KEY (fk_remise_except) REFERENCES llx_societe_remise_except (rowid); + From cbf6afb4a0540653215b91fa60220e782f198324 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 14 Apr 2020 12:13:38 +0000 Subject: [PATCH 16/62] Fixing style errors. --- htdocs/compta/facture/card.php | 36 +++++++++++++++++----------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 95d2010a4f6..6865edcecfd 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3389,18 +3389,18 @@ if ($action == 'create') if($conf->global->INVOICE_USE_RETAINED_WARRANTY){ $rwStyle = 'display:none;'; - if(in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)){ - $rwStyle = ''; - } + if(in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)){ + $rwStyle = ''; + } $retained_warranty = GETPOST('retained_warranty', 'int'); - if(empty($retained_warranty)){ - if(!empty($objectsrc->retained_warranty)){ // use previous situation value - $retained_warranty = $objectsrc->retained_warranty; - }else{ - $retained_warranty = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT; - } - } + if(empty($retained_warranty)){ + if(!empty($objectsrc->retained_warranty)){ // use previous situation value + $retained_warranty = $objectsrc->retained_warranty; + }else{ + $retained_warranty = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT; + } + } print ''.$langs->trans('RetainedWarranty').''; print '%'; @@ -3408,14 +3408,14 @@ if ($action == 'create') // Retained warranty payment term print ''.$langs->trans('PaymentConditionsShortRetainedWarranty').''; $retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); - if(empty($retained_warranty_fk_cond_reglement)){ - $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; - if(!empty($objectsrc->retained_warranty_fk_cond_reglement)){ // use previous situation value - $retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement; - }else{ - $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; - } - } + if(empty($retained_warranty_fk_cond_reglement)){ + $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; + if(!empty($objectsrc->retained_warranty_fk_cond_reglement)){ // use previous situation value + $retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement; + }else{ + $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; + } + } $form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1); print ''; From 7fea2bc557e84f26e54964d01aa4e46bb624da35 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 15 Apr 2020 08:44:29 +0200 Subject: [PATCH 17/62] Update changelog + trigger name change for class UserGroup --- ChangeLog | 2 +- htdocs/core/class/events.class.php | 6 +++--- htdocs/core/triggers/interface_20_all_Logevents.class.php | 6 +++--- .../triggers/interface_50_modLdap_Ldapsynchro.class.php | 6 +++--- .../interface_99_modZapier_ZapierTriggers.class.php | 6 +++--- .../interface_99_modMyModule_MyModuleTriggers.class.php | 6 +++--- htdocs/user/class/usergroup.class.php | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0de59b03184..68cd7695057 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,7 +13,7 @@ For Developers or integrators: - replace $page = GETPOST('page', 'int') with $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); - remove input field in form '';' - add parameter $pagenavastextinput to value 1 when calling print_barre_liste - +* UserGroup class has been refactored with new architecture. Triggers of class UserGroup are now USERGROUP_CREATE, USERGROUP_MODIFY, USERGROUP_DELETE WARNING: diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index c32fe1d77f2..9c2e5b145dd 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -100,9 +100,9 @@ class Events // extends CommonObject array('id'=>'USER_NEW_PASSWORD', 'test'=>1), array('id'=>'USER_ENABLEDISABLE', 'test'=>1), array('id'=>'USER_DELETE', 'test'=>1), - array('id'=>'GROUP_CREATE', 'test'=>1), - array('id'=>'GROUP_MODIFY', 'test'=>1), - array('id'=>'GROUP_DELETE', 'test'=>1), + array('id'=>'USERGROUP_CREATE', 'test'=>1), + array('id'=>'USERGROUP_MODIFY', 'test'=>1), + array('id'=>'USERGROUP_DELETE', 'test'=>1), ); diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php index 7acd977e714..fceb1552f0b 100644 --- a/htdocs/core/triggers/interface_20_all_Logevents.class.php +++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php @@ -151,7 +151,7 @@ class InterfaceLogevents extends DolibarrTriggers } // Groupes - elseif ($action == 'GROUP_CREATE') + elseif ($action == 'USERGROUP_CREATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); @@ -159,7 +159,7 @@ class InterfaceLogevents extends DolibarrTriggers $text = $langs->transnoentities("NewGroupCreated", $object->name); $desc = $langs->transnoentities("NewGroupCreated", $object->name); } - elseif ($action == 'GROUP_MODIFY') + elseif ($action == 'USERGROUP_MODIFY') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); @@ -167,7 +167,7 @@ class InterfaceLogevents extends DolibarrTriggers $text = $langs->transnoentities("GroupModified", $object->name); $desc = $langs->transnoentities("GroupModified", $object->name); } - elseif ($action == 'GROUP_DELETE') + elseif ($action == 'USERGROUP_DELETE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php index 2febdacff91..8b8c392615a 100644 --- a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php @@ -269,7 +269,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers } // Groupes - elseif ($action == 'GROUP_CREATE') + elseif ($action == 'USERGROUP_CREATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') @@ -293,7 +293,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; } } - elseif ($action == 'GROUP_MODIFY') + elseif ($action == 'USERGROUP_MODIFY') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') @@ -330,7 +330,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; } } - elseif ($action == 'GROUP_DELETE') + elseif ($action == 'USERGROUP_DELETE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') diff --git a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php index dc9ca6448a9..1091b5ee198 100644 --- a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php +++ b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php @@ -147,9 +147,9 @@ class InterfaceZapierTriggers extends DolibarrTriggers break; // Groups - //case 'GROUP_CREATE': - //case 'GROUP_MODIFY': - //case 'GROUP_DELETE': + //case 'USERGROUP_CREATE': + //case 'USERGROUP_MODIFY': + //case 'USERGROUP_DELETE': // Companies case 'COMPANY_CREATE': diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php index e0dd34cf180..dcee9eeaea5 100644 --- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php +++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php @@ -118,9 +118,9 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'ACTION_DELETE': // Groups - //case 'GROUP_CREATE': - //case 'GROUP_MODIFY': - //case 'GROUP_DELETE': + //case 'USERGROUP_CREATE': + //case 'USERGROUP_MODIFY': + //case 'USERGROUP_DELETE': // Companies //case 'COMPANY_CREATE': diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 269089c73f2..aaa631fdf36 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -404,7 +404,7 @@ class UserGroup extends CommonObject $this->context = array('audit'=>$langs->trans("PermissionsAdd").($rid ? ' (id='.$rid.')' : '')); // Call trigger - $result = $this->call_trigger('GROUP_MODIFY', $user); + $result = $this->call_trigger('USERGROUP_MODIFY', $user); if ($result < 0) { $error++; } // End call triggers } @@ -528,7 +528,7 @@ class UserGroup extends CommonObject $this->context = array('audit'=>$langs->trans("PermissionsDelete").($rid ? ' (id='.$rid.')' : '')); // Call trigger - $result = $this->call_trigger('GROUP_MODIFY', $user); + $result = $this->call_trigger('USERGROUP_MODIFY', $user); if ($result < 0) { $error++; } // End call triggers } From 9a1993f71c0ede76e9975540d93f86242c094998 Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 15 Apr 2020 10:44:07 +0200 Subject: [PATCH 18/62] Fix retained warranty default value --- htdocs/compta/facture/card.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 95d2010a4f6..170daad50f9 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3397,12 +3397,11 @@ if ($action == 'create') if(empty($retained_warranty)){ if(!empty($objectsrc->retained_warranty)){ // use previous situation value $retained_warranty = $objectsrc->retained_warranty; - }else{ - $retained_warranty = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT; } } + $retained_warranty_js_default = !empty($retained_warranty)?$retained_warranty:$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT; - print ''.$langs->trans('RetainedWarranty').''; + print ''.$langs->trans('RetainedWarranty').''; print '%'; // Retained warranty payment term @@ -3421,16 +3420,19 @@ if ($action == 'create') print ''; } From e6b29aa0f0a4cb64c6102922c98f714134a68d0f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 15 Apr 2020 08:48:45 +0000 Subject: [PATCH 19/62] Fixing style errors. --- htdocs/compta/facture/card.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 96bc813e45d..d670bed146a 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3389,16 +3389,16 @@ if ($action == 'create') if($conf->global->INVOICE_USE_RETAINED_WARRANTY){ $rwStyle = 'display:none;'; - if(in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)){ - $rwStyle = ''; - } + if(in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)){ + $rwStyle = ''; + } $retained_warranty = GETPOST('retained_warranty', 'int'); - if(empty($retained_warranty)){ - if(!empty($objectsrc->retained_warranty)){ // use previous situation value - $retained_warranty = $objectsrc->retained_warranty; - } - } + if(empty($retained_warranty)){ + if(!empty($objectsrc->retained_warranty)){ // use previous situation value + $retained_warranty = $objectsrc->retained_warranty; + } + } $retained_warranty_js_default = !empty($retained_warranty)?$retained_warranty:$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT; print ''.$langs->trans('RetainedWarranty').''; @@ -3407,14 +3407,14 @@ if ($action == 'create') // Retained warranty payment term print ''.$langs->trans('PaymentConditionsShortRetainedWarranty').''; $retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); - if(empty($retained_warranty_fk_cond_reglement)){ - $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; - if(!empty($objectsrc->retained_warranty_fk_cond_reglement)){ // use previous situation value - $retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement; - }else{ - $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; - } - } + if(empty($retained_warranty_fk_cond_reglement)){ + $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; + if(!empty($objectsrc->retained_warranty_fk_cond_reglement)){ // use previous situation value + $retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement; + }else{ + $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; + } + } $form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1); print ''; From 4b4f69c76a4293e55220f43019af5804d684a202 Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 15 Apr 2020 10:52:28 +0200 Subject: [PATCH 20/62] fix indentation --- htdocs/compta/facture/card.php | 52 +++++++++++++++++----------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d670bed146a..d96cd61a308 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3388,25 +3388,25 @@ if ($action == 'create') if($conf->global->INVOICE_USE_RETAINED_WARRANTY){ - $rwStyle = 'display:none;'; + $rwStyle = 'display:none;'; if(in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)){ $rwStyle = ''; } - $retained_warranty = GETPOST('retained_warranty', 'int'); + $retained_warranty = GETPOST('retained_warranty', 'int'); if(empty($retained_warranty)){ if(!empty($objectsrc->retained_warranty)){ // use previous situation value $retained_warranty = $objectsrc->retained_warranty; } } - $retained_warranty_js_default = !empty($retained_warranty)?$retained_warranty:$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT; + $retained_warranty_js_default = !empty($retained_warranty)?$retained_warranty:$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT; - print ''.$langs->trans('RetainedWarranty').''; - print '%'; + print ''.$langs->trans('RetainedWarranty').''; + print '%'; - // Retained warranty payment term - print ''.$langs->trans('PaymentConditionsShortRetainedWarranty').''; - $retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); + // Retained warranty payment term + print ''.$langs->trans('PaymentConditionsShortRetainedWarranty').''; + $retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); if(empty($retained_warranty_fk_cond_reglement)){ $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; if(!empty($objectsrc->retained_warranty_fk_cond_reglement)){ // use previous situation value @@ -3415,26 +3415,26 @@ if ($action == 'create') $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; } } - $form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1); - print ''; + $form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1); + print ''; - print ''; + $("[name=\'type\']").trigger("change"); + }); + '; } // Payment mode From e6669348e1e295e833c8d9faf877a6025b544e26 Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 15 Apr 2020 11:09:34 +0200 Subject: [PATCH 21/62] Fix dom manipulation on creation --- htdocs/compta/facture/card.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d96cd61a308..5e280535c27 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1362,8 +1362,14 @@ if (empty($reshook)) $object->situation_cycle_ref = $object->newCycle(); } - $object->retained_warranty = GETPOST('retained_warranty', 'int'); - $object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); + if(in_array($object->type, $retainedWarrantyInvoiceAvailableType)){ + $object->retained_warranty = GETPOST('retained_warranty', 'int'); + $object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); + } + else{ + $object->retained_warranty = 0; + $object->retained_warranty_fk_cond_reglement = 0; + } $retained_warranty_date_limit = GETPOST('retained_warranty_date_limit'); if (!empty($retained_warranty_date_limit) && $db->jdate($retained_warranty_date_limit)) { From 3b4b30ea576413f81454ba676845fd54228fdc72 Mon Sep 17 00:00:00 2001 From: ATM john Date: Thu, 16 Apr 2020 20:33:53 +0200 Subject: [PATCH 22/62] Fix merge remaining lines --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 1a5b5d47a23..6fad6fc4665 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1338,7 +1338,6 @@ class pdf_sponge extends ModelePDFFactures $total_a_payer_ttc = 0; } - $deja_paye = 0; $i = 1; if (!empty($TPreviousIncoice)) { $pdf->setY($tab2_top); @@ -1370,7 +1369,6 @@ class pdf_sponge extends ModelePDFFactures $pdf->MultiCell($largcol2, $tab2_hl, $displayAmount, 0, 'R', 1); $i++; - $deja_paye += $fac->total_ht; $posy += $tab2_hl; $pdf->setY($posy); From 162cd94138629b1ca2af02e0e26327bf0f2af5bd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 17 Apr 2020 12:32:05 +0200 Subject: [PATCH 23/62] FIX Keep sort order after deletion of a file into file manager. --- htdocs/core/actions_linkedfiles.inc.php | 5 +++-- htdocs/core/ajax/ajaxdirpreview.php | 10 ++++++---- htdocs/core/class/html.form.class.php | 4 ++-- htdocs/website/index.php | 2 ++ 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 7090b71c773..f8ac8ab0be0 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -145,12 +145,13 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') if (is_object($object) && $object->id > 0) { if ($backtopage) { - header('Location: '.$backtopage); + header('Location: '.$backtopage); exit; } else { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(GETPOST('section_dir', 'alpha') ? '§ion_dir='.urlencode(GETPOST('section_dir', 'alpha')) : '').(!empty($withproject) ? '&withproject=1' : '')); + $tmpurl = $_SERVER["PHP_SELF"].'?id='.$object->id.(GETPOST('section_dir', 'alpha') ? '§ion_dir='.urlencode(GETPOST('section_dir', 'alpha')) : '').(!empty($withproject) ? '&withproject=1' : ''); + header('Location: '.$tmpurl); exit; } } diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index a9a7df300c3..31d0b449d5b 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -356,10 +356,12 @@ if ($useajax || $action == 'delete') require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; $useglobalvars = 1; $form = new Form($db); - $formquestion['urlfile'] = array('type'=>'hidden', 'value'=>$urlfile, 'name'=>'urlfile'); // We must always put field, even if empty because it is fille by javascript later - $formquestion['section'] = array('type'=>'hidden', 'value'=>$section, 'name'=>'section'); // We must always put field, even if empty because it is fille by javascript later - $formquestion['section_id'] = array('type'=>'hidden', 'value'=>$section_id, 'name'=>'section_id'); // We must always put field, even if empty because it is fille by javascript later - $formquestion['section_dir'] = array('type'=>'hidden', 'value'=>$section_dir, 'name'=>'section_dir'); // We must always put field, even if empty because it is fille by javascript later + $formquestion['urlfile'] = array('type'=>'hidden', 'value'=>$urlfile, 'name'=>'urlfile'); // We must always put field, even if empty because it is filled by javascript later + $formquestion['section'] = array('type'=>'hidden', 'value'=>$section, 'name'=>'section'); // We must always put field, even if empty because it is filled by javascript later + $formquestion['section_id'] = array('type'=>'hidden', 'value'=>$section_id, 'name'=>'section_id'); // We must always put field, even if empty because it is filled by javascript later + $formquestion['section_dir'] = array('type'=>'hidden', 'value'=>$section_dir, 'name'=>'section_dir'); // We must always put field, even if empty because it is filled by javascript later + $formquestion['sortfield'] = array('type'=>'hidden', 'value'=>$sortfield, 'name'=>'sortfield'); // We must always put field, even if empty because it is filled by javascript later + $formquestion['sortorder'] = array('type'=>'hidden', 'value'=>$sortorder, 'name'=>'sortorder'); // We must always put field, even if empty because it is filled by javascript later if (!empty($action) && $action == 'file_manager') $formquestion['file_manager'] = array('type'=>'hidden', 'value'=>1, 'name'=>'file_manager'); if (!empty($websitekey)) $formquestion['website'] = array('type'=>'hidden', 'value'=>$websitekey, 'name'=>'website'); if (!empty($pageid) && $pageid > 0) $formquestion['pageid'] = array('type'=>'hidden', 'value'=>$pageid, 'name'=>'pageid'); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c543fd436a2..914106ac49a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4386,7 +4386,7 @@ class Form buttons: { "'.dol_escape_js($langs->transnoentities("Yes")).'": function() { var options = "&token='.urlencode(newToken()).'"; - var inputok = '.json_encode($inputok).'; + var inputok = '.json_encode($inputok).'; /* List of fields into form */ var pageyes = "'.dol_escape_js(!empty($pageyes) ? $pageyes : '').'"; if (inputok.length>0) { $.each(inputok, function(i, inputname) { @@ -4405,7 +4405,7 @@ class Form }, "'.dol_escape_js($langs->transnoentities("No")).'": function() { var options = "&token='.urlencode(newToken()).'"; - var inputko = '.json_encode($inputko).'; + var inputko = '.json_encode($inputko).'; /* List of fields into form */ var pageno="'.dol_escape_js(!empty($pageno) ? $pageno : '').'"; if (inputko.length>0) { $.each(inputko, function(i, inputname) { diff --git a/htdocs/website/index.php b/htdocs/website/index.php index a6feeea3346..437ef5b498d 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -327,6 +327,8 @@ if ($cancel) $savbacktopage = $backtopage; $backtopage = $_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid.(GETPOST('section_dir', 'alpha') ? '§ion_dir='.urlencode(GETPOST('section_dir', 'alpha')) : ''); // used after a confirm_deletefile into actions_linkedfiles.inc.php +if ($sortfield) $backtopage.='&sortfield='.$sortfield; +if ($sortorder) $backtopage.='&sortorder='.$sortorder; include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; $backtopage = $savbacktopage; From 024abe8b58481d2d8340569bc3a14c778905af72 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 17 Apr 2020 12:34:35 +0200 Subject: [PATCH 24/62] FIX Preview of svg files into file manager --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 7b689814960..52e852188d6 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1297,7 +1297,7 @@ class FormFile { $fileinfo = pathinfo($file['name']); print ''; - if (image_format_supported($file['name']) > 0) + if (image_format_supported($file['name']) >= 0) { if ($useinecm == 5 || $useinecm == 6) { From 965bdf733dca4a2ad9b87d86b928f128473182dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 17 Apr 2020 13:10:18 +0200 Subject: [PATCH 25/62] FIX Can overwrite file if exists in file manager --- htdocs/core/actions_linkedfiles.inc.php | 7 ++++--- htdocs/core/class/html.formfile.class.php | 8 +++++--- htdocs/core/lib/files.lib.php | 10 +++++++--- htdocs/langs/en_US/link.lang | 1 + 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index f8ac8ab0be0..2542cf23268 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -52,15 +52,16 @@ if (GETPOST('sendit', 'alpha') && !empty($conf->global->MAIN_UPLOAD_DOC)) { // Define if we have to generate thumbs or not $generatethumbs = 1; - if (GETPOST('section_dir')) $generatethumbs = 0; + if (GETPOST('section_dir', 'alpha')) $generatethumbs = 0; + $allowoverwrite = (GETPOST('overwritefile', 'int') ? 1 : 0); if (!empty($upload_dirold) && !empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { - $result = dol_add_file_process($upload_dirold, 0, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs); + $result = dol_add_file_process($upload_dirold, $allowoverwrite, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs); } elseif (!empty($upload_dir)) { - $result = dol_add_file_process($upload_dir, 0, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs); + $result = dol_add_file_process($upload_dir, $allowoverwrite, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs); } } } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 52e852188d6..4a50525c88a 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -76,7 +76,7 @@ class FormFile * @param integer $linkfiles 1=Also add form to link files, 0=Do not show form to link files * @param string $htmlname Name and id of HTML form ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM) * @param string $accept Specifies the types of files accepted (This is not a security check but an user interface facility. eg '.pdf,image/*' or '.png,.jpg' or 'video/*') - * @param string $sectiondir If upload must be done inside a particular directory (is sectiondir defined, sectionid must not be) + * @param string $sectiondir If upload must be done inside a particular directory (if sectiondir defined, sectionid must not be) * @param int $usewithoutform 0=Default, 1=Disable
and style to use in existing area * @return int <0 if KO, >0 if OK */ @@ -108,8 +108,6 @@ class FormFile return 1; } - $maxlength = $size; - $out = "\n\n".'
'."\n"; if (empty($title)) $title = $langs->trans("AttachANewFile"); @@ -174,6 +172,10 @@ class FormFile $out .= (!empty($accept) ? ' accept="'.$accept.'"' : ' accept=""'); $out .= '>'; $out .= ' '; + if ($sectionid) { // Show overwrite if exists for ECM module only + $langs->load('link'); + $out .= ''; + } $out .= 'global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : ''); $out .= '>'; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index a39e48e3a60..9746c1047b8 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1598,13 +1598,18 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess $formmail->add_attached_files($destfull, $destfile, $TFile['type'][$i]); } - // Update table of files + // Update index table of files (llx_ecm_files) if ($donotupdatesession == 1) { $result = addFileIntoDatabaseIndex($upload_dir, basename($destfile), $TFile['name'][$i], 'uploaded', 0); if ($result < 0) { - setEventMessages('FailedToAddFileIntoDatabaseIndex', '', 'warnings'); + if ($allowoverwrite) { + // Do not show error message. We can have an error due to DB_ERROR_RECORD_ALREADY_EXISTS + } + else { + setEventMessages('FailedToAddFileIntoDatabaseIndex', '', 'warnings'); + } } } @@ -1760,7 +1765,6 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo return $result; } - /** * Delete files into database index using search criterias. * diff --git a/htdocs/langs/en_US/link.lang b/htdocs/langs/en_US/link.lang index fdcf07aeff4..1ffcd41a18b 100644 --- a/htdocs/langs/en_US/link.lang +++ b/htdocs/langs/en_US/link.lang @@ -8,3 +8,4 @@ LinkRemoved=The link %s has been removed ErrorFailedToDeleteLink= Failed to remove link '%s' ErrorFailedToUpdateLink= Failed to update link '%s' URLToLink=URL to link +OverwriteIfExists=Overwrite file if exists From 6fd34f592d6da85518e91aadb0cc890ea0705aa5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 17 Apr 2020 19:07:30 +0200 Subject: [PATCH 26/62] Fix default value --- htdocs/compta/tva/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index beb5b8bfc4f..658c9353a00 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -209,7 +209,7 @@ if ($id) } } -// Formulaire saisie tva +// Form to enter VAT if ($action == 'create') { print load_fiche_titre($langs->trans("VAT").' - '.$langs->trans("New")); @@ -262,7 +262,7 @@ if ($action == 'create') print ''; print ''.$form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")).''; - print $form->selectDate($datev, "datev", '', '', '', 'add', 1, 1); + print $form->selectDate((GETPOST("datevmonth", 'int') ? $datev : -1), "datev", '', '', '', 'add', 1, 1); print ''; // Label From ee26390f890016ea7a0dd8008492c7cfb0836d33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 17 Apr 2020 19:15:22 +0200 Subject: [PATCH 27/62] Look and feel v12 --- htdocs/compta/bank/class/account.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index cbda53affed..ab99173b614 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1390,8 +1390,8 @@ class Account extends CommonObject global $conf, $langs, $user; $result = ''; - $label = ''.$langs->trans("ShowAccount").''; - $label .= '
'.$langs->trans('BankAccount').': '.$this->label; + $label = ''.$langs->trans("BankAccount").''; + $label .= '
'.$langs->trans('Label').': '.$this->label; $label .= '
'.$langs->trans('AccountNumber').': '.$this->number; $label .= '
'.$langs->trans("AccountCurrency").': '.$this->currency_code; From b0515c626b8968868360b0b6f91194ceac060e97 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Apr 2020 00:09:24 +0200 Subject: [PATCH 28/62] Look and feel v12 --- htdocs/compta/bank/bankentries_list.php | 6 +++--- htdocs/core/tpl/objectline_edit.tpl.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index fb97a2e9129..43cfdef0b62 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -751,8 +751,8 @@ if ($resql) print ''; }*/ print ''; - print '
'; - print ''; + print '
'; + print ''; print ''; print ''; @@ -815,7 +815,7 @@ if ($resql) $morehtml .= $buttonreconcile; } - $morehtml .= $newcardbutton; + $morehtml .= ''.$newcardbutton; $picto = 'bank_account'; if ($id > 0 || !empty($ref)) $picto = ''; diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 82509815f44..d316afb6966 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -251,8 +251,8 @@ $coldisplay++; - ">
- "> + ">
+ "> From 910aa464d4f9df2544d6030ccfb74eddc321aee2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Apr 2020 00:38:37 +0200 Subject: [PATCH 29/62] Trans --- htdocs/langs/en_US/companies.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 609ea0efdf2..f8b3d0354e2 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -446,6 +446,7 @@ SaleRepresentativeFirstname=First name of sales representative SaleRepresentativeLastname=Last name of sales representative ErrorThirdpartiesMerge=There was an error when deleting the third parties. Please check the log. Changes have been reverted. NewCustomerSupplierCodeProposed=Customer or Vendor code already used, a new code is suggested +KeepEmptyIfGenericAddress=Keep this field empty if this address is a generic address #Imports PaymentTypeCustomer=Payment Type - Customer PaymentTermsCustomer=Payment Terms - Customer From 13eb1ca28d1e042b78bd02e7d03fc038c372d211 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Apr 2020 04:40:33 +0200 Subject: [PATCH 30/62] Fix link --- htdocs/accountancy/supplier/lines.php | 2 +- htdocs/fourn/class/fournisseur.product.class.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 8d3f3937823..6d1a0ccd610 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -373,7 +373,7 @@ if ($result) { print ''.dol_print_date($db->jdate($objp->datef), 'day').''; // Ref product - print ''; + print ''; if ($product_static->id > 0) print $product_static->getNomUrl(1); if ($product_static->id > 0 && $objp->product_label) print '
'; if ($objp->product_label) print $objp->product_label; diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 78935ca2fb1..c00ee77df53 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -1057,7 +1057,8 @@ class ProductFournisseur extends Product $label = ''.$langs->trans("SupplierRef").''; $label .= '
'; - $label .= ''.$langs->trans('Ref').': '.$this->ref_supplier; + $label .= ''.$langs->trans('Product').': '.$this->ref; + $label .= '
'.$langs->trans('RefSupplier').': '.$this->ref_supplier; $logPrices = $this->listProductFournisseurPriceLog($this->product_fourn_price_id, 'pfpl.datec', 'DESC'); // set sort order here if (is_array($logPrices) && count($logPrices) > 0) { @@ -1095,7 +1096,7 @@ class ProductFournisseur extends Product $result .= $linkstart; if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); - if ($withpicto != 2) $result .= $this->fourn_ref; + if ($withpicto != 2) $result .= $this->ref.($this->ref_supplier ? ' ('.$this->ref_supplier.')' : ''); $result .= $linkend; //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); From 23876684cb45bc1c6e07ffcb907179eb2b4e761a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Apr 2020 11:06:28 +0200 Subject: [PATCH 31/62] Responsive --- htdocs/comm/propal/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 74a8ce7697f..69bbb056283 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -900,7 +900,7 @@ if ($resql) if (!empty($arrayfields['p.ref']['checked'])) { - print ''; + print ''; print ''; // Picto + Ref From 0ab8c479888cfb9f3dfd2a0c8bd29a0fa484b326 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Apr 2020 11:07:57 +0200 Subject: [PATCH 32/62] css --- htdocs/install/check.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/check.php b/htdocs/install/check.php index b4de3cebb66..95e3082cb56 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -557,7 +557,7 @@ else } if ($disabled) { - $choice .= ''.$langs->trans("NotYetAvailable").''; + $choice .= ''.$langs->trans("NotYetAvailable").''; } else { From 7c6c6002258d90de9f4daa03b0db8b65efd83232 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Apr 2020 11:38:24 +0200 Subject: [PATCH 33/62] CSS --- htdocs/comm/propal/list.php | 2 +- htdocs/core/class/html.formfile.class.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index b274689ef3e..e3ba84a6dc5 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -904,7 +904,7 @@ if ($resql) print '
'; // Picto + Ref - print ''; // Warning diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 4a50525c88a..433e959b176 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -733,7 +733,9 @@ class FormFile $arraykeys = array_keys($modellist); $modelselected = $arraykeys[0]; } - $out .= $form->selectarray('model', $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth100'); + $morecss = 'maxwidth200'; + if ($conf->browser->layout == 'phone') $morecss = 'maxwidth100'; + $out .= $form->selectarray('model', $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss); if ($conf->use_javascript_ajax) { $out .= ajax_combobox('model'); From f23266e56012127153f8909ed672e1bdeb25f449 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Apr 2020 11:40:26 +0200 Subject: [PATCH 34/62] css --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 433e959b176..c9c99370816 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -873,7 +873,7 @@ class FormFile if ($printer) { //$out.= ''; } if (!empty($arrayfields['p.ref_client']['checked'])) { print ''; } if (!empty($arrayfields['pr.ref']['checked'])) { print ''; } if (!empty($arrayfields['pr.title']['checked'])) { print ''; } if (!empty($arrayfields['s.nom']['checked'])) { print ''; } - if (!empty($arrayfields['s.town']['checked'])) print ''; - if (!empty($arrayfields['s.zip']['checked'])) print ''; + if (!empty($arrayfields['s.town']['checked'])) print ''; + if (!empty($arrayfields['s.zip']['checked'])) print ''; // State if (!empty($arrayfields['state.nom']['checked'])) { print ''; } // Country @@ -618,7 +618,7 @@ if ($resql) // Company type if (!empty($arrayfields['typent.code']['checked'])) { - print ''; @@ -668,7 +668,7 @@ if ($resql) // Availability if (!empty($arrayfields['ava.rowid']['checked'])) { - print ''; From 8f7c3fc867b2a83dc5f51769d06b2c4319a872ce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Apr 2020 14:39:02 +0200 Subject: [PATCH 36/62] Fix: restore jselect2 4.0.5 (4.0.6 create troubles in responsive) --- COPYRIGHT | 2 +- htdocs/comm/propal/list.php | 6 +- htdocs/core/class/html.form.class.php | 167 ++-- .../tpl/extrafields_list_search_input.tpl.php | 2 + .../jquery/plugins/select2/.editorconfig | 6 - .../jquery/plugins/select2/.gitignore | 3 - .../jquery/plugins/select2/.jshintignore | 4 - .../includes/jquery/plugins/select2/.jshintrc | 25 - .../jquery/plugins/select2/CHANGELOG.md | 173 ---- .../jquery/plugins/select2/Gruntfile.js | 125 ++- .../includes/jquery/plugins/select2/README.md | 64 +- .../jquery/plugins/select2/component.json | 2 +- .../jquery/plugins/select2/composer.json | 3 + .../plugins/select2/dist/css/select2.css | 19 +- .../plugins/select2/dist/css/select2.min.css | 2 +- .../jquery/plugins/select2/dist/js/i18n/af.js | 3 - .../jquery/plugins/select2/dist/js/i18n/ar.js | 3 - .../jquery/plugins/select2/dist/js/i18n/az.js | 3 - .../jquery/plugins/select2/dist/js/i18n/bg.js | 3 - .../jquery/plugins/select2/dist/js/i18n/bn.js | 3 - .../jquery/plugins/select2/dist/js/i18n/bs.js | 3 - .../jquery/plugins/select2/dist/js/i18n/ca.js | 3 - .../jquery/plugins/select2/dist/js/i18n/cs.js | 3 - .../jquery/plugins/select2/dist/js/i18n/da.js | 3 - .../jquery/plugins/select2/dist/js/i18n/de.js | 3 - .../plugins/select2/dist/js/i18n/dsb.js | 3 - .../jquery/plugins/select2/dist/js/i18n/el.js | 3 - .../jquery/plugins/select2/dist/js/i18n/en.js | 3 - .../jquery/plugins/select2/dist/js/i18n/es.js | 3 - .../jquery/plugins/select2/dist/js/i18n/et.js | 3 - .../jquery/plugins/select2/dist/js/i18n/eu.js | 3 - .../jquery/plugins/select2/dist/js/i18n/fa.js | 3 - .../jquery/plugins/select2/dist/js/i18n/fi.js | 3 - .../jquery/plugins/select2/dist/js/i18n/fr.js | 3 - .../jquery/plugins/select2/dist/js/i18n/gl.js | 3 - .../jquery/plugins/select2/dist/js/i18n/he.js | 3 - .../jquery/plugins/select2/dist/js/i18n/hi.js | 3 - .../jquery/plugins/select2/dist/js/i18n/hr.js | 3 - .../plugins/select2/dist/js/i18n/hsb.js | 3 - .../jquery/plugins/select2/dist/js/i18n/hu.js | 3 - .../jquery/plugins/select2/dist/js/i18n/hy.js | 3 - .../jquery/plugins/select2/dist/js/i18n/id.js | 3 - .../jquery/plugins/select2/dist/js/i18n/is.js | 3 - .../jquery/plugins/select2/dist/js/i18n/it.js | 3 - .../jquery/plugins/select2/dist/js/i18n/ja.js | 3 - .../jquery/plugins/select2/dist/js/i18n/ka.js | 3 - .../jquery/plugins/select2/dist/js/i18n/km.js | 3 - .../jquery/plugins/select2/dist/js/i18n/ko.js | 3 - .../jquery/plugins/select2/dist/js/i18n/lt.js | 3 - .../jquery/plugins/select2/dist/js/i18n/lv.js | 3 - .../jquery/plugins/select2/dist/js/i18n/mk.js | 3 - .../jquery/plugins/select2/dist/js/i18n/ms.js | 3 - .../jquery/plugins/select2/dist/js/i18n/nb.js | 3 - .../jquery/plugins/select2/dist/js/i18n/ne.js | 3 - .../jquery/plugins/select2/dist/js/i18n/nl.js | 3 - .../jquery/plugins/select2/dist/js/i18n/pl.js | 3 - .../jquery/plugins/select2/dist/js/i18n/ps.js | 3 - .../plugins/select2/dist/js/i18n/pt-BR.js | 3 - .../jquery/plugins/select2/dist/js/i18n/pt.js | 3 - .../jquery/plugins/select2/dist/js/i18n/ro.js | 3 - .../jquery/plugins/select2/dist/js/i18n/ru.js | 3 - .../jquery/plugins/select2/dist/js/i18n/sk.js | 3 - .../jquery/plugins/select2/dist/js/i18n/sl.js | 3 - .../jquery/plugins/select2/dist/js/i18n/sq.js | 3 - .../plugins/select2/dist/js/i18n/sr-Cyrl.js | 3 - .../jquery/plugins/select2/dist/js/i18n/sr.js | 3 - .../jquery/plugins/select2/dist/js/i18n/sv.js | 3 - .../jquery/plugins/select2/dist/js/i18n/th.js | 3 - .../jquery/plugins/select2/dist/js/i18n/tk.js | 3 - .../jquery/plugins/select2/dist/js/i18n/tr.js | 3 - .../jquery/plugins/select2/dist/js/i18n/uk.js | 3 - .../jquery/plugins/select2/dist/js/i18n/vi.js | 3 - .../plugins/select2/dist/js/i18n/zh-CN.js | 3 - .../plugins/select2/dist/js/i18n/zh-TW.js | 3 - .../plugins/select2/dist/js/select2.full.js | 803 +++++------------- .../select2/dist/js/select2.full.min.js | 3 +- .../jquery/plugins/select2/dist/js/select2.js | 790 +++++------------ .../plugins/select2/dist/js/select2.min.js | 3 +- .../jquery/plugins/select2/package.json | 40 +- 79 files changed, 694 insertions(+), 1725 deletions(-) delete mode 100644 htdocs/includes/jquery/plugins/select2/.editorconfig delete mode 100644 htdocs/includes/jquery/plugins/select2/.gitignore delete mode 100644 htdocs/includes/jquery/plugins/select2/.jshintignore delete mode 100644 htdocs/includes/jquery/plugins/select2/.jshintrc delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/af.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/ar.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/az.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/bg.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/bn.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/bs.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/ca.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/cs.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/da.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/de.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/dsb.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/el.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/en.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/es.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/et.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/eu.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/fa.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/fi.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/fr.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/gl.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/he.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/hi.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/hr.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/hsb.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/hu.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/hy.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/id.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/is.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/it.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/ja.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/ka.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/km.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/ko.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/lt.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/lv.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/mk.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/ms.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/nb.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/ne.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/nl.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/pl.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/ps.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/pt-BR.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/pt.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/ro.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/ru.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/sk.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/sl.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/sq.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/sr-Cyrl.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/sr.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/sv.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/th.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/tk.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/tr.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/uk.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/vi.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/zh-CN.js delete mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/i18n/zh-TW.js diff --git a/COPYRIGHT b/COPYRIGHT index 137682bc514..42241a47d37 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -41,7 +41,7 @@ Ace 1.4.8 BSD Yes ChartJS 2.9.3 MIT License Yes JS library for graph jQuery 3.4.1 MIT License Yes JS library jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI -jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect +jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles with responsive jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups) jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index f1552cd7b39..10dcf49b426 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -496,7 +496,7 @@ if ($resql) print ''; print ''; - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'commercial', 0, $newcardbutton, '', $limit, 0, 0, 1); +// print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'commercial', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "SendPropalRef"; $modelmail = "proposal_send"; @@ -562,7 +562,8 @@ if ($resql) } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +/////////// +// $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; @@ -765,6 +766,7 @@ if ($resql) print '
'; } // Extra fields +//////////// include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 914106ac49a..ee2ae092420 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6120,11 +6120,11 @@ class Form } if ($tmpfieldstoshow) $fieldstoshow = $tmpfieldstoshow; } - else - { + else + { // For backward compatibility $objecttmp->fields['ref'] = array('type'=>'varchar(30)', 'label'=>'Ref', 'showoncombobox'=>1); - } + } if (empty($fieldstoshow)) { @@ -6146,107 +6146,100 @@ class Form // Search data $sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".MAIN_DB_PREFIX.$objecttmp->table_element." as t"; - if (isset($objecttmp->ismultientitymanaged) && !is_numeric($objecttmp->ismultientitymanaged)) { - $tmparray = explode('@', $objecttmp->ismultientitymanaged); - $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$tmparray[1].' as parenttable ON parenttable.rowid = t.'.$tmparray[0]; - } - if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') + if ($objecttmp->ismultientitymanaged == 2) if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE 1=1"; - if (isset($objecttmp->ismultientitymanaged) && $objecttmp->ismultientitymanaged == 1) $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; - if (isset($objecttmp->ismultientitymanaged) && !is_numeric($objecttmp->ismultientitymanaged)) { - $sql .= ' AND parenttable.entity = t.'.$tmparray[0]; - } - if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { - if ($objecttmp->element == 'societe') $sql .= " AND t.rowid = ".$user->socid; - else $sql .= " AND t.fk_soc = ".$user->socid; - } - if ($searchkey != '') $sql .= natural_search(explode(',', $fieldstoshow), $searchkey); - if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') { - if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; - } - if ($objecttmp->filter) { // Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - /*if (! DolibarrApi::_checkFilters($objecttmp->filter)) - { - throw new RestException(503, 'Error when validating parameter sqlfilters '.$objecttmp->filter); - }*/ - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; - $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'Form::forgeCriteriaCallback', $objecttmp->filter).")"; - } - $sql .= $this->db->order($fieldstoshow, "ASC"); - //$sql.=$this->db->plimit($limit, 0); - //print $sql; - - // Build output string - $resql = $this->db->query($sql); - if ($resql) - { - if (!$forcecombo) - { - include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - $out .= ajax_combobox($htmlname, null, $conf->global->$confkeyforautocompletemode); + $sql .= " WHERE 1=1"; + if (!empty($objecttmp->ismultientitymanaged)) $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; + if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { + if ($objecttmp->element == 'societe') $sql .= " AND t.rowid = ".$user->socid; + else $sql .= " AND t.fk_soc = ".$user->socid; } - - // Construct $out and $outarray - $out .= ''."\n"; + + // Warning: Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4 + $textifempty = ' '; + + //if (! empty($conf->use_javascript_ajax) || $forcecombo) $textifempty=''; + if (!empty($conf->global->$confkeyforautocompletemode)) + { + if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty); + else $textifempty .= $langs->trans("All"); + } + if ($showempty) $out .= ''."\n"; + + $num = $this->db->num_rows($resql); + $i = 0; + if ($num) + { + while ($i < $num) { - $val = preg_replace('/t\./', '', $val); - $label .= (($label && $obj->$val) ? ' - ' : '').$obj->$val; - } - if (empty($outputmode)) - { - if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) + $obj = $this->db->fetch_object($resql); + $label = ''; + $tmparray = explode(',', $fieldstoshow); + foreach ($tmparray as $key => $val) { - $out .= ''; + $val = preg_replace('/t\./', '', $val); + $label .= (($label && $obj->$val) ? ' - ' : '').$obj->$val; + } + if (empty($outputmode)) + { + if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) + { + $out .= ''; + } + else + { + $out .= ''; + } } else { - $out .= ''; + array_push($outarray, array('key'=>$obj->rowid, 'value'=>$label, 'label'=>$label)); } - } - else - { - array_push($outarray, array('key'=>$obj->rowid, 'value'=>$label, 'label'=>$label)); - } - $i++; - if (($i % 10) == 0) $out .= "\n"; + $i++; + if (($i % 10) == 0) $out .= "\n"; + } } + + $out .= ''."\n"; + } + else + { + dol_print_error($this->db); } - $out .= ''."\n"; - } - else - { - dol_print_error($this->db); - } + $this->result = array('nbofelement'=>$num); - $this->result = array('nbofelement'=>$num); - - if ($outputmode) return $outarray; - return $out; + if ($outputmode) return $outarray; + return $out; } diff --git a/htdocs/core/tpl/extrafields_list_search_input.tpl.php b/htdocs/core/tpl/extrafields_list_search_input.tpl.php index cfd15deb91c..d6ebb8b919f 100644 --- a/htdocs/core/tpl/extrafields_list_search_input.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_input.tpl.php @@ -1,5 +1,7 @@ '."\n"; + // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { diff --git a/htdocs/includes/jquery/plugins/select2/.editorconfig b/htdocs/includes/jquery/plugins/select2/.editorconfig deleted file mode 100644 index 54f4d3beedb..00000000000 --- a/htdocs/includes/jquery/plugins/select2/.editorconfig +++ /dev/null @@ -1,6 +0,0 @@ -[*] -indent_style = space -end_of_line = lf - -[*.js] -indent_size = 2 diff --git a/htdocs/includes/jquery/plugins/select2/.gitignore b/htdocs/includes/jquery/plugins/select2/.gitignore deleted file mode 100644 index aa970da6518..00000000000 --- a/htdocs/includes/jquery/plugins/select2/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -dist/js/i18n/build.txt -.sass-cache diff --git a/htdocs/includes/jquery/plugins/select2/.jshintignore b/htdocs/includes/jquery/plugins/select2/.jshintignore deleted file mode 100644 index ba5a30f8c38..00000000000 --- a/htdocs/includes/jquery/plugins/select2/.jshintignore +++ /dev/null @@ -1,4 +0,0 @@ -src/js/banner.*.js -src/js/wrapper.*.js -tests/vendor/*.js -tests/helpers.js diff --git a/htdocs/includes/jquery/plugins/select2/.jshintrc b/htdocs/includes/jquery/plugins/select2/.jshintrc deleted file mode 100644 index 94299268771..00000000000 --- a/htdocs/includes/jquery/plugins/select2/.jshintrc +++ /dev/null @@ -1,25 +0,0 @@ -{ - "bitwise": true, - "camelcase": true, - "curly": true, - "es3": true, - "eqnull": true, - "freeze": true, - "globals": { - "console": false, - "define": false, - "document": false, - "MockContainer": false, - "module": false, - "QUnit": false, - "require": false, - "test": false, - "window": false - }, - "indent": 2, - "maxlen": 80, - "noarg": true, - "nonew": true, - "quotmark": "single", - "undef": true -} diff --git a/htdocs/includes/jquery/plugins/select2/CHANGELOG.md b/htdocs/includes/jquery/plugins/select2/CHANGELOG.md index d6b2a7587dd..3ae60aff255 100644 --- a/htdocs/includes/jquery/plugins/select2/CHANGELOG.md +++ b/htdocs/includes/jquery/plugins/select2/CHANGELOG.md @@ -1,178 +1,5 @@ # Change Log -## 4.0.13 - -### New features / improvements - -* Trigger `input` event before `change` events (#4649) -* Feed back the keypress code that was responsible for the 'close' event (#5513) -* Only trigger `selection:update` once on DOM change events (#5734) - -### Bug fixes - -* Prevent opening of disabled elements (#5751) - -### Documentation - -* Fix "edit this page" links in docs (#5689) - -### Miscellaneous - -* Registered Select2 on Open Collective (#5700, #5721, #5741) - -## 4.0.12 - -### Bug fixes - -* Fixes incorrect offset when using the Shadow DOM and styling the `` element (#5682) - -### Miscellaneous - -* Replace cdnjs with jsDelivr in the documentation (#5687) -* Fix incorrect provider for the automated NPM deployment (#5686) - -## 4.0.11 - -### Bug fixes - -* Fixes jQuery migrate error when getting offset when dropdownParent not in document (#5584) - -### Miscellaneous - -* Enable GitHub actions for CI (#5591) -* Documentation has been moved into and is deployed from the code repository (#5638) -* Remove Travis CI integration (#5665) - -## 4.0.10 - -### New features / improvements - -* Support passing in a selector for `dropdownParent` option (#5622) - -### Bug fixes - -* Fix bug where dropdowns pointing upwards were incorrectly positioned (#5621) - -## 4.0.9 - -### New features / improvements - -* Mirror disabled state through aria-disabled on selection (#5579) -* Select2 now clears the internal ID when it is destroyed (#5587) -* Set the main ARIA 1.1 roles and properties for comboboxes (#5582) -* The `language` option now has a clearly defined fallback chain (#5602) - -### Bug fixes - -* Do not propagate click when search box is not empty (#5580) -* Fix `maximumSelectionLength` being ignored by `closeOnSelect` (#5581) -* Fix generated options not receiving result IDs (#5586) -* Remove selection title attribute if text is empty (#5589) -* Reposition dropdown whenever items are selected (#5590) -* Fix dropdown positioning when displayed above with messages (#5592) -* Fix search box expanding width of container (#5595) -* `allowClear` no longer shifts selections to a new line (#5603) - -### Translations - -* Fix error in German translations (#5604) - -### Miscellaneous - -* Updated development grunt version so it no longer shows as vulnerable (#5597) -* Remove unused variables (#5554) - -## 4.0.8 - -### New features / improvements - -* Test against and fix compatibility with jQuery 3.4.1 (#5531) -* Results respect disabled state of `'; + print ''; } if (!empty($arrayfields['p.ref_client']['checked'])) { print ''; + print ''; } if (!empty($arrayfields['pr.ref']['checked'])) { - print ''; + print ''; } if (!empty($arrayfields['pr.title']['checked'])) { - print ''; + print ''; } if (!empty($arrayfields['s.nom']['checked'])) { print ''; + print ''; } if (!empty($arrayfields['s.town']['checked'])) print ''; if (!empty($arrayfields['s.zip']['checked'])) print ''; @@ -766,7 +765,6 @@ if ($resql) print ''; } // Extra fields -//////////// include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook @@ -785,7 +783,7 @@ if ($resql) print ''; } - // Date cloture + // Date cloture if (!empty($arrayfields['p.date_cloture']['checked'])) { print ''; - if (!$i) $totalarray['nbfield']++; + print ''; + if (!$i) $totalarray['nbfield']++; } if (!empty($arrayfields['pr.title']['checked'])) { - // Project label - print ''; - if (!$i) $totalarray['nbfield']++; + // Project label + print ''; + if (!$i) $totalarray['nbfield']++; } // Thirdparty @@ -1061,10 +1059,10 @@ if ($resql) // Amount HT if (!empty($arrayfields['p.total_ht']['checked'])) { - print '\n"; - if (!$i) $totalarray['nbfield']++; - if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht'; - $totalarray['val']['p.total_ht'] += $obj->total_ht; + print '\n"; + if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht'; + $totalarray['val']['p.total_ht'] += $obj->total_ht; } // Amount VAT if (!empty($arrayfields['p.total_vat']['checked'])) @@ -1083,42 +1081,42 @@ if ($resql) $totalarray['val']['p.total_ttc'] += $obj->total_ttc; } // Amount invoiced - if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) - { - print '\n"; - if (!$i) $totalarray['nbfield']++; - if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht_invoiced'; - $totalarray['val']['p.total_ht_invoiced'] += $totalInvoicedHT; - } - // Amount invoiced - if (!empty($arrayfields['p.total_invoiced']['checked'])) - { - print '\n"; - if (!$i) $totalarray['nbfield']++; - if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_invoiced'; - $totalarray['val']['p.total_invoiced'] += $totalInvoicedTTC; - } + if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) + { + print '\n"; + if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht_invoiced'; + $totalarray['val']['p.total_ht_invoiced'] += $totalInvoicedHT; + } + // Amount invoiced + if (!empty($arrayfields['p.total_invoiced']['checked'])) + { + print '\n"; + if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_invoiced'; + $totalarray['val']['p.total_invoiced'] += $totalInvoicedTTC; + } // Currency if (!empty($arrayfields['p.multicurrency_code']['checked'])) { - print '\n"; - if (!$i) $totalarray['nbfield']++; + print '\n"; + if (!$i) $totalarray['nbfield']++; } // Currency rate if (!empty($arrayfields['p.multicurrency_tx']['checked'])) { - print '\n"; - if (!$i) $totalarray['nbfield']++; + print '\n"; + if (!$i) $totalarray['nbfield']++; } // Amount HT if (!empty($arrayfields['p.multicurrency_total_ht']['checked'])) { - print '\n"; - if (!$i) $totalarray['nbfield']++; + print '\n"; + if (!$i) $totalarray['nbfield']++; } // Amount VAT if (!empty($arrayfields['p.multicurrency_total_vat']['checked'])) @@ -1133,17 +1131,17 @@ if ($resql) if (!$i) $totalarray['nbfield']++; } // Amount invoiced - if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked'])) - { - print '\n"; - if (!$i) $totalarray['nbfield']++; - } - // Amount invoiced - if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked'])) - { - print '\n"; - if (!$i) $totalarray['nbfield']++; - } + if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked'])) + { + print '\n"; + if (!$i) $totalarray['nbfield']++; + } + // Amount invoiced + if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked'])) + { + print '\n"; + if (!$i) $totalarray['nbfield']++; + } $userstatic->id = $obj->fk_user_author; $userstatic->login = $obj->login; @@ -1223,7 +1221,7 @@ if ($resql) print ''; if (!$i) $totalarray['nbfield']++; } - // Date cloture + // Date cloture if (!empty($arrayfields['p.date_cloture']['checked'])) { print ''; + $ret .= ''; + if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) $ret .= '
'."\n"; + $ret .= ''; + if (empty($notabletag)) $ret .= ''; - if (empty($notabletag)) $ret .= '
'; + print ''; print $objectstatic->getNomUrl(1, '', '', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1)); print ''; - $out .= ''.img_picto($langs->trans("PrintFile", $relativepath), 'printer.png').''; } From 47ff3f866a82c28c1dcba5d92bfd579bc9903da6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Apr 2020 12:54:28 +0200 Subject: [PATCH 35/62] css --- htdocs/comm/propal/list.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index e3ba84a6dc5..f1552cd7b39 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -572,40 +572,40 @@ if ($resql) if (!empty($arrayfields['p.ref']['checked'])) { print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; + print ''; print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT)); print ajax_combobox('search_type_thirdparty'); print ''; + print ''; $form->selectAvailabilityDelay($search_availability, 'search_availability', '', 1); print ajax_combobox('search_availability'); print ''; print ''; - print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; + print ''; + print ''; print ''; - print ''; print ''; @@ -941,24 +939,24 @@ if ($resql) if (!empty($arrayfields['pr.ref']['checked'])) { - // Project ref - print ''; - if ($obj->project_id > 0) { + // Project ref + print ''; + if ($obj->project_id > 0) { print $projectstatic->getNomUrl(1); } - print ''; - if ($obj->project_id > 0) { - print $projectstatic->title; - } - print ''; + if ($obj->project_id > 0) { + print $projectstatic->title; + } + print ''.price($obj->total_ht)."'.price($obj->total_ht)."'.price($totalInvoicedHT)."'.price($totalInvoicedTTC)."'.price($totalInvoicedHT)."'.price($totalInvoicedTTC)."'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."'; - $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); - print "'; + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); + print "'.price($obj->multicurrency_total_ht)."'.price($obj->multicurrency_total_ht)."'.price($multicurrency_totalInvoicedHT)."'.price($multicurrency_totalInvoicedTTC)."'.price($multicurrency_totalInvoicedHT)."'.price($multicurrency_totalInvoicedTTC)."'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index ee2ae092420..9a8ade00367 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -52,19 +52,19 @@ class Form { /** - * @var DoliDB Database handler. - */ - public $db; + * @var DoliDB Database handler. + */ + public $db; /** * @var string Error code (or message) */ public $error = ''; - /** - * @var string[] Array of error strings - */ - public $errors = array(); + /** + * @var string[] Array of error strings + */ + public $errors = array(); public $num; @@ -103,8 +103,8 @@ class Form * @param string $help Tooltip help * @return string HTML edit field */ - public function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata = 'string', $moreparam = '', $fieldrequired = 0, $notabletag = 0, $paramid = 'id', $help = '') - { + public function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata = 'string', $moreparam = '', $fieldrequired = 0, $notabletag = 0, $paramid = 'id', $help = '') + { global $conf, $langs; $ret = ''; @@ -157,7 +157,7 @@ class Form } return $ret; - } + } /** * Output value of a field for an editable field @@ -177,7 +177,7 @@ class Form * @param string $paramid Key of parameter for id ('id', 'socid') * @return string HTML edit field */ - public function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata = 'string', $editvalue = '', $extObject = null, $custommsg = null, $moreparam = '', $notabletag = 0, $formatfunc = '', $paramid = 'id') + public function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata = 'string', $editvalue = '', $extObject = null, $custommsg = null, $moreparam = '', $notabletag = 0, $formatfunc = '', $paramid = 'id') { global $conf, $langs, $db; @@ -243,7 +243,7 @@ class Form elseif (preg_match('/^select;/', $typeofdata)) { $arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); - $arraylist = array(); + $arraylist = array(); foreach ($arraydata as $val) { $tmp = explode(':', $val); @@ -254,7 +254,7 @@ class Form } elseif (preg_match('/^ckeditor/', $typeofdata)) { - $tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser + $tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($htmlname, ($editvalue ? $editvalue : $value), ($tmp[2] ? $tmp[2] : ''), ($tmp[3] ? $tmp[3] : '100'), ($tmp[1] ? $tmp[1] : 'dolibarr_notes'), 'In', ($tmp[5] ? $tmp[5] : 0), (isset($tmp[8]) ? ($tmp[8] ?true:false) : true), true, ($tmp[6] ? $tmp[6] : '20'), ($tmp[7] ? $tmp[7] : '100')); $ret .= $doleditor->Create(1); @@ -263,12 +263,12 @@ class Form if (empty($notabletag)) $ret .= ''; //else $ret.='
'; - $ret .= ''; - if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) $ret .= '
'."\n"; - $ret .= ''; - if (empty($notabletag)) $ret .= '
'."\n"; + if (empty($notabletag)) $ret .= ''."\n"; $ret .= ''."\n"; } else @@ -282,7 +282,7 @@ class Form elseif (preg_match('/^select;/', $typeofdata)) { $arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); - $arraylist = array(); + $arraylist = array(); foreach ($arraydata as $val) { $tmp = explode(':', $val); @@ -492,8 +492,8 @@ class Form { if (!empty($custommsg['success'])) $out .= ''."\n"; - if (!empty($custommsg['error'])) - $out .= ''."\n"; + if (!empty($custommsg['error'])) + $out .= ''."\n"; } else $out .= ''."\n"; @@ -532,7 +532,7 @@ class Form * @see textwithpicto() Use thisfunction if you can. * TODO Move this as static as soon as everybody use textwithpicto or @Form::textwithtooltip */ - public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0) + public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0) { if ($incbefore) $text = $incbefore.$text; if (!$htmltext) return $text; @@ -613,7 +613,7 @@ class Form * @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only) * @return string HTML code of text, picto, tooltip */ - public function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = '', $noencodehtmltext = 0, $notabs = 3, $tooltiptrigger = '', $forcenowrap = 0) + public function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = '', $noencodehtmltext = 0, $notabs = 3, $tooltiptrigger = '', $forcenowrap = 0) { global $conf, $langs; @@ -643,7 +643,7 @@ class Form // If info or help with smartphone, show only text (tooltip on click does not works with dialog on smaprtphone) //if (! empty($conf->dol_no_mouse_hover) && ! empty($tooltiptrigger)) //{ - //if ($type == 'info' || $type == 'help') return ''.$text.'''; + //if ($type == 'info' || $type == 'help') return ''.$text.'''; //} $img = ''; @@ -666,7 +666,7 @@ class Form * @param int $alwaysvisible 1=select button always visible * @return string|void Select list */ - public function selectMassAction($selected, $arrayofaction, $alwaysvisible = 0) + public function selectMassAction($selected, $arrayofaction, $alwaysvisible = 0) { global $conf, $langs, $hookmanager; @@ -760,7 +760,7 @@ class Form return $ret; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return combo list of activated countries, into language of user * @@ -776,9 +776,9 @@ class Form * @param array $exclude_country_code Array of country code (iso2) to exclude * @return string HTML string with select */ - public function select_country($selected = '', $htmlname = 'country_id', $htmloption = '', $maxlength = 0, $morecss = 'minwidth300', $usecodeaskey = '', $showempty = 1, $disablefavorites = 0, $addspecialentries = 0, $exclude_country_code = array()) + public function select_country($selected = '', $htmlname = 'country_id', $htmloption = '', $maxlength = 0, $morecss = 'minwidth300', $usecodeaskey = '', $showempty = 1, $disablefavorites = 0, $addspecialentries = 0, $exclude_country_code = array()) { - // phpcs:enable + // phpcs:enable global $conf, $langs, $mysoc; $langs->load("dict"); @@ -878,7 +878,7 @@ class Form return $out; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return select list of incoterms * @@ -891,9 +891,9 @@ class Form * @param array $events Event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @return string HTML string with select and input */ - public function select_incoterms($selected = '', $location_incoterms = '', $page = '', $htmlname = 'incoterm_id', $htmloption = '', $forcecombo = 1, $events = array()) + public function select_incoterms($selected = '', $location_incoterms = '', $page = '', $htmlname = 'incoterm_id', $htmloption = '', $forcecombo = 1, $events = array()) { - // phpcs:enable + // phpcs:enable global $conf, $langs; $langs->load("dict"); @@ -972,7 +972,7 @@ class Form return $out; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of types of lines (product or service) * Example: 0=product, 1=service, 9=other (for external module) @@ -984,14 +984,14 @@ class Form * @param integer $forceall 1=Force to show products and services in combo list, whatever are activated modules, 0=No force, 2=Force to show only Products, 3=Force to show only services, -1=Force none (and set hidden field to 'service') * @return void */ - public function select_type_of_lines($selected = '', $htmlname = 'type', $showempty = 0, $hidetext = 0, $forceall = 0) + public function select_type_of_lines($selected = '', $htmlname = 'type', $showempty = 0, $hidetext = 0, $forceall = 0) { - // phpcs:enable + // phpcs:enable global $db, $langs, $user, $conf; // If product & services are enabled or both disabled. if ($forceall == 1 || (empty($forceall) && !empty($conf->product->enabled) && !empty($conf->service->enabled)) - || (empty($forceall) && empty($conf->product->enabled) && empty($conf->service->enabled))) + || (empty($forceall) && empty($conf->product->enabled) && empty($conf->service->enabled))) { if (empty($hidetext)) print $langs->trans("Type").': '; print ''."\n"; + + // Warning: Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4 + $textifempty = ' '; + + //if (! empty($conf->use_javascript_ajax) || $forcecombo) $textifempty=''; + if (!empty($conf->global->$confkeyforautocompletemode)) + { + if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty); + else $textifempty .= $langs->trans("All"); + } + if ($showempty) $out .= ''."\n"; + + $num = $this->db->num_rows($resql); + $i = 0; + if ($num) + { + while ($i < $num) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - $out .= ajax_combobox($htmlname, null, $conf->global->$confkeyforautocompletemode); - } - - // Construct $out and $outarray - $out .= ''."\n"; - } - else - { - dol_print_error($this->db); } - $this->result = array('nbofelement'=>$num); + $out .= ''."\n"; + } + else + { + dol_print_error($this->db); + } - if ($outputmode) return $outarray; - return $out; + $this->result = array('nbofelement'=>$num); + + if ($outputmode) return $outarray; + return $out; } diff --git a/htdocs/includes/jquery/plugins/select2/.editorconfig b/htdocs/includes/jquery/plugins/select2/.editorconfig new file mode 100644 index 00000000000..54f4d3beedb --- /dev/null +++ b/htdocs/includes/jquery/plugins/select2/.editorconfig @@ -0,0 +1,6 @@ +[*] +indent_style = space +end_of_line = lf + +[*.js] +indent_size = 2 diff --git a/htdocs/includes/jquery/plugins/select2/.gitignore b/htdocs/includes/jquery/plugins/select2/.gitignore new file mode 100644 index 00000000000..aa970da6518 --- /dev/null +++ b/htdocs/includes/jquery/plugins/select2/.gitignore @@ -0,0 +1,3 @@ +node_modules +dist/js/i18n/build.txt +.sass-cache diff --git a/htdocs/includes/jquery/plugins/select2/.jshintignore b/htdocs/includes/jquery/plugins/select2/.jshintignore new file mode 100644 index 00000000000..ba5a30f8c38 --- /dev/null +++ b/htdocs/includes/jquery/plugins/select2/.jshintignore @@ -0,0 +1,4 @@ +src/js/banner.*.js +src/js/wrapper.*.js +tests/vendor/*.js +tests/helpers.js diff --git a/htdocs/includes/jquery/plugins/select2/.jshintrc b/htdocs/includes/jquery/plugins/select2/.jshintrc new file mode 100644 index 00000000000..94299268771 --- /dev/null +++ b/htdocs/includes/jquery/plugins/select2/.jshintrc @@ -0,0 +1,25 @@ +{ + "bitwise": true, + "camelcase": true, + "curly": true, + "es3": true, + "eqnull": true, + "freeze": true, + "globals": { + "console": false, + "define": false, + "document": false, + "MockContainer": false, + "module": false, + "QUnit": false, + "require": false, + "test": false, + "window": false + }, + "indent": 2, + "maxlen": 80, + "noarg": true, + "nonew": true, + "quotmark": "single", + "undef": true +} diff --git a/htdocs/includes/jquery/plugins/select2/CHANGELOG.md b/htdocs/includes/jquery/plugins/select2/CHANGELOG.md index 3ae60aff255..d6b2a7587dd 100644 --- a/htdocs/includes/jquery/plugins/select2/CHANGELOG.md +++ b/htdocs/includes/jquery/plugins/select2/CHANGELOG.md @@ -1,5 +1,178 @@ # Change Log +## 4.0.13 + +### New features / improvements + +* Trigger `input` event before `change` events (#4649) +* Feed back the keypress code that was responsible for the 'close' event (#5513) +* Only trigger `selection:update` once on DOM change events (#5734) + +### Bug fixes + +* Prevent opening of disabled elements (#5751) + +### Documentation + +* Fix "edit this page" links in docs (#5689) + +### Miscellaneous + +* Registered Select2 on Open Collective (#5700, #5721, #5741) + +## 4.0.12 + +### Bug fixes + +* Fixes incorrect offset when using the Shadow DOM and styling the `` element (#5682) + +### Miscellaneous + +* Replace cdnjs with jsDelivr in the documentation (#5687) +* Fix incorrect provider for the automated NPM deployment (#5686) + +## 4.0.11 + +### Bug fixes + +* Fixes jQuery migrate error when getting offset when dropdownParent not in document (#5584) + +### Miscellaneous + +* Enable GitHub actions for CI (#5591) +* Documentation has been moved into and is deployed from the code repository (#5638) +* Remove Travis CI integration (#5665) + +## 4.0.10 + +### New features / improvements + +* Support passing in a selector for `dropdownParent` option (#5622) + +### Bug fixes + +* Fix bug where dropdowns pointing upwards were incorrectly positioned (#5621) + +## 4.0.9 + +### New features / improvements + +* Mirror disabled state through aria-disabled on selection (#5579) +* Select2 now clears the internal ID when it is destroyed (#5587) +* Set the main ARIA 1.1 roles and properties for comboboxes (#5582) +* The `language` option now has a clearly defined fallback chain (#5602) + +### Bug fixes + +* Do not propagate click when search box is not empty (#5580) +* Fix `maximumSelectionLength` being ignored by `closeOnSelect` (#5581) +* Fix generated options not receiving result IDs (#5586) +* Remove selection title attribute if text is empty (#5589) +* Reposition dropdown whenever items are selected (#5590) +* Fix dropdown positioning when displayed above with messages (#5592) +* Fix search box expanding width of container (#5595) +* `allowClear` no longer shifts selections to a new line (#5603) + +### Translations + +* Fix error in German translations (#5604) + +### Miscellaneous + +* Updated development grunt version so it no longer shows as vulnerable (#5597) +* Remove unused variables (#5554) + +## 4.0.8 + +### New features / improvements + +* Test against and fix compatibility with jQuery 3.4.1 (#5531) +* Results respect disabled state of `
'; diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index b2370089dd3..24061a9e949 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -1,7 +1,7 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2020 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2012 Juanjo Menent @@ -42,9 +42,9 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'use if (!isset($id) || empty($id)) accessforbidden(); -// Defini si peux lire les permissions +// Define if user can read permissions $canreaduser = ($user->admin || $user->rights->user->user->lire); -// Defini si peux modifier les autres utilisateurs et leurs permisssions +// Define if user can modify other users and permissions $caneditperms = ($user->admin || $user->rights->user->user->creer); // Advanced permissions if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) @@ -132,10 +132,10 @@ if (empty($reshook)) { * View */ -llxHeader('', $langs->trans("Permissions")); - $form = new Form($db); +llxHeader('', $langs->trans("Permissions")); + $head = user_prepare_head($object); $title = $langs->trans("User"); From 01f96b35ed0b40d7c5ff1eccb6d74a323b7ac640 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Apr 2020 16:50:36 +0200 Subject: [PATCH 43/62] Fix reposition --- htdocs/user/group/perms.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index a19c5082f74..8efd7ef38e2 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -293,9 +293,9 @@ if ($object->id > 0) if ($caneditperms) { print ''; - print 'module.'#'.$objMod->getName().'">'.$langs->trans("All").""; + print 'module.'">'.$langs->trans("All").""; print '/'; - print 'module.'#'.$objMod->getName().'">'.$langs->trans("None").""; + print 'module.'">'.$langs->trans("None").""; print ''; } else { print ' '; From 200c29bd14e4e115641bf004e33a7a623fc8577a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Apr 2020 14:19:34 +0200 Subject: [PATCH 44/62] Fix some regression with new architecture for groups --- htdocs/user/card.php | 10 +++++----- htdocs/user/class/usergroup.class.php | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index a1675771bee..d545391bd4f 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1993,6 +1993,8 @@ else if ($canreadgroup) { + print ''."\n"; + print load_fiche_titre($langs->trans("ListOfGroupsForUser"), '', ''); // On selectionne les groupes auquel fait parti le user @@ -2031,13 +2033,11 @@ else print $form->select_dolgroups('', 'group', 1, $exclude, 0, '', '', $object->entity); print '   '; print ''; - print ''; + print ''; } print ''."\n"; - /* - * Groups assigned to user - */ + // List of groups of user if (!empty($groupslist)) { foreach ($groupslist as $group) @@ -2085,7 +2085,7 @@ else } /* - * Fiche en mode edition + * Card in edit mode */ if ($action == 'edit' && ($canedituser || $caneditfield || $caneditpassword || ($user->id == $object->id))) { diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index aaa631fdf36..c897db44412 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -160,6 +160,8 @@ class UserGroup extends CommonObject $result = $this->fetchCommon($id); } + $this->name = $this->nom; // For compatibility with field name + if($result) { if ($load_members) From d3598380daf8b454e3a48561571b18d99f20f49e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Apr 2020 14:23:31 +0200 Subject: [PATCH 45/62] Fix do not use hard coded link --- htdocs/user/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index d545391bd4f..26e455e3346 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -2046,7 +2046,7 @@ else print ''; if ($caneditgroup) { - print ''.img_object($langs->trans("ShowGroup"), "group").' '.$group->name.''; + print $group->getNomUrl(1); } else { From 0a3d57058342bab68b40245fb3a2c19e2b0f66db Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Apr 2020 14:29:18 +0200 Subject: [PATCH 46/62] Look and feel v12 --- htdocs/user/group/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 25a0db9d633..618f569c1e3 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -447,7 +447,7 @@ else print $form->select_dolusers('', 'user', 1, $exclude, 0, '', '', $object->entity, 0, 0, '', 0, '', 'maxwidth300'); print '   '; print ''; - print ''; + print ''; print ''."\n"; print ''."\n"; print '
'; @@ -456,6 +456,7 @@ else /* * Group members */ + print ''; print ''; print ''; From 9ad086ac3c7682228292adf04db4e9fdbbf46c5e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Apr 2020 14:39:15 +0200 Subject: [PATCH 47/62] Look and feel v12 --- htdocs/bookmarks/card.php | 4 ++-- htdocs/bookmarks/list.php | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index 44ab989f528..0c73b6c7146 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -172,7 +172,7 @@ if ($action == 'create') // Owner print ''; // Position @@ -276,7 +276,7 @@ if ($id > 0 && !preg_match('/^add/i', $action)) print '
'.$langs->trans("Login").'
'.$langs->trans("Owner").''; - print $form->select_dolusers(isset($_POST['userid']) ? $_POST['userid'] : $user->id, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); + print img_picto('', 'user').' '.$form->select_dolusers(isset($_POST['userid']) ? $_POST['userid'] : $user->id, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print ' 
'.$langs->trans("Owner").''; if ($action == 'edit' && $user->admin) { - print $form->select_dolusers(isset($_POST['userid']) ? $_POST['userid'] : ($object->fk_user ? $object->fk_user : ''), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); + print img_picto('', 'user').' '.$form->select_dolusers(isset($_POST['userid']) ? $_POST['userid'] : ($object->fk_user ? $object->fk_user : ''), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); } else { diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index 067e2abeaa9..5dd1718b263 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -155,13 +155,12 @@ print ''; print ''; print ''; -print ''; print ''; $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create', '', !empty($user->rights->bookmark->creer)); -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bookmark', 0, $newcardbutton, '', $limit); +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bookmark', 0, $newcardbutton, '', $limit, 0, 0, 1); print '
'; print ''."\n"; @@ -178,6 +177,8 @@ print_liste_field_titre("Position", $_SERVER["PHP_SELF"], "b.position", "", $par print_liste_field_titre(''); print "\n"; +$cacheOfUsers = array(); + $i = 0; while ($i < min($num, $limit)) { @@ -222,9 +223,13 @@ while ($i < min($num, $limit)) print ''; $fieldsforcontent = array('topic', 'joinfiles', 'content'); @@ -902,10 +902,10 @@ if ($resql) // Modify link / Delete link print ''; diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 69272de686f..e299fec88c5 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -100,11 +100,6 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view'; // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. -// Security check - Protection if external user -//if ($user->socid > 0) accessforbidden(); -//if ($user->socid > 0) $socid = $user->socid; -//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0); -//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); $permissiontoread = $user->rights->mymodule->myobject->read; $permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php @@ -113,6 +108,14 @@ $permissionnote = $user->rights->mymodule->myobject->write; // Used by the inclu $permissiondellink = $user->rights->mymodule->myobject->write; // Used by the include of actions_dellink.inc.php $upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object->entity : 1]; +// Security check - Protection if external user +//if ($user->socid > 0) accessforbidden(); +//if ($user->socid > 0) $socid = $user->socid; +//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0); +//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); + +//if (!$permissiontoread) accessforbidden(); + /* * Actions diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 5865af34e78..9b230eae594 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -107,16 +107,6 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen if (!$sortfield) $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. if (!$sortorder) $sortorder = "ASC"; -// Security check -if (empty($conf->mymodule->enabled)) accessforbidden('Module not enabled'); -$socid = 0; -if ($user->socid > 0) // Protection if external user -{ - //$socid = $user->socid; - accessforbidden(); -} -//$result = restrictedArea($user, 'mymodule', $id, ''); - // Initialize array of search criterias $search_all = trim(GETPOST("search_all", 'alpha')); $search = array(); @@ -161,6 +151,18 @@ $permissiontoread = $user->rights->mymodule->myobject->read; $permissiontoadd = $user->rights->mymodule->myobject->write; $permissiontodelete = $user->rights->mymodule->myobject->delete; +// Security check +if (empty($conf->mymodule->enabled)) accessforbidden('Module not enabled'); +$socid = 0; +if ($user->socid > 0) // Protection if external user +{ + //$socid = $user->socid; + accessforbidden(); +} +//$result = restrictedArea($user, 'mymodule', $id, ''); +//if (!$permissiontoread) accessforbidden(); + + /* * Actions From 7b68d4260c27cda522556a0194f21e8418e2b5bb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Apr 2020 15:50:32 +0200 Subject: [PATCH 50/62] Fix permission on button --- htdocs/core/class/html.formactions.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 3c744f4c4bd..b19a75135aa 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -203,7 +203,7 @@ class FormActions if ($typeelement == 'project') $projectid = $object->id; $newcardbutton = ''; - if (!empty($conf->agenda->enabled)) + if (!empty($conf->agenda->enabled) && ! empty($user->rights->agenda->myactions->create)) { $newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(), 'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid > 0 ? '&socid='.$object->socid : ($socid > 0 ? '&socid='.$socid : '')).($projectid > 0 ? '&projectid='.$projectid : '').'&backtopage='.urlencode($urlbacktopage)); } From 08260cb7a4787c8361f373bc3e29ea8b097e409c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Apr 2020 15:52:43 +0200 Subject: [PATCH 51/62] Look and feel --- htdocs/user/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 26e455e3346..22b591dd53f 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1618,7 +1618,9 @@ else // Hierarchy print ''; print ''; print ''; print ''; - print ''; print "\n"; } while ($i < $num) @@ -1420,16 +1419,14 @@ elseif ($id > 0 || !empty($ref)) print "\n"; - // Icone d'edition et suppression + // Econ to edit and delete if ($object->statut == 0 && $user->rights->ficheinter->creer) { print ''; - print ''; print ''; + print ''; } print ''; @@ -1470,7 +1467,7 @@ elseif ($id > 0 || !empty($ref)) // Line in update mode if ($object->statut == 0 && $action == 'editline' && $user->rights->ficheinter->creer && GETPOST('line_id', 'int') == $objp->rowid) { - print ''; + print ''; print ''; - print ''; + print ''; print ''."\n"; $line = new FichinterLigne($db); @@ -1534,7 +1532,7 @@ elseif ($id > 0 || !empty($ref)) print "\n"; } - print ''."\n"; + print ''."\n"; print '
'; if ($obj->fk_user) { - $userstatic->id = $obj->fk_user; - $userstatic->lastname = $obj->login; - print $userstatic->getNomUrl(1); + if (empty($cacheOfUsers[$obj->fk_user])) { + $tmpuser = new User($db); + $tmpuser->fetch($obj->fk_user); + $cacheOfUsers[$obj->fk_user] = $tmpuser; + } + $tmpuser = $cacheOfUsers[$obj->fk_user]; + print $tmpuser->getNomUrl(1); } else { @@ -242,11 +247,11 @@ while ($i < min($num, $limit)) print ''; if ($user->rights->bookmark->creer) { - print 'rowid."&backtopage=".urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().""; + print 'rowid."&backtopage=".urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().""; } if ($user->rights->bookmark->supprimer) { - print "rowid\">".img_delete().""; + print 'rowid.'">'.img_delete().''; } else { From 8117f37e469f919c2dc9bd2904825c034a252751 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Apr 2020 14:39:37 +0200 Subject: [PATCH 48/62] Fix --- htdocs/bookmarks/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index 0c73b6c7146..6ab6bc283b6 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -280,7 +280,7 @@ if ($id > 0 && !preg_match('/^add/i', $action)) } else { - if ($object->fk_user) + if ($object->fk_user > 0) { $fuser = new User($db); $fuser->fetch($object->fk_user); From 4bbe307b410297d3dc418b9b36042934e88796de Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Apr 2020 15:34:53 +0200 Subject: [PATCH 49/62] Look and feel v12 --- htdocs/admin/mails_templates.php | 8 +++---- .../modulebuilder/template/myobject_card.php | 13 ++++++----- .../modulebuilder/template/myobject_list.php | 22 ++++++++++--------- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index f2d27cf2849..cc8a92f819b 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -754,9 +754,9 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; print '
'; - print ''; + print ''; print '
'; - if ($canbemodified) print ''.img_edit().''; + if ($canbemodified) print ''.img_edit().''; if ($iserasable) { - print '   '.img_delete().''; + print ''.img_delete().''; //else print ''.img_delete().''; // Some dictionary can be edited by other profile than admin } print '
'.$langs->trans("HierarchicalResponsible").''; - if (empty($object->fk_user)) print $langs->trans("None"); + if (empty($object->fk_user)) { + print ''.$langs->trans("None").''; + } else { $huser = new User($db); $huser->fetch($object->fk_user); From 6472f521ac224f96471c7e6b00ab1bc6a89b0f49 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Apr 2020 00:54:38 +0200 Subject: [PATCH 52/62] css --- htdocs/commande/list.php | 2 +- htdocs/theme/eldy/global.inc.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 4c2ade29fcc..43f45b10612 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -919,7 +919,7 @@ if ($resql) // Ref if (!empty($arrayfields['c.ref']['checked'])) { - print ''; + print ''; $generic_commande->getLinesArray(); // This set ->lines diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 2e49395d9b3..d46bd839958 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1695,8 +1695,8 @@ div.statusrefbis { } img.photoref, div.photoref { /* border: 1px solid #DDD; */ - -webkit-box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2), 0px 0px 2px rgba(0, 0, 0, 0.1); - box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2), 0px 0px 2px rgba(0, 0, 0, 0.1); + -webkit-box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2); + box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2); padding: 4px; height: 80px; width: 80px; From fa056e59dfca08e23569546967f46e23426f8b4d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Apr 2020 02:14:43 +0200 Subject: [PATCH 53/62] Look and feel v12 --- htdocs/core/class/doleditor.class.php | 4 +- htdocs/core/lib/functions.lib.php | 32 +++-- htdocs/fichinter/card.php | 24 ++-- htdocs/fichinter/index.php | 3 +- htdocs/index.php | 200 +++++++++++++------------- htdocs/projet/class/project.class.php | 5 +- htdocs/projet/list.php | 6 +- htdocs/theme/eldy/info-box.inc.php | 2 +- htdocs/website/index.php | 2 + 9 files changed, 146 insertions(+), 132 deletions(-) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index de5ef1f2e9f..8c7a88e925a 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -96,7 +96,7 @@ class DolEditor $this->cols = (preg_match('/%/', $cols) ? $cols : max(40, $cols)); // If $cols is a percent, we keep it, otherwise, we take max $this->height = $height; $this->width = $width; - } + } } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -259,7 +259,7 @@ class DolEditor })'; $out .= ''."\n"; } - +var_dump($this->height); $out .= '
'pencil-alt', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'info-circle',
 		    	'generic'=>'file', 'holiday'=>'umbrella-beach', 'member'=>'users', 'mrp'=>'cubes', 'trip'=>'wallet', 'group'=>'users',
 		    	'sign-out'=>'sign-out-alt',
-		    	'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star', 'stats' => 'chart-bar',
-		    	'bank'=>'university', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil-alt', 'filter'=>'filter', 'split'=>'code-branch',
+		    	'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star',
+		    	'bank'=>'university', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil-alt', 'filter'=>'filter',
 		    	'list-alt'=>'list-alt', 'calendar'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarmonth'=>'calendar-alt', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table',
-		    	'multicurrency'=>'dollar-sign', 'other'=>'square', 'resource'=>'laptop-house',
+		    	'intervention'=>'ambulance', 'multicurrency'=>'dollar-sign',
 		    	'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle',
+		    	'other'=>'square', 'playdisabled'=>'play', 'preview'=>'binoculars', 'project'=>'sitemap', 'projectpub'=>'sitemap', 'projecttask'=>'tasks',
+				'resize'=>'crop',
 		    	'payment'=>'money-bill-alt', 'phoning'=>'phone', 'phoning_fax'=>'fax', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell',
-		    	'stock'=>'box-open', 'technic'=>'cogs', 'ticket'=>'ticket-alt',
+		    	'resource'=>'laptop-house',
+		    	'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'technic'=>'cogs', 'ticket'=>'ticket-alt',
 		    	'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach',
 		    	'title_agenda'=>'calendar-alt',
-		    	'playdisabled'=>'play', 'preview'=>'binoculars', 'project'=>'sitemap', 'resize'=>'crop',
 		    	'uparrow'=>'mail-forward',
 		    	'jabber'=>'comment-o'
 		    );
@@ -3245,10 +3248,11 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
 				'contract'=>'bg-infoxbox-contrat',
 				'multicurrency'=>'bg-infoxbox-bank_account',
 				'check'=>'font-status4',
-				'hrm'=>'bg-infoxbox-adherent', 'group'=>'bg-infoxbox-adherent',
+				'hrm'=>'bg-infoxbox-adherent', 'group'=>'bg-infoxbox-adherent', 'intervention'=>'bg-infoxbox-contrat',
 				'members'=>'bg-infoxbox-adherent', 'member'=>'bg-infoxbox-adherent', 'user'=>'bg-infoxbox-adherent', 'users'=>'bg-infoxbox-adherent',
 				'error'=>'pictoerror', 'warning'=>'pictowarning', 'switch_on'=>'font-status4',
-				'holiday'=>'bg-infoxbox-holiday', 'payment'=>'bg-infoxbox-bank_account', 'project'=>'bg-infoxbox-project', 'resource'=>'bg-infoxbox-action',
+				'holiday'=>'bg-infoxbox-holiday', 'payment'=>'bg-infoxbox-bank_account', 'project'=>'bg-infoxbox-project', 'projecttask'=>'bg-infoxbox-project',
+				'resource'=>'bg-infoxbox-action',
 				'ticket'=>'bg-infoxbox-contrat', 'title_hrm'=>'bg-infoxbox-holiday', 'trip'=>'bg-infoxbox-expensereport', 'title_agenda'=>'bg-infoxbox-action',
 				'list-alt'=>'imgforviewmode', 'calendar'=>'imgforviewmode', 'calendarweek'=>'imgforviewmode', 'calendarmonth'=>'imgforviewmode', 'calendarday'=>'imgforviewmode', 'calendarperuser'=>'imgforviewmode'
 			);
@@ -3263,7 +3267,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
 				'edit'=>'#444', 'note'=>'#999', 'error'=>'', 'listlight'=>'#999',
 				'lot'=>'#a69944', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'stock'=>'#a69944',
 				'other'=>'#ddd',
-				'playdisabled'=>'#ccc', 'printer'=>'#444', 'resize'=>'#444', 'rss'=>'#cba',
+				'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'resize'=>'#444', 'rss'=>'#cba',
 				'stats'=>'#444', 'switch_off'=>'#999', 'uparrow'=>'#555', 'warning'=>''
 			);
 			if (isset($arrayconvpictotocolor[$pictowithouttext])) {
@@ -3349,7 +3353,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
  *	@param	int		$srconly			Return only content of the src attribute of img.
  *  @param	int		$notitle			1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip.
  *	@return	string						Return img tag
- *	@see	#img_picto, #img_picto_common
+ *	@see	img_picto(), img_picto_common()
  */
 function img_object($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly = 0, $notitle = 0)
 {
@@ -3365,7 +3369,7 @@ function img_object($titlealt, $picto, $moreatt = '', $pictoisfullpath = false,
  *	@param		int			$pictoisfullpath	If 1, image path is a full path
  *  @param      string      $morecss            More CSS
  *	@return     string      					Return img tag
- *  @see        #img_object, #img_picto
+ *  @see        img_object(), img_picto()
  */
 function img_weather($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $morecss = '')
 {
@@ -3392,7 +3396,7 @@ function img_weather($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $mo
  *	@param		string		$moreatt			Add more attribute on img tag
  *	@param		int			$pictoisfullpath	If 1, image path is a full path
  *	@return     string      					Return img tag
- *  @see        #img_object, #img_picto
+ *  @see        img_object(), img_picto()
  */
 function img_picto_common($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0)
 {
diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php
index 43ff4c978d8..07f9b24476a 100644
--- a/htdocs/fichinter/card.php
+++ b/htdocs/fichinter/card.php
@@ -1395,7 +1395,6 @@ elseif ($id > 0 || !empty($ref))
 				print '
'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans('Duration') : '').'   
'; - print 'rowid.'#'.$objp->rowid.'">'; + print 'rowid.'#'.$objp->rowid.'">'; print img_edit(); print ''; - print ''; - print 'rowid.'">'; + print 'rowid.'">'; print img_delete(); print ''; @@ -1437,13 +1434,13 @@ elseif ($id > 0 || !empty($ref)) { if ($i > 0) { - print 'rowid.'">'; + print 'rowid.'">'; print img_up(); print ''; } if ($i < $num - 1) { - print 'rowid.'">'; + print 'rowid.'">'; print img_down(); print ''; } @@ -1452,7 +1449,7 @@ elseif ($id > 0 || !empty($ref)) } else { - print '  
'; print ''; // ancre pour retourner sur la ligne @@ -1499,8 +1496,9 @@ elseif ($id > 0 || !empty($ref)) } print ''; - print '
'; + print ''; + print '
'; // editeur wysiwyg if (empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) { diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index fdf5a222dee..c371be369f3 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -57,11 +57,12 @@ if ($user->socid > 0) $fichinterstatic = new Fichinter($db); $form = new Form($db); $formfile = new FormFile($db); + $help_url = "EN:ModuleFichinters|FR:Module_Fiche_Interventions|ES:Módulo_FichaInterventiones"; llxHeader("", $langs->trans("Interventions"), $help_url); -print load_fiche_titre($langs->trans("InterventionsArea")); +print load_fiche_titre($langs->trans("InterventionsArea"), '', 'commercial'); print '
'; diff --git a/htdocs/index.php b/htdocs/index.php index 026e6dc8347..d7d15a12fba 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -152,17 +152,18 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) // Class file containing the method load_state_board for each line $includes = array( DOL_DOCUMENT_ROOT."/user/class/user.class.php", - DOL_DOCUMENT_ROOT."/societe/class/client.class.php", + DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php", + DOL_DOCUMENT_ROOT."/societe/class/client.class.php", DOL_DOCUMENT_ROOT."/societe/class/client.class.php", DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php", DOL_DOCUMENT_ROOT."/contact/class/contact.class.php", - DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php", DOL_DOCUMENT_ROOT."/product/class/product.class.php", DOL_DOCUMENT_ROOT."/product/class/product.class.php", DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php", DOL_DOCUMENT_ROOT."/commande/class/commande.class.php", DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php", - DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php", + DOL_DOCUMENT_ROOT."/don/class/don.class.php", + DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php", DOL_DOCUMENT_ROOT."/fichinter/class/fichinter.class.php", DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php", DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php", @@ -170,116 +171,119 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) DOL_DOCUMENT_ROOT."/projet/class/project.class.php", DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php", DOL_DOCUMENT_ROOT."/holiday/class/holiday.class.php", - DOL_DOCUMENT_ROOT."/don/class/don.class.php", DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php" ); // Name class containing the method load_state_board for each line - $classes = array('User', - 'Client', - 'Client', - 'Fournisseur', - 'Contact', - 'Adherent', - 'Product', - 'Product', - 'Propal', - 'Commande', - 'Facture', - 'Contrat', - 'Fichinter', - 'CommandeFournisseur', - 'FactureFournisseur', - 'SupplierProposal', - 'Project', - 'ExpenseReport', - 'Holiday', - 'Don', - 'Ticket', + $classes = array( + 'User', + 'Adherent', + 'Client', + 'Client', + 'Fournisseur', + 'Contact', + 'Product', + 'Product', + 'Propal', + 'Commande', + 'Facture', + 'Don', + 'Contrat', + 'Fichinter', + 'CommandeFournisseur', + 'FactureFournisseur', + 'SupplierProposal', + 'Project', + 'ExpenseReport', + 'Holiday', + 'Ticket', ); // Cle array returned by the method load_state_board for each line - $keys = array('users', - 'customers', - 'prospects', - 'suppliers', - 'contacts', - 'members', - 'products', - 'services', - 'proposals', - 'orders', - 'invoices', - 'contracts', - 'interventions', - 'supplier_orders', - 'supplier_invoices', - 'askprice', - 'projects', - 'expensereports', - 'holidays', - 'donations', - 'ticket' + $keys = array( + 'users', + 'members', + 'customers', + 'prospects', + 'suppliers', + 'contacts', + 'products', + 'services', + 'proposals', + 'orders', + 'invoices', + 'donations', + 'contracts', + 'interventions', + 'supplier_orders', + 'supplier_invoices', + 'askprice', + 'projects', + 'expensereports', + 'holidays', + 'ticket' ); // Dashboard Icon lines - $icons = array('user', - 'company', - 'company', - 'company', - 'contact', - 'user', - 'product', - 'service', - 'propal', - 'order', - 'bill', - 'contract', - 'intervention', - 'order', - 'bill', - 'propal', - 'projectpub', - 'trip', - 'holiday', - 'generic', - 'ticket', + $icons = array( + 'user', + 'user', + 'company', + 'company', + 'company', + 'contact', + 'product', + 'service', + 'propal', + 'order', + 'bill', + 'generic', + 'contract', + 'intervention', + 'order', + 'bill', + 'propal', + 'project', + 'trip', + 'holiday', + 'ticket', ); // Translation keyword - $titres = array("Users", - "ThirdPartyCustomersStats", - "ThirdPartyProspectsStats", - "Suppliers", - "Contacts", - "Members", - "Products", - "Services", - "CommercialProposalsShort", - "CustomersOrders", - "BillsCustomers", - "Contracts", - "Interventions", - "SuppliersOrders", - "SuppliersInvoices", - "SupplierProposalShort", - "Projects", - "ExpenseReports", - "Holidays", - "Donations", - "Ticket", + $titres = array( + "Users", + "Members", + "ThirdPartyCustomersStats", + "ThirdPartyProspectsStats", + "Suppliers", + "Contacts", + "Products", + "Services", + "CommercialProposalsShort", + "CustomersOrders", + "BillsCustomers", + "Donations", + "Contracts", + "Interventions", + "SuppliersOrders", + "SuppliersInvoices", + "SupplierProposalShort", + "Projects", + "ExpenseReports", + "Holidays", + "Ticket", ); // Dashboard Link lines $links = array( DOL_URL_ROOT.'/user/list.php', - DOL_URL_ROOT.'/societe/list.php?type=c&mainmenu=companies', + DOL_URL_ROOT.'/adherents/list.php?statut=1&mainmenu=members', + DOL_URL_ROOT.'/societe/list.php?type=c&mainmenu=companies', DOL_URL_ROOT.'/societe/list.php?type=p&mainmenu=companies', DOL_URL_ROOT.'/societe/list.php?type=f&mainmenu=companies', DOL_URL_ROOT.'/contact/list.php?mainmenu=companies', - DOL_URL_ROOT.'/adherents/list.php?statut=1&mainmenu=members', - DOL_URL_ROOT.'/adherents/list.php?statut=-1&mainmenu=members', DOL_URL_ROOT.'/product/list.php?type=0&mainmenu=products', DOL_URL_ROOT.'/product/list.php?type=1&mainmenu=products', DOL_URL_ROOT.'/comm/propal/list.php?mainmenu=commercial&leftmenu=propals', DOL_URL_ROOT.'/commande/list.php?mainmenu=commercial&leftmenu=orders', DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills', - DOL_URL_ROOT.'/contrat/list.php?mainmenu=commercial&leftmenu=contracts', + DOL_URL_ROOT.'/don/list.php?leftmenu=donations', + DOL_URL_ROOT.'/contrat/list.php?mainmenu=commercial&leftmenu=contracts', DOL_URL_ROOT.'/fichinter/list.php?mainmenu=commercial&leftmenu=ficheinter', DOL_URL_ROOT.'/fourn/commande/list.php?mainmenu=commercial&leftmenu=orders_suppliers', DOL_URL_ROOT.'/fourn/facture/list.php?mainmenu=billing&leftmenu=suppliers_bills', @@ -287,23 +291,23 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) DOL_URL_ROOT.'/projet/list.php?mainmenu=project', DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport', DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&leftmenu=holiday', - DOL_URL_ROOT.'/don/list.php?leftmenu=donations', DOL_URL_ROOT.'/ticket/list.php?leftmenu=ticket' ); // Translation lang files $langfile = array( "users", - "companies", + "members", + "companies", "prospects", "suppliers", "companies", - "members", "products", "products", "propal", "orders", "bills", - "contracts", + "donations", + "contracts", "interventions", "bills", "bills", @@ -311,7 +315,6 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) "projects", "trips", "holiday", - "donations", "ticket" ); @@ -588,7 +591,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { 'groupName' => 'Members', 'globalStatsKey' => 'members', 'stats' => - array('member_shift', 'member_expired'), + array('member_shift', 'member_expired'), ), 'ExpenseReport' => array( @@ -923,6 +926,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) } if (!empty($boxstatFromHook) || !empty($boxstatItems)) { + $boxstat .= ''."\n"; $boxstat .= '
'; $boxstat .= ''; $boxstat .= ''; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 9035df18742..0e793361d2b 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1046,9 +1046,12 @@ class Project extends CommonObject $result = ''; $label = ''; - if ($option != 'nolink') $label = ''.$langs->trans("ShowProject").''; + if ($option != 'nolink') $label = ''.$langs->trans("Project").''; $label .= ($label ? '
' : '').''.$langs->trans('Ref').': '.$this->ref; // The space must be after the : to not being explode when showing the title in img_picto $label .= ($label ? '
' : '').''.$langs->trans('Label').': '.$this->title; // The space must be after the : to not being explode when showing the title in img_picto + if (isset($this->public)) { + $label .= '
'.$langs->trans("Visibility").": ".($this->public ? $langs->trans("SharedProject") : $langs->trans("PrivateProject")); + } if (!empty($this->thirdparty_name)) $label .= ($label ? '
' : '').''.$langs->trans('ThirdParty').': '.$this->thirdparty_name; // The space must be after the : to not being explode when showing the title in img_picto if (!empty($this->dateo)) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 8ed94cc1180..26b00bae2a9 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -289,7 +289,7 @@ else dol_print_error($db); if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0] = '0'; // To avoid sql syntax error if not found $distinct = 'DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once. -$sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut, p.fk_opp_status, p.public, p.fk_user_creat"; +$sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut as status, p.fk_opp_status, p.public, p.fk_user_creat"; $sql .= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, (p.opp_amount*p.opp_percent/100) as opp_weighted_amount, p.tms as date_update, p.budget_amount, p.usage_opportunity, p.usage_task, p.usage_bill_time"; $sql .= ", s.rowid as socid, s.nom as name, s.email"; $sql .= ", cls.code as opp_status_code"; @@ -713,7 +713,9 @@ while ($i < min($num, $limit)) $object->public = $obj->public; $object->ref = $obj->ref; $object->datee = $db->jdate($obj->date_end); - $object->statut = $obj->fk_statut; + $object->statut = $obj->status; // deprecated + $object->status = $obj->status; + $object->public = $obj->public; $object->opp_status = $obj->fk_opp_status; $object->title = $obj->title; diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 3222cbe7964..86d2f96ead3 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -205,7 +205,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES } .bg-infoxbox-project{ - color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; + color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } .bg-infoxbox-action{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 437ef5b498d..32c51d3eef1 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3328,6 +3328,8 @@ if ($action == 'editmeta' || $action == 'createcontainer') { $fuser->fetch($pageauthorid); print $fuser->getNomUrl(1); + } else { + print ''.$langs->trans("Unknown").''; } print ''; From f53dd01d09f196f22d58d4c0b504ea22f727c565 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Apr 2020 02:15:36 +0200 Subject: [PATCH 54/62] Fix css --- htdocs/fichinter/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 07f9b24476a..20f25a1207b 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -825,7 +825,7 @@ if ($action == 'create') $soc = new Societe($db); - print load_fiche_titre($langs->trans("AddIntervention"), '', 'title_commercial'); + print load_fiche_titre($langs->trans("AddIntervention"), '', 'commercial'); dol_htmloutput_mesg($mesg); From 8d59ce2e03de6fd444fe34a89082e526389700f7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Apr 2020 02:48:05 +0200 Subject: [PATCH 55/62] Look and feel v12 --- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/core/lib/functions.lib.php | 29 ++++++++++--------- htdocs/fichinter/class/fichinter.class.php | 6 ++-- htdocs/index.php | 2 +- .../class/supplier_proposal.class.php | 27 ++++++++--------- htdocs/supplier_proposal/list.php | 19 ++++++------ htdocs/theme/eldy/info-box.inc.php | 28 +++++++++--------- htdocs/theme/md/info-box.inc.php | 26 ++++++++--------- 9 files changed, 70 insertions(+), 71 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 41a7107b8d9..f9c3e260e6f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -575,7 +575,7 @@ abstract class CommonObject { $return = '
'; $return .= '
'; - $return .= ''; + $return .= ''; $return .= ''; // Can be image $return .= ''; $return .= '
'; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index c9c99370816..d4e6620c0da 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -994,7 +994,7 @@ class FormFile { $out = '
'; @@ -728,14 +735,6 @@ if ($resql) if (!$i) $totalarray['nbfield']++; } - $url = DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid; - - // Company - $companystatic->id = $obj->socid; - $companystatic->name = $obj->name; - $companystatic->client = $obj->client; - $companystatic->code_client = $obj->code_client; - // Thirdparty if (!empty($arrayfields['s.nom']['checked'])) { @@ -901,7 +900,7 @@ if ($resql) // Status if (!empty($arrayfields['sp.fk_statut']['checked'])) { - print '\n"; + print '\n"; if (!$i) $totalarray['nbfield']++; } diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 86d2f96ead3..0473cb15584 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -204,35 +204,35 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES opacity: 0.95; } -.bg-infoxbox-project{ +.bg-infobox-project{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infoxbox-action{ +.bg-infobox-action{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infoxbox-propal, -.bg-infoxbox-facture, -.bg-infoxbox-commande{ +.bg-infobox-propal, +.bg-infobox-facture, +.bg-infobox-commande{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infoxbox-supplier_proposal, -.bg-infoxbox-invoice_supplier, -.bg-infoxbox-order_supplier{ +.bg-infobox-supplier_proposal, +.bg-infobox-invoice_supplier, +.bg-infobox-order_supplier{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infoxbox-contrat, .bg-infoxbox-ticket{ +.bg-infobox-contrat, .bg-infobox-ticket{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infoxbox-bank_account{ +.bg-infobox-bank_account{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infoxbox-adherent{ +.bg-infobox-adherent{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infoxbox-expensereport{ +.bg-infobox-expensereport{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infoxbox-holiday{ +.bg-infobox-holiday{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } @@ -242,7 +242,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES } .fa-dol-propal:before, .fa-dol-supplier_proposal:before { - content: "\f2b5"; + content: "\f573"; } .fa-dol-facture:before, .fa-dol-invoice_supplier:before { diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index ad1f037ab1e..d9b467f130b 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -110,35 +110,35 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; if (!isset($conf->global->THEME_AGRESSIVENESS_RATIO)) $conf->global->THEME_AGRESSIVENESS_RATIO = -100; if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENESS_RATIO = GETPOST('THEME_AGRESSIVENESS_RATIO', 'int'); ?> -.bg-infoxbox-project i.fa{ +.bg-infobox-project i.fa{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infoxbox-action i.fa{ +.bg-infobox-action i.fa{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infoxbox-propal i.fa, -.bg-infoxbox-facture i.fa, -.bg-infoxbox-commande i.fa{ +.bg-infobox-propal i.fa, +.bg-infobox-facture i.fa, +.bg-infobox-commande i.fa{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infoxbox-supplier_proposal i.fa, -.bg-infoxbox-invoice_supplier i.fa, -.bg-infoxbox-order_supplier i.fa{ +.bg-infobox-supplier_proposal i.fa, +.bg-infobox-invoice_supplier i.fa, +.bg-infobox-order_supplier i.fa{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infoxbox-contrat i.fa, .bg-infoxbox-ticket i.fa{ +.bg-infobox-contrat i.fa, .bg-infobox-ticket i.fa{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infoxbox-bank_account i.fa{ +.bg-infobox-bank_account i.fa{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infoxbox-adherent i.fa{ +.bg-infobox-adherent i.fa{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infoxbox-expensereport i.fa{ +.bg-infobox-expensereport i.fa{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infoxbox-holiday i.fa{ +.bg-infobox-holiday i.fa{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } From fe674f08d911178193ad24a98c21cb013c5b672c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Apr 2020 03:00:10 +0200 Subject: [PATCH 56/62] Fix option WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER --- htdocs/commande/card.php | 7 ++++--- htdocs/commande/class/commande.class.php | 7 +++++-- htdocs/commande/list.php | 5 +++-- htdocs/core/lib/functions.lib.php | 7 ++++--- htdocs/fichinter/class/fichinter.class.php | 2 +- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 2a0675806dc..b43a702c2f2 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -113,7 +113,7 @@ $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc $permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php $permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -if (!empty($conf->expedition->enabled) && $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER = 1) { +if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) $object->warehouse_id = $conf->global->MAIN_DEFAULT_WAREHOUSE; if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) $object->warehouse_id = $user->fk_warehouse; } @@ -1506,9 +1506,10 @@ if ($action == 'create' && $usercancreate) if (!empty($origin) && !empty($originid)) { // Parse element/subelement (ex: project_task) $element = $subelement = $origin; + $regs = array(); if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) { - $element = $regs [1]; - $subelement = $regs [2]; + $element = $regs[1]; + $subelement = $regs[2]; } if ($element == 'project') { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 9ebc0b166dc..c39a5a05a13 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3697,7 +3697,7 @@ class Commande extends CommonOrder $label = ''; if ($user->rights->commande->lire) { - $label = ''.$langs->trans("ShowOrder").''; + $label = ''.$langs->trans("Order").''; $label .= '
'.$langs->trans('Ref').': '.$this->ref; $label .= '
'.$langs->trans('RefCustomer').': '.($this->ref_customer ? $this->ref_customer : $this->ref_client); if (!empty($this->total_ht)) { @@ -3709,6 +3709,9 @@ class Commande extends CommonOrder if (!empty($this->total_ttc)) { $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); } + if (isset($this->statut)) { + $label .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5); + } } $linkclose = ''; @@ -3716,7 +3719,7 @@ class Commande extends CommonOrder { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $label = $langs->trans("ShowOrder"); + $label = $langs->trans("Order"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 43f45b10612..dda9bee327f 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -348,7 +348,7 @@ if ($search_user > 0) $sql .= " AND ec.fk_c_type_contact if ($search_total_ht != '') $sql .= natural_search('c.total_ht', $search_total_ht, 1); if ($search_total_vat != '') $sql .= natural_search('c.tva', $search_total_vat, 1); if ($search_total_ttc != '') $sql .= natural_search('c.total_ttc', $search_total_ttc, 1); -if ($search_warehouse != '') $sql .= natural_search('c.fk_warehouse', $search_warehouse, 1); +if ($search_warehouse != '' && $search_warehouse != '-1') $sql .= natural_search('c.fk_warehouse', $search_warehouse, 1); if ($search_multicurrency_code != '') $sql .= ' AND c.multicurrency_code = "'.$db->escape($search_multicurrency_code).'"'; if ($search_multicurrency_tx != '') $sql .= natural_search('c.multicurrency_tx', $search_multicurrency_tx, 1); if ($search_multicurrency_montant_ht != '') $sql .= natural_search('c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1); @@ -603,7 +603,7 @@ if ($resql) $moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1); $moreforfilter .= ''; } - if (!empty($conf->expedition->enabled) && $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER = 1) { + if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); $moreforfilter .= '
'; @@ -901,6 +901,7 @@ if ($resql) $generic_commande->id = $obj->rowid; $generic_commande->ref = $obj->ref; $generic_commande->statut = $obj->fk_statut; + $generic_commande->billed = $obj->billed; $generic_commande->date = $db->jdate($obj->date_commande); $generic_commande->date_livraison = $db->jdate($obj->date_delivery); $generic_commande->ref_client = $obj->ref_client; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4c7396eb4e5..f6584a49c77 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3147,7 +3147,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'object_accounting', 'object_action', 'object_account', 'object_barcode', 'object_bom', 'object_category', 'object_bookmark', 'object_bug', 'object_generic', 'object_list-alt', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser', 'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_dynamicprice', - 'object_holiday', 'object_hrm', 'object_intervention', 'object_multicurrency', 'object_payment', + 'object_holiday', 'object_hrm', 'object_intervention', 'object_multicurrency', 'object_order', 'object_payment', 'object_lot', 'object_mrp', 'object_product', 'object_propal', 'object_supplier_proposal', 'object_service', 'object_stock', 'object_paragraph', 'object_printer', 'object_project', 'object_projectpub', 'object_propal', 'object_resource', 'object_rss', 'object_projecttask', 'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member', 'object_other', @@ -3187,7 +3187,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star', 'bank'=>'university', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil-alt', 'filter'=>'filter', 'list-alt'=>'list-alt', 'calendar'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarmonth'=>'calendar-alt', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table', - 'intervention'=>'ambulance', 'multicurrency'=>'dollar-sign', + 'intervention'=>'ambulance', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice', 'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle', 'other'=>'square', 'playdisabled'=>'play', 'preview'=>'binoculars', 'project'=>'sitemap', 'projectpub'=>'sitemap', 'projecttask'=>'tasks', 'propal'=>'file-signature', @@ -3251,7 +3251,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'multicurrency'=>'bg-infobox-bank_account', 'check'=>'font-status4', 'hrm'=>'bg-infobox-adherent', 'group'=>'bg-infobox-adherent', 'intervention'=>'bg-infobox-contrat', - 'members'=>'bg-infobox-adherent', 'member'=>'bg-infobox-adherent', 'user'=>'bg-infobox-adherent', 'users'=>'bg-infobox-adherent', + 'members'=>'bg-infobox-adherent', 'member'=>'bg-infobox-adherent', 'order'=>'bg-infobox-commande', + 'user'=>'bg-infobox-adherent', 'users'=>'bg-infobox-adherent', 'error'=>'pictoerror', 'warning'=>'pictowarning', 'switch_on'=>'font-status4', 'holiday'=>'bg-infobox-holiday', 'payment'=>'bg-infobox-bank_account', 'project'=>'bg-infobox-project', 'projecttask'=>'bg-infobox-project', 'propal'=>'bg-infobox-propal', diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index ddc9e701e8a..f8a62da7ba6 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -784,7 +784,7 @@ class Fichinter extends CommonObject $label = ''.$langs->trans("ShowIntervention").''; $label .= '
'.$langs->trans('Ref').': '.$this->ref; if (isset($this->status)) { - $label .= '
'.$langs->trans("Status").": ".$this->status.$this->getLibStatut(5); + $label .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5); } $url = DOL_URL_ROOT.'/fichinter/card.php?id='.$this->id; From d847f67e4564f91049192a4df0f7880723d9d353 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Apr 2020 03:10:26 +0200 Subject: [PATCH 57/62] Look and feel v12 --- htdocs/comm/propal/class/propal.class.php | 9 +++++++-- htdocs/comm/propal/list.php | 8 +++++--- htdocs/fichinter/list.php | 9 +++++---- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 938430ea542..6a2eac53f95 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3658,7 +3658,7 @@ class Propal extends CommonObject if ($user->rights->propal->lire) { - $label = ''.$langs->trans("ShowPropal").''; + $label = ''.$langs->trans("Proposal").''; if (!empty($this->ref)) $label .= '
'.$langs->trans('Ref').': '.$this->ref; if (!empty($this->ref_client)) @@ -3669,6 +3669,11 @@ class Propal extends CommonObject $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); if (!empty($this->total_ttc)) $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + if (isset($this->statut)) { + $label .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5); + } + + if ($option == '') { $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id.$get_params; } @@ -3696,7 +3701,7 @@ class Propal extends CommonObject { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $label = $langs->trans("ShowPropal"); + $label = $langs->trans("Proposal"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 716f2fdd060..955c4f38832 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -287,7 +287,7 @@ $sql .= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s. $sql .= " typent.code as typent_code,"; $sql .= " ava.rowid as availability,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; -$sql .= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,'; +$sql .= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut as status, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,'; $sql .= ' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva as multicurrency_total_vat, p.multicurrency_total_ttc,'; $sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,'; $sql .= ' p.note_public, p.note_private,'; @@ -862,6 +862,8 @@ if ($resql) $objectstatic->ref_client = $obj->ref_client; $objectstatic->note_public = $obj->note_public; $objectstatic->note_private = $obj->note_private; + $objectstatic->statut = $obj->status; + $objectstatic->status = $obj->status; $companystatic->id = $obj->socid; $companystatic->name = $obj->name; @@ -909,7 +911,7 @@ if ($resql) print ''; // Warning $warnornote = ''; - if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) $warnornote .= img_warning($langs->trans("Late")); + if ($obj->status == Propal::STATUS_VALIDATED && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) $warnornote .= img_warning($langs->trans("Late")); if ($warnornote) { print '
'; + print ''; if (!$i) $totalarray['nbfield']++; } // Action column diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index f67e12684fa..7e9dd073925 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -202,7 +202,7 @@ foreach ($arrayfields as $tmpkey => $tmpval) } $sql = "SELECT"; -$sql .= " f.ref, f.rowid, f.fk_statut, f.description, f.datec as date_creation, f.tms as date_update, f.note_private,"; +$sql .= " f.ref, f.rowid, f.fk_statut as status, f.description, f.datec as date_creation, f.tms as date_update, f.note_private,"; if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql .= "fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,"; $sql .= " s.nom as name, s.rowid as socid, s.client, s.fournisseur, s.email, s.status as thirdpartystatus"; if (!empty($conf->projet->enabled)) { @@ -249,7 +249,7 @@ if ($search_desc) { else $sql .= natural_search(array('f.description'), $search_desc); } if ($search_status != '' && $search_status >= 0) { - $sql .= ' AND f.fk_statut = '.$search_status; + $sql .= ' AND f.fk_statut = '.urlencode($search_status); } if (!$user->rights->societe->client->voir && empty($socid)) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; @@ -476,7 +476,8 @@ if ($resql) $objectstatic->id = $obj->rowid; $objectstatic->ref = $obj->ref; - $objectstatic->statut = $obj->fk_statut; + $objectstatic->statut = $obj->status; + $objectstatic->status = $obj->status; $companystatic->name = $obj->name; $companystatic->id = $obj->socid; @@ -587,7 +588,7 @@ if ($resql) // Status if (!empty($arrayfields['f.fk_statut']['checked'])) { - print ''; + print ''; if (!$i) $totalarray['nbfield']++; } // Fields of detail of line From 78474af4862fa285f0c38d2637f73ea82906ca51 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Apr 2020 03:14:44 +0200 Subject: [PATCH 58/62] Link missing --- htdocs/compta/bank/list.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 2e616a6ef48..eaefdfb6573 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -538,7 +538,11 @@ foreach ($accounts as $key=>$type) if ($result < 0) { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); } else { - print ''.$result->nbtodo.''; + print ''; + print ''; + print $result->nbtodo; + print ''; + print ''; if ($result->nbtodolate) { print ''; print ' '.$result->nbtodolate; From afc04faa641647a79fa46fccc8f352934311a3c8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Apr 2020 04:26:16 +0200 Subject: [PATCH 59/62] Fix nb of open tickets --- htdocs/ticket/class/ticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 4ce5948f0b3..863c0c03072 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2808,7 +2808,7 @@ class Ticket extends CommonObject $clause = " AND"; } $sql .= $clause." p.entity IN (".getEntity('ticket').")"; - if ($mode == 'opened') $sql .= " AND p.fk_statut in (".Ticket::STATUS_CLOSED.", ".Ticket::STATUS_CANCELED.")"; + if ($mode == 'opened') $sql .= " AND p.fk_statut NOT IN (".Ticket::STATUS_CLOSED.", ".Ticket::STATUS_CANCELED.")"; if ($user->socid) $sql .= " AND p.fk_soc = ".$user->socid; $resql = $this->db->query($sql); From f816fae86cfd523dfb3c57888100666f11c8ee7d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Apr 2020 12:21:13 +0200 Subject: [PATCH 60/62] Fix a duplicated index --- htdocs/install/mysql/migration/11.0.0-12.0.0.sql | 5 +++++ htdocs/install/mysql/migration/3.5.0-3.6.0.sql | 4 ---- htdocs/product/class/product.class.php | 2 +- .../product/stock/class/mouvementstock.class.php | 16 ++++++++-------- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 628b298329d..681731e27a5 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -45,6 +45,11 @@ UPDATE llx_accounting_system SET fk_country = NULL, active = 0 WHERE pcg_version -- For v12 + +-- Delete an old index that is duplicated +-- VMYSQL4.1 DROP INDEX ix_fk_product_stock on llx_product_batch; +-- VPGSQL8.2 DROP INDEX ix_fk_product_stock + DELETE FROM llx_menu where module='supplier_proposal'; UPDATE llx_website SET lang = 'en' WHERE lang like 'en_%'; diff --git a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql index 65752a542ca..5727b946bcb 100644 --- a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql +++ b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql @@ -216,10 +216,6 @@ ALTER TABLE llx_expeditiondet_batch ADD INDEX idx_fk_expeditiondet (fk_expeditio ALTER TABLE llx_expeditiondet_batch ADD CONSTRAINT fk_expeditiondet_batch_fk_expeditiondet FOREIGN KEY (fk_expeditiondet) REFERENCES llx_expeditiondet(rowid); -ALTER TABLE llx_product_batch ADD INDEX ix_fk_product_stock (fk_product_stock); -ALTER TABLE llx_product_batch ADD CONSTRAINT fk_product_batch_fk_product_stock FOREIGN KEY (fk_product_stock) REFERENCES llx_product_stock (rowid); - - -- New 1074 : Stock mouvement link to origin ALTER TABLE llx_stock_mouvement ADD fk_origin integer; ALTER TABLE llx_stock_mouvement ADD origintype VARCHAR(32); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 8fac5fb3028..c37dbaeb3f7 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4734,7 +4734,7 @@ class Product extends CommonObject $op[1] = "-".trim($nbpiece); $movementstock = new MouvementStock($this->db); - $movementstock->setOrigin($origin_element, $origin_id); + $movementstock->setOrigin($origin_element, $origin_id); // Set ->origin and ->origin->id $result = $movementstock->_create($user, $this->id, $id_entrepot, $op[$movement], $movement, $price, $label, $inventorycode); if ($result >= 0) { diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index b7c92215e2a..5bbc3f9d92c 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -142,7 +142,7 @@ class MouvementStock extends CommonObject require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; - $langs->load("errors"); + $error = 0; dol_syslog(get_class($this)."::_create start userid=$user->id, fk_product=$fk_product, warehouse_id=$entrepot_id, qty=$qty, type=$type, price=$price, label=$label, inventorycode=$inventorycode, datem=".$datem.", eatby=".$eatby.", sellby=".$sellby.", batch=".$batch.", skip_batch=".$skip_batch); @@ -408,13 +408,13 @@ class MouvementStock extends CommonObject $sql .= " ".($batch ? "'".$batch."'" : "null").", "; $sql .= " ".($eatby ? "'".$this->db->idate($eatby)."'" : "null").", "; $sql .= " ".($sellby ? "'".$this->db->idate($sellby)."'" : "null").", "; - $sql .= " ".$this->entrepot_id.", ".$this->qty.", ".$this->type.","; + $sql .= " ".$this->entrepot_id.", ".$this->qty.", ".((int) $this->type).","; $sql .= " ".$user->id.","; $sql .= " '".$this->db->escape($label)."',"; $sql .= " ".($inventorycode ? "'".$this->db->escape($inventorycode)."'" : "null").","; - $sql .= " '".price2num($price)."',"; - $sql .= " '".$fk_origin."',"; - $sql .= " '".$origintype."',"; + $sql .= " ".price2num($price).","; + $sql .= " ".$fk_origin.","; + $sql .= " '".$this->db->escape($origintype)."',"; $sql .= " ".$fk_project; $sql .= ")"; @@ -438,7 +438,7 @@ class MouvementStock extends CommonObject $oldpmp = $product->pmp; $oldqtywarehouse = 0; - // Test if there is already a record for couple (warehouse / product) + // Test if there is already a record for couple (warehouse / product), so later we will make an update or create. $alreadyarecord = 0; if (!$error) { @@ -486,7 +486,7 @@ class MouvementStock extends CommonObject } elseif ($type == 1 || $type == 2) { - // After a stock decrease, we don't change value of PMP for product. + // After a stock decrease, we don't change value of the AWP/PMP of a product. $newpmp = $oldpmp; } else @@ -543,7 +543,7 @@ class MouvementStock extends CommonObject // $sql = "UPDATE ".MAIN_DB_PREFIX."product SET pmp = ".$newpmp.", stock = ".$this->db->ifsql("stock IS NULL", 0, "stock") . " + ".$qty; // $sql.= " WHERE rowid = ".$fk_product; // Update pmp + denormalized fields because we change content of produt_stock. Warning: Do not use "SET p.stock", does not works with pgsql - $sql = "UPDATE ".MAIN_DB_PREFIX."product as p SET pmp = ".$newpmp.", "; + $sql = "UPDATE ".MAIN_DB_PREFIX."product as p SET pmp = ".$newpmp.","; $sql .= " stock=(SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock as ps WHERE ps.fk_product = p.rowid)"; $sql .= " WHERE rowid = ".$fk_product; From b92c03cdf6e16cc9661167bb93393f327324da6f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Apr 2020 13:20:09 +0200 Subject: [PATCH 61/62] Fix Look and feel v12 --- htdocs/takepos/index.php | 2 ++ htdocs/takepos/invoice.php | 13 ++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index bba62298989..0688d4a8584 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -763,8 +763,10 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { echo ' - '.dol_print_date(dol_now(), "day").''; ?> +
+
diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 77254be543f..e358b24602a 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -733,7 +733,7 @@ function DolibarrTakeposPrinting(id) { $( document ).ready(function() { - console.log("Set customer info in header"); + console.log("Set customer info and sales in header"); trans("Customer"); @@ -742,7 +742,9 @@ $( document ).ready(function() { } ?> - $("#customerandsales").html(''); + $("#customerandsales").html(''); + + $("#customerandsales").append(''); fetch_object($resql)) { echo '$("#customerandsales").append(\''; - if ($placeid == $obj->rowid) echo ""; echo 'ref)); echo $num_sale; if (str_replace("-", "", $num_sale) > $max_sale) $max_sale = str_replace("-", "", $num_sale); - echo '\\\';Refresh();">'.date('H:i', strtotime($obj->datec)); + echo '\\\';Refresh();">'; + if ($placeid == $obj->rowid) echo ""; + echo date('H:i', strtotime($obj->datec)); if ($placeid == $obj->rowid) echo ""; echo '\');'; } @@ -787,7 +790,7 @@ $( document ).ready(function() { adherent->enabled) && $invoice->socid != $conf->global->$constforcompanyid) + if (!empty($conf->adherent->enabled) && $invoice->socid > 0 && $invoice->socid != $conf->global->$constforcompanyid) { $s = ''; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; From c7fab6a83e42e14b7563f6b54903ce65ee7ea375 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Apr 2020 13:26:06 +0200 Subject: [PATCH 62/62] Fix no tooltip of not predefined products --- htdocs/takepos/invoice.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index e358b24602a..adbf403491e 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -944,6 +944,7 @@ if ($placeid > 0) if (is_array($invoice->lines) && count($invoice->lines)) { + print ''."\n"; $tmplines = array_reverse($invoice->lines); foreach ($tmplines as $line) { @@ -993,11 +994,14 @@ if ($placeid > 0) else $htmlforlines .= img_object('', 'service').' '; } if (empty($conf->global->TAKEPOS_SHOW_N_FIRST_LINES)) { - $tooltiptext = ''.$langs->trans("Ref").' : '.$line->product_ref.'
'; - $tooltiptext .= ''.$langs->trans("Label").' : '.$line->product_label.'
'; - if ($line->product_label != $line->desc) { - if ($line->desc) $tooltiptext .= '
'; - $tooltiptext .= $line->desc; + $tooltiptext = ''; + if ($line->product_ref) { + $tooltiptext .= ''.$langs->trans("Ref").' : '.$line->product_ref.'
'; + $tooltiptext .= ''.$langs->trans("Label").' : '.$line->product_label.'
'; + if ($line->product_label != $line->desc) { + if ($line->desc) $tooltiptext .= '
'; + $tooltiptext .= $line->desc; + } } $htmlforlines .= $form->textwithpicto($line->product_label ? $line->product_label : ($line->product_ref ? $line->product_ref : dolGetFirstLineOfText($line->desc, 1)), $tooltiptext); } else {
'.$objectstatic->LibStatut($obj->fk_statut, 5)."'.$objectstatic->getLibStatut(5)."'; @@ -1232,7 +1234,7 @@ if ($resql) // Status if (!empty($arrayfields['p.fk_statut']['checked'])) { - print ''.$objectstatic->LibStatut($obj->fk_statut, 5).''.$objectstatic->getLibStatut(5).''.$objectstatic->LibStatut($obj->fk_statut, 5).''.$objectstatic->getLibStatut(5).'