Fix: When creating invoice from other object, discount are created
automatically
This commit is contained in:
parent
8426d806f0
commit
65c2d93a29
@ -1030,13 +1030,13 @@ if ($action == 'edit')
|
||||
else print $langs->trans("NoDolibarrAccess");
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br><center>';
|
||||
print '<tr><td colspan="3" align="center">';
|
||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</center';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ class Categorie
|
||||
$sql.= " WHERE rowid = ".$id;
|
||||
|
||||
dol_syslog("Categorie::fetch sql=".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$res = $this->db->fetch_array($resql);
|
||||
@ -102,7 +102,7 @@ class Categorie
|
||||
|
||||
$sql = "SELECT fk_categorie_mere";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_association";
|
||||
$sql.= " WHERE fk_categorie_fille = ".$id;
|
||||
$sql.= " WHERE fk_categorie_fille = '".$id."'";
|
||||
|
||||
dol_syslog("Categorie::fetch sql=".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -215,8 +215,7 @@ class Categorie
|
||||
$this->label=trim($this->label);
|
||||
$this->description=trim($this->description);
|
||||
$this->parentId = ($this->id_mere) != "" ? intval($this->id_mere) : 0;
|
||||
$this->visible = ($this->visible) != "" ? intval($this->visible) : 0;
|
||||
|
||||
|
||||
if ($this->already_exists())
|
||||
{
|
||||
$this->error=$langs->trans("ImpossibleUpdateCat");
|
||||
@ -227,7 +226,7 @@ class Categorie
|
||||
$this->db->begin();
|
||||
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'categorie_association';
|
||||
$sql.= ' WHERE fk_categorie_fille = '.$this->id;
|
||||
$sql .= ' WHERE fk_categorie_fille = "'.$this->id.'"';
|
||||
|
||||
dol_syslog("Categorie::update sql=".$sql);
|
||||
if (! $this->db->query($sql))
|
||||
@ -240,7 +239,7 @@ class Categorie
|
||||
if($this->id_mere !="" && $this->id_mere!=$this->id)
|
||||
{
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'categorie_association(fk_categorie_mere,fk_categorie_fille)';
|
||||
$sql.= ' VALUES ('.$this->id_mere.', '.$this->id.')';
|
||||
$sql .= ' VALUES ("'.$this->id_mere.'","'.$this->id.'")';
|
||||
|
||||
dol_syslog("Categorie::update sql=".$sql);
|
||||
if (! $this->db->query($sql))
|
||||
@ -580,10 +579,10 @@ class Categorie
|
||||
* @param int $cate Category id
|
||||
* @return string Description
|
||||
*/
|
||||
function get_desc($cate)
|
||||
function get_desc ($cate)
|
||||
{
|
||||
$sql = "SELECT description FROM ".MAIN_DB_PREFIX."categorie ";
|
||||
$sql .= "WHERE rowid = ".$cate;
|
||||
$sql .= "WHERE rowid = '".$cate."'";
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
$n = $this->db->fetch_array($res);
|
||||
@ -596,7 +595,7 @@ class Categorie
|
||||
*
|
||||
* @param Category $fille Object category
|
||||
*/
|
||||
function is_fille($fille)
|
||||
function is_fille ($fille)
|
||||
{
|
||||
$sql = "SELECT count(fk_categorie_fille) FROM ".MAIN_DB_PREFIX."categorie_association ";
|
||||
$sql .= "WHERE fk_categorie_mere = ".$this->id." AND fk_categorie_fille = ".$fille->id;
|
||||
@ -1078,7 +1077,7 @@ class Categorie
|
||||
$sql = "SELECT ct.fk_categorie";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$type." as ct";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON ct.fk_categorie = c.rowid";
|
||||
$sql.= " WHERE ct.fk_".$table." = ".$id." AND c.type = ".$typeid;
|
||||
$sql.= " WHERE ct.fk_".$table." = ".$id." AND c.type = ".$typeid;
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
if ($res)
|
||||
|
||||
@ -232,7 +232,7 @@ class Facture extends CommonObject
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", '".$this->type."'";
|
||||
$sql.= ", '".$socid."'";
|
||||
$sql.= ", '".$this->db->idate($now)."'";
|
||||
$sql.= ", ".$this->db->idate($now);
|
||||
$sql.= ", '".$totalht."'";
|
||||
$sql.= ",".($this->remise_absolue>0?$this->remise_absolue:'NULL');
|
||||
$sql.= ",".($this->remise_percent>0?$this->remise_percent:'NULL');
|
||||
|
||||
@ -77,7 +77,7 @@ class Canvas
|
||||
* and MVC properties: ->control (Controller), ->control->object (Model), ->template_dir (View)
|
||||
*
|
||||
* @param module Name of target module (thirdparty, contact, ...)
|
||||
* @param card Type of card (ex: 'card', 'info', 'contactcard', ...) or '' for a list page
|
||||
* @param card Type of card (ex: card, info, contactcard, ...)
|
||||
* @param canvas Name of canvas (ex: mycanvas, default, or mycanvas@myexternalmodule)
|
||||
*/
|
||||
function getCanvas($module, $card, $canvas)
|
||||
@ -161,7 +161,7 @@ class Canvas
|
||||
}
|
||||
|
||||
/**
|
||||
* Get object
|
||||
* get object
|
||||
*
|
||||
* @param param1 Param1
|
||||
* @param param2 Param2
|
||||
@ -224,16 +224,16 @@ class Canvas
|
||||
/**
|
||||
* Return the template to display canvas (if it exists)
|
||||
*
|
||||
* @param string $mode 'create', ''='view', 'edit', 'list'
|
||||
* @return string Path to display canvas file if it exists, '' otherwise.
|
||||
* @param mode 'create', ''='view', 'edit'
|
||||
* @return string Path to display canvas file if it exists, '' otherwise.
|
||||
*/
|
||||
function displayCanvasExists($mode='view')
|
||||
{
|
||||
$newmode=$mode;
|
||||
if (empty($newmode)) $newmode='view';
|
||||
if (empty($this->template_dir)) return 0;
|
||||
//print $this->template_dir.($this->card?$this->card.'_':'').$newmode.'.tpl.php';
|
||||
if (file_exists($this->template_dir.($this->card?$this->card.'_':'').$newmode.'.tpl.php')) return 1;
|
||||
//print $this->template_dir.$this->card.'_'.$newmode.'.tpl.php';
|
||||
if (file_exists($this->template_dir.$this->card.'_'.$newmode.'.tpl.php')) return 1;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
@ -242,16 +242,16 @@ class Canvas
|
||||
* Variables used by templates may have been defined, loaded before
|
||||
* into the assign_values function.
|
||||
*
|
||||
* @param string $mode 'create', 'view', 'edit'
|
||||
* @param int $id Id of object to show
|
||||
* @param mode 'create', 'view', 'edit'
|
||||
* @param id Id of object to show
|
||||
*/
|
||||
function display_canvas($mode='view',$id=0)
|
||||
{
|
||||
global $db, $conf, $langs, $user, $canvas;
|
||||
global $id, $form, $formfile;
|
||||
|
||||
//print $this->template_dir.($this->card?$this->card.'_':'').$mode.'.tpl.php';exit;
|
||||
include($this->template_dir.($this->card?$this->card.'_':'').$mode.'.tpl.php'); // Include native PHP template
|
||||
//print $this->template_dir.$this->card.'_'.$mode.'.tpl.php';exit;
|
||||
include($this->template_dir.$this->card.'_'.$mode.'.tpl.php'); // Include native PHP template
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ abstract class CommonObject
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= " WHERE ref = '".$this->ref."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
dol_syslog(get_class($this)."::verifyNumRef sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("CommonObject::verifyNumRef sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -62,7 +62,7 @@ abstract class CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::verifyNumRef ".$this->error, LOG_ERR);
|
||||
dol_syslog("CommonObject::verifyNumRef ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -80,19 +80,19 @@ abstract class CommonObject
|
||||
{
|
||||
global $user,$conf,$langs;
|
||||
|
||||
dol_syslog(get_class($this)."::add_contact $fk_socpeople, $type_contact, $source");
|
||||
dol_syslog("CommonObject::add_contact $fk_socpeople, $type_contact, $source");
|
||||
|
||||
// Check parameters
|
||||
if ($fk_socpeople <= 0)
|
||||
{
|
||||
$this->error=$langs->trans("ErrorWrongValueForParameter","1");
|
||||
dol_syslog(get_class($this)."::add_contact ".$this->error,LOG_ERR);
|
||||
dol_syslog("CommonObject::add_contact ".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
if (! $type_contact)
|
||||
{
|
||||
$this->error=$langs->trans("ErrorWrongValueForParameter","2");
|
||||
dol_syslog(get_class($this)."::add_contact ".$this->error,LOG_ERR);
|
||||
dol_syslog("CommonObject::add_contact ".$this->error,LOG_ERR);
|
||||
return -2;
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ abstract class CommonObject
|
||||
$sql.= $this->db->idate($datecreate);
|
||||
$sql.= ", 4, '". $id_type_contact . "' ";
|
||||
$sql.= ")";
|
||||
dol_syslog(get_class($this)."::add_contact sql=".$sql);
|
||||
dol_syslog("CommonObject::add_contact sql=".$sql);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -200,7 +200,7 @@ abstract class CommonObject
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact";
|
||||
$sql.= " WHERE rowid =".$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::delete_contact sql=".$sql);
|
||||
dol_syslog("CommonObject::delete_contact sql=".$sql);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if (! $notrigger)
|
||||
@ -218,7 +218,7 @@ abstract class CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::delete_contact error=".$this->error, LOG_ERR);
|
||||
dol_syslog("CommonObject::delete_contact error=".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -243,7 +243,7 @@ abstract class CommonObject
|
||||
$sql.= " WHERE element_id =".$this->id;
|
||||
$sql.= " AND fk_c_type_contact IN (".$listId.")";
|
||||
|
||||
dol_syslog(get_class($this)."::delete_linked_contact sql=".$sql);
|
||||
dol_syslog("CommonObject::delete_linked_contact sql=".$sql);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
return 1;
|
||||
@ -251,7 +251,7 @@ abstract class CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::delete_linked_contact error=".$this->error, LOG_ERR);
|
||||
dol_syslog("CommonObject::delete_linked_contact error=".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -288,7 +288,7 @@ abstract class CommonObject
|
||||
if ($statut >= 0) $sql.= " AND ec.statut = '".$statut."'";
|
||||
$sql.=" ORDER BY t.name ASC";
|
||||
|
||||
dol_syslog(get_class($this)."::liste_contact sql=".$sql);
|
||||
dol_syslog("CommonObject::liste_contact sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -440,7 +440,7 @@ abstract class CommonObject
|
||||
$sql.= " AND tc.active = 1";
|
||||
if ($status) $sql.= " AND ec.statut = ".$status;
|
||||
|
||||
dol_syslog(get_class($this)."::getIdContact sql=".$sql);
|
||||
dol_syslog("CommonObject::getIdContact sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -453,7 +453,7 @@ abstract class CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::getIdContact ".$this->error, LOG_ERR);
|
||||
dol_syslog("CommonObject::getIdContact ".$this->error, LOG_ERR);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -606,7 +606,7 @@ abstract class CommonObject
|
||||
$sql.= $field." = '".$value."'";
|
||||
$sql.= " WHERE rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::updateObjectField sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("CommonObject::updateObjectField sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -632,7 +632,7 @@ abstract class CommonObject
|
||||
|
||||
if (! $this->table_element)
|
||||
{
|
||||
dol_print_error('',get_class($this)."::load_previous_next_ref was called on objet with property table_element not defined", LOG_ERR);
|
||||
dol_print_error('',"CommonObject::load_previous_next_ref was called on objet with property table_element not defined", LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -720,7 +720,7 @@ abstract class CommonObject
|
||||
{
|
||||
if (! $this->table_element)
|
||||
{
|
||||
dol_syslog(get_class($this)."::setProject was called on objet with property table_element not defined",LOG_ERR);
|
||||
dol_syslog("CommonObject::setProject was called on objet with property table_element not defined",LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -729,7 +729,7 @@ abstract class CommonObject
|
||||
else $sql.= ' SET fk_projet = NULL';
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::setProject sql=".$sql);
|
||||
dol_syslog("CommonObject::setProject sql=".$sql);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->fk_project = $projectid;
|
||||
@ -754,7 +754,7 @@ abstract class CommonObject
|
||||
{
|
||||
if (! $this->table_element)
|
||||
{
|
||||
dol_syslog(get_class($this)."::setDocModel was called on objet with property table_element not defined",LOG_ERR);
|
||||
dol_syslog("CommonObject::setDocModel was called on objet with property table_element not defined",LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -766,7 +766,7 @@ abstract class CommonObject
|
||||
// if ($this->element == 'facture') $sql.= " AND fk_statut < 2";
|
||||
// if ($this->element == 'propal') $sql.= " AND fk_statut = 0";
|
||||
|
||||
dol_syslog(get_class($this)."::setDocModel sql=".$sql);
|
||||
dol_syslog("CommonObject::setDocModel sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -791,12 +791,12 @@ abstract class CommonObject
|
||||
{
|
||||
if (! $this->table_element_line)
|
||||
{
|
||||
dol_syslog(get_class($this)."::line_order was called on objet with property table_element_line not defined",LOG_ERR);
|
||||
dol_syslog("CommonObject::line_order was called on objet with property table_element_line not defined",LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
if (! $this->fk_element)
|
||||
{
|
||||
dol_syslog(get_class($this)."::line_order was called on objet with property fk_element not defined",LOG_ERR);
|
||||
dol_syslog("CommonObject::line_order was called on objet with property fk_element not defined",LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1042,7 +1042,7 @@ abstract class CommonObject
|
||||
{
|
||||
if (! $this->table_element)
|
||||
{
|
||||
dol_syslog(get_class($this)."::update_note was called on objet with property table_element not defined", LOG_ERR);
|
||||
dol_syslog("CommonObject::update_note was called on objet with property table_element not defined", LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1058,7 +1058,7 @@ abstract class CommonObject
|
||||
}
|
||||
$sql.= " WHERE rowid =". $this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update_note sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("CommonObject::update_note sql=".$sql, LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->note = $note;
|
||||
@ -1067,7 +1067,7 @@ abstract class CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::update_note error=".$this->error, LOG_ERR);
|
||||
dol_syslog("CommonObject::update_note error=".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1081,7 +1081,7 @@ abstract class CommonObject
|
||||
{
|
||||
if (! $this->table_element)
|
||||
{
|
||||
dol_syslog(get_class($this)."::update_note_public was called on objet with property table_element not defined",LOG_ERR);
|
||||
dol_syslog("CommonObject::update_note_public was called on objet with property table_element not defined",LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1089,7 +1089,7 @@ abstract class CommonObject
|
||||
$sql.= " SET note_public = '".$this->db->escape($note_public)."'";
|
||||
$sql.= " WHERE rowid =". $this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update_note_public sql=".$sql);
|
||||
dol_syslog("CommonObject::update_note_public sql=".$sql);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->note_public = $note_public;
|
||||
@ -1130,7 +1130,7 @@ abstract class CommonObject
|
||||
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
|
||||
if ($exclspec) $sql.= ' AND product_type <> 9';
|
||||
|
||||
dol_syslog(get_class($this)."::update_price sql=".$sql);
|
||||
dol_syslog("CommonObject::update_price sql=".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1194,7 +1194,7 @@ abstract class CommonObject
|
||||
$sql .= ' WHERE rowid = '.$this->id;
|
||||
|
||||
//print "xx".$sql;
|
||||
dol_syslog(get_class($this)."::update_price sql=".$sql);
|
||||
dol_syslog("CommonObject::update_price sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1203,14 +1203,14 @@ abstract class CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::update_price error=".$this->error,LOG_ERR);
|
||||
dol_syslog("CommonObject::update_price error=".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::update_price error=".$this->error,LOG_ERR);
|
||||
dol_syslog("CommonObject::update_price error=".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1236,7 +1236,7 @@ abstract class CommonObject
|
||||
$sql.= ", '".$this->element."'";
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::add_object_linked sql=".$sql);
|
||||
dol_syslog("CommonObject::add_object_linked sql=".$sql);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -1293,7 +1293,7 @@ abstract class CommonObject
|
||||
}
|
||||
//print $sql;
|
||||
|
||||
dol_syslog(get_class($this)."::fetchObjectLink sql=".$sql);
|
||||
dol_syslog("CommonObject::fetchObjectLink sql=".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1382,25 +1382,73 @@ abstract class CommonObject
|
||||
$sql.= " SET fk_statut = ".$statut;
|
||||
$sql.= " WHERE rowid=".$elementId;
|
||||
|
||||
dol_syslog(get_class($this)."::setStatut sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("CommonObject::setStatut sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::setStatut ".$this->error, LOG_ERR);
|
||||
dol_syslog("CommonObject::setStatut ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch field list
|
||||
*/
|
||||
function getFieldList()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$this->field_list = array();
|
||||
|
||||
$sql = "SELECT rowid, name, alias, title, align, sort, search, enabled, rang";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_field_list";
|
||||
$sql.= " WHERE element = '".$this->fieldListName."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql.= " ORDER BY rang ASC";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$fieldlist = array();
|
||||
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$fieldlist["id"] = $obj->rowid;
|
||||
$fieldlist["name"] = $obj->name;
|
||||
$fieldlist["alias"] = $obj->alias;
|
||||
$fieldlist["title"] = $langs->trans($obj->title);
|
||||
$fieldlist["align"] = $obj->align;
|
||||
$fieldlist["sort"] = $obj->sort;
|
||||
$fieldlist["search"] = $obj->search;
|
||||
$fieldlist["enabled"] = verifCond($obj->enabled);
|
||||
$fieldlist["order"] = $obj->rang;
|
||||
|
||||
array_push($this->field_list,$fieldlist);
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db,$sql);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load type of canvas of an object if it exists
|
||||
*
|
||||
* @param int $id Record id
|
||||
* @param string $ref Record ref
|
||||
* @return int <0 if KO, 0 if nothing done, >0 if OK
|
||||
* @param id Record id
|
||||
* @param ref Record ref
|
||||
* @return int <0 if KO, 0 if nothing done, >0 if OK
|
||||
*/
|
||||
function getCanvas($id=0,$ref='')
|
||||
{
|
||||
|
||||
@ -217,7 +217,6 @@ class Export
|
||||
// Build the sql request
|
||||
$sql=$this->array_export_sql_start[$indice];
|
||||
$i=0;
|
||||
|
||||
//print_r($array_selected);
|
||||
foreach ($this->array_export_fields[$indice] as $key => $value)
|
||||
{
|
||||
@ -254,14 +253,7 @@ class Export
|
||||
asort($array_selected);
|
||||
|
||||
dol_syslog("Export::build_file $model, $datatoexport, $array_selected");
|
||||
|
||||
// Check parameters or context properties
|
||||
if (! is_array($this->array_export_fields[$indice]))
|
||||
{
|
||||
$this->error="ErrorBadParameter";
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// Creation de la classe d'export du model ExportXXX
|
||||
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/export/";
|
||||
$file = "export_".$model.".modules.php";
|
||||
@ -286,7 +278,7 @@ class Export
|
||||
$outputlangs=$langs; // Lang for output
|
||||
|
||||
// Open file
|
||||
dol_mkdir($dirname);
|
||||
create_exdir($dirname);
|
||||
$result=$objmodel->open_file($dirname."/".$filename, $outputlangs);
|
||||
|
||||
if ($result >= 0)
|
||||
|
||||
@ -1051,7 +1051,7 @@ LDAPFilterConnection=Search filter
|
||||
LDAPFilterConnectionExample=Example : &(objectClass=inetOrgPerson)
|
||||
LDAPFieldLoginSamba=Login (samba, activedirectory)
|
||||
LDAPFieldLoginSambaExample=Example : samaccountname
|
||||
LDAPFieldFullname=First name
|
||||
LDAPFieldFullname=Firstname Name
|
||||
LDAPFieldFullnameExample=Example : cn
|
||||
LDAPFieldPassword=Password
|
||||
LDAPFieldPasswordNotCrypted=Password not crypted
|
||||
|
||||
@ -53,8 +53,8 @@ ReportByQuarter=Report by rate
|
||||
CivilityCode=Civility code
|
||||
RegisteredOffice=Registered office
|
||||
Name=Name
|
||||
Lastname=Last name
|
||||
Firstname=First name
|
||||
Lastname=Lastname
|
||||
Firstname=Name
|
||||
PostOrFunction=Post/Function
|
||||
UserTitle=Title
|
||||
Surname=Surname/Pseudo
|
||||
|
||||
@ -36,35 +36,25 @@ class ActionsCardProduct extends Product
|
||||
//! Template container
|
||||
var $tpl = array();
|
||||
|
||||
// List of fiels for action=list
|
||||
var $field_list =array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $DB Handler acces base de donnees
|
||||
* @param string $targmetmodule Name of directory of module where canvas is stored
|
||||
* @param string $canvas Name of canvas
|
||||
* @param string $card Name of tab (sub-canvas)
|
||||
* \brief Constructeur de la classe
|
||||
* \param DB Handler acces base de donnees
|
||||
* \param id Id produit (0 par defaut)
|
||||
*/
|
||||
function ActionsCardIndividual($DB,$targetmodule,$canvas,$card)
|
||||
function ActionsCardProduct($DB=0, $id=0, $user=0)
|
||||
{
|
||||
$this->db = $DB;
|
||||
$this->targetmodule = $targetmodule;
|
||||
$this->canvas = $canvas;
|
||||
$this->card = $card;
|
||||
|
||||
$this->name = "product";
|
||||
$this->id = $id ;
|
||||
$this->user = $user;
|
||||
$this->module = "produit";
|
||||
$this->canvas = "default";
|
||||
$this->name = "default";
|
||||
$this->definition = "Product canvas (défaut)";
|
||||
$this->fieldListName = "product_default";
|
||||
|
||||
$this->next_prev_filter = "canvas='default'";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the title of card
|
||||
*/
|
||||
function getTitle()
|
||||
{
|
||||
global $langs;
|
||||
@ -86,7 +76,7 @@ class ActionsCardProduct extends Product
|
||||
/**
|
||||
* Assign custom values for canvas (for example into this->tpl to be used by templates)
|
||||
*
|
||||
* @param action Type of action
|
||||
* @param action Type of action
|
||||
*/
|
||||
function assign_values($action='')
|
||||
{
|
||||
@ -189,65 +179,8 @@ class ActionsCardProduct extends Product
|
||||
|
||||
$this->tpl['fiche_end']=dol_get_fiche_end();
|
||||
}
|
||||
|
||||
if ($action == 'list')
|
||||
{
|
||||
$this->LoadListDatas($GLOBALS['limit'], $GLOBALS['offset'], $GLOBALS['sortfield'], $GLOBALS['sortorder']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch field list
|
||||
*/
|
||||
function getFieldList()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$this->field_list = array();
|
||||
|
||||
$sql = "SELECT rowid, name, alias, title, align, sort, search, enabled, rang";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_field_list";
|
||||
$sql.= " WHERE element = '".$this->fieldListName."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql.= " ORDER BY rang ASC";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$fieldlist = array();
|
||||
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$fieldlist["id"] = $obj->rowid;
|
||||
$fieldlist["name"] = $obj->name;
|
||||
$fieldlist["alias"] = $obj->alias;
|
||||
$fieldlist["title"] = $langs->trans($obj->title);
|
||||
$fieldlist["align"] = $obj->align;
|
||||
$fieldlist["sort"] = $obj->sort;
|
||||
$fieldlist["search"] = $obj->search;
|
||||
$fieldlist["enabled"] = verifCond($obj->enabled);
|
||||
$fieldlist["order"] = $obj->rang;
|
||||
|
||||
array_push($this->field_list,$fieldlist);
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db,$sql);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch datas list
|
||||
*/
|
||||
@ -255,9 +188,7 @@ class ActionsCardProduct extends Product
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$this->getFieldList();
|
||||
|
||||
$this->list_datas = array();
|
||||
$this->list_datas = array();
|
||||
|
||||
//$_GET["sall"] = 'LL';
|
||||
// Clean parameters
|
||||
@ -325,7 +256,7 @@ class ActionsCardProduct extends Product
|
||||
$sql.= $this->db->order($sortfield,$sortorder);
|
||||
$sql.= $this->db->plimit($limit + 1 ,$offset);
|
||||
//print $sql;
|
||||
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -36,40 +36,28 @@ class ActionsCardService extends Product
|
||||
//! Template container
|
||||
var $tpl = array();
|
||||
|
||||
// List of fiels for action=list
|
||||
var $field_list =array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $DB Handler acces base de donnees
|
||||
* @param string $targmetmodule Name of directory of module where canvas is stored
|
||||
* @param string $canvas Name of canvas
|
||||
* @param string $card Name of tab (sub-canvas)
|
||||
* \brief Constructeur de la classe
|
||||
* \param DB Handler acces base de donnees
|
||||
* \param id Id service (0 par defaut)
|
||||
*/
|
||||
function ActionsCardIndividual($DB,$targetmodule,$canvas,$card)
|
||||
function ActionsCardService($DB=0, $id=0, $user=0)
|
||||
{
|
||||
$this->db = $DB;
|
||||
$this->targetmodule = $targetmodule;
|
||||
$this->canvas = $canvas;
|
||||
$this->card = $card;
|
||||
|
||||
$this->id = $id ;
|
||||
$this->user = $user;
|
||||
$this->module = "service";
|
||||
$this->canvas = "service";
|
||||
$this->name = "service";
|
||||
$this->definition = "Services canvas";
|
||||
$this->fieldListName = "product_service";
|
||||
|
||||
$this->next_prev_filter = "canvas='service'";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the title of card
|
||||
*/
|
||||
function getTitle()
|
||||
{
|
||||
global $langs;
|
||||
|
||||
return $langs->trans("Products");
|
||||
return 'Services';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,9 +72,8 @@ class ActionsCardService extends Product
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign custom values for canvas (for example into this->tpl to be used by templates)
|
||||
*
|
||||
* @param action Type of action
|
||||
* \brief Assigne les valeurs pour les templates
|
||||
* \param object object
|
||||
*/
|
||||
function assign_values($action='')
|
||||
{
|
||||
@ -169,62 +156,6 @@ class ActionsCardService extends Product
|
||||
|
||||
$this->tpl['fiche_end']=dol_get_fiche_end();
|
||||
}
|
||||
|
||||
if ($action == 'list')
|
||||
{
|
||||
$this->LoadListDatas($GLOBALS['limit'], $GLOBALS['offset'], $GLOBALS['sortfield'], $GLOBALS['sortorder']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch field list
|
||||
*/
|
||||
private function getFieldList()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$this->field_list = array();
|
||||
|
||||
$sql = "SELECT rowid, name, alias, title, align, sort, search, enabled, rang";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_field_list";
|
||||
$sql.= " WHERE element = '".$this->fieldListName."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql.= " ORDER BY rang ASC";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$fieldlist = array();
|
||||
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$fieldlist["id"] = $obj->rowid;
|
||||
$fieldlist["name"] = $obj->name;
|
||||
$fieldlist["alias"] = $obj->alias;
|
||||
$fieldlist["title"] = $langs->trans($obj->title);
|
||||
$fieldlist["align"] = $obj->align;
|
||||
$fieldlist["sort"] = $obj->sort;
|
||||
$fieldlist["search"] = $obj->search;
|
||||
$fieldlist["enabled"] = verifCond($obj->enabled);
|
||||
$fieldlist["order"] = $obj->rang;
|
||||
|
||||
array_push($this->field_list,$fieldlist);
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db,$sql);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -234,8 +165,6 @@ class ActionsCardService extends Product
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->getFieldList();
|
||||
|
||||
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,';
|
||||
$sql.= ' p.fk_product_type, p.tms as datem,';
|
||||
$sql.= ' p.duration, p.tosell as statut, p.seuil_stock_alerte';
|
||||
|
||||
@ -105,10 +105,15 @@ if ($conf->categorie->enabled && GETPOST('catid'))
|
||||
$htmlother=new FormOther($db);
|
||||
$html=new Form($db);
|
||||
|
||||
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
if (! empty($objcanvas->template_dir))
|
||||
{
|
||||
$objcanvas->assign_values('list'); // This must contains code to load data (must call LoadListDatas($limit, $offset, $sortfield, $sortorder))
|
||||
$objcanvas->display_canvas('list'); // This is code to show template
|
||||
$classname = 'ActionsCard'.ucfirst($canvas);
|
||||
include_once(DOL_DOCUMENT_ROOT.'/product/canvas/'.$canvas.'/actions_card_'.$canvas.'.class.php');
|
||||
|
||||
$object = new $classname($db);
|
||||
$object->getFieldList();
|
||||
$object->LoadListDatas($limit, $offset, $sortfield, $sortorder);
|
||||
$title = $object->getTitle();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -129,346 +134,346 @@ else
|
||||
{
|
||||
$texte = $langs->trans("ProductsAndServices");
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,';
|
||||
$sql.= ' p.fk_product_type, p.tms as datem,';
|
||||
$sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte,';
|
||||
$sql.= ' MIN(pfp.unitprice) as minsellprice';
|
||||
$sql.= ' FROM ('.MAIN_DB_PREFIX.'product as p';
|
||||
// We'll need this table joined to the select in order to filter by categ
|
||||
if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_product as cp";
|
||||
$sql.= ') ';
|
||||
//if ($fourn_id > 0) // The DISTINCT is used to avoid duplicate from this link
|
||||
//{
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur as pf ON p.rowid = pf.fk_product";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pf.rowid = pfp.fk_product_fournisseur";
|
||||
//}
|
||||
$sql.= ' WHERE p.entity IN (0,'.(! empty($conf->entities['product']) ? $conf->entities['product'] : $conf->entity).')';
|
||||
if ($search_categ) $sql.= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ
|
||||
if ($sall)
|
||||
{
|
||||
$sql.= " AND (p.ref LIKE '%".$db->escape($sall)."%' OR p.label LIKE '%".$db->escape($sall)."%' OR p.description LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%')";
|
||||
}
|
||||
# if the type is not 1, we show all products (type = 0,2,3)
|
||||
if (dol_strlen($type))
|
||||
{
|
||||
if ($type == 1) $sql.= " AND p.fk_product_type = '1'";
|
||||
else $sql.= " AND p.fk_product_type <> '1'";
|
||||
}
|
||||
if ($sref) $sql.= " AND p.ref like '%".$sref."%'";
|
||||
if ($sbarcode) $sql.= " AND p.barcode like '%".$sbarcode."%'";
|
||||
if ($snom) $sql.= " AND p.label like '%".$db->escape($snom)."%'";
|
||||
if (isset($tosell) && dol_strlen($tosell) > 0) $sql.= " AND p.tosell = ".$db->escape($tosell);
|
||||
if (isset($tobuy) && dol_strlen($tobuy) > 0) $sql.= " AND p.tobuy = ".$db->escape($tobuy);
|
||||
if (dol_strlen($canvas) > 0) $sql.= " AND p.canvas = '".$db->escape($canvas)."'";
|
||||
if ($catid) $sql.= " AND cp.fk_categorie = ".$catid;
|
||||
if ($search_categ) $sql.= " AND cp.fk_categorie = ".$search_categ;
|
||||
if ($fourn_id > 0) $sql.= " AND pf.fk_soc = ".$fourn_id;
|
||||
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,";
|
||||
$sql.= " p.fk_product_type, p.tms,";
|
||||
$sql.= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte";
|
||||
//if (GETPOST("toolowstock")) $sql.= " HAVING SUM(s.reel) < p.seuil_stock_alerte"; // Not used yet
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit + 1 ,$offset);
|
||||
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,';
|
||||
$sql.= ' p.fk_product_type, p.tms as datem,';
|
||||
$sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte,';
|
||||
$sql.= ' MIN(pfp.unitprice) as minsellprice';
|
||||
$sql.= ' FROM ('.MAIN_DB_PREFIX.'product as p';
|
||||
// We'll need this table joined to the select in order to filter by categ
|
||||
if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_product as cp";
|
||||
$sql.= ') ';
|
||||
//if ($fourn_id > 0) // The DISTINCT is used to avoid duplicate from this link
|
||||
//{
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur as pf ON p.rowid = pf.fk_product";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pf.rowid = pfp.fk_product_fournisseur";
|
||||
//}
|
||||
$sql.= ' WHERE p.entity IN (0,'.(! empty($conf->entities['product']) ? $conf->entities['product'] : $conf->entity).')';
|
||||
if ($search_categ) $sql.= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ
|
||||
if ($sall)
|
||||
{
|
||||
$sql.= " AND (p.ref LIKE '%".$db->escape($sall)."%' OR p.label LIKE '%".$db->escape($sall)."%' OR p.description LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%')";
|
||||
}
|
||||
# if the type is not 1, we show all products (type = 0,2,3)
|
||||
if (dol_strlen($type))
|
||||
{
|
||||
if ($type == 1) $sql.= " AND p.fk_product_type = '1'";
|
||||
else $sql.= " AND p.fk_product_type <> '1'";
|
||||
}
|
||||
if ($sref) $sql.= " AND p.ref like '%".$sref."%'";
|
||||
if ($sbarcode) $sql.= " AND p.barcode like '%".$sbarcode."%'";
|
||||
if ($snom) $sql.= " AND p.label like '%".$db->escape($snom)."%'";
|
||||
if (isset($tosell) && dol_strlen($tosell) > 0) $sql.= " AND p.tosell = ".$db->escape($tosell);
|
||||
if (isset($tobuy) && dol_strlen($tobuy) > 0) $sql.= " AND p.tobuy = ".$db->escape($tobuy);
|
||||
if (dol_strlen($canvas) > 0) $sql.= " AND p.canvas = '".$db->escape($canvas)."'";
|
||||
if ($catid) $sql.= " AND cp.fk_categorie = ".$catid;
|
||||
if ($search_categ) $sql.= " AND cp.fk_categorie = ".$search_categ;
|
||||
if ($fourn_id > 0) $sql.= " AND pf.fk_soc = ".$fourn_id;
|
||||
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,";
|
||||
$sql.= " p.fk_product_type, p.tms,";
|
||||
$sql.= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte";
|
||||
//if (GETPOST("toolowstock")) $sql.= " HAVING SUM(s.reel) < p.seuil_stock_alerte"; // Not used yet
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit + 1 ,$offset);
|
||||
|
||||
dol_syslog("sql=".$sql);
|
||||
$resql = $db->query($sql) ;
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
dol_syslog("sql=".$sql);
|
||||
$resql = $db->query($sql) ;
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$i = 0;
|
||||
$i = 0;
|
||||
|
||||
if ($num == 1 && ($sall || $snom || $sref || $sbarcode) && $action != 'list')
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
Header("Location: fiche.php?id=".$objp->rowid);
|
||||
exit;
|
||||
}
|
||||
if ($num == 1 && ($sall || $snom || $sref || $sbarcode) && $action != 'list')
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
Header("Location: fiche.php?id=".$objp->rowid);
|
||||
exit;
|
||||
}
|
||||
|
||||
$helpurl='';
|
||||
if (isset($_GET["type"]) && $_GET["type"] == 0)
|
||||
{
|
||||
$helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
|
||||
}
|
||||
if (isset($_GET["type"]) && $_GET["type"] == 1)
|
||||
{
|
||||
$helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
|
||||
}
|
||||
$helpurl='';
|
||||
if (isset($_GET["type"]) && $_GET["type"] == 0)
|
||||
{
|
||||
$helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
|
||||
}
|
||||
if (isset($_GET["type"]) && $_GET["type"] == 1)
|
||||
{
|
||||
$helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
|
||||
}
|
||||
|
||||
llxHeader('',$title,$helpurl,'');
|
||||
llxHeader('',$title,$helpurl,'');
|
||||
|
||||
// Displays product removal confirmation
|
||||
if (GETPOST('delprod')) dol_htmloutput_mesg($langs->trans("ProductDeleted",GETPOST('delprod')));
|
||||
// Displays product removal confirmation
|
||||
if (GETPOST('delprod')) dol_htmloutput_mesg($langs->trans("ProductDeleted",GETPOST('delprod')));
|
||||
|
||||
$param="&sref=".$sref.($sbarcode?"&sbarcode=".$sbarcode:"")."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy;
|
||||
$param.=($fourn_id?"&fourn_id=".$fourn_id:"");
|
||||
$param.=isset($type)?"&type=".$type:"";
|
||||
print_barre_liste($texte, $page, "liste.php", $param, $sortfield, $sortorder,'',$num);
|
||||
$param="&sref=".$sref.($sbarcode?"&sbarcode=".$sbarcode:"")."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy;
|
||||
$param.=($fourn_id?"&fourn_id=".$fourn_id:"");
|
||||
$param.=isset($type)?"&type=".$type:"";
|
||||
print_barre_liste($texte, $page, "liste.php", $param, $sortfield, $sortorder,'',$num);
|
||||
|
||||
if (isset($catid))
|
||||
{
|
||||
print "<div id='ways'>";
|
||||
$c = new Categorie ($db, $catid);
|
||||
$ways = $c->print_all_ways(' > ','product/liste.php');
|
||||
print " > ".$ways[0]."<br>\n";
|
||||
print "</div><br>";
|
||||
}
|
||||
if (isset($catid))
|
||||
{
|
||||
print "<div id='ways'>";
|
||||
$c = new Categorie ($db, $catid);
|
||||
$ways = $c->print_all_ways(' > ','product/liste.php');
|
||||
print " > ".$ways[0]."<br>\n";
|
||||
print "</div><br>";
|
||||
}
|
||||
|
||||
if (!empty($_GET["canvas"]) && file_exists(DOL_DOCUMENT_ROOT.'/product/canvas/'.$_GET["canvas"].'/actions_card_'.$_GET["canvas"].'.class.php'))
|
||||
{
|
||||
$fieldlist = $object->field_list;
|
||||
$datas = $object->list_datas;
|
||||
$picto='title.png';
|
||||
if (empty($conf->browser->firefox)) $picto='title.gif';
|
||||
$title_picto = img_picto('',$picto);
|
||||
$title_text = $title;
|
||||
if (!empty($_GET["canvas"]) && file_exists(DOL_DOCUMENT_ROOT.'/product/canvas/'.$_GET["canvas"].'/actions_card_'.$_GET["canvas"].'.class.php'))
|
||||
{
|
||||
$fieldlist = $object->field_list;
|
||||
$datas = $object->list_datas;
|
||||
$picto='title.png';
|
||||
if (empty($conf->browser->firefox)) $picto='title.gif';
|
||||
$title_picto = img_picto('',$picto);
|
||||
$title_text = $title;
|
||||
|
||||
// Default templates directory
|
||||
$template_dir = DOL_DOCUMENT_ROOT . '/product/canvas/'.$_GET["canvas"].'/tpl/';
|
||||
// Check if a custom template is present
|
||||
if (file_exists(DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$_GET["canvas"].'/list.tpl.php'))
|
||||
{
|
||||
$template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$_GET["canvas"].'/';
|
||||
}
|
||||
// Default templates directory
|
||||
$template_dir = DOL_DOCUMENT_ROOT . '/product/canvas/'.$_GET["canvas"].'/tpl/';
|
||||
// Check if a custom template is present
|
||||
if (file_exists(DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$_GET["canvas"].'/list.tpl.php'))
|
||||
{
|
||||
$template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$_GET["canvas"].'/';
|
||||
}
|
||||
|
||||
include($template_dir.'list.tpl.php'); // Include native PHP templates
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<form action="liste.php" method="post" name="formulaire">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
include($template_dir.'list.tpl.php'); // Include native PHP templates
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<form action="liste.php" method="post" name="formulaire">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<table class="liste" width="100%">';
|
||||
|
||||
// Filter on categories
|
||||
$moreforfilter='';
|
||||
if ($conf->categorie->enabled)
|
||||
{
|
||||
$moreforfilter.=$langs->trans('Categories'). ': ';
|
||||
$moreforfilter.=$htmlother->select_categories(0,$search_categ,'search_categ');
|
||||
$moreforfilter.=' ';
|
||||
}
|
||||
if ($moreforfilter)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" colspan="9">';
|
||||
print $moreforfilter;
|
||||
print '</td></tr>';
|
||||
}
|
||||
// Filter on categories
|
||||
$moreforfilter='';
|
||||
if ($conf->categorie->enabled)
|
||||
{
|
||||
$moreforfilter.=$langs->trans('Categories'). ': ';
|
||||
$moreforfilter.=$htmlother->select_categories(0,$search_categ,'search_categ');
|
||||
$moreforfilter.=' ';
|
||||
}
|
||||
if ($moreforfilter)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" colspan="9">';
|
||||
print $moreforfilter;
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Lignes des titres
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder);
|
||||
if ($conf->barcode->enabled) print_liste_field_titre($langs->trans("BarCode"), $_SERVER["PHP_SELF"], "p.barcode",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateModification"), $_SERVER["PHP_SELF"], "p.tms",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
if ($conf->service->enabled && $type != 0) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("SellingPrice"), $_SERVER["PHP_SELF"], "p.price",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print '<td class="liste_titre" align="right">'.$langs->trans("BuyingPriceMinShort").'</td>';
|
||||
if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1) print '<td class="liste_titre" align="right">'.$langs->trans("PhysicalStock").'</td>';
|
||||
print_liste_field_titre($langs->trans("Sell"), $_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Buy"), $_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
// Lignes des titres
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder);
|
||||
if ($conf->barcode->enabled) print_liste_field_titre($langs->trans("BarCode"), $_SERVER["PHP_SELF"], "p.barcode",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateModification"), $_SERVER["PHP_SELF"], "p.tms",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
if ($conf->service->enabled && $type != 0) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("SellingPrice"), $_SERVER["PHP_SELF"], "p.price",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print '<td class="liste_titre" align="right">'.$langs->trans("BuyingPriceMinShort").'</td>';
|
||||
if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1) print '<td class="liste_titre" align="right">'.$langs->trans("PhysicalStock").'</td>';
|
||||
print_liste_field_titre($langs->trans("Sell"), $_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Buy"), $_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="sref" size="8" value="'.$sref.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="snom" size="12" value="'.$snom.'">';
|
||||
print '</td>';
|
||||
if ($conf->barcode->enabled)
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="sbarcode" size="6" value="'.$sbarcode.'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Lignes des champs de filtre
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="sref" size="8" value="'.$sref.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="snom" size="12" value="'.$snom.'">';
|
||||
print '</td>';
|
||||
if ($conf->barcode->enabled)
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="sbarcode" size="6" value="'.$sbarcode.'">';
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="liste_titre">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Duration
|
||||
if ($conf->service->enabled && $type != 0)
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Sell price
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Duration
|
||||
if ($conf->service->enabled && $type != 0)
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print ' ';
|
||||
// Minimum buying Price
|
||||
print '<td class="liste_titre">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Stock
|
||||
if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1)
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$product_static=new Product($db);
|
||||
$product_fourn =new ProductFournisseur($db);
|
||||
|
||||
$var=true;
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
// Multilangs
|
||||
if ($conf->global->MAIN_MULTILANGS) // si l'option est active
|
||||
{
|
||||
$sql = "SELECT label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
|
||||
$sql.= " WHERE fk_product=".$objp->rowid;
|
||||
$sql.= " AND lang='". $langs->getDefaultLang() ."'";
|
||||
$sql.= " LIMIT 1";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$objtp = $db->fetch_object($result);
|
||||
if ($objtp->label != '') $objp->label = $objtp->label;
|
||||
}
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
// Ref
|
||||
print '<td nowrap="nowrap">';
|
||||
$product_static->id = $objp->rowid;
|
||||
$product_static->ref = $objp->ref;
|
||||
$product_static->type = $objp->fk_product_type;
|
||||
print $product_static->getNomUrl(1,'',24);
|
||||
print "</td>\n";
|
||||
|
||||
// Label
|
||||
print '<td>'.dol_trunc($objp->label,40).'</td>';
|
||||
|
||||
// Barcode
|
||||
if ($conf->barcode->enabled)
|
||||
{
|
||||
print '<td align="right">'.$objp->barcode.'</td>';
|
||||
}
|
||||
|
||||
// Date
|
||||
print '<td align="center">'.dol_print_date($db->jdate($objp->datem),'day')."</td>\n";
|
||||
|
||||
// Duration
|
||||
if ($conf->service->enabled && $type != 0)
|
||||
{
|
||||
print '<td align="center">';
|
||||
if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
|
||||
elseif (preg_match('/([0-9]+)m/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth");
|
||||
elseif (preg_match('/([0-9]+)w/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek");
|
||||
elseif (preg_match('/([0-9]+)d/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay");
|
||||
else print $objp->duration;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Sell price
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
print '<td align="right">';
|
||||
if ($objp->price_base_type == 'TTC') print price($objp->price_ttc).' '.$langs->trans("TTC");
|
||||
else print price($objp->price).' '.$langs->trans("HT");
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
// Sell price
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
// Better buy price
|
||||
print '<td align="right">';
|
||||
if ($objp->minsellprice != '')
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
//print price($objp->minsellprice).' '.$langs->trans("HT");
|
||||
if ($product_fourn->find_min_price_product_fournisseur($objp->rowid) > 0)
|
||||
{
|
||||
if ($product_fourn->product_fourn_price_id > 0)
|
||||
{
|
||||
$htmltext=$product_fourn->display_price_product_fournisseur();
|
||||
if ($conf->fournisseur->enabled && $user->rights->fournisseur->lire) print $html->textwithpicto(price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"),$htmltext);
|
||||
else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Minimum buying Price
|
||||
print '<td class="liste_titre">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Stock
|
||||
if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1)
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
// Show stock
|
||||
if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1)
|
||||
{
|
||||
if ($objp->fk_product_type != 1)
|
||||
{
|
||||
$product_static->id = $objp->rowid;
|
||||
$product_static->load_stock();
|
||||
print '<td align="right">';
|
||||
if ($product_static->stock_reel < $objp->seuil_stock_alerte) print img_warning($langs->trans("StockTooLow")).' ';
|
||||
print $product_static->stock_reel;
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
}
|
||||
|
||||
// Status (to buy)
|
||||
print '<td align="right" nowrap="nowrap">'.$product_static->LibStatut($objp->tosell,5,0).'</td>';
|
||||
|
||||
$product_static=new Product($db);
|
||||
$product_fourn =new ProductFournisseur($db);
|
||||
// Status (to sell)
|
||||
print '<td align="right" nowrap="nowrap">'.$product_static->LibStatut($objp->tobuy,5,1).'</td>';
|
||||
|
||||
$var=true;
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Multilangs
|
||||
if ($conf->global->MAIN_MULTILANGS) // si l'option est active
|
||||
{
|
||||
$sql = "SELECT label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
|
||||
$sql.= " WHERE fk_product=".$objp->rowid;
|
||||
$sql.= " AND lang='". $langs->getDefaultLang() ."'";
|
||||
$sql.= " LIMIT 1";
|
||||
if ($num > $conf->liste_limit)
|
||||
{
|
||||
if ($sref || $snom || $sall || $sbarcode || $_POST["search"])
|
||||
{
|
||||
print_barre_liste('', $page, "liste.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_barre_liste('', $page, "liste.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"")."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num);
|
||||
}
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$objtp = $db->fetch_object($result);
|
||||
if ($objtp->label != '') $objp->label = $objtp->label;
|
||||
}
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
// Ref
|
||||
print '<td nowrap="nowrap">';
|
||||
$product_static->id = $objp->rowid;
|
||||
$product_static->ref = $objp->ref;
|
||||
$product_static->type = $objp->fk_product_type;
|
||||
print $product_static->getNomUrl(1,'',24);
|
||||
print "</td>\n";
|
||||
|
||||
// Label
|
||||
print '<td>'.dol_trunc($objp->label,40).'</td>';
|
||||
|
||||
// Barcode
|
||||
if ($conf->barcode->enabled)
|
||||
{
|
||||
print '<td align="right">'.$objp->barcode.'</td>';
|
||||
}
|
||||
|
||||
// Date
|
||||
print '<td align="center">'.dol_print_date($db->jdate($objp->datem),'day')."</td>\n";
|
||||
|
||||
// Duration
|
||||
if ($conf->service->enabled && $type != 0)
|
||||
{
|
||||
print '<td align="center">';
|
||||
if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
|
||||
elseif (preg_match('/([0-9]+)m/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth");
|
||||
elseif (preg_match('/([0-9]+)w/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek");
|
||||
elseif (preg_match('/([0-9]+)d/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay");
|
||||
else print $objp->duration;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Sell price
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
print '<td align="right">';
|
||||
if ($objp->price_base_type == 'TTC') print price($objp->price_ttc).' '.$langs->trans("TTC");
|
||||
else print price($objp->price).' '.$langs->trans("HT");
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Better buy price
|
||||
print '<td align="right">';
|
||||
if ($objp->minsellprice != '')
|
||||
{
|
||||
//print price($objp->minsellprice).' '.$langs->trans("HT");
|
||||
if ($product_fourn->find_min_price_product_fournisseur($objp->rowid) > 0)
|
||||
{
|
||||
if ($product_fourn->product_fourn_price_id > 0)
|
||||
{
|
||||
$htmltext=$product_fourn->display_price_product_fournisseur();
|
||||
if ($conf->fournisseur->enabled && $user->rights->fournisseur->lire) print $html->textwithpicto(price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"),$htmltext);
|
||||
else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT");
|
||||
}
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Show stock
|
||||
if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1)
|
||||
{
|
||||
if ($objp->fk_product_type != 1)
|
||||
{
|
||||
$product_static->id = $objp->rowid;
|
||||
$product_static->load_stock();
|
||||
print '<td align="right">';
|
||||
if ($product_static->stock_reel < $objp->seuil_stock_alerte) print img_warning($langs->trans("StockTooLow")).' ';
|
||||
print $product_static->stock_reel;
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
}
|
||||
|
||||
// Status (to buy)
|
||||
print '<td align="right" nowrap="nowrap">'.$product_static->LibStatut($objp->tosell,5,0).'</td>';
|
||||
|
||||
// Status (to sell)
|
||||
print '<td align="right" nowrap="nowrap">'.$product_static->LibStatut($objp->tobuy,5,1).'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($num > $conf->liste_limit)
|
||||
{
|
||||
if ($sref || $snom || $sall || $sbarcode || $_POST["search"])
|
||||
{
|
||||
print_barre_liste('', $page, "liste.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_barre_liste('', $page, "liste.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"")."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num);
|
||||
}
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
print "</table>";
|
||||
print '</form>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
print "</table>";
|
||||
print '</form>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -45,12 +45,11 @@ abstract class ActionsCardCommon
|
||||
var $errors=array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $DB Handler acces base de donnees
|
||||
* @param string $targmetmodule Name of directory of module where canvas is stored
|
||||
* @param string $canvas Name of canvas
|
||||
* @param string $card Name of tab (sub-canvas)
|
||||
* Constructor
|
||||
* @param DB Handler acces base de donnees
|
||||
* @param targetmodule Name of directory of module where canvas is stored
|
||||
* @param canvas Name of canvas
|
||||
* @param card Name of tab (sub-canvas)
|
||||
*/
|
||||
function ActionsCardCommon($DB,$targetmodule,$canvas,$card)
|
||||
{
|
||||
|
||||
@ -36,11 +36,10 @@ class ActionsCardDefault extends ActionsCardCommon
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $DB Handler acces base de donnees
|
||||
* @param string $targmetmodule Name of directory of module where canvas is stored
|
||||
* @param string $canvas Name of canvas
|
||||
* @param string $card Name of tab (sub-canvas)
|
||||
* @param DB Handler acces base de donnees
|
||||
* @param targmetmodule Name of directory of module where canvas is stored
|
||||
* @param canvas Name of canvas
|
||||
* @param card Name of tab (sub-canvas)
|
||||
*/
|
||||
function ActionsCardDefault($DB,$targetmodule,$canvas,$card)
|
||||
{
|
||||
@ -67,6 +66,14 @@ class ActionsCardDefault extends ActionsCardCommon
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Assigne les valeurs POST dans l'objet
|
||||
*/
|
||||
function assign_post()
|
||||
{
|
||||
parent::assign_post();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute actions
|
||||
* @param Id of object (may be empty for creation)
|
||||
|
||||
@ -34,12 +34,11 @@ class ActionsCardIndividual extends ActionsCardCommon
|
||||
var $card;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $DB Handler acces base de donnees
|
||||
* @param string $targmetmodule Name of directory of module where canvas is stored
|
||||
* @param string $canvas Name of canvas
|
||||
* @param string $card Name of tab (sub-canvas)
|
||||
* Constructor
|
||||
* @param DB Handler acces base de donnees
|
||||
* @param targetmodule Name of directory of module where canvas is stored
|
||||
* @param canvas Name of canvas
|
||||
* @param card Name of tab (sub-canvas)
|
||||
*/
|
||||
function ActionsCardIndividual($DB,$targetmodule,$canvas,$card)
|
||||
{
|
||||
@ -67,6 +66,14 @@ class ActionsCardIndividual extends ActionsCardCommon
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Assigne les valeurs POST dans l'objet
|
||||
*/
|
||||
function assign_post()
|
||||
{
|
||||
parent::assign_post();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute actions
|
||||
* @param Id of object (may be empty for creation)
|
||||
|
||||
@ -1230,8 +1230,7 @@ class User extends CommonObject
|
||||
function setPassword($user, $password='', $changelater=0, $notrigger=0, $nosyncmember=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
require_once(DOL_DOCUMENT_ROOT ."/lib/security.lib.php");
|
||||
|
||||
|
||||
$error=0;
|
||||
|
||||
dol_syslog("User::setPassword user=".$user->id." password=".preg_replace('/./i','*',$password)." changelater=".$changelater." notrigger=".$notrigger." nosyncmember=".$nosyncmember, LOG_DEBUG);
|
||||
|
||||
@ -139,8 +139,6 @@ class ExportTest extends PHPUnit_Framework_TestCase
|
||||
$objexport->array_export_fields[0]=$array_export_fields;
|
||||
$objexport->array_export_alias[0]=$array_alias;
|
||||
|
||||
dol_mkdir($conf->export->dir_temp);
|
||||
|
||||
$model='csv';
|
||||
|
||||
// Build export file
|
||||
@ -165,29 +163,5 @@ class ExportTest extends PHPUnit_Framework_TestCase
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test export function
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testExportSociete()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
|
||||
$sql = "";
|
||||
$datatoexport='societe_1';
|
||||
$array_selected = array("s.rowid"=>1, "s.nom"=>2); // Mut be fields found into declaration of dataset
|
||||
$model='csv';
|
||||
|
||||
$objexport=new Export($db);
|
||||
$result=$objexport->load_arrays($user,$datatoexport);
|
||||
|
||||
// Build export file
|
||||
$result=$objexport->build_file($user, $model, $datatoexport, $array_selected, $sql);
|
||||
$expectedresult=1;
|
||||
$this->assertEquals($result,$expectedresult);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user