This commit is contained in:
Florian HENRY 2021-05-20 13:15:32 +02:00
parent a3c28edfbb
commit 62bc6e9e1f
3 changed files with 46 additions and 19 deletions

View File

@ -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'=>'<input type="hidden" id="invoicesid" name="invoicesid" value="'.implode('#',GETPOST('toselect','array')).'">'),
);
$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);

View File

@ -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 '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
$out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
if ($empty) {
print '<option value="">&nbsp;</option>';
$out .= '<option value="">&nbsp;</option>';
}
foreach ($this->cache_types_paiements as $id => $arraytypes) {
// If not good status
@ -3960,25 +3963,25 @@ class Form
}
if ($format == 0) {
print '<option value="'.$id.'"';
$out .= '<option value="'.$id.'"';
} elseif ($format == 1) {
print '<option value="'.$arraytypes['code'].'"';
$out .= '<option value="'.$arraytypes['code'].'"';
} elseif ($format == 2) {
print '<option value="'.$arraytypes['code'].'"';
$out .= '<option value="'.$arraytypes['code'].'"';
} elseif ($format == 3) {
print '<option value="'.$id.'"';
$out .= '<option value="'.$id.'"';
}
// Print attribute selected or not
if ($format == 1 || $format == 2) {
if ($selected == $arraytypes['code']) {
print ' selected';
$out .= ' selected';
}
} else {
if ($selected == $id) {
print ' selected';
$out .= ' selected';
}
}
print '>';
$out .= '>';
if ($format == 0) {
$value = ($maxlength ?dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']);
} elseif ($format == 1) {
@ -3988,14 +3991,20 @@ class Form
} elseif ($format == 3) {
$value = $arraytypes['code'];
}
print $value ? $value : '&nbsp;';
print '</option>';
$out .= $value ? $value : '&nbsp;';
$out .= '</option>';
}
print '</select>';
$out .= '</select>';
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);
}

View File

@ -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
SearchUnpaidInvoicesWithDueDate=Search unpaid invoices with a due date = %s
RegisterPaymentAndClasiffiedPayed=Enter payment and Classify 'Paid'