From 62bc6e9e1f383db48d7dc7351f1a90fc227c8cc2 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 20 May 2021 13:15:32 +0200 Subject: [PATCH] on going --- htdocs/compta/facture/list.php | 23 +++++++++++++--- htdocs/core/class/html.form.class.php | 39 ++++++++++++++++----------- htdocs/langs/en_US/bills.lang | 3 ++- 3 files changed, 46 insertions(+), 19 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 282aad95d89..6bf02d5d580 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -363,7 +363,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } -if ($massaction == 'makepayment') { +if ($massaction == 'makepayment_confirm') { $arrayofselected = is_array($toselect) ? $toselect : array(); $loc = dol_buildpath('/compta/paiement.php', 2).'?action=create&facids='.implode(',', $arrayofselected); @@ -948,8 +948,10 @@ if ($resql) { 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), - //'makepayment'=>$langs->trans("InvoicePaymentsLimits"), TODO Blank page when using this ); + if ($user->rights->facture->paiement) { + $arrayofmassactions['makepayment'] = $langs->trans("RegisterPaymentAndClasiffiedPayed"); + } if ($conf->prelevement->enabled && !empty($user->rights->prelevement->bons->creer)) { $langs->load("withdrawals"); $arrayofmassactions['withdrawrequest'] = $langs->trans("MakeWithdrawRequest"); @@ -961,7 +963,7 @@ if ($resql) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } } - if (in_array($massaction, array('presend', 'predelete'))) { + if (in_array($massaction, array('presend', 'predelete' ,'makepayment'))) { $arrayofmassactions = array(); } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); @@ -997,6 +999,21 @@ if ($resql) { $trackid = 'inv'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + if ($massaction=='makepayment') { + $formconfirm = ''; + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + array('type' => 'date', 'name' => 'datepaiment', 'label' => $langs->trans("Date")), + array('type' => 'other', 'name' => 'paiementid', 'label' => $langs->trans("PaymentMode"), 'value' => $form->select_types_paiements(GETPOST('search_paymentmode'), 'paiementid', '', 2, 0, 1, 0, 1, '', 1)), + array('type' => 'other', 'name' => 'bankid', 'label' => $langs->trans("Date"), 'value'=>$form->select_comptes('', 'bankid', 0, '', 0, '', 0, '', 1)), + //array('type' => 'other', 'name' => 'invoicesid', 'label' => '', 'value'=>''), + ); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('RegisterPaymentAndClasiffiedPayed'), $langs->trans('RegisterPaymentAndClasiffiedPayed', $object->ref), 'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1); + print $formconfirm; + } + if ($sall) { foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 57bbbe3a029..763a3da6c57 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3914,13 +3914,16 @@ class Form * @param int $maxlength Max length of label * @param int $active Active or not, -1 = all * @param string $morecss Add more CSS on select tag + * @param int $nooutput 1=Return string, do not send to output * @return void */ - public function select_types_paiements($selected = '', $htmlname = 'paiementtype', $filtertype = '', $format = 0, $empty = 1, $noadmininfo = 0, $maxlength = 0, $active = 1, $morecss = '') + public function select_types_paiements($selected = '', $htmlname = 'paiementtype', $filtertype = '', $format = 0, $empty = 1, $noadmininfo = 0, $maxlength = 0, $active = 1, $morecss = '', $nooutput = 0) { // phpcs:enable global $langs, $user, $conf; + $out = ''; + dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); $filterarray = array(); @@ -3939,9 +3942,9 @@ class Form $selected = $conf->global->MAIN_DEFAULT_PAYMENT_TYPE_ID; } - print ''; if ($empty) { - print ''; + $out .= ''; } foreach ($this->cache_types_paiements as $id => $arraytypes) { // If not good status @@ -3960,25 +3963,25 @@ class Form } if ($format == 0) { - print ''; + $out .= $value ? $value : ' '; + $out .= ''; } - print ''; + $out .= ''; if ($user->admin && !$noadmininfo) { - print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + } + $out .= ajax_combobox('select'.$htmlname); + + if (empty($nooutput)) { + print $out; + } else { + return $out; } - print ajax_combobox('select'.$htmlname); } diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 940da4e35b4..1ccdd162719 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -589,4 +589,5 @@ FacParentLine=Invoice Line Parent SituationTotalRayToRest=Remainder to pay without taxe PDFSituationTitle=Situation n° %d SituationTotalProgress=Total progress %d %% -SearchUnpaidInvoicesWithDueDate=Search unpaid invoices with a due date = %s \ No newline at end of file +SearchUnpaidInvoicesWithDueDate=Search unpaid invoices with a due date = %s +RegisterPaymentAndClasiffiedPayed=Enter payment and Classify 'Paid'