Skip to content

Commit

Permalink
Merge branch '8.0' of git@github.com:Dolibarr/dolibarr.git into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jul 3, 2018
2 parents dfc42e5 + 50df452 commit 5583600
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 40 deletions.
7 changes: 4 additions & 3 deletions htdocs/core/menus/standard/eldy.lib.php
Expand Up @@ -122,6 +122,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
if (! empty($conf->propal->enabled)) $menuqualified++;
if (! empty($conf->commande->enabled)) $menuqualified++;
if (! empty($conf->supplier_order->enabled)) $menuqualified++;
if (! empty($conf->supplier_proposal->enabled)) $menuqualified++;
if (! empty($conf->contrat->enabled)) $menuqualified++;
if (! empty($conf->ficheinter->enabled)) $menuqualified++;
$tmpentry=array(
Expand Down Expand Up @@ -660,11 +661,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
}

// Suppliers
if (! empty($conf->societe->enabled) && ! empty($conf->fournisseur->enabled))
if (! empty($conf->societe->enabled) && (! empty($conf->fournisseur->enabled) || ! empty($conf->supplier_proposal->enabled)))
{
$langs->load("suppliers");
$newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers');
$newmenu->add("/societe/card.php?leftmenu=suppliers&action=create&type=f",$langs->trans("MenuNewSupplier"), 2, $user->rights->societe->creer && $user->rights->fournisseur->lire);
$newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, ($user->rights->fournisseur->lire || $user->rights->supplier_proposal->lire), '', $mainmenu, 'suppliers');
$newmenu->add("/societe/card.php?leftmenu=suppliers&action=create&type=f",$langs->trans("MenuNewSupplier"), 2, $user->rights->societe->creer && ($user->rights->fournisseur->lire || $user->rights->supplier_proposal->lire));
}

// Contacts
Expand Down
83 changes: 47 additions & 36 deletions htdocs/societe/card.php
Expand Up @@ -485,11 +485,6 @@
$langs->load("errors");
setEventMessages('', $langs->trans("ErrorBadUrl",$object->url), 'errors');
}
if ($object->fournisseur && ! $conf->fournisseur->enabled)
{
$langs->load("errors");
setEventMessages('', $langs->trans("ErrorSupplierModuleNotEnabled"), 'errors');
}
if (! empty($object->webservices_url)) {
//Check if has transport, without any the soap client will give error
if (strpos($object->webservices_url, "http") === false)
Expand Down Expand Up @@ -1166,7 +1161,8 @@
print '</td></tr></table>';
print '</td></tr>';

if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire))
if ((! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire))
|| (! empty($conf->supplier_proposal->enabled) && ! empty($user->rights->supplier_proposal->lire)))
{
// Supplier
print '<tr>';
Expand All @@ -1175,15 +1171,23 @@
if (! empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)) $default=1;
print $form->selectyesno("fournisseur", (GETPOST('fournisseur','int')!=''?GETPOST('fournisseur','int'):(GETPOST("type",'alpha') == '' ? $default : $object->fournisseur)), 1, 0, (GETPOST("type",'alpha') == '' ? 1 : 0));
print '</td>';
print '<td>'.fieldLabel('SupplierCode','supplier_code').'</td><td>';
print '<table class="nobordernopadding"><tr><td>';
$tmpcode=$object->code_fournisseur;
if (empty($tmpcode) && ! empty($modCodeFournisseur->code_auto)) $tmpcode=$modCodeFournisseur->getNextValue($object,1);
print '<input type="text" name="code_fournisseur" id="supplier_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).'" maxlength="15">';
print '<td>';
if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire))
{
print fieldLabel('SupplierCode','supplier_code');
}
print '</td><td>';
$s=$modCodeFournisseur->getToolTip($langs,$object,1);
print $form->textwithpicto('',$s,1);
print '</td></tr></table>';
if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire))
{
print '<table class="nobordernopadding"><tr><td>';
$tmpcode=$object->code_fournisseur;
if (empty($tmpcode) && ! empty($modCodeFournisseur->code_auto)) $tmpcode=$modCodeFournisseur->getNextValue($object,1);
print '<input type="text" name="code_fournisseur" id="supplier_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).'" maxlength="15">';
print '</td><td>';
$s=$modCodeFournisseur->getToolTip($langs,$object,1);
print $form->textwithpicto('',$s,1);
print '</td></tr></table>';
}
print '</td></tr>';
}

