From 7d1292d8386f21f017e9444e07d17f1ad174ed67 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 13 Apr 2018 09:05:17 +0200 Subject: [PATCH 1/5] NEW add "printUserPasswordField" hooks --- htdocs/user/card.php | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index f9a69d37baa..beefbf83a3c 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -818,6 +818,13 @@ if ($action == 'create' || $action == 'adduserldap') $valuetoshow.= ($valuetoshow?', ':'').''; } } + + // Other form for add user to group + $parameters=array('valuetoshow' => $valuetoshow); + $reshook=$hookmanager->executeHooks('printUserPasswordField',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if ($reshook > 0) $valuetoshow=$hookmanager->resPrint; // to replace + else $valuetoshow.=$hookmanager->resPrint; // to add + print $valuetoshow; print ''; @@ -1363,6 +1370,13 @@ else else $valuetoshow.= ($valuetoshow?(' '.$langs->trans("or").' '):'').$langs->trans("Hidden"); } } + + // Other form for add user to group + $parameters=array('valuetoshow' => $valuetoshow); + $reshook=$hookmanager->executeHooks('printUserPasswordField',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if ($reshook > 0) $valuetoshow=$hookmanager->resPrint; // to replace + else $valuetoshow.=$hookmanager->resPrint; // to add + print $valuetoshow; print ""; print ''."\n"; @@ -1923,6 +1937,13 @@ else $valuetoshow.=($valuetoshow?(' '.$langs->trans("or").' '):'').preg_replace('/./i','*',$object->pass); } } + + // Other form for add user to group + $parameters=array('valuetoshow' => $valuetoshow); + $reshook=$hookmanager->executeHooks('printUserPasswordField',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if ($reshook > 0) $valuetoshow=$hookmanager->resPrint; // to replace + else $valuetoshow.=$hookmanager->resPrint; // to add + print $valuetoshow; print "\n"; @@ -2033,7 +2054,7 @@ else else { $type=0; - if ($object->contact_id) $type=$object->contact_id; + if ($object->contactid) $type=$object->contactid; print $form->selectcontacts(0,$type,'contactid',2,'','',1,'',false,1); if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; } @@ -2203,12 +2224,12 @@ else print ''; if ($caneditfield) { - print ''; + print ''; } else { - print ''; - print $object->accountancy_code; + print ''; + print $object->accountancy_code; } print ''; print ""; From 7c3f0be83d4c5fa5609c9b787301f948957cc815 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 13 Apr 2018 09:09:26 +0200 Subject: [PATCH 2/5] Fix: missing parameters --- htdocs/user/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index beefbf83a3c..ecfb5de2436 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -820,7 +820,7 @@ if ($action == 'create' || $action == 'adduserldap') } // Other form for add user to group - $parameters=array('valuetoshow' => $valuetoshow); + $parameters=array('valuetoshow' => $valuetoshow, 'password' => $password); $reshook=$hookmanager->executeHooks('printUserPasswordField',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if ($reshook > 0) $valuetoshow=$hookmanager->resPrint; // to replace else $valuetoshow.=$hookmanager->resPrint; // to add From a317c54b66522267b5362bc447de514ac03991b5 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 13 Apr 2018 09:39:02 +0200 Subject: [PATCH 3/5] Fix: missing right parameter --- htdocs/user/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index ecfb5de2436..15c8df0d2b9 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -819,7 +819,7 @@ if ($action == 'create' || $action == 'adduserldap') } } - // Other form for add user to group + // Other form for user password $parameters=array('valuetoshow' => $valuetoshow, 'password' => $password); $reshook=$hookmanager->executeHooks('printUserPasswordField',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if ($reshook > 0) $valuetoshow=$hookmanager->resPrint; // to replace @@ -828,7 +828,7 @@ if ($action == 'create' || $action == 'adduserldap') print $valuetoshow; print ''; - if(! empty($conf->api->enabled)) + if (! empty($conf->api->enabled)) { // API key $generated_api_key = ''; @@ -1371,7 +1371,7 @@ else } } - // Other form for add user to group + // Other form for user password $parameters=array('valuetoshow' => $valuetoshow); $reshook=$hookmanager->executeHooks('printUserPasswordField',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if ($reshook > 0) $valuetoshow=$hookmanager->resPrint; // to replace @@ -1938,8 +1938,8 @@ else } } - // Other form for add user to group - $parameters=array('valuetoshow' => $valuetoshow); + // Other form for user password + $parameters=array('valuetoshow' => $valuetoshow, 'caneditpassword' => $caneditpassword); $reshook=$hookmanager->executeHooks('printUserPasswordField',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if ($reshook > 0) $valuetoshow=$hookmanager->resPrint; // to replace else $valuetoshow.=$hookmanager->resPrint; // to add From ba5ac4760202467e7acaccd783208c3a27fbbd8b Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Fri, 13 Apr 2018 15:48:58 +0200 Subject: [PATCH 4/5] NEW OnSearchAndListGoOnCustomerOrSupplierCard conf --- htdocs/langs/fr_FR/admin.lang | 1 + htdocs/societe/admin/societe.php | 32 ++++++++++++++++++++++++++ htdocs/societe/class/societe.class.php | 7 ++++++ htdocs/societe/list.php | 11 +++++++++ 4 files changed, 51 insertions(+) diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 4d32e4fd948..49a80dabe7a 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1169,6 +1169,7 @@ BrowserIsKO=Vous utilisez le navigateur %s. Ce navigateur est déconseillé pour XDebugInstalled=XDebug est chargé. XCacheInstalled=XCache est chargé. AddRefInList=Afficher les références client/fournisseur dans les listes (listes déroulantes ou à autocomplétion) et les libellés des liens clicables. Les tiers apparaîtront alors sous la forme "CC12345 - SC45678 - La big company coorp", au lieu de "La big company coorp". +OnSearchAndListGoOnCustomerOrSupplierCard = A la recherche, ou sur une liste, aller directement sur la fiche client ou fournisseur (si le tiers est client ou fournisseur) AskForPreferredShippingMethod=Demander la méthode d'expédition préférée pour les tiers. FieldEdition=Édition du champ %s FillThisOnlyIfRequired=Exemple: +2 (ne remplir que si un décalage d'heure est constaté dans l'export) diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 7866ffbf0be..a32dfb99cce 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -263,6 +263,20 @@ if ($action == 'sethideinactivethirdparty') dol_print_error($db); } } +if($action=='setonsearchandlistgooncustomerorsuppliercard'){ + $setonsearchandlistgooncustomerorsuppliercard = GETPOST('value','int'); + $res = dolibarr_set_const($db, "SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD", $setonsearchandlistgooncustomerorsuppliercard,'yesno',0,'',$conf->entity); + if (! $res > 0) $error++; + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + /* * View @@ -775,6 +789,24 @@ else print ''; print ''; +print ''; +print ''.$langs->trans("OnSearchAndListGoOnCustomerOrSupplierCard").''; +print ' '; +print ''; +if (!empty($conf->global->SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD)) +{ + print ''; + print img_picto($langs->trans("Activated"),'switch_on'); + +} +else +{ + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); +} +print ''; +print ''; + /* // COMPANY_USE_SEARCH_TO_SELECT diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index f401f92e84d..1fb99e3c5d2 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1972,6 +1972,13 @@ class Societe extends CommonObject if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips $name=$this->name?$this->name:$this->nom; + + if(!empty($conf->global->SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD)){ + + if(empty($option) && $this->client > 0) $option = 'customer'; + if(empty($option) && $this->fournisseur > 0) $option = 'supplier'; + } + if (! empty($conf->global->SOCIETE_ADD_REF_IN_LIST) && (!empty($withpicto))) { diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 448f526df4a..dd1cb616c4d 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -504,6 +504,17 @@ if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && { $obj = $db->fetch_object($resql); $id = $obj->rowid; + if(!empty($conf->global->SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD)){ + if( $obj->client > 0) { + header("Location: ".DOL_URL_ROOT.'/comm/card.php?socid='.$id); + exit; + } + if( $obj->fournisseur > 0){ + header("Location: ".DOL_URL_ROOT.'/fourn/card.php?socid='.$id); + exit; + } + } + header("Location: ".DOL_URL_ROOT.'/societe/card.php?socid='.$id); exit; } From c6f57b8ec4a8bb1e8a6c479b8ac4cf04c6c6cd0b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Apr 2018 23:29:47 +0200 Subject: [PATCH 5/5] Update societe.php --- htdocs/societe/admin/societe.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index a32dfb99cce..ecbefe2cb1d 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -789,7 +789,7 @@ else print ''; print ''; -print ''; +/*print ''; print ''.$langs->trans("OnSearchAndListGoOnCustomerOrSupplierCard").''; print ' '; print ''; @@ -806,7 +806,7 @@ else } print ''; print ''; - +*/ /* // COMPANY_USE_SEARCH_TO_SELECT