NEW OnSearchAndListGoOnCustomerOrSupplierCard conf

This commit is contained in:
atm-quentin 2018-04-13 15:48:58 +02:00
parent 77a853e49d
commit ba5ac47602
4 changed files with 51 additions and 0 deletions

View File

@ -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)

View File

@ -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 '</a></td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td width="80%">'.$langs->trans("OnSearchAndListGoOnCustomerOrSupplierCard").'</td>';
print '<td>&nbsp</td>';
print '<td align="center">';
if (!empty($conf->global->SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD))
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setonsearchandlistgooncustomerorsuppliercard&value=0">';
print img_picto($langs->trans("Activated"),'switch_on');
}
else
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setonsearchandlistgooncustomerorsuppliercard&value=1">';
print img_picto($langs->trans("Disabled"),'switch_off');
}
print '</a></td>';
print '</tr>';
/*
// COMPANY_USE_SEARCH_TO_SELECT

View File

@ -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)))
{

View File

@ -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;
}