';
print '';
print $langs->trans('PaymentConditionsShort');
@@ -3184,21 +3185,24 @@ else if ($id > 0 || ! empty($ref))
print ' ';
// Multicurrency rate
- print '';
- print '';
- print '';
- print ' ';
- if ($action == 'editmulticurrencyrate') {
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
- } else {
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
- }
- print ' ';
+ //if ($object->multicurrency_code != $conf->currency)
+ //{
+ print '';
+ print '';
+ print '';
+ print ' ';
+ if ($action == 'editmulticurrencyrate') {
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
+ } else {
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
+ }
+ print ' ';
+ //}
}
// Bank Account
@@ -3307,9 +3311,29 @@ else if ($id > 0 || ! empty($ref))
print '';
+ if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
+ {
+ // Multicurrency Amount HT
+ print '' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ' ';
+ print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' ';
+ print ' ';
+
+ // Multicurrency Amount VAT
+ print '' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ' ';
+ print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' ';
+ print ' ';
+
+ // Multicurrency Amount TTC
+ print '' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ' ';
+ print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' ';
+ print ' ';
+ }
+
// Amount
- print '' . $langs->trans('AmountHT') . ' ';
+ print '' . $langs->trans('AmountHT') . ' ';
print '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . ' ';
+
+ // Vat
print '' . $langs->trans('AmountVAT') . ' ' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . ' ';
print '';
@@ -3355,24 +3379,6 @@ else if ($id > 0 || ! empty($ref))
// Total with tax
print '' . $langs->trans('AmountTTC') . ' ' . price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) . ' ';
- if (!empty($conf->multicurrency->enabled))
- {
- // Multicurrency Amount HT
- print '' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ' ';
- print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' ';
- print ' ';
-
- // Multicurrency Amount VAT
- print '' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ' ';
- print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' ';
- print ' ';
-
- // Multicurrency Amount TTC
- print '' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ' ';
- print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' ';
- print ' ';
- }
-
print '
';
// List of payments
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index fafb4ce51fe..bea5571730f 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -1058,7 +1058,8 @@ class Facture extends CommonInvoice
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
- $sql = 'SELECT f.rowid,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount,f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp';
+ $sql = 'SELECT f.rowid,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount';
+ $sql.= ', f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp';
$sql.= ', f.remise_percent, f.remise_absolue, f.remise';
$sql.= ', f.datef as df, f.date_pointoftax';
$sql.= ', f.date_lim_reglement as dlr';
@@ -1204,7 +1205,7 @@ class Facture extends CommonInvoice
{
$this->lines=array();
- $sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.tva_tx, ';
+ $sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx,';
$sql.= ' l.situation_percent, l.fk_prev_id,';
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,';
$sql.= ' l.rang, l.special_code,';
@@ -1243,6 +1244,8 @@ class Facture extends CommonInvoice
$line->fk_product_type = $objp->fk_product_type; // Type of product
$line->qty = $objp->qty;
$line->subprice = $objp->subprice;
+
+ $line->vat_src_code = $objp->vat_src_code;
$line->tva_tx = $objp->tva_tx;
$line->localtax1_tx = $objp->localtax1_tx;
$line->localtax2_tx = $objp->localtax2_tx;
@@ -2311,7 +2314,7 @@ class Facture extends CommonInvoice
* @param string $desc Description of line
* @param double $pu_ht Unit price without tax (> 0 even for credit note)
* @param double $qty Quantity
- * @param double $txtva Force vat rate, -1 for auto
+ * @param double $txtva Force Vat rate, -1 for auto
* @param double $txlocaltax1 Local tax 1 rate (deprecated)
* @param double $txlocaltax2 Local tax 2 rate (deprecated)
* @param int $fk_product Id of predefined product/service
@@ -2363,6 +2366,16 @@ class Facture extends CommonInvoice
if (empty($fk_prev_id)) $fk_prev_id = 'null';
if (! isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100;
+ $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
+
+ // Clean vat code
+ $vat_src_code='';
+ if (preg_match('/\((.*)\)/', $txtva, $reg))
+ {
+ $vat_src_code = $reg[1];
+ $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
+ }
+
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
@@ -2408,9 +2421,6 @@ class Facture extends CommonInvoice
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
- $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc);
- $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate.
-
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, $situation_percent, $this->multicurrency_tx);
$total_ht = $tabprice[0];
@@ -2445,6 +2455,7 @@ class Facture extends CommonInvoice
$this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
$this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
+ $this->line->vat_src_code=$vat_src_code;
$this->line->tva_tx=$txtva;
$this->line->localtax1_tx=$txlocaltax1;
$this->line->localtax2_tx=$txlocaltax2;
@@ -2659,11 +2670,14 @@ class Facture extends CommonInvoice
$this->line->label = $label;
$this->line->desc = $desc;
$this->line->qty = ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
+
+ $this->line->vat_src_code=$vat_src_code;
$this->line->tva_tx = $txtva;
$this->line->localtax1_tx = $txlocaltax1;
$this->line->localtax2_tx = $txlocaltax2;
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
+
$this->line->remise_percent = $remise_percent;
$this->line->subprice = ($this->type==2?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
$this->line->date_start = $date_start;
@@ -4315,7 +4329,7 @@ class FactureLigne extends CommonInvoiceLine
// Insertion dans base de la ligne
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facturedet';
$sql.= ' (fk_facture, fk_parent_line, label, description, qty,';
- $sql.= ' tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
+ $sql.= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
$sql.= ' fk_product, product_type, remise_percent, subprice, fk_remise_except,';
$sql.= ' date_start, date_end, fk_code_ventilation, ';
$sql.= ' rang, special_code, fk_product_fournisseur_price, buy_price_ht,';
@@ -4329,6 +4343,7 @@ class FactureLigne extends CommonInvoiceLine
$sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
$sql.= " '".$this->db->escape($this->desc)."',";
$sql.= " ".price2num($this->qty).",";
+ $sql.= " ".(empty($this->vat_src_code)?"''":"'".$this->vat_src_code."'").",";
$sql.= " ".price2num($this->tva_tx).",";
$sql.= " ".price2num($this->localtax1_tx).",";
$sql.= " ".price2num($this->localtax2_tx).",";
@@ -4514,6 +4529,7 @@ class FactureLigne extends CommonInvoiceLine
$sql.= ",remise_percent=".price2num($this->remise_percent)."";
if ($this->fk_remise_except) $sql.= ",fk_remise_except=".$this->fk_remise_except;
else $sql.= ",fk_remise_except=null";
+ $sql.= ",vat_src_code = '".(empty($this->vat_src_code)?'':$this->vat_src_code)."'";
$sql.= ",tva_tx=".price2num($this->tva_tx)."";
$sql.= ",localtax1_tx=".price2num($this->localtax1_tx)."";
$sql.= ",localtax2_tx=".price2num($this->localtax2_tx)."";
diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php
index ac03853a1b1..a1f50959aa4 100644
--- a/htdocs/compta/paiement.php
+++ b/htdocs/compta/paiement.php
@@ -461,24 +461,19 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '';
// Third party
- print ''.$langs->trans('Company').' '.$facture->thirdparty->getNomUrl(4)." \n";
+ print ''.$langs->trans('Company').' '.$facture->thirdparty->getNomUrl(4)." \n";
// Date payment
print ''.$langs->trans('Date').' ';
$datepayment = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$datepayment= ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'') : $datepayment);
$form->select_date($datepayment,'','','',0,"add_paiement",1,1,0,0,'','',$facture->date);
- print ' ';
- print ''.$langs->trans('Comments').' ';
-
- $rowspan=5;
+ print '';
// Payment mode
print ''.$langs->trans('PaymentMode').' ';
$form->select_types_paiements((GETPOST('paiementcode')?GETPOST('paiementcode'):$facture->mode_reglement_code),'paiementcode','',2);
print " \n";
- print '';
- print ' ';
print ' ';
// Bank account
@@ -493,7 +488,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
}
else
{
- print ' ';
+ print ' ';
}
print "\n";
@@ -515,6 +510,11 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '';
print ' ';
+ // Comments
+ print ''.$langs->trans('Comments').' ';
+ print '';
+ print ' ';
+
print '
';
dol_fiche_end();
@@ -633,7 +633,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print ''.dol_print_date($db->jdate($objp->df),'day')." \n";
// Currency
- print ''.$objp->multicurrency_code." \n";
+ if (!empty($conf->multicurrency->enabled)) print ''.$objp->multicurrency_code." \n";
// Multicurrency Price
if (!empty($conf->multicurrency->enabled))
diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php
index ebfd598ee0b..df02264badc 100644
--- a/htdocs/compta/paiement/cheque/list.php
+++ b/htdocs/compta/paiement/cheque/list.php
@@ -191,7 +191,7 @@ if ($resql)
// Bank
print '';
- if ($objp->bid) print ''.img_object($langs->trans("ShowAccount"),'account').' '.$objp->label.' ';
+ if ($objp->bid) print ''.img_object($langs->trans("ShowAccount"),'account').' '.$objp->label.' ';
else print ' ';
print ' ';
diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php
index 6f2d4a2128f..672da011a79 100644
--- a/htdocs/core/actions_linkedfiles.inc.php
+++ b/htdocs/core/actions_linkedfiles.inc.php
@@ -40,7 +40,7 @@ elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
$link = GETPOST('link', 'alpha');
if ($link)
{
- if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://') {
+ if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://' && substr($link, 0, 7) != 'file://') {
$link = 'http://' . $link;
}
dol_add_file_process($upload_dir, 0, 1, 'userfile', null, $link);
@@ -124,7 +124,7 @@ elseif ($action == 'confirm_updateline' && GETPOST('save') && GETPOST('link', 'a
if ($f)
{
$link->url = GETPOST('link', 'alpha');
- if (substr($link->url, 0, 7) != 'http://' && substr($link->url, 0, 8) != 'https://')
+ if (substr($link->url, 0, 7) != 'http://' && substr($link->url, 0, 8) != 'https://' && substr($link->url, 0, 7) != 'file://')
{
$link->url = 'http://' . $link->url;
}
diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php
index 297fe373c04..9ec3bfcb3b7 100644
--- a/htdocs/core/actions_sendmails.inc.php
+++ b/htdocs/core/actions_sendmails.inc.php
@@ -171,7 +171,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
// Recipient was provided from combo list
if ($_POST['receiver'] == 'thirdparty') // Id of third party
{
- $sendto = $thirdparty->email;
+ $sendto = $thirdparty->name.' <'.$thirdparty->email.'>';
$sendtoid = 0;
}
else // Id du contact
@@ -189,7 +189,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
// Recipient was provided from combo list
if ($_POST['receivercc'] == 'thirdparty') // Id of third party
{
- $sendtocc = $thirdparty->email;
+ $sendtocc = $thirdparty->name.' <'.$thirdparty->email.'>';
}
else // Id du contact
{
@@ -199,6 +199,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
if (dol_strlen($sendto))
{
+ require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
+
$langs->load("commercial");
$fromtype = GETPOST('fromtype');
@@ -235,11 +237,12 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
if ($action == 'send' || $action == 'relance')
{
if (dol_strlen($_POST['subject'])) $subject = $_POST['subject'];
- $actionmsg2=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto;
+ $actionmsg2=$langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from,4,0,1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto,4,0,1);
if ($message)
{
- $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto;
- if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
+ $actionmsg=$langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from);
+ $actionmsg=dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto));
+ if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . dol_escape_htmltag($sendtocc));
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
$actionmsg = dol_concatdesc($actionmsg, $message);
@@ -300,7 +303,6 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
}
// Send mail
- require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid);
if ($mailfile->error)
{
diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php
index 03f7e39bde8..317b84e0b29 100644
--- a/htdocs/core/class/CMailFile.class.php
+++ b/htdocs/core/class/CMailFile.class.php
@@ -690,7 +690,7 @@ class CMailFile
* @param string $stringtoencode String to encode
* @return string string encoded
*/
- function encodetorfc2822($stringtoencode)
+ static function encodetorfc2822($stringtoencode)
{
global $conf;
return '=?'.$conf->file->character_set_client.'?B?'.base64_encode($stringtoencode).'?=';
@@ -1220,15 +1220,17 @@ class CMailFile
/**
* Return a formatted address string for SMTP protocol
*
- * @param string $address Example: 'John Doe , Alan Smith ' or 'john@doe.com, alan@smith.com'
- * @param int $format 0=auto, 1=emails with <>, 2=emails without <>, 3=auto + label between "
- * @param int $encode 1=Encode name to RFC2822
- * @return string If format 0: '' or 'John Doe ' or '=?UTF-8?B?Sm9obiBEb2U=?= '
- * If format 1: ''
- * If format 2: 'john@doe.com'
- * If format 3: '' or '"John Doe" ' or '"=?UTF-8?B?Sm9obiBEb2U=?=" '
+ * @param string $address Example: 'John Doe , Alan Smith ' or 'john@doe.com, alan@smith.com'
+ * @param int $format 0=auto, 1=emails with <>, 2=emails without <>, 3=auto + label between "
+ * @param int $encode 0=No encode name, 1=Encode name to RFC2822
+ * @param int $maxnumberofemail 0=No limit. Otherwise, maximum number of emails returned ($address may contains several email separated with ','). Add '...' if there is more.
+ * @return string If format 0: '' or 'John Doe ' or '=?UTF-8?B?Sm9obiBEb2U=?= '
+ * If format 1: ''
+ * If format 2: 'john@doe.com'
+ * If format 3: '' or '"John Doe" ' or '"=?UTF-8?B?Sm9obiBEb2U=?=" '
+ * If format 4: 'John Doe' or 'john@doe.com' if no label exists
*/
- function getValidAddress($address,$format,$encode='')
+ static function getValidAddress($address,$format,$encode=0,$maxnumberofemail=0)
{
global $conf;
@@ -1237,6 +1239,7 @@ class CMailFile
$arrayaddress=explode(',',$address);
// Boucle sur chaque composant de l'adresse
+ $i=0;
foreach($arrayaddress as $val)
{
if (preg_match('/^(.*)<(.*)>$/i',trim($val),$regs))
@@ -1252,7 +1255,13 @@ class CMailFile
if ($email)
{
+ $i++;
+
$newemail='';
+ if ($format == 4)
+ {
+ $newemail = $name?$name:$email;
+ }
if ($format == 2)
{
$newemail=$email;
@@ -1265,10 +1274,17 @@ class CMailFile
{
if (! empty($conf->global->MAIN_MAIL_NO_FULL_EMAIL)) $newemail='<'.$email.'>';
elseif (! $name) $newemail='<'.$email.'>';
- else $newemail=($format==3?'"':'').($encode?$this->encodetorfc2822($name):$name).($format==3?'"':'').' <'.$email.'>';
+ else $newemail=($format==3?'"':'').($encode?self::encodetorfc2822($name):$name).($format==3?'"':'').' <'.$email.'>';
}
$ret=($ret ? $ret.',' : '').$newemail;
+
+ // Stop if we have too much records
+ if ($maxnumberofemail && $i >= $maxnumberofemail)
+ {
+ if (count($arrayaddress) > $maxnumberofemail) $ret.='...';
+ break;
+ }
}
}
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index a82a4c9e537..e2c6d67074a 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -522,7 +522,7 @@ abstract class CommonObject
}
if (! empty($this->url))
{
- $out.=dol_print_url($this->url,'',0,1);
+ $out.=dol_print_url($this->url,'_goout',0,1);
$outdone++;
}
if (! empty($conf->skype->enabled))
diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php
index b5371e6fa53..74078740080 100644
--- a/htdocs/core/lib/bank.lib.php
+++ b/htdocs/core/lib/bank.lib.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2006-2016 Laurent Destailleur
* Copyright (C) 2012 Regis Houssin
* Copyright (C) 2015 Alexandre Spangaro
* Copyright (C) 2016 Juanjo Menent
@@ -42,8 +42,8 @@ function bank_prepare_head(Account $object)
$head[$h][2] = 'bankname';
$h++;
- $head[$h][0] = DOL_URL_ROOT . "/compta/bank/account.php?id=" . $object->id;
- $head[$h][1] = $langs->trans("Transactions");
+ $head[$h][0] = DOL_URL_ROOT . "/compta/bank/bankentries.php?id=" . $object->id;
+ $head[$h][1] = $langs->trans("BankTransactions");
$head[$h][2] = 'journal';
$h++;
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 691ac3a8a3c..892c6c1fc2b 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -926,9 +926,10 @@ function dol_get_fiche_end($notab=0)
* @param int $nodbprefix Do not include DB prefix to forge table name
* @param string $morehtmlleft More html code to show before ref
* @param string $morehtmlright More html code to show before navigation arrows
+ * @param int $onlybanner Put this to 1, if the card will contains only a banner
* @return void
*/
-function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlright='')
+function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlright='', $onlybanner=0)
{
global $conf, $form, $user, $langs;
@@ -943,7 +944,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if ($object->element == 'user') $modulepart='userphoto';
if ($object->element == 'product') $modulepart='product';
- print '';
+ print '
';
if ($object->element == 'product')
{
$width=80; $cssclass='photoref';
diff --git a/htdocs/core/lib/resource.lib.php b/htdocs/core/lib/resource.lib.php
index 58fffbae5b7..a6c63dc51e4 100644
--- a/htdocs/core/lib/resource.lib.php
+++ b/htdocs/core/lib/resource.lib.php
@@ -81,8 +81,37 @@ function resource_prepare_head($object)
$head[$h][1] = $langs->trans('Info');
$head[$h][2] = 'info';
$h++;*/
-
+
complete_head_from_modules($conf,$langs,$object,$head,$h,'resource', 'remove');
return $head;
}
+
+function resource_admin_prepare_head() {
+
+ global $langs, $conf, $user;
+
+ $h = 0;
+ $head = array();
+
+ $head[$h][0] = DOL_URL_ROOT.'/admin/resource.php';
+ $head[$h][1] = $langs->trans("ResourceSetup");
+ $head[$h][2] = 'general';
+ $h++;
+
+ // Show more tabs from modules
+ // Entries must be declared in modules descriptor with line
+ // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
+ // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
+ complete_head_from_modules($conf,$langs,null,$head,$h,'resource_admin');
+
+ $head[$h][0] = DOL_URL_ROOT.'/admin/resource_extrafields.php';
+ $head[$h][1] = $langs->trans("ExtraFields");
+ $head[$h][2] = 'attributes';
+ $h++;
+
+ complete_head_from_modules($conf,$langs,null,$head,$h,'resource_admin','remove');
+
+ return $head;
+
+}
diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql
index 058f954ffbe..63d846171a9 100644
--- a/htdocs/core/menus/init_menu_auguria.sql
+++ b/htdocs/core/menus/init_menu_auguria.sql
@@ -101,7 +101,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2802__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/list.php?leftmenu=product&type=0', 'List', 1, 'products', '$user->rights->produit->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2803__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassort.php?type=0', 'Stocks', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->productbatch->enabled', __HANDLER__, 'left', 2805__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassortlot.php?type=0', 'StocksByLotSerial', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 5, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->productbatch->enabled', __HANDLER__, 'left', 2805__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/stock/productlot_list.php', 'LotSerial', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 6, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->productbatch->enabled', __HANDLER__, 'left', 2806__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/stock/productlot_list.php', 'LotSerial', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 6, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 2804__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/stats/card.php?id=all&leftmenu=stats&type=0', 'Statistics', 1, 'main', '$user->rights->produit->lire', '', 2, 7, __ENTITY__);
-- Product - Services
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->service->enabled', __HANDLER__, 'left', 2900__+MAX_llx_menu__, 'products', 'service', 3__+MAX_llx_menu__, '/product/index.php?leftmenu=service&type=1', 'Services', 0, 'products', '$user->rights->service->lire', '', 2, 1, __ENTITY__);
@@ -156,10 +156,10 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1401__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/card.php?&action=create&leftmenu=contracts', 'NewContract', 1, 'contracts', '$user->rights->contrat->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1402__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/list.php?leftmenu=contracts', 'List', 1, 'contracts', '$user->rights->contrat->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1403__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts', 'MenuServices', 1, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled&&$leftmenu=="contracts"', __HANDLER__, 'left', 1404__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=0', 'MenuInactiveServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 0, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled&&$leftmenu=="contracts"', __HANDLER__, 'left', 1405__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=4', 'MenuRunningServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 1, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled&&$leftmenu=="contracts"', __HANDLER__, 'left', 1406__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=4&filter=expired', 'MenuExpiredServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled&&$leftmenu=="contracts"', __HANDLER__, 'left', 1407__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=5', 'MenuClosedServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 3, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1404__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=0', 'MenuInactiveServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 0, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1405__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=4', 'MenuRunningServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 1, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1406__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=4&filter=expired', 'MenuExpiredServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1407__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=5', 'MenuClosedServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 3, __ENTITY__);
-- Commercial - Interventions
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1500__+MAX_llx_menu__, 'commercial', 'ficheinter', 5__+MAX_llx_menu__, '/fichinter/list.php?leftmenu=ficheinter', 'Interventions', 0, 'interventions', '$user->rights->ficheinter->lire', '', 2, 8, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1501__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/card.php?action=create&leftmenu=ficheinter', 'NewIntervention', 1, 'interventions', '$user->rights->ficheinter->creer', '', 2, 0, __ENTITY__);
@@ -210,19 +210,22 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2303__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/clients.php?leftmenu=tax_vat', 'ReportByCustomers', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2304__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/quadri_detail.php?leftmenu=tax_vat', 'ReportByQuarter', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__);
-- Accounting Expert
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'accounting', 6__+MAX_llx_menu__, '/accountancy/index.php?leftmenu=accounting', 'MenuAccountancy', 0, 'accountancy', '! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire', '', 0, 7, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'accounting', 6__+MAX_llx_menu__, '/accountancy/index.php?leftmenu=accountancy', 'MenuAccountancy', 0, 'accountancy', '! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire', '', 0, 7, __ENTITY__);
-- Setup
- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2451__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chartmodel', 2400__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Pcg_version', 1, 'accountancy_admin', '$user->rights->accounting->chartofaccount', '', 0, 1, __ENTITY__);
- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2452__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart', 2400__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Chartofaccounts', 1, 'accountancy_admin', '$user->rights->accounting->chartofaccount', '', 0, 2, __ENTITY__);
- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2453__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_default', 2400__+MAX_llx_menu__, '/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuDefaultAccounts', 1, 'accountancy_admin', '$user->rights->accounting->chartofaccount', '', 0, 3, __ENTITY__);
- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2454__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_product', 2400__+MAX_llx_menu__, '/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'ProductsBinding', 1, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 4, __ENTITY__);
+ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2451__+MAX_llx_menu__, 'accountancy', 'accountancy_admin', 2400__+MAX_llx_menu__, '/accountancy/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Setup', 1, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 1, __ENTITY__);
+ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2455__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chartmodel', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Pcg_version', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 10, __ENTITY__);
+ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2456__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Chartofaccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 20, __ENTITY__);
+ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2457__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_default', 2451__+MAX_llx_menu__, '/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuDefaultAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 30, __ENTITY__);
+ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2458__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuVatAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 40, __ENTITY__);
+ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2459__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_tax', 2451__+MAX_llx_menu__, '/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuTaxAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 50, __ENTITY__);
+ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2460__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_product', 2451__+MAX_llx_menu__, '/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuProductsAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 60, __ENTITY__);
-- Binding
- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', 'dispatch_customer', 2400__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=dispatch_customer', 'CustomersVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 1, __ENTITY__);
- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="dispatch_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 2, __ENTITY__);
- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="dispatch_customer"', __HANDLER__, 'left', 2403__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/lines.php', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 3, __ENTITY__);
- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 2410__+MAX_llx_menu__, 'accountancy', 'ventil_supplier', 2400__+MAX_llx_menu__, '/accountancy/supplier/index.php?leftmenu=dispatch_supplier', 'SuppliersVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 4, __ENTITY__);
- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu=="dispatch_supplier"', __HANDLER__, 'left', 2411__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 5, __ENTITY__);
- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu=="dispatch_supplier"', __HANDLER__, 'left', 2412__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/lines.php', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 6, __ENTITY__);
+ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', 'dispatch_customer', 2400__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=dispatch_customer', 'CustomersVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 2, __ENTITY__);
+ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="dispatch_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 3, __ENTITY__);
+ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="dispatch_customer"', __HANDLER__, 'left', 2403__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/lines.php', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 4, __ENTITY__);
+ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 2410__+MAX_llx_menu__, 'accountancy', 'ventil_supplier', 2400__+MAX_llx_menu__, '/accountancy/supplier/index.php?leftmenu=dispatch_supplier', 'SuppliersVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 5, __ENTITY__);
+ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu=="dispatch_supplier"', __HANDLER__, 'left', 2411__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 6, __ENTITY__);
+ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu=="dispatch_supplier"', __HANDLER__, 'left', 2412__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/lines.php', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 7, __ENTITY__);
-- Journals
-- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2420__+MAX_llx_menu__, 'accountancy', 'journal', 2400__+MAX_llx_menu__, '/accountancy/journal/index.php?leftmenu=journal', 'Journaux', 1, 'accountancy', '$user->rights->accounting->comptarapport->lire', '', 0, 7, __ENTITY__);
-- General Ledger
@@ -265,9 +268,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled', __HANDLER__, 'left', 2600__+MAX_llx_menu__, 'accountancy', 'bank', 14__+MAX_llx_menu__, '/compta/bank/index.php?leftmenu=bank&mainmenu=bank', 'MenuBankCash', 0, 'banks', '$user->rights->banque->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2601__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/card.php?action=create&leftmenu=bank', 'MenuNewFinancialAccount', 1, 'banks', '$user->rights->banque->configurer', '', 0, 0, __ENTITY__);
-- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2602__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/categ.php?leftmenu=bank', 'Rubriques', 1, 'categories', '$user->rights->banque->configurer', '', 0, 1, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2603__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/search.php?leftmenu=bank', 'ListTransactions', 1, 'banks', '$user->rights->banque->lire', '', 0, 2, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2603__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/bankentries.php?leftmenu=bank', 'ListTransactions', 1, 'banks', '$user->rights->banque->lire', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2604__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/budget.php?leftmenu=bank', 'ListTransactionsByCategory', 1, 'banks', '$user->rights->banque->lire', '', 0, 3, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2606__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/virement.php?leftmenu=bank', 'BankTransfers', 1, 'banks', '$user->rights->banque->transfer', '', 0, 5, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2606__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/transfer.php?leftmenu=bank', 'BankTransfers', 1, 'banks', '$user->rights->banque->transfer', '', 0, 5, __ENTITY__);
-- Account - Categories
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 2650__+MAX_llx_menu__, 'accountancy', 'cat', 14__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=5', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 2651__+MAX_llx_menu__, 'accountancy', '', 2650__+MAX_llx_menu__, '/categories/card.php?action=create&type=5', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__);
diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php
index 4f93f9757ae..1b0ff489eba 100644
--- a/htdocs/core/menus/standard/auguria.lib.php
+++ b/htdocs/core/menus/standard/auguria.lib.php
@@ -307,7 +307,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
$newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate
{
- $newmenu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
+ $newmenu->add('/compta/bank/bankentries.php?id='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
}
$i++;
}
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index b5f672d5210..7b5e5d98d9d 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -942,14 +942,30 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/accountancy/index.php?leftmenu=accountancy",$langs->trans("MenuAccountancy"), 0, $permtoshowmenu, '', $mainmenu, 'accountancy');
// Chart of account
- if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("", $langs->trans("Setup"),1,$user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin', 1);
- if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 10);
- if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 20);
- if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 40);
- if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 30);
- if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 30);
- if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 50);
-
+ if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"),1,$user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin', 1);
+ if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 10);
+ if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 20);
+ if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 40);
+ if (! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled))
+ {
+ if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 30);
+ }
+ if (! empty($conf->tax->enabled))
+ {
+ if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 30);
+ }
+ if (! empty($conf->loan->enabled))
+ {
+ if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/loan.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuLoanAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_loan', 45);
+ }
+ /* not required yet, already supported by default account
+ if (! empty($conf->don->enabled))
+ {
+ if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/don/admin/donation.php?from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDonationAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_donation', 47);
+ }*/
+ if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 50);
+
+
// Binding
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&mainmenu=accountancy",$langs->trans("CustomersVentilation"),1,$user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer');
if (preg_match('/accountancy_dispatch_customer/',$leftmenu)) $newmenu->add("/accountancy/customer/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer",$langs->trans("ToBind"),2,$user->rights->accounting->bind->write);
@@ -1073,10 +1089,10 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/compta/bank/card.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer);
$newmenu->add("/compta/bank/index.php?leftmenu=bank&mainmenu=bank",$langs->trans("List"),1,$user->rights->banque->lire, '', $mainmenu, 'bank');
- $newmenu->add("/compta/bank/search.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire);
+ $newmenu->add("/compta/bank/bankentries.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire);
$newmenu->add("/compta/bank/budget.php",$langs->trans("ListTransactionsByCategory"),1,$user->rights->banque->lire);
- $newmenu->add("/compta/bank/virement.php",$langs->trans("MenuBankInternalTransfer"),1,$user->rights->banque->transfer);
+ $newmenu->add("/compta/bank/transfer.php",$langs->trans("MenuBankInternalTransfer"),1,$user->rights->banque->transfer);
}
if (! empty($conf->categorie->enabled)) {
@@ -1396,7 +1412,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate
{
- $newmenu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
+ $newmenu->add('/compta/bank/bankentries.php?id='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
}
$i++;
}
diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php
index ee6162569b1..d3aa3405d0b 100644
--- a/htdocs/core/modules/modResource.class.php
+++ b/htdocs/core/modules/modResource.class.php
@@ -48,7 +48,7 @@ class modResource extends DolibarrModules
// Use a free id here
// (See in Home -> System information -> Dolibarr for list of used modules id).
$this->numero = 63000;
-
+
// Key text used to identify module (for permissions, menus, etc...)
$this->rights_class = 'resource';
@@ -109,7 +109,7 @@ class modResource extends DolibarrModules
// Config pages. Put here list of php pages
// stored into resource/admin directory, used to setup module.
- //$this->config_page_url = array("admin_resource.php@resource");
+ $this->config_page_url = array("resource.php");
// Dependencies
// List of modules id that must be enabled if this module is enabled
@@ -199,8 +199,8 @@ class modResource extends DolibarrModules
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
-
-
+
+
// Add here list of permission defined by
// an id, a label, a boolean and two constant strings.
// Example:
@@ -266,7 +266,7 @@ class modResource extends DolibarrModules
'target'=> '',
'user'=> 0
);
-
+
// Exports
$r = 1;
diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php
index 96c9e81d852..928b151618a 100644
--- a/htdocs/ecm/index.php
+++ b/htdocs/ecm/index.php
@@ -468,8 +468,8 @@ else
print '
';
print '';
}
-$url=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'§ion='.$section:'')));
-print '
';
+$relativeurl=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'§ion='.$section:'')));
+print ' ';
print ' ';
print ' ';
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index ea91765b94a..d34671b9806 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -584,7 +584,7 @@ class FactureFournisseur extends CommonInvoice
*/
function fetch_lines()
{
- $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx';
+ $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.vat_src_code, f.tva_tx';
$sql.= ', f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 ';
$sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit';
$sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc';
@@ -609,7 +609,7 @@ class FactureFournisseur extends CommonInvoice
$line = new SupplierInvoiceLine($this->db);
$line->id = $obj->rowid;
- $line->rowid = $obj->rowid;
+ $line->rowid = $obj->rowid;
$line->description = $obj->description;
$line->product_ref = $obj->product_ref;
$line->ref = $obj->product_ref;
@@ -618,27 +618,29 @@ class FactureFournisseur extends CommonInvoice
$line->label = $obj->label;
$line->product_desc = $obj->product_desc;
$line->subprice = $obj->pu_ht;
- $line->pu_ht = $obj->pu_ht;
+ $line->pu_ht = $obj->pu_ht;
$line->pu_ttc = $obj->pu_ttc;
+
+ $line->vat_src_code = $obj->vat_src_code;
$line->tva_tx = $obj->tva_tx;
$line->localtax1_tx = $obj->localtax1_tx;
$line->localtax2_tx = $obj->localtax2_tx;
$line->qty = $obj->qty;
- $line->remise_percent = $obj->remise_percent;
+ $line->remise_percent = $obj->remise_percent;
$line->tva = $obj->total_tva;
$line->total_ht = $obj->total_ht;
- $line->total_tva = $obj->total_tva;
+ $line->total_tva = $obj->total_tva;
$line->total_localtax1 = $obj->total_localtax1;
$line->total_localtax2 = $obj->total_localtax2;
- $line->total_ttc = $obj->total_ttc;
+ $line->total_ttc = $obj->total_ttc;
$line->fk_product = $obj->fk_product;
$line->product_type = $obj->product_type;
- $line->product_label = $obj->label;
- $line->info_bits = $obj->info_bits;
- $line->fk_parent_line = $obj->fk_parent_line;
+ $line->product_label = $obj->label;
+ $line->info_bits = $obj->info_bits;
+ $line->fk_parent_line = $obj->fk_parent_line;
$line->special_code = $obj->special_code;
$line->rang = $obj->rang;
- $line->fk_unit = $obj->fk_unit;
+ $line->fk_unit = $obj->fk_unit;
// Multicurrency
$line->fk_multicurrency = $obj->fk_multicurrency;
@@ -1241,7 +1243,7 @@ class FactureFournisseur extends CommonInvoice
*
* @param string $desc Description de la ligne
* @param double $pu Prix unitaire (HT ou TTC selon price_base_type, > 0 even for credit note)
- * @param double $txtva Taux de tva force, sinon -1
+ * @param double $txtva Force Vat rate to use, -1 for auto.
* @param double $txlocaltax1 LocalTax1 Rate
* @param double $txlocaltax2 LocalTax2 Rate
* @param double $qty Quantite
@@ -1277,6 +1279,16 @@ class FactureFournisseur extends CommonInvoice
if (empty($txtva)) $txtva=0;
if (empty($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2)) $txlocaltax2=0;
+
+ $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $mysoc, $this->thirdparty);
+
+ // Clean vat code
+ $vat_src_code='';
+ if (preg_match('/\((.*)\)/', $txtva, $reg))
+ {
+ $vat_src_code = $reg[1];
+ $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
+ }
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
@@ -1285,8 +1297,6 @@ class FactureFournisseur extends CommonInvoice
$txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2);
- $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc, $this->thirdparty);
-
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
@@ -1311,6 +1321,8 @@ class FactureFournisseur extends CommonInvoice
//$this->line->label=$label; // deprecated
$this->line->desc=$desc;
$this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
+
+ $this->line->vat_src_code=$vat_src_code;
$this->line->tva_tx=$txtva;
$this->line->localtax1_tx=$txlocaltax1;
$this->line->localtax2_tx=$txlocaltax2;
@@ -1470,6 +1482,8 @@ class FactureFournisseur extends CommonInvoice
$line->pu_ttc = $pu_ttc;
$line->qty = $qty;
$line->remise_percent = $remise_percent;
+
+ $this->line->vat_src_code=$vat_src_code;
$line->tva_tx = $vatrate;
$line->localtax1_tx = $txlocaltax1;
$line->localtax2_tx = $txlocaltax2;
@@ -2448,6 +2462,7 @@ class SupplierInvoiceLine extends CommonObjectLine
$sql.= ", pu_ttc = ".price2num($this->pu_ttc);
$sql.= ", qty = ".price2num($this->qty);
$sql.= ", remise_percent = ".price2num($this->remise_percent);
+ $sql.= ", vat_src_code = '".(empty($this->vat_src_code)?'':$this->vat_src_code)."'";
$sql.= ", tva_tx = ".price2num($this->tva_tx);
$sql.= ", localtax1_tx = ".price2num($this->localtax1_tx);
$sql.= ", localtax2_tx = ".price2num($this->localtax2_tx);
@@ -2571,7 +2586,7 @@ class SupplierInvoiceLine extends CommonObjectLine
// Insertion dans base de la ligne
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element;
$sql.= ' (fk_facture_fourn, fk_parent_line, label, description, qty,';
- $sql.= ' tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
+ $sql.= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
$sql.= ' fk_product, product_type, remise_percent, pu_ht, pu_ttc,';
$sql.= ' date_start, date_end, fk_code_ventilation, rang, special_code,';
$sql.= ' info_bits, total_ht, tva, total_ttc, total_localtax1, total_localtax2, fk_unit';
@@ -2582,6 +2597,7 @@ class SupplierInvoiceLine extends CommonObjectLine
$sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
$sql.= " '".$this->db->escape($this->desc)."',";
$sql.= " ".price2num($this->qty).",";
+ $sql.= " ".(empty($this->vat_src_code)?"''":"'".$this->vat_src_code."'").",";
$sql.= " ".price2num($this->tva_tx).",";
$sql.= " ".price2num($this->localtax1_tx).",";
$sql.= " ".price2num($this->localtax2_tx).",";
@@ -2650,6 +2666,38 @@ class SupplierInvoiceLine extends CommonObjectLine
$this->db->rollback();
return -2;
}
- }
-}
+ }
+ /**
+ * Mise a jour de l'objet ligne de commande en base
+ *
+ * @return int <0 si ko, >0 si ok
+ */
+ function update_total()
+ {
+ $this->db->begin();
+ // Mise a jour ligne en base
+ $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET";
+ $sql.= " total_ht='".price2num($this->total_ht)."'";
+ $sql.= ", tva='".price2num($this->total_tva)."'";
+ $sql.= ", total_localtax1='".price2num($this->total_localtax1)."'";
+ $sql.= ", total_localtax2='".price2num($this->total_localtax2)."'";
+ $sql.= ", total_ttc='".price2num($this->total_ttc)."'";
+ $sql.= " WHERE rowid = ".$this->rowid;
+
+ dol_syslog("FactureFournisseurLigne.class.php::update_total", LOG_DEBUG);
+
+ $resql=$this->db->query($sql);
+ if ($resql)
+ {
+ $this->db->commit();
+ return 1;
+ }
+ else
+ {
+ $this->error=$this->db->error();
+ $this->db->rollback();
+ return -2;
+ }
+ }
+ }
diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php
index 34a11663e2a..e59144abc2e 100644
--- a/htdocs/fourn/class/fournisseur.product.class.php
+++ b/htdocs/fourn/class/fournisseur.product.class.php
@@ -521,9 +521,10 @@ class ProductFournisseur extends Product
*
* @param int $prodid Product id
* @param int $qty Minimum quantity
+ * @param int $socid get min price for specific supplier
* @return int <0 if KO, 0=Not found of no product id provided, >0 if OK
*/
- function find_min_price_product_fournisseur($prodid, $qty=0)
+ function find_min_price_product_fournisseur($prodid, $qty=0, $socid=0)
{
global $conf;
@@ -556,6 +557,7 @@ class ProductFournisseur extends Product
$sql.= " AND pfp.fk_soc = s.rowid";
$sql.= " AND s.status = 1"; // only enabled society
if ($qty > 0) $sql.= " AND pfp.quantity <= ".$qty;
+ if ($socid > 0) $sql.= ' AND pfp.fk_soc = '.$socid;
dol_syslog(get_class($this)."::find_min_price_product_fournisseur", LOG_DEBUG);
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 4460a335463..828809d43d3 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -1059,7 +1059,7 @@ if (empty($reshook))
$array_option = $lines[$i]->array_options;
}
- $result = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty);
+ $result = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty, $srcobject->socid);
if ($result>=0)
{
$tva_tx = $lines[$i]->tva_tx;
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index bd575e28bcf..78fbe392774 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -355,243 +355,425 @@ if (empty($reshook))
// Create
elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
{
- $error=0;
+ if ($socid > 0) $object->socid = GETPOST('socid', 'int');
- $datefacture=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']);
- $datedue=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
+ $db->begin();
- if (GETPOST('socid','int')<1)
- {
- setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('Supplier')), null, 'errors');
- $action='create';
- $error++;
- }
+ $error = 0;
- if ($datefacture == '')
- {
- setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')), null, 'errors');
- $action='create';
- $_GET['socid']=$_POST['socid'];
- $error++;
- }
- if (! GETPOST('ref_supplier'))
- {
- setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('RefSupplier')), null, 'errors');
- $action='create';
- $_GET['socid']=$_POST['socid'];
- $error++;
- }
+ // Fill array 'array_options' with data from add form
+ $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
+ $ret = $extrafields->setOptionalsFromPost($extralabels, $object);
+ if ($ret < 0) $error++;
- // Fill array 'array_options' with data from add form
+ $datefacture=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']);
+ $datedue=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
- if (! $error)
- {
- $db->begin();
+ // Replacement invoice
+ if ($_POST['type'] == FactureFournisseur::TYPE_REPLACEMENT)
+ {
+ if ($datefacture == '')
+ {
+ setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')), null, 'errors');
+ $action='create';
+ $_GET['socid']=$_POST['socid'];
+ $error++;
+ }
+ if (! ($_POST['fac_replacement'] > 0)) {
+ $error ++;
+ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReplaceInvoice")), null, 'errors');
+ }
- $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
- $ret = $extrafields->setOptionalsFromPost($extralabels, $object);
- if ($ret < 0) $error++;
+ if (! $error) {
+ // This is a replacement invoice
+ $result = $object->fetch($_POST['fac_replacement']);
+ $object->fetch_thirdparty();
- $tmpproject = GETPOST('projectid', 'int');
+ $object->ref = $_POST['ref'];
+ $object->ref_supplier = $_POST['ref_supplier'];
+ $object->socid = $_POST['socid'];
+ $object->libelle = $_POST['label'];
+ $object->date = $datefacture;
+ $object->date_echeance = $datedue;
+ $object->note_public = GETPOST('note_public');
+ $object->note_private = GETPOST('note_private');
+ $object->cond_reglement_id = GETPOST('cond_reglement_id');
+ $object->mode_reglement_id = GETPOST('mode_reglement_id');
+ $object->fk_account = GETPOST('fk_account', 'int');
+ $object->fk_project = ($tmpproject > 0) ? $tmpproject : null;
+ $object->fk_incoterms = GETPOST('incoterm_id', 'int');
+ $object->location_incoterms = GETPOST('location_incoterms', 'alpha');
+ $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
+ $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
- // Creation facture
- $object->ref = $_POST['ref'];
- $object->ref_supplier = $_POST['ref_supplier'];
- $object->socid = $_POST['socid'];
- $object->libelle = $_POST['label'];
- $object->date = $datefacture;
- $object->date_echeance = $datedue;
- $object->note_public = GETPOST('note_public');
- $object->note_private = GETPOST('note_private');
- $object->cond_reglement_id = GETPOST('cond_reglement_id');
- $object->mode_reglement_id = GETPOST('mode_reglement_id');
- $object->fk_account = GETPOST('fk_account', 'int');
- $object->fk_project = ($tmpproject > 0) ? $tmpproject : null;
- $object->fk_incoterms = GETPOST('incoterm_id', 'int');
- $object->location_incoterms = GETPOST('location_incoterms', 'alpha');
- $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
- $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
+ // Proprietes particulieres a facture de remplacement
+ $object->fk_facture_source = $_POST['fac_replacement'];
+ $object->type = FactureFournisseur::TYPE_REPLACEMENT;
- // Auto calculation of date due if not filled by user
- if(empty($object->date_echeance)) $object->date_echeance = $object->calculate_date_lim_reglement();
+ $id = $object->createFromCurrent($user);
+ if ($id <= 0) {
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+ }
+ }
- // If creation from another object of another module
- if (! $error && $_POST['origin'] && $_POST['originid'])
- {
- // Parse element/subelement (ex: project_task)
- $element = $subelement = $_POST['origin'];
- /*if (preg_match('/^([^_]+)_([^_]+)/i',$_POST['origin'],$regs))
- {
- $element = $regs[1];
- $subelement = $regs[2];
- }*/
+ // Credit note invoice
+ if ($_POST['type'] == FactureFournisseur::TYPE_CREDIT_NOTE)
+ {
+ $sourceinvoice = GETPOST('fac_avoir');
+ if (! ($sourceinvoice > 0) && empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE))
+ {
+ $error ++;
+ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CorrectInvoice")), null, 'errors');
+ }
+ if (GETPOST('socid','int')<1)
+ {
+ setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('Supplier')), null, 'errors');
+ $action='create';
+ $error++;
+ }
+ if ($datefacture == '')
+ {
+ setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')), null, 'errors');
+ $action='create';
+ $_GET['socid']=$_POST['socid'];
+ $error++;
+ }
+ if (! GETPOST('ref_supplier'))
+ {
+ setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('RefSupplier')), null, 'errors');
+ $action='create';
+ $_GET['socid']=$_POST['socid'];
+ $error++;
+ }
- // For compatibility
- if ($element == 'order') {
- $element = $subelement = 'commande';
- }
- if ($element == 'propal') {
- $element = 'comm/propal'; $subelement = 'propal';
- }
- if ($element == 'contract') {
- $element = $subelement = 'contrat';
- }
- if ($element == 'order_supplier') {
- $element = 'fourn'; $subelement = 'fournisseur.commande';
- }
- if ($element == 'project')
- {
- $element = 'projet';
- }
- $object->origin = $_POST['origin'];
- $object->origin_id = $_POST['originid'];
+ if (! $error)
+ {
+ $tmpproject = GETPOST('projectid', 'int');
- $id = $object->create($user);
+ // Creation facture
+ $object->ref = $_POST['ref'];
+ $object->ref_supplier = $_POST['ref_supplier'];
+ $object->socid = $_POST['socid'];
+ $object->libelle = $_POST['label'];
+ $object->date = $datefacture;
+ $object->date_echeance = $datedue;
+ $object->note_public = GETPOST('note_public');
+ $object->note_private = GETPOST('note_private');
+ $object->cond_reglement_id = GETPOST('cond_reglement_id');
+ $object->mode_reglement_id = GETPOST('mode_reglement_id');
+ $object->fk_account = GETPOST('fk_account', 'int');
+ $object->fk_project = ($tmpproject > 0) ? $tmpproject : null;
+ $object->fk_incoterms = GETPOST('incoterm_id', 'int');
+ $object->location_incoterms = GETPOST('location_incoterms', 'alpha');
+ $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
+ $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
- // Add lines
- if ($id > 0)
- {
- require_once DOL_DOCUMENT_ROOT.'/'.$element.'/class/'.$subelement.'.class.php';
- $classname = ucfirst($subelement);
- if ($classname == 'Fournisseur.commande') $classname='CommandeFournisseur';
- $srcobject = new $classname($db);
+ // Proprietes particulieres a facture avoir
+ $object->fk_facture_source = $sourceinvoice > 0 ? $sourceinvoice : '';
+ $object->type = FactureFournisseur::TYPE_CREDIT_NOTE;
- $result=$srcobject->fetch($_POST['originid']);
- if ($result > 0)
- {
- $lines = $srcobject->lines;
- if (empty($lines) && method_exists($srcobject,'fetch_lines'))
- {
- $srcobject->fetch_lines();
- $lines = $srcobject->lines;
- }
+ $id = $object->create($user);
- $num=count($lines);
- for ($i = 0; $i < $num; $i++)
- {
- $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
- $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
+ if (GETPOST('invoiceAvoirWithLines', 'int')==1 && $id>0)
+ {
+ $facture_source = new FactureFournisseur($db); // fetch origin object
+ if ($facture_source->fetch($object->fk_facture_source)>0)
+ {
+ $fk_parent_line = 0;
- // Dates
- // TODO mutualiser
- $date_start=$lines[$i]->date_debut_prevue;
- if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel;
- if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start;
- $date_end=$lines[$i]->date_fin_prevue;
- if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
- if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
+ foreach($facture_source->lines as $line)
+ {
+ // Reset fk_parent_line for no child products and special product
+ if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) {
+ $fk_parent_line = 0;
+ }
- // FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example.
- $result = $object->addline(
- $desc,
- $lines[$i]->subprice,
- $lines[$i]->tva_tx,
- $lines[$i]->localtax1_tx,
- $lines[$i]->localtax2_tx,
- $lines[$i]->qty,
- $lines[$i]->fk_product,
- $lines[$i]->remise_percent,
- $date_start,
- $date_end,
- 0,
- $lines[$i]->info_bits,
- 'HT',
- $product_type,
- $lines[$i]->rang,
- 0,
- $lines[$i]->array_options,
- $lines[$i]->fk_unit,
- $lines[$i]->id
- );
+ $line->fk_facture = $object->id;
+ $line->fk_parent_line = $fk_parent_line;
- if ($result < 0)
- {
- $error++;
- break;
- }
- }
+ $line->subprice =-$line->subprice; // invert price for object
+ $line->pa_ht = -$line->pa_ht;
+ $line->total_ht=-$line->total_ht;
+ $line->total_tva=-$line->total_tva;
+ $line->total_ttc=-$line->total_ttc;
+ $line->total_localtax1=-$line->total_localtax1;
+ $line->total_localtax2=-$line->total_localtax2;
- // Now reload line
- $object->fetch_lines();
- }
- else
- {
- $error++;
- }
- }
- else
- {
- $error++;
- }
- }
- else if (! $error)
- {
- $id = $object->create($user);
- if ($id < 0)
- {
- $error++;
- }
+ $result = $line->insert();
- if (! $error)
- {
- // If some invoice's lines already known
- for ($i = 1 ; $i < 9 ; $i++)
- {
- $label = $_POST['label'.$i];
- $amountht = price2num($_POST['amount'.$i]);
- $amountttc = price2num($_POST['amountttc'.$i]);
- $tauxtva = price2num($_POST['tauxtva'.$i]);
- $qty = $_POST['qty'.$i];
- $fk_product = $_POST['fk_product'.$i];
- if ($label)
- {
- if ($amountht)
- {
- $price_base='HT'; $amount=$amountht;
- }
- else
- {
- $price_base='TTC'; $amount=$amountttc;
- }
- $atleastoneline=1;
+ $object->lines[] = $line; // insert new line in current object
- $product=new Product($db);
- $product->fetch($_POST['idprod'.$i]);
+ // Defined the new fk_parent_line
+ if ($result > 0 && $line->product_type == 9) {
+ $fk_parent_line = $result;
+ }
+ }
- $ret=$object->addline($label, $amount, $tauxtva, $product->localtax1_tx, $product->localtax2_tx, $qty, $fk_product, $remise_percent, '', '', '', 0, $price_base, $_POST['rang'.$i], 1);
- if ($ret < 0) $error++;
- }
- }
- }
- }
+ $object->update_price(1);
+ }
- if ($error)
- {
- $langs->load("errors");
- $db->rollback();
+ }
- setEventMessages($object->error, $object->errors, 'errors');
- $action='create';
- $_GET['socid']=$_POST['socid'];
- }
- else
- {
- $db->commit();
+ if(GETPOST('invoiceAvoirWithPaymentRestAmount', 'int')==1 && $id>0)
+ {
+ $facture_source = new FactureFournisseur($db); // fetch origin object if not previously defined
+ if ($facture_source->fetch($object->fk_facture_source)>0)
+ {
+ $totalpaye = $facture_source->getSommePaiement();
+ $totalcreditnotes = $facture_source->getSumCreditNotesUsed();
+ $totaldeposits = $facture_source->getSumDepositsUsed();
+ $remain_to_pay = abs($facture_source->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits);
- if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
- $outputlangs = $langs;
- $result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
- if ($result < 0)
- {
- dol_print_error($db,$object->error,$object->errors);
- exit;
- }
- }
+ $object->addline($langs->trans('invoiceAvoirLineWithPaymentRestAmount'),$remain_to_pay,1,0,0,0,0,0,'','','TTC');
+ }
+ }
- header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
- exit;
- }
- }
+ // Add predefined lines
+ /*
+ TODO delete
+ for($i = 1; $i <= $NBLINES; $i ++) {
+ if ($_POST['idprod' . $i]) {
+ $product = new Product($db);
+ $product->fetch($_POST['idprod' . $i]);
+ $startday = dol_mktime(12, 0, 0, $_POST['date_start' . $i . 'month'], $_POST['date_start' . $i . 'day'], $_POST['date_start' . $i . 'year']);
+ $endday = dol_mktime(12, 0, 0, $_POST['date_end' . $i . 'month'], $_POST['date_end' . $i . 'day'], $_POST['date_end' . $i . 'year']);
+ $result = $object->addline($product->description, $product->price, $_POST['qty' . $i], $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, $_POST['idprod' . $i], $_POST['remise_percent' . $i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
+ }
+ }*/
+ }
+ }
+
+ // Standard or deposit
+ if ($_POST['type'] == FactureFournisseur::TYPE_STANDARD || $_POST['type'] == FactureFournisseur::TYPE_DEPOSIT)
+ {
+ if (GETPOST('socid','int')<1)
+ {
+ setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('Supplier')), null, 'errors');
+ $action='create';
+ $error++;
+ }
+
+ if ($datefacture == '')
+ {
+ setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')), null, 'errors');
+ $action='create';
+ $_GET['socid']=$_POST['socid'];
+ $error++;
+ }
+ if (! GETPOST('ref_supplier'))
+ {
+ setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('RefSupplier')), null, 'errors');
+ $action='create';
+ $_GET['socid']=$_POST['socid'];
+ $error++;
+ }
+
+ if (! $error)
+ {
+ $db->begin();
+
+ $tmpproject = GETPOST('projectid', 'int');
+
+ // Creation facture
+ $object->ref = $_POST['ref'];
+ $object->ref_supplier = $_POST['ref_supplier'];
+ $object->socid = $_POST['socid'];
+ $object->libelle = $_POST['label'];
+ $object->date = $datefacture;
+ $object->date_echeance = $datedue;
+ $object->note_public = GETPOST('note_public');
+ $object->note_private = GETPOST('note_private');
+ $object->cond_reglement_id = GETPOST('cond_reglement_id');
+ $object->mode_reglement_id = GETPOST('mode_reglement_id');
+ $object->fk_account = GETPOST('fk_account', 'int');
+ $object->fk_project = ($tmpproject > 0) ? $tmpproject : null;
+ $object->fk_incoterms = GETPOST('incoterm_id', 'int');
+ $object->location_incoterms = GETPOST('location_incoterms', 'alpha');
+ $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
+ $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
+
+ // Auto calculation of date due if not filled by user
+ if(empty($object->date_echeance)) $object->date_echeance = $object->calculate_date_lim_reglement();
+
+ // If creation from another object of another module
+ if (! $error && $_POST['origin'] && $_POST['originid'])
+ {
+ // Parse element/subelement (ex: project_task)
+ $element = $subelement = $_POST['origin'];
+ /*if (preg_match('/^([^_]+)_([^_]+)/i',$_POST['origin'],$regs))
+ {
+ $element = $regs[1];
+ $subelement = $regs[2];
+ }*/
+
+ // For compatibility
+ if ($element == 'order') {
+ $element = $subelement = 'commande';
+ }
+ if ($element == 'propal') {
+ $element = 'comm/propal'; $subelement = 'propal';
+ }
+ if ($element == 'contract') {
+ $element = $subelement = 'contrat';
+ }
+ if ($element == 'order_supplier') {
+ $element = 'fourn'; $subelement = 'fournisseur.commande';
+ }
+ if ($element == 'project')
+ {
+ $element = 'projet';
+ }
+ $object->origin = $_POST['origin'];
+ $object->origin_id = $_POST['originid'];
+
+ $id = $object->create($user);
+
+ // Add lines
+ if ($id > 0)
+ {
+ require_once DOL_DOCUMENT_ROOT.'/'.$element.'/class/'.$subelement.'.class.php';
+ $classname = ucfirst($subelement);
+ if ($classname == 'Fournisseur.commande') $classname='CommandeFournisseur';
+ $srcobject = new $classname($db);
+
+ $result=$srcobject->fetch($_POST['originid']);
+ if ($result > 0)
+ {
+ $lines = $srcobject->lines;
+ if (empty($lines) && method_exists($srcobject,'fetch_lines'))
+ {
+ $srcobject->fetch_lines();
+ $lines = $srcobject->lines;
+ }
+
+ $num=count($lines);
+ for ($i = 0; $i < $num; $i++)
+ {
+ $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
+ $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
+
+ // Dates
+ // TODO mutualiser
+ $date_start=$lines[$i]->date_debut_prevue;
+ if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel;
+ if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start;
+ $date_end=$lines[$i]->date_fin_prevue;
+ if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
+ if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
+
+ // FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example.
+ $result = $object->addline(
+ $desc,
+ $lines[$i]->subprice,
+ $lines[$i]->tva_tx,
+ $lines[$i]->localtax1_tx,
+ $lines[$i]->localtax2_tx,
+ $lines[$i]->qty,
+ $lines[$i]->fk_product,
+ $lines[$i]->remise_percent,
+ $date_start,
+ $date_end,
+ 0,
+ $lines[$i]->info_bits,
+ 'HT',
+ $product_type,
+ $lines[$i]->rang,
+ 0,
+ $lines[$i]->array_options,
+ $lines[$i]->fk_unit,
+ $lines[$i]->id
+ );
+
+ if ($result < 0)
+ {
+ $error++;
+ break;
+ }
+ }
+
+ // Now reload line
+ $object->fetch_lines();
+ }
+ else
+ {
+ $error++;
+ }
+ }
+ else
+ {
+ $error++;
+ }
+ }
+ else if (! $error)
+ {
+ $id = $object->create($user);
+ if ($id < 0)
+ {
+ $error++;
+ }
+
+ if (! $error)
+ {
+ // If some invoice's lines already known
+ for ($i = 1 ; $i < 9 ; $i++)
+ {
+ $label = $_POST['label'.$i];
+ $amountht = price2num($_POST['amount'.$i]);
+ $amountttc = price2num($_POST['amountttc'.$i]);
+ $tauxtva = price2num($_POST['tauxtva'.$i]);
+ $qty = $_POST['qty'.$i];
+ $fk_product = $_POST['fk_product'.$i];
+ if ($label)
+ {
+ if ($amountht)
+ {
+ $price_base='HT'; $amount=$amountht;
+ }
+ else
+ {
+ $price_base='TTC'; $amount=$amountttc;
+ }
+ $atleastoneline=1;
+
+ $product=new Product($db);
+ $product->fetch($_POST['idprod'.$i]);
+
+ $ret=$object->addline($label, $amount, $tauxtva, $product->localtax1_tx, $product->localtax2_tx, $qty, $fk_product, $remise_percent, '', '', '', 0, $price_base, $_POST['rang'.$i], 1);
+ if ($ret < 0) $error++;
+ }
+ }
+ }
+ }
+
+ if ($error)
+ {
+ $langs->load("errors");
+ $db->rollback();
+
+ setEventMessages($object->error, $object->errors, 'errors');
+ $action='create';
+ $_GET['socid']=$_POST['socid'];
+ }
+ else
+ {
+ $db->commit();
+
+ if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
+ $outputlangs = $langs;
+ $result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
+ if ($result < 0)
+ {
+ dol_print_error($db,$object->error,$object->errors);
+ exit;
+ }
+ }
+
+ header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
+ exit;
+ }
+ }
+ }
}
// Edit line
diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php
index 3ad6451d66b..bcf000bc3aa 100644
--- a/htdocs/fourn/facture/paiement.php
+++ b/htdocs/fourn/facture/paiement.php
@@ -708,7 +708,7 @@ if (empty($action))
print '
'.$objp->num_paiement.' ';
print '
';
- if ($objp->bid) print ''.img_object($langs->trans("ShowAccount"),'account').' '.dol_trunc($objp->label,24).' ';
+ if ($objp->bid) print ''.img_object($langs->trans("ShowAccount"),'account').' '.dol_trunc($objp->label,24).' ';
else print ' ';
print ' ';
diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql
index cf34086f066..8b1c554ee1a 100644
--- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql
+++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql
@@ -139,7 +139,8 @@ ALTER TABLE llx_accounting_bookkeeping ADD COLUMN tms timestamp;
ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (account_number, entity, fk_pcg_version);
-ALTER TABLE llx_c_payment_term change fdm type_cdr tinyint
+
+ALTER TABLE llx_c_payment_term change fdm type_cdr tinyint;
ALTER TABLE llx_facturedet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
@@ -149,4 +150,17 @@ ALTER TABLE llx_commande_fournisseurdet ADD COLUMN vat_src_code varchar(10) DEFA
ALTER TABLE llx_propaldet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
ALTER TABLE llx_supplier_proposaldet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
-
\ No newline at end of file
+ALTER TABLE llx_c_payment_term change fdm type_cdr tinyint;
+
+ALTER TABLE llx_entrepot ADD COLUMN fk_parent integer DEFAULT 0;
+
+
+create table llx_resource_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_resource_extrafields ADD INDEX idx_resource_extrafields (fk_object);
diff --git a/htdocs/install/mysql/tables/llx_entrepot.sql b/htdocs/install/mysql/tables/llx_entrepot.sql
index a8898a7ec92..d93eb6e1575 100644
--- a/htdocs/install/mysql/tables/llx_entrepot.sql
+++ b/htdocs/install/mysql/tables/llx_entrepot.sql
@@ -34,5 +34,6 @@ create table llx_entrepot
fk_pays integer DEFAULT 0,
statut tinyint DEFAULT 1, -- 1 open, 0 close
fk_user_author integer,
- import_key varchar(14)
+ import_key varchar(14),
+ fk_parent integer DEFAULT 0
)ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_resource_extrafields.key.sql b/htdocs/install/mysql/tables/llx_resource_extrafields.key.sql
new file mode 100644
index 00000000000..af77b0c2474
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_resource_extrafields.key.sql
@@ -0,0 +1,20 @@
+-- ===================================================================
+-- Copyright (C) 2016 Florian Henry
+--
+-- 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
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see .
+--
+-- ===================================================================
+
+
+ALTER TABLE llx_resource_extrafields ADD INDEX idx_resource_extrafields (fk_object);
diff --git a/htdocs/install/mysql/tables/llx_resource_extrafields.sql b/htdocs/install/mysql/tables/llx_resource_extrafields.sql
new file mode 100644
index 00000000000..4bda4091de4
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_resource_extrafields.sql
@@ -0,0 +1,26 @@
+-- ========================================================================
+-- Copyright (C) 2016 Florian Henry
+--
+-- 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
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see .
+--
+-- ========================================================================
+
+create table llx_resource_extrafields
+(
+ rowid integer AUTO_INCREMENT PRIMARY KEY,
+ tms timestamp,
+ fk_object integer NOT NULL,
+ import_key varchar(14) -- import key
+) ENGINE=innodb;
+
diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang
index c0b956ed18c..6a679b53939 100644
--- a/htdocs/langs/en_US/accountancy.lang
+++ b/htdocs/langs/en_US/accountancy.lang
@@ -30,6 +30,7 @@ AccountancyAreaDescContrib=STEP %s: Check the binding between special expences (
AccountancyAreaDescDonation=STEP %s: Check the binding between donation and accounting account is done. Complete missing bindings. This will save you time in future for the next steps by suggesting you the correct default accounting account on record related to payments of donation. You can set the account dedicated for that from the menu entry %s.
AccountancyAreaDescMisc=STEP %s: Check the default binding between miscellaneous transaction lines and accounting account is done. Complete missing bindings. For this you can use the menu entry %s.
AccountancyAreaDescProd=STEP %s: Check the binding between products/services and accounting account is done. Complete missing bindings. This will save you time in future for the next steps by suggesting you the correct default accounting account on your invoice lines. For this you can use the menu entry %s.
+AccountancyAreaDescLoan=STEP %s: Check the binding between loans payment and accounting account is done. Complete missing bindings. This will save you time in future for the next steps by suggesting you the correct default accounting account on record related to payment of loans. For this you can use the menu entry %s.
AccountancyAreaDescCustomer=STEP %s: Check the binding between existing customer invoice lines and accounting account is done. Complete missing bindings. Once binding is complete, application will be able to journalize transactions in General Ledger in one click. For this you can use the menu entry %s.
AccountancyAreaDescSupplier=STEP %s: Check the binding between existing supplier invoice lines and accounting account is done. Complete missing bindings. Once binding is complete, application will be able to journalize transactions in General Ledger in one click. For this you can use the menu entry %s.
@@ -48,6 +49,7 @@ AccountAccountingSuggest=Accounting account suggest
MenuDefaultAccounts=Default accounts
MenuVatAccounts=Vat accounts
MenuTaxAccounts=Tax accounts
+MenuLoanAccounts=Loan accounts
MenuProductsAccounts=Product accounts
ProductsBinding=Products accounts
Ventilation=Binding to accounts
@@ -93,9 +95,9 @@ ACCOUNTING_MISCELLANEOUS_JOURNAL=Miscellaneous journal
ACCOUNTING_EXPENSEREPORT_JOURNAL=Expense report journal
ACCOUNTING_SOCIAL_JOURNAL=Social journal
-ACCOUNTING_ACCOUNT_TRANSFER_CASH=Account of transfer
-ACCOUNTING_ACCOUNT_SUSPENSE=Account of wait
-DONATION_ACCOUNTINGACCOUNT=Account to register donations
+ACCOUNTING_ACCOUNT_TRANSFER_CASH=Accounting account of transfer
+ACCOUNTING_ACCOUNT_SUSPENSE=Accounting account of wait
+DONATION_ACCOUNTINGACCOUNT=Accounting account to register donations
ACCOUNTING_PRODUCT_BUY_ACCOUNT=Accounting account by default for bought products (used if not defined in the product sheet)
ACCOUNTING_PRODUCT_SOLD_ACCOUNT=Accounting account by default for the sold products (used if not defined in the product sheet)
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 39281f48609..ca53bc971a9 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1631,4 +1631,9 @@ LandingPage=Landing page
SamePriceAlsoForSharedCompanies=If you use a multicompany module, with the choice "Single price", price will be also the same for all companies if products are shared between environments
ModuleEnabledAdminMustCheckRights=Module has been activated. Permissions for activated module(s) were given to admin users only. You may need to grant permissions to other users manually if necessary.
UserHasNoPermissions=This user has no permission defined
-TypeCdr=Use "None" if the date of payment term is date of invoice plus a delta in days (delta is field "Nb of days") Use "At end of month", if, after delta, the date must be increased to reach the end of month (+ an optional "Offset" in days) Use "Current/Next" to have payment term date being the first Nth of the month (N is stored into field "Nb of days")
\ No newline at end of file
+TypeCdr=Use "None" if the date of payment term is date of invoice plus a delta in days (delta is field "Nb of days") Use "At end of month", if, after delta, the date must be increased to reach the end of month (+ an optional "Offset" in days) Use "Current/Next" to have payment term date being the first Nth of the month (N is stored into field "Nb of days")
+##### Resource ####
+ResourceSetup=Configuration du module Resource
+UseSearchToSelectResource=Use a search form to choose a resource (rather than a drop-down list).
+DisabledResourceLinkUser=Disabled resource link to user
+DisabledResourceLinkContact=Disabled resource link to contact
diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang
index 31cbdae740a..d4fe1334d20 100644
--- a/htdocs/langs/en_US/banks.lang
+++ b/htdocs/langs/en_US/banks.lang
@@ -55,35 +55,36 @@ AccountCard=Account card
DeleteAccount=Delete account
ConfirmDeleteAccount=Are you sure you want to delete this account?
Account=Account
-BankTransactionByCategories=Bank transactions by categories
-BankTransactionForCategory=Bank transactions for category %s
+BankTransactionByCategories=Bank entries by categories
+BankTransactionForCategory=Bank entries for category %s
RemoveFromRubrique=Remove link with category
-RemoveFromRubriqueConfirm=Are you sure you want to remove link between the transaction and the category?
-ListBankTransactions=List of bank transactions
+RemoveFromRubriqueConfirm=Are you sure you want to remove link between the entry and the category?
+ListBankTransactions=List of bank entries
IdTransaction=Transaction ID
-BankTransactions=Bank transactions
-ListTransactions=List transactions
-ListTransactionsByCategory=List transaction/category
-TransactionsToConciliate=Transactions to reconcile
+BankTransactions=Bank entries
+ListTransactions=List entries
+ListTransactionsByCategory=List entries/category
+TransactionsToConciliate=Entries to reconcile
Conciliable=Can be reconciled
Conciliate=Reconcile
Conciliation=Reconciliation
+ReconciliationLate=Reconciliation late
IncludeClosedAccount=Include closed accounts
OnlyOpenedAccount=Only open accounts
AccountToCredit=Account to credit
AccountToDebit=Account to debit
DisableConciliation=Disable reconciliation feature for this account
ConciliationDisabled=Reconciliation feature disabled
-LinkedToAConciliatedTransaction=Linked to a conciliated transaction
+LinkedToAConciliatedTransaction=Linked to a conciliated entry
StatusAccountOpened=Open
StatusAccountClosed=Closed
AccountIdShort=Number
LineRecord=Transaction
-AddBankRecord=Add transaction
-AddBankRecordLong=Add transaction manually
+AddBankRecord=Add entry
+AddBankRecordLong=Add entry manually
ConciliatedBy=Reconciled by
DateConciliating=Reconcile date
-BankLineConciliated=Transaction reconciled
+BankLineConciliated=Entry reconciled
Reconciled=Reconciled
NotReconciled=Not reconciled
CustomerInvoicePayment=Customer payment
@@ -107,13 +108,13 @@ BankChecks=Bank checks
BankChecksToReceipt=Checks awaiting deposit
ShowCheckReceipt=Show check deposit receipt
NumberOfCheques=Nb of check
-DeleteTransaction=Delete transaction
-ConfirmDeleteTransaction=Are you sure you want to delete this transaction?
-ThisWillAlsoDeleteBankRecord=This will also delete generated bank transactions
+DeleteTransaction=Delete entry
+ConfirmDeleteTransaction=Are you sure you want to delete this entry?
+ThisWillAlsoDeleteBankRecord=This will also delete generated bank entry
BankMovements=Movements
-PlannedTransactions=Planned transactions
+PlannedTransactions=Planned entries
Graph=Graphics
-ExportDataset_banque_1=Bank transactions and account statement
+ExportDataset_banque_1=Bank entries and account statement
ExportDataset_banque_2=Deposit slip
TransactionOnTheOtherAccount=Transaction on the other account
PaymentNumberUpdateSucceeded=Payment number updated successfully
@@ -121,7 +122,7 @@ PaymentNumberUpdateFailed=Payment number could not be updated
PaymentDateUpdateSucceeded=Payment date updated successfully
PaymentDateUpdateFailed=Payment date could not be updated
Transactions=Transactions
-BankTransactionLine=Bank transaction
+BankTransactionLine=Bank entry
AllAccounts=All bank/cash accounts
BackToAccount=Back to account
ShowAllAccounts=Show for all accounts
diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang
index 3be2772d3c7..777d0d4e805 100644
--- a/htdocs/langs/en_US/bills.lang
+++ b/htdocs/langs/en_US/bills.lang
@@ -421,6 +421,7 @@ ShowUnpaidAll=Show all unpaid invoices
ShowUnpaidLateOnly=Show late unpaid invoices only
PaymentInvoiceRef=Payment invoice %s
ValidateInvoice=Validate invoice
+ValidateInvoices=Validate invoices
Cash=Cash
Reported=Delayed
DisabledBecausePayments=Not possible since there are some payments
@@ -482,4 +483,5 @@ ToCreateARecurringInvoiceGene=To generate future invoices regularly and manually
ToCreateARecurringInvoiceGeneAuto=If you need to have such invoices generated automatically, ask you administrator to enable and setup module %s . Note that both method (manual and automatic) can be used together with no risk of duplication.
DeleteRepeatableInvoice=Delete template invoice
ConfirmDeleteRepeatableInvoice=Are your sure you want to delete the template invoice?
-
+CreateOneBillByThird=Create one bill by third
+BillCreated=%s bill(s) created
\ No newline at end of file
diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang
index 3872a36a2ae..e77b53db26f 100644
--- a/htdocs/langs/en_US/companies.lang
+++ b/htdocs/langs/en_US/companies.lang
@@ -271,7 +271,7 @@ DefaultContact=Default contact/address
AddThirdParty=Create third party
DeleteACompany=Delete a company
PersonalInformations=Personal data
-AccountancyCode=Accountancy code
+AccountancyCode=Accounting account
CustomerCode=Customer code
SupplierCode=Supplier code
CustomerCodeShort=Customer code
diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang
index 00b151620fb..1ccb3d5e458 100644
--- a/htdocs/langs/en_US/errors.lang
+++ b/htdocs/langs/en_US/errors.lang
@@ -69,7 +69,7 @@ ErrorLDAPSetupNotComplete=Dolibarr-LDAP matching is not complete.
ErrorLDAPMakeManualTest=A .ldif file has been generated in directory %s. Try to load it manually from command line to have more information on errors.
ErrorCantSaveADoneUserWithZeroPercentage=Can't save an action with "statut not started" if field "done by" is also filled.
ErrorRefAlreadyExists=Ref used for creation already exists.
-ErrorPleaseTypeBankTransactionReportName=Please type bank receipt name where transaction is reported (Format YYYYMM or YYYYMMDD)
+ErrorPleaseTypeBankTransactionReportName=Please type bank statement name where entry is reported (Format YYYYMM or YYYYMMDD)
ErrorRecordHasChildren=Failed to delete record since it has some childs.
ErrorRecordIsUsedCantDelete=Can't delete record. It is already used or included into other object.
ErrorModuleRequireJavascript=Javascript must not be disabled to have this feature working. To enable/disable Javascript, go to menu Home->Setup->Display.
@@ -131,7 +131,7 @@ ErrorWarehouseMustDiffers=Source and target warehouses must differs
ErrorBadFormat=Bad format!
ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst=Error, this member is not yet linked to any third party. Link member to an existing third party or create a new third party before creating subscription with invoice.
ErrorThereIsSomeDeliveries=Error, there is some deliveries linked to this shipment. Deletion refused.
-ErrorCantDeletePaymentReconciliated=Can't delete a payment that had generated a bank transaction that was conciliated
+ErrorCantDeletePaymentReconciliated=Can't delete a payment that had generated a bank entry that was reconciled
ErrorCantDeletePaymentSharedWithPayedInvoice=Can't delete a payment shared by at least one invoice with status Payed
ErrorPriceExpression1=Cannot assign to constant '%s'
ErrorPriceExpression2=Cannot redefine built-in function '%s'
@@ -177,6 +177,7 @@ ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enougth for product %s
ErrorFailedToLoadLoginFileForMode=Failed to get the login file for mode '%s'.
ErrorModuleNotFound=File of module was not found.
ErrorFieldAccountNotDefinedForBankLine=Value for Accounting account not defined for source bank line %s
+ErrorBankStatementNameMustFollowRegex=Error, bank statement name must follow the following syntax rule %s
# Warnings
WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.
diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang
index 6be0af4fd1a..336b20bff16 100644
--- a/htdocs/langs/en_US/install.lang
+++ b/htdocs/langs/en_US/install.lang
@@ -175,7 +175,7 @@ MigrationReopeningContracts=Open contract closed by error
MigrationReopenThisContract=Reopen contract %s
MigrationReopenedContractsNumber=%s contracts modified
MigrationReopeningContractsNothingToUpdate=No closed contract to open
-MigrationBankTransfertsUpdate=Update links between bank transaction and a bank transfer
+MigrationBankTransfertsUpdate=Update links between bank entry and a bank transfer
MigrationBankTransfertsNothingToUpdate=All links are up to date
MigrationShipmentOrderMatching=Sendings receipt update
MigrationDeliveryOrderMatching=Delivery receipt update
diff --git a/htdocs/langs/en_US/loan.lang b/htdocs/langs/en_US/loan.lang
index 8c70dfc6fd2..de0a6fd0295 100644
--- a/htdocs/langs/en_US/loan.lang
+++ b/htdocs/langs/en_US/loan.lang
@@ -10,9 +10,9 @@ LoanCapital=Capital
Insurance=Insurance
Interest=Interest
Nbterms=Number of terms
-LoanAccountancyCapitalCode=Accountancy code capital
-LoanAccountancyInsuranceCode=Accountancy code insurance
-LoanAccountancyInterestCode=Accountancy code interest
+LoanAccountancyCapitalCode=Accounting account capital
+LoanAccountancyInsuranceCode=Accounting account insurance
+LoanAccountancyInterestCode=Accounting account interest
ConfirmDeleteLoan=Confirm deleting this loan
LoanDeleted=Loan Deleted Successfully
ConfirmPayLoan=Confirm classify paid this loan
@@ -45,6 +45,6 @@ GoToPrincipal=%s will go towards PRINCIPAL
YouWillSpend=You will spend %s in year %s
# Admin
ConfigLoan=Configuration of the module loan
-LOAN_ACCOUNTING_ACCOUNT_CAPITAL=Accountancy code capital by default
-LOAN_ACCOUNTING_ACCOUNT_INTEREST=Accountancy code interest by default
-LOAN_ACCOUNTING_ACCOUNT_INSURANCE=Accountancy code insurance by default
+LOAN_ACCOUNTING_ACCOUNT_CAPITAL=Accounting account capital by default
+LOAN_ACCOUNTING_ACCOUNT_INTEREST=Accounting account interest by default
+LOAN_ACCOUNTING_ACCOUNT_INSURANCE=Accounting account insurance by default
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index 56639e43127..a3851b89339 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -62,6 +62,7 @@ ErrorCantLoadUserFromDolibarrDatabase=Failed to find user %s in Dolibarr
ErrorNoVATRateDefinedForSellerCountry=Error, no vat rates defined for country '%s'.
ErrorNoSocialContributionForSellerCountry=Error, no social/fiscal taxes type defined for country '%s'.
ErrorFailedToSaveFile=Error, failed to save file.
+ErrorCannotAddThisParentWarehouse=You are trying to add a parent warehouse which is already a child of current one
NotAuthorized=You are not authorized to do that.
SetDate=Set date
SelectDate=Select a date
@@ -705,7 +706,7 @@ PublicUrl=Public URL
AddBox=Add box
SelectElementAndClickRefresh=Select an element and click Refresh
PrintFile=Print File %s
-ShowTransaction=Show transaction on bank account
+ShowTransaction=Show entry on bank account
GoIntoSetupToChangeLogo=Go into Home - Setup - Company to change logo or go into Home - Setup - Display to hide.
Deny=Deny
Denied=Denied
@@ -721,7 +722,7 @@ DeleteLine=Delete line
ConfirmDeleteLine=Are you sure you want to delete this line?
NoPDFAvailableForDocGenAmongChecked=No PDF were available for the document generation among checked records
TooManyRecordForMassAction=Too many record selected for mass action. The action is restricted to a list of %s records.
-NoRecordSelected=No record were selected
+NoRecordSelected=No record selected
MassFilesArea=Area for files built by mass actions
ShowTempMassFilesArea=Show area of files built by mass actions
RelatedObjects=Related Objects
diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang
index d249131a507..c123fed51a5 100644
--- a/htdocs/langs/en_US/members.lang
+++ b/htdocs/langs/en_US/members.lang
@@ -127,8 +127,8 @@ NoThirdPartyAssociatedToMember=No third party associated to this member
MembersAndSubscriptions= Members and Subscriptions
MoreActions=Complementary action on recording
MoreActionsOnSubscription=Complementary action, suggested by default when recording a subscription
-MoreActionBankDirect=Create a direct transaction record on account
-MoreActionBankViaInvoice=Create an invoice and payment on account
+MoreActionBankDirect=Create a direct entry on bank account
+MoreActionBankViaInvoice=Create an invoice, and a payment on bank account
MoreActionInvoiceOnly=Create an invoice with no payment
LinkToGeneratedPages=Generate visit cards
LinkToGeneratedPagesDesc=This screen allows you to generate PDF files with business cards for all your members or a particular member.
diff --git a/htdocs/langs/en_US/multicurrency.lang b/htdocs/langs/en_US/multicurrency.lang
index fc90fe3d78d..805356a2e46 100644
--- a/htdocs/langs/en_US/multicurrency.lang
+++ b/htdocs/langs/en_US/multicurrency.lang
@@ -4,7 +4,7 @@ ErrorAddRateFail=Error in added rate
ErrorAddCurrencyFail=Error in added currency
ErrorDeleteCurrencyFail=Error delete fail
multicurrency_syncronize_error=Error in synchronization
-multicurrency_useOriginTx=When an object is created from another, keep the original rate of source object (otherwise use the new rate entered)
+multicurrency_useOriginTx=When an object is created from another, keep the original rate of source object (otherwise use the new known rate)
CurrencyLayerAccount=CurrencyLayer API
CurrencyLayerAccount_help_to_synchronize=You sould create an account on their website to use this functionnality Get your API key If you use a free account you can't change the currency source (USD by default) But if your main currency isn't USD you can use the alternate currency source to force you main currency You are limited at 1000 synchronizations per month
multicurrency_appId=API key
diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang
index 413e6c80088..d5fa618b1e0 100644
--- a/htdocs/langs/en_US/stocks.lang
+++ b/htdocs/langs/en_US/stocks.lang
@@ -2,6 +2,7 @@
WarehouseCard=Warehouse card
Warehouse=Warehouse
Warehouses=Warehouses
+ParentWarehouse=Parent warehouse
NewWarehouse=New warehouse / Stock area
WarehouseEdit=Modify warehouse
MenuNewWarehouse=New warehouse
diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php
index cedf40678d2..d1fe225ba0e 100644
--- a/htdocs/product/class/html.formproduct.class.php
+++ b/htdocs/product/class/html.formproduct.class.php
@@ -56,15 +56,18 @@ class FormProduct
* @param string $batch Add quantity of batch stock in label for product with batch name batch, batch name precedes batch_id. Nothing if ''.
* @param int $status additional filter on status other then 1
* @param boolean $sumStock sum total stock of a warehouse, default true
+ * @param array $exclude warehouses ids to exclude
* @return int Nb of loaded lines, 0 if already loaded, <0 if KO
*/
- function loadWarehouses($fk_product=0, $batch = '', $status=null, $sumStock = true)
+ function loadWarehouses($fk_product=0, $batch = '', $status=null, $sumStock = true, $exclude='')
{
global $conf, $langs;
if (empty($fk_product) && count($this->cache_warehouses)) return 0; // Cache already loaded and we do not want a list with information specific to a product
-
- $sql = "SELECT e.rowid, e.label, e.description";
+
+ if (is_array($exclude)) $excludeGroups = implode("','",$exclude);
+
+ $sql = "SELECT e.rowid, e.label, e.description, e.fk_parent";
if (!empty($fk_product))
{
if (!empty($batch))
@@ -100,6 +103,8 @@ class FormProduct
$sql.= " AND e.statut = 1";
}
+ if(!empty($exclude)) $sql.= ' AND e.rowid NOT IN('.implode(',', $exclude).')';
+
if ($sumStock && empty($fk_product)) $sql.= " GROUP BY e.rowid, e.label, e.description";
$sql.= " ORDER BY e.label";
@@ -115,10 +120,17 @@ class FormProduct
if ($sumStock) $obj->stock = price2num($obj->stock,5);
$this->cache_warehouses[$obj->rowid]['id'] =$obj->rowid;
$this->cache_warehouses[$obj->rowid]['label']=$obj->label;
+ $this->cache_warehouses[$obj->rowid]['parent_id']=$obj->fk_parent;
$this->cache_warehouses[$obj->rowid]['description'] = $obj->description;
$this->cache_warehouses[$obj->rowid]['stock'] = $obj->stock;
$i++;
}
+
+ // Full label init
+ foreach($this->cache_warehouses as $obj_rowid=>$tab) {
+ $this->cache_warehouses[$obj_rowid]['full_label'] = $this->get_parent_path($tab);
+ }
+
return $num;
}
else
@@ -127,6 +139,29 @@ class FormProduct
return -1;
}
}
+
+ /**
+ * Return full path to current warehouse in $tab (recursive function)
+ *
+ * @param array $tab warehouse data in $this->cache_warehouses line
+ * @param String $final_label full label with all parents, separated by ' >> ' (completed on each call)
+ * @return String full label with all parents, separated by ' >> '
+ */
+ private function get_parent_path($tab, $final_label='') {
+
+ if(empty($final_label)) $final_label = $tab['label'];
+
+ if(empty($tab['parent_id'])) return $final_label;
+ else {
+ if(!empty($this->cache_warehouses[$tab['parent_id']])) {
+ $final_label = $this->cache_warehouses[$tab['parent_id']]['label'].' >> '.$final_label;
+ return $this->get_parent_path($this->cache_warehouses[$tab['parent_id']], $final_label);
+ }
+ }
+
+ return $final_label;
+
+ }
/**
* Return list of warehouses
@@ -142,9 +177,10 @@ class FormProduct
* @param int $forcecombo force combo iso ajax select2
* @param array $events events to add to select2
* @param string $morecss Add more css classes
+ * @param array $exclude warehouses ids to exclude
* @return string HTML select
*/
- function selectWarehouses($selected='',$htmlname='idwarehouse',$filtertype='',$empty=0,$disabled=0,$fk_product=0,$empty_label='', $showstock=0, $forcecombo=0, $events=array(), $morecss='minwidth200')
+ function selectWarehouses($selected='',$htmlname='idwarehouse',$filtertype='',$empty=0,$disabled=0,$fk_product=0,$empty_label='', $showstock=0, $forcecombo=0, $events=array(), $morecss='minwidth200', $exclude='')
{
global $conf,$langs,$user;
@@ -152,7 +188,7 @@ class FormProduct
$out='';
- $this->loadWarehouses($fk_product, '', + $filtertype); // filter on numeric status
+ $this->loadWarehouses($fk_product, '', + $filtertype, true, $exclude); // filter on numeric status
$nbofwarehouses=count($this->cache_warehouses);
if ($conf->use_javascript_ajax && ! $forcecombo)
@@ -170,7 +206,7 @@ class FormProduct
$out.='';
- $out.=$arraytypes['label'];
+ $out.=$arraytypes['full_label'];
if (($fk_product || ($showstock > 0)) && ($arraytypes['stock'] != 0 || ($showstock > 0))) $out.=' ('.$langs->trans("Stock").':'.$arraytypes['stock'].')';
$out.=' ';
}
diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php
index 60f7938de06..5adff357db1 100644
--- a/htdocs/product/stock/card.php
+++ b/htdocs/product/stock/card.php
@@ -31,10 +31,12 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
+require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$langs->load("products");
$langs->load("stocks");
$langs->load("companies");
+$langs->load("categories");
$action=GETPOST('action');
$cancel=GETPOST('cancel');
@@ -64,6 +66,7 @@ $object = new Entrepot($db);
if ($action == 'add' && $user->rights->stock->creer)
{
$object->ref = GETPOST("ref");
+ $object->fk_parent = GETPOST("fk_parent");
$object->libelle = GETPOST("libelle");
$object->description = GETPOST("desc");
$object->statut = GETPOST("statut");
@@ -128,6 +131,7 @@ if ($action == 'update' && $cancel <> $langs->trans("Cancel"))
if ($object->fetch($id))
{
$object->libelle = GETPOST("libelle");
+ $object->fk_parent = GETPOST("fk_parent");
$object->description = GETPOST("desc");
$object->statut = GETPOST("statut");
$object->lieu = GETPOST("lieu");
@@ -166,6 +170,7 @@ if ($cancel == $langs->trans("Cancel"))
$productstatic=new Product($db);
$form=new Form($db);
+$formproduct=new FormProduct($db);
$formcompany=new FormCompany($db);
$help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
@@ -189,6 +194,11 @@ if ($action == 'create')
print ''.$langs->trans("Ref").' ';
print ''.$langs->trans("LocationSummary").' ';
+
+ // Parent entrepot
+ print ''.$langs->trans("AddIn").' ';
+ print $formproduct->selectWarehouses('', 'fk_parent', '', 1);
+ print ' ';
// Description
print ''.$langs->trans("Description").' ';
@@ -346,6 +356,16 @@ else
//print ' '.$langs->trans("LocationSummary").' '.$object->lieu.' ';
+ // Parent entrepot
+ $e = new Entrepot($db);
+ if(!empty($object->fk_parent) && $e->fetch($object->fk_parent) > 0) {
+
+ print ''.$langs->trans("ParentWarehouse").' ';
+ print $e->getNomUrl(3);
+ print ' ';
+
+ }
+
// Description
print ''.$langs->trans("Description").' '.nl2br($object->description).' ';
@@ -623,6 +643,11 @@ else
print ''.$langs->trans("Ref").' ';
print ''.$langs->trans("LocationSummary").' ';
+
+ // Parent entrepot
+ print ''.$langs->trans("AddIn").' ';
+ print $formproduct->selectWarehouses($object->fk_parent, 'fk_parent', '', 1);
+ print ' ';
// Description
print ''.$langs->trans("Description").' ';
diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php
index aee38a67ccf..032a0f3a56d 100644
--- a/htdocs/product/stock/class/entrepot.class.php
+++ b/htdocs/product/stock/class/entrepot.class.php
@@ -123,8 +123,8 @@ class Entrepot extends CommonObject
$this->db->begin();
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot (entity, datec, fk_user_author, label)";
- $sql .= " VALUES (".$conf->entity.",'".$this->db->idate($now)."',".$user->id.",'".$this->db->escape($this->libelle)."')";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot (entity, datec, fk_user_author, label, fk_parent)";
+ $sql .= " VALUES (".$conf->entity.",'".$this->db->idate($now)."',".$user->id.",'".$this->db->escape($this->libelle)."', ".($this->fk_parent > 0 ? $this->fk_parent : 'NULL').")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$result=$this->db->query($sql);
@@ -172,6 +172,16 @@ class Entrepot extends CommonObject
*/
function update($id, $user)
{
+ // Check if new parent is already a child of current warehouse
+ if(!empty($this->fk_parent)) {
+ $TChildWarehouses = array($id);
+ $TChildWarehouses = $this->get_children_warehouses($this->id, $TChildWarehouses);
+ if(in_array($this->fk_parent, $TChildWarehouses)) {
+ $this->error = 'ErrorCannotAddThisParentWarehouse';
+ return -2;
+ }
+ }
+
$this->libelle=trim($this->libelle);
$this->description=trim($this->description);
@@ -184,6 +194,7 @@ class Entrepot extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."entrepot ";
$sql .= " SET label = '" . $this->db->escape($this->libelle) ."'";
+ $sql .= ", fk_parent = '" . (($this->fk_parent > 0) ? $this->fk_parent : 'NULL') ."'";
$sql .= ", description = '" . $this->db->escape($this->description) ."'";
$sql .= ", statut = " . $this->statut;
$sql .= ", lieu = '" . $this->db->escape($this->lieu) ."'";
@@ -294,7 +305,7 @@ class Entrepot extends CommonObject
{
global $conf;
- $sql = "SELECT rowid, label, description, statut, lieu, address, zip, town, fk_pays as country_id";
+ $sql = "SELECT rowid, fk_parent, label, description, statut, lieu, address, zip, town, fk_pays as country_id";
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot";
if ($id)
@@ -317,6 +328,7 @@ class Entrepot extends CommonObject
$obj=$this->db->fetch_object($result);
$this->id = $obj->rowid;
+ $this->fk_parent = $obj->fk_parent;
$this->ref = $obj->rowid;
$this->libelle = $obj->label;
$this->description = $obj->description;
@@ -573,7 +585,7 @@ class Entrepot extends CommonObject
$linkend='';
if ($withpicto) $result.=($link.img_object($label, 'stock', 'class="classfortooltip"').$linkend.' ');
- $result.=$link.(empty($this->label)?$this->libelle:$this->label).$linkend;
+ $result.=$link.$this->get_full_arbo().$linkend;
return $result;
}
@@ -604,4 +616,69 @@ class Entrepot extends CommonObject
$this->country_id=1;
$this->country_code='FR';
}
+
+ /**
+ * Return full path to current warehouse
+ *
+ * @param int $protection Deep counter to avoid infinite loop
+ * @return string String full path to current warehouse separated by " >> "
+ */
+ function get_full_arbo($protection=1000) {
+
+ global $user,$langs,$conf;
+
+ $TArbo = array($this->libelle);
+
+ $id = $this->id;
+
+ $i=0;
+
+ while((empty($protection) || $i < $protection)) {
+ $sql = 'SELECT fk_parent
+ FROM '.MAIN_DB_PREFIX.'entrepot
+ WHERE rowid = '.$id;
+
+ $resql = $this->db->query($sql);
+ if($resql) {
+ $res = $this->db->fetch_object($resql);
+ if(empty($res->fk_parent)) break;
+ $id = $res->fk_parent;
+ $o = new Entrepot($this->db);
+ $o->fetch($id);
+ $TArbo[] = $o->libelle;
+ } else break;
+
+ $i++;
+
+ }
+
+ return implode(' >> ', array_reverse($TArbo));
+
+ }
+
+ /**
+ * Return array of children warehouses ids from $id warehouse (recursive function)
+ *
+ * @param int $id id parent warehouse
+ * @param array() $TChildWarehouses array which will contain all children (param by reference)
+ * @return array() $TChildWarehouses array which will contain all children
+ */
+ function get_children_warehouses($id, &$TChildWarehouses) {
+
+ $sql = 'SELECT rowid
+ FROM '.MAIN_DB_PREFIX.'entrepot
+ WHERE fk_parent = '.$id;
+
+ $resql = $this->db->query($sql);
+ if($resql) {
+ while($res = $this->db->fetch_object($resql)) {
+ $TChildWarehouses[] = $res->rowid;
+ $this->get_children_warehouses($res->rowid, $TChildWarehouses);
+ }
+ }
+
+ return $TChildWarehouses;
+
+ }
+
}
diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php
index cc3a97fac5b..5817f44db65 100644
--- a/htdocs/projet/card.php
+++ b/htdocs/projet/card.php
@@ -970,7 +970,16 @@ else
{
if ($action != "edit" )
{
- // Modify
+
+ // Create event
+ if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a
+ // "workflow" action so should appears somewhere else on
+ // page.
+ {
+ print '';
+ }
+
+ // Modify
if ($object->statut != 2 && $user->rights->projet->creer)
{
if ($userWrite > 0)
diff --git a/htdocs/resource/add.php b/htdocs/resource/add.php
index 7608e1b6cf3..7c60bf8091d 100644
--- a/htdocs/resource/add.php
+++ b/htdocs/resource/add.php
@@ -27,6 +27,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
// Load traductions files required by page
$langs->load("resource");
@@ -60,6 +61,11 @@ if ($user->societe_id > 0)
$object = new DolResource($db);
+$extrafields = new ExtraFields($db);
+
+// fetch optionals attributes and labels
+$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
+
if ($action == 'confirm_add_resource')
{
if (! $cancel)
@@ -84,6 +90,12 @@ if ($action == 'confirm_add_resource')
$object->description=$description;
$object->fk_code_type_resource=$fk_code_type_resource;
+ // Fill array 'array_options' with data from add form
+ $ret = $extrafields->setOptionalsFromPost($extralabels, $object);
+ if ($ret < 0) {
+ $error ++;
+ }
+
$result=$object->create($user);
if ($result > 0)
{
@@ -162,6 +174,15 @@ if (! $action)
print ' ';
print ' ';
+ // Other attributes
+ $parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"');
+ $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
+ if (empty($reshook) && ! empty($extrafields->attribute_label))
+ {
+ print $object->showOptionals($extrafields,'edit');
+ }
+
+
print '
';
dol_fiche_end('');
diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php
index 95f5cf0574b..d2ec14efd71 100644
--- a/htdocs/resource/card.php
+++ b/htdocs/resource/card.php
@@ -29,9 +29,10 @@ if (! $res) $res=@include("../../main.inc.php"); // For "custom" directory
if (! $res) die("Include of main fails");
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
-require_once 'class/dolresource.class.php';
-require_once 'class/html.formresource.class.php';
+require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
+require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
// Load traductions files requiredby by page
$langs->load("resource");
@@ -58,6 +59,11 @@ if( ! $user->rights->resource->read)
$object = new Dolresource($db);
+$extrafields = new ExtraFields($db);
+
+// fetch optionals attributes and labels
+$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
+
$hookmanager->initHooks(array('resource_card','globalcard'));
$parameters=array('resource_id'=>$id);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
@@ -88,6 +94,12 @@ if (empty($reshook))
$object->description = $description;
$object->fk_code_type_resource = $fk_code_type_resource;
+ // Fill array 'array_options' with data from add form
+ $ret = $extrafields->setOptionalsFromPost($extralabels, $object);
+ if ($ret < 0) {
+ $error ++;
+ }
+
$result=$object->update($user);
if ($result > 0)
{
@@ -126,7 +138,7 @@ if (empty($reshook))
Header('Location: '.DOL_URL_ROOT.'/resource/list.php');
exit;
}
- else
+ else
{
setEventMessages($object->error, $object->errors, 'errors');
}
@@ -188,6 +200,14 @@ if ( $object->fetch($id) > 0 )
print '';
print ' ';
+ // Other attributes
+ $parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"');
+ $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
+ if (empty($reshook) && ! empty($extrafields->attribute_label))
+ {
+ print $object->showOptionals($extrafields,'edit');
+ }
+
print '