Merge pull request #19383 from atm-gauthier/NEW/accountancy_massaction_preselect_account_customer_and_supplier_list
NEW : accountancy massaction preselect account (customer and supplier list)
This commit is contained in:
commit
02bad082d6
@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -46,6 +47,7 @@ $show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$default_account = GETPOST('default_account', 'int');
|
||||
|
||||
// Select Box
|
||||
$mesCasesCochees = GETPOST('toselect', 'array');
|
||||
@ -434,12 +436,15 @@ if ($result) {
|
||||
|
||||
$arrayofmassactions = array(
|
||||
'ventil'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Ventilate")
|
||||
,'set_default_account'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("ConfirmPreselectAccount")
|
||||
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||
if ($massaction !== 'set_default_account') {
|
||||
$massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||
}
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'."\n";
|
||||
print '<input type="hidden" name="action" value="ventil">';
|
||||
@ -454,6 +459,14 @@ if ($result) {
|
||||
|
||||
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||
|
||||
if ($massaction == 'set_default_account') {
|
||||
$formquestion[]=array('type' => 'other',
|
||||
'name' => 'set_default_account',
|
||||
'label' => $langs->trans("AccountancyCode"),
|
||||
'value' => $formaccounting->select_account('', 'default_account', 1, array(), 0, 0, 'maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'));
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmPreselectAccount"), $langs->trans("ConfirmPreselectAccountQuestion", count($toselect)), "confirm_set_default_account", $formquestion, 1, 0, 200, 500, 1);
|
||||
}
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer").'</span></br><br>';
|
||||
|
||||
if ($msg) {
|
||||
@ -712,7 +725,7 @@ if ($result) {
|
||||
|
||||
// Suggested accounting account
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($suggestedid, 'codeventil'.$facture_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facture_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print '</td>';
|
||||
|
||||
// Column with checkbox
|
||||
@ -721,6 +734,14 @@ if ($result) {
|
||||
if (!empty($suggestedid) && $suggestedaccountingaccountfor != '' && $suggestedaccountingaccountfor != 'eecwithoutvatnumber') {
|
||||
$ischecked = 1;
|
||||
}
|
||||
|
||||
if (!empty($toselect)) {
|
||||
$ischecked = 0;
|
||||
if (in_array($objp->rowid."_".$i, $toselect)) {
|
||||
$ischecked=1;
|
||||
}
|
||||
}
|
||||
|
||||
print '<input type="checkbox" class="flat checkforselect checkforselect'.$facture_static_det->id.'" name="toselect[]" value="'.$facture_static_det->id."_".$i.'"'.($ischecked ? " checked" : "").'/>';
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
@ -47,6 +48,7 @@ $show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$default_account = GETPOST('default_account', 'int');
|
||||
|
||||
// Select Box
|
||||
$mesCasesCochees = GETPOST('toselect', 'array');
|
||||
@ -442,12 +444,15 @@ if ($result) {
|
||||
|
||||
$arrayofmassactions = array(
|
||||
'ventil'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Ventilate")
|
||||
,'set_default_account'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("ConfirmPreselectAccount")
|
||||
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||
if ($massaction !== 'set_default_account') {
|
||||
$massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||
}
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'."\n";
|
||||
print '<input type="hidden" name="action" value="ventil">';
|
||||
@ -462,6 +467,14 @@ if ($result) {
|
||||
|
||||
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||
|
||||
if ($massaction == 'set_default_account') {
|
||||
$formquestion[]=array('type' => 'other',
|
||||
'name' => 'set_default_account',
|
||||
'label' => $langs->trans("AccountancyCode"),
|
||||
'value' => $formaccounting->select_account('', 'default_account', 1, array(), 0, 0, 'maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'));
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmPreselectAccount"), $langs->trans("ConfirmPreselectAccountQuestion", count($toselect)), "confirm_set_default_account", $formquestion, 1, 0, 200, 500, 1);
|
||||
}
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer").'</span></br><br>';
|
||||
|
||||
if ($msg) {
|
||||
@ -736,7 +749,7 @@ if ($result) {
|
||||
|
||||
// Suggested accounting account
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($suggestedid, 'codeventil'.$facturefourn_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facturefourn_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print '</td>';
|
||||
|
||||
// Column with checkbox
|
||||
@ -745,6 +758,14 @@ if ($result) {
|
||||
if (!empty($suggestedid) && $suggestedaccountingaccountfor != '' && $suggestedaccountingaccountfor != 'eecwithoutvatnumber') {
|
||||
$ischecked = 1;
|
||||
}
|
||||
|
||||
if (!empty($toselect)) {
|
||||
$ischecked = 0;
|
||||
if (in_array($objp->rowid."_".$i, $toselect)) {
|
||||
$ischecked=1;
|
||||
}
|
||||
}
|
||||
|
||||
print '<input type="checkbox" class="flat checkforselect checkforselect'.$facturefourn_static_det->id.'" name="toselect[]" value="'.$facturefourn_static_det->id."_".$i.'"'.($ischecked ? " checked" : "").'/>';
|
||||
print '</td>';
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user