diff --git a/README-FR.md b/README-FR.md index 3f1819f6370..53ae1be8e8d 100644 --- a/README-FR.md +++ b/README-FR.md @@ -77,50 +77,56 @@ Voir fichier ChangeLog. ## CE QUE DOLIBARR PEUT FAIRE -Modules principaux: +### Modules principaux (tous optionnels): + - Annuaires des prospects et/ou client et/ou fournisseurs - Gestion de catalogue de produits et services -- Gestion de stock +- Gestion des devis, propositions commerciales +- Gestion des commandes +- Gestion des factures clients/fournisseurs et paiements +- Gestion des virements bancaires SEPA - Gestion des comptes bancaires - Agenda partagé -- Gestion des commandes -- Gestion des devis, propositions commerciales -- Gestion des factures clients et fournisseurs +- Suivi des opportunités et/ou projets (suivi de rentabilité incluant les factures, notes de frais, temps consommé valorisé, ...) - Gestion de contrats de services -- Gestion des paiements -- Gestion des virements bancaires +- Gestion de stock - Gestion des expéditions - GED (Gestion Electronique de Documents) - EMailings de masse - Réalisation de sondages - Point de vente/Caisse enregistreuse +- … + +### Autres modules: -Autres modules: - Gestion de marque-pages - Gestion des promesses de dons - Gestion de la TVA NPR (non perçue récupérable - pour les utilisateurs français des DOM-TOM) - Rapports - Imports/Exports des données - Connectivité LDAP -- Export PDF de tous les éléments (factures, propositions commerciales, commandes, bons expéditions, etc...) - De nombreuses autres fonctionnalités issues de modules officiels ou non (AWStats, Bittorrent, Gravatar, Google, Webcalendar...) +- … + +### Divers: -Divers: - Application multi-utilisateurs avec différents niveaux de permissions par module. +- Peux être multi-société par ajout du module externe multi-société. +- Peux-être multi-devise par ajout du module externe multi-devise. - Plusieurs gestionnaires de menus (possibilité de différencier les menus pour les utilisateurs internes ou externes comme les clients ou fournisseurs). - Application simple à utiliser. - Plusieurs thèmes visuels. - Code simple et facilement personnalisable. - Requiert PHP et Mysql ou Postgresql (Voir versions exactes sur http://wiki.dolibarr.org/index.php/Prérequis). - Compatible avec toutes les offres Cloud du marché respectant les prérequis MySQL et PHP ou Postgresql. +- Export PDF de tous les éléments (factures, propositions commerciales, commandes, bons expéditions, etc...) ## CE QUE DOLIBARR NE PEUT PAS FAIRE (TACHES A FAIRE) Voici un liste de fonctionnalites pas encore gérées par Dolibarr: -- Pas de compta analytique double-partie (uniquement gestion de trésorerie). +- Pas encore de compta analytique double-partie (uniquement gestion de trésorerie). - Dolibarr ne gère qu'une seule monnaie à la fois (mono-devise). -- Dolibarr ne gère en standard qu'une société/institution/association mère (mono-société). Pour en gérer plusieurs (comme vos filiales), il faut, soit faire plusieurs installations de Dolibarr, soit installer le module MultiCompany qui permet de gérer n société/institutions/associations dans une seule instance par une isolation logique des données. - Dolibarr ne contient pas de module de Gestion de la paie. - Les tâches du module de gestion de projets n'ont pas de dépendance entre elle. - Dolibarr ne contient pas de Webmail. diff --git a/README.md b/README.md index 8359b66cbd9..576e3153ef9 100644 --- a/README.md +++ b/README.md @@ -69,39 +69,22 @@ See the [ChangeLog](ChangeLog) file. ## FEATURES -### General features -- Users and groups with finely grained rights -- Localization in most major languages -- Very user friendly and easy to use -- Highly customizable: enable only the modules you need, add user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one) -- Works with PHP 5.3+ and MySQL 4.1+ or PostgreSQL 8.1. (See requirements on the [Wiki](http://wiki.dolibarr.org/index.php/Prerequisite)) -- Compatible with all Cloud solutions that match MySQL, PHP or PostgreSQL prerequisites. -- An easy to understand, maintain and code interfaces with your own information system (PHP with no heavy framework; trigger and hook architecture) -- Support for country specific features: - - Spanish Tax RE and ISPF - - French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM) - - Canadian double taxes (federal/province) and other countries using cumulative VAT - - Tunisian tax stamp - - Compatible with [European directives](http://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE) -- ... - -### Main modules +### Main modules (all optional) - Customers, Prospects and/or Suppliers directory - Products and/or Services catalog -- Bank accounts management -- Customer and Supplier Orders management - Commercial proposals management -- Contracts management -- Invoices management +- Customer and Supplier Orders management +- Invoices and payment management +- Standing orders management (European SEPA) +- Bank accounts management +- Shared calendar +- Opportunities and/or project management (following project benefit including invoices, expense reports, time spent, ...) - Projects management -- Events management -- Payments management -- Standing orders management +- Contracts management - Stock management - Shipping management - Interventions management -- PDF or ODT generation for invoice, proposals, orders... - Agenda with ical and vcal export for third party tools integration - Electronic Document Management (EDM) - Foundations members management @@ -127,6 +110,25 @@ See the [ChangeLog](ChangeLog) file. - Payment platforms integration (PayBox, PayPal) - … +### Other general features +- Multi-Users and groups with finely grained rights +- Localization in most major languages +- Can manage several companies by adding external module multi-company. +- Can manage several currencies by adding external module multi-currency. +- Very user friendly and easy to use +- Highly customizable: enable only the modules you need, add user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one) +- Works with PHP 5.3+ and MySQL 4.1+ or PostgreSQL 8.1. (See requirements on the [Wiki](http://wiki.dolibarr.org/index.php/Prerequisite)) +- Compatible with all Cloud solutions that match MySQL, PHP or PostgreSQL prerequisites. +- An easy to understand, maintain and code interfaces with your own information system (PHP with no heavy framework; trigger and hook architecture) +- Support for country specific features: + - Spanish Tax RE and ISPF + - French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM) + - Canadian double taxes (federal/province) and other countries using cumulative VAT + - Tunisian tax stamp + - Compatible with [European directives](http://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE) +- PDF or ODT generation for invoice, proposals, orders... +- … + ### Extending Dolibarr can be extended with a lot of other external modules from third party developers available at the [DoliStore](http://www.dolistore.com). @@ -135,10 +137,7 @@ Dolibarr can be extended with a lot of other external modules from third party d These are features that Dolibarr does **not** yet fully support: -- Double-entry bookkeeping (only bank and treasury management) -- Multiple currencies -- Multiple companies - If you want to manage several companies or foundations, you must install the software several times (on same server or not) or use the MultiCompany addon module that allows to manage several companies in one Dolibarr instance (one database but with a logical isolation of datas) +- Double-entry bookkeeping yet (only bank and treasury management) - Tasks dependencies in projects - Payroll module - Webmail diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index 74036ec8e8d..77fa8022968 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -96,11 +96,11 @@ if ($object->id > 0) // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' '; + print ''.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' '; } // Type - print ''.$langs->trans("Type").''.$adht->getNomUrl(1)."\n"; + print ''.$langs->trans("Type").''.$adht->getNomUrl(1)."\n"; // Morphy print ''.$langs->trans("Nature").''.$object->getmorphylib().''; @@ -116,16 +116,6 @@ if ($object->id > 0) print ''.$langs->trans("UserTitle").''.$object->getCivilityLabel().' '; print ''; - // Lastname - print ''.$langs->trans("Lastname").''.$object->lastname.' '; - print ''; - - // Firstname - print ''.$langs->trans("Firstname").''.$object->firstname.' '; - - // Status - print ''.$langs->trans("Status").''.$object->getLibStatut(4).''; - print ''; print ''; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 2123b59ab8d..b9224253bac 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1432,13 +1432,6 @@ else print ''.$langs->trans("UserTitle").''.$object->getCivilityLabel().' '; print ''; - // Lastname - print ''.$langs->trans("Lastname").''.$object->lastname.' '; - print ''; - - // Firstname - print ''.$langs->trans("Firstname").''.$object->firstname.' '; - // Password if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { @@ -1559,6 +1552,22 @@ else } print ''; + // Date end subscription + print ''.$langs->trans("SubscriptionEndDate").''; + if ($object->datefin) + { + print dol_print_date($object->datefin,'day'); + if ($object->hasDelay()) { + print " ".img_warning($langs->trans("Late")); + } + } + else + { + print $langs->trans("SubscriptionNotReceived"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + } + print ''; + print "\n"; print "\n"; diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index fb3807fcc5c..fa440c3bac4 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -572,46 +572,150 @@ if ($rowid > 0) dol_banner_tab($object, 'rowid', $linkback); print '
'; + print '
'; print '
'; print ''; - // Login - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) - { - print ''; - print $showphoto; $showphoto=''; - print ''; - } + // Login + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + print ''; + } - // Type - print '\n"; + // Type + print '\n"; - // Morphy - print ''; - print $showphoto; $showphoto=''; - print ''; + // Morphy + print ''; + print ''; - // Company - print ''; + // Company + print ''; - // Civility - print ''; - print ''; + // Civility + print ''; + print ''; - // Lastname - print ''; - print ''; + // Password + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + print ''; + } - // Firstname - print ''; - print ''; + // Skype + if (! empty($conf->skype->enabled)) + { + print ''; + } - // EMail - print ''; + print '
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("Type").''.$adht->getNomUrl(1)."
'.$langs->trans("Type").''.$adht->getNomUrl(1)."
'.$langs->trans("Nature").''.$object->getmorphylib().'
'.$langs->trans("Nature").''.$object->getmorphylib().'
'.$langs->trans("Company").''.$object->societe.'
'.$langs->trans("Company").''.$object->societe.'
'.$langs->trans("UserTitle").''.$object->getCivilityLabel().' 
'.$langs->trans("UserTitle").''.$object->getCivilityLabel().' 
'.$langs->trans("Lastname").''.$object->lastname.' 
'.$langs->trans("Password").''.preg_replace('/./i','*',$object->pass); + if ((! empty($object->pass) || ! empty($object->pass_crypted)) && empty($object->user_id)) + { + $langs->load("errors"); + $htmltext=$langs->trans("WarningPasswordSetWithNoAccount"); + print ' '.$form->textwithpicto('', $htmltext,1,'warning'); + } + print '
'.$langs->trans("Firstname").''.$object->firstname.' 
'.$langs->trans("Skype").''.dol_print_skype($object->skype,0,$object->fk_soc,1).'
'.$langs->trans("EMail").''.dol_print_email($object->email,0,$object->fk_soc,1).'
'; + + print '
'; + print '
'; + + print '
'; + print ''; + + // Birthday + print ''; - // Status - print ''; + // Public + print ''; + + // Categories + if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + { + print ''; + print ''; + } + + // Other attributes + $parameters=array('colspan'=>2); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $object->showOptionals($extrafields, 'view', $parameters); + } + + // Third party Dolibarr + if (! empty($conf->societe->enabled)) + { + print ''; + } + + // Login Dolibarr + print ''; // Date end subscription print ''; - // Third party Dolibarr - if (! empty($conf->societe->enabled)) - { - print ''; - } - - // Login Dolibarr - print ''; - print "
'.$langs->trans("Birthday").''.dol_print_date($object->birth,'day').'
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("Public").''.yn($object->public).'
' . $langs->trans("Categories") . ''; + print $form->showCategories($object->id, 'member', 1); + print '
'; + print ''; + if ($action != 'editthirdparty' && $user->rights->adherent->creer) print ''; + print '
'; + print $langs->trans("LinkedToDolibarrThirdParty"); + print 'id.'">'.img_edit($langs->trans('SetLinkToThirdParty'),1).'
'; + print '
'; + if ($action == 'editthirdparty') + { + $htmlname='socid'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $form->select_company($object->fk_soc,'socid','',1); + print '
'; + } + else + { + if ($object->fk_soc) + { + $company=new Societe($db); + $result=$company->fetch($object->fk_soc); + print $company->getNomUrl(1); + } + else + { + print $langs->trans("NoThirdPartyAssociatedToMember"); + } + } + print '
'; + print ''; + if ($action != 'editlogin' && $user->rights->adherent->creer) + { + print ''; + } + print '
'; + print $langs->trans("LinkedToDolibarrUser"); + print ''; + if ($user->rights->user->user->creer) + { + print 'id.'">'.img_edit($langs->trans('SetLinkToUser'),1).''; + } + print '
'; + print '
'; + if ($action == 'editlogin') + { + $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'userid',''); + } + else + { + if ($object->user_id) + { + $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'none'); + } + else print $langs->trans("NoDolibarrAccess"); + } + print '
'.$langs->trans("SubscriptionEndDate").''; @@ -629,76 +733,10 @@ if ($rowid > 0) } print '
'; - print ''; - if ($action != 'editthirdparty' && $user->rights->adherent->creer) print ''; - print '
'; - print $langs->trans("LinkedToDolibarrThirdParty"); - print 'id.'">'.img_edit($langs->trans('SetLinkToThirdParty'),1).'
'; - print '
'; - if ($action == 'editthirdparty') - { - $htmlname='socid'; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $form->select_company($object->fk_soc,'socid','',1); - print '
'; - } - else - { - if ($object->fk_soc) - { - $company=new Societe($db); - $result=$company->fetch($object->fk_soc); - print $company->getNomUrl(1); - } - else - { - print $langs->trans("NoThirdPartyAssociatedToMember"); - } - } - print '
'; - print ''; - if ($action != 'editlogin' && $user->rights->adherent->creer) print ''; - print '
'; - print $langs->trans("LinkedToDolibarrUser"); - print 'id.'">'.img_edit($langs->trans('SetLinkToUser'),1).'
'; - print '
'; - if ($action == 'editlogin') - { - /*$include=array(); - if (empty($user->rights->user->user->creer)) // If can edit only itself user, we can link to itself only - { - $include=array($object->user_id,$user->id); - }*/ - $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'userid',''); - } - else - { - if ($object->user_id) - { - $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'none'); - } - else print $langs->trans("NoDolibarrAccess"); - } - print '
\n"; - print '
'; + print "
\n"; + print '
'; dol_fiche_end(); diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 71f1df22937..4dd5fd9bf64 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -83,6 +83,7 @@ include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php * View */ +$form = new Form($db); llxHeader(); @@ -91,19 +92,7 @@ if ($id > 0) $result=$membert->fetch($object->typeid); if ($result > 0) { - /* - * Affichage onglets - */ - if (! empty($conf->notification->enabled)) - $langs->load("mails"); - - $head = member_prepare_head($object); - - $form=new Form($db); - - dol_fiche_head($head, 'document', $langs->trans("Member"),0,'user'); - - + // Construit liste des fichiers $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; @@ -111,34 +100,41 @@ if ($id > 0) { $totalsize+=$file['size']; } + + if (! empty($conf->notification->enabled)) + $langs->load("mails"); + $head = member_prepare_head($object); - print ''; + dol_fiche_head($head, 'document', $langs->trans("Member"),0,'user'); + + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'rowid', $linkback); + + print '
'; + + print '
'; + print '
'; $linkback = ''.$langs->trans("BackToList").''; - // Ref - print ''; - print ''; - // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''; + print ''; } + // Type + print '\n"; + // Morphy - print ''; + print ''; /*print '';*/ print ''; - // Type - print '\n"; - // Company print ''; @@ -146,17 +142,6 @@ if ($id > 0) print ''; print ''; - // Lastname - print ''; - print ''; - - // Firstname - print ''; - print ''; - - // Status - print ''; - // Nbre fichiers print ''; @@ -166,6 +151,8 @@ if ($id > 0) print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'rowid', $linkback); - print '
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("Type").''.$membert->getNomUrl(1)."
'.$langs->trans("Nature").''.$object->getmorphylib().'
'.$langs->trans("Nature").''.$object->getmorphylib().''; print $form->showphoto('memberphoto',$object); print '
'.$langs->trans("Type").''.$membert->getNomUrl(1)."
'.$langs->trans("Company").''.$object->societe.'
'.$langs->trans("UserTitle").''.$object->getCivilityLabel().' 
'.$langs->trans("Lastname").''.$object->lastname.' 
'.$langs->trans("Firstname").''.$object->firstname.' 
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'; print ''; + + dol_fiche_end(); $modulepart = 'member'; $permission = $user->rights->adherent->creer; diff --git a/htdocs/adherents/fiche_subscription.php b/htdocs/adherents/fiche_subscription.php index 6f0177d4b6f..6b980a4df1c 100644 --- a/htdocs/adherents/fiche_subscription.php +++ b/htdocs/adherents/fiche_subscription.php @@ -180,18 +180,24 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') $head[$h][2] = 'info'; $h++; - dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment'); - - print "\n"; print '
'; print ''; print ""; print ""; print "fk_bank."\">"; + + dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment'); + + print "\n"; print ''; + $linkback = ''.$langs->trans("BackToList").''; + // Ref - print ''; + print ''; + print ''; // Member $adh->ref=$adh->getFullName($langs); @@ -239,18 +245,18 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') } } - print '
'.$langs->trans("Ref").''.$subscription->ref.' 
'.$langs->trans("Ref").''; + print $form->showrefnav($subscription, 'rowid', $linkback, 1); + print '
'; - print ''; + print '
'; + + dol_fiche_end(); + + print '
'; + print ''; print '       '; print ''; - print ''; - - print ''; + print '
'; + print '
'; print "\n"; - - print ''; - print "\n"; } if ($rowid && $action != 'edit') @@ -355,8 +361,7 @@ if ($rowid && $action != 'edit') print "\n"; print ''; - print "\n"; - + dol_fiche_end(); /* * Barre d'actions @@ -388,6 +393,6 @@ if ($rowid && $action != 'edit') } -$db->close(); - llxFooter(); + +$db->close(); diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index d6c17337176..f6bdb81345c 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -125,29 +125,32 @@ if ($result) //print ''; print '
'; +// Search contact/address +if (! empty($conf->adherent->enabled) && $user->rights->adherent->lire) +{ + $listofsearchfields['search_member']=array('text'=>'Member'); +} + +if (count($listofsearchfields)) +{ + print '
'; + print ''; + print ''; + $i=0; + foreach($listofsearchfields as $key => $value) + { + if ($i == 0) print ''; + print ''; + print ''; + if ($i == 0) print ''; + print ''; + $i++; + } + print '
'.$langs->trans("Search").'
:
'; + print '
'; + print '
'; +} -// Formulaire recherche adherent -print '
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; -$var=false; -print ""; -print ''; -print ""; -print ''; -print ""; -print ''; -print "
'.$langs->trans("SearchAMember").'
'; -print ':'; -print '
'; -print ':'; -print '
'; -print ':'; -print '
"; /* @@ -156,7 +159,6 @@ print ""; if ($conf->use_javascript_ajax) { - print '
'; print ''; print ''; print ''; print ''; - print ''; + print ''; if ($i == 0) print ''; print ''; $i++; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 7d1539ff0f5..c623069cd85 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -108,6 +108,15 @@ $viewstatut=$object_statut; // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('propallist')); +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'p.ref'=>'Ref', + 'p.ref_client'=>'CustomerRef', + 'pd.description'=>'Description', + 's.nom'=>"ThirdParty", + 'p.note_public'=>'NotePublic', +); +if (empty($user->socid)) $fieldstosearchall["p.note_private"]="NotePrivate"; /* @@ -192,7 +201,7 @@ if ($search_montant_ht != '') $sql.= natural_search("p.total_ht", $search_montant_ht, 1); } if ($sall) { - $sql .= natural_search(array('s.nom', 'p.note_private', 'p.note_public', 'pd.description'), $sall); + $sql .= natural_search(array_keys($fieldstosearchall), $sall); } if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_product_category; if ($socid > 0) $sql.= ' AND s.rowid = '.$socid; @@ -262,8 +271,19 @@ if ($result) // Lignes des champs de filtre print ''; - if ($optioncss != '') print ''; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + if ($sall) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + //sort($fieldstosearchall); + print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall)); + } + $i = 0; $moreforfilter=''; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 19fd113138a..46ee8687fbb 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -76,7 +76,7 @@ $limit = $conf->liste_limit; $viewstatut=GETPOST('viewstatut'); // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_categ=''; $search_user=''; @@ -95,6 +95,17 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('orderlist')); +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'c.ref'=>'Ref', + 'c.ref_client'=>'RefCustomerOrder', + 'pd.description'=>'Description', + 's.nom'=>"ThirdParty", + 'c.note_public'=>'NotePublic', +); +if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate"; + + /* * Actions */ @@ -139,7 +150,7 @@ if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_produc if ($socid > 0) $sql.= ' AND s.rowid = '.$socid; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($search_ref) $sql .= natural_search('c.ref', $search_ref); -if ($sall) $sql .= natural_search(array('c.ref', 'c.note_private'), $sall); +if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); if ($viewstatut <> '') { if ($viewstatut < 4 && $viewstatut > -3) @@ -259,9 +270,19 @@ if ($resql) // Lignes des champs de filtre print ''; - if ($optioncss != '') print ''; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; print ''; + if ($sall) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall)); + } + $moreforfilter=''; // If the user can view prospects other than his' @@ -305,7 +326,7 @@ if ($resql) print ''; print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'c.ref','',$param,'width="25%"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('RefCustomerOrder'),$_SERVER["PHP_SELF"],'c.ref_client','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('ThirdParty'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('OrderDate'),$_SERVER["PHP_SELF"],'c.date_commande','',$param, 'align="center"',$sortfield,$sortorder); if (empty($conf->global->ORDER_DISABLE_DELIVERY_DATE)) print_liste_field_titre($langs->trans('DeliveryDate'),$_SERVER["PHP_SELF"],'c.date_livraison','',$param, 'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder); diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php index 2290edd8cc5..0b588fa64d0 100644 --- a/htdocs/compta/bank/document.php +++ b/htdocs/compta/bank/document.php @@ -200,7 +200,7 @@ if ($id > 0 || !empty($ref)) { * Confirmation suppression fichier */ if ($action == 'delete') { - $ret = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode($_GET["urlfile"]), + $ret = $form->form_confirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index e4993eacb88..fc090ef52e0 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -107,6 +107,16 @@ $hookmanager->initHooks(array('invoicelist')); $now=dol_now(); +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'f.facnumber'=>'Ref', + 'f.ref_client'=>'RefCustomer', + 'fd.description'=>'Description', + 's.nom'=>"ThirdParty", + 'f.note_public'=>'NotePublic', +); +if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate"; + /* * Actions @@ -134,6 +144,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $month=''; } + /* * View @@ -232,7 +243,7 @@ if (! $sall) } else { - $sql .= natural_search(array('s.nom', 'f.facnumber', 'f.note_public', 'fd.description'), $sall); + $sql .= natural_search(array_keys($fieldstosearchall), $sall); } $sql.= ' ORDER BY '; $listfield=explode(',',$sortfield); @@ -275,7 +286,19 @@ if ($resql) $i = 0; print ''."\n"; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if ($sall) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall)); + } + // If the user can view prospects other than his' $moreforfilter=''; if ($user->rights->societe->client->voir || $socid) diff --git a/htdocs/compta/hrm.php b/htdocs/compta/hrm.php index 12b410e29af..4122f850723 100644 --- a/htdocs/compta/hrm.php +++ b/htdocs/compta/hrm.php @@ -71,37 +71,40 @@ print load_fiche_titre($langs->trans("HRMArea"),'', 'title_hrm.png'); print '
'; -/* - * Search expenses - */ + +if (! empty($conf->holiday->enabled) && $user->rights->holiday->read) +{ + $langs->load("holiday"); + $listofsearchfields['search_holiday']=array('text'=>'TitreRequestCP'); +} if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) { $langs->load("trips"); - print ''; - print ''; - print '
'.$langs->trans("Statistics").'
'; diff --git a/htdocs/adherents/info.php b/htdocs/adherents/info.php index 27f36e9a843..36ed504dd73 100644 --- a/htdocs/adherents/info.php +++ b/htdocs/adherents/info.php @@ -42,23 +42,34 @@ $result=restrictedArea($user,'adherent',$id); * View */ +$form = new Form($db); + llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); -$adh = new Adherent($db); -$adh->fetch($id); -$adh->info($id); +$object = new Adherent($db); +$object->fetch($id); +$object->info($id); -$head = member_prepare_head($adh); +$head = member_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("Member"), 0, 'user'); -print '
'; -dol_print_object_info($adh); -print '
'; +$linkback = ''.$langs->trans("BackToList").''; + +dol_banner_tab($object, 'rowid', $linkback); + +print '
'; + +print '
'; + +print '
'; +dol_print_object_info($object); print '
'; +dol_fiche_end(); + llxFooter(); $db->close(); diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index 89572525c32..a2848b655b3 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -44,12 +44,11 @@ if ($user->societe_id > 0) $socid = $user->societe_id; } -$adh = new Adherent($db); -$adh->id = $rowid; -$result=$adh->fetch($rowid); +$object = new Adherent($db); +$result=$object->fetch($rowid); if (! $result) { - dol_print_error($db,"Failed to get adherent: ".$adh->error); + dol_print_error($db,"Failed to get adherent: ".$object->error); exit; } @@ -65,8 +64,8 @@ if ($action == 'dolibarr2ldap') $ldap=new Ldap(); $result=$ldap->connect_bind(); - $info=$adh->_load_ldap_info(); - $dn=$adh->_load_ldap_dn($info); + $info=$object->_load_ldap_info(); + $dn=$object->_load_ldap_dn($info); $olddn=$dn; // We can say that old dn = dn as we force synchro $result=$ldap->update($dn,$info,$user,$olddn); @@ -93,35 +92,27 @@ llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adhé $form = new Form($db); -$head = member_prepare_head($adh); +$head = member_prepare_head($object); dol_fiche_head($head, 'ldap', $langs->trans("Member"), 0, 'user'); +$linkback = ''.$langs->trans("BackToList").''; -print ''; +dol_banner_tab($object, 'rowid', $linkback); -// Ref -print ''; -print ''; +print '
'; -// Lastname -print '
'; -print ''; - -// Firstname -print ''; -print ''; +print '
'; +print '
'.$langs->trans("Ref").''; -print $form->showrefnav($adh,'id'); -print '
'.$langs->trans("Lastname").''.$adh->lastname.' 
'.$langs->trans("Firstname").''.$adh->firstname.' 
'; // Login -print ''; +print ''; // Password not crypted if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) { print ''; - print ''; + print ''; print "\n"; } @@ -129,12 +120,12 @@ if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) { print ''; - print ''; + print ''; print "\n"; } // Type -print '\n"; +print '\n"; $langs->load("admin"); @@ -155,6 +146,8 @@ print '
'.$langs->trans("Login").''.$adh->login.' 
'.$langs->trans("Login").''.$object->login.' 
'.$langs->trans("LDAPFieldPasswordNotCrypted").''.$adh->pass.''.$object->pass.'
'.$langs->trans("LDAPFieldPasswordCrypted").''.$adh->pass_crypted.''.$object->pass_crypted.'
'.$langs->trans("Type").''.$adh->type."
'.$langs->trans("Type").''.$object->type."
'; print ''; +dol_fiche_end(); + /* * Barre d'actions */ @@ -163,7 +156,7 @@ print '
'; if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr') { - print ''; + print ''; } print "
\n"; @@ -187,9 +180,9 @@ $ldap=new Ldap(); $result=$ldap->connect_bind(); if ($result > 0) { - $info=$adh->_load_ldap_info(); - $dn=$adh->_load_ldap_dn($info,1); - $search = "(".$adh->_load_ldap_dn($info,2).")"; + $info=$object->_load_ldap_info(); + $dn=$object->_load_ldap_dn($info,1); + $search = "(".$object->_load_ldap_dn($info,2).")"; if (empty($dn)) { diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index d89360631db..7d86c04869c 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -78,6 +78,21 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $hookmanager->initHooks(array('memberlist')); $extrafields = new ExtraFields($db); +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'd.rowid'=>'Ref', + //'d.ref'=>'Ref', + 'd.lastname'=>'Lastname', + 'd.firstname'=>'Firstname', + 'd.societe'=>"Company", + 'd.email'=>'EMail', + 'd.address'=>'Address', + 'd.zip'=>'Zip', + 'd.town'=>'Town', + 'd.note_public'=>'NotePublic', + 'd.note_private'=>'NotePrivate', +); + /* * View @@ -111,7 +126,7 @@ if ($catid == -2) $sql.= " AND cm.fk_categorie IS NULL"; if ($search_categ > 0) $sql.= " AND cm.fk_categorie = ".$db->escape($search_categ); if ($search_categ == -2) $sql.= " AND cm.fk_categorie IS NULL"; $sql.= " AND d.entity IN (".getEntity('adherent', 1).")"; -if ($sall) $sql.=natural_search(array("d.rowid", "d.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall); +if ($sall) $sql.=natural_search(array_keys($fieldstosearchall), $sall); if ($type > 0) $sql.=" AND t.rowid=".$db->escape($type); if (isset($_GET["statut"]) || isset($_POST["statut"])) $sql.=" AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules if ($search_ref) @@ -180,16 +195,16 @@ if ($resql) if ($optioncss != '') $param.='&optioncss='.$optioncss; print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); - if ($sall) - { - print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): "; - print ''.$sall.''; - } - print '
'; if ($optioncss != '') print ''; print ''; + if ($sall) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall)); + } + // Filter on categories $moreforfilter=''; if (! empty($conf->categorie->enabled)) diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index 79b7db086e6..a895d6cfef8 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -73,33 +73,31 @@ if ($id) print ""; print ''; - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Reference - print ''; - print ''; - print ''; + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'rowid', $linkback); + + print '
'; + + print '
'; + print '
'.$langs->trans('Ref').''; - print $form->showrefnav($object, 'id', $linkback); - print '
'; // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''; + print ''; } + // Type + print '\n"; + // Morphy - print ''; + print ''; /*print '';*/ print ''; - // Type - print '\n"; - // Company print ''; @@ -107,21 +105,13 @@ if ($id) print ''; print ''; - // Lastname - print ''; - print ''; - - // Firstname - print ''; - - // Status - print ''; - print "
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("Type").''.$adht->getNomUrl(1)."
'.$langs->trans("Nature").''.$object->getmorphylib().'
'.$langs->trans("Nature").''.$object->getmorphylib().''; print $form->showphoto('memberphoto',$member); print '
'.$langs->trans("Type").''.$adht->getNomUrl(1)."
'.$langs->trans("Company").''.$object->societe.'
'.$langs->trans("UserTitle").''.$object->getCivilityLabel().' 
'.$langs->trans("Lastname").''.$object->lastname.' 
'.$langs->trans("Firstname").''.$object->firstname.' 
'.$langs->trans("Status").''.$object->getLibStatut(4).'
"; + + print ''; print '
'; - $colwidth='20'; + $cssclass='titlefield'; $permission = $user->rights->adherent->creer; // Used by the include of notes.tpl.php include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 534b7af4572..18991f66bba 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -108,7 +108,7 @@ if (count($listofsearchfields)) { if ($i == 0) print '
'.$langs->trans("Search").'
::
'; - print ''; - print ""; - print "'; - print ''; - //print "'; - print ''; - print "
'.$langs->trans("SearchATripAndExpense").'
:
:

