Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
61d32b7fb6
@ -580,7 +580,7 @@ if ($id == 10)
|
|||||||
// Actions add or modify an entry into a dictionary
|
// Actions add or modify an entry into a dictionary
|
||||||
if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||||
{
|
{
|
||||||
$listfield=explode(',',$tabfield[$id]);
|
$listfield=explode(',', str_replace(' ', '',$tabfield[$id]));
|
||||||
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
|
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
|
||||||
$listfieldmodify=explode(',',$tabfieldinsert[$id]);
|
$listfieldmodify=explode(',',$tabfieldinsert[$id]);
|
||||||
$listfieldvalue=explode(',',$tabfieldvalue[$id]);
|
$listfieldvalue=explode(',',$tabfieldvalue[$id]);
|
||||||
|
|||||||
@ -129,18 +129,18 @@ $fieldstosearchall = array(
|
|||||||
$arrayfields=array(
|
$arrayfields=array(
|
||||||
'p.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
'p.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
||||||
'p.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
|
'p.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
|
||||||
'p.poste'=>array('label'=>$langs->trans("Post"), 'checked'=>1),
|
'p.poste'=>array('label'=>$langs->trans("PostOrFunction"), 'checked'=>1),
|
||||||
'p.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0),
|
'p.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0),
|
||||||
'p.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0),
|
'p.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0),
|
||||||
'p.phone'=>array('label'=>$langs->trans("PhonePro"), 'checked'=>1),
|
'p.phone'=>array('label'=>$langs->trans("Phone"), 'checked'=>1),
|
||||||
'p.phone_perso'=>array('label'=>$langs->trans("PhonePerso"), 'checked'=>0),
|
'p.phone_perso'=>array('label'=>$langs->trans("PhonePerso"), 'checked'=>0),
|
||||||
'p.phone_mobile'=>array('label'=>$langs->trans("PhoneMobile"), 'checked'=>1),
|
'p.phone_mobile'=>array('label'=>$langs->trans("PhoneMobile"), 'checked'=>1),
|
||||||
'p.fax'=>array('label'=>$langs->trans("Fax"), 'checked'=>1),
|
'p.fax'=>array('label'=>$langs->trans("Fax"), 'checked'=>1),
|
||||||
'p.email'=>array('label'=>$langs->trans("Email"), 'checked'=>1),
|
'p.email'=>array('label'=>$langs->trans("EMail"), 'checked'=>1),
|
||||||
'p.skype'=>array('label'=>$langs->trans("Skype"), 'checked'=>1, 'enabled'=>(! empty($conf->skype->enabled))),
|
'p.skype'=>array('label'=>$langs->trans("Skype"), 'checked'=>1, 'enabled'=>(! empty($conf->skype->enabled))),
|
||||||
'p.thirdparty'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)),
|
'p.thirdparty'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)),
|
||||||
'p.priv'=>array('label'=>$langs->trans("ContactVisibility"), 'checked'=>1, 'position'=>200),
|
'p.priv'=>array('label'=>$langs->trans("ContactVisibility"), 'checked'=>1, 'position'=>200),
|
||||||
'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
'p.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500),
|
||||||
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||||
'p.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
'p.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1627,57 +1627,36 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
*
|
*
|
||||||
* @param int $idline Id of line to delete
|
* @param int $idline Id of line to delete
|
||||||
* @param int $notrigger 1=Disable call to triggers
|
* @param int $notrigger 1=Disable call to triggers
|
||||||
* @return <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function deleteline($idline, $notrigger=0)
|
public function deleteline($idline, $notrigger=0)
|
||||||
{
|
{
|
||||||
global $user,$langs,$conf;
|
if ($this->statut == 0)
|
||||||
$error = 0;
|
|
||||||
|
|
||||||
if ($this->statut != 0)
|
|
||||||
{
|
{
|
||||||
return -1;
|
$line = new CommandeFournisseurLigne($this->db);
|
||||||
|
|
||||||
|
if ($line->fetch($idline) <= 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->begin();
|
if ($line->delete($notrigger) > 0)
|
||||||
|
|
||||||
if (! $notrigger)
|
|
||||||
{
|
{
|
||||||
// Call trigger
|
$this->update_price();
|
||||||
$result=$this->call_trigger('LINEORDER_SUPPLIER_DELETE',$user);
|
|
||||||
if ($result < 0) $error++;
|
|
||||||
// End call triggers
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid = ".$idline;
|
|
||||||
$resql=$this->db->query($sql);
|
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::deleteline sql=".$sql);
|
|
||||||
if (! $resql)
|
|
||||||
{
|
|
||||||
$this->error=$this->db->lasterror();
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
$result=$this->update_price();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
$this->db->commit();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->error = $line->error;
|
||||||
|
$this->errors = $line->errors;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete an order
|
* Delete an order
|
||||||
@ -3089,7 +3068,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
|||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('LINEORDER_INSERT',$user);
|
$result=$this->call_trigger('LINEORDER_SUPPLIER_CREATE',$user);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
@ -3202,5 +3181,55 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete line in database
|
||||||
|
*
|
||||||
|
* @param int $notrigger 1=Disable call to triggers
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function delete($notrigger)
|
||||||
|
{
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid='".$this->rowid."';";
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!$notrigger)
|
||||||
|
{
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('LINEORDER_SUPPLIER_DELETE',$user);
|
||||||
|
if ($result < 0) $error++;
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error)
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($this->errors as $errmsg)
|
||||||
|
{
|
||||||
|
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1*$error;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -63,12 +63,43 @@ if ($user->societe_id) $socid=$user->societe_id;
|
|||||||
$result=restrictedArea($user,'produit&stock',$id,'product&product','','',$fieldid);
|
$result=restrictedArea($user,'produit&stock',$id,'product&product','','',$fieldid);
|
||||||
|
|
||||||
|
|
||||||
|
$object = new Product($db);
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
|
// fetch optionals attributes and labels
|
||||||
|
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
|
||||||
|
if ($id > 0 || ! empty($ref))
|
||||||
|
{
|
||||||
|
$result = $object->fetch($id, $ref);
|
||||||
|
|
||||||
|
}
|
||||||
|
$modulepart='product';
|
||||||
|
|
||||||
|
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||||
|
$canvas = !empty($object->canvas)?$object->canvas:GETPOST("canvas");
|
||||||
|
$objcanvas=null;
|
||||||
|
if (! empty($canvas))
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php';
|
||||||
|
$objcanvas = new Canvas($db,$action);
|
||||||
|
$objcanvas->getCanvas('stockproduct','card',$canvas);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||||
|
$hookmanager->initHooks(array('stockproductcard','globalcard'));
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($cancel) $action='';
|
if ($cancel) $action='';
|
||||||
|
|
||||||
|
$parameters=array('id'=>$id, 'ref'=>$ref, 'objcanvas'=>$objcanvas);
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
// Set stock limit
|
// Set stock limit
|
||||||
if ($action == 'setseuil_stock_alerte')
|
if ($action == 'setseuil_stock_alerte')
|
||||||
{
|
{
|
||||||
@ -506,6 +537,10 @@ if ($id > 0 || $ref)
|
|||||||
print $form->editfieldval("StockLimit",'seuil_stock_alerte',$object->seuil_stock_alerte,$object,$user->rights->produit->creer,'string');
|
print $form->editfieldval("StockLimit",'seuil_stock_alerte',$object->seuil_stock_alerte,$object,$user->rights->produit->creer,'string');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Hook formObject
|
||||||
|
$parameters=array('colspan' => 3);
|
||||||
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
|
|
||||||
// Desired stock
|
// Desired stock
|
||||||
print '<tr><td>'.$form->editfieldkey($form->textwithpicto($langs->trans("DesiredStock"), $langs->trans("DesiredStockDesc"), 1),'desiredstock',$object->desiredstock,$object,$user->rights->produit->creer);
|
print '<tr><td>'.$form->editfieldkey($form->textwithpicto($langs->trans("DesiredStock"), $langs->trans("DesiredStockDesc"), 1),'desiredstock',$object->desiredstock,$object,$user->rights->produit->creer);
|
||||||
print '</td><td colspan="2">';
|
print '</td><td colspan="2">';
|
||||||
@ -664,9 +699,14 @@ else
|
|||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
$parameters=array();
|
||||||
|
|
||||||
if (empty($action) && $object->id)
|
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (empty($action) && $object->id)
|
||||||
|
{
|
||||||
print "<div class=\"tabsAction\">\n";
|
print "<div class=\"tabsAction\">\n";
|
||||||
|
|
||||||
if ($user->rights->stock->mouvement->creer)
|
if ($user->rights->stock->mouvement->creer)
|
||||||
@ -681,11 +721,11 @@ if (empty($action) && $object->id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Stock detail (by warehouse). May go down into batch details.
|
* Stock detail (by warehouse). May go down into batch details.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user