diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index 0eac0c761c7..4a3eb6b4421 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -52,9 +52,13 @@ dol_include_once('/mymodule/class/skeleton_class.class.php'); $langs->load("mymodule"); $langs->load("other"); -// Get parameters +$action=GETPOST('action','alpha'); +$massaction=GETPOST('massaction','alpha'); +$show_files=GETPOST('show_files','int'); +$confirm=GETPOST('confirm','alpha'); +$toselect = GETPOST('toselect', 'array'); + $id = GETPOST('id','int'); -$action = GETPOST('action','alpha'); $backtopage = GETPOST('backtopage'); $myparam = GETPOST('myparam','alpha'); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index ec1065d65c3..f63e262e2bb 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -42,10 +42,14 @@ $langs->load("main"); $langs->load("accountancy"); $langs->load("productbatch"); -$action = GETPOST('action'); +$action=GETPOST('action','alpha'); +$massaction=GETPOST('massaction','alpha'); +$show_files=GETPOST('show_files','int'); +$confirm=GETPOST('confirm','alpha'); +$toselect = GETPOST('toselect', 'array'); // Select Box -$mesCasesCochees = GETPOST('mesCasesCochees', 'array'); +$mesCasesCochees = GETPOST('toselect', 'array'); // Search Getpost $search_invoice = GETPOST('search_invoice', 'alpha'); @@ -90,6 +94,9 @@ $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOU * Action */ +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } + // Purge search criteria if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers { @@ -102,11 +109,19 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $search_vat = ''; } -if ($action == 'ventil' && ! empty($btn_ventil)) { +// Mass actions +$objectclass='Skeleton'; +$objectlabel='Skeleton'; +$permtoread = $user->rights->accounting->read; +$permtodelete = $user->rights->accounting->delete; +$uploaddir = $conf->accounting->dir_output; +include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; + +if ($massaction == 'ventil') { $msg=''; //print '
' . $langs->trans("Processing") . '...
'; if (! empty($mesCasesCochees)) { - $msg = '
' . $langs->trans("SelectedLines") . ': '.count($_POST["mesCasesCochees"]).'
'; + $msg = '
' . $langs->trans("SelectedLines") . ': '.count($mesCasesCochees).'
'; $msg.='
'; $cpt = 0; $ok=0; @@ -144,10 +159,10 @@ if ($action == 'ventil' && ! empty($btn_ventil)) { $cpt++; } $msg.='
'; - } else { - setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings'); + $msg.= '
' . $langs->trans("EndProcessing") . '
'; + //} else { + // setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings'); } - $msg.= '
' . $langs->trans("EndProcessing") . '
'; } @@ -156,6 +171,8 @@ if ($action == 'ventil' && ! empty($btn_ventil)) { * View */ +$form = new Form($db); + llxHeader('', $langs->trans("Ventilation")); // Customer Invoice lines @@ -219,6 +236,16 @@ if ($result) { if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + $arrayofmassactions = array( + 'ventil'=>$langs->trans("Ventilate") + //'presend'=>$langs->trans("SendByMail"), + //'builddoc'=>$langs->trans("PDFMerge"), + ); + //if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); + //if ($massaction == 'presend') $arrayofmassactions=array(); + $massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1); + + print '
' . "\n"; print ''; if ($optioncss != '') print ''; @@ -227,9 +254,9 @@ if ($result) { print ''; print ''; - $center='
'; + //$center='
'; - print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); + print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); print $langs->trans("DescVentilTodoCustomer") . '