"; + $listofsearchfields['search_deplacement']=array('text'=>'ExpenseReport'); } - if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire) { $langs->load("trips"); - print '
'; - print ''; - print ''; - print ''; - print ""; - print "'; - print ''; - //print "'; - print ''; - print "
'.$langs->trans("SearchATripAndExpense").'
:
:

"; + $listofsearchfields['search_expensereport']=array('text'=>'ExpenseReport'); +} +if (count($listofsearchfields)) +{ + print '
'; + print ''; + print ''; + $i=0; + foreach($listofsearchfields as $key => $value) + { + if ($i == 0) print ''; + print ''; + print ''; + if ($i == 0) print ''; + print ''; + $i++; + } + print '
'.$langs->trans("Search").'
:
'; + print '
'; + print '
'; } diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 59ed9afc504..fea0708e2a8 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -90,56 +90,40 @@ print '
'; $max=3; -/* - * Search invoices - */ +// Search customer invoices if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { - print '
'; - print ''; - print ''; - print ""; - print ''; - print "'; - print ''; - print "'; - print ''; - print "
'.$langs->trans("SearchACustomerInvoice").'
:
:

"; + $listofsearchfields['search_invoice']=array('text'=>'CustomerInvoice'); } - -/* - * Search supplier invoices - */ +// Search supplier invoices if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) { - print '
'; - print ''; - print ''; - print ''; - print ""; - print "'; - print ''; - print "'; - print ''; - print "
'.$langs->trans("SearchASupplierInvoice").'
:
:

"; + $listofsearchfields['search_supplier_invoice']=array('text'=>'SupplierInvoice'); } - -/* - * Search donations - */ if (! empty($conf->don->enabled) && $user->rights->don->lire) { $langs->load("donations"); - print '
'; - print ''; - print ''; - print ''; - print ""; - print "'; - print ''; - //print "'; - print ''; - print "
'.$langs->trans("SearchADonation").'
:
:

"; + $listofsearchfields['search_donation']=array('text'=>'Donation'); +} + +if (count($listofsearchfields)) +{ + print '
'; + print ''; + print ''; + $i=0; + foreach($listofsearchfields as $key => $value) + { + if ($i == 0) print ''; + print ''; + print ''; + if ($i == 0) print ''; + print ''; + $i++; + } + print '
'.$langs->trans("Search").'
:
'; + print '
'; + print '
'; } /** diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index 62822a97690..6cf3daf5cad 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -95,6 +95,8 @@ if ($object->id) $totalsize+=$file['size']; } + $linkback = ''.$langs->trans("BackToList").''; + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); print '
'; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 4082ebbae80..2a1163111ed 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -40,6 +40,7 @@ $contactid = GETPOST('id','int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'contact', $contactid,''); +$sall=GETPOST("sall"); $search_firstlast_only=GETPOST("search_firstlast_only"); $search_lastname=GETPOST("search_lastname"); $search_firstname=GETPOST("search_firstname"); @@ -56,13 +57,13 @@ $search_priv=GETPOST("search_priv"); $search_categ=GETPOST("search_categ",'int'); $search_status=GETPOST("search_status",'int'); if ($search_status=='') $search_status=1; // always display activ customer first + $optioncss = GETPOST('optioncss','alpha'); $type=GETPOST("type"); $view=GETPOST("view"); -$sall=GETPOST("contactname"); $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); $page = GETPOST('page', 'int'); @@ -98,8 +99,9 @@ else if ($type == "o") $urlfiche=""; } -if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter')) // Both tests are required to be compatible with all browsers +if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter')) // All tests are required to be compatible with all browsers { + $sall=""; $search_firstlast_only=""; $search_lastname=""; $search_firstname=""; @@ -113,11 +115,17 @@ if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter')) // Both $search_email=""; $search_skype=""; $search_priv=""; - $sall=""; $seach_status=1; } if ($search_priv < 0) $search_priv=''; +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'p.lastname'=>'Lastname', + 'p.firstname'=>'Firstname', + 'p.email'=>'EMail', + 's.nom'=>"ThirdParty", +); /* @@ -225,7 +233,7 @@ else if ($type == "p") // filtre sur type } if ($sall) { - $sql .= natural_search(array('p.lastname', 'p.firstname', 'p.email', 's.nom'), $sall); + $sql .= natural_search(array_keys($fieldstosearchall), $sall); } if (! empty($socid)) { @@ -241,13 +249,13 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) // Add order and limit if($view == "recent") { - $sql.= " ORDER BY p.datec DESC "; - $sql.= " ".$db->plimit($conf->liste_limit+1, $offset); + $sql.= $db->order("p.datec","DESC"); + $sql.= $db->plimit($conf->liste_limit+1, $offset); } else { - $sql.= " ORDER BY $sortfield $sortorder "; - $sql.= " ".$db->plimit($conf->liste_limit+1, $offset); + $sql.= $db->order($sortfield,$sortorder); + $sql.= $db->plimit($conf->liste_limit+1, $offset); } //print $sql; @@ -278,11 +286,12 @@ if ($result) if ($sall) { - print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("ThirdParty")." ".$langs->trans("or")." ".$langs->trans("EMail")."): ".$sall; + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall)); } if ($search_firstlast_only) { - print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname")."): ".$search_firstlast_only; + print $langs->trans("FilterOnInto", $search_firstlast_only, $langs->trans("Lastname").", ".$langs->trans("Firstname")); } if (! empty($conf->categorie->enabled)) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index f7363984fb8..13be2859482 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -237,6 +237,7 @@ if (empty($reshook)) $object->fk_project = GETPOST('projectid','int'); $object->remise_percent = GETPOST('remise_percent','alpha'); $object->ref = GETPOST('ref','alpha'); + $object->ref_customer = GETPOST('ref_customer','alpha'); $object->ref_supplier = GETPOST('ref_supplier','alpha'); // If creation from another object of another module (Example: origin=propal, originid=1) @@ -747,7 +748,9 @@ if (empty($reshook)) { setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("RefNewContract")),'errors'); } - } else if ($action == 'update_extras') { + } + else if ($action == 'update_extras') + { // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); @@ -767,9 +770,10 @@ if (empty($reshook)) $action = 'edit_extras'; setEventMessage($object->error,'errors'); } - } elseif ($action=='setref_supplier') { + } + elseif ($action=='setref_supplier') + { $cancelbutton = GETPOST('cancel'); - if (!$cancelbutton) { $result = $object->fetch($id); @@ -790,7 +794,34 @@ if (empty($reshook)) header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id); exit; } - } elseif ($action=='setref') { + } + elseif ($action=='setref_customer') + { + $cancelbutton = GETPOST('cancel'); + + if (!$cancelbutton) + { + $result = $object->fetch($id); + if ($result < 0) { + setEventMessage($object->errors, 'errors'); + } + + $result = $object->setValueFrom('ref_customer',GETPOST('ref_customer','alpha')); + if ($result < 0) { + setEventMessage($object->errors, 'errors'); + $action = 'editref_customer'; + } else { + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } + } + else { + header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id); + exit; + } + } + elseif ($action=='setref') + { $cancelbutton = GETPOST('cancel'); if (!$cancelbutton) { @@ -1001,14 +1032,18 @@ if ($action == 'create') } print ''.$langs->trans('Ref').''.$tmpcode.''; + // Ref customer + print ''.$langs->trans('RefCustomer').''; + print ''; + // Ref supplier print ''.$langs->trans('RefSupplier').''; print ''; - // Customer + // Thirdparty print ''; - print ''.$langs->trans('Customer').''; - if($socid>0) + print ''.$langs->trans('Thirdparty').''; + if ($socid>0) { print ''; print $soc->getNomUrl(1); @@ -1018,7 +1053,7 @@ if ($action == 'create') else { print ''; - print $form->select_company('','socid','s.client = 1 OR s.client = 3',1); + print $form->select_company('','socid','',1); print ''; } print ''."\n"; @@ -1206,6 +1241,14 @@ else } print ''; + print ''; + print $form->editfieldkey("RefCustomer",'ref_customer',$object->ref_customer,$object,$user->rights->contrat->creer); + print ''; + print $form->editfieldval("RefCustomer",'ref_customer',$object->ref_customer,$object,$user->rights->contrat->creer); + print ''; + print ''; + + print ''; print ''; print $form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); print ''; @@ -1592,7 +1635,7 @@ else 'text' => $langs->trans("ConfirmMoveToAnotherContractQuestion"), array('type' => 'select', 'name' => 'newcid', 'values' => $arraycontractid)); - $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid'),$langs->trans("MoveToAnotherContract"),$langs->trans("ConfirmMoveToAnotherContract"),"confirm_move",$formquestion); + $form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid'),$langs->trans("MoveToAnotherContract"),$langs->trans("ConfirmMoveToAnotherContract"),"confirm_move",$formquestion); print '
'; } @@ -1604,7 +1647,7 @@ else $dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); $comment = GETPOST('comment'); - $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment),$langs->trans("ActivateService"),$langs->trans("ConfirmActivateService",dol_print_date($dateactstart,"%A %d %B %Y")),"confirm_active", '', 0, 1); + $form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment),$langs->trans("ActivateService"),$langs->trans("ConfirmActivateService",dol_print_date($dateactstart,"%A %d %B %Y")),"confirm_active", '', 0, 1); print '
'; } @@ -1616,7 +1659,7 @@ else $dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); $comment = GETPOST('comment'); - $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("CloseService"), $langs->trans("ConfirmCloseService",dol_print_date($dateactend,"%A %d %B %Y")), "confirm_closeline", '', 0, 1); + $form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("CloseService"), $langs->trans("ConfirmCloseService",dol_print_date($dateactend,"%A %d %B %Y")), "confirm_closeline", '', 0, 1); print '
'; } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 3b6b6bdac2e..1d2bd9f4181 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -50,6 +50,12 @@ class Contrat extends CommonObject */ protected $table_ref_field = 'ref'; + /** + * Customer reference of the contract + * @var string + */ + var $ref_customer; + /** * Supplier reference of the contract * @var string @@ -476,13 +482,13 @@ class Contrat extends CommonObject function fetch($id,$ref='') { $sql = "SELECT rowid, statut, ref, fk_soc, mise_en_service as datemise,"; + $sql.= " ref_supplier, ref_customer,"; + $sql.= " ref_ext,"; $sql.= " fk_user_mise_en_service, date_contrat as datecontrat,"; $sql.= " fk_user_author,"; $sql.= " fk_projet,"; $sql.= " fk_commercial_signature, fk_commercial_suivi,"; $sql.= " note_private, note_public, model_pdf, extraparams"; - $sql.= " ,ref_supplier"; - $sql.= " ,ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat"; if ($ref) { @@ -501,6 +507,7 @@ class Contrat extends CommonObject { $this->id = $result["rowid"]; $this->ref = (!isset($result["ref"]) || !$result["ref"]) ? $result["rowid"] : $result["ref"]; + $this->ref_customer = $result["ref_customer"]; $this->ref_supplier = $result["ref_supplier"]; $this->ref_ext = $result["ref_ext"]; $this->statut = $result["statut"]; @@ -839,7 +846,7 @@ class Contrat extends CommonObject // Insert contract $sql = "INSERT INTO ".MAIN_DB_PREFIX."contrat (datec, fk_soc, fk_user_author, date_contrat,"; $sql.= " fk_commercial_signature, fk_commercial_suivi, fk_projet,"; - $sql.= " ref, entity, note_private, note_public, ref_supplier, ref_ext)"; + $sql.= " ref, entity, note_private, note_public, ref_customer, ref_supplier, ref_ext)"; $sql.= " VALUES ('".$this->db->idate($now)."',".$this->socid.",".$user->id; $sql.= ", '".$this->db->idate($this->date_contrat)."'"; $sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL"); @@ -849,6 +856,7 @@ class Contrat extends CommonObject $sql.= ", ".$conf->entity; $sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL"); $sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL"); + $sql.= ", ".(!empty($this->ref_customer)?("'".$this->db->escape($this->ref_customer)."'"):"NULL"); $sql.= ", ".(!empty($this->ref_supplier)?("'".$this->db->escape($this->ref_supplier)."'"):"NULL"); $sql.= ", ".(!empty($this->ref_ext)?("'".$this->db->escape($this->ref_ext)."'"):"NULL"); $sql.= ")"; @@ -1101,6 +1109,7 @@ class Contrat extends CommonObject // Clean parameters if (isset($this->ref)) $this->ref=trim($this->ref); + if (isset($this->ref_customer)) $this->ref_customer=trim($this->ref_customer); if (isset($this->ref_supplier)) $this->ref_supplier=trim($this->ref_supplier); if (isset($this->ref_ext)) $this->ref_ext=trim($this->ref_ext); if (isset($this->entity)) $this->entity=trim($this->entity); @@ -1125,6 +1134,7 @@ class Contrat extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."contrat SET"; $sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").","; + $sql.= " ref_customer=".(isset($this->ref_customer)?"'".$this->db->escape($this->ref_customer)."'":"null").","; $sql.= " ref_supplier=".(isset($this->ref_supplier)?"'".$this->db->escape($this->ref_supplier)."'":"null").","; $sql.= " ref_ext=".(isset($this->ref_ext)?"'".$this->db->escape($this->ref_ext)."'":"null").","; $sql.= " entity=".$conf->entity.","; @@ -2024,6 +2034,8 @@ class Contrat extends CommonObject $this->specimen=1; $this->ref = 'SPECIMEN'; + $this->ref_customer = 'SPECIMENCUST'; + $this->ref_supplier = 'SPECIMENSUPP'; $this->socid = 1; $this->statut= 0; $this->date_contrat = dol_now(); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 9619713859a..07d3aa9e1c5 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -1,11 +1,11 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Claudio Aschieri + * Copyright (C) 2015 Jean-François Ferry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -80,6 +80,17 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both if ($search_status == '') $search_status=1; +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'c.ref'=>'Ref', + 'c.ref_customer'=>'RefCustomer', + 'c.ref_supplier'=>'RefSupplier', + 's.nom'=>"ThirdParty", + 'cd.description'=>'Description', + 'c.note_public'=>'NotePublic', +); +if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate"; + /* * View @@ -93,7 +104,7 @@ $socstatic = new Societe($db); llxHeader(); $sql = 'SELECT'; -$sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_supplier,"; +$sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier,"; $sql.= " s.nom as name, s.rowid as socid,"; $sql.= ' SUM('.$db->ifsql("cd.statut=0",1,0).') as nb_initial,'; $sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite >= '".$db->idate($now)."')",1,0).') as nb_running,'; @@ -132,7 +143,7 @@ if ($search_sale > 0) } if ($sall) { - $sql .= natural_search(array('s.nom', 'cd.label', 'cd.description'), $sall); + $sql .= natural_search(array_keys($fieldstosearchall), $sall); } if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; $sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_supplier, s.nom, s.rowid"; @@ -149,7 +160,17 @@ if ($resql) print '
'; if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + if ($sall) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall)); + } + // If the user can view prospects other than his' $moreforfilter=''; if ($user->rights->societe->client->voir || $socid) @@ -199,8 +220,9 @@ if ($resql) if ($optioncss != '') $param.='&optioncss='.$optioncss; print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_customer","","$param",'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("RefSupplier"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ThirdParty"), $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("SalesRepresentative"), $_SERVER["PHP_SELF"], "","","$param",'',$sortfield,$sortorder); //print_liste_field_titre($langs->trans("DateCreation"), $_SERVER["PHP_SELF"], "c.datec","","$param",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateContract"), $_SERVER["PHP_SELF"], "c.date_contrat","","$param",'align="center"',$sortfield,$sortorder); @@ -218,10 +240,13 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ' '; //print ' '; @@ -240,6 +265,7 @@ if ($resql) print img_object($langs->trans("ShowContract"),"contract").' '.(isset($obj->ref) ? $obj->ref : $obj->cid) .''; if ($obj->nb_late) print img_warning($langs->trans("Late")); print ''; + print ''.$obj->ref_customer.''; print ''.$obj->ref_supplier.''; print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.''; //print ''.dol_print_date($obj->datec).''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index bc1bdf7e790..1a63cbcca29 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3238,7 +3238,7 @@ class Form $formconfirm.= ($question ? '
'.img_help('','').' '.$question . '
': ''); $formconfirm.= '
'."\n"; - $formconfirm.= "\n\n"; + $formconfirm.= "\n\n"; $formconfirm.= ''; - $formconfirm.= "\n"; + $formconfirm.= "\n"; } else { - $formconfirm.= "\n\n"; + $formconfirm.= "\n\n"; $formconfirm.= ''."\n"; $formconfirm.= ''."\n"; @@ -3346,7 +3346,7 @@ class Form $formconfirm.= "\n"; $formconfirm.= '
'; - $formconfirm.= "\n"; + $formconfirm.= "\n"; } return $formconfirm; @@ -5265,9 +5265,9 @@ class Form $dir=$conf->societe->multidir_output[$entity]; $smallfile=$object->logo; $smallfile=preg_replace('/(\.png|\.gif|\.jpg|\.jpeg|\.bmp)/i','_small\\1',$smallfile); - if ($object->logo) $file=$id.'/logos/thumbs/'.$smallfile; + if (! empty($object->logo)) $file=$id.'/logos/thumbs/'.$smallfile; } - if ($modulepart=='contact') + else if ($modulepart=='contact') { $dir=$conf->societe->multidir_output[$entity].'/contact'; $file=$id.'/photos/'.$object->photo; @@ -5275,19 +5275,19 @@ class Form else if ($modulepart=='userphoto') { $dir=$conf->user->dir_output; - if ($object->photo) $file=get_exdir($id, 2, 0, 0, $object, 'user').$object->photo; + if (! empty($object->photo)) $file=get_exdir($id, 2, 0, 0, $object, 'user').$object->photo; if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility $email=$object->email; } else if ($modulepart=='memberphoto') { $dir=$conf->adherent->dir_output; - if ($object->photo) $file=get_exdir($id, 2, 0, 0, $object, 'invoice_supplier').'photos/'.$object->photo; + if (! empty($object->photo)) $file=get_exdir($id, 2, 0, 0, $object, 'invoice_supplier').'photos/'.$object->photo; if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility $email=$object->email; } else { $dir=$conf->$modulepart->dir_output; - if ($object->photo) $file=get_exdir($id, 2, 0, 0, $adherent, 'member').'photos/'.$object->photo; + if (! empty($object->photo)) $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.$object->photo; if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility $email=$object->email; } diff --git a/htdocs/core/search.php b/htdocs/core/search.php index 6dd5d46c72f..0307a8c77d1 100644 --- a/htdocs/core/search.php +++ b/htdocs/core/search.php @@ -64,7 +64,69 @@ if (GETPOST('search_contract') != '') header("Location: ".DOL_URL_ROOT.'/contrat/list.php?sall='.urlencode(GETPOST('search_contract'))); exit; } +if (GETPOST('search_invoice') != '') +{ + header("Location: ".DOL_URL_ROOT.'/compta/facture/list.php?sall='.urlencode(GETPOST('search_invoice'))); + exit; +} +if (GETPOST('search_supplier_invoice') != '') +{ + header("Location: ".DOL_URL_ROOT.'/fourn/facture/list.php?sall='.urlencode(GETPOST('search_supplier_invoice'))); + exit; +} +if (GETPOST('search_donation') != '') +{ + header("Location: ".DOL_URL_ROOT.'/don/list.php?sall='.urlencode(GETPOST('search_donation'))); + exit; +} +if (GETPOST('search_product') != '') +{ + header("Location: ".DOL_URL_ROOT.'/product/list.php?sall='.urlencode(GETPOST('search_product'))); + exit; +} +if (GETPOST('search_thirdparty') != '') +{ + header("Location: ".DOL_URL_ROOT.'/societe/list.php?mode=search&sall='.urlencode(GETPOST('search_thirdparty'))); + exit; +} +if (GETPOST('search_contact') != '') +{ + header("Location: ".DOL_URL_ROOT.'/contact/list.php?mode=search&sall='.urlencode(GETPOST('search_contact'))); + exit; +} +if (GETPOST('search_deplacement') != '') +{ + header("Location: ".DOL_URL_ROOT.'/compta/deplacement/list.php?mode=search&sall='.urlencode(GETPOST('search_deplacement'))); + exit; +} +if (GETPOST('search_expensereport') != '') +{ + header("Location: ".DOL_URL_ROOT.'/expensereport/list.php?mode=search&sall='.urlencode(GETPOST('search_expensereport'))); + exit; +} +if (GETPOST('search_holiday') != '') +{ + header("Location: ".DOL_URL_ROOT.'/holiday/list.php?mode=search&sall='.urlencode(GETPOST('search_holiday'))); + exit; +} +if (GETPOST('search_member') != '') +{ + header("Location: ".DOL_URL_ROOT.'/adherents/list.php?mode=search&sall='.urlencode(GETPOST('search_member'))); + exit; +} +if (GETPOST('search_project') != '') +{ + header("Location: ".DOL_URL_ROOT.'/projet/list.php?mode=search&search_all='.urlencode(GETPOST('search_project'))); + exit; +} +if (GETPOST('search_task') != '') +{ + header("Location: ".DOL_URL_ROOT.'/projet/tasks/index.php?mode=search&search_all='.urlencode(GETPOST('search_task'))); + exit; +} + + // If we are here, search was called with no supported criteria if (! empty($_SERVER['HTTP_REFERER'])) { diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php index dc90a7c3853..fa63a9e9c06 100644 --- a/htdocs/core/search_page.php +++ b/htdocs/core/search_page.php @@ -70,14 +70,14 @@ $searchform = ''; if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && ! empty($conf->global->MAIN_SEARCHFORM_SOCIETE) && $user->rights->societe->lire) { $langs->load("companies"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'socname'); + $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'sall', '', 'company'); $nbofsearch++; } if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_CONTACT) && $user->rights->societe->lire) { $langs->load("companies"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', img_object('','contact').' '.$langs->trans("Contacts"), 'contact', 'contactname'); + $searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', img_object('','contact').' '.$langs->trans("Contacts"), 'contact', 'sall', '', 'contact'); $nbofsearch++; } @@ -85,7 +85,7 @@ if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! em && ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE)) { $langs->load("products"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', '', 'sall'.rand(0,10)); + $searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', '', 'product'); $nbofsearch++; } @@ -100,7 +100,7 @@ if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! em if (! empty($conf->adherent->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_ADHERENT) && $user->rights->adherent->lire) { $langs->load("members"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall', 'sall'.rand(0,10)); + $searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall', '', 'member'); $nbofsearch++; } diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php index 59c4c86a77e..84b869cd813 100644 --- a/htdocs/core/tpl/document_actions_post_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php @@ -28,7 +28,7 @@ if (empty($relativepathwithnofile)) $relativepathwithnofile=''; if ($action == 'delete') { $langs->load("companies"); // Need for string DeleteFile+ConfirmDeleteFiles - $ret = $form->formconfirm( + $ret = $form->form_confirm( $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int') . (empty($param)?'':$param), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 55b7d9377a3..14389887faa 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -43,6 +43,7 @@ if (! $sortfield) $sortfield="d.datedon"; $limit = $conf->liste_limit; $statut=isset($_GET["statut"])?$_GET["statut"]:"-1"; +$search_all=GETPOST('sall','alpha'); $search_ref=GETPOST('search_ref','alpha'); $search_company=GETPOST('search_company','alpha'); $search_name=GETPOST('search_name','alpha'); @@ -51,14 +52,29 @@ $optioncss = GETPOST('optioncss','alpha'); if (!$user->rights->don->lire) accessforbidden(); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { - $search_ref=""; + $search_all=""; + $search_ref=""; $search_company=""; $search_name=""; $search_amount=""; } +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('orderlist')); + + +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'd.rowid'=>'Id', + 'd.ref'=>'Ref', + 'd.lastname'=>'Lastname', + 'd.firstname'=>'Firstname', +); + + + /* * View */ @@ -83,6 +99,10 @@ if (trim($search_ref) != '') { $sql.= ' AND d.rowid LIKE \'%'.$db->escape(trim($search_ref)) . '%\''; } +if (trim($search_all) != '') +{ + $sql .= natural_search(array_keys($fieldstosearchall), $search_all); +} if (trim($search_company) != '') { $sql .= natural_search('d.societe', $search_company); @@ -120,6 +140,18 @@ if ($resql) print '
'."\n"; if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + if ($search_all) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $search_all, join(', ',$fieldstosearchall)); + } + print ""; print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","", $param,"",$sortfield,$sortorder); diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index ef8120444a7..e7bd34583b9 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1100,13 +1100,13 @@ if ($action == 'create') print '
'; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; @@ -1321,56 +1321,56 @@ else if ($action == 'save') { - $ret=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_validate","","",1); + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_validate","","",1); if ($ret == 'html') print '
'; } if ($action == 'save_from_refuse') { - $ret=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save_from_refuse","","",1); + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save_from_refuse","","",1); if ($ret == 'html') print '
'; } if ($action == 'delete') { - $ret=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete","","",1); + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete","","",1); if ($ret == 'html') print '
'; } if ($action == 'validate') { - $ret=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("ValideTrip"),$langs->trans("ConfirmValideTrip"),"confirm_approve","","",1); + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("ValideTrip"),$langs->trans("ConfirmValideTrip"),"confirm_approve","","",1); if ($ret == 'html') print '
'; } if ($action == 'paid') { - $ret=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("PaidTrip"),$langs->trans("ConfirmPaidTrip"),"confirm_paid","","",1); + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("PaidTrip"),$langs->trans("ConfirmPaidTrip"),"confirm_paid","","",1); if ($ret == 'html') print '
'; } if ($action == 'cancel') { $array_input = array('text'=>$langs->trans("ConfirmCancelTrip"), array('type'=>"text",'label'=>$langs->trans("Comment"),'name'=>"detail_cancel",'size'=>"50",'value'=>"")); - $ret=$form->formconfirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("Cancel"),"","confirm_cancel",$array_input,"",1); + $ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("Cancel"),"","confirm_cancel",$array_input,"",1); if ($ret == 'html') print '
'; } if ($action == 'brouillonner'): - $ret=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("BrouillonnerTrip"),$langs->trans("ConfirmBrouillonnerTrip"),"confirm_brouillonner","","",1); + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("BrouillonnerTrip"),$langs->trans("ConfirmBrouillonnerTrip"),"confirm_brouillonner","","",1); if ($ret == 'html') print '
'; endif; if ($action == 'refuse') // Deny { $array_input = array('text'=>$langs->trans("ConfirmRefuseTrip"), array('type'=>"text",'label'=>$langs->trans("Comment"),'name'=>"detail_refuse",'size'=>"50",'value'=>"")); - $ret=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("Deny"),'',"confirm_refuse",$array_input,"yes",1); + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("Deny"),'',"confirm_refuse",$array_input,"yes",1); if ($ret == 'html') print '
'; } if ($action == 'delete_line') { - $ret=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id."&rowid=".GETPOST('rowid'),$langs->trans("DeleteLine"),$langs->trans("ConfirmDeleteLine"),"confirm_delete_line",'','yes',1); + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id."&rowid=".GETPOST('rowid'),$langs->trans("DeleteLine"),$langs->trans("ConfirmDeleteLine"),"confirm_delete_line",'','yes',1); if ($ret == 'html') print '
'; } diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index ba3b652a3a9..4a12d25f8f2 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -39,6 +39,7 @@ $socid = $_GET["socid"]?$_GET["socid"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'expensereport','',''); +$sall = GETPOST('sall'); $search_ref = GETPOST('search_ref'); $search_user = GETPOST('search_user','int'); $search_amount_ht = GETPOST('search_amount_ht','alpha'); @@ -66,6 +67,14 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both if ($search_status == '') $search_status=-1; if ($search_user == '') $search_user=-1; +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'd.ref'=>'Ref', + 'u.lastname'=>'Lastname', + 'u.firstname'=>"Firstname", +); + + /* * View */ @@ -101,6 +110,11 @@ $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON d.fk_user_author = u.rowid"; $sql.= " WHERE d.entity = ".$conf->entity; +// Search all +if (!empty($sall)) +{ + $sql.= natural_search(array_keys($fieldstosearchall), $sall); +} // Ref if(!empty($search_ref)){ $sql.= " AND d.ref LIKE '%".$db->escape($search_ref)."%'"; @@ -183,6 +197,16 @@ if ($resql) print_barre_liste($langs->trans("ListTripsAndExpenses"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print ''."\n"; if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + + if ($sall) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall)); + } print '
'.$langs->trans("DateStart").''.$langs->trans("DateStart").''; $form->select_date($date_start?$date_start:-1,'date_debut',0,0,0,'',1,1); print '
'.$langs->trans("DateEnd").''.$langs->trans("DateEnd").''; $form->select_date($date_end?$date_end:-1,'date_fin',0,0,0,'',1,1); print '
'; print ""; diff --git a/htdocs/expensereport/stats/index.php b/htdocs/expensereport/stats/index.php index bba5ceb1ee1..d64cbca648f 100644 --- a/htdocs/expensereport/stats/index.php +++ b/htdocs/expensereport/stats/index.php @@ -211,7 +211,7 @@ print '
'; // Show filter box print ''; print ''; -print '
'; +print '
'; print ''; // Company /* @@ -237,8 +237,8 @@ print '
'.$langs->trans("Filter").'
'; print '
'; print '

'; -print ''; -print ''; +print '
'; +print ''; print ''; print ''; print ''; diff --git a/htdocs/expensereport/synchro_compta.php b/htdocs/expensereport/synchro_compta.php index 3e2a7c21d34..59a6b8926fe 100644 --- a/htdocs/expensereport/synchro_compta.php +++ b/htdocs/expensereport/synchro_compta.php @@ -108,13 +108,13 @@ dol_fiche_head(''); if ($_GET["action"] == 'ndfTOaccount'): $idTrip = $_GET['idTrip']; - $ret=$html->formconfirm($_SERVER["PHP_SELF"]."?idTrip=".$idTrip."&account=".$idAccount,$langs->trans("ndfToAccount"),$langs->trans("ConfirmNdfToAccount"),"confirm_ndf_to_account","","",1); + $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?idTrip=".$idTrip."&account=".$idAccount,$langs->trans("ndfToAccount"),$langs->trans("ConfirmNdfToAccount"),"confirm_ndf_to_account","","",1); if ($ret == 'html') print '
'; endif; if ($_GET["action"] == 'accountTOndf'): $idTrip = $_GET['idTrip']; - $ret=$html->formconfirm($_SERVER["PHP_SELF"]."?idTrip=".$idTrip."&account=".$idAccount,$langs->trans("AccountToNdf"),$langs->trans("ConfirmAccountToNdf"),"confirm_account_to_ndf","","",1); + $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?idTrip=".$idTrip."&account=".$idAccount,$langs->trans("AccountToNdf"),$langs->trans("ConfirmAccountToNdf"),"confirm_account_to_ndf","","",1); if ($ret == 'html') print '
'; endif; @@ -212,4 +212,4 @@ dol_fiche_end(); llxFooter(); -$db->close(); +$db->close(); \ No newline at end of file diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 74051b5bc70..896d8c6a4fa 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -64,7 +64,7 @@ $search_status=GETPOST('search_status'); $sall=GETPOST('sall'); $optioncss = GETPOST('optioncss','alpha'); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_ref=""; $search_company=""; @@ -72,6 +72,17 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_status=""; } +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'f.ref'=>'Ref', + 's.nom'=>"ThirdParty", + 'f.description'=>'Description', + 'f.note_public'=>'NotePublic', +); +if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate"; +if (! empty($conf->global->FICHINTER_DISABLE_DETAILS)) unset($fieldstosearchall['f.description']); + + /* * View */ @@ -110,9 +121,7 @@ if (! $user->rights->societe->client->voir && empty($socid)) if ($socid) $sql.= " AND s.rowid = " . $socid; if ($sall) { - $arraytosearch=array('f.ref', 'f.description', 's.nom'); - if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $arraytosearch=array('f.ref', 'f.description', 's.nom', 'fd.description'); - $sql .= natural_search($arraytosearch, $sall); + $sql .= natural_search(array_keys($fieldstosearchall), $sall); } $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1, $offset); @@ -135,11 +144,22 @@ if ($result) print ''."\n"; if ($optioncss != '') print ''; - print '
'.$langs->trans("Year").''.$langs->trans("Number").''.$langs->trans("AmountTotal").'
'; + print ''; + print ''; + print ''; + print ''; + + if ($sall) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall)); + } + + print '
'; print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$urlparam,'width="15%"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$urlparam,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$urlparam,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$urlparam,'',$sortfield,$sortorder); if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) { diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 5b37229024c..768854063dd 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -74,6 +74,17 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both if ($search_status == '') $search_status=-1; +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'cf.ref'=>'Ref', + 'cf.ref_supplier'=>'RefSupplier', + //'pd.description'=>'Description', + 's.nom'=>"ThirdParty", + 'cf.note_public'=>'NotePublic', +); +if (empty($user->socid)) $fieldstosearchall["cf.note_private"]="NotePrivate"; + + /* * View @@ -141,7 +152,7 @@ if ($search_ttc != '') } if ($sall) { - $sql .= natural_search(array('cf.ref', 'cf.ref_supplier', 'cf.note_public', 'cf.note_private'), $sall); + $sql .= natural_search(array_keys($fieldstosearchall), $sall); } if ($socid) $sql.= " AND s.rowid = ".$socid; @@ -190,6 +201,19 @@ if ($resql) print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); print ''; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + if ($sall) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall)); + } + print '
'; print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"cf.ref","",$param,'',$sortfield,$sortorder); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 05459d0bd69..ccf7169219b 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -68,6 +68,7 @@ $pagenext = $page + 1; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="fac.datef,fac.rowid"; +$search_all = GETPOST('sall'); $search_ref = GETPOST("search_ref","int"); $search_ref_supplier = GETPOST("search_ref_supplier","alpha"); $search_label = GETPOST("search_label","alpha"); @@ -86,6 +87,7 @@ $optioncss = GETPOST('optioncss','alpha'); if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers { + $search_all=""; $search_ref=""; $search_ref_supplier=""; $search_label=""; @@ -97,6 +99,18 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $filter=""; } +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'fac.ref'=>'Ref', + 'fac.ref_supplier'=>'RefSupplier', + //'fd.description'=>'Description', + 's.nom'=>"ThirdParty", + 'fac.note_public'=>'NotePublic', +); +if (empty($user->socid)) $fieldstosearchall["fac.note_private"]="NotePrivate"; + + + /* * Actions */ @@ -157,7 +171,10 @@ if ($filter && $filter != -1) // GETPOST('filtre') may be a string $sql .= " AND " . $filt[0] . " = " . $filt[1]; } } - +if ($search_all) +{ + $sql.= natural_search(array_keys($fieldstosearchall), $search_all); +} if ($search_ref) { if (is_numeric($search_ref)) $sql .= natural_search(array('fac.ref'), $search_ref); @@ -255,6 +272,18 @@ if ($resql) print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print ''; if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + if ($search_all) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $search_all, join(', ',$fieldstosearchall)); + } + print '
'; print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"fac.ref,fac.rowid","",$param,"",$sortfield,$sortorder); diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 25d23594787..db53c4f2a10 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -84,20 +84,26 @@ if ($action == 'create') $description = trim(GETPOST('description')); $userID = GETPOST('userID'); + // If no start date + if ($type <= 0) + { + setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), 'errors'); + $error++; + $action='create'; + } + // If no start date if (empty($date_debut)) { header('Location: card.php?action=request&error=nodatedebut'); exit; } - // If no end date if (empty($date_fin)) { header('Location: card.php?action=request&error=nodatefin'); exit; } - // If start date after end date if ($date_debut > $date_fin) { @@ -128,22 +134,27 @@ if ($action == 'create') exit; } - $cp->fk_user = $userid; - $cp->description = $description; - $cp->date_debut = $date_debut; - $cp->date_fin = $date_fin; - $cp->fk_validator = $valideur; - $cp->halfday = $halfday; - $cp->fk_type = $type; - - $verif = $cp->create($user); - + $result = 0; + + if (! $error) + { + $cp->fk_user = $userid; + $cp->description = $description; + $cp->date_debut = $date_debut; + $cp->date_fin = $date_fin; + $cp->fk_validator = $valideur; + $cp->halfday = $halfday; + $cp->fk_type = $type; + + $result = $cp->create($user); + } + // If no SQL error we redirect to the request card - if ($verif > 0) + if ($result > 0) { $db->commit(); - header('Location: card.php?id='.$verif); + header('Location: card.php?id='.$result); exit; } else @@ -151,7 +162,7 @@ if ($action == 'create') $db->rollback(); // Otherwise we display the request form with the SQL error message - header('Location: card.php?action=request&error=SQL_Create&msg='.$cp->error); + header('Location: card.php?action=request'); exit; } } diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 419fabf9087..b309eade0f4 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -53,6 +53,7 @@ $pagenext = $page + 1; $id = GETPOST('id','int'); +$sall = GETPOST('sall'); $search_ref = GETPOST('search_ref'); $month_create = GETPOST('month_create'); $year_create = GETPOST('year_create'); @@ -64,7 +65,7 @@ $search_employe = GETPOST('search_employe'); $search_valideur = GETPOST('search_valideur'); $search_statut = GETPOST('select_statut'); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_ref=""; $month_create=""; @@ -78,6 +79,12 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_statut=""; } +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'cp.rowid'=>'Ref', + 'cp.description'=>'Description', +); + /* * Actions @@ -171,6 +178,12 @@ if(!empty($search_valideur) && $search_valideur != -1) { if(!empty($search_statut) && $search_statut != -1) { $filter.= " AND cp.statut = '".$db->escape($search_statut)."'\n"; } +// Search all +if (!empty($sall)) +{ + $filter.= natural_search(array_keys($fieldstosearchall), $sall); +} + /************************************* * Fin des filtres de recherche @@ -252,6 +265,18 @@ if ($id > 0) print '
'; print ''."\n"; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; + +if ($sall) +{ + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall)); +} + print '
'; print ""; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"cp.rowid","",'','',$sortfield,$sortorder); diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index d54cd22849a..1d8c12e3938 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -66,4 +66,5 @@ ALTER TABLE llx_prelevement_facture_demande MODIFY COLUMN code_banque varchar(12 ALTER TABLE llx_prelevement_lignes MODIFY COLUMN code_banque varchar(128); ALTER TABLE llx_societe_rib MODIFY COLUMN code_banque varchar(128); +ALTER TABLE llx_contrat ADD COLUMN ref_customer varchar(30); diff --git a/htdocs/install/mysql/tables/llx_contrat.sql b/htdocs/install/mysql/tables/llx_contrat.sql index 73e29e8bdd4..f229f020bf6 100644 --- a/htdocs/install/mysql/tables/llx_contrat.sql +++ b/htdocs/install/mysql/tables/llx_contrat.sql @@ -22,7 +22,8 @@ create table llx_contrat ( rowid integer AUTO_INCREMENT PRIMARY KEY, ref varchar(30), -- contrat reference - ref_supplier varchar(30), -- suplier contract ref + ref_customer varchar(30), -- customer contract ref + ref_supplier varchar(30), -- supplier contract ref ref_ext varchar(30), -- external contract ref entity integer DEFAULT 1 NOT NULL, -- multi company id tms timestamp, @@ -44,6 +45,5 @@ create table llx_contrat model_pdf varchar(255), import_key varchar(14), extraparams varchar(255) - )ENGINE=innodb; diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index b61cf77019f..634b058f6d4 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -58,7 +58,7 @@ BoxLastExpiredServices=Last %s oldest contacts with active expired services BoxTitleLastActionsToDo=Last %s actions to do BoxTitleLastContracts=Last %s contracts BoxTitleLastModifiedDonations=Last %s modified donations -BoxTitleLastModifiedExpenses=Last %s modified expenses +BoxTitleLastModifiedExpenses=Last %s modified expense reports BoxGlobalActivity=Global activity (invoices, proposals, orders) FailedToRefreshDataInfoNotUpToDate=Failed to refresh RSS flux. Last successfull refresh date: %s LastRefreshDate=Last refresh date diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index a73ed322cba..e3fd6fadeec 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -110,7 +110,7 @@ ProfId2Short=Prof. id 2 ProfId3Short=Prof. id 3 ProfId4Short=Prof. id 4 ProfId5Short=Prof. id 5 -ProfId6Short=Prof. id 5 +ProfId6Short=Prof. id 6 ProfId1=Professional ID 1 ProfId2=Professional ID 2 ProfId3=Professional ID 3 @@ -285,6 +285,8 @@ PersonalInformations=Personal data AccountancyCode=Accountancy code CustomerCode=Customer code SupplierCode=Supplier code +CustomerCodeShort=Customer code +SupplierCodeShort=Supplier code CustomerAccount=Customer account SupplierAccount=Supplier account CustomerCodeDesc=Customer code, unique for all customers diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index ad8858a4255..20c0a144121 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -99,6 +99,8 @@ TotalToPay=Total to pay TotalVATReceived=Total VAT received CustomerAccountancyCode=Customer accountancy code SupplierAccountancyCode=Supplier accountancy code +CustomerAccountancyCodeShort=Cust. account. code +SupplierAccountancyCodeShort=Sup. account. code AccountNumberShort=Account number AccountNumber=Account number NewAccount=New account diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 2761ba85c45..7e1dc3ee929 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -386,6 +386,7 @@ NActions=%s events NActionsLate=%s late RequestAlreadyDone=Request already recorded Filter=Filter +FilterOnInto=Search criteria '%s' into fields %s RemoveFilter=Remove filter ChartGenerated=Chart generated ChartNotGenerated=Chart not generated @@ -576,6 +577,7 @@ SendByMail=Send by EMail MailSentBy=Email sent by TextUsedInTheMessageBody=Email body SendAcknowledgementByMail=Send Ack. by email +EMail=E-mail NoEMail=No email NoMobilePhone=No mobile phone Owner=Owner diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index ac04c689df4..6dcf4ce60f9 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -1,6 +1,9 @@ # Dolibarr language file - Source file is en_US - products ProductRef=Product ref. ProductLabel=Product label +ProductLabelTranslated=Translated product label +ProductDescriptionTranslated=Translated product description +ProductNoteTranslated=Translated product note ProductServiceCard=Products/Services card Products=Products Services=Services diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 638ddbc91a4..9e6869f7302 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1575,13 +1575,13 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && ! empty($conf->global->MAIN_SEARCHFORM_SOCIETE) && $user->rights->societe->lire) { $langs->load("companies"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', $langs->trans("ThirdParties"), 'soc', 'socname', 'T', 'searchleftt', img_object('','company')); + $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', $langs->trans("ThirdParties"), 'soc', 'sall', 'T', 'searchleftt', img_object('','company')); } if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_CONTACT) && $user->rights->societe->lire) { $langs->load("companies"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', $langs->trans("Contacts"), 'contact', 'contactname', '', 'searchleftc', img_object('','contact')); + $searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', $langs->trans("Contacts"), 'contact', 'sall', 'A', 'searchleftc', img_object('','contact')); } if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) @@ -1607,7 +1607,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me if (! empty($conf->projet->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_PROJECT) && $user->rights->projet->lire) { $langs->load("members"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/projet/list.php', DOL_URL_ROOT.'/projet/list.php', $langs->trans("Projects"), 'project', 'search_all', 'M', 'searchleftproj', img_object('','projectpub')); + $searchform.=printSearchForm(DOL_URL_ROOT.'/projet/list.php', DOL_URL_ROOT.'/projet/list.php', $langs->trans("Projects"), 'project', 'search_all', 'Q', 'searchleftproj', img_object('','projectpub')); } // Execute hook printSearchForm @@ -1851,11 +1851,11 @@ function getHelpParamFor($helppagename,$langs) * @param string $htmlmodesearch Value to set into parameter "mode_search" ('soc','contact','products','member',...) * @param string $htmlinputname Field Name input form * @param string $accesskey Accesskey - * @param string $idname Complement for id to avoid multiple same id in the page + * @param string $prefhtmlinputname Complement for id to avoid multiple same id in the page * @param string $img Image to use * @return string */ -function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinputname,$accesskey='', $idname='',$img='') +function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinputname,$accesskey='', $prefhtmlinputname='',$img='') { global $conf,$langs; @@ -1868,7 +1868,7 @@ function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinput $ret.='
'; -print ""; -print ''; -print "'; -print ''; -if (! empty($conf->barcode->enabled)) + +// Search contract +if ((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && ($user->rights->produit->lire || $user->rights->service->lire)) { - print "'; - //print ''; - print ''; + $listofsearchfields['search_product']=array('text'=>'ProductOrService'); } -print "'; -//print ''; -print ''; -print "
'.$langs->trans("Search").'
"; -print ':
"; - print ':
"; -print ':

