@@ -90,7 +97,7 @@
|
-
+
| textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"),1,0)?> |
textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0)?>
textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"),1,0)?> |
diff --git a/htdocs/don/admin/donation.php b/htdocs/don/admin/donation.php
index af00f2dbbcc..bd4683ec3c7 100644
--- a/htdocs/don/admin/donation.php
+++ b/htdocs/don/admin/donation.php
@@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$langs->load("admin");
$langs->load("donations");
+$langs->load("accountancy");
$langs->load('other');
if (!$user->admin) accessforbidden();
@@ -114,7 +115,25 @@ else if ($action == 'del')
}
}
-// Option
+// Options
+if ($action == 'set_DONATION_ACCOUNTINGACCOUNT')
+{
+ $account = GETPOST('DONATION_ACCOUNTINGACCOUNT'); // No alpha here, we want exact string
+
+ $res = dolibarr_set_const($db, "DONATION_ACCOUNTINGACCOUNT",$account,'chaine',0,'',$conf->entity);
+
+ if (! $res > 0) $error++;
+
+ if (! $error)
+ {
+ setEventMessage($langs->trans("SetupSaved"));
+ }
+ else
+ {
+ setEventMessage($langs->trans("Error"),'errors');
+ }
+}
+
if ($action == 'set_DONATION_MESSAGE')
{
$freemessage = GETPOST('DONATION_MESSAGE'); // No alpha here, we want exact string
@@ -191,24 +210,42 @@ dol_fiche_head($head, 'general', $langs->trans("Donations"), 0, 'payment');
*/
print_titre($langs->trans("Options"));
-print '';
diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php
index ce041351eed..5e36037738f 100644
--- a/htdocs/don/class/don.class.php
+++ b/htdocs/don/class/don.class.php
@@ -306,7 +306,7 @@ class Don extends CommonObject
* @return int <0 if KO, id of created donation if OK
* TODO add numbering module for Ref
*/
- function create($user)
+ function create($user, $notrigger)
{
global $conf, $langs;
@@ -426,6 +426,7 @@ class Don extends CommonObject
* Update a donation record
*
* @param User $user Objet utilisateur qui met a jour le don
+ * @param int $notrigger Disable triggers
* @return int >0 if OK, <0 if KO
*/
function update($user, $notrigger=0)
@@ -589,11 +590,11 @@ class Don extends CommonObject
/**
* Load donation from database
*
- * @param int $rowid Id of donation to load
+ * @param int $id Id of donation to load
* @param string $ref Ref of donation to load
* @return int <0 if KO, >0 if OK
*/
- function fetch($id,$ref='')
+ function fetch($id, $ref='')
{
global $conf;
@@ -676,7 +677,7 @@ class Don extends CommonObject
/**
* Validate a promise of donation
*
- * @param int $rowid id of donation
+ * @param int $id id of donation
* @param int $userid User who validate the promise
* @return int <0 if KO, >0 if OK
*/
@@ -707,7 +708,7 @@ class Don extends CommonObject
/**
* Classe le don comme paye, le don a ete recu
*
- * @param int $rowid id du don a modifier
+ * @param int $id id du don a modifier
* @param int $modepaiement mode de paiement
* @return int <0 if KO, >0 if OK
*/
@@ -742,7 +743,7 @@ class Don extends CommonObject
/**
* Set donation to status canceled
*
- * @param int $rowid id of donation
+ * @param int $id id of donation
* @return int <0 if KO, >0 if OK
*/
function set_cancel($id)
diff --git a/htdocs/don/payment/card.php b/htdocs/don/payment/card.php
index 4c59f566ba5..3abff69a624 100644
--- a/htdocs/don/payment/card.php
+++ b/htdocs/don/payment/card.php
@@ -33,7 +33,7 @@ $langs->load('banks');
$langs->load('companies');
// Security check
-$id=GETPOST("id");
+$id=GETPOST('rowid')?GETPOST('rowid','int'):GETPOST('id','int');
$action=GETPOST("action");
$confirm=GETPOST('confirm');
if ($user->societe_id) $socid=$user->societe_id;
@@ -129,7 +129,7 @@ $h++;
dol_fiche_head($head, $hselected, $langs->trans("DonationPayment"), 0, 'payment');
/*
- * Confirmation de la suppression du paiement
+ * Confirm deleting of the payment
*/
if ($action == 'delete')
{
@@ -138,7 +138,7 @@ if ($action == 'delete')
}
/*
- * Confirmation de la validation du paiement
+ * Confirm validation of the payment
*/
if ($action == 'valide')
{
@@ -192,7 +192,7 @@ print ' ';
/*
- * List of donations payed
+ * List of donations paid
*/
$disable_delete = 0;
@@ -262,7 +262,7 @@ print '';
/*
- * Boutons Actions
+ * Actions buttons
*/
print '';
diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php
index 973066971a3..d29dc513e5c 100644
--- a/htdocs/expedition/shipment.php
+++ b/htdocs/expedition/shipment.php
@@ -216,7 +216,7 @@ if ($id > 0 || ! empty($ref))
$absolute_creditnote=price2num($absolute_creditnote,'MT');
if ($absolute_discount)
{
- if ($commande->statut > 0)
+ if ($commande->statut > Commande::STATUS_DRAFT)
{
print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
}
@@ -606,7 +606,7 @@ if ($id > 0 || ! empty($ref))
print ' ';
// Bouton expedier sans gestion des stocks
- if (empty($conf->stock->enabled) && ($commande->statut > 0 && $commande->statut < 3))
+ if (empty($conf->stock->enabled) && ($commande->statut > Commande::STATUS_DRAFT && $commande->statut < Commande::STATUS_CLOSED))
{
if ($user->rights->expedition->creer)
{
@@ -626,7 +626,7 @@ if ($id > 0 || ! empty($ref))
// Bouton expedier avec gestion des stocks
- if (! empty($conf->stock->enabled) && ($commande->statut > 0 && $commande->statut < 3))
+ if (! empty($conf->stock->enabled) && ($commande->statut > Commande::STATUS_DRAFT && $commande->statut < Commande::STATUS_CLOSED))
{
if ($user->rights->expedition->creer)
{
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 21b008b1d0e..e7341e98fe7 100755
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -389,6 +389,7 @@ ExtrafieldSeparator=Separator
ExtrafieldCheckBox=Checkbox
ExtrafieldRadio=Radio button
ExtrafieldCheckBoxFromList= Checkbox from table
+ExtrafieldLink=Link to an object
ExtrafieldParamHelpselect=Parameters list have to be like key,value for example : 1,value1 2,value2 3,value3 ... In order to have the list depending on another : 1,value1|parent_list_code:parent_key 2,value2|parent_list_code:parent_key
ExtrafieldParamHelpcheckbox=Parameters list have to be like key,value for example : 1,value1 2,value2 3,value3 ...
ExtrafieldParamHelpradio=Parameters list have to be like key,value for example : 1,value1 2,value2 3,value3 ...
diff --git a/htdocs/langs/en_US/loan.lang b/htdocs/langs/en_US/loan.lang
index 4aba2de625c..e082f166959 100644
--- a/htdocs/langs/en_US/loan.lang
+++ b/htdocs/langs/en_US/loan.lang
@@ -4,6 +4,7 @@ Loans=Loans
NewLoan=New Loan
ShowLoan=Show Loan
PaymentLoan=Loan payment
+ShowLoanPayment=Show Loan Payment
Capital=Capital
Insurance=Insurance
Interest=Interest
diff --git a/htdocs/langs/en_US/suppliers.lang b/htdocs/langs/en_US/suppliers.lang
index 53b0618c7b1..441eba9d884 100644
--- a/htdocs/langs/en_US/suppliers.lang
+++ b/htdocs/langs/en_US/suppliers.lang
@@ -42,4 +42,5 @@ SentToSuppliers=Sent to suppliers
ListOfSupplierOrders=List of supplier orders
MenuOrdersSupplierToBill=Supplier orders to invoice
NbDaysToDelivery=Delivery delay in days
-DescNbDaysToDelivery=The biggest delay is display among order product list
\ No newline at end of file
+DescNbDaysToDelivery=The biggest delay is display among order product list
+UseDoubleApproval=Use double approval (the second approval will be any user of a defined user group)
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/donations.lang b/htdocs/langs/fr_FR/donations.lang
index 84081b64576..fab53285a7c 100644
--- a/htdocs/langs/fr_FR/donations.lang
+++ b/htdocs/langs/fr_FR/donations.lang
@@ -32,7 +32,7 @@ ThankYou=Merci
IConfirmDonationReception=Le bénéficiaire reconnait avoir reçu au titre des versements ouvrant droit à réduction d'impôt, la somme de
MinimumAmount=Don minimum de %s
FreeTextOnDonations=Mention complémentaire sur les dons
-FrenchOptions=Options propre à la france
+FrenchOptions=Options propres à la france
DONATION_ART200=Afficher article 200 du CGI si vous êtes concernés
DONATION_ART238=Afficher article 238 du CGI si vous êtes concernés
DONATION_ART885=Afficher article 885 du CGI si vous êtes concernés
diff --git a/htdocs/langs/fr_FR/trips.lang b/htdocs/langs/fr_FR/trips.lang
index 3a11b7c4036..2170c579547 100644
--- a/htdocs/langs/fr_FR/trips.lang
+++ b/htdocs/langs/fr_FR/trips.lang
@@ -22,7 +22,7 @@ SearchATripAndExpense=Rechercher une note de frais
ClassifyRefunded=Classer 'Remboursé'
ExpenseReportWaitingForApproval=Une nouvelle note de frais a été soumise pour approbation
ExpenseReportWaitingForApprovalMessage=A new expense report has been submitted and is waiting for approval.\n- User: %s\n- Period: %s\nClick here to validate: %s
-TripId=Id expense report
+TripId=Id note de frais
AnyOtherInThisListCanValidate=Person to inform for validation.
TripSociete=Information société
TripSalarie=Informations utilisateur
diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php
index 5c24621d802..51961e37e6e 100644
--- a/htdocs/loan/class/paymentloan.class.php
+++ b/htdocs/loan/class/paymentloan.class.php
@@ -391,7 +391,7 @@ class PaymentLoan extends CommonObject
* @param string $emetteur_banque Name of bank
* @return int <0 if KO, >0 if OK
*/
- function addPaymentToBank($user,$mode,$label,$accountid,$emetteur_nom,$emetteur_banque)
+ function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
{
global $conf;
@@ -448,7 +448,7 @@ class PaymentLoan extends CommonObject
//$linkaddedforthirdparty=array();
if ($mode == 'payment_loan')
{
- $result=$acc->add_url_line($bank_line_id, $this->id, DOL_URL_ROOT.'/loan/card.php?id=', $this->type_libelle.(($this->label && $this->label!=$this->type_libelle)?' ('.$this->label.')':''),'loan');
+ $result=$acc->add_url_line($bank_line_id, $this->id, DOL_URL_ROOT.'/loan/card.php?id=', ($this->label?$this->label:''),'loan');
if ($result <= 0) dol_print_error($this->db);
}
}
diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php
index ece4a5e0271..32e6ed57d2d 100644
--- a/htdocs/loan/payment/payment.php
+++ b/htdocs/loan/payment/payment.php
@@ -41,6 +41,9 @@ if ($user->societe_id > 0)
$socid = $user->societe_id;
}
+$loan = new Loan($db);
+$loan->fetch($chid);
+
/*
* Actions
*/
@@ -92,6 +95,7 @@ if ($action == 'add_payment')
$payment = new PaymentLoan($db);
$payment->chid = $chid;
$payment->datepaid = $datepaid;
+ $payment->label = $loan->label;
$payment->amount_capital = GETPOST('amount_capital');
$payment->amount_insurance = GETPOST('amount_insurance');
$payment->amount_interest = GETPOST('amount_interest');
@@ -150,10 +154,6 @@ $form=new Form($db);
// Form to create loan's payment
if ($_GET["action"] == 'create')
{
-
- $loan = new Loan($db);
- $loan->fetch($chid);
-
$total = $loan->capital;
print_fiche_titre($langs->trans("DoPayment"));
diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php
index d811f898c0b..2123f683c21 100644
--- a/htdocs/margin/tabs/productMargins.php
+++ b/htdocs/margin/tabs/productMargins.php
@@ -79,7 +79,7 @@ if ($id > 0 || ! empty($ref))
{
$head=product_prepare_head($object, $user);
$titre=$langs->trans("CardProduct".$object->type);
- $picto=($object->type==1?'service':'product');
+ $picto=($object->type== Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'margin', $titre, 0, $picto);
print ' ';
diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php
index 3537dc288a9..84140ee3f6a 100644
--- a/htdocs/product/canvas/product/actions_card_product.class.php
+++ b/htdocs/product/canvas/product/actions_card_product.class.php
@@ -143,7 +143,7 @@ class ActionsCardProduct
$this->tpl['showrefnav'] = $form->showrefnav($this->object,'ref','',1,'ref');
$titre=$langs->trans("CardProduct".$this->object->type);
- $picto=($this->object->type==1?'service':'product');
+ $picto=($this->object->type==Product::TYPE_SERVICE?'service':'product');
$this->tpl['showhead']=dol_get_fiche_head($head, 'card', $titre, 0, $picto);
$this->tpl['showend']=dol_get_fiche_end();
diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php
index cbb9e10750c..b36e7b317c6 100644
--- a/htdocs/product/canvas/service/actions_card_service.class.php
+++ b/htdocs/product/canvas/service/actions_card_service.class.php
@@ -142,7 +142,7 @@ class ActionsCardService
$this->tpl['showrefnav'] = $form->showrefnav($this->object,'ref','',1,'ref');
$titre=$langs->trans("CardProduct".$this->object->type);
- $picto=($this->object->type==1?'service':'product');
+ $picto=($this->object->type==Product::TYPE_SERVICE?'service':'product');
$this->tpl['showhead']=dol_get_fiche_head($head, 'card', $titre, 0, $picto);
$this->tpl['showend']=dol_get_fiche_end();
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index 0a74845a763..eecec0705f7 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -461,7 +461,7 @@ if (empty($reshook))
if ($action == 'confirm_delete' && $confirm != 'yes') { $action=''; }
if ($action == 'confirm_delete' && $confirm == 'yes')
{
- if (($object->type == 0 && $user->rights->produit->supprimer) || ($object->type == 1 && $user->rights->service->supprimer))
+ if (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->supprimer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->supprimer))
{
$result = $object->delete($object->id);
}
@@ -768,8 +768,8 @@ if (GETPOST("cancel") == $langs->trans("Cancel"))
*/
$helpurl='';
-if (GETPOST("type") == '0' || ($object->type == '0')) $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
-if (GETPOST("type") == '1' || ($object->type == '1')) $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
+if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
+if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
if (isset($_GET['type'])) $title = $langs->trans('CardProduct'.GETPOST('type'));
else $title = $langs->trans('ProductServiceCard');
@@ -1193,7 +1193,7 @@ else
}*/
// Nature
- if($object->type!=1)
+ if($object->type!= Product::TYPE_SERVICE)
{
print '| '.$langs->trans("Nature").' | ';
$statutarray=array('-1'=>' ', '1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
@@ -1308,7 +1308,7 @@ else
{
$head=product_prepare_head($object, $user);
$titre=$langs->trans("CardProduct".$object->type);
- $picto=($object->type==1?'service':'product');
+ $picto=($object->type== Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'card', $titre, 0, $picto);
$showphoto=$object->is_photo_available($conf->product->multidir_output[$object->entity]);
@@ -1331,7 +1331,7 @@ else
$nblignes=7;
if (! empty($conf->produit->enabled) && ! empty($conf->service->enabled)) $nblignes++;
if ($showbarcode) $nblignes+=2;
- if ($object->type!=1) $nblignes++;
+ if ($object->type!= Product::TYPE_SERVICE) $nblignes++;
if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) $nblignes+=2;
if ($object->isservice()) $nblignes++;
else $nblignes+=4;
@@ -1464,7 +1464,7 @@ else
print ' | ';
// Nature
- if($object->type!=1)
+ if($object->type!= Product::TYPE_SERVICE)
{
print '| '.$langs->trans("Nature").' | ';
print $object->getLibFinished();
@@ -1628,8 +1628,8 @@ if (empty($reshook))
}
$object_is_used = $object->isObjectUsed($object->id);
- if (($object->type == 0 && $user->rights->produit->supprimer)
- || ($object->type == 1 && $user->rights->service->supprimer))
+ if (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->supprimer)
+ || ($object->type == Product::TYPE_SERVICE && $user->rights->service->supprimer))
{
if (empty($object_is_used) && (! isset($object->no_button_delete) || $object->no_button_delete <> 1))
{
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index d08ed699b7f..8c811a57a1a 100755
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -61,8 +61,12 @@ class Product extends CommonObject
var $libelle; // TODO deprecated
var $label;
var $description;
- //! Type 0 for regular product, 1 for service (Advanced feature: 2 for assembly kit, 3 for stock kit)
- var $type;
+
+ /**
+ * Check TYPE constants
+ * @var int
+ */
+ var $type = self::TYPE_PRODUCT;
//! Selling price
var $price; // Price net
var $price_ttc; // Price with tax
@@ -171,6 +175,23 @@ class Product extends CommonObject
var $fk_price_expression;
+ /**
+ * Regular product
+ */
+ const TYPE_PRODUCT = 0;
+ /**
+ * Service
+ */
+ const TYPE_SERVICE = 1;
+ /**
+ * Advanced feature: assembly kit
+ */
+ const TYPE_ASSEMBLYKIT = 2;
+ /**
+ * Advanced feature: stock kit
+ */
+ const TYPE_STOCKKIT = 3;
+
/**
* Constructor
*
@@ -233,7 +254,6 @@ class Product extends CommonObject
// Clean parameters
$this->ref = dol_string_nospecial(trim($this->ref));
$this->libelle = trim($this->libelle);
- if (empty($this->type)) $this->type=0;
$this->price_ttc=price2num($this->price_ttc);
$this->price=price2num($this->price);
$this->price_min_ttc=price2num($this->price_min_ttc);
@@ -795,7 +815,7 @@ class Product extends CommonObject
$this->error = "Object must be fetched before calling delete";
return -1;
}
- if (($this->type == 0 && empty($user->rights->produit->supprimer)) || ($this->type == 1 && empty($user->rights->service->supprimer)))
+ if (($this->type == Product::TYPE_PRODUCT && empty($user->rights->produit->supprimer)) || ($this->type == Product::TYPE_SERVICE && empty($user->rights->service->supprimer)))
{
$this->error = "ErrorForbidden";
return 0;
@@ -2932,8 +2952,8 @@ class Product extends CommonObject
$result='';
$newref=$this->ref;
if ($maxlength) $newref=dol_trunc($newref,$maxlength,'middle');
- if ($this->type == 0) $label = '' . $langs->trans("ShowProduct") . '';
- if ($this->type == 1) $label = '' . $langs->trans("ShowService") . '';
+ if ($this->type == Product::TYPE_PRODUCT) $label = '' . $langs->trans("ShowProduct") . '';
+ if ($this->type == Product::TYPE_SERVICE) $label = '' . $langs->trans("ShowService") . '';
if (! empty($this->ref))
$label .= ' ' . $langs->trans('ProductRef') . ': ' . $this->ref;
if (! empty($this->label))
@@ -2968,8 +2988,8 @@ class Product extends CommonObject
}
if ($withpicto) {
- if ($this->type == 0) $result.=($link.img_object($langs->trans("ShowProduct").' '.$this->label, 'product', 'class="classfortooltip"').$linkend.' ');
- if ($this->type == 1) $result.=($link.img_object($langs->trans("ShowService").' '.$this->label, 'service', 'class="classfortooltip"').$linkend.' ');
+ if ($this->type == Product::TYPE_PRODUCT) $result.=($link.img_object($langs->trans("ShowProduct").' '.$this->label, 'product', 'class="classfortooltip"').$linkend.' ');
+ if ($this->type == Product::TYPE_SERVICE) $result.=($link.img_object($langs->trans("ShowService").' '.$this->label, 'service', 'class="classfortooltip"').$linkend.' ');
}
$result.=$link.$newref.$linkend;
return $result;
@@ -3666,7 +3686,7 @@ class Product extends CommonObject
*/
function isproduct()
{
- return ($this->type != 1 ? true : false);
+ return ($this->type != Product::TYPE_PRODUCT ? true : false);
}
/**
@@ -3676,7 +3696,7 @@ class Product extends CommonObject
*/
function isservice()
{
- return ($this->type == 1 ? true : false);
+ return ($this->type == Product::TYPE_SERVICE ? true : false);
}
/**
@@ -3733,7 +3753,6 @@ class Product extends CommonObject
$this->tosell=1;
$this->tobuy=1;
$this->tobatch=0;
- $this->type=0;
$this->note='This is a comment (private)';
$this->barcode=-1; // Create barcode automatically
diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php
index 53f79266c25..96f2a589429 100644
--- a/htdocs/product/composition/card.php
+++ b/htdocs/product/composition/card.php
@@ -176,7 +176,7 @@ llxHeader("","",$langs->trans("CardProduct".$object->type));
$head=product_prepare_head($object, $user);
$titre=$langs->trans("CardProduct".$object->type);
-$picto=($object->type==1?'service':'product');
+$picto=($object->type==Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'subproduct', $titre, 0, $picto);
@@ -207,7 +207,7 @@ if ($id > 0 || ! empty($ref))
print ' | ';
// Nature
- if($object->type!=1)
+ if($object->type!=Product::TYPE_SERVICE)
{
print '| '.$langs->trans("Nature").' | ';
print $object->getLibFinished();
@@ -474,7 +474,7 @@ if ($id > 0 || ! empty($ref))
// check if a product is not already a parent product of this one
$prod_arbo=new Product($db);
$prod_arbo->id=$objp->rowid;
- if ($prod_arbo->type==2 || $prod_arbo->type==3)
+ if ($prod_arbo->type==Product::TYPE_ASSEMBLYKIT || $prod_arbo->type== Product::TYPE_STOCKKIT)
{
$is_pere=0;
$prod_arbo->get_sousproduits_arbo();
diff --git a/htdocs/product/document.php b/htdocs/product/document.php
index e46dc0384b2..9a71eac4f55 100644
--- a/htdocs/product/document.php
+++ b/htdocs/product/document.php
@@ -102,7 +102,7 @@ if ($object->id)
{
$head=product_prepare_head($object, $user);
$titre=$langs->trans("CardProduct".$object->type);
- $picto=($object->type==1?'service':'product');
+ $picto=($object->type== Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'documents', $titre, 0, $picto);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
@@ -146,7 +146,7 @@ if ($object->id)
print '';
$modulepart = 'produit';
- $permission = (($object->type == 0 && $user->rights->produit->creer) || ($object->type == 1 && $user->rights->service->creer));
+ $permission = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer));
$param = '&id=' . $object->id;
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
}
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index b360829a341..c2196aba00b 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -259,7 +259,7 @@ if ($id || $ref)
$head=product_prepare_head($product, $user);
$titre=$langs->trans("CardProduct".$product->type);
- $picto=($product->type==1?'service':'product');
+ $picto=($product->type== Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'suppliers', $titre, 0, $picto);
diff --git a/htdocs/product/photos.php b/htdocs/product/photos.php
index 0ae65a7dec6..8a6e2ddbd6b 100644
--- a/htdocs/product/photos.php
+++ b/htdocs/product/photos.php
@@ -102,7 +102,7 @@ if ($object->id)
*/
$head=product_prepare_head($object, $user);
$titre=$langs->trans("CardProduct".$object->type);
- $picto=($object->type==1?'service':'product');
+ $picto=($object->type== Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'photos', $titre, 0, $picto);
/*
@@ -145,8 +145,8 @@ if ($object->id)
$permtoedit=0;
- if ($user->rights->produit->creer && $object->type == 0) $permtoedit=1;
- if ($user->rights->service->creer && $object->type == 1) $permtoedit=1;
+ if ($user->rights->produit->creer && $object->type == Product::TYPE_PRODUCT) $permtoedit=1;
+ if ($user->rights->service->creer && $object->type == Product::TYPE_SERVICE) $permtoedit=1;
if (empty($conf->global->MAIN_UPLOAD_DOC)) $permtoedit=0;
/* ************************************************************************** */
diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index f6cd6187e85..da61ccc45b8 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -347,7 +347,7 @@ llxHeader("", "", $langs->trans("CardProduct" . $object->type));
$head = product_prepare_head($object, $user);
$titre = $langs->trans("CardProduct" . $object->type);
-$picto = ($object->type == 1 ? 'service' : 'product');
+$picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
dol_fiche_head($head, 'price', $titre, 0, $picto);
print '';
diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php
index 9600e6c0a44..788068ea5ec 100644
--- a/htdocs/product/stats/card.php
+++ b/htdocs/product/stats/card.php
@@ -69,7 +69,7 @@ if (! empty($id) || ! empty($ref))
{
$head=product_prepare_head($object, $user);
$titre=$langs->trans("CardProduct".$object->type);
- $picto=($object->type==1?'service':'product');
+ $picto=($object->type==Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'stats', $titre, 0, $picto);
diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php
index 49a443938ab..a1e538f4559 100644
--- a/htdocs/product/stats/commande.php
+++ b/htdocs/product/stats/commande.php
@@ -91,7 +91,7 @@ if ($id > 0 || ! empty($ref))
{
$head=product_prepare_head($product, $user);
$titre=$langs->trans("CardProduct".$product->type);
- $picto=($product->type==1?'service':'product');
+ $picto=($product->type==Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'referers', $titre, 0, $picto);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook
diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php
index 8cbdea41495..1b324d99bbf 100644
--- a/htdocs/product/stats/commande_fournisseur.php
+++ b/htdocs/product/stats/commande_fournisseur.php
@@ -98,7 +98,7 @@ if ($id > 0 || ! empty($ref)) {
if ($result > 0) {
$head = product_prepare_head($product, $user);
$titre = $langs->trans("CardProduct" . $product->type);
- $picto = ($product->type == 1 ? 'service' : 'product');
+ $picto = ($product->type == Product::TYPE_SERVICE ? 'service' : 'product');
dol_fiche_head($head, 'referers', $titre, 0, $picto);
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook
diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php
index 189ead2eaa2..aa535f02575 100644
--- a/htdocs/product/stats/contrat.php
+++ b/htdocs/product/stats/contrat.php
@@ -81,7 +81,7 @@ if ($id > 0 || ! empty($ref))
{
$head=product_prepare_head($product,$user);
$titre=$langs->trans("CardProduct".$product->type);
- $picto=($product->type==1?'service':'product');
+ $picto=($product->type==Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'referers', $titre, 0, $picto);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook
diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php
index 2ae8164b0f9..c0fa1481269 100644
--- a/htdocs/product/stats/facture.php
+++ b/htdocs/product/stats/facture.php
@@ -92,7 +92,7 @@ if ($id > 0 || ! empty($ref))
{
$head=product_prepare_head($product, $user);
$titre=$langs->trans("CardProduct".$product->type);
- $picto=($product->type==1?'service':'product');
+ $picto=($product->type==Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'referers', $titre, 0, $picto);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook
diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php
index 2e8e84621ba..275a2ff8604 100644
--- a/htdocs/product/stats/facture_fournisseur.php
+++ b/htdocs/product/stats/facture_fournisseur.php
@@ -93,7 +93,7 @@ if ($id > 0 || ! empty($ref))
{
$head = product_prepare_head($product, $user);
$titre = $langs->trans("CardProduct" . $product->type);
- $picto = ($product->type == 1 ? 'service' : 'product');
+ $picto = ($product->type == Product::TYPE_SERVICE ? 'service' : 'product');
dol_fiche_head($head, 'referers', $titre, 0, $picto);
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook
diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php
index 10fd8247204..4eae4c238e1 100644
--- a/htdocs/product/stats/propal.php
+++ b/htdocs/product/stats/propal.php
@@ -91,7 +91,7 @@ if ($id > 0 || ! empty($ref))
{
$head = product_prepare_head($product, $user);
$titre = $langs->trans("CardProduct" . $product->type);
- $picto = ($product->type == 1 ? 'service' : 'product');
+ $picto = ($product->type == Product::TYPE_SERVICE ? 'service' : 'product');
dol_fiche_head($head, 'referers', $titre, 0, $picto);
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook
diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php
index 1994b4ad6c2..c41fe590d18 100644
--- a/htdocs/product/stock/class/mouvementstock.class.php
+++ b/htdocs/product/stock/class/mouvementstock.class.php
@@ -117,7 +117,7 @@ class MouvementStock extends CommonObject
// Define if we must make the stock change (If product type is a service or if stock is used also for services)
$movestock=0;
- if ($product->type != 1 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) $movestock=1;
+ if ($product->type != Product::TYPE_SERVICE || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) $movestock=1;
if ($movestock && $entrepot_id > 0) // Change stock for current product, change for subproduct is done after
{
diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php
index 044da6c9aa4..116fff88809 100644
--- a/htdocs/product/stock/product.php
+++ b/htdocs/product/stock/product.php
@@ -7,6 +7,7 @@
* Copyright (C) 2013 Cédric Salvador
* Copyright (C) 2013 Juanjo Menent
* Copyright (C) 2014-2015 Cédric Gross
+ * Copyright (C) 2015 Marcos García
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -385,7 +386,7 @@ if ($id > 0 || $ref)
{
$head=product_prepare_head($product, $user);
$titre=$langs->trans("CardProduct".$product->type);
- $picto=($product->type==1?'service':'product');
+ $picto=($product->type==Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'stock', $titre, 0, $picto);
dol_htmloutput_events();
diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php
index 34b38fe8919..480f739285d 100644
--- a/htdocs/product/traduction.php
+++ b/htdocs/product/traduction.php
@@ -170,7 +170,7 @@ $formadmin=new FormAdmin($db);
$head=product_prepare_head($product, $user);
$titre=$langs->trans("CardProduct".$product->type);
-$picto=($product->type==1?'service':'product');
+$picto=($product->type==Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'translation', $titre, 0, $picto);
print '';
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index c3d86f4fae3..2df9ba0776f 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -241,7 +241,6 @@ class Societe extends CommonObject
var $specimen;
-
/**
* 0=no customer, 1=customer, 2=prospect, 3=customer and prospect
* @var int
diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php
index 9c5bd24b463..3c1a122fa6f 100644
--- a/htdocs/webservices/server_invoice.php
+++ b/htdocs/webservices/server_invoice.php
@@ -522,7 +522,7 @@ function createInvoice($authentication,$invoice)
$newobject->date=dol_stringtotime($invoice['date'],'dayrfc');
$newobject->note_private=$invoice['note_private'];
$newobject->note_public=$invoice['note_public'];
- $newobject->statut=0; // We start with status draft
+ $newobject->statut= Facture::STATUS_DRAFT; // We start with status draft
$newobject->fk_project=$invoice['project_id'];
$newobject->date_creation=$now;
diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php
index f089a86aeb6..2f5955d8ec1 100644
--- a/htdocs/webservices/server_order.php
+++ b/htdocs/webservices/server_order.php
@@ -687,7 +687,7 @@ function createOrder($authentication,$order)
$newobject->date_lim_reglement=dol_stringtotime($order['date_due'],'dayrfc');
$newobject->note_private=$order['note_private'];
$newobject->note_public=$order['note_public'];
- $newobject->statut=0; // We start with status draft
+ $newobject->statut=Commande::STATUS_DRAFT; // We start with status draft
$newobject->billed=$order['billed'];
$newobject->fk_project=$order['project_id'];
$newobject->fk_delivery_address=$order['fk_delivery_address'];
| |