diff --git a/htdocs/admin/dav.php b/htdocs/admin/dav.php index 894706576b5..6ac210c1ddb 100644 --- a/htdocs/admin/dav.php +++ b/htdocs/admin/dav.php @@ -153,7 +153,7 @@ print "\n"; clearstatcache(); -print $langs->trans("WebDAVSetupDesc")."
\n"; +print ''.$langs->trans("WebDAVSetupDesc")."
\n"; print "
"; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 24c53d26526..19fe59062dd 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -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 ''; print ''; - print ''; + print ''; } if (! empty($arrayfields['pr.ref']['checked'])) { print ''; print ''; - print ''; + print ''; + } + if (! empty($arrayfields['pr.title']['checked'])) + { + print ''; + print ''; + print ''; } if (! empty($arrayfields['s.nom']['checked'])) { print ''; print ''; - print ''; + print ''; } if (! empty($arrayfields['s.town']['checked'])) print ''; if (! empty($arrayfields['s.zip']['checked'])) print ''; @@ -687,7 +696,8 @@ if ($resql) print ''; 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 ''; if (! empty($arrayfields['p.ref']['checked'])) @@ -767,7 +787,7 @@ if ($resql) if (! empty($arrayfields['p.ref_client']['checked'])) { // Customer ref - print ''; + print ''; print $obj->ref_client; print ''; if (! $i) $totalarray['nbfield']++; @@ -776,20 +796,24 @@ if ($resql) if (! empty($arrayfields['pr.ref']['checked'])) { // Project ref - print ''; - if ($obj->project_id) { - $projectstatic->fetch($obj->project_id); + print ''; + if ($obj->project_id > 0) { print $projectstatic->getNomUrl(1); } print ''; 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 ''; + if ($obj->project_id > 0) { + print $projectstatic->title; + } + print ''; + if (! $i) $totalarray['nbfield']++; + } // Thirdparty if (! empty($arrayfields['s.nom']['checked'])) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 13f9d2a2b1d..4ff7fe364bd 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -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 ''; } // Project ref - if (! empty($arrayfields['p.project_ref']['checked'])) + if (! empty($arrayfields['p.ref']['checked'])) { print ''; } + // Project title + if (! empty($arrayfields['p.title']['checked'])) + { + print ''; + } // Thirpdarty if (! empty($arrayfields['s.nom']['checked'])) { @@ -722,7 +730,8 @@ if ($resql) print ''; 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 ''; // 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 ''; - if ($obj->project_id > 0) print $projectstatic->getNomUrl(1); + print ''; + if ($obj->project_id > 0) + { + print $projectstatic->getNomUrl(1); + } print ''; if (! $i) $totalarray['nbfield']++; } + // Project label + if (! empty($arrayfields['p.title']['checked'])) + { + print ''; + if ($obj->project_id > 0) + { + print $projectstatic->title; + } + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Third party if (! empty($arrayfields['s.nom']['checked'])) { diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index a418696c15d..fe669a73312 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -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 '
'.$langs->trans("Alert"); print ''; } - // Project + // Project ref if (! empty($arrayfields['p.ref']['checked'])) { - print ''; + print ''; + } + // Project label + if (! empty($arrayfields['p.title']['checked'])) + { + print ''; } // 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 ''; 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 ''; if (! $i) $totalarray['nbfield']++; } + // Project title + if (! empty($arrayfields['p.title']['checked'])) + { + print ''; + if ($obj->project_id > 0) + { + print $projectstatic->title; + } + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Third party if (! empty($arrayfields['s.nom']['checked'])) { diff --git a/htdocs/core/ajax/getaccountcurrency.php b/htdocs/core/ajax/getaccountcurrency.php index d4168b17174..a24133f4448 100644 --- a/htdocs/core/ajax/getaccountcurrency.php +++ b/htdocs/core/ajax/getaccountcurrency.php @@ -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 diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index 3c1b486b50d..09de3b874e3 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -138,7 +138,7 @@ class box_factures_fourn_imp extends ModeleBoxes $tooltip = $langs->trans('SupplierInvoice') . ': ' . ($objp->ref?$objp->ref:$objp->facid) . '
' . $langs->trans('RefSupplier') . ': ' . $objp->ref_supplier; $this->info_box_contents[$line][] = array( - 'td' => '', + 'td' => 'class="nowraponall"', 'text' => $facturestatic->getNomUrl(1), 'text2'=> $late, 'asis' => 1 diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 86e092de7c3..e7281708802 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -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 ); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 80aeb83b064..3ee0cd1f3e1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -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 ''; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index e5c765383af..76d3d54515d 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -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; } diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index e9876271dc3..9f81d343c8b 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -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( diff --git a/htdocs/dav/fileserver.php b/htdocs/dav/fileserver.php index 55284036bea..4e99cf92613 100644 --- a/htdocs/dav/fileserver.php +++ b/htdocs/dav/fileserver.php @@ -14,6 +14,9 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . + * + * 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()); diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index cc922cb724b..d5ec0d6d2df 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -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.="
".$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 ''; - 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 ''; print ''; @@ -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 ''; print $langs->trans("AddSupplierPrice").''; @@ -758,7 +761,7 @@ SCRIPT; print "\n\n"; print '
'; - 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 ''.$productfourn->getSocNomUrl(1, 'supplier').''; // Supplier ref - if ($user->rights->produit->creer || $user->rights->service->creer) // change required right here + if ($usercancreate) // change required right here { print ''.$productfourn->getNomUrl().''; } @@ -924,7 +927,7 @@ SCRIPT; // Modify-Remove print ''; - if ($user->rights->produit->creer || $user->rights->service->creer) + if ($usercancreate) { print ''.img_edit().""; print '   '; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 885d699b096..292d109fd74 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1370,12 +1370,12 @@ else print "\n"; print ''; print "\n"; $s.=''.$langs->trans("VATIntraCheck").''; - $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); + $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 9b9914d6c7e..2bc257e1f77 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -155,7 +155,7 @@ print ''; 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")."
\n"; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index f6a8eb9f8d9..13ae44463d6 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -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; diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index eada58c3e3b..c3fe000292c 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -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;