'; @@ -250,7 +277,7 @@ if ($result) { print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"'); print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"'); print_liste_field_titre('', '', '', '', '', 'align="center"'); - print ''; + print "\n"; // We add search filter print ''; @@ -265,7 +292,7 @@ if ($result) { print ''; print ''; print ''; - $searchpitco=$form->showFilterAndCheckAddButtons(1); + $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); print $searchpitco; print ''; print ''; @@ -352,7 +379,7 @@ if ($result) { print price($objp->tva_tx_line); print ''; - // Suggested accounting account + // Current account print ''; print (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")) . ' = ' . ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : $langs->trans("Unknown")); if ($objp->product_id > 0) @@ -362,12 +389,13 @@ if ($result) { } print ''; + // Suggested accounting account print ''; print $formventilation->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; print ''; - print 'aarowid ? "checked" : "") . '/>'; + print 'aarowid ? "checked" : "") . '/>'; print ''; print ''; $i ++; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index ef7acac9ad0..01e723806cc 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -42,7 +42,11 @@ $langs->load("main"); $langs->load("accountancy"); $langs->load("productbatch"); -$action = GETPOST('action'); +$action=GETPOST('action','alpha'); +$massaction=GETPOST('massaction','alpha'); +$show_files=GETPOST('show_files','int'); +$confirm=GETPOST('confirm','alpha'); +$toselect = GETPOST('toselect', 'array'); // Select Box $mesCasesCochees = GETPOST('mesCasesCochees', 'array'); @@ -145,10 +149,10 @@ if ($action == 'ventil' && ! empty($btn_ventil)) { $cpt++; } $msg.=''; + $msg.= '
' . $langs->trans("EndProcessing") . '
'; } else { setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings'); } - $msg.= '
' . $langs->trans("EndProcessing") . '
'; } @@ -156,6 +160,9 @@ if ($action == 'ventil' && ! empty($btn_ventil)) { /* * View */ + +$form = new Form($db); + llxHeader('', $langs->trans("ExpenseReportsVentilation")); // Expense report lines diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index daafd1d7b13..5bd164a2a54 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -42,10 +42,14 @@ $langs->load("main"); $langs->load("accountancy"); $langs->load("productbatch"); -$action = GETPOST('action'); +$action=GETPOST('action','alpha'); +$massaction=GETPOST('massaction','alpha'); +$show_files=GETPOST('show_files','int'); +$confirm=GETPOST('confirm','alpha'); +$toselect = GETPOST('toselect', 'array'); // Select Box -$mesCasesCochees = GETPOST('mesCasesCochees', 'array'); +$mesCasesCochees = GETPOST('toselect', 'array'); // Search Getpost $search_invoice = GETPOST('search_invoice', 'alpha'); @@ -81,12 +85,7 @@ if (! $user->rights->accounting->bind->write) accessforbidden(); $formventilation = new FormVentilation($db); - -// Defaut AccountingAccount RowId Product / Service -// at this time ACCOUNTING_SERVICE_SOLD_ACCOUNT & ACCOUNTING_PRODUCT_SOLD_ACCOUNT are account number not accountingacount rowid -// so we need to get those default value rowid first $accounting = new AccountingAccount($db); - // TODO: we should need to check if result is a really exist accountaccount rowid..... $aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1); $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1); @@ -96,10 +95,14 @@ $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUN * Action */ +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } + // Purge search criteria if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers { $search_ref = ''; + $search_invoice = ''; $search_label = ''; $search_desc = ''; $search_amount = ''; @@ -107,11 +110,19 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $search_vat = ''; } -if ($action == 'ventil' && ! empty($btn_ventil)) { +// Mass actions +$objectclass='Skeleton'; +$objectlabel='Skeleton'; +$permtoread = $user->rights->accounting->read; +$permtodelete = $user->rights->accounting->delete; +$uploaddir = $conf->accounting->dir_output; +include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; + +if ($massaction == 'ventil') { $msg=''; //print '
' . $langs->trans("Processing") . '...
'; if (! empty($mesCasesCochees)) { - $msg = '
' . $langs->trans("SelectedLines") . ': '.count($_POST["mesCasesCochees"]).'
'; + $msg = '
' . $langs->trans("SelectedLines") . ': '.count($mesCasesCochees).'
'; $msg.='
'; $mesCodesVentilChoisis = $codeventil; $cpt = 0; @@ -119,7 +130,6 @@ if ($action == 'ventil' && ! empty($btn_ventil)) { $ko=0; foreach ( $mesCasesCochees as $maLigneCochee ) { - // print '
id selectionnee : '.$monChoix."
"; $maLigneCourante = explode("_", $maLigneCochee); $monId = $maLigneCourante[0]; $monCompte = GETPOST('codeventil'.$monId); @@ -140,21 +150,21 @@ if ($action == 'ventil' && ! empty($btn_ventil)) { dol_syslog('accountancy/supplier/list.php:: sql=' . $sql, LOG_DEBUG); if ($db->query($sql)) { - $ok++; $msg.= '
' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '
'; + $ok++; } else { - $ko++; $msg.= '
' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '
' . $sql . '
'; + $ko++; } } $cpt++; } $msg.='
'; - } else { - setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings'); + $msg.= '
' . $langs->trans("EndProcessing") . '
'; + //} else { + // setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings'); } - $msg.= '
' . $langs->trans("EndProcessing") . '
'; } @@ -162,6 +172,9 @@ if ($action == 'ventil' && ! empty($btn_ventil)) { /* * View */ + +$form = new Form($db); + llxHeader('', $langs->trans("SuppliersVentilation")); // Supplier Invoice Lines @@ -225,6 +238,16 @@ if ($result) { if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + $arrayofmassactions = array( + 'ventil'=>$langs->trans("Ventilate") + //'presend'=>$langs->trans("SendByMail"), + //'builddoc'=>$langs->trans("PDFMerge"), + ); + //if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); + //if ($massaction == 'presend') $arrayofmassactions=array(); + $massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1); + + print '' . "\n"; print ''; if ($optioncss != '') print ''; @@ -233,15 +256,15 @@ if ($result) { print ''; print ''; - $center='
'; + //$center='
'; - print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); + print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); + + print $langs->trans("DescVentilTodoCustomer") . '

