diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index f63e262e2bb..8d759de5e01 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -190,25 +190,25 @@ $sql .= " AND product_type <= 2"; $sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')"; // Add search filter like if (strlen(trim($search_invoice))) { - $sql .= " AND (f.facnumber like '%" . $search_invoice . "%')"; + $sql .= natural_search("f.facnumber",$search_invoice); } if (strlen(trim($search_ref))) { - $sql .= " AND (p.ref like '%" . $search_ref . "%')"; + $sql .= natural_search("p.ref",$search_ref); } if (strlen(trim($search_label))) { - $sql .= " AND (p.label like '%" . $search_label . "%')"; + $sql .= natural_search("p.label",$search_label); } if (strlen(trim($search_desc))) { - $sql .= " AND (l.description like '%" . $search_desc . "%')"; + $sql .= natural_search("l.description",$search_desc); } if (strlen(trim($search_amount))) { - $sql .= " AND l.total_ht like '" . $search_amount . "%'"; + $sql .= natural_search("l.total_ht",$search_amount,1); } if (strlen(trim($search_account))) { - $sql .= " AND aa.account_number like '%" . $search_account . "%'"; + $sql .= natural_search("aa.account_number",$search_account); } if (strlen(trim($search_vat))) { - $sql .= " AND (l.tva_tx like '" . $search_vat . "%')"; + $sql .= natural_search("l.tva_tx",$search_vat,1); } $sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy @@ -286,7 +286,7 @@ if ($result) { print ''; print ''; //print ''; - print ''; + print ''; print ''; print '%'; print ''; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 01e723806cc..d583ec38d42 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -49,7 +49,7 @@ $confirm=GETPOST('confirm','alpha'); $toselect = GETPOST('toselect', 'array'); // Select Box -$mesCasesCochees = GETPOST('mesCasesCochees', 'array'); +$mesCasesCochees = GETPOST('toselect', 'array'); // Search Getpost $search_expensereport = GETPOST('search_expensereport', 'alpha'); @@ -84,16 +84,16 @@ 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); + /* * 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 { @@ -105,11 +105,19 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $search_vat = ''; } -if ($action == 'ventil' && ! empty($btn_ventil)) { - $msg=''; +// 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; @@ -117,7 +125,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); @@ -138,11 +145,11 @@ if ($action == 'ventil' && ! empty($btn_ventil)) { dol_syslog('accountancy/expensereport/list.php:: sql=' . $sql, LOG_DEBUG); if ($db->query($sql)) { - $ok++; $msg.= '
' . $langs->trans("LineOfExpenseReport") . ' ' . $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++; } } @@ -150,8 +157,8 @@ if ($action == 'ventil' && ! empty($btn_ventil)) { } $msg.='
'; $msg.= '
' . $langs->trans("EndProcessing") . '
'; - } else { - setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings'); + //} else { + // setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings'); } } @@ -179,22 +186,22 @@ $sql .= " WHERE er.fk_statut > 4 AND erd.fk_code_ventilation <= 0"; $sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR f.accountancy_code IS NULL OR f.accountancy_code ='')"; // Add search filter like if (strlen(trim($search_expensereport))) { - $sql .= " AND (er.ref like '%" . $search_expensereport . "%')"; + $sql .= natural_search("er.ref",$search_expensereport); } if (strlen(trim($search_label))) { - $sql .= " AND (f.label like '%" . $search_label . "%')"; + $sql .= natural_search("f.label",$search_label); } if (strlen(trim($search_desc))) { - $sql .= " AND (erd.comments like '%" . $search_desc . "%')"; + $sql .= natural_search("erd.comments",$search_desc); } if (strlen(trim($search_amount))) { - $sql .= " AND erd.total_ht like '" . $search_amount . "%'"; + $sql .= natural_search("erd.total_ht",$search_amount,1); } if (strlen(trim($search_account))) { - $sql .= " AND aa.account_number like '%" . $search_account . "%'"; + $sql .= natural_search("aa.account_number",$search_account); } if (strlen(trim($search_vat))) { - $sql .= " AND (erd.tva_tx like '" . $search_vat . "%')"; + $sql .= natural_search("erd.tva_tx",$search_vat,1); } $sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don't share object for accountancy @@ -222,6 +229,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 ''; @@ -230,14 +247,14 @@ if ($result) { print ''; print ''; - $center='
'; + //$center='
'; - print_barre_liste($langs->trans("ExpenseReportLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); - - if ($msg) print $msg.'
'; + print_barre_liste($langs->trans("ExpenseReportLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); print $langs->trans("DescVentilTodoExpenseReport") . '

'; + if ($msg) print $msg.'
'; + $moreforfilter = ''; print ''."\n"; @@ -254,6 +271,7 @@ if ($result) { print_liste_field_titre('', '', '', '', '', 'align="center"'); print "\n"; + // We add search filter print ''; print ''; print ''; @@ -265,7 +283,7 @@ if ($result) { print ''; print ''; print ''; print ''; @@ -273,7 +291,7 @@ if ($result) { $expensereport_static = new ExpenseReport($db); $form = new Form($db); - $var = True; + $var = true; while ( $i < min($num_lines, $limit) ) { $objp = $db->fetch_object($result); $var = ! $var; @@ -315,19 +333,18 @@ if ($result) { print price($objp->tva_tx_line); print ''; - // Accounting account suggested + // Current account print ''; - // Colonne choix du compte + // Suggested accounting account print ''; - // Colonne choix ligne a ventiler print ''; print ""; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 5bd164a2a54..d5fcf2d011b 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -192,25 +192,25 @@ $sql.= " AND product_type <= 2"; $sql.= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_buy IS NULL OR p.accountancy_code_buy ='')"; // Add search filter like if (strlen(trim($search_invoice))) { - $sql .= " AND (f.ref like '%" . $search_invoice . "%')"; + $sql .= natural_search("f.ref",$search_invoice); } if (strlen(trim($search_ref))) { - $sql .= " AND (p.ref like '%" . $search_ref . "%')"; + $sql .= natural_search("p.ref",$search_ref); } if (strlen(trim($search_label))) { - $sql .= " AND (p.label like '%" . $search_label . "%')"; + $sql .= natural_search("p.label",$search_label); } if (strlen(trim($search_desc))) { - $sql .= " AND (l.description like '%" . $search_desc . "%')"; + $sql .= natural_search("l.description",$search_desc); } if (strlen(trim($search_amount))) { - $sql .= " AND l.total_ht like '" . $search_amount . "%'"; + $sql .= natural_search("l.total_ht",$search_amount,1); } if (strlen(trim($search_account))) { - $sql .= " AND aa.account_number like '%" . $search_account . "%'"; + $sql .= natural_search("aa.account_number",$search_account); } if (strlen(trim($search_vat))) { - $sql .= " AND (l.tva_tx like '" . $search_vat . "%')"; + $sql .= natural_search("l.tva_tx",$search_vat,1); } $sql .= " AND f.entity IN (" . getEntity("facture_fourn", 0) . ")"; // We don't share object for accountancy
'; - $searchpicto=$form->showFilterAndCheckAddButtons(1); + $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); print $searchpicto; print '
'; print length_accountg(html_entity_decode($objp->code_buy)); print ''; print $formventilation->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; - print 'aarowid ? "checked" : "") . '/>'; + print 'aarowid ? "checked" : "") . '/>'; print '