FIX adapt develop
This commit is contained in:
parent
8442b405b2
commit
96d0bb8f2e
@ -28,7 +28,7 @@ require '../main.inc.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("admin","workflow","propal","workflow","orders","supplier_proposals"));
|
$langs->loadLangs(array("admin","workflow","propal","workflow","orders","supplier_proposals","receptions"));
|
||||||
|
|
||||||
if (! $user->admin) accessforbidden();
|
if (! $user->admin) accessforbidden();
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ $workflowcodes=array(
|
|||||||
// Automatic classification supplier order
|
// Automatic classification supplier order
|
||||||
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER'=>array('family'=>'classify_supplier_order', 'position'=>62, 'enabled'=>'! empty($conf->fournisseur->enabled)', 'picto'=>'order','warning'=>''),
|
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER'=>array('family'=>'classify_supplier_order', 'position'=>62, 'enabled'=>'! empty($conf->fournisseur->enabled)', 'picto'=>'order','warning'=>''),
|
||||||
//Automatic classification reception
|
//Automatic classification reception
|
||||||
'WORKFLOW_BILL_ON_RECEPTION'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->reception->enabled) && ! empty($conf->fournisseur->enabled)', 'picto'=>'bill'),
|
'WORKFLOW_BILL_ON_RECEPTION'=>array('family'=>'classify_reception', 'position'=>30, 'enabled'=>'! empty($conf->reception->enabled) && ! empty($conf->fournisseur->enabled)', 'picto'=>'bill'),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (! empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow']))
|
if (! empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow']))
|
||||||
@ -140,6 +140,7 @@ foreach($workflowcodes as $key => $params)
|
|||||||
if ($reg[1] == 'order') print ' - '.$langs->trans('Order');
|
if ($reg[1] == 'order') print ' - '.$langs->trans('Order');
|
||||||
if ($reg[1] == 'supplier_proposal') print ' - '.$langs->trans('SupplierProposal');
|
if ($reg[1] == 'supplier_proposal') print ' - '.$langs->trans('SupplierProposal');
|
||||||
if ($reg[1] == 'supplier_order') print ' - '.$langs->trans('SupplierOrder');
|
if ($reg[1] == 'supplier_order') print ' - '.$langs->trans('SupplierOrder');
|
||||||
|
if ($reg[1] == 'reception') print ' - '.$langs->trans('Reception');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4225,6 +4225,7 @@ abstract class CommonObject
|
|||||||
}else {
|
}else {
|
||||||
$this->tpl['label'].= ($line->label ? ' '.$line->label : '');
|
$this->tpl['label'].= ($line->label ? ' '.$line->label : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dates
|
// Dates
|
||||||
if ($line->product_type == 1 && ($date_start || $date_end))
|
if ($line->product_type == 1 && ($date_start || $date_end))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -44,14 +44,14 @@ class modReception extends DolibarrModules
|
|||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->numero = 104160;
|
$this->numero = 104160;
|
||||||
|
|
||||||
$this->family = "crm";
|
$this->family = "srm";
|
||||||
$this->module_position = 40;
|
$this->module_position = 40;
|
||||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||||
$this->name = preg_replace('/^mod/i','',get_class($this));
|
$this->name = preg_replace('/^mod/i','',get_class($this));
|
||||||
$this->description = "Gestion des réceptions fournisseurs";
|
$this->description = "Gestion des réceptions fournisseurs";
|
||||||
|
|
||||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||||
$this->version = 'dolibarr';
|
$this->version = 'experimental';
|
||||||
|
|
||||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||||
$this->special = 0;
|
$this->special = 0;
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
|
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
|
||||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','9.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
|
if (! defined('DOL_VERSION')) define('DOL_VERSION','9.0.1'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
|
||||||
|
|
||||||
if (! defined('EURO')) define('EURO',chr(128));
|
if (! defined('EURO')) define('EURO',chr(128));
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
// Put here all includes required by your class file
|
// Put here all includes required by your class file
|
||||||
require_once DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php";
|
require_once DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php";
|
||||||
|
require_once DOL_DOCUMENT_ROOT."/reception/class/reception.class.php";
|
||||||
//require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
|
//require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
|
||||||
//require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php";
|
//require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php";
|
||||||
|
|
||||||
@ -185,7 +186,7 @@ class CommandeFournisseurDispatch extends CommonObject
|
|||||||
$sql.= " ".(! isset($this->status)?'NULL':"'".$this->db->escape($this->status)."'").",";
|
$sql.= " ".(! isset($this->status)?'NULL':"'".$this->db->escape($this->status)."'").",";
|
||||||
$sql.= " ".(! isset($this->batch)?'NULL':"'".$this->db->escape($this->batch)."'").",";
|
$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->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->sellby) || dol_strlen($this->sellby)==0?'NULL':"'".$this->db->idate($this->sellby)."'").",";
|
||||||
$sql.= " ".(! isset($this->fk_reception)?'NULL':"'".$this->fk_reception."'")."";
|
$sql.= " ".(! isset($this->fk_reception)?'NULL':"'".$this->fk_reception."'")."";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
@ -221,6 +222,7 @@ class CommandeFournisseurDispatch extends CommonObject
|
|||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||||
{
|
{
|
||||||
$result=$this->insertExtraFields();
|
$result=$this->insertExtraFields();
|
||||||
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
|
|||||||
@ -889,8 +889,8 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
}else if(!empty($conf->reception->enabled)){
|
}else if(!empty($conf->reception->enabled)){
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if(!empty($reception->id)){
|
if(!empty($reception->id)){
|
||||||
|
|
||||||
print $reception->getLibStatut(5);
|
print $reception->getLibStatut(5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
|
|||||||
@ -129,3 +129,89 @@ CREATE TABLE llx_takepos_floor_tables(
|
|||||||
|
|
||||||
|
|
||||||
UPDATE llx_c_payment_term SET decalage = nbjour, nbjour = 0 where decalage IS NULL AND type_cdr = 2;
|
UPDATE llx_c_payment_term SET decalage = nbjour, nbjour = 0 where decalage IS NULL AND type_cdr = 2;
|
||||||
|
|
||||||
|
-- Reception
|
||||||
|
|
||||||
|
ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN fk_reception integer DEFAULT NULL;
|
||||||
|
ALTER TABLE llx_commande_fournisseur_dispatch CHANGE comment comment TEXT;
|
||||||
|
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECEPTION_VALIDATE','Reception validated','Executed when a reception is validated','reception',22);
|
||||||
|
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECEPTION_SENTBYMAIL','Reception sent by mail','Executed when a reception is sent by mail','reception',22);
|
||||||
|
|
||||||
|
create table llx_commande_fournisseur_dispatch_extrafields
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
tms timestamp,
|
||||||
|
fk_object integer NOT NULL, -- object id
|
||||||
|
import_key varchar(14) -- import key
|
||||||
|
)ENGINE=innodb;
|
||||||
|
|
||||||
|
ALTER TABLE llx_commande_fournisseur_dispatch_extrafields ADD INDEX idx_commande_fournisseur_dispatch_extrafields (fk_object);
|
||||||
|
|
||||||
|
|
||||||
|
create table llx_reception
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
tms timestamp,
|
||||||
|
ref varchar(30) NOT NULL,
|
||||||
|
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||||
|
fk_soc integer NOT NULL,
|
||||||
|
fk_projet integer DEFAULT NULL,
|
||||||
|
|
||||||
|
ref_ext varchar(30), -- reference into an external system (not used by dolibarr)
|
||||||
|
ref_int varchar(30), -- reference into an internal system (used by dolibarr to store extern id like paypal info)
|
||||||
|
ref_supplier varchar(30), -- customer number
|
||||||
|
|
||||||
|
date_creation datetime, -- date de creation
|
||||||
|
fk_user_author integer, -- author of creation
|
||||||
|
fk_user_modif integer, -- author of last change
|
||||||
|
date_valid datetime, -- date de validation
|
||||||
|
fk_user_valid integer, -- valideur
|
||||||
|
date_delivery datetime DEFAULT NULL, -- date planned of delivery
|
||||||
|
date_reception datetime,
|
||||||
|
fk_shipping_method integer,
|
||||||
|
tracking_number varchar(50),
|
||||||
|
fk_statut smallint DEFAULT 0, -- 0 = draft, 1 = validated, 2 = billed or closed depending on WORKFLOW_BILL_ON_SHIPMENT option
|
||||||
|
billed smallint DEFAULT 0,
|
||||||
|
|
||||||
|
height float, -- height
|
||||||
|
width float, -- with
|
||||||
|
size_units integer, -- unit of all sizes (height, width, depth)
|
||||||
|
size float, -- depth
|
||||||
|
weight_units integer, -- unit of weight
|
||||||
|
weight float, -- weight
|
||||||
|
note_private text,
|
||||||
|
note_public text,
|
||||||
|
model_pdf varchar(255),
|
||||||
|
fk_incoterms integer, -- for incoterms
|
||||||
|
location_incoterms varchar(255), -- for incoterms
|
||||||
|
|
||||||
|
import_key varchar(14),
|
||||||
|
extraparams varchar(255) -- for other parameters with json format
|
||||||
|
)ENGINE=innodb;
|
||||||
|
|
||||||
|
ALTER TABLE llx_reception ADD UNIQUE INDEX idx_reception_uk_ref (ref, entity);
|
||||||
|
|
||||||
|
ALTER TABLE llx_reception ADD INDEX idx_reception_fk_soc (fk_soc);
|
||||||
|
ALTER TABLE llx_reception ADD INDEX idx_reception_fk_user_author (fk_user_author);
|
||||||
|
ALTER TABLE llx_reception ADD INDEX idx_reception_fk_user_valid (fk_user_valid);
|
||||||
|
ALTER TABLE llx_reception ADD INDEX idx_reception_fk_shipping_method (fk_shipping_method);
|
||||||
|
|
||||||
|
ALTER TABLE llx_reception ADD CONSTRAINT fk_reception_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
|
||||||
|
ALTER TABLE llx_reception ADD CONSTRAINT fk_reception_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
|
||||||
|
ALTER TABLE llx_reception ADD CONSTRAINT fk_reception_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid);
|
||||||
|
ALTER TABLE llx_reception ADD CONSTRAINT fk_reception_fk_shipping_method FOREIGN KEY (fk_shipping_method) REFERENCES llx_c_shipment_mode (rowid);
|
||||||
|
|
||||||
|
create table llx_reception_extrafields
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
tms timestamp,
|
||||||
|
fk_object integer NOT NULL,
|
||||||
|
import_key varchar(14) -- import key
|
||||||
|
) ENGINE=innodb;
|
||||||
|
|
||||||
|
ALTER TABLE llx_reception_extrafields ADD INDEX idx_reception_extrafields (fk_object);
|
||||||
|
|
||||||
|
ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX idx_commande_fournisseur_dispatch_fk_reception (fk_reception);
|
||||||
|
ALTER TABLE llx_commande_fournisseur_dispatch ADD CONSTRAINT fk_commande_fournisseur_dispatch_fk_reception FOREIGN KEY (fk_reception) REFERENCES llx_reception (rowid);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ ReceptionsAndReceivingForSameOrder=Réceptions et réceptions pour cette command
|
|||||||
ReceptionsToValidate=Réceptions à valider
|
ReceptionsToValidate=Réceptions à valider
|
||||||
StatusReceptionCanceled=Annulée
|
StatusReceptionCanceled=Annulée
|
||||||
StatusReceptionDraft=Brouillon
|
StatusReceptionDraft=Brouillon
|
||||||
StatusReceptionValidated=Validée (produits à envoyer ou envoyés)
|
StatusReceptionValidated=Validée
|
||||||
StatusReceptionProcessed=Traitée
|
StatusReceptionProcessed=Traitée
|
||||||
StatusReceptionDraftShort=Brouillon
|
StatusReceptionDraftShort=Brouillon
|
||||||
StatusReceptionValidatedShort=Validée
|
StatusReceptionValidatedShort=Validée
|
||||||
|
|||||||
@ -2248,7 +2248,7 @@ else if ($id || $ref)
|
|||||||
$formmail->withdeliveryreceipt=1;
|
$formmail->withdeliveryreceipt=1;
|
||||||
$formmail->withcancel=1;
|
$formmail->withcancel=1;
|
||||||
// Tableau des substitutions
|
// Tableau des substitutions
|
||||||
$formmail->setSubstitFromObject($object);
|
$formmail->setSubstitFromObject($object,$langs);
|
||||||
$formmail->substit['__RECEPTIONREF__']=$object->ref;
|
$formmail->substit['__RECEPTIONREF__']=$object->ref;
|
||||||
$formmail->substit['__RECEPTIONTRACKNUM__']=$object->tracking_number;
|
$formmail->substit['__RECEPTIONTRACKNUM__']=$object->tracking_number;
|
||||||
$formmail->substit['__RECEPTIONTRACKNUMURL__']=$object->tracking_url;
|
$formmail->substit['__RECEPTIONTRACKNUMURL__']=$object->tracking_url;
|
||||||
|
|||||||
@ -1025,7 +1025,7 @@ class Reception extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Load lines
|
* Load lines
|
||||||
*
|
*
|
||||||
@ -1033,6 +1033,7 @@ class Reception extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function fetch_lines()
|
function fetch_lines()
|
||||||
{
|
{
|
||||||
|
// phpcs:enable
|
||||||
global $db;
|
global $db;
|
||||||
dol_include_once('/fourn/class/fournisseur.commande.dispatch.class.php');
|
dol_include_once('/fourn/class/fournisseur.commande.dispatch.class.php');
|
||||||
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch WHERE fk_reception='.$this->id;
|
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch WHERE fk_reception='.$this->id;
|
||||||
@ -1056,9 +1057,8 @@ class Reception extends CommonObject
|
|||||||
$line->subprice = $obj->subprice;
|
$line->subprice = $obj->subprice;
|
||||||
$line->multicurrency_subprice = $obj->multicurrency_subprice;
|
$line->multicurrency_subprice = $obj->multicurrency_subprice;
|
||||||
$line->remise_percent = $obj->remise_percent;
|
$line->remise_percent = $obj->remise_percent;
|
||||||
$line->label = $obj->label;
|
$line->label = !empty($obj->label)?$obj->label:$line->product->label;
|
||||||
$line->ref_supplier = $obj->ref;
|
$line->ref_supplier = $obj->ref;
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
$line->qty_asked = 0;
|
$line->qty_asked = 0;
|
||||||
$line->description = '';
|
$line->description = '';
|
||||||
@ -1261,6 +1261,7 @@ class Reception extends CommonObject
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Set the planned delivery date
|
* Set the planned delivery date
|
||||||
*
|
*
|
||||||
@ -1270,6 +1271,7 @@ class Reception extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function set_date_livraison($user, $date_livraison)
|
function set_date_livraison($user, $date_livraison)
|
||||||
{
|
{
|
||||||
|
// phpcs:enable
|
||||||
if ($user->rights->reception->creer)
|
if ($user->rights->reception->creer)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."reception";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."reception";
|
||||||
@ -1294,7 +1296,7 @@ class Reception extends CommonObject
|
|||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Fetch deliveries method and return an array. Load array this->meths(rowid=>label).
|
* Fetch deliveries method and return an array. Load array this->meths(rowid=>label).
|
||||||
*
|
*
|
||||||
@ -1302,6 +1304,7 @@ class Reception extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function fetch_delivery_methods()
|
function fetch_delivery_methods()
|
||||||
{
|
{
|
||||||
|
// phpcs:enable
|
||||||
global $langs;
|
global $langs;
|
||||||
$this->meths = array();
|
$this->meths = array();
|
||||||
|
|
||||||
@ -1320,7 +1323,7 @@ class Reception extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Fetch all deliveries method and return an array. Load array this->listmeths.
|
* Fetch all deliveries method and return an array. Load array this->listmeths.
|
||||||
*
|
*
|
||||||
@ -1329,6 +1332,7 @@ class Reception extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function list_delivery_methods($id='')
|
function list_delivery_methods($id='')
|
||||||
{
|
{
|
||||||
|
// phpcs:enable
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$this->listmeths = array();
|
$this->listmeths = array();
|
||||||
@ -1355,6 +1359,7 @@ class Reception extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Update/create delivery method.
|
* Update/create delivery method.
|
||||||
*
|
*
|
||||||
@ -1364,6 +1369,7 @@ class Reception extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function update_delivery_method($id='')
|
function update_delivery_method($id='')
|
||||||
{
|
{
|
||||||
|
// phpcs:enable
|
||||||
if ($id=='')
|
if ($id=='')
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (code, libelle, description, tracking)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (code, libelle, description, tracking)";
|
||||||
@ -1383,6 +1389,7 @@ class Reception extends CommonObject
|
|||||||
if ($resql < 0) dol_print_error($this->db,'');
|
if ($resql < 0) dol_print_error($this->db,'');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Activate delivery method.
|
* Activate delivery method.
|
||||||
*
|
*
|
||||||
@ -1392,6 +1399,7 @@ class Reception extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function activ_delivery_method($id)
|
function activ_delivery_method($id)
|
||||||
{
|
{
|
||||||
|
// phpcs:enable
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=1';
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=1';
|
||||||
$sql.= ' WHERE rowid='.$id;
|
$sql.= ' WHERE rowid='.$id;
|
||||||
|
|
||||||
@ -1399,6 +1407,7 @@ class Reception extends CommonObject
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||||
/**
|
/**
|
||||||
* DesActivate delivery method.
|
* DesActivate delivery method.
|
||||||
*
|
*
|
||||||
@ -1408,6 +1417,7 @@ class Reception extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function disable_delivery_method($id)
|
function disable_delivery_method($id)
|
||||||
{
|
{
|
||||||
|
// phpcs:enable
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=0';
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=0';
|
||||||
$sql.= ' WHERE rowid='.$id;
|
$sql.= ' WHERE rowid='.$id;
|
||||||
|
|
||||||
@ -1598,7 +1608,7 @@ class Reception extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Classify the reception as invoiced (used when WORKFLOW_BILL_ON_RECEPTION is on)
|
* Classify the reception as invoiced (used when WORKFLOW_BILL_ON_RECEPTION is on)
|
||||||
*
|
*
|
||||||
@ -1606,6 +1616,7 @@ class Reception extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function set_billed()
|
function set_billed()
|
||||||
{
|
{
|
||||||
|
// phpcs:enable
|
||||||
global $user;
|
global $user;
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
@ -1768,6 +1779,7 @@ class Reception extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Set draft status
|
* Set draft status
|
||||||
*
|
*
|
||||||
@ -1776,6 +1788,7 @@ class Reception extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function set_draft($user)
|
function set_draft($user)
|
||||||
{
|
{
|
||||||
|
// phpcs:enable
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|||||||
@ -1,316 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
|
|
||||||
$sapi_type = php_sapi_name();
|
|
||||||
$script_file = basename(__FILE__);
|
|
||||||
$path = dirname(__FILE__).'/';
|
|
||||||
|
|
||||||
// Test if batch mode
|
|
||||||
if (substr($sapi_type, 0, 3) == 'cgi')
|
|
||||||
{
|
|
||||||
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
require_once($path."../../htdocs/master.inc.php");
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/ldap.class.php");
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php");
|
|
||||||
|
|
||||||
// Global variables
|
|
||||||
$version = DOL_VERSION;
|
|
||||||
$error = 0;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Main
|
|
||||||
*/
|
|
||||||
|
|
||||||
@set_time_limit(0);
|
|
||||||
|
|
||||||
// We always choose in mysql directory (Conversion is done by driver to translate SQL syntax)
|
|
||||||
$dir = DOL_DOCUMENT_ROOT."/install/mysql/tables/";
|
|
||||||
$sql='ALTER TABLE '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch ADD COLUMN fk_reception integer DEFAULT NULL;';
|
|
||||||
|
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
if(empty($resql)){
|
|
||||||
var_dump($db->error);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql=" insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECEPTION_VALIDATE','Reception validated','Executed when a reception is validated','reception',22);";
|
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
if(empty($resql)){
|
|
||||||
print '<pre>';
|
|
||||||
var_dump($db->error);
|
|
||||||
print '</pre>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql="insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECEPTION_SENTBYMAIL','Reception sent by mail','Executed when a reception is sent by mail','reception',22); ";
|
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
if(empty($resql)){
|
|
||||||
print '<pre>';
|
|
||||||
var_dump($db->error);
|
|
||||||
print '</pre>';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$sql=" ALTER TABLE ".MAIN_DB_PREFIX."commande_fournisseur_dispatch CHANGE comment comment TEXT;";
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
if(empty($resql)){
|
|
||||||
var_dump($db->error);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$ok = 0;
|
|
||||||
$handle = opendir($dir);
|
|
||||||
$tablefound = 0;
|
|
||||||
$tabledata = array();
|
|
||||||
if (is_resource($handle))
|
|
||||||
{
|
|
||||||
while (($file = readdir($handle)) !== false)
|
|
||||||
{
|
|
||||||
if (preg_match('/\.sql$/i', $file) && preg_match('/^llx_/i', $file) && !preg_match('/\.key\.sql$/i', $file))
|
|
||||||
{
|
|
||||||
if (strpos($file, 'reception') !== false || strpos($file, 'commande_fournisseur_dispatch') !== false){
|
|
||||||
$tablefound++;
|
|
||||||
$tabledata[] = $file;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
closedir($handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Sort list of sql files on alphabetical order (load order is important)
|
|
||||||
sort($tabledata);
|
|
||||||
foreach ($tabledata as $file)
|
|
||||||
{
|
|
||||||
$name = substr($file, 0, dol_strlen($file) - 4);
|
|
||||||
$buffer = '';
|
|
||||||
$fp = fopen($dir.$file, "r");
|
|
||||||
if ($fp)
|
|
||||||
{
|
|
||||||
while (!feof($fp))
|
|
||||||
{
|
|
||||||
$buf = fgets($fp, 4096);
|
|
||||||
if (substr($buf, 0, 2) <> '--')
|
|
||||||
{
|
|
||||||
$buf = preg_replace('/--(.+)*/', '', $buf);
|
|
||||||
$buffer .= $buf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose($fp);
|
|
||||||
|
|
||||||
$buffer = trim($buffer);
|
|
||||||
if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli') // For Mysql 5.5+, we must replace type=innodb with ENGINE=innodb
|
|
||||||
{
|
|
||||||
$buffer = preg_replace('/type=innodb/i', 'ENGINE=innodb', $buffer);
|
|
||||||
}
|
|
||||||
else if ($conf->db->type == 'mssql')
|
|
||||||
{
|
|
||||||
$buffer = preg_replace('/type=innodb/i', '', $buffer);
|
|
||||||
$buffer = preg_replace('/ENGINE=innodb/i', '', $buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Replace the prefix tables
|
|
||||||
if ($dolibarr_main_db_prefix != 'llx_')
|
|
||||||
{
|
|
||||||
$buffer = preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
//print "<tr><td>Creation de la table $name/td>";
|
|
||||||
$requestnb++;
|
|
||||||
|
|
||||||
$resql = $db->query($buffer, 0, 'dml');
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
// print "<td>OK requete ==== $buffer</td></tr>";
|
|
||||||
$db->free($resql);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($db->errno() == 'DB_ERROR_TABLE_ALREADY_EXISTS' ||
|
|
||||||
$db->errno() == 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS')
|
|
||||||
{
|
|
||||||
//print "<td>Deja existante</td></tr>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print "<tr><td>".$langs->trans("CreateTableAndPrimaryKey", $name);
|
|
||||||
print "<br>\n".$langs->trans("Request").' '.$requestnb.' : '.$buffer.' <br>Executed query : '.$db->lastquery;
|
|
||||||
print "\n</td>";
|
|
||||||
print '<td><font class="error">'.$langs->trans("ErrorSQL")." ".$db->errno()." ".$db->error().'</font></td></tr>';
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print "<tr><td>".$langs->trans("CreateTableAndPrimaryKey", $name);
|
|
||||||
print "</td>";
|
|
||||||
print '<td><font class="error">'.$langs->trans("Error").' Failed to open file '.$dir.$file.'</td></tr>';
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($tablefound)
|
|
||||||
{
|
|
||||||
if ($error == 0)
|
|
||||||
{
|
|
||||||
print '<tr><td>';
|
|
||||||
print $langs->trans("TablesAndPrimaryKeysCreation").'</td><td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
|
|
||||||
$ok = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans("ErrorFailedToFindSomeFiles", $dir).'</td><td><img src="../theme/eldy/img/error.png" alt="Error"></td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// We always choose in mysql directory (Conversion is done by driver to translate SQL syntax)
|
|
||||||
|
|
||||||
|
|
||||||
$okkeys = 0;
|
|
||||||
$handle = opendir($dir);
|
|
||||||
$tablefound = 0;
|
|
||||||
$tabledata = array();
|
|
||||||
if (is_resource($handle))
|
|
||||||
{
|
|
||||||
while (($file = readdir($handle)) !== false)
|
|
||||||
{
|
|
||||||
if (preg_match('/\.sql$/i', $file) && preg_match('/^llx_/i', $file) && preg_match('/\.key\.sql$/i', $file))
|
|
||||||
{
|
|
||||||
if (strpos($file, 'reception') !== false || strpos($file, 'commande_fournisseur_dispatch') !== false){
|
|
||||||
$tablefound++;
|
|
||||||
$tabledata[] = $file;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
closedir($handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sort list of sql files on alphabetical order (load order is important)
|
|
||||||
sort($tabledata);
|
|
||||||
foreach ($tabledata as $file)
|
|
||||||
{
|
|
||||||
$name = substr($file, 0, dol_strlen($file) - 4);
|
|
||||||
//print "<tr><td>Creation de la table $name</td>";
|
|
||||||
$buffer = '';
|
|
||||||
$fp = fopen($dir.$file, "r");
|
|
||||||
if ($fp)
|
|
||||||
{
|
|
||||||
while (!feof($fp))
|
|
||||||
{
|
|
||||||
$buf = fgets($fp, 4096);
|
|
||||||
|
|
||||||
// Cas special de lignes autorisees pour certaines versions uniquement
|
|
||||||
if ($choix == 1 && preg_match('/^--\sV([0-9\.]+)/i', $buf, $reg))
|
|
||||||
{
|
|
||||||
$versioncommande = explode('.', $reg[1]);
|
|
||||||
//print var_dump($versioncommande);
|
|
||||||
//print var_dump($versionarray);
|
|
||||||
if (count($versioncommande) && count($versionarray) && versioncompare($versioncommande, $versionarray) <= 0)
|
|
||||||
{
|
|
||||||
// Version qualified, delete SQL comments
|
|
||||||
$buf = preg_replace('/^--\sV([0-9\.]+)/i', '', $buf);
|
|
||||||
//print "Ligne $i qualifiee par version: ".$buf.'<br>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($choix == 2 && preg_match('/^--\sPOSTGRESQL\sV([0-9\.]+)/i', $buf, $reg))
|
|
||||||
{
|
|
||||||
$versioncommande = explode('.', $reg[1]);
|
|
||||||
//print var_dump($versioncommande);
|
|
||||||
//print var_dump($versionarray);
|
|
||||||
if (count($versioncommande) && count($versionarray) && versioncompare($versioncommande, $versionarray) <= 0)
|
|
||||||
{
|
|
||||||
// Version qualified, delete SQL comments
|
|
||||||
$buf = preg_replace('/^--\sPOSTGRESQL\sV([0-9\.]+)/i', '', $buf);
|
|
||||||
//print "Ligne $i qualifiee par version: ".$buf.'<br>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ajout ligne si non commentaire
|
|
||||||
if (!preg_match('/^--/i', $buf))
|
|
||||||
$buffer .= $buf;
|
|
||||||
}
|
|
||||||
fclose($fp);
|
|
||||||
|
|
||||||
// Si plusieurs requetes, on boucle sur chaque
|
|
||||||
$listesql = explode(';', $buffer);
|
|
||||||
foreach ($listesql as $req)
|
|
||||||
{
|
|
||||||
$buffer = trim($req);
|
|
||||||
if ($buffer)
|
|
||||||
{
|
|
||||||
// Replace the prefix tables
|
|
||||||
if ($dolibarr_main_db_prefix != 'llx_')
|
|
||||||
{
|
|
||||||
$buffer = preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
//print "<tr><td>Creation des cles et index de la table $name: '$buffer'</td>";
|
|
||||||
$requestnb++;
|
|
||||||
|
|
||||||
$resql = $db->query($buffer, 0, 'dml');
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
//print "<td>OK requete ==== $buffer</td></tr>";
|
|
||||||
$db->free($resql);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS' ||
|
|
||||||
$db->errno() == 'DB_ERROR_CANNOT_CREATE' ||
|
|
||||||
$db->errno() == 'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS' ||
|
|
||||||
$db->errno() == 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS' ||
|
|
||||||
preg_match('/duplicate key name/i', $db->error()))
|
|
||||||
{
|
|
||||||
//print "<td>Deja existante</td></tr>";
|
|
||||||
$key_exists = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print "<tr><td>".$langs->trans("CreateOtherKeysForTable", $name);
|
|
||||||
print "<br>\n".$langs->trans("Request").' '.$requestnb.' : '.$db->lastqueryerror();
|
|
||||||
print "\n</td>";
|
|
||||||
print '<td><font class="error">'.$langs->trans("ErrorSQL")." ".$db->errno()." ".$db->error().'</font></td></tr>';
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print "<tr><td>".$langs->trans("CreateOtherKeysForTable", $name);
|
|
||||||
print "</td>";
|
|
||||||
print '<td><font class="error">'.$langs->trans("Error")." Failed to open file ".$dir.$file."</font></td></tr>";
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($tablefound && $error == 0)
|
|
||||||
{
|
|
||||||
print '<tr><td>';
|
|
||||||
print $langs->trans("OtherKeysCreation").'</td><td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
|
|
||||||
$okkeys = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
|||||||
// For now, receptions must stay linked to order, so link is not deletable
|
// For now, receptions must stay linked to order, so link is not deletable
|
||||||
if($object->element != 'order_supplier') {
|
if($object->element != 'order_supplier') {
|
||||||
?>
|
?>
|
||||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
|
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user