Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into 7.0

This commit is contained in:
Laurent Destailleur 2018-03-10 17:57:49 +01:00
commit 702c84a100
7 changed files with 53 additions and 13 deletions

View File

@ -93,8 +93,16 @@ if ($action == 'update' && ! empty($permissiontoadd))
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
// Set value to update
if (in_array($object->fields[$key]['type'], array('text', 'html'))) $value = GETPOST($key,'none');
else $value = GETPOST($key,'alpha');
if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
$value = GETPOST($key,'none');
}
elseif ($object->fields[$key]['type']=='date') {
$value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
} elseif ($object->fields[$key]['type']=='datetime') {
$value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
} else {
$value = GETPOST($key,'alpha');
}
if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value=''; // This is an implicit foreign key field
if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value=''; // This is an explicit foreign key field

View File

@ -1257,9 +1257,18 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (! empty($conf->stock->enabled))
{
$langs->load("stocks");
$newmenu->add("/product/inventory/list.php?leftmenu=stock", $langs->trans("Inventory"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock');
$newmenu->add("/product/inventory/card.php?action=create", $langs->trans("NewInventory"), 1, $user->rights->stock->creer);
$newmenu->add("/product/inventory/list.php", $langs->trans("List"), 1, $user->rights->stock->lire);
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
{
$newmenu->add("/product/inventory/list.php?leftmenu=stock", $langs->trans("Inventory"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock');
$newmenu->add("/product/inventory/card.php?action=create", $langs->trans("NewInventory"), 1, $user->rights->stock->creer);
$newmenu->add("/product/inventory/list.php", $langs->trans("List"), 1, $user->rights->stock->lire);
}
else
{
$newmenu->add("/product/inventory/list.php?leftmenu=stock", $langs->trans("Inventory"), 0, $user->rights->stock->advance_inventory->read, '', $mainmenu, 'stock');
$newmenu->add("/product/inventory/card.php?action=create", $langs->trans("NewInventory"), 1, $user->rights->stock->advance_inventory->write);
$newmenu->add("/product/inventory/list.php", $langs->trans("List"), 1, $user->rights->stock->advance_inventory->read);
}
}
}

View File

@ -321,8 +321,6 @@ class CommandeFournisseur extends CommonOrder
if ($this->statut == 0) $this->brouillon = 1;
$this->fetchObjectLinked();
//$result=$this->fetch_lines();
$this->lines=array();

View File

@ -2453,7 +2453,7 @@ elseif (! empty($object->id))
print $form->select_date('','',1,1,'',"commande",1,1,1);
print "</td></tr>\n";
print "<tr><td>".$langs->trans("Delivery")."</td><td>\n";
print "<tr><td class=\"fieldrequired\">".$langs->trans("Delivery")."</td><td>\n";
$liv = array();
$liv[''] = '&nbsp;';
$liv['tot'] = $langs->trans("CompleteOrNoMoreReceptionExpected");

View File

@ -457,7 +457,7 @@ if ($id > 0 || ! empty($ref)) {
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="dispatch">';
print '<div class="div-table-responsive">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
// Set $products_dispatched with qty dispatched for each product id

View File

@ -36,6 +36,15 @@ $action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
{
$result = restrictedArea($user, 'stock', $id);
}
else
{
$result = restrictedArea($user, 'stock', $id, '', 'advance_inventory');
}
// Initialize technical objects
$object=new Inventory($db);
$extrafields = new ExtraFields($db);
@ -66,6 +75,16 @@ $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
{
$permissiontoadd = $user->rights->stock->write;
$permissiontodelete = $user->rights->stock->write;
}
else
{
$permissiontoadd = $user->rights->stock->advance_inventory->create;
$permissiontodelete = $user->rights->stock->advance_inventory->write;
}
/*
@ -80,8 +99,6 @@ if (empty($reshook))
{
$error=0;
$permissiontoadd = $user->rights->stock->creer;
$permissiontodelete = $user->rights->stock->supprimer;
$backurlforlist = DOL_URL_ROOT.'/product/inventory/list.php';
// Actions cancel, add, update or delete
@ -327,7 +344,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Send
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
if ($user->rights->inventory->write)
if ($permissiontoadd)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'."\n";
}
@ -336,7 +353,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
}
if ($user->rights->inventory->delete)
if ($permissiontodelete)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>'."\n";
}

View File

@ -72,6 +72,14 @@ if ($user->societe_id > 0)
//$socid = $user->societe_id;
accessforbidden();
}
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
{
$result = restrictedArea($user, 'stock', $objectid);
}
else
{
$result = restrictedArea($user, 'stock', $objectid, '', 'advance_inventory');
}
// Initialize array of search criterias
$search_all=trim(GETPOST("search_all",'alpha'));