Merge remote-tracking branch 'Dolibarr/develop' into develop

This commit is contained in:
Nicolas ZABOURI 2019-05-10 17:13:44 +02:00
commit 924378930c
16 changed files with 206 additions and 121 deletions

View File

@ -153,7 +153,7 @@ print "</form>\n";
clearstatcache();
print $langs->trans("WebDAVSetupDesc")."<br>\n";
print '<span class="opacitymedium">'.$langs->trans("WebDAVSetupDesc")."</span><br>\n";
print "<br>";

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_refproject=GETPOST('search_refproject', 'alpha');
$search_project=GETPOST('search_project', 'alpha');
$search_societe=GETPOST('search_societe', 'alpha');
$search_montant_ht=GETPOST('search_montant_ht', 'alpha');
@ -144,27 +145,28 @@ if (empty($user->socid)) $fieldstosearchall["p.note_private"]="NotePrivate";
$checkedtypetiers=0;
$arrayfields=array(
'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'p.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1),
'pr.ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled)?0:1)),
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0),
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
'p.date'=>array('label'=>$langs->trans("Date"), 'checked'=>1),
'p.fin_validite'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1),
'p.date_livraison'=>array('label'=>$langs->trans("DeliveryDate"), 'checked'=>0),
'ava.rowid'=>array('label'=>$langs->trans("AvailabilityPeriod"), 'checked'=>0),
'p.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
'p.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
'p.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0),
'u.login'=>array('label'=>$langs->trans("Author"), 'checked'=>1, 'position'=>10),
'sale_representative'=>array('label'=>$langs->trans("SaleRepresentativesOfThirdParty"), 'checked'=>1),
'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'p.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
'p.ref'=>array('label'=>"Ref", 'checked'=>1),
'p.ref_client'=>array('label'=>"RefCustomer", 'checked'=>1),
'pr.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled)?0:1)),
'pr.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.zip'=>array('label'=>"Zip", 'checked'=>1),
'state.nom'=>array('label'=>"StateShort", 'checked'=>0),
'country.code_iso'=>array('label'=>"Country", 'checked'=>0),
'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers),
'p.date'=>array('label'=>"Date", 'checked'=>1),
'p.fin_validite'=>array('label'=>"DateEnd", 'checked'=>1),
'p.date_livraison'=>array('label'=>"DeliveryDate", 'checked'=>0),
'ava.rowid'=>array('label'=>"AvailabilityPeriod", 'checked'=>0),
'p.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
'p.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0),
'p.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10),
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>1),
'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'p.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
'p.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
);
// Extra fields
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_refcustomer='';
$search_refproject='';
$search_project='';
$search_societe='';
$search_montant_ht='';
$search_montant_vat='';
@ -265,13 +268,12 @@ $sql.= " ava.rowid as availability,";
$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.datec as date_creation, p.tms as date_update,';
$sql.= " pr.rowid as project_id, pr.ref as project_ref,";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,";
$sql.= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
$sql.= ' u.login';
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";
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
@ -310,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_refcustomer) $sql .= natural_search('p.ref_client', $search_refcustomer);
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_societe) $sql .= natural_search('s.nom', $search_societe);
@ -537,19 +540,25 @@ if ($resql)
{
print '<td class="liste_titre">';
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']))
{
print '<td class="liste_titre">';
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']))
{
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 '</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.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.$search_zip.'"></td>';
@ -687,7 +696,8 @@ if ($resql)
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_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.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);
@ -725,6 +735,16 @@ if ($resql)
$objectstatic->id=$obj->rowid;
$objectstatic->ref=$obj->ref;
$companystatic->id=$obj->socid;
$companystatic->name=$obj->name;
$companystatic->client=$obj->client;
$companystatic->code_client=$obj->code_client;
$companystatic->email=$obj->email;
$projectstatic->id=$obj->project_id;
$projectstatic->ref=$obj->project_ref;
$projectstatic->title=$obj->project_label;
print '<tr class="oddeven">';
if (! empty($arrayfields['p.ref']['checked']))
@ -767,7 +787,7 @@ if ($resql)
if (! empty($arrayfields['p.ref_client']['checked']))
{
// Customer ref
print '<td class="nocellnopadd nowrap">';
print '<td class="nowrap">';
print $obj->ref_client;
print '</td>';
if (! $i) $totalarray['nbfield']++;
@ -776,20 +796,24 @@ if ($resql)
if (! empty($arrayfields['pr.ref']['checked']))
{
// Project ref
print '<td class="nocellnopadd nowrap">';
if ($obj->project_id) {
$projectstatic->fetch($obj->project_id);
print '<td class="nowrap">';
if ($obj->project_id > 0) {
print $projectstatic->getNomUrl(1);
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
$companystatic->id=$obj->socid;
$companystatic->name=$obj->name;
$companystatic->client=$obj->client;
$companystatic->code_client=$obj->code_client;
$companystatic->email=$obj->email;
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
if (! empty($arrayfields['s.nom']['checked']))

View File

@ -84,6 +84,7 @@ $viewstatut=GETPOST('viewstatut');
$search_btn=GETPOST('button_search', 'alpha');
$search_remove_btn=GETPOST('button_removefilter', 'alpha');
$search_project_ref=GETPOST('search_project_ref', 'alpha');
$search_project=GETPOST('search_project', 'alpha');
// Security check
$id = (GETPOST('orderid')?GETPOST('orderid', 'int'):GETPOST('id', 'int'));
@ -125,24 +126,25 @@ if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate";
$checkedtypetiers=0;
$arrayfields=array(
'c.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'c.ref_client'=>array('label'=>$langs->trans("RefCustomerOrder"), 'checked'=>1),
'p.project_ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>0, 'enabled'=>1),
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0),
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
'c.date_commande'=>array('label'=>$langs->trans("OrderDateShort"), 'checked'=>1),
'c.date_delivery'=>array('label'=>$langs->trans("DateDeliveryPlanned"), 'checked'=>1, 'enabled'=>empty($conf->global->ORDER_DISABLE_DELIVERY_DATE)),
'c.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
'c.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
'c.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0),
'c.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'c.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'c.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
'c.facture'=>array('label'=>$langs->trans("Billed"), 'checked'=>1, 'position'=>1000, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)))
'c.ref'=>array('label'=>"Ref", 'checked'=>1),
'c.ref_client'=>array('label'=>"RefCustomerOrder", 'checked'=>1),
'p.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled)?0: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.zip'=>array('label'=>"Zip", 'checked'=>1),
'state.nom'=>array('label'=>"StateShort", 'checked'=>0),
'country.code_iso'=>array('label'=>"Country", 'checked'=>0),
'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers),
'c.date_commande'=>array('label'=>"OrderDateShort", 'checked'=>1),
'c.date_delivery'=>array('label'=>"DateDeliveryPlanned", 'checked'=>1, 'enabled'=>empty($conf->global->ORDER_DISABLE_DELIVERY_DATE)),
'c.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
'c.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0),
'c.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
'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
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
@ -197,6 +199,7 @@ if (empty($reshook))
$search_deliverymonth='';
$search_deliveryyear='';
$search_project_ref='';
$search_project='';
$viewstatut='';
$billed='';
$toselect='';
@ -245,11 +248,10 @@ $sql.= " state.code_departement as state_code, state.nom as state_name,";
$sql.= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,';
$sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
$sql.= ' c.date_creation as date_creation, c.tms as date_update,';
$sql.= " p.rowid as project_id, p.ref as project_ref";
$sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_label";
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
@ -316,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_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 != '') $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 == -2) $sql.= " AND cc.fk_categorie IS NULL";
// Add where from extra fields
@ -596,10 +599,15 @@ if ($resql)
print '</td>';
}
// 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>';
}
// 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
if (! empty($arrayfields['s.nom']['checked']))
{
@ -722,7 +730,8 @@ if ($resql)
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_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.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);
@ -782,6 +791,10 @@ if ($resql)
$generic_commande->total_tva = $obj->total_tva;
$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">';
// Ref
@ -933,17 +946,30 @@ if ($resql)
if (! $i) $totalarray['nbfield']++;
}
// Project
if (! empty($arrayfields['p.project_ref']['checked']))
// Project ref
if (! empty($arrayfields['p.ref']['checked']))
{
$projectstatic->id=$obj->project_id;
$projectstatic->ref=$obj->project_ref;
print '<td>';
if ($obj->project_id > 0) print $projectstatic->getNomUrl(1);
print '<td class="nowrap">';
if ($obj->project_id > 0)
{
print $projectstatic->getNomUrl(1);
}
print '</td>';
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
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_refcustomer=GETPOST('search_refcustomer', 'alpha');
$search_type=GETPOST('search_type', 'int');
$search_project_ref=GETPOST('search_project_ref', 'alpha');
$search_project=GETPOST('search_project', 'alpha');
$search_societe=GETPOST('search_societe', 'alpha');
$search_montant_ht=GETPOST('search_montant_ht', 'alpha');
@ -160,8 +161,9 @@ $arrayfields=array(
'f.type'=>array('label'=>"Type", 'checked'=>0),
'f.date'=>array('label'=>"DateInvoice", '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)),
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
'p.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled)?0: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.zip'=>array('label'=>"Zip", 'checked'=>1),
'state.nom'=>array('label'=>"StateShort", 'checked'=>0),
@ -212,6 +214,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
$search_ref='';
$search_refcustomer='';
$search_type='';
$search_project_ref='';
$search_project='';
$search_societe='';
$search_montant_ht='';
@ -379,9 +382,8 @@ $sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_label";
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
if (! $sall) $sql.= ', SUM(pf.amount) as dynamount_payed';
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
@ -427,7 +429,8 @@ if ($filtre)
if ($search_ref) $sql .= natural_search('f.ref', $search_ref);
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_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_town) $sql.= natural_search('s.town', $search_town);
if ($search_zip) $sql.= natural_search("s.zip", $search_zip);
@ -453,7 +456,7 @@ if ($search_status != '-1' && $search_status != '')
}
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);
@ -461,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.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 ($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)
{
$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;
@ -555,6 +558,8 @@ if ($resql)
if ($search_year_lim) $param.='&search_year_lim=' .urlencode($search_year_lim);
if ($search_ref) $param.='&search_ref=' .urlencode($search_ref);
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_societe) $param.='&search_societe=' .urlencode($search_societe);
if ($search_town) $param.='&search_town='.urlencode($search_town);
@ -742,10 +747,15 @@ if ($resql)
print '<br><input type="checkbox" name="search_option" value="late"'.($option == 'late'?' checked':'').'> '.$langs->trans("Alert");
print '</td>';
}
// Project
// Project ref
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
if (! empty($arrayfields['s.nom']['checked']))
@ -877,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_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.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.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);
@ -942,6 +953,10 @@ if ($resql)
$thirdpartystatic->email=$obj->email;
$thirdpartystatic->country_code=$obj->country_code;
$projectstatic->id=$obj->project_id;
$projectstatic->ref=$obj->project_ref;
$projectstatic->title=$obj->project_label;
$paiement = $facturestatic->getSommePaiement();
$totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
$totaldeposits = $facturestatic->getSumDepositsUsed();
@ -1027,21 +1042,30 @@ if ($resql)
if (! $i) $totalarray['nbfield']++;
}
// Project
// Project ref
if (! empty($arrayfields['p.ref']['checked']))
{
print '<td class="nowrap">';
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 '</td>';
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
if (! empty($arrayfields['s.nom']['checked']))
{

View File

@ -16,8 +16,8 @@
*/
/**
* \file htdocs/core/ajax/vatrates.php
* \brief File to load vat rates combobox
* \file htdocs/core/ajax/getaccountcurrency.php
* \brief File to load currency rates
*/
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
@ -26,7 +26,8 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
require '../../main.inc.php';
$id = GETPOST('id', 'int');
$id = GETPOST('id', 'int');
/*
* View

View File

@ -138,7 +138,7 @@ class box_factures_fourn_imp extends ModeleBoxes
$tooltip = $langs->trans('SupplierInvoice') . ': ' . ($objp->ref?$objp->ref:$objp->facid) . '<br>' . $langs->trans('RefSupplier') . ': ' . $objp->ref_supplier;
$this->info_box_contents[$line][] = array(
'td' => '',
'td' => 'class="nowraponall"',
'text' => $facturestatic->getNomUrl(1),
'text2'=> $late,
'asis' => 1

View File

@ -118,7 +118,7 @@ class box_project extends ModeleBoxes
$projectstatic->public = $objp->public;
$this->info_box_contents[$i][] = array(
'td' => '',
'td' => 'class="nowraponall"',
'text' => $projectstatic->getNomUrl(1),
'asis' => 1
);

View File

@ -3593,12 +3593,12 @@ function img_allow($allow, $titlealt = 'default')
*/
function img_credit_card($brand)
{
if ($brand == 'Visa') {$brand='cc-visa';}
elseif ($brand == 'MasterCard') {$brand='cc-mastercard';}
elseif ($brand == 'American Express') {$brand='cc-amex';}
elseif ($brand == 'Discover') {$brand='cc-discover';}
elseif ($brand == 'JCB') {$brand='cc-jcb';}
elseif ($brand == 'Diners Club') {$brand='cc-diners-club';}
if ($brand == 'visa' || $brand == 'Visa') {$brand='cc-visa';}
elseif ($brand == 'mastercard' || $brand == 'MasterCard') {$brand='cc-mastercard';}
elseif ($brand == 'amex' || $brand == 'American Express') {$brand='cc-amex';}
elseif ($brand == 'discover' || $brand == 'Discover') {$brand='cc-discover';}
elseif ($brand == 'jcb' || $brand == 'JCB') {$brand='cc-jcb';}
elseif ($brand == 'diners' || $brand == 'Diners club') {$brand='cc-diners-club';}
elseif (! in_array($brand, array('cc-visa','cc-mastercard','cc-amex','cc-discover','cc-jcb','cc-diners-club'))) {$brand='credit-card';}
return '<span class="fa fa-'.$brand.' fa-2x fa-fw"></span>';

View File

@ -577,7 +577,7 @@ function isValidVATID($company)
$vatprefix = $company->country_code;
if ($vatprefix == 'GR') $vatprefix = '(EL|GR)';
else $vatprefix = preg_quote($vatprefix, '/');
if (! preg_match('/^'.$vatprefix.'[a-zA-Z0-9\-\.]{5,10}$/', $company->tva_intra))
if (! preg_match('/^'.$vatprefix.'[a-zA-Z0-9\-\.]{5,12}$/', $company->tva_intra))
{
return 0;
}

View File

@ -142,12 +142,8 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
// Products-Services
$tmpentry = array(
'enabled'=> (( ! empty($conf->societe->enabled) &&
( empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) )
)
|| ! empty($conf->fournisseur->enabled)
),
'perms'=> (! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)),
'enabled'=> (! empty($conf->product->enabled) || ! empty($conf->service->enabled)),
'perms'=> (! empty($user->rights->produit->lire) || ! empty($user->rights->service->lire)),
'module'=>'product|service'
);
$menu_arr[] = array(

View File

@ -14,6 +14,9 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* You can test with the WebDav client cadaver:
* cadaver http://myurl/dav/fileserver.php
*/
/**
@ -58,8 +61,9 @@ $entity = (GETPOST('entity', 'int') ? GETPOST('entity', 'int') : (!empty($conf->
$publicDir = $conf->dav->multidir_output[$entity].'/public';
$privateDir = $conf->dav->multidir_output[$entity].'/private';
$ecmDir = $conf->ecm->multidir_output[$entity];
$tmpDir = $conf->dav->multidir_temp[$entity];
//var_dump($tmpDir);exit;
$tmpDir = $conf->dav->multidir_output[$entity]; // We need root dir, not a dir that can be deleted
//var_dump($tmpDir);mkdir($tmpDir);exit;
// Authentication callback function
$authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function ($username, $password) {
@ -152,8 +156,11 @@ $lockPlugin = new \Sabre\DAV\Locks\Plugin($lockBackend);
$server->addPlugin($lockPlugin);
// Support for html frontend
$browser = new \Sabre\DAV\Browser\Plugin();
$server->addPlugin($browser);
if (empty($conf->global->DAV_DISABLE_BROWSER))
{
$browser = new \Sabre\DAV\Browser\Plugin();
$server->addPlugin($browser);
}
// Automatically guess (some) contenttypes, based on extension
//$server->addPlugin(new \Sabre\DAV\Browser\GuessContentType());

View File

@ -102,6 +102,9 @@ if (! $sortorder) $sortorder="ASC";
if ($cancel) $action='';
$usercanread = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->lire) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->lire));
$usercancreate = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer));
$parameters=array('socid'=>$socid, 'id_prod'=>$id);
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -385,9 +388,9 @@ if ($id > 0 || $ref)
$textdesc =$langs->trans("CostPriceDescription");
$textdesc.="<br>".$langs->trans("CostPriceUsage");
$text=$form->textwithpicto($langs->trans("CostPrice"), $textdesc, 1, 'help', '');
print $form->editfieldkey($text, 'cost_price', $object->cost_price, $object, $user->rights->produit->creer||$user->rights->service->creer, 'amount:6');
print $form->editfieldkey($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6');
print '</td><td colspan="2">';
print $form->editfieldval($text, 'cost_price', $object->cost_price, $object, $user->rights->produit->creer||$user->rights->service->creer, 'amount:6');
print $form->editfieldval($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6');
print '</td></tr>';
print '</table>';
@ -399,7 +402,7 @@ if ($id > 0 || $ref)
// Form to add or update a price
if (($action == 'add_price' || $action == 'updateprice' ) && ($user->rights->produit->creer || $user->rights->service->creer))
if (($action == 'add_price' || $action == 'updateprice' ) && $usercancreate)
{
$langs->load("suppliers");
@ -747,7 +750,7 @@ SCRIPT;
$reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
if ($user->rights->produit->creer || $user->rights->service->creer)
if ($usercancreate)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/product/fournisseurs.php?id='.$object->id.'&amp;action=add_price">';
print $langs->trans("AddSupplierPrice").'</a>';
@ -758,7 +761,7 @@ SCRIPT;
print "\n</div>\n";
print '<br>';
if ($user->rights->fournisseur->lire)
if ($user->rights->fournisseur->lire) // Duplicate ? this check is already in the head of this file
{
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
@ -822,7 +825,7 @@ SCRIPT;
print '<td>'.$productfourn->getSocNomUrl(1, 'supplier').'</td>';
// Supplier ref
if ($user->rights->produit->creer || $user->rights->service->creer) // change required right here
if ($usercancreate) // change required right here
{
print '<td class="left">'.$productfourn->getNomUrl().'</td>';
}
@ -924,7 +927,7 @@ SCRIPT;
// Modify-Remove
print '<td class="center nowraponall">';
if ($user->rights->produit->creer || $user->rights->service->creer)
if ($usercancreate)
{
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$productfourn->fourn_id.'&amp;action=add_price&amp;rowid='.$productfourn->product_fourn_price_id.'">'.img_edit()."</a>";
print ' &nbsp; ';

View File

@ -1370,12 +1370,12 @@ else
print "\n";
print '<script language="JavaScript" type="text/javascript">';
print "function CheckVAT(a) {\n";
print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."',500,300);\n";
print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."', 540, 350);\n";
print "}\n";
print '</script>';
print "\n";
$s.='<a href="#" class="hideonsmartphone" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
$s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1);
$s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1);
}
else
{

View File

@ -155,7 +155,7 @@ print '<input type="hidden" name="action" value="setvalue">';
dol_fiche_head($head, 'stripeaccount', '', -1);
$stripearrayofwebhookevents=array('payout.created','payout.paid','charge.pending','charge.refunded','charge.succeeded','charge.failed','payment_intent.succeeded','payment_intent.payment_failed','source.chargeable','customer.deleted');
$stripearrayofwebhookevents=array('payout.created','payout.paid','charge.pending','charge.refunded','charge.succeeded','charge.failed','payment_intent.succeeded','payment_intent.payment_failed','payment_method.attached','payment_method.updated','payment_method.card_automatically_updated','payment_method.detached','source.chargeable','customer.deleted');
print $langs->trans("StripeDesc")."<br>\n";

View File

@ -2512,7 +2512,8 @@ class User extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
*
@ -2522,7 +2523,7 @@ class User extends CommonObject
* 2=Return key only (RDN) (uid=qqq)
* @return string DN
*/
private function _load_ldap_dn($info, $mode = 0)
public function _load_ldap_dn($info, $mode = 0)
{
// phpcs:enable
global $conf;
@ -2533,13 +2534,14 @@ class User extends CommonObject
return $dn;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Initialize the info array (array of LDAP values) that will be used to call LDAP functions
*
* @return array Tableau info des attributs
*/
private function _load_ldap_info()
public function _load_ldap_info()
{
// phpcs:enable
global $conf,$langs;

View File

@ -924,7 +924,8 @@ class UserGroup extends CommonObject
return $result;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
*
@ -934,7 +935,7 @@ class UserGroup extends CommonObject
* 2=Return key only (uid=qqq)
* @return string DN
*/
private function _load_ldap_dn($info, $mode = 0)
public function _load_ldap_dn($info, $mode = 0)
{
// phpcs:enable
global $conf;
@ -946,13 +947,14 @@ class UserGroup extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Initialize the info array (array of LDAP values) that will be used to call LDAP functions
*
* @return array Tableau info des attributs
*/
private function _load_ldap_info()
public function _load_ldap_info()
{
// phpcs:enable
global $conf,$langs;