2
0
forked from Wavyzz/dolibarr

FIX column project into list

This commit is contained in:
Laurent Destailleur
2019-05-10 15:11:06 +02:00
parent 0e8184332e
commit 9de0e69456
3 changed files with 140 additions and 69 deletions

View File

@@ -62,6 +62,7 @@ $search_ref=GETPOST('sf_ref')?GETPOST('sf_ref', 'alpha'):GETPOST('search_ref', '
$search_refcustomer=GETPOST('search_refcustomer', 'alpha'); $search_refcustomer=GETPOST('search_refcustomer', 'alpha');
$search_refproject=GETPOST('search_refproject', 'alpha'); $search_refproject=GETPOST('search_refproject', 'alpha');
$search_project=GETPOST('search_project', 'alpha');
$search_societe=GETPOST('search_societe', 'alpha'); $search_societe=GETPOST('search_societe', 'alpha');
$search_montant_ht=GETPOST('search_montant_ht', 'alpha'); $search_montant_ht=GETPOST('search_montant_ht', 'alpha');
@@ -144,27 +145,28 @@ if (empty($user->socid)) $fieldstosearchall["p.note_private"]="NotePrivate";
$checkedtypetiers=0; $checkedtypetiers=0;
$arrayfields=array( $arrayfields=array(
'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), 'p.ref'=>array('label'=>"Ref", 'checked'=>1),
'p.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1), 'p.ref_client'=>array('label'=>"RefCustomer", 'checked'=>1),
'pr.ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled)?0:1)), 'pr.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled)?0:1)),
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), 'pr.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(empty($conf->projet->enabled)?0:1)),
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1), 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1), 's.town'=>array('label'=>"Town", 'checked'=>1),
'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0), 's.zip'=>array('label'=>"Zip", 'checked'=>1),
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0), 'state.nom'=>array('label'=>"StateShort", 'checked'=>0),
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers), 'country.code_iso'=>array('label'=>"Country", 'checked'=>0),
'p.date'=>array('label'=>$langs->trans("Date"), 'checked'=>1), 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers),
'p.fin_validite'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1), 'p.date'=>array('label'=>"Date", 'checked'=>1),
'p.date_livraison'=>array('label'=>$langs->trans("DeliveryDate"), 'checked'=>0), 'p.fin_validite'=>array('label'=>"DateEnd", 'checked'=>1),
'ava.rowid'=>array('label'=>$langs->trans("AvailabilityPeriod"), 'checked'=>0), 'p.date_livraison'=>array('label'=>"DeliveryDate", 'checked'=>0),
'p.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), 'ava.rowid'=>array('label'=>"AvailabilityPeriod", 'checked'=>0),
'p.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0), 'p.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
'p.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0), 'p.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0),
'u.login'=>array('label'=>$langs->trans("Author"), 'checked'=>1, 'position'=>10), 'p.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
'sale_representative'=>array('label'=>$langs->trans("SaleRepresentativesOfThirdParty"), 'checked'=>1), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10),
'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>1),
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'p.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), 'p.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
'p.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
); );
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
@@ -197,6 +199,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_ref=''; $search_ref='';
$search_refcustomer=''; $search_refcustomer='';
$search_refproject=''; $search_refproject='';
$search_project='';
$search_societe=''; $search_societe='';
$search_montant_ht=''; $search_montant_ht='';
$search_montant_vat=''; $search_montant_vat='';
@@ -265,7 +268,7 @@ $sql.= " ava.rowid as availability,";
$sql.= " state.code_departement as state_code, state.nom as state_name,"; $sql.= " state.code_departement as state_code, state.nom as state_name,";
$sql.= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,'; $sql.= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,';
$sql.= ' p.datec as date_creation, p.tms as date_update,'; $sql.= ' p.datec as date_creation, p.tms as date_update,';
$sql.= " pr.rowid as project_id, pr.ref as project_ref, p.title as project_label,"; $sql.= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
$sql.= ' u.login'; $sql.= ' u.login';
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user,"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user,";
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc"; if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
@@ -309,6 +312,7 @@ if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search
if ($search_ref) $sql .= natural_search('p.ref', $search_ref); if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
if ($search_refcustomer) $sql .= natural_search('p.ref_client', $search_refcustomer); if ($search_refcustomer) $sql .= natural_search('p.ref_client', $search_refcustomer);
if ($search_refproject) $sql .= natural_search('pr.ref', $search_refproject); if ($search_refproject) $sql .= natural_search('pr.ref', $search_refproject);
if ($search_project) $sql .= natural_search('pr.title', $search_project);
if ($search_availability) $sql .= " AND p.fk_availability IN (".$db->escape($search_availability).')'; if ($search_availability) $sql .= " AND p.fk_availability IN (".$db->escape($search_availability).')';
if ($search_societe) $sql .= natural_search('s.nom', $search_societe); if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
@@ -536,19 +540,25 @@ if ($resql)
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).'">'; print '<input class="flat" size="6" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).'">';
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['pr.ref']['checked'])) if (! empty($arrayfields['pr.ref']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_refproject" value="'.dol_escape_htmltag($search_refproject).'">'; print '<input class="flat" size="6" type="text" name="search_refproject" value="'.dol_escape_htmltag($search_refproject).'">';
print '</td>'; print '</td>';
}
if (! empty($arrayfields['pr.title']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_project" value="'.dol_escape_htmltag($search_project).'">';
print '</td>';
} }
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="10" name="search_societe" value="'.dol_escape_htmltag($search_societe).'">'; print '<input class="flat" type="text" size="10" name="search_societe" value="'.dol_escape_htmltag($search_societe).'">';
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>'; if (! empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
if (! empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.$search_zip.'"></td>'; if (! empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.$search_zip.'"></td>';
@@ -686,7 +696,8 @@ if ($resql)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['p.ref_client']['checked'])) print_liste_field_titre($arrayfields['p.ref_client']['label'], $_SERVER["PHP_SELF"], 'p.ref_client', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.ref_client']['checked'])) print_liste_field_titre($arrayfields['p.ref_client']['label'], $_SERVER["PHP_SELF"], 'p.ref_client', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['pr.ref']['checked'])) print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['pr.ref']['checked'])) print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['pr.title']['checked'])) print_liste_field_titre($arrayfields['pr.title']['label'], $_SERVER["PHP_SELF"], 'pr.title', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
@@ -730,6 +741,10 @@ if ($resql)
$companystatic->code_client=$obj->code_client; $companystatic->code_client=$obj->code_client;
$companystatic->email=$obj->email; $companystatic->email=$obj->email;
$projectstatic->id=$obj->project_id;
$projectstatic->ref=$obj->project_ref;
$projectstatic->title=$obj->project_label;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
if (! empty($arrayfields['p.ref']['checked'])) if (! empty($arrayfields['p.ref']['checked']))
@@ -772,7 +787,7 @@ if ($resql)
if (! empty($arrayfields['p.ref_client']['checked'])) if (! empty($arrayfields['p.ref_client']['checked']))
{ {
// Customer ref // Customer ref
print '<td class="nocellnopadd nowrap">'; print '<td class="nowrap">';
print $obj->ref_client; print $obj->ref_client;
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
@@ -781,17 +796,25 @@ if ($resql)
if (! empty($arrayfields['pr.ref']['checked'])) if (! empty($arrayfields['pr.ref']['checked']))
{ {
// Project ref // Project ref
print '<td class="nocellnopadd nowrap">'; print '<td class="nowrap">';
if ($obj->project_id > 0) { if ($obj->project_id > 0) {
$projectstatic->id=$obj->project_id;
$projectstatic->ref=$obj->project_ref;
$projectstatic->title=$obj->project_label;
print $projectstatic->getNomUrl(1); print $projectstatic->getNomUrl(1);
} }
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
if (! empty($arrayfields['pr.title']['checked']))
{
// Project ref
print '<td class="nowrap">';
if ($obj->project_id > 0) {
print $projectstatic->title;
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Thirdparty // Thirdparty
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {

View File

@@ -84,6 +84,7 @@ $viewstatut=GETPOST('viewstatut');
$search_btn=GETPOST('button_search', 'alpha'); $search_btn=GETPOST('button_search', 'alpha');
$search_remove_btn=GETPOST('button_removefilter', 'alpha'); $search_remove_btn=GETPOST('button_removefilter', 'alpha');
$search_project_ref=GETPOST('search_project_ref', 'alpha'); $search_project_ref=GETPOST('search_project_ref', 'alpha');
$search_project=GETPOST('search_project', 'alpha');
// Security check // Security check
$id = (GETPOST('orderid')?GETPOST('orderid', 'int'):GETPOST('id', 'int')); $id = (GETPOST('orderid')?GETPOST('orderid', 'int'):GETPOST('id', 'int'));
@@ -125,24 +126,25 @@ if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate";
$checkedtypetiers=0; $checkedtypetiers=0;
$arrayfields=array( $arrayfields=array(
'c.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), 'c.ref'=>array('label'=>"Ref", 'checked'=>1),
'c.ref_client'=>array('label'=>$langs->trans("RefCustomerOrder"), 'checked'=>1), 'c.ref_client'=>array('label'=>"RefCustomerOrder", 'checked'=>1),
'p.project_ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>0, 'enabled'=>1), 'p.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled)?0:1)),
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), 'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(empty($conf->projet->enabled)?0:1)),
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1), 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1), 's.town'=>array('label'=>"Town", 'checked'=>1),
'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0), 's.zip'=>array('label'=>"Zip", 'checked'=>1),
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0), 'state.nom'=>array('label'=>"StateShort", 'checked'=>0),
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers), 'country.code_iso'=>array('label'=>"Country", 'checked'=>0),
'c.date_commande'=>array('label'=>$langs->trans("OrderDateShort"), 'checked'=>1), 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers),
'c.date_delivery'=>array('label'=>$langs->trans("DateDeliveryPlanned"), 'checked'=>1, 'enabled'=>empty($conf->global->ORDER_DISABLE_DELIVERY_DATE)), 'c.date_commande'=>array('label'=>"OrderDateShort", 'checked'=>1),
'c.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), 'c.date_delivery'=>array('label'=>"DateDeliveryPlanned", 'checked'=>1, 'enabled'=>empty($conf->global->ORDER_DISABLE_DELIVERY_DATE)),
'c.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0), 'c.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
'c.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0), 'c.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0),
'c.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'c.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
'c.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'c.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), 'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
'c.facture'=>array('label'=>$langs->trans("Billed"), 'checked'=>1, 'position'=>1000, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) 'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
'c.facture'=>array('label'=>"Billed", 'checked'=>1, 'position'=>1000, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)))
); );
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
@@ -197,6 +199,7 @@ if (empty($reshook))
$search_deliverymonth=''; $search_deliverymonth='';
$search_deliveryyear=''; $search_deliveryyear='';
$search_project_ref=''; $search_project_ref='';
$search_project='';
$viewstatut=''; $viewstatut='';
$billed=''; $billed='';
$toselect=''; $toselect='';
@@ -315,6 +318,7 @@ if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.elemen
if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1); if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1);
if ($search_total_ttc != '') $sql.= natural_search('c.total_ttc', $search_total_ttc, 1); if ($search_total_ttc != '') $sql.= natural_search('c.total_ttc', $search_total_ttc, 1);
if ($search_project_ref != '') $sql.= natural_search("p.ref", $search_project_ref); if ($search_project_ref != '') $sql.= natural_search("p.ref", $search_project_ref);
if ($search_project != '') $sql.= natural_search("p.title", $search_project);
if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL";
// Add where from extra fields // Add where from extra fields
@@ -595,10 +599,15 @@ if ($resql)
print '</td>'; print '</td>';
} }
// Project ref // Project ref
if (! empty($arrayfields['p.project_ref']['checked'])) if (! empty($arrayfields['p.ref']['checked']))
{ {
print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.$search_project_ref.'"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.$search_project_ref.'"></td>';
} }
// Project title
if (! empty($arrayfields['p.title']['checked']))
{
print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project" value="'.$search_project.'"></td>';
}
// Thirpdarty // Thirpdarty
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {
@@ -721,7 +730,8 @@ if ($resql)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], 'c.ref', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], 'c.ref', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['c.ref_client']['checked'])) print_liste_field_titre($arrayfields['c.ref_client']['label'], $_SERVER["PHP_SELF"], 'c.ref_client', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['c.ref_client']['checked'])) print_liste_field_titre($arrayfields['c.ref_client']['label'], $_SERVER["PHP_SELF"], 'c.ref_client', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['p.project_ref']['checked'])) print_liste_field_titre($arrayfields['p.project_ref']['label'], $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['p.title']['checked'])) print_liste_field_titre($arrayfields['p.title']['label'], $_SERVER["PHP_SELF"], "p.title", "", $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
@@ -781,6 +791,10 @@ if ($resql)
$generic_commande->total_tva = $obj->total_tva; $generic_commande->total_tva = $obj->total_tva;
$generic_commande->total_ttc = $obj->total_ttc; $generic_commande->total_ttc = $obj->total_ttc;
$projectstatic->id=$obj->project_id;
$projectstatic->ref=$obj->project_ref;
$projectstatic->title=$obj->project_label;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Ref // Ref
@@ -932,21 +946,30 @@ if ($resql)
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Project // Project ref
if (! empty($arrayfields['p.project_ref']['checked'])) if (! empty($arrayfields['p.ref']['checked']))
{ {
print '<td class="nocellnopadd nowrap">'; print '<td class="nowrap">';
if ($obj->project_id > 0) if ($obj->project_id > 0)
{ {
$projectstatic->id=$obj->project_id;
$projectstatic->ref=$obj->project_ref;
$projectstatic->title=$obj->project_label;
print $projectstatic->getNomUrl(1); print $projectstatic->getNomUrl(1);
} }
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Project label
if (! empty($arrayfields['p.title']['checked']))
{
print '<td class="nowrap">';
if ($obj->project_id > 0)
{
print $projectstatic->title;
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Third party // Third party
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {

View File

@@ -78,6 +78,7 @@ $search_product_category=GETPOST('search_product_category', 'int');
$search_ref=GETPOST('sf_ref')?GETPOST('sf_ref', 'alpha'):GETPOST('search_ref', 'alpha'); $search_ref=GETPOST('sf_ref')?GETPOST('sf_ref', 'alpha'):GETPOST('search_ref', 'alpha');
$search_refcustomer=GETPOST('search_refcustomer', 'alpha'); $search_refcustomer=GETPOST('search_refcustomer', 'alpha');
$search_type=GETPOST('search_type', 'int'); $search_type=GETPOST('search_type', 'int');
$search_project_ref=GETPOST('search_project_ref', 'alpha');
$search_project=GETPOST('search_project', 'alpha'); $search_project=GETPOST('search_project', 'alpha');
$search_societe=GETPOST('search_societe', 'alpha'); $search_societe=GETPOST('search_societe', 'alpha');
$search_montant_ht=GETPOST('search_montant_ht', 'alpha'); $search_montant_ht=GETPOST('search_montant_ht', 'alpha');
@@ -160,8 +161,9 @@ $arrayfields=array(
'f.type'=>array('label'=>"Type", 'checked'=>0), 'f.type'=>array('label'=>"Type", 'checked'=>0),
'f.date'=>array('label'=>"DateInvoice", 'checked'=>1), 'f.date'=>array('label'=>"DateInvoice", 'checked'=>1),
'f.date_lim_reglement'=>array('label'=>"DateDue", 'checked'=>1), 'f.date_lim_reglement'=>array('label'=>"DateDue", 'checked'=>1),
'p.ref'=>array('label'=>"ProjectRef", 'checked'=>0, 'enabled'=>(empty($conf->projet->enabled)?0:1)), 'p.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled)?0:1)),
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1), 'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(empty($conf->projet->enabled)?0:1)),
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
's.town'=>array('label'=>"Town", 'checked'=>1), 's.town'=>array('label'=>"Town", 'checked'=>1),
's.zip'=>array('label'=>"Zip", 'checked'=>1), 's.zip'=>array('label'=>"Zip", 'checked'=>1),
'state.nom'=>array('label'=>"StateShort", 'checked'=>0), 'state.nom'=>array('label'=>"StateShort", 'checked'=>0),
@@ -212,6 +214,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
$search_ref=''; $search_ref='';
$search_refcustomer=''; $search_refcustomer='';
$search_type=''; $search_type='';
$search_project_ref='';
$search_project=''; $search_project='';
$search_societe=''; $search_societe='';
$search_montant_ht=''; $search_montant_ht='';
@@ -426,7 +429,8 @@ if ($filtre)
if ($search_ref) $sql .= natural_search('f.ref', $search_ref); if ($search_ref) $sql .= natural_search('f.ref', $search_ref);
if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer); if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer);
if ($search_type != '' && $search_type != '-1') $sql.=" AND f.type IN (".$db->escape($search_type).")"; if ($search_type != '' && $search_type != '-1') $sql.=" AND f.type IN (".$db->escape($search_type).")";
if ($search_project) $sql .= natural_search('p.ref', $search_project); if ($search_project_ref) $sql .= natural_search('p.ref', $search_project_ref);
if ($search_project) $sql .= natural_search('p.title', $search_project);
if ($search_societe) $sql .= natural_search('s.nom', $search_societe); if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_town) $sql.= natural_search('s.town', $search_town); if ($search_town) $sql.= natural_search('s.town', $search_town);
if ($search_zip) $sql.= natural_search("s.zip", $search_zip); if ($search_zip) $sql.= natural_search("s.zip", $search_zip);
@@ -452,7 +456,7 @@ if ($search_status != '-1' && $search_status != '')
} }
else else
{ {
$sql.= " AND f.fk_statut IN (".$search_status.")"; // When search_status is '1,2' for example $sql.= " AND f.fk_statut IN (".$db->escape($search_status).")"; // When search_status is '1,2' for example
} }
} }
if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode); if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode);
@@ -460,7 +464,7 @@ if ($search_paymentterms > 0) $sql .= " AND f.fk_cond_reglement = ".$db->escape(
$sql.= dolSqlDateFilter("f.datef", $search_day, $search_month, $search_year); $sql.= dolSqlDateFilter("f.datef", $search_day, $search_month, $search_year);
$sql.= dolSqlDateFilter("f.date_lim_reglement", $search_day_lim, $search_month_lim, $search_year_lim); $sql.= dolSqlDateFilter("f.date_lim_reglement", $search_day_lim, $search_month_lim, $search_year_lim);
if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'"; if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'";
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .(int) $search_sale;
if ($search_user > 0) if ($search_user > 0)
{ {
$sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".$search_user; $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".$search_user;
@@ -554,6 +558,8 @@ if ($resql)
if ($search_year_lim) $param.='&search_year_lim=' .urlencode($search_year_lim); if ($search_year_lim) $param.='&search_year_lim=' .urlencode($search_year_lim);
if ($search_ref) $param.='&search_ref=' .urlencode($search_ref); if ($search_ref) $param.='&search_ref=' .urlencode($search_ref);
if ($search_refcustomer) $param.='&search_refcustomer=' .urlencode($search_refcustomer); if ($search_refcustomer) $param.='&search_refcustomer=' .urlencode($search_refcustomer);
if ($search_project_ref) $param.='&search_project_ref='.urlencode($search_project_ref);
if ($search_project) $param.='&search_project='.urlencode($search_project);
if ($search_type != '') $param.='&search_type='.urlencode($search_type); if ($search_type != '') $param.='&search_type='.urlencode($search_type);
if ($search_societe) $param.='&search_societe=' .urlencode($search_societe); if ($search_societe) $param.='&search_societe=' .urlencode($search_societe);
if ($search_town) $param.='&search_town='.urlencode($search_town); if ($search_town) $param.='&search_town='.urlencode($search_town);
@@ -741,10 +747,15 @@ if ($resql)
print '<br><input type="checkbox" name="search_option" value="late"'.($option == 'late'?' checked':'').'> '.$langs->trans("Alert"); print '<br><input type="checkbox" name="search_option" value="late"'.($option == 'late'?' checked':'').'> '.$langs->trans("Alert");
print '</td>'; print '</td>';
} }
// Project // Project ref
if (! empty($arrayfields['p.ref']['checked'])) if (! empty($arrayfields['p.ref']['checked']))
{ {
print '<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.$search_project.'"></td>'; print '<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project_ref" value="'.$search_project_ref.'"></td>';
}
// Project label
if (! empty($arrayfields['p.title']['checked']))
{
print '<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.$search_project.'"></td>';
} }
// Thirpdarty // Thirpdarty
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
@@ -876,6 +887,7 @@ if ($resql)
if (! empty($arrayfields['f.date']['checked'])) print_liste_field_titre($arrayfields['f.date']['label'], $_SERVER['PHP_SELF'], 'f.datef', '', $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['f.date']['checked'])) print_liste_field_titre($arrayfields['f.date']['label'], $_SERVER['PHP_SELF'], 'f.datef', '', $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['f.date_lim_reglement']['checked'])) print_liste_field_titre($arrayfields['f.date_lim_reglement']['label'], $_SERVER['PHP_SELF'], "f.date_lim_reglement", '', $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['f.date_lim_reglement']['checked'])) print_liste_field_titre($arrayfields['f.date_lim_reglement']['label'], $_SERVER['PHP_SELF'], "f.date_lim_reglement", '', $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER['PHP_SELF'], "p.ref", '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER['PHP_SELF'], "p.ref", '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['p.title']['checked'])) print_liste_field_titre($arrayfields['p.title']['label'], $_SERVER['PHP_SELF'], "p.title", '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER['PHP_SELF'], 's.nom', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER['PHP_SELF'], 's.nom', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
@@ -941,6 +953,10 @@ if ($resql)
$thirdpartystatic->email=$obj->email; $thirdpartystatic->email=$obj->email;
$thirdpartystatic->country_code=$obj->country_code; $thirdpartystatic->country_code=$obj->country_code;
$projectstatic->id=$obj->project_id;
$projectstatic->ref=$obj->project_ref;
$projectstatic->title=$obj->project_label;
$paiement = $facturestatic->getSommePaiement(); $paiement = $facturestatic->getSommePaiement();
$totalcreditnotes = $facturestatic->getSumCreditNotesUsed(); $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
$totaldeposits = $facturestatic->getSumDepositsUsed(); $totaldeposits = $facturestatic->getSumDepositsUsed();
@@ -1026,21 +1042,30 @@ if ($resql)
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Project // Project ref
if (! empty($arrayfields['p.ref']['checked'])) if (! empty($arrayfields['p.ref']['checked']))
{ {
print '<td class="nocellnopadd nowrap">'; print '<td class="nowrap">';
if ($obj->project_id > 0) if ($obj->project_id > 0)
{ {
$projectstatic->id=$obj->project_id;
$projectstatic->ref=$obj->project_ref;
$projectstatic->title=$obj->project_label;
print $projectstatic->getNomUrl(1); print $projectstatic->getNomUrl(1);
} }
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Project title
if (! empty($arrayfields['p.title']['checked']))
{
print '<td class="nowrap">';
if ($obj->project_id > 0)
{
print $projectstatic->title;
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Third party // Third party
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {