Merge https://github.com/gschratzer/dolibarr into develop
This commit is contained in:
commit
99e679ec39
@ -160,6 +160,7 @@ $extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('thirdparty');
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
// Do we click on purge search criteria ?
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
@ -174,6 +175,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$search_datec="";
|
||||
$search_categ="";
|
||||
$search_status="";
|
||||
$search_array_options=array();
|
||||
}
|
||||
|
||||
if ($search_status=='') $search_status=1; // always display active customer first
|
||||
@ -256,6 +258,19 @@ if ($socname)
|
||||
$sortfield = "s.nom";
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
// Extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||
@ -269,6 +284,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
}
|
||||
$sql.= " ORDER BY $sortfield $sortorder, s.nom ASC";
|
||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||
//print $sql;
|
||||
|
||||
dol_syslog('comm/prospect/list.php', LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
@ -302,9 +318,15 @@ if ($resql)
|
||||
}
|
||||
if ($search_level_from != '') $param.='&search_level_from='.$search_level_from;
|
||||
if ($search_level_to != '') $param.='&search_level_to='.$search_level_to;
|
||||
if ($search_categ != '') $param.='&search_categ='.$search_categ;
|
||||
if ($search_categ != '') $param.='&search_categ='.urlencode($search_categ);
|
||||
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
|
||||
if ($search_status != '') $param.='&search_status='.$search_status;
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||
}
|
||||
// $param and $urladd should have the same value
|
||||
$urladd = $param;
|
||||
|
||||
@ -420,7 +442,7 @@ if ($resql)
|
||||
{
|
||||
$arraystcomm[$val['id']]=$val['label'];
|
||||
}
|
||||
print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, 1);
|
||||
print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre" align="center">';
|
||||
@ -434,9 +456,10 @@ if ($resql)
|
||||
{
|
||||
if ($val)
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
//print $extrafields->showInputField($key, $array_options[$key], '', '', 'search_', 4);
|
||||
print '</td>';
|
||||
$crit=$search_array_options['search_options_'.$key];
|
||||
print '<td class="liste_titre">';
|
||||
print $extrafields->showInputField($key, $crit, '', '', 'search_', 4);
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,6 +129,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$search_montant_ht='';
|
||||
$search_montant_ttc='';
|
||||
$search_status='';
|
||||
$day='';
|
||||
$year='';
|
||||
$month='';
|
||||
}
|
||||
@ -350,7 +351,7 @@ if ($resql)
|
||||
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_montant_ttc" value="'.$search_montant_ttc.'"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$liststatus=array('0'=>$langs->trans("Draft"), '1'=>$langs->trans("Unpaid"), '2'=>$langs->trans("Paid"), '3'=>$langs->trans("Cancel"));
|
||||
$liststatus=array('0'=>$langs->trans("BillShortStatusDraft"), '1'=>$langs->trans("BillShortStatusNotPaid"), '2'=>$langs->trans("BillShortStatusPaid"), '3'=>$langs->trans("BillShortStatusCanceled"));
|
||||
print $form->selectarray('search_status', $liststatus, $search_status, 1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
|
||||
@ -28,6 +28,8 @@
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
$langs->load("bills");
|
||||
$langs->load("compta");
|
||||
@ -36,6 +38,10 @@ $langs->load("compta");
|
||||
$facid =GETPOST('facid','int');
|
||||
$socid =GETPOST('socid','int');
|
||||
$userid=GETPOST('userid','int');
|
||||
$day = GETPOST('day','int');
|
||||
$month = GETPOST('month','int');
|
||||
$year = GETPOST('year','int');
|
||||
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'facture',$facid,'');
|
||||
|
||||
@ -66,6 +72,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$search_amount="";
|
||||
$search_paymenttype="";
|
||||
$search_company="";
|
||||
$day='';
|
||||
$year='';
|
||||
$month='';
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
@ -81,6 +90,7 @@ $extrafields = new ExtraFields($db);
|
||||
llxHeader('', $langs->trans('ListPayment'));
|
||||
|
||||
$form=new Form($db);
|
||||
$formother=new FormOther($db);
|
||||
|
||||
if (GETPOST("orphelins"))
|
||||
{
|
||||
@ -141,6 +151,19 @@ else
|
||||
else $sql.= " AND f.fk_user_author = ".$userid;
|
||||
}
|
||||
// Search criteria
|
||||
if ($month > 0)
|
||||
{
|
||||
if ($year > 0 && empty($day))
|
||||
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
|
||||
else if ($year > 0 && ! empty($day))
|
||||
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'";
|
||||
else
|
||||
$sql.= " AND date_format(p.datep, '%m') = '".$month."'";
|
||||
}
|
||||
else if ($year > 0)
|
||||
{
|
||||
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
}
|
||||
if ($search_ref > 0) $sql .=" AND p.rowid=".$search_ref;
|
||||
if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;
|
||||
if ($search_paymenttype != "") $sql .=" AND c.code='".$db->escape($search_paymenttype)."'";
|
||||
@ -194,7 +217,11 @@ if ($resql)
|
||||
print '<td align="left">';
|
||||
print '<input class="flat" type="text" size="4" name="search_ref" value="'.$search_ref.'">';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||
$formother->select_year($year?$year:-1,'year',1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
print '<input class="flat" type="text" size="6" name="search_company" value="'.$search_company.'">';
|
||||
print '</td>';
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
|
||||
// TODO Include this include file into all class objects
|
||||
// TODO Include this include file into all element pages allowing email sending
|
||||
|
||||
// $id must be defined
|
||||
// $actiontypecode must be defined
|
||||
@ -92,7 +92,7 @@ if(! empty($_POST['removAll']))
|
||||
/*
|
||||
* Send mail
|
||||
*/
|
||||
if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removAll'] && ! $_POST['removedfile'] && ! $_POST['cancel'])
|
||||
if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removAll'] && ! $_POST['removedfile'] && ! $_POST['cancel'] && !$_POST['modelselected'])
|
||||
{
|
||||
if($conf->dolimail->enabled) $langs->load("dolimail@dolimail");
|
||||
$langs->load('mails');
|
||||
|
||||
@ -1422,14 +1422,16 @@ class ExtraFields
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return array_options array for object by extrafields value (using for data send by forms)
|
||||
*
|
||||
* @param array $extralabels $array of extrafields
|
||||
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
||||
* @return int 1 if array_options set / 0 if no value
|
||||
* @param array $extralabels $array of extrafields
|
||||
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
||||
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
|
||||
* @return int 1 if array_options set / 0 if no value
|
||||
*/
|
||||
function getOptionalsFromPost($extralabels,$keyprefix='')
|
||||
function getOptionalsFromPost($extralabels,$keyprefix='',$keysuffix='')
|
||||
{
|
||||
global $_POST;
|
||||
|
||||
@ -1444,24 +1446,24 @@ class ExtraFields
|
||||
if (in_array($key_type,array('date','datetime')))
|
||||
{
|
||||
// Clean parameters
|
||||
$value_key=dol_mktime($_POST["options_".$key.$keyprefix."hour"], $_POST["options_".$key.$keyprefix."min"], 0, $_POST["options_".$key.$keyprefix."month"], $_POST["options_".$key.$keyprefix."day"], $_POST["options_".$key.$keyprefix."year"]);
|
||||
$value_key=dol_mktime($_POST[$keysuffix."options_".$key.$keyprefix."hour"], $_POST[$keysuffix."options_".$key.$keyprefix."min"], 0, $_POST[$keysuffix."options_".$key.$keyprefix."month"], $_POST[$keysuffix."options_".$key.$keyprefix."day"], $_POST[$keysuffix."options_".$key.$keyprefix."year"]);
|
||||
}
|
||||
else if (in_array($key_type,array('checkbox')))
|
||||
{
|
||||
$value_arr=GETPOST("options_".$key.$keyprefix);
|
||||
$value_arr=GETPOST($keysuffix."options_".$key.$keyprefix);
|
||||
$value_key=implode($value_arr,',');
|
||||
}
|
||||
else if (in_array($key_type,array('price','double')))
|
||||
{
|
||||
$value_arr=GETPOST("options_".$key.$keyprefix);
|
||||
$value_arr=GETPOST($keysuffix."options_".$key.$keyprefix);
|
||||
$value_key=price2num($value_arr);
|
||||
}
|
||||
else
|
||||
{
|
||||
$value_key=GETPOST("options_".$key.$keyprefix);
|
||||
$value_key=GETPOST($keysuffix."options_".$key.$keyprefix);
|
||||
}
|
||||
|
||||
$array_options["options_".$key]=$value_key; // No keyprefix here. keyprefix is used only for read.
|
||||
$array_options[$keysuffix."options_".$key]=$value_key; // No keyprefix here. keyprefix is used only for read.
|
||||
}
|
||||
|
||||
return $array_options;
|
||||
|
||||
@ -4406,7 +4406,7 @@ class Form
|
||||
* @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect
|
||||
* @param array $array Array with key+value
|
||||
* @param string|string[] $id Preselected key or preselected keys for multiselect
|
||||
* @param int $show_empty 0 no empty value allowed, 1 to add an empty value into list (value is '' or ' ').
|
||||
* @param int $show_empty 0 no empty value allowed, 1 to add an empty value into list (value is '' or ' '), <0 to add an empty value with key that is this value.
|
||||
* @param int $key_in_label 1 pour afficher la key dans la valeur "[key] value"
|
||||
* @param int $value_as_key 1 to use value as key
|
||||
* @param string $moreparam Add more parameters onto the select tag
|
||||
@ -4455,7 +4455,7 @@ class Form
|
||||
{
|
||||
$textforempty=' ';
|
||||
if (! empty($conf->use_javascript_ajax)) $textforempty=' '; // If we use ajaxcombo, we need here to avoid to have an empty element that is too small.
|
||||
$out.='<option value="-2"'.($id==-2?' selected':'').'>'.$textforempty.'</option>'."\n"; // id is -2 because -1 is already "do not contact"
|
||||
$out.='<option value="'.($show_empty < 0 ? $show_empty : -1).'"'.($id==-2?' selected':'').'>'.$textforempty.'</option>'."\n"; // id is -2 because -1 is already "do not contact"
|
||||
}
|
||||
|
||||
if (is_array($array))
|
||||
|
||||
@ -789,7 +789,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
|
||||
if (empty($leftmenu) || ($leftmenu == 'suppliers_bills')) {
|
||||
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills&search_status=0", $langs->trans("BillShortStatusDraft"),2,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
|
||||
$newmenu->add("/fourn/facture/impayees.php", $langs->trans("BillShortStatusNotPaid"),2,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
|
||||
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills&search_status=1", $langs->trans("BillShortStatusNotPaid"),2,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
|
||||
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills&search_status=2", $langs->trans("BillShortStatusPaid"),2,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
|
||||
}
|
||||
|
||||
|
||||
@ -305,7 +305,7 @@ if ($resql)
|
||||
print '</td><td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="6" name="search_amount_all_tax" value="'.$search_amount_all_tax.'">';
|
||||
print '</td><td class="liste_titre" align="right">';
|
||||
$liststatus=array('paye:0'=>$langs->trans("Unpaid"), 'paye:1'=>$langs->trans("Paid"));
|
||||
$liststatus=array('fac.fk_statut:0'=>$langs->trans("Draft"),'fac.fk_statut:1,paye:0'=>$langs->trans("Unpaid"), 'paye:1'=>$langs->trans("Paid"));
|
||||
print $form->selectarray('filtre', $liststatus, $filter, 1);
|
||||
print '</td><td class="liste_titre" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
|
||||
@ -63,7 +63,7 @@ MenuSpecialExpenses=Special expenses
|
||||
MenuTaxAndDividends=Taxes and dividends
|
||||
MenuSalaries=Salaries
|
||||
MenuSocialContributions=Social/fiscal taxes
|
||||
MenuNewSocialContribution=New tax payment
|
||||
MenuNewSocialContribution=New social/fiscal tax
|
||||
NewSocialContribution=New social/fiscal tax
|
||||
ContributionsToPay=Social/fiscal taxes to pay
|
||||
AccountancyTreasuryArea=Accountancy/Treasury area
|
||||
|
||||
Loading…
Reference in New Issue
Block a user