"; +if (count($listofsearchfields)) +{ + print '
'; + print ''; + print ''; + $i=0; + foreach($listofsearchfields as $key => $value) + { + if ($i == 0) print ''; + print ''; + print ''; + if ($i == 0) print ''; + print ''; + $i++; + } + print '
'.$langs->trans("Search").'
:
'; + print '
'; + print '
'; +} /* * Number of products and/or services diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 650b248a88f..ac411cce8d5 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -84,6 +84,24 @@ if ($type=='0') $result=restrictedArea($user,'produit','','','','','',$objcanvas else if ($type=='1') $result=restrictedArea($user,'service','','','','','',$objcanvas); else $result=restrictedArea($user,'produit|service','','','','','',$objcanvas); +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'p.ref'=>"Ref", + 'p.label'=>"ProductLabel", + 'p.description'=>"Description", + "p.note"=>"Note", +); +// multilang +if (! empty($conf->global->MAIN_MULTILANGS)) +{ + $fieldstosearchall['pl.label']='ProductLabelTranslated'; + $fieldstosearchall['pl.description']='ProductDescriptionTranslated'; + $fieldstosearchall['pl.note']='ProductNoteTranslated'; +} +if (! empty($conf->barcode->enabled)) { + $fieldstosearchall['p.barcode']='Gencod'; +} + /* * Actions @@ -92,6 +110,7 @@ else $result=restrictedArea($user,'produit|service','','','','','',$objcanvas); if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $sref=""; + $sall=""; $sbarcode=""; $snom=""; $search_categ=0; @@ -131,8 +150,6 @@ else { $texte = $langs->trans("ProductsAndServices"); } - // Add what we are searching for - if (! empty($sall)) $texte.= " - ".$sall; $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,'; $sql.= ' p.fk_product_type, p.tms as datem,'; @@ -146,19 +163,7 @@ else $sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')'; if ($sall) { - // For natural search - $params = array('p.ref', 'p.label', 'p.description', 'p.note'); - // multilang - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $params[] = 'pl.label'; - $params[] = 'pl.description'; - $params[] = 'pl.note'; - } - if (! empty($conf->barcode->enabled)) { - $params[] = 'p.barcode'; - } - $sql .= natural_search($params, $sall); + $sql .= natural_search(array_keys($fieldstosearchall), $sall); } // if the type is not 1, we show all products (type = 0,2,3) if (dol_strlen($type)) @@ -168,16 +173,6 @@ else } if ($sref) $sql .= natural_search('p.ref', $sref); if ($sbarcode) $sql .= natural_search('p.barcode', $sbarcode); - if ($snom) - { - $params = array('p.label'); - // multilang - if (! empty($conf->global->MAIN_MULTILANGS)) - { - $params[] = 'pl.label'; - } - $sql .= natural_search($params, $snom); - } if (isset($tosell) && dol_strlen($tosell) > 0 && $tosell!=-1) $sql.= " AND p.tosell = ".$db->escape($tosell); if (isset($tobuy) && dol_strlen($tobuy) > 0 && $tobuy!=-1) $sql.= " AND p.tobuy = ".$db->escape($tobuy); if (dol_strlen($canvas) > 0) $sql.= " AND p.canvas = '".$db->escape($canvas)."'"; @@ -188,8 +183,7 @@ else if ($fourn_id > 0) $sql.= " AND pfp.fk_soc = ".$fourn_id; $sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,"; $sql.= " p.fk_product_type, p.tms,"; - $sql.= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte"; - $sql .= ', p.desiredstock'; + $sql.= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock"; //if (GETPOST("toolowstock")) $sql.= " HAVING SUM(s.reel) < p.seuil_stock_alerte"; // Not used yet $nbtotalofrecords = 0; @@ -242,7 +236,7 @@ else $param.=isset($type)?"&type=".$type:""; if ($optioncss != '') $param.='&optioncss='.$optioncss; - print_barre_liste($texte, $page, "list.php", $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords,'title_products.png'); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords,'title_products.png'); if (! empty($catid)) { @@ -281,6 +275,12 @@ else print ''; print ''; + if ($sall) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall)); + } + // Filter on categories $moreforfilter=''; $colspan=6; diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index be97ad37a33..1be05aed2d8 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -68,30 +68,35 @@ else print '
'; - -// Search task +// Search project if (! empty($conf->projet->enabled) && $user->rights->projet->lire) { - $var=false; - print '
'; + $listofsearchfields['search_task']=array('text'=>'Task'); +} + +if (count($listofsearchfields)) +{ + print ''; print ''; - print ''; - print ''; // All status - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print ''; - print ''; - print "
'.$langs->trans("SearchATask").'
:
:
:
\n"; - print "
\n"; + print ''; + $i=0; + foreach($listofsearchfields as $key => $value) + { + if ($i == 0) print ''; + print ''; + print ''; + if ($i == 0) print ''; + print ''; + $i++; + } + print '
'.$langs->trans("Search").'
:
'; + print ''; + print '
'; } /* Affichage de la liste des projets d'aujourd'hui */ -print '
'; +print '
'; print ''; print ''; print ''; diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index e316603c2b7..2f45dce9906 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -101,19 +101,27 @@ print '
'; // Search project if (! empty($conf->projet->enabled) && $user->rights->projet->lire) { - $var=false; - print '
'; + $listofsearchfields['search_project']=array('text'=>'Project'); +} + +if (count($listofsearchfields)) +{ + print ''; print ''; - print '
'.$langs->trans('ActivityOnProjectToday').''.$langs->trans("Time").'
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "
'.$langs->trans("SearchAProject").'
:
:
:
\n"; - print "
\n"; + print ''; + $i=0; + foreach($listofsearchfields as $key => $value) + { + if ($i == 0) print ''; + print ''; + print ''; + if ($i == 0) print ''; + print ''; + $i++; + } + print '
'.$langs->trans("Search").'
:
'; + print ''; + print '
'; } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index e8e04fe15fb..17aa5cac222 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -109,6 +109,14 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $hookmanager->initHooks(array('projectlist')); $extrafields = new ExtraFields($db); +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'p.ref'=>"Ref", + 'p.title'=>"Label", + 's.nom'=>"ThirdPartyName", + "p.note_public"=>"NotePublic" +); +if (empty($user->socid)) $fieldstosearchall["p.note_private"]="NotePrivate"; /* @@ -182,7 +190,7 @@ else if ($year > 0) { $sql.= " AND p.datee BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } -if ($search_all) $sql .= natural_search(array('p.ref','p.title','s.nom'), $search_all); +if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); if ($search_status >= 0) $sql .= " AND p.fk_statut = ".$db->escape($search_status); if ($search_opp_status) { @@ -234,8 +242,13 @@ if ($resql) print '
'; if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - // Show description of content + // Show description of content if ($mine) print $langs->trans("MyProjectsDesc").'

'; else { @@ -245,8 +258,8 @@ if ($resql) if ($search_all) { - print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Label")." ".$langs->trans("or")." ".$langs->trans("ThirdParty")."): "; - print ''.$search_all.''; + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $search_all, join(', ',$fieldstosearchall)); } $colspan=8; diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php index 39484f05014..cd8e3af37bd 100644 --- a/htdocs/projet/tasks/index.php +++ b/htdocs/projet/tasks/index.php @@ -33,6 +33,8 @@ $langs->load('projects'); $langs->load('users'); $id=GETPOST('id','int'); + +$search_all=GETPOST('search_all'); $search_project=GETPOST('search_project'); if (! isset($_GET['search_status']) && ! isset($_POST['search_status'])) $search_status=1; else $search_status=GETPOST('search_status'); @@ -55,8 +57,9 @@ $page = $page == -1 ? 0 : $page; $mine = $_REQUEST['mode']=='mine' ? 1 : 0; // Purge criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { + $search_all=""; $search_project=""; $search_status=""; $search_task_ref=""; @@ -64,6 +67,12 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both } if (empty($search_status) && $search_status == '') $search_status=1; +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 't.ref'=>"Ref", + 't.label'=>"Label", +); + /* * Actions @@ -107,6 +116,7 @@ $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$so // Get list of tasks in tasksarray and taskarrayfiltered // We need all tasks (even not limited to a user because a task assigned to a user can have a parent that is not assigned to him and we need such parents). $morewherefilter=''; +if ($search_all) $morewherefilter.=natural_search(array_keys($fieldstosearchall), $search_all); if ($search_task_ref) $morewherefilter.=natural_search('t.ref', $search_task_ref); if ($search_task_label) $morewherefilter.=natural_search('t.label', $search_task_label); $tasksarray=$taskstatic->getTasksArray(0, 0, $projectstatic->id, $socid, 0, $search_project, $search_status, $morewherefilter, $search_project_user, $search_task_user); @@ -114,8 +124,21 @@ $tasksarray=$taskstatic->getTasksArray(0, 0, $projectstatic->id, $socid, 0, $sea $tasksrole=($mine ? $taskstatic->getUserRolesForProjectsOrTasks(0,$user,$projectstatic->id,0) : ''); print ''; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; print ''; +if ($search_all) +{ + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $search_all, join(', ',$fieldstosearchall)); +} + + // If the user can view users if ($user->rights->user->user->lire) { diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index 2538b105536..d27d6891119 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -56,54 +56,43 @@ print load_fiche_titre($transAreaType,$linkback,'title_companies.png'); print '
'; -/* - * Search area - */ -$rowspan=2; -if (! empty($conf->barcode->enabled)) $rowspan++; -print ''; -print ''; -print ''."\n"; -print ''; -print ''; -print "'; -print ''; -if (! empty($conf->barcode->enabled)) -{ - print "'; - //print ''; - print ''; -} -print "'; -//print ''; -print ''."\n"; -print "
'.$langs->trans("SearchThirdparty").'
"; -print ':
"; - print ':
"; -print ':

\n"; -/* - * Search contact - */ -$rowspan=2; -if (! empty($conf->barcode->enabled)) $rowspan++; -print '
'; -print ''."\n"; -print ''."\n"; -print ''; -print ''."\n"; -print "'; -print ''."\n"; -print "'; -//print ''; -print ''."\n"; -print "
'.$langs->trans("SearchContact").'
"; -print ':
"; -print ':

\n"; +// Search thirdparty +if (! empty($conf->societe->enabled) && $user->rights->societe->lire) +{ + $listofsearchfields['search_thirdparty']=array('text'=>'Thirdparty'); +} +// Search contact/address +if (! empty($conf->societe->enabled) && $user->rights->societe->lire) +{ + $listofsearchfields['search_contact']=array('text'=>'Contact'); +} + +if (count($listofsearchfields)) +{ + print '
'; + print ''; + print ''; + $i=0; + foreach($listofsearchfields as $key => $value) + { + if ($i == 0) print ''; + print ''; + print ''; + if ($i == 0) print ''; + print ''; + $i++; + } + print '
'.$langs->trans("Search").'
:
'; + print '
'; + print '
'; +} + /* * Statistics area */ + $third = array( 'customer' => 0, 'prospect' => 0, diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 95b9747ca0b..f251274b3ad 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -41,13 +41,16 @@ $socid = GETPOST('socid','int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user,'societe',$socid,''); +$search_all=trim(GETPOST("sall")); $search_nom=trim(GETPOST("search_nom")); $search_nom_only=trim(GETPOST("search_nom_only")); -$search_all=trim(GETPOST("search_all")); -$sbarcode=trim(GETPOST("sbarcode")); +$search_barcode=trim(GETPOST("sbarcode")); +$search_customer_code=trim(GETPOST('search_customer_code')); +$search_supplier_code=trim(GETPOST('search_supplier_code')); +$search_account_customer_code=trim(GETPOST('search_account_customer_code')); +$search_account_supplier_code=trim(GETPOST('search_account_supplier_code')); $search_town=trim(GETPOST("search_town")); $search_zip=trim(GETPOST("search_zip")); -$socname=trim(GETPOST("socname")); $search_idprof1=trim(GETPOST('search_idprof1')); $search_idprof2=trim(GETPOST('search_idprof2')); $search_idprof3=trim(GETPOST('search_idprof3')); @@ -63,7 +66,6 @@ $search_status=GETPOST("search_status",'int'); $optioncss=GETPOST('optioncss','alpha'); $mode=GETPOST("mode"); -$modesearch=GETPOST("mode_search"); $sortfield=GETPOST("sortfield",'alpha'); $sortorder=GETPOST("sortorder",'alpha'); @@ -84,6 +86,24 @@ $extrafields = new ExtraFields($db); $extralabels = $extrafields->fetch_name_optionals_label('thirdparty'); $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 's.nom'=>"ThirdPartyName", + 's.name_alias'=>"AliasNameShort", + 's.code_client'=>"CustomerCode", + "s.code_fournisseur"=>"SupplierCode", + 's.email'=>"EMail", + 's.url'=>"URL", + 's.tva_intra'=>"VATIntra", + 's.siren'=>"ProfId1", + 's.siret'=>"ProfId2", + 's.ape'=>"ProfId3", +); +if (($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof4']='ProfId4'; +if (($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof5']='ProfId5'; +if (($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof6']='ProfId6'; +if (!empty($conf->barcode->enabled)) $fieldstosearchall['s.barcode']='Gencod'; + /* * Actions @@ -94,34 +114,14 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // special search if ($mode == 'search') { - $search_nom=$socname; - $sql = "SELECT s.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We'll need this table joined to the select in order to filter by categ if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as cs"; $sql.= " WHERE s.entity IN (".getEntity('societe', 1).")"; - - // For natural search - $scrit = explode(' ', $socname); - - $fields = array( - 's.nom', - 's.code_client', - 's.email', - 's.url', - 's.siren', - 's.name_alias' - ); - - if (!empty($conf->barcode->enabled)) { - $fields[] = 's.barcode'; - } - - foreach ($scrit as $crit) { - $sql.= natural_search($fields, $crit); - } + // sall criteria + $sql.= natural_search($fields, $sall); if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = ".$socid; @@ -180,15 +180,19 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP { $search_categ=''; $search_sale=''; - $socname=""; - $search_nom=""; - $sbarcode=""; + $search_barcode=""; + $search_customer_code=''; + $search_supplier_code=''; + $search_account_customer_code=''; + $search_account_supplier_code=''; $search_town=""; $search_zip=""; $search_idprof1=''; $search_idprof2=''; $search_idprof3=''; $search_idprof4=''; + $search_idprof5=''; + $search_idprof6=''; $search_type=''; $search_country=''; $search_type_thirdparty=''; @@ -198,11 +202,6 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP if ($search_status=='') $search_status=1; // always display active thirdparty first -if ($socname) -{ - $search_nom=$socname; -} - /* * Mode List @@ -251,9 +250,13 @@ if ($search_categ) $sql.= " AND s.rowid = cs.fk_soc"; // Join for the neede if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible if ($search_sale) $sql.= " AND sc.fk_user = ".$db->escape($search_sale); if ($search_categ) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ); +if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); +if ($search_nom) $sql.= natural_search("s.nom",$search_nom); if ($search_nom_only) $sql.= natural_search("s.nom",$search_nom_only); -if ($search_all) $sql.= natural_search(array("s.nom", "s.name_alias", "s.code_client", "s.code_fournisseur", "s.email", "s.url","s.siren","s.siret","s.ape","s.idprof4","s.idprof5","s.idprof6"), $search_all); -if ($search_nom) $sql.= natural_search(array("s.nom", "s.name_alias", "s.code_client", "s.code_fournisseur", "s.email", "s.url","s.siren","s.siret","s.ape","s.idprof4","s.idprof5","s.idprof6"), $search_nom); +if ($search_customer_code) $sql.= natural_search("s.code_client",$search_customer_code); +if ($search_supplier_code) $sql.= natural_search("s.code_fournisseur",$search_supplier_code); +if ($search_account_customer_code) $sql.= natural_search("s.code_compta",$search_account_customer_code); +if ($search_account_supplier_code) $sql.= natural_search("s.code_compta_fournisseur",$search_account_supplier_code); if ($search_town) $sql.= natural_search("s.town",$search_town); if ($search_zip) $sql.= natural_search("s.zip",$search_zip); if ($search_idprof1) $sql.= natural_search("s.siren",$search_idprof1); @@ -267,7 +270,7 @@ if ($search_type > 0 && in_array($search_type,array('1,3','2,3'))) $sql .= " AND if ($search_type > 0 && in_array($search_type,array('4'))) $sql .= " AND s.fournisseur = 1"; if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0"; if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status); -if (!empty($conf->barcode->enabled) && $sbarcode) $sql.= " AND s.barcode LIKE '%".$db->escape($sbarcode)."%'"; +if (!empty($conf->barcode->enabled) && $search_barcode) $sql.= " AND s.barcode LIKE '%".$db->escape($search_barcode)."%'"; if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; // Add where from extra fields @@ -305,11 +308,15 @@ if ($resql) $num = $db->num_rows($resql); $i = 0; - $param = "&socname=".urlencode($socname); + $param = "&sall=".urlencode($sall); $param.= "&search_nom=".urlencode($search_nom); $param.= "&search_town=".urlencode($search_town); $param.= "&search_zip=".urlencode($search_zip); - $param.= ($sbarcode?"&sbarcode=".urlencode($sbarcode):""); + $param.= "&search_customer_code=".urlencode($search_customer_code); + $param.= "&search_supplier_code=".urlencode($search_supplier_code); + $param.= "&search_account_customer_code=".urlencode($search_account_customer_code); + $param.= "&search_account_supplier_code=".urlencode($search_account_supplier_code); + $param.= ($search_barcode?"&sbarcode=".urlencode($search_barcode):""); $param.= '&search_idprof1='.urlencode($search_idprof1); $param.= '&search_idprof2='.urlencode($search_idprof2); $param.= '&search_idprof3='.urlencode($search_idprof3); @@ -336,7 +343,7 @@ if ($resql) $langs->load("other"); $textprofid=array(); - foreach(array(1,2,3,4) as $key) + foreach(array(1,2,3,4,5,6) as $key) { $label=$langs->transnoentities("ProfId".$key.$mysoc->country_code); $textprofid[$key]=''; @@ -354,7 +361,13 @@ if ($resql) print ''; print ''; - // Filter on categories + if ($search_all) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $search_all, join(', ',$fieldstosearchall)); + } + + // Filter on categories /* Not possible in this page because list is for ALL third parties type $moreforfilter=''; if (! empty($conf->categorie->enabled)) @@ -384,17 +397,27 @@ if ($resql) } // Define list of fields to show into list + $checkedcustomercode=1; + $checkedsuppliercode=1; + $checkedcustomeraccountcode=0; + $checkedsupplieraccountcode=0; $arrayfields=array( 's.nom'=>array('label'=>$langs->trans("Company"), 'checked'=>1), - 's.barcode'=>array('label'=>$langs->trans("BarCode"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))), + 's.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))), + 's.code_client'=>array('label'=>$langs->trans("CustomerCodeShort"), 'checked'=>$checkedcustomercode), + 's.code_fournisseur'=>array('label'=>$langs->trans("SupplierCodeShort"), 'checked'=>$checkedsuppliercode, 'enabled'=>(! empty($conf->fournisseur->enabled))), + 's.code_compta'=>array('label'=>$langs->trans("CustomerAccountancyCodeShort"), 'checked'=>$checkedcustomeraccountcode), + 's.code_compta_fournisseur'=>array('label'=>$langs->trans("SupplierAccountancyCodeShort"), 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(! empty($conf->fournisseur->enabled))), 's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1), 's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1), - 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>1), + 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0), 'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>1), 's.siren'=>array('label'=>$langs->trans("ProfId1Short"), 'checked'=>1), 's.siret'=>array('label'=>$langs->trans("ProfId2Short"), 'checked'=>1), 's.ape'=>array('label'=>$langs->trans("ProfId3Short"), 'checked'=>1), - 's.idprof4'=>array('label'=>$langs->trans("ProfId4Short"), 'checked'=>1), + 's.idprof4'=>array('label'=>$langs->trans("ProfId4Short"), 'checked'=>((($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') ? 1 : 0)), + 's.idprof5'=>array('label'=>$langs->trans("ProfId5Short"), 'checked'=>((($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') ? 1 : 0)), + 's.idprof6'=>array('label'=>$langs->trans("ProfId6Short"), 'checked'=>((($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') ? 1 : 0)), 's.status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>200), 's.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 's.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), @@ -405,7 +428,11 @@ if ($resql) print ''; if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['s.barcode']['checked'])) print_liste_field_titre($langs->trans("BarCode"), $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder); + if (! empty($arrayfields['s.barcode']['checked'])) print_liste_field_titre($langs->trans("Gencod"), $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder); + if (! empty($arrayfields['s.code_client']['checked'])) print_liste_field_titre($arrayfields['s.code_client']['label'],$_SERVER["PHP_SELF"],"s.code_client","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['s.code_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_fournisseur","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['s.code_compta']['checked'])) print_liste_field_titre($arrayfields['s.code_compta']['label'],$_SERVER["PHP_SELF"],"s.code_compta","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_compta_fournisseur","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($langs->trans("Zip"),$_SERVER["PHP_SELF"],"s.zip","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); @@ -414,6 +441,8 @@ if ($resql) if (! empty($arrayfields['s.siret']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"),$textprofid[2],1,0),$_SERVER["PHP_SELF"],"s.siret","",$param,'class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['s.ape']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"),$textprofid[3],1,0),$_SERVER["PHP_SELF"],"s.ape","",$param,'class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['s.idprof4']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof4","",$param,'class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof5","",$param,'class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof6","",$param,'class="nowrap"',$sortfield,$sortorder); print_liste_field_titre(''); // type of customer // Extra fields if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list)) @@ -449,10 +478,38 @@ if ($resql) if (! empty($arrayfields['s.barcode']['checked'])) { print ''; - print ''; + print ''; print ''; } - // Town + // Customer code + if (! empty($arrayfields['s.code_client']['checked'])) + { + print ''; + print ''; + print ''; + } + // Supplier code + if (! empty($arrayfields['s.code_fournisseur']['checked'])) + { + print ''; + print ''; + print ''; + } + // Account Customer code + if (! empty($arrayfields['s.code_compta']['checked'])) + { + print ''; + print ''; + print ''; + } + // Account Supplier code + if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) + { + print ''; + print ''; + print ''; + } + // Town if (! empty($arrayfields['s.town']['checked'])) { print ''; @@ -508,7 +565,21 @@ if ($resql) print ''; print ''; } - // Type (customer/prospect/supplier) + if (! empty($arrayfields['s.idprof5']['checked'])) + { + // IdProf5 + print ''; + print ''; + print ''; + } + if (! empty($arrayfields['s.idprof6']['checked'])) + { + // IdProf6 + print ''; + print ''; + print ''; + } + // Type (customer/prospect/supplier) print ''; print '