Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
8850f56c01
@ -116,30 +116,5 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
|
||||
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteAdherent"), $langs->trans("ConfirmDeleteAdherent"), "confirm_delete", '', 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'list') {
|
||||
$this->LoadListDatas($limit, $offset, $sortfield, $sortorder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Fetch datas list and save into ->list_datas
|
||||
*
|
||||
* @param int $limit Limit number of responses
|
||||
* @param int $offset Offset for first response
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order ('ASC' or 'DESC')
|
||||
* @return void
|
||||
*/
|
||||
public function LoadListDatas($limit, $offset, $sortfield, $sortorder)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
|
||||
//$this->getFieldList();
|
||||
|
||||
$this->list_datas = array();
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,13 +188,12 @@ class FactureRec extends CommonInvoice
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>105),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
||||
'modelpdf' =>array('type'=>'varchar(255)', 'label'=>'Modelpdf', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||
'date_last_gen' =>array('type'=>'varchar(7)', 'label'=>'Last gen', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
|
||||
'unit_frequency' =>array('type'=>'varchar(2)', 'label'=>'Unit frequency', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
|
||||
'date_when' =>array('type'=>'datetime', 'label'=>'Date when', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
|
||||
'date_last_gen' =>array('type'=>'datetime', 'label'=>'Date last gen', 'enabled'=>1, 'visible'=>-1, 'position'=>135),
|
||||
'nb_gen_done' =>array('type'=>'integer', 'label'=>'Nb gen done', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
|
||||
'nb_gen_max' =>array('type'=>'integer', 'label'=>'Nb gen max', 'enabled'=>1, 'visible'=>-1, 'position'=>145),
|
||||
'frequency' =>array('type'=>'integer', 'label'=>'Frequency', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
|
||||
'unit_frequency' =>array('type'=>'varchar(2)', 'label'=>'UnitFrequency', 'enabled'=>1, 'visible'=>-1, 'position'=>152),
|
||||
'usenewprice' =>array('type'=>'integer', 'label'=>'UseNewPrice', 'enabled'=>1, 'visible'=>0, 'position'=>155),
|
||||
'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'RevenueStamp', 'enabled'=>1, 'visible'=>-1, 'position'=>160, 'isameasure'=>1),
|
||||
'auto_validate' =>array('type'=>'integer', 'label'=>'Auto validate', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
|
||||
@ -115,30 +115,5 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
|
||||
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteContact"), $langs->trans("ConfirmDeleteContact"), "confirm_delete", '', 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'list') {
|
||||
$this->LoadListDatas($limit, $offset, $sortfield, $sortorder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Fetch datas list and save into ->list_datas
|
||||
*
|
||||
* @param int $limit Limit number of responses
|
||||
* @param int $offset Offset for first response
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order ('ASC' or 'DESC')
|
||||
* @return void
|
||||
*/
|
||||
public function LoadListDatas($limit, $offset, $sortfield, $sortorder)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
|
||||
//$this->getFieldList();
|
||||
|
||||
$this->list_datas = array();
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,6 +164,7 @@ class Canvas
|
||||
*/
|
||||
public function displayCanvasExists($action)
|
||||
{
|
||||
// template_dir should be '/'.$this->dirmodule.'/canvas/'.$this->canvas.'/tpl/', for example '/mymodule/canvas/product/tpl'
|
||||
if (empty($this->template_dir)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ class modWorkflow extends DolibarrModules
|
||||
8=>array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 0, 'current', 0),
|
||||
10=>array('WORKFLOW_TICKET_LINK_CONTRACT', 'chaine', '0', 'Automatically link a ticket to available contracts', 0, 'current', 0),
|
||||
11=>array('WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS', 'chaine', '0', 'Search among parent companies contracts when automatically linking a ticket to available contracts', 0, 'current', 0),
|
||||
11=>array('WORKFLOW_TICKET_CREATE_INTERVENTION', 'chaine', '1', 'WORKFLOW_TICKET_CREATE_INTERVENTION', 0, 'current', 0)
|
||||
12=>array('WORKFLOW_TICKET_CREATE_INTERVENTION', 'chaine', '0', 'WORKFLOW_TICKET_CREATE_INTERVENTION', 0, 'current', 0)
|
||||
);
|
||||
|
||||
// Boxes
|
||||
|
||||
@ -39,7 +39,6 @@ class ActionsCardProduct
|
||||
|
||||
// List of fiels for action=list
|
||||
public $field_list = array();
|
||||
public $list_datas = array();
|
||||
|
||||
|
||||
/**
|
||||
@ -88,8 +87,6 @@ class ActionsCardProduct
|
||||
}
|
||||
$this->object = $tmpobject;
|
||||
|
||||
//parent::assign_values($action);
|
||||
|
||||
foreach ($this->object as $key => $value) {
|
||||
$this->tpl[$key] = $value;
|
||||
}
|
||||
@ -227,10 +224,6 @@ class ActionsCardProduct
|
||||
|
||||
$this->tpl['fiche_end'] = dol_get_fiche_end();
|
||||
}
|
||||
|
||||
if ($action == 'list') {
|
||||
$this->LoadListDatas($limit, $offset, $sortfield, $sortorder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -281,136 +274,4 @@ class ActionsCardProduct
|
||||
dol_print_error($this->db, $sql);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Fetch datas list and save into ->list_datas
|
||||
*
|
||||
* @param int $limit Limit number of responses
|
||||
* @param int $offset Offset for first response
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order ('ASC' or 'DESC')
|
||||
* @return void
|
||||
*/
|
||||
public function LoadListDatas($limit, $offset, $sortfield, $sortorder)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
|
||||
$this->getFieldListCanvas();
|
||||
|
||||
$this->list_datas = array();
|
||||
|
||||
// Clean parameters
|
||||
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||
|
||||
foreach ($this->field_list as $field) {
|
||||
if ($field['enabled']) {
|
||||
$fieldname = "s".$field['alias'];
|
||||
$$fieldname = GETPOST($fieldname);
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'SELECT DISTINCT ';
|
||||
|
||||
// Fields requiered
|
||||
$sql .= 'p.rowid, p.price_base_type, p.fk_product_type, p.seuil_stock_alerte, p.entity';
|
||||
|
||||
// Fields not requiered
|
||||
foreach ($this->field_list as $field) {
|
||||
if ($field['enabled']) {
|
||||
$sql .= ", ".$field['name']." as ".$field['alias'];
|
||||
}
|
||||
}
|
||||
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$sql .= " WHERE p.entity IN (".getEntity('product').")";
|
||||
|
||||
if ($sall) {
|
||||
$clause = '';
|
||||
$sql .= " AND (";
|
||||
foreach ($this->field_list as $field) {
|
||||
if ($field['enabled']) {
|
||||
$sql .= $clause." ".$field['name']." LIKE '%".$this->db->escape($sall)."%'";
|
||||
if ($clause == '') {
|
||||
$clause = ' OR';
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql .= ")";
|
||||
}
|
||||
|
||||
// Search fields
|
||||
foreach ($this->field_list as $field) {
|
||||
if ($field['enabled']) {
|
||||
$fieldname = "s".$field['alias'];
|
||||
if (${$fieldname}) {
|
||||
$sql .= " AND ".$field['name']." LIKE '%".$this->db->escape(${$fieldname})."%'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOSTISSET("tosell")) {
|
||||
$sql .= " AND p.tosell = ".((int) GETPOST("tosell", "int"));
|
||||
}
|
||||
if (GETPOSTISSET("canvas")) {
|
||||
$sql .= " AND p.canvas = '".$this->db->escape(GETPOST("canvas"))."'";
|
||||
}
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
$sql .= $this->db->plimit($limit + 1, $offset);
|
||||
//print $sql;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
$i = 0;
|
||||
while ($i < min($num, $limit)) {
|
||||
$datas = array();
|
||||
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$datas["id"] = $obj->rowid;
|
||||
|
||||
foreach ($this->field_list as $field) {
|
||||
if ($field['enabled']) {
|
||||
$alias = $field['alias'];
|
||||
|
||||
if ($alias == 'ref') {
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->$alias;
|
||||
$this->type = $obj->fk_product_type;
|
||||
$this->entity = $obj->entity;
|
||||
$datas[$alias] = $this->getNomUrl(1, '', 24);
|
||||
} elseif ($alias == 'stock') {
|
||||
$this->load_stock();
|
||||
if ($this->stock_reel < $obj->seuil_stock_alerte) {
|
||||
$datas[$alias] = $this->stock_reel.' '.img_warning($langs->trans("StockTooLow"));
|
||||
} else {
|
||||
$datas[$alias] = $this->stock_reel;
|
||||
}
|
||||
} elseif ($alias == 'label') {
|
||||
$datas[$alias] = dol_trunc($obj->$alias, 40);
|
||||
} elseif (preg_match('/price/i', $alias)) {
|
||||
$datas[$alias] = price($obj->$alias);
|
||||
} elseif ($alias == 'datem') {
|
||||
$datas[$alias] = dol_print_date($this->db->jdate($obj->$alias), 'day');
|
||||
} elseif ($alias == 'status') {
|
||||
$datas[$alias] = $this->LibStatut($obj->$alias, 5);
|
||||
} else {
|
||||
$datas[$alias] = $obj->$alias;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
array_push($this->list_datas, $datas);
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +37,6 @@ class ActionsCardService
|
||||
|
||||
// List of fiels for action=list
|
||||
public $field_list = array();
|
||||
public $list_datas = array();
|
||||
|
||||
public $id;
|
||||
public $ref;
|
||||
@ -92,8 +91,6 @@ class ActionsCardService
|
||||
}
|
||||
$this->object = $tmpobject;
|
||||
|
||||
//parent::assign_values($action);
|
||||
|
||||
foreach ($this->object as $key => $value) {
|
||||
$this->tpl[$key] = $value;
|
||||
}
|
||||
@ -213,10 +210,6 @@ class ActionsCardService
|
||||
|
||||
$this->tpl['fiche_end'] = dol_get_fiche_end();
|
||||
}
|
||||
|
||||
if ($action == 'list') {
|
||||
$this->LoadListDatas($limit, $offset, $sortfield, $sortorder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -267,97 +260,4 @@ class ActionsCardService
|
||||
dol_print_error($this->db, $sql);
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Fetch datas list and save into ->list_datas
|
||||
*
|
||||
* @param int $limit Limit number of responses
|
||||
* @param int $offset Offset for first response
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order ('ASC' or 'DESC')
|
||||
* @return void
|
||||
*/
|
||||
public function LoadListDatas($limit, $offset, $sortfield, $sortorder)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
global $search_categ, $sall, $sref, $search_barcode, $snom, $catid;
|
||||
|
||||
$this->getFieldListCanvas();
|
||||
|
||||
$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';
|
||||
$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";
|
||||
}
|
||||
$fourn_id = 0;
|
||||
if (GETPOST("fourn_id", 'int') > 0) {
|
||||
$fourn_id = GETPOST("fourn_id", 'int');
|
||||
$sql .= ", ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
}
|
||||
$sql .= " WHERE p.entity IN (".getEntity('product').")";
|
||||
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 '%".$this->db->escape($sall)."%' OR p.label LIKE '%".$this->db->escape($sall)."%' OR p.description LIKE '%".$this->db->escape($sall)."%' OR p.note LIKE '%".$this->db->escape($sall)."%')";
|
||||
}
|
||||
if ($sref) {
|
||||
$sql .= " AND p.ref LIKE '%".$this->db->escape($sref)."%'";
|
||||
}
|
||||
if ($search_barcode) {
|
||||
$sql .= " AND p.barcode LIKE '%".$this->db->escape($search_barcode)."%'";
|
||||
}
|
||||
if ($snom) {
|
||||
$sql .= " AND p.label LIKE '%".$this->db->escape($snom)."%'";
|
||||
}
|
||||
if (GETPOSTISSET("tosell")) {
|
||||
$sql .= " AND p.tosell = ".((int) GETPOST("tosell", 'int'));
|
||||
}
|
||||
if (GETPOSTISSET("canvas")) {
|
||||
$sql .= " AND p.canvas = '".$this->db->escape(GETPOST("canvas"))."'";
|
||||
}
|
||||
if ($catid) {
|
||||
$sql .= " AND cp.fk_categorie = ".((int) $catid);
|
||||
}
|
||||
if ($fourn_id > 0) {
|
||||
$sql .= " AND p.rowid = pfp.fk_product AND pfp.fk_soc = ".((int) $fourn_id);
|
||||
}
|
||||
// Insert categ filter
|
||||
if ($search_categ) {
|
||||
$sql .= " AND cp.fk_categorie = ".((int) $search_categ);
|
||||
}
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
$sql .= $this->db->plimit($limit + 1, $offset);
|
||||
|
||||
$this->list_datas = array();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
$i = 0;
|
||||
while ($i < min($num, $limit)) {
|
||||
$datas = array();
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$datas["id"] = $obj->rowid;
|
||||
$datas["ref"] = $obj->ref;
|
||||
$datas["label"] = $obj->label;
|
||||
$datas["barcode"] = $obj->barcode;
|
||||
$datas["statut"] = $obj->statut;
|
||||
|
||||
array_push($this->list_datas, $datas);
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
} else {
|
||||
print $sql;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1250,7 +1250,6 @@ if (isModEnabled('barcode') && !empty($conf->global->BARCODE_PRODUCT_ADDON_NUM))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// -----------------------------------------
|
||||
// When used with CANVAS
|
||||
|
||||
@ -270,7 +270,7 @@ class Ticket extends CommonObject
|
||||
|
||||
// BEGIN MODULEBUILDER PROPERTIES
|
||||
public $fields = array(
|
||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'position'=>1, 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id"),
|
||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id"),
|
||||
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'notnull'=>1, 'index'=>1),
|
||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>'', 'showoncombobox'=>1),
|
||||
'track_id' => array('type'=>'varchar(255)', 'label'=>'TicketTrackId', 'visible'=>-2, 'enabled'=>1, 'position'=>11, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text"),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user