'; if ($msg) print $msg.'
'; - print $langs->trans("DescVentilTodoCustomer") . '

'; - - $moreforfilter = ''; + $moreforfilter = ''; print ''."\n"; print ''; @@ -259,6 +282,7 @@ if ($result) { print_liste_field_titre('', '', '', '', '', 'align="center"'); print "\n"; + // We add search filter print ''; print ''; print ''; @@ -272,7 +296,7 @@ if ($result) { print ''; print ''; print ''; print ''; @@ -281,7 +305,7 @@ if ($result) { $productfourn_static = new ProductFournisseur($db); $form = new Form($db); - $var = True; + $var = true; while ( $i < min($num_lines, $limit) ) { $objp = $db->fetch_object($result); $var = ! $var; @@ -317,7 +341,7 @@ if ($result) { if ($objp->code_buy_l == -1) $objp->code_buy_l=''; if (! empty($objp->code_buy)) { - $objp->code_buy_p = $objp->code_buy; + $objp->code_buy_p = $objp->code_buy; // Code on product } else { $code_buy_p_notset = 'color:orange'; } @@ -365,7 +389,7 @@ if ($result) { print price($objp->tva_tx_line); print ''; - // Accounting account suggested + // Current account print ''; print ""; diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 42a73f0bbde..3acb974deae 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -41,7 +41,7 @@ $maxformassaction=1000; if (! empty($massaction) && count($toselect) < 1) { $error++; - setEventMessages($langs->trans("NoLineChecked"), null, "warnings"); + setEventMessages($langs->trans("NoRecordSelected"), null, "warnings"); } if (! $error && count($toselect) > $maxformassaction) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1f3883738d1..75d62b76184 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -509,11 +509,12 @@ class Form /** * Generate select HTML to choose massaction * - * @param string $selected Selected value + * @param string $selected Value auto selected when at least one record is selected. Not a preselected value. Use '0' by default. * @param int $arrayofaction array('code'=>'label', ...). The code is the key stored into the GETPOST('massaction') when submitting action. + * @param int $alwaysvisible 1=select button always visible * @return string Select list */ - function selectMassAction($selected, $arrayofaction) + function selectMassAction($selected, $arrayofaction, $alwaysvisible=0) { global $conf,$langs,$hookmanager; @@ -521,7 +522,7 @@ class Form $disabled=0; $ret='
'; - $ret.=''; $ret.=''; foreach($arrayofaction as $code => $label) { @@ -529,50 +530,55 @@ class Form } $ret.=''; // Warning: if you set submit button to disabled, post using 'Enter' will no more work. - $ret.=''; + $ret.=''; $ret.='
'; - $ret.=' - - '; - + if (! empty($conf->use_javascript_ajax)) + { + $ret.=' + + '; + } + return $ret; }
'; - $searchpitco=$form->showFilterAndCheckAddButtons(1); + $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); print $searchpitco; print '
'; print (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")) . ' = ' . ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : $langs->trans("Unknown")); if ($objp->product_id > 0) @@ -382,7 +406,7 @@ if ($result) { // Colonne choix ligne a ventiler print ''; - print 'aarowid ? "checked" : "") . '/>'; + print 'aarowid ? "checked" : "") . '/>'; print '