Debug v20
This commit is contained in:
parent
37f6731d7e
commit
9e654e65dd
12 changed files with 165 additions and 84 deletions
|
|
@ -233,11 +233,16 @@ class DolibarrApi
|
|||
unset($object->sendtoid);
|
||||
unset($object->name_bis);
|
||||
unset($object->newref);
|
||||
unset($object->oldref);
|
||||
unset($object->alreadypaid);
|
||||
unset($object->openid);
|
||||
|
||||
//unset($object->labelStatus);
|
||||
//unset($object->labelStatusShort);
|
||||
unset($object->fk_bank);
|
||||
unset($object->showphoto_on_popup);
|
||||
unset($object->nb);
|
||||
unset($object->nbphoto);
|
||||
unset($object->output);
|
||||
unset($object->tpl);
|
||||
//unset($object->libelle);
|
||||
|
||||
unset($object->stats_propale);
|
||||
unset($object->stats_commande);
|
||||
|
|
@ -248,6 +253,8 @@ class DolibarrApi
|
|||
unset($object->stats_mrptoconsume);
|
||||
unset($object->stats_mrptoproduce);
|
||||
|
||||
unset($object->origin_object);
|
||||
unset($object->origin);
|
||||
unset($object->element);
|
||||
unset($object->element_for_permission);
|
||||
unset($object->fk_element);
|
||||
|
|
@ -255,6 +262,7 @@ class DolibarrApi
|
|||
unset($object->table_element_line);
|
||||
unset($object->class_element_line);
|
||||
unset($object->picto);
|
||||
unset($object->linked_objects);
|
||||
|
||||
unset($object->fieldsforcombobox);
|
||||
unset($object->regeximgext);
|
||||
|
|
@ -268,11 +276,17 @@ class DolibarrApi
|
|||
unset($object->country);
|
||||
unset($object->state);
|
||||
unset($object->state_code);
|
||||
unset($object->fk_departement);
|
||||
unset($object->departement);
|
||||
unset($object->departement_code);
|
||||
|
||||
unset($object->libelle_statut);
|
||||
unset($object->libelle_paiement);
|
||||
unset($object->labelStatus);
|
||||
unset($object->labelStatusShort);
|
||||
|
||||
unset($object->actionmsg);
|
||||
unset($object->actionmsg2);
|
||||
|
||||
unset($object->prefix_comm);
|
||||
|
||||
|
|
|
|||
|
|
@ -67,11 +67,6 @@ abstract class CommonObject
|
|||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @var int Another ID that is the $id but with an offset so that ID of the website start at 1
|
||||
*/
|
||||
public $newid;
|
||||
|
||||
/**
|
||||
* @var int The environment ID when using a multicompany module
|
||||
*/
|
||||
|
|
@ -279,7 +274,7 @@ abstract class CommonObject
|
|||
public $origin_id;
|
||||
|
||||
/**
|
||||
* @var ?CommonObject Origin object. This is set by fetch_origin() from this->origin and this->origin_id.
|
||||
* @var ?CommonObject Origin object. This is set by fetch_origin() from this->origin_type and this->origin_id.
|
||||
*/
|
||||
public $origin_object;
|
||||
|
||||
|
|
@ -806,7 +801,7 @@ abstract class CommonObject
|
|||
public $nbphoto;
|
||||
|
||||
/**
|
||||
* @var string output
|
||||
* @var string output content. Used topropagate information by cron jobs.
|
||||
*/
|
||||
public $output;
|
||||
|
||||
|
|
@ -2038,7 +2033,6 @@ abstract class CommonObject
|
|||
/**
|
||||
* Read linked origin object.
|
||||
* Set ->origin_object
|
||||
* Set also ->expedition or ->livraison or ->commandeFournisseur (deprecated)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -2047,6 +2041,7 @@ abstract class CommonObject
|
|||
// phpcs:enable
|
||||
$origin = $this->origin ? $this->origin : $this->origin_type;
|
||||
|
||||
// Manage classes with non standard name
|
||||
if ($origin == 'shipping') {
|
||||
$origin = 'expedition';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,6 +229,7 @@ class InterfaceStripe extends DolibarrTriggers
|
|||
$card = $stripe->cardStripe($customer, $object, $stripeacc, $servicestatus);
|
||||
if ($card) {
|
||||
// @phan-suppress-next-line PhanTypeMismatchPropertyProbablyReal
|
||||
// @phpstan-ignore-next-line
|
||||
$card->metadata = array('dol_id' => $object->id, 'dol_version' => DOL_VERSION, 'dol_entity' => $conf->entity, 'ipaddress' => (empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR']));
|
||||
try {
|
||||
// @phan-suppress-next-line PhanDeprecatedFunction
|
||||
|
|
|
|||
|
|
@ -101,8 +101,6 @@ class Shipments extends DolibarrApi
|
|||
*/
|
||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $properties = '')
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
if (!DolibarrApiAccess::$user->hasRight('expedition', 'lire')) {
|
||||
throw new RestException(403);
|
||||
}
|
||||
|
|
@ -178,7 +176,7 @@ class Shipments extends DolibarrApi
|
|||
* Create shipment object
|
||||
*
|
||||
* @param array $request_data Request data
|
||||
* @return int ID of shipment
|
||||
* @return int ID of shipment created
|
||||
*/
|
||||
public function post($request_data = null)
|
||||
{
|
||||
|
|
@ -202,17 +200,18 @@ class Shipments extends DolibarrApi
|
|||
foreach ($request_data["lines"] as $line) {
|
||||
$shipmentline = new ExpeditionLigne($this->db);
|
||||
|
||||
$shipmentline->entrepot_id = $line->entrepot_id;
|
||||
$shipmentline->fk_element = $line->origin_id; // example: order id. this->origin is 'commande'
|
||||
$shipmentline->origin_line_id = $line->origin_line_id; // example: order id
|
||||
$shipmentline->fk_elementdet = $line->origin_line_id; // example: order line id
|
||||
$shipmentline->element_type = $line->origin_type; // example 'commande' or 'order'
|
||||
$shipmentline->qty = $line->qty;
|
||||
$shipmentline->rang = $line->rang;
|
||||
$shipmentline->array_options = $line->array_options;
|
||||
$shipmentline->detail_batch = $line->detail_batch;
|
||||
$shipmentline->entrepot_id = $line['entrepot_id'];
|
||||
$shipmentline->fk_element = $line['fk_element'] ?? $line['origin_id']; // example: order id. this->origin is 'commande'
|
||||
$shipmentline->origin_line_id = $line['fk_elementdet'] ?? $line['origin_line_id']; // example: order id
|
||||
$shipmentline->fk_elementdet = $line['fk_elementdet'] ?? $line['origin_line_id']; // example: order line id
|
||||
$shipmentline->origin_type = $line['element_type'] ?? $line['origin_type']; // example 'commande' or 'order'
|
||||
$shipmentline->element_type = $line['element_type'] ?? $line['origin_type']; // example 'commande' or 'order'
|
||||
$shipmentline->qty = $line['qty'];
|
||||
$shipmentline->rang = $line['rang'];
|
||||
$shipmentline->array_options = $line['array_options'];
|
||||
$shipmentline->detail_batch = $line['detail_batch'];
|
||||
|
||||
$lines[] = $shipmentline;;
|
||||
$lines[] = $shipmentline;
|
||||
}
|
||||
$this->shipment->lines = $lines;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1593,7 +1593,7 @@ class Expedition extends CommonObject
|
|||
public function fetch_lines()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $mysoc;
|
||||
global $mysoc;
|
||||
|
||||
$this->lines = array();
|
||||
|
||||
|
|
@ -1604,7 +1604,7 @@ class Expedition extends CommonObject
|
|||
$sql .= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva";
|
||||
$sql .= ", cd.vat_src_code, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.info_bits, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht";
|
||||
$sql .= ", cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc, cd.rang";
|
||||
$sql .= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_elementdet, ed.element_type, ed.fk_entrepot";
|
||||
$sql .= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_element, ed.fk_elementdet, ed.element_type, ed.fk_entrepot";
|
||||
$sql .= ", p.ref as product_ref, p.label as product_label, p.fk_product_type, p.barcode as product_barcode";
|
||||
$sql .= ", p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tosell as product_tosell, p.tobuy as product_tobuy, p.tobatch as product_tobatch";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."commandedet as cd";
|
||||
|
|
@ -1655,13 +1655,16 @@ class Expedition extends CommonObject
|
|||
$detail_entrepot->line_id = $obj->line_id;
|
||||
$line->details_entrepot[] = $detail_entrepot;
|
||||
|
||||
$line->line_id = $obj->line_id;
|
||||
$line->line_id = $obj->line_id; // TODO deprecated
|
||||
$line->rowid = $obj->line_id; // TODO deprecated
|
||||
$line->id = $obj->line_id;
|
||||
|
||||
$line->fk_origin = 'orderline';
|
||||
$line->fk_origin = 'orderline'; // TODO deprecated, we already have element_type that can be use to guess type of line
|
||||
|
||||
$line->fk_element = $obj->fk_element;
|
||||
$line->origin_id = $obj->fk_element;
|
||||
$line->fk_elementdet = $obj->fk_elementdet;
|
||||
$line->origin_line_id = $obj->fk_elementdet; // TODO deprecated
|
||||
$line->origin_line_id = $obj->fk_elementdet;
|
||||
$line->element_type = $obj->element_type;
|
||||
|
||||
$line->fk_expedition = $this->id; // id of parent
|
||||
|
|
@ -2632,30 +2635,39 @@ class ExpeditionLigne extends CommonObjectLine
|
|||
public $line_id; // deprecated
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see $fk_elementdet
|
||||
* @var int ID Duplicate of origin_id (using origin_id is better)
|
||||
*/
|
||||
public $fk_element;
|
||||
|
||||
/**
|
||||
* @var int ID Duplicate of fk_element
|
||||
*/
|
||||
public $origin_id;
|
||||
|
||||
/**
|
||||
* @var int ID Duplicate of origin_line_id
|
||||
*/
|
||||
public $fk_elementdet;
|
||||
|
||||
/**
|
||||
* @var int ID Duplicate of fk_elementdet
|
||||
*/
|
||||
public $origin_line_id;
|
||||
|
||||
/**
|
||||
* @var string Type of object the fk_element refers to. Example: 'order'.
|
||||
*/
|
||||
public $element_type;
|
||||
|
||||
|
||||
/**
|
||||
* Code of object line that is origin of the shipment line.
|
||||
*
|
||||
* @var string
|
||||
* @deprecated Use instead origin_type = element_type to guess the line of origin of the shipment line.
|
||||
*/
|
||||
public $fk_origin; // Example: 'orderline'
|
||||
|
||||
/**
|
||||
* Type of source object
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $element_type; // Example: 'order'
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
public $fk_elementdet;
|
||||
|
||||
/**
|
||||
* @var int Id of shipment
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -59,8 +59,12 @@ class CommandeFournisseurDispatch extends ReceptionLineBatch
|
|||
*/
|
||||
public function create($user, $notrigger = 0)
|
||||
{
|
||||
$this->fk_element = $this->fk_commande;
|
||||
$this->fk_elementdet = $this->fk_commandefourndet;
|
||||
if (empty($this->fk_element) && !empty($this->fk_commande)) {
|
||||
$this->fk_element = $this->fk_commande;
|
||||
}
|
||||
if (empty($this->fk_elementdet) && !empty($this->fk_commandefourndet)) {
|
||||
$this->fk_elementdet = $this->fk_commandefourndet;
|
||||
}
|
||||
|
||||
return parent::create($user, $notrigger);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -286,6 +286,7 @@ ALTER TABLE llx_ticket ADD CONSTRAINT llx_ticket_fk_product_barcode_type FOREIGN
|
|||
|
||||
ALTER TABLE llx_socpeople ADD COLUMN fk_parent integer NULL;
|
||||
|
||||
ALTER TABLE llx_expeditiondet ADD COLUMN fk_product integer;
|
||||
ALTER TABLE llx_expeditiondet ADD COLUMN fk_element integer;
|
||||
ALTER TABLE llx_expeditiondet ADD COLUMN element_type varchar(50) DEFAULT 'order' NOT NULL;
|
||||
ALTER TABLE llx_expeditiondet CHANGE COLUMN fk_origin_line fk_elementdet integer;
|
||||
|
|
|
|||
|
|
@ -24,8 +24,9 @@ create table llx_expeditiondet
|
|||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_expedition integer NOT NULL, -- ID of parent object
|
||||
fk_element integer, -- ID of main source object
|
||||
fk_elementdet integer, -- ID of line of source object (proposal, sale order)
|
||||
fk_elementdet integer, -- ID of line of source object (proposal, sale order)
|
||||
element_type varchar(50) DEFAULT 'order' NOT NULL, -- Type of source object ('order', ...)
|
||||
fk_product integer, -- ID of product. If empy, you can retreive it using fk_element/element_type link
|
||||
qty real, -- Quantity
|
||||
fk_entrepot integer, -- Warehouse for departure of product
|
||||
rang integer DEFAULT 0
|
||||
|
|
|
|||
|
|
@ -16,9 +16,10 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Luracast\Restler\RestException;
|
||||
use Luracast\Restler\RestException;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/reception/class/receptionlinebatch.class.php';
|
||||
|
||||
/**
|
||||
* API class for receptions
|
||||
|
|
@ -175,7 +176,7 @@ class Receptions extends DolibarrApi
|
|||
* Create reception object
|
||||
*
|
||||
* @param array $request_data Request data
|
||||
* @return int ID of reception
|
||||
* @return int ID of reception created
|
||||
*/
|
||||
public function post($request_data = null)
|
||||
{
|
||||
|
|
@ -197,7 +198,25 @@ class Receptions extends DolibarrApi
|
|||
if (isset($request_data["lines"])) {
|
||||
$lines = array();
|
||||
foreach ($request_data["lines"] as $line) {
|
||||
array_push($lines, (object) $line);
|
||||
$receptionline = new ReceptionLineBatch($this->db);
|
||||
|
||||
$receptionline->fk_product = $line['fk_product'];
|
||||
$receptionline->fk_entrepot = $line['fk_entrepot'];
|
||||
$receptionline->fk_element = $line['fk_element'] ?? $line['origin_id']; // example: purchase order id. this->origin is 'supplier_order'
|
||||
$receptionline->origin_line_id = $line['fk_elementdet'] ?? $line['origin_line_id']; // example: purchase order id
|
||||
$receptionline->fk_elementdet = $line['fk_elementdet'] ?? $line['origin_line_id']; // example: purchase order line id
|
||||
$receptionline->origin_type = $line['element_type'] ?? $line['origin_type']; // example 'supplier_order'
|
||||
$receptionline->element_type = $line['element_type'] ?? $line['origin_type']; // example 'supplier_order'
|
||||
$receptionline->qty = $line['qty'];
|
||||
//$receptionline->rang = $line['rang'];
|
||||
$receptionline->array_options = $line['array_options'];
|
||||
$receptionline->batch = $line['batch'];
|
||||
$receptionline->eatby = $line['eatby'];
|
||||
$receptionline->sellby = $line['sellby'];
|
||||
$receptionline->cost_price = $line['cost_price'];
|
||||
$receptionline->status = $line['status'];
|
||||
|
||||
$lines[] = $receptionline;
|
||||
}
|
||||
$this->reception->lines = $lines;
|
||||
}
|
||||
|
|
@ -684,6 +703,8 @@ class Receptions extends DolibarrApi
|
|||
|
||||
if (!empty($object->lines) && is_array($object->lines)) {
|
||||
foreach ($object->lines as $line) {
|
||||
unset($line->canvas);
|
||||
|
||||
unset($line->tva_tx);
|
||||
unset($line->vat_src_code);
|
||||
unset($line->total_ht);
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ class Reception extends CommonObject
|
|||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."reception");
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."reception";
|
||||
$sql .= " SET ref = '(PROV".$this->id.")'";
|
||||
$sql .= " SET ref = '(PROV".((int) $this->id).")'";
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
|
|
@ -420,6 +420,7 @@ class Reception extends CommonObject
|
|||
$this->shipping_method_id = $obj->fk_shipping_method;
|
||||
$this->tracking_number = $obj->tracking_number;
|
||||
$this->origin = ($obj->origin ? $obj->origin : 'commande'); // For compatibility
|
||||
$this->origin_type = ($obj->origin ? $obj->origin : 'commande'); // For compatibility
|
||||
$this->origin_id = $obj->origin_id;
|
||||
|
||||
$this->trueWeight = $obj->weight;
|
||||
|
|
@ -1193,7 +1194,9 @@ class Reception extends CommonObject
|
|||
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php';
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."receptiondet_batch WHERE fk_reception = ".((int) $this->id);
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."receptiondet_batch";
|
||||
$sql .= " WHERE fk_reception = ".((int) $this->id);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if (!empty($resql)) {
|
||||
|
|
@ -1221,7 +1224,7 @@ class Reception extends CommonObject
|
|||
$line->subprice = $obj->subprice;
|
||||
$line->multicurrency_subprice = $obj->multicurrency_subprice;
|
||||
$line->remise_percent = $obj->remise_percent;
|
||||
$line->label = !empty($obj->label) ? $obj->label : $line->product->label;
|
||||
$line->label = !empty($obj->label) ? $obj->label : (is_object($line->product) ? $line->product->label : '');
|
||||
$line->ref_supplier = $obj->ref;
|
||||
$line->total_ht = $obj->total_ht;
|
||||
$line->total_ttc = $obj->total_ttc;
|
||||
|
|
@ -1246,6 +1249,7 @@ class Reception extends CommonObject
|
|||
$detail_batch->sellby = $line->sellby;
|
||||
$detail_batch->batch = $line->batch;
|
||||
$detail_batch->qty = $line->qty;
|
||||
|
||||
$line->detail_batch[] = $detail_batch;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,23 +66,40 @@ class ReceptionLineBatch extends CommonObjectLine
|
|||
public $id;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
* @var int ID of reception
|
||||
*/
|
||||
public $fk_reception;
|
||||
|
||||
/**
|
||||
* @var int ID Duplicate of origin_id (using origin_id is better)
|
||||
*/
|
||||
public $fk_element;
|
||||
|
||||
/**
|
||||
* @var int ID Duplicate of fk_element
|
||||
*/
|
||||
public $origin_id;
|
||||
|
||||
/**
|
||||
* @var int ID Duplicate of origin_line_id
|
||||
*/
|
||||
public $fk_elementdet;
|
||||
|
||||
/**
|
||||
* @var int ID Duplicate of fk_elementdet
|
||||
*/
|
||||
public $origin_line_id;
|
||||
|
||||
/**
|
||||
* @var string Type of object the fk_element refers to. Example: 'supplier_order'.
|
||||
*/
|
||||
public $element_type;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
public $fk_product;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
public $fk_elementdet;
|
||||
|
||||
public $fk_reception;
|
||||
|
||||
|
||||
public $qty;
|
||||
public $qty_asked;
|
||||
|
||||
|
|
@ -147,11 +164,9 @@ class ReceptionLineBatch extends CommonObjectLine
|
|||
*/
|
||||
public function create($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs, $hookmanager;
|
||||
$error = 0;
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->fk_element)) {
|
||||
$this->fk_element = (int) $this->fk_element;
|
||||
}
|
||||
|
|
@ -183,15 +198,22 @@ class ReceptionLineBatch extends CommonObjectLine
|
|||
$this->datec = dol_now();
|
||||
}
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
if (empty($this->fk_product)) {
|
||||
$this->error = 'Error, property ->fk_product must not be empty to create a line of reception';
|
||||
return -1;
|
||||
}
|
||||
if (empty($this->fk_reception)) {
|
||||
$this->error = 'Error, property ->fk_reception must not be empty to create a line of reception';
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."(";
|
||||
$sql .= "fk_element,";
|
||||
$sql .= "fk_product,";
|
||||
$sql .= "fk_element,";
|
||||
$sql .= "fk_elementdet,";
|
||||
$sql .= "element_type,";
|
||||
$sql .= "qty,";
|
||||
$sql .= "fk_entrepot,";
|
||||
$sql .= "fk_user,";
|
||||
|
|
@ -203,23 +225,22 @@ class ReceptionLineBatch extends CommonObjectLine
|
|||
$sql .= "sellby,";
|
||||
$sql .= "fk_reception,";
|
||||
$sql .= "cost_price";
|
||||
|
||||
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= " ".(!isset($this->fk_element) ? 'NULL' : "'".$this->db->escape($this->fk_element)."'").",";
|
||||
$sql .= " ".(!isset($this->fk_product) ? 'NULL' : "'".$this->db->escape($this->fk_product)."'").",";
|
||||
$sql .= " ".(!isset($this->fk_elementdet) ? 'NULL' : "'".$this->db->escape($this->fk_elementdet)."'").",";
|
||||
$sql .= " ".(!isset($this->qty) ? 'NULL' : "'".$this->db->escape($this->qty)."'").",";
|
||||
$sql .= " ".(!isset($this->fk_entrepot) ? 'NULL' : "'".$this->db->escape($this->fk_entrepot)."'").",";
|
||||
$sql .= " ".(!isset($this->fk_user) ? 'NULL' : "'".$this->db->escape($this->fk_user)."'").",";
|
||||
$sql .= " ".(!isset($this->fk_product) ? 'NULL' : (int) $this->fk_product).",";
|
||||
$sql .= " ".(!isset($this->fk_element) ? 'NULL' : (int) $this->fk_element).",";
|
||||
$sql .= " ".(!isset($this->fk_elementdet) ? 'NULL' : (int) $this->fk_elementdet).",";
|
||||
$sql .= " '".(!isset($this->element_type) ? "supplier_order" : $this->db->escape($this->element_type))."',";
|
||||
$sql .= " ".(!isset($this->qty) ? 'NULL' : (float) $this->qty).",";
|
||||
$sql .= " ".(!isset($this->fk_entrepot) ? 'NULL' : (int) $this->fk_entrepot).",";
|
||||
$sql .= " ".(!isset($this->fk_user) ? 'NULL' : (int) $this->fk_user).",";
|
||||
$sql .= " ".(!isset($this->datec) || dol_strlen($this->datec) == 0 ? 'NULL' : "'".$this->db->idate($this->datec)."'").",";
|
||||
$sql .= " ".(!isset($this->comment) ? 'NULL' : "'".$this->db->escape($this->comment)."'").",";
|
||||
$sql .= " ".(!isset($this->status) ? 'NULL' : "'".$this->db->escape($this->status)."'").",";
|
||||
$sql .= " ".(!isset($this->status) ? 'NULL' : (int) $this->status).",";
|
||||
$sql .= " ".(!isset($this->batch) ? 'NULL' : "'".$this->db->escape($this->batch)."'").",";
|
||||
$sql .= " ".(!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : "'".$this->db->idate($this->eatby)."'").",";
|
||||
$sql .= " ".(!isset($this->sellby) || dol_strlen($this->sellby) == 0 ? 'NULL' : "'".$this->db->idate($this->sellby)."'").",";
|
||||
$sql .= " ".(!isset($this->fk_reception) ? 'NULL' : "'".$this->db->escape($this->fk_reception)."'").",";
|
||||
$sql .= " ".(!isset($this->cost_price) ? '0' : "'".$this->db->escape($this->cost_price)."'");
|
||||
$sql .= " ".((int) $this->fk_reception).",";
|
||||
$sql .= " ".(!isset($this->cost_price) ? '0' : (float) $this->cost_price);
|
||||
$sql .= ")";
|
||||
|
||||
$this->db->begin();
|
||||
|
|
@ -276,13 +297,12 @@ class ReceptionLineBatch extends CommonObjectLine
|
|||
*/
|
||||
public function fetch($id, $ref = '')
|
||||
{
|
||||
global $langs;
|
||||
$sql = "SELECT";
|
||||
$sql .= " t.rowid,";
|
||||
|
||||
$sql .= " t.fk_element,";
|
||||
$sql .= " t.fk_product,";
|
||||
$sql .= " t.fk_elementdet,";
|
||||
$sql .= " t.element_type,";
|
||||
$sql .= " t.fk_product,";
|
||||
$sql .= " t.qty,";
|
||||
$sql .= " t.fk_entrepot,";
|
||||
$sql .= " t.fk_user,";
|
||||
|
|
@ -294,8 +314,6 @@ class ReceptionLineBatch extends CommonObjectLine
|
|||
$sql .= " t.eatby,";
|
||||
$sql .= " t.sellby,";
|
||||
$sql .= " t.fk_reception";
|
||||
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
|
||||
if ($ref) {
|
||||
$sql .= " WHERE t.ref = '".$this->db->escape($ref)."'";
|
||||
|
|
@ -312,8 +330,13 @@ class ReceptionLineBatch extends CommonObjectLine
|
|||
$this->id = $obj->rowid;
|
||||
|
||||
$this->fk_element = $obj->fk_element;
|
||||
$this->fk_product = $obj->fk_product;
|
||||
$this->origin_id = $obj->fk_element;
|
||||
$this->fk_elementdet = $obj->fk_elementdet;
|
||||
$this->origin_line_id = $obj->fk_elementdet;
|
||||
$this->element_type = $obj->element_type;
|
||||
$this->origin_type = $obj->element_type;
|
||||
|
||||
$this->fk_product = $obj->fk_product;
|
||||
$this->qty = $obj->qty;
|
||||
$this->fk_entrepot = $obj->fk_entrepot;
|
||||
$this->fk_user = $obj->fk_user;
|
||||
|
|
|
|||
|
|
@ -133,6 +133,12 @@ class WebsitePage extends CommonObject
|
|||
*/
|
||||
public $fk_object;
|
||||
|
||||
/**
|
||||
* @var int Another ID that is the $id but with an offset so that ID of pages of the website start at 1
|
||||
*/
|
||||
public $newid;
|
||||
|
||||
|
||||
const STATUS_DRAFT = 0; // offline
|
||||
const STATUS_VALIDATED = 1; // online
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue