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 '