Expand Down Expand Up @@ -1721,36 +1725,43 @@
print '</td></tr>';

// Supplier
if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire))
if ((! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire))
|| (! empty($conf->supplier_proposal->enabled) && ! empty($user->rights->supplier_proposal->lire)))
{
print '<tr>';
print '<td>'.fieldLabel('Supplier','fournisseur',1).'</td><td class="maxwidthonsmartphone">';
print $form->selectyesno("fournisseur",$object->fournisseur,1);
print '</td>';
print '<td>'.fieldLabel('SupplierCode','supplier_code').'</td><td>';

print '<table class="nobordernopadding"><tr><td>';
if ((!$object->code_fournisseur || $object->code_fournisseur == -1) && $modCodeFournisseur->code_auto)
print '<td>';
if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire))
{
$tmpcode=$object->code_fournisseur;
if (empty($tmpcode) && ! empty($object->oldcopy->code_fournisseur)) $tmpcode=$object->oldcopy->code_fournisseur; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value.
if (empty($tmpcode) && ! empty($modCodeFournisseur->code_auto)) $tmpcode=$modCodeFournisseur->getNextValue($object,1);
print '<input type="text" name="code_fournisseur" id="supplier_code" size="16" value="'.dol_escape_htmltag($tmpcode).'" maxlength="15">';
print fieldLabel('SupplierCode','supplier_code');
}
else if ($object->codefournisseur_modifiable())
print '</td><td>';
if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire))
{
print '<input type="text" name="code_fournisseur" id="supplier_code" size="16" value="'.$object->code_fournisseur.'" maxlength="15">';
}
else
{
print $object->code_fournisseur;
print '<input type="hidden" name="code_fournisseur" value="'.$object->code_fournisseur.'">';
print '<table class="nobordernopadding"><tr><td>';
if ((!$object->code_fournisseur || $object->code_fournisseur == -1) && $modCodeFournisseur->code_auto)
{
$tmpcode=$object->code_fournisseur;
if (empty($tmpcode) && ! empty($object->oldcopy->code_fournisseur)) $tmpcode=$object->oldcopy->code_fournisseur; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value.
if (empty($tmpcode) && ! empty($modCodeFournisseur->code_auto)) $tmpcode=$modCodeFournisseur->getNextValue($object,1);
print '<input type="text" name="code_fournisseur" id="supplier_code" size="16" value="'.dol_escape_htmltag($tmpcode).'" maxlength="15">';
}
else if ($object->codefournisseur_modifiable())
{
print '<input type="text" name="code_fournisseur" id="supplier_code" size="16" value="'.$object->code_fournisseur.'" maxlength="15">';
}
else
{
print $object->code_fournisseur;
print '<input type="hidden" name="code_fournisseur" value="'.$object->code_fournisseur.'">';
}
print '</td><td>';
$s=$modCodeFournisseur->getToolTip($langs,$object,1);
print $form->textwithpicto('',$s,1);
print '</td></tr></table>';
}
print '</td><td>';
$s=$modCodeFournisseur->getToolTip($langs,$object,1);
print $form->textwithpicto('',$s,1);
print '</td></tr></table>';

print '</td></tr>';
}

Expand Down Expand Up @@ -2129,7 +2140,7 @@
print '</td></tr>';

// Supplier
if (! empty($conf->fournisseur->enabled))
if (! empty($conf->fournisseur->enabled) || ! empty($conf->supplier_proposal->enabled))
{
print '<tr><td>'.$langs->trans('Supplier').'</td><td>';
print yn($object->fournisseur);
Expand Down
2 changes: 1 addition & 1 deletion htdocs/societe/list.php
Expand Up @@ -1203,7 +1203,7 @@
$companystatic->name_alias='';
$s.=$companystatic->getNomUrl(0,'prospect',0,1);
}
if (! empty($conf->fournisseur->enabled) && $obj->fournisseur)
if ((! empty($conf->fournisseur->enabled) || ! empty($conf->supplier_proposal->enabled)) && $obj->fournisseur)
{
if ($s) $s.=" / ";
$companystatic->name=$langs->trans("Supplier");
Expand Down

0 comments on commit 5583600

Please sign in to comment.