Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
4677ebd4aa
@ -354,7 +354,6 @@ if ($action == 'create')
|
||||
print "</form>";
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
llxFooter();
|
||||
?>
|
||||
|
||||
@ -660,6 +660,7 @@ class Propal extends CommonObject
|
||||
$sql.= ", date_livraison";
|
||||
$sql.= ", fk_availability";
|
||||
$sql.= ", fk_demand_reason";
|
||||
$sql.= ", fk_projet";
|
||||
$sql.= ", entity";
|
||||
$sql.= ") ";
|
||||
$sql.= " VALUES (";
|
||||
@ -684,6 +685,7 @@ class Propal extends CommonObject
|
||||
$sql.= ", ".($this->date_livraison!=''?"'".$this->db->idate($this->date_livraison)."'":"null");
|
||||
$sql.= ", ".$this->availability_id;
|
||||
$sql.= ", ".$this->demand_reason_id;
|
||||
$sql.= ", ".($this->fk_project?$this->fk_project:"null");
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
@ -757,17 +759,6 @@ class Propal extends CommonObject
|
||||
if (! $ret) dol_print_error($this->db);
|
||||
}
|
||||
|
||||
// Affectation au projet
|
||||
if (! $error && $this->fk_project)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
|
||||
$sql.= " SET fk_projet=".$this->fk_project;
|
||||
$sql.= " WHERE ref='".$this->ref."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
}
|
||||
|
||||
// Set delivery address
|
||||
if (! $error && $this->fk_delivery_address)
|
||||
{
|
||||
|
||||
@ -612,7 +612,6 @@ class Commande extends CommonObject
|
||||
dol_syslog("Commande::create ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
if (! $this->fk_project) $this->fk_project = 0;
|
||||
|
||||
// $date_commande is deprecated
|
||||
$date = ($this->date_commande ? $this->date_commande : $this->date);
|
||||
@ -626,7 +625,8 @@ class Commande extends CommonObject
|
||||
$sql.= ", remise_absolue, remise_percent";
|
||||
$sql.= ", entity";
|
||||
$sql.= ")";
|
||||
$sql.= " VALUES ('(PROV)',".$this->socid.", ".$this->db->idate(gmmktime()).", ".$user->id.", ".$this->fk_project;
|
||||
$sql.= " VALUES ('(PROV)',".$this->socid.", ".$this->db->idate(gmmktime()).", ".$user->id;
|
||||
$sql.= ", ".($this->fk_project?$this->fk_project:"null");
|
||||
$sql.= ", ".$this->db->idate($date);
|
||||
$sql.= ", ".($this->source>=0 && $this->source != '' ?$this->source:'null');
|
||||
$sql.= ", '".$this->db->escape($this->note)."'";
|
||||
|
||||
@ -62,6 +62,7 @@ if((isset($_GET['field']) && ! empty($_GET['field']))
|
||||
|
||||
if ($element == 'propal') $element = 'propale';
|
||||
else if ($element == 'fichinter') $element = 'ficheinter';
|
||||
else if ($element == 'product') $element = 'produit';
|
||||
else if ($element == 'order_supplier') {
|
||||
$element = 'fournisseur';
|
||||
$subelement = 'commande';
|
||||
|
||||
@ -69,6 +69,7 @@ if((isset($_POST['field']) && ! empty($_POST['field']))
|
||||
|
||||
if ($element == 'propal') $element = 'propale';
|
||||
else if ($element == 'fichinter') $element = 'ficheinter';
|
||||
else if ($element == 'product') $element = 'produit';
|
||||
else if ($element == 'order_supplier') {
|
||||
$element = 'fournisseur';
|
||||
$subelement = 'commande';
|
||||
|
||||
@ -80,8 +80,9 @@ class Form
|
||||
global $conf,$langs;
|
||||
|
||||
$ret='';
|
||||
|
||||
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE))
|
||||
|
||||
// TODO change for compatibility
|
||||
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && ! preg_match('/^select;/',$typeofdata))
|
||||
{
|
||||
if ($perm)
|
||||
{
|
||||
@ -128,7 +129,8 @@ class Form
|
||||
$ret='';
|
||||
|
||||
// When option to edit inline is activated
|
||||
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE))
|
||||
// TODO change for compatibility
|
||||
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && ! preg_match('/^select;/',$typeofdata))
|
||||
{
|
||||
$ret.=$this->editInPlace($object, $value, $htmlname, $perm, $typeofdata, $editvalue, $extObject, $success);
|
||||
}
|
||||
|
||||
@ -198,6 +198,7 @@ ALTER TABLE llx_expedition ADD CONSTRAINT fk_expedition_fk_expedition_methode F
|
||||
|
||||
-- VMYSQL4.1 UPDATE llx_chargesociales set tms = date_creation WHERE tms = '0000-00-00 00:00:00';
|
||||
|
||||
ALTER TABLE llx_propal MODIFY fk_projet integer DEFAULT NULL;
|
||||
ALTER TABLE llx_propal ADD COLUMN fk_account integer AFTER total;
|
||||
ALTER TABLE llx_propal ADD COLUMN fk_currency varchar(2) AFTER fk_account;
|
||||
ALTER TABLE llx_propal ADD INDEX idx_propal_fk_user_author (fk_user_author);
|
||||
@ -213,6 +214,7 @@ ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_projet FOREIGN KEY (fk_proje
|
||||
ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code);
|
||||
ALTER TABLE llx_propal DROP FOREIGN KEY fk_propal_fk_account;
|
||||
|
||||
ALTER TABLE llx_commande MODIFY fk_projet integer DEFAULT NULL;
|
||||
ALTER TABLE llx_commande ADD COLUMN fk_account integer AFTER facture;
|
||||
ALTER TABLE llx_commande ADD COLUMN fk_currency varchar(2) AFTER fk_account;
|
||||
ALTER TABLE llx_commande ADD INDEX idx_commande_fk_user_author (fk_user_author);
|
||||
@ -228,6 +230,7 @@ ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_fk_projet FOREIGN KEY (fk_p
|
||||
ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code);
|
||||
ALTER TABLE llx_commande DROP FOREIGN KEY fk_commande_fk_account;
|
||||
|
||||
ALTER TABLE llx_facture MODIFY fk_projet integer DEFAULT NULL;
|
||||
ALTER TABLE llx_facture ADD COLUMN fk_account integer AFTER fk_projet;
|
||||
ALTER TABLE llx_facture ADD COLUMN fk_currency varchar(2) AFTER fk_account;
|
||||
ALTER TABLE llx_facture ADD INDEX idx_facture_fk_account (fk_account);
|
||||
|
||||
@ -29,7 +29,7 @@ create table llx_commande
|
||||
ref_client varchar(255), -- reference for customer
|
||||
|
||||
fk_soc integer NOT NULL,
|
||||
fk_projet integer DEFAULT 0, -- projet auquel est rattache la commande
|
||||
fk_projet integer DEFAULT NULL, -- projet auquel est rattache la commande
|
||||
|
||||
tms timestamp,
|
||||
date_creation datetime, -- date de creation
|
||||
|
||||
@ -59,7 +59,7 @@ create table llx_facture
|
||||
fk_user_valid integer, -- valideur de la facture
|
||||
|
||||
fk_facture_source integer, -- facture origine si facture avoir
|
||||
fk_projet integer, -- projet auquel est associee la facture
|
||||
fk_projet integer DEFAULT NULL, -- projet auquel est associee la facture
|
||||
|
||||
fk_account integer, -- bank account
|
||||
fk_currency varchar(2), -- currency code
|
||||
|
||||
@ -30,7 +30,7 @@ create table llx_propal
|
||||
ref_client varchar(255), -- customer proposal number
|
||||
|
||||
fk_soc integer,
|
||||
fk_projet integer DEFAULT 0, -- projet auquel est rattache la propale
|
||||
fk_projet integer DEFAULT NULL, -- projet auquel est rattache la propale
|
||||
|
||||
tms timestamp,
|
||||
datec datetime, -- date de creation
|
||||
|
||||
@ -2813,85 +2813,6 @@ class Product extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update product/service type
|
||||
*
|
||||
* @param User $user Utilisateur qui fait la modification
|
||||
* @return void
|
||||
* TODO Replace this by a method update_field into common
|
||||
*/
|
||||
function update_type($user)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product";
|
||||
$sql.= " SET fk_product_type = '".$this->type."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update_type sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise a jour du code barre
|
||||
*
|
||||
* @param User $user Utilisateur qui fait la modification
|
||||
* @return void
|
||||
* TODO Replace this by a method update_field into common
|
||||
*/
|
||||
function update_barcode($user)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product";
|
||||
$sql.= " SET barcode = '".$this->barcode."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update_barcode sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise a jour du type de code barre
|
||||
*
|
||||
* @param User $user Utilisateur qui fait la modification
|
||||
* @return void
|
||||
* TODO Replace this by a method update_field into common
|
||||
*/
|
||||
function update_barcode_type($user)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product";
|
||||
$sql.= " SET fk_barcode_type = '".$this->barcode_type."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update_barcode_type sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return if object is a product
|
||||
*
|
||||
|
||||
@ -88,12 +88,10 @@ $error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Type
|
||||
if ($action == 'setproducttype' && $user->rights->produit->creer)
|
||||
if ($action == 'setfk_product_type' && $user->rights->produit->creer)
|
||||
{
|
||||
var_dump($action);
|
||||
$object->fetch($id);
|
||||
$object->type = $_POST['producttype'];
|
||||
$result = $object->update_type($user);
|
||||
$result = $object->setValueFrom('fk_product_type', $_POST['fk_product_type']);
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
||||
exit;
|
||||
}
|
||||
@ -102,8 +100,7 @@ if (empty($reshook))
|
||||
if ($action == 'setbarcodetype' && $user->rights->barcode->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->barcode_type = $_POST['barcodetype_id'];
|
||||
$result = $object->update_barcode_type($user);
|
||||
$result = $object->setValueFrom('fk_barcode_type', $_POST['barcodetype_id']);
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
||||
exit;
|
||||
}
|
||||
@ -112,18 +109,16 @@ if (empty($reshook))
|
||||
if ($action == 'setbarcode' && $user->rights->barcode->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->barcode = $_POST['barcode']; //Todo: ajout verification de la validite du code barre en fonction du type
|
||||
$result = $object->update_barcode($user);
|
||||
//Todo: ajout verification de la validite du code barre en fonction du type
|
||||
$result = $object->setValueFrom('barcode', $_POST['barcode']);
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action == 'setproductaccountancycodebuy')
|
||||
if ($action == 'setaccountancy_code_buy')
|
||||
{
|
||||
$product = new Product($db);
|
||||
$result=$product->fetch($id,$ref);
|
||||
$product->accountancy_code_buy=$_POST["productaccountancycodebuy"];
|
||||
$result=$product->update($product->id,$user,1,0,1);
|
||||
$object->fetch($id,$ref);
|
||||
$result = $object->setValueFrom('accountancy_code_buy', $_POST['productaccountancycodebuy']);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg=join(',',$product->errors);
|
||||
@ -131,12 +126,12 @@ if (empty($reshook))
|
||||
$action="";
|
||||
}
|
||||
|
||||
if ($action == 'setproductaccountancycodesell')
|
||||
if ($action == 'setaccountancy_code_buy')
|
||||
{
|
||||
$product = new Product($db);
|
||||
$result=$product->fetch($id,$ref);
|
||||
$object->fetch($id,$ref);
|
||||
$product->accountancy_code_sell=$_POST["productaccountancycodesell"];
|
||||
$result=$product->update($product->id,$user,1,0,1);
|
||||
$result = $object->setValueFrom('accountancy_code_sell', $_POST['productaccountancycodesell']);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg=join(',',$product->errors);
|
||||
@ -1092,9 +1087,10 @@ else
|
||||
// Type
|
||||
if ($conf->produit->enabled && $conf->service->enabled)
|
||||
{
|
||||
$typeformat='select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service");
|
||||
print '<tr><td>'.$form->editfieldkey("Type",'producttype',$object->type,$object,$user->rights->produit->creer|$user->rights->service->creer,$typeformat).'</td><td colspan="2">';
|
||||
print $form->editfieldval("Type",'producttype',$object->type,$object,$user->rights->produit->creer|$user->rights->service->creer,$typeformat);
|
||||
// TODO change for compatibility with edit in place
|
||||
$typeformat='select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service");
|
||||
print '<tr><td>'.$form->editfieldkey("Type",'fk_product_type',$object->type,$object,$user->rights->produit->creer||$user->rights->service->creer,$typeformat).'</td><td colspan="2">';
|
||||
print $form->editfieldval("Type",'fk_product_type',$object->type,$object,$user->rights->produit->creer||$user->rights->service->creer,$typeformat);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1145,13 +1141,13 @@ else
|
||||
}
|
||||
|
||||
// Accountancy sell code
|
||||
print '<tr><td>'.$form->editfieldkey("ProductAccountancySellCode",'productaccountancycodesell',$object->accountancy_code_sell,$object,$user->rights->produit->creer|$user->rights->service->creer).'</td><td colspan="2">';
|
||||
print $form->editfieldval("ProductAccountancySellCode",'productaccountancycodesell',$object->accountancy_code_sell,$object,$user->rights->produit->creer|$user->rights->service->creer);
|
||||
print '<tr><td>'.$form->editfieldkey("ProductAccountancySellCode",'accountancy_code_sell',$object->accountancy_code_sell,$object,$user->rights->produit->creer||$user->rights->service->creer).'</td><td colspan="2">';
|
||||
print $form->editfieldval("ProductAccountancySellCode",'accountancy_code_sell',$object->accountancy_code_sell,$object,$user->rights->produit->creer||$user->rights->service->creer);
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy buy code
|
||||
print '<tr><td>'.$form->editfieldkey("ProductAccountancyBuyCode",'productaccountancycodebuy',$object->accountancy_code_buy,$object,$user->rights->produit->creer|$user->rights->service->creer).'</td><td colspan="2">';
|
||||
print $form->editfieldval("ProductAccountancyBuyCode",'productaccountancycodebuy',$object->accountancy_code_buy,$object,$user->rights->produit->creer|$user->rights->service->creer);
|
||||
print '<tr><td>'.$form->editfieldkey("ProductAccountancyBuyCode",'accountancy_code_buy',$object->accountancy_code_buy,$object,$user->rights->produit->creer||$user->rights->service->creer).'</td><td colspan="2">';
|
||||
print $form->editfieldval("ProductAccountancyBuyCode",'accountancy_code_buy',$object->accountancy_code_buy,$object,$user->rights->produit->creer||$user->rights->service->creer);
|
||||
print '</td></tr>';
|
||||
|
||||
// Status (to sell)
|
||||
@ -1742,8 +1738,6 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status)
|
||||
}
|
||||
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
llxFooter();
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user