diff --git a/htdocs/admin/order_extrafields.php b/htdocs/admin/order_extrafields.php
index f81b3cc1e69..eba9fd76ff6 100644
--- a/htdocs/admin/order_extrafields.php
+++ b/htdocs/admin/order_extrafields.php
@@ -70,7 +70,6 @@ llxHeader('', $langs->trans("OrdersSetup"));
$linkback=''.$langs->trans("BackToModuleList").'';
print load_fiche_titre($langs->trans("OrdersSetup"), $linkback, 'title_setup');
-print "
\n";
$head = order_admin_prepare_head();
diff --git a/htdocs/admin/orderdet_extrafields.php b/htdocs/admin/orderdet_extrafields.php
index 2b239de0932..9204bbc251c 100644
--- a/htdocs/admin/orderdet_extrafields.php
+++ b/htdocs/admin/orderdet_extrafields.php
@@ -71,7 +71,6 @@ llxHeader('', $langs->trans("OrdersSetup"));
$linkback=''.$langs->trans("BackToModuleList").'';
print load_fiche_titre($langs->trans("OrdersSetup"), $linkback, 'title_setup');
-print "
\n";
$head = order_admin_prepare_head();
diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php
index 8fcd6ce1274..0183ffb004a 100644
--- a/htdocs/bom/class/bom.class.php
+++ b/htdocs/bom/class/bom.class.php
@@ -47,7 +47,7 @@ class BOM extends CommonObject
public $ismultientitymanaged = 1;
/**
- * @var int Does bom support extrafields ? 0=No, 1=Yes
+ * @var int Does object support extrafields ? 0=No, 1=Yes
*/
public $isextrafieldmanaged = 1;
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 791c4872794..778f00fbf31 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -722,6 +722,7 @@ class Propal extends CommonObject
$localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
// Clean vat code
+ $reg = array();
$vat_src_code = '';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
@@ -757,7 +758,7 @@ class Propal extends CommonObject
//Fetch current line from the database and then clone the object and set it in $oldline property
$line = new PropaleLigne($this->db);
$line->fetch($rowid);
- $line->fetch_optionals(); // Fetch extrafields for oldcopy
+ $line->fetch_optionals();
$staticline = clone $line;
@@ -808,7 +809,10 @@ class Propal extends CommonObject
$this->line->remise = $remise;
if (is_array($array_options) && count($array_options) > 0) {
- $this->line->array_options = $array_options;
+ // We replace values in this->line->array_options only for entries defined into $array_options
+ foreach($array_options as $key => $value) {
+ $this->line->array_options[$key] = $array_options[$key];
+ }
}
// Multicurrency
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 337a6696b3c..1d8c5bb0f30 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -3074,6 +3074,7 @@ class Commande extends CommonOrder
//Fetch current line from the database and then clone the object and set it in $oldline property
$line = new OrderLine($this->db);
$line->fetch($rowid);
+ $line->fetch_optionals();
if (!empty($line->fk_product))
{
@@ -3146,7 +3147,10 @@ class Commande extends CommonOrder
$this->line->remise = $remise;
if (is_array($array_options) && count($array_options) > 0) {
- $this->line->array_options = $array_options;
+ // We replace values in this->line->array_options only for entries defined into $array_options
+ foreach($array_options as $key => $value) {
+ $this->line->array_options[$key] = $array_options[$key];
+ }
}
$result = $this->line->update($user, $notrigger);
diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php
index 0a7e2fa2d17..4c60434619a 100644
--- a/htdocs/compta/cashcontrol/cashcontrol_card.php
+++ b/htdocs/compta/cashcontrol/cashcontrol_card.php
@@ -56,7 +56,7 @@ if (!$sortfield) $sortfield = 'rowid';
if (!$sortorder) $sortorder = 'ASC';
// Security check
-if (!$user->rights->cashdesk->use && !$user->rights->takepos->use)
+if (!$user->rights->cashdesk->run && !$user->rights->takepos->run)
{
accessforbidden();
}
@@ -82,8 +82,8 @@ $hookmanager->initHooks(array('cashcontrolcard', 'globalcard'));
* Actions
*/
-$permissiontoadd = ($user->rights->cashdesk->use || $user->rights->takepos->use);
-$permissiontodelete = ($user->rights->cashdesk->use || $user->rights->takepos->use) || ($permissiontoadd && $object->status == 0);
+$permissiontoadd = ($user->rights->cashdesk->run || $user->rights->takepos->run);
+$permissiontodelete = ($user->rights->cashdesk->run || $user->rights->takepos->run) || ($permissiontoadd && $object->status == 0);
if (empty($backtopage)) $backtopage = dol_buildpath('/compta/cashcontrol/cashcontrol_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
$backurlforlist = dol_buildpath('/compta/cashcontrol/cashcontrol_list.php', 1);
$triggermodname = 'CACHCONTROL_MODIFY'; // Name of trigger action code to execute when we modify record
@@ -544,14 +544,16 @@ if (empty($action) || $action == "view")
print $object->posmodule;
print "";
- print '
| '.$langs->trans($val).' | ';
diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php
index 5bf48189c4a..6c59276d600 100644
--- a/htdocs/compta/cashcontrol/cashcontrol_list.php
+++ b/htdocs/compta/cashcontrol/cashcontrol_list.php
@@ -168,8 +168,8 @@ if (empty($reshook))
// Mass actions
$objectclass = 'CashControl';
$objectlabel = 'CashControl';
- $permissiontoread = ($user->rights->cashdesk->use || $user->rights->takepos->use);
- $permissiontodelete = ($user->rights->cashdesk->use || $user->rights->takepos->use);
+ $permissiontoread = ($user->rights->cashdesk->run || $user->rights->takepos->run);
+ $permissiontodelete = ($user->rights->cashdesk->run || $user->rights->takepos->run);
//$uploaddir = '';
//include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php
index ad792db0826..32f7533b6c3 100644
--- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php
+++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php
@@ -59,7 +59,7 @@ class CashControl extends CommonObject
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>15),
'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>18),
'posmodule' =>array('type'=>'varchar(30)', 'label'=>'Module', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>19),
- 'posnumber' =>array('type'=>'varchar(30)', 'label'=>'CashDesk', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>20),
+ 'posnumber' =>array('type'=>'varchar(30)', 'label'=>'Terminal', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>20, 'css'=>'center'),
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>0, 'position'=>24),
'opening' =>array('type'=>'price', 'label'=>'Opening', 'enabled'=>1, 'visible'=>1, 'position'=>25),
'cash' =>array('type'=>'price', 'label'=>'Cash', 'enabled'=>1, 'visible'=>1, 'position'=>30),
diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php
index 2a2477fce5e..e8aea86681c 100644
--- a/htdocs/compta/cashcontrol/report.php
+++ b/htdocs/compta/cashcontrol/report.php
@@ -33,11 +33,13 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php';
+
+$langs->load("bills");
$id = GETPOST('id', 'int');
$_GET['optioncss']="print";
-include_once 'class/cashcontrol.class.php';
$cashcontrol= new CashControl($db);
$cashcontrol->fetch($id);
@@ -50,7 +52,8 @@ $arrayfields=array(
'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1),
'b.num_chq'=>array('label'=>$langs->trans("Number"), 'checked'=>1),
'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>1),
- 'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
+ 'cp.code'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1),
+ 'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
);
@@ -128,7 +131,6 @@ if ($resql)
$invoicetmp = new Facture($db);
-
print "";
print $langs->trans("InitialBankBalance").' - '.$langs->trans("Cash")." : ".price($cashcontrol->opening);
print "";
@@ -136,13 +138,16 @@ if ($resql)
print '';
print ' '."\n";
+ $param = '';
+
// Fields title
print '';
print_liste_field_titre($arrayfields['b.rowid']['label'], $_SERVER['PHP_SELF'], 'b.rowid', '', $param, '', $sortfield, $sortorder);
- print_liste_field_titre($arrayfields['b.dateo']['label'], $_SERVER['PHP_SELF'], 'b.dateo', '', $param, 'class="left"', $sortfield, $sortorder);
- print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, 'class="right"', $sortfield, $sortorder);
- print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder);
- print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, 'class="right"', $sortfield, $sortorder);
+ print_liste_field_titre($arrayfields['b.dateo']['label'], $_SERVER['PHP_SELF'], 'b.dateo', '', $param, '"', $sortfield, $sortorder, 'center ');
+ print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, '', $sortfield, $sortorder, 'right ');
+ print_liste_field_titre($arrayfields['cp.code']['label'], $_SERVER['PHP_SELF'], 'cp.code', '', $param, '', $sortfield, $sortorder, 'right ');
+ print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, '', $sortfield, $sortorder, 'right ');
+ print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, '', $sortfield, $sortorder, 'right ');
print " \n";
$posconciliatecol = 0;
@@ -151,7 +156,9 @@ if ($resql)
$sign = 1;
$cash=$bank=$cheque=$other=0;
- $totalarray=array();
+ $totalarray = array();
+ $cachebankaccount = array();
+ $amountpertype = array();
while ($i < $num)
{
$objp = $db->fetch_object($resql);
@@ -168,7 +175,9 @@ if ($resql)
$bankaccount = $cachebankaccount[$objp->bankid];
}
- /*if ($first == "yes")
+ $invoicetmp->fetch($objp->facid);
+
+ /*if ($first == "yes")
{
print '';
print '| '.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").' | ';
@@ -181,12 +190,10 @@ if ($resql)
// Ref
print '';
- $invoicetmp->fetch($objp->facid);
print $invoicetmp->getNomUrl(1);
print ' | ';
if (! $i) $totalarray['nbfield']++;
-
// Date ope
print '';
print ''.dol_print_date($db->jdate($objp->do), "day")."";
@@ -197,26 +204,38 @@ if ($resql)
print ' | ';
print $bankaccount->getNomUrl(1);
if ($cashcontrol->posmodule=="takepos"){
- if ($conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$cashcontrol->posnumber}==$bankaccount->id) $cash+=$objp->amount;
- elseif ($conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$cashcontrol->posnumber}==$bankaccount->id) $bank+=$objp->amount;
- elseif ($conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$cashcontrol->posnumber}==$bankaccount->id) $cheque+=$objp->amount;
- else $other+=$objp->amount;
+ $var1 = 'CASHDESK_ID_BANKACCOUNT_CASH'.$cashcontrol->posnumber;
}
else{
- if ($conf->global->CASHDESK_ID_BANKACCOUNT_CASH==$bankaccount->id) $cash+=$objp->amount;
- elseif ($conf->global->CASHDESK_ID_BANKACCOUNT_CB==$bankaccount->id) $bank+=$objp->amount;
- elseif ($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE==$bankaccount->id) $cheque+=$objp->amount;
- else $other+=$objp->amount;
+ $var1 = 'CASHDESK_ID_BANKACCOUNT_CASH';
+ }
+ if ($objp->code == 'CHQ') {
+ $cheque += $objp->amount;
+ } elseif ($objp->code == 'CB') {
+ $bank += $objp->amount;
+ } else {
+ if ($conf->global->$var1 == $bankaccount->id) $cash += $objp->amount;
+ //elseif ($conf->global->$var2 == $bankaccount->id) $bank+=$objp->amount;
+ //elseif ($conf->global->$var3 == $bankaccount->id) $cheque+=$objp->amount;
+ else $other += $objp->amount;
}
print " | \n";
if (! $i) $totalarray['nbfield']++;
- // Debit
+ // Type
+ print '';
+ print $objp->code;
+ if (empty($amountpertype[$objp->code])) $amountpertype[$objp->code] = 0;
+ print " | \n";
+ if (! $i) $totalarray['nbfield']++;
+
+ // Debit
print '';
if ($objp->amount < 0)
{
print price($objp->amount * -1);
$totalarray['val']['totaldebfield'] += $objp->amount;
+ $amountpertype[$objp->code] += $objp->amount;
}
print " | \n";
if (! $i) $totalarray['nbfield']++;
@@ -228,6 +247,7 @@ if ($resql)
{
print price($objp->amount);
$totalarray['val']['totalcredfield'] += $objp->amount;
+ $amountpertype[$objp->code] -= $objp->amount;
}
print "\n";
if (! $i) $totalarray['nbfield']++;
@@ -243,12 +263,34 @@ if ($resql)
print " ";
- $cash=$cash+$cashcontrol->opening;
+ //$cash = $amountpertype['LIQ'] + $cashcontrol->opening;
+ $cash = $cash + $cashcontrol->opening;
+
print " ";
- print $langs->trans("Cash").": ".price($cash)."
";
- print $langs->trans("PaymentTypeCB").": ".price($bank)."
";
- print $langs->trans("PaymentTypeCHQ").": ".price($cheque)."
";
- if ($other) print $langs->trans("Other").": ".price($other)."
";
+ print $langs->trans("Cash").": ".price($cash);
+ if ($cash != $cashcontrol->cash) {
+ print ' <> '.$langs->trans("Declared").': '.price($cashcontrol->cash).'';
+ }
+ print "
";
+
+ //print ' ';
+ print $langs->trans("PaymentTypeCHQ").": ".price($cheque);
+ if ($cheque != $cashcontrol->cheque) {
+ print ' <> '.$langs->trans("Declared").': '.price($cashcontrol->cheque).'';
+ }
+ print "
";
+
+ //print ' ';
+ print $langs->trans("PaymentTypeCB").": ".price($bank);
+ if ($bank != $cashcontrol->card) {
+ print ' <> '.$langs->trans("Declared").': '.price($cashcontrol->card).'';
+ }
+ print "
";
+
+ // print ' ';
+ if ($other) {
+ print ' '.$langs->trans("Other").": ".price($other)."
";
+ }
print "";
//save totals to DB
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 83f9706bcee..4cea8dcad9d 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -3105,6 +3105,7 @@ class Facture extends CommonInvoice
//Fetch current line from the database and then clone the object and set it in $oldline property
$line = new FactureLigne($this->db);
$line->fetch($rowid);
+ $line->fetch_optionals();
if (!empty($line->fk_product))
{
@@ -3173,7 +3174,10 @@ class Facture extends CommonInvoice
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
if (is_array($array_options) && count($array_options) > 0) {
- $this->line->array_options = $array_options;
+ // We replace values in this->line->array_options only for entries defined into $array_options
+ foreach($array_options as $key => $value) {
+ $this->line->array_options[$key] = $array_options[$key];
+ }
}
$result = $this->line->update($user, $notrigger);
diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php
index b7850fb8dc0..0b8a441dea2 100644
--- a/htdocs/compta/prelevement/card.php
+++ b/htdocs/compta/prelevement/card.php
@@ -63,7 +63,7 @@ $object = new BonPrelevement($db, "");
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
-$hookmanager->initHooks(array('directdebitprevcard', 'globalcard'));
+$hookmanager->initHooks(array('directdebitprevcard', 'globalcard', 'directdebitprevlist'));
/*
* Actions
@@ -362,10 +362,19 @@ if ($id > 0 || $ref)
$urladd = "&id=".$id;
- print_barre_liste($langs->trans("Lines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
+ print ' |