diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php
index 74319355350..bc0f22cb136 100644
--- a/htdocs/blockedlog/class/blockedlog.class.php
+++ b/htdocs/blockedlog/class/blockedlog.class.php
@@ -172,6 +172,10 @@ class BlockedLog
if ($conf->banque->enabled) $this->trackedevents['PAYMENT_VARIOUS_CREATE']='logPAYMENT_VARIOUS_CREATE';
if ($conf->banque->enabled) $this->trackedevents['PAYMENT_VARIOUS_MODIFY']='logPAYMENT_VARIOUS_MODIFY';
if ($conf->banque->enabled) $this->trackedevents['PAYMENT_VARIOUS_DELETE']='logPAYMENT_VARIOUS_DELETE';
+
+ // $conf->global->BANK_ENABLE_POS_CASHCONTROL must be set to 1 by all POS modules
+ $moduleposenabled = ($conf->cashdesk->enabled || $conf->takepos->enabled || ! empty($conf->global->BANK_ENABLE_POS_CASHCONTROL));
+ if ($moduleposenabled) $this->trackedevents['CASHCONTROL_VALIDATE']='logCASHCONTROL_VALIDATE';
}
/**
@@ -270,6 +274,17 @@ class BlockedLog
$this->error++;
}
}
+ else if($this->element === 'cashcontrol') {
+ require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php';
+
+ $object = new CashControl($this->db);
+ if ($object->fetch($this->fk_object)>0) {
+ return $object->getNomUrl(1);
+ }
+ else{
+ $this->error++;
+ }
+ }
else if ($this->action == 'MODULE_SET')
{
return 'System to track events into unalterable logs were enabled';
@@ -351,6 +366,10 @@ class BlockedLog
{
$this->date_object = $object->dateh;
}
+ elseif ($object->element=='cashcontrol')
+ {
+ $this->date_object = $object->date_creation;
+ }
else {
$this->date_object = $object->date;
}
@@ -364,7 +383,12 @@ class BlockedLog
// Set object_data
$this->object_data=new stdClass();
- $arrayoffieldstoexclude = array('table_element','fields','ref_previous','ref_next','origin','origin_id','oldcopy','picto','error','modelpdf','table_element_line','linkedObjectsIds','linkedObjects','fk_delivery_address');
+ $arrayoffieldstoexclude = array(
+ 'table_element','fields','ref_previous','ref_next','origin','origin_id','oldcopy','picto','error','errors','modelpdf',
+ 'table_element_line','ismultientitymanaged','isextrafieldmanaged',
+ 'linkedObjectsIds','linkedObjects','fk_delivery_address',
+ 'context'
+ );
// Add thirdparty info
if (empty($object->thirdparty) && method_exists($object, 'fetch_thirdparty')) $object->fetch_thirdparty();
diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php
index e212f8ff75b..11c86e53af3 100644
--- a/htdocs/compta/cashcontrol/cashcontrol_card.php
+++ b/htdocs/compta/cashcontrol/cashcontrol_card.php
@@ -32,8 +32,9 @@ require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php'
$langs->loadLangs(array("cashcontrol","install","cashdesk","admin","banks"));
-$action=GETPOST('action','aZ09');
$id=GETPOST('id','int');
+$ref = GETPOST('ref', 'alpha');
+$action=GETPOST('action','aZ09');
$categid = GETPOST('categid');
$label = GETPOST("label");
@@ -47,9 +48,10 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined,
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if (! $sortfield) $sortfield='b.label';
+if (! $sortfield) $sortfield='rowid';
if (! $sortorder) $sortorder='ASC';
+// Security check
if (! $user->rights->cashdesk->use && ! $user->rights->takepos->use)
{
accessforbidden();
@@ -62,8 +64,14 @@ if (! empty($conf->cashdesk->enabled)) $arrayofposavailable['cashdesk']=$langs->
if (! empty($conf->takepos->enabled)) $arrayofposavailable['takepos']=$langs->trans('TakePOS').' (takepos)';
// TODO Add hook here to allow other POS to add themself
-$cashcontrol= new CashControl($db);
+$object= new CashControl($db);
+$extrafields = new ExtraFields($db);
+// fetch optionals attributes and labels
+$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
+
+// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
+$hookmanager->initHooks(array('cashcontrolcard','globalcard'));
/*
@@ -111,21 +119,21 @@ elseif ($action=="add")
}
else
{
- $cashcontrol->$key = price2num(GETPOST($key,'alpha'));
+ $object->$key = price2num(GETPOST($key,'alpha'));
}
}
if (! $error)
{
- $cashcontrol->day_close = GETPOST('closeday', 'int');
- $cashcontrol->month_close = GETPOST('closemonth', 'int');
- $cashcontrol->year_close = GETPOST('closeyear', 'int');
+ $object->day_close = GETPOST('closeday', 'int');
+ $object->month_close = GETPOST('closemonth', 'int');
+ $object->year_close = GETPOST('closeyear', 'int');
- $cashcontrol->opening=price2num(GETPOST('opening','alpha'));
- $cashcontrol->posmodule=GETPOST('posmodule','alpha');
- $cashcontrol->posnumber=GETPOST('posnumber','alpha');
+ $object->opening=price2num(GETPOST('opening','alpha'));
+ $object->posmodule=GETPOST('posmodule','alpha');
+ $object->posnumber=GETPOST('posnumber','alpha');
- $id=$cashcontrol->create($user);
+ $id=$object->create($user);
$action="view";
}
@@ -133,12 +141,29 @@ elseif ($action=="add")
if ($action=="close")
{
- $cashcontrol= new CashControl($db);
- $cashcontrol->id=$id;
- $cashcontrol->valid($user);
- $action="view";
+ $object->fetch($id);
+
+ $result = $object->valid($user);
+ if ($result <= 0)
+ {
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+ else
+ {
+ setEventMessages($langs->trans("CashFenceDone"), null);
+ }
+
+ $action="view";
}
+
+
+/*
+ * View
+ */
+
+$form=new Form($db);
+
if ($action=="create" || $action=="start")
{
llxHeader();
@@ -260,40 +285,48 @@ if ($action=="create" || $action=="start")
if (empty($action) || $action=="view")
{
- $cashcontrol= new CashControl($db);
- $cashcontrol->fetch($id);
- llxHeader();
- print load_fiche_titre($langs->trans("CashControl"), '', 'title_bank.png');
+ $object->fetch($id);
+
+ llxHeader('', $langs->trans("CashControl"));
+
+ $head=array();
+ $head[0][0] = DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card.php?id='.$object->id;
+ $head[0][1] = $langs->trans("Card");
+ $head[0][2] = 'cashcontrol';
+
+ dol_fiche_head($head, 'cashcontrol', $langs->trans("CashControl"), -1, 'cashcontrol');
+
+ $linkback = '' . $langs->trans("BackToList") . '';
+
+ $morehtmlref='
';
print '
';
print '
';
print '
';
- print '| ';
+ print ' |
| ';
print $langs->trans("Ref");
print ' | ';
print $id;
print ' |
';
print '| '.$langs->trans("Module").' | ';
- print $cashcontrol->posmodule;
+ print $object->posmodule;
print " |
";
- print '| '.$langs->trans("InitialBankBalance").' | ';
- print price($cashcontrol->opening);
+ print ' |
| '.$langs->trans("CashDesk").' ID | ';
+ print $object->posnumber;
print " |
";
print '| ';
- print $langs->trans("DateEnd");
+ print $langs->trans("Period");
print ' | ';
- print $cashcontrol->year_close."-".$cashcontrol->month_close."-".$cashcontrol->day_close;
- print ' |
';
-
- print '| ';
- print $langs->trans("Status");
- print ' | ';
- if ($cashcontrol->status==1) print $langs->trans("Opened");
- if ($cashcontrol->status==2) print $langs->trans("Closed");
+ print $object->year_close."-".$object->month_close."-".$object->day_close;
print ' |
';
print '
';
@@ -303,15 +336,26 @@ if (empty($action) || $action=="view")
print '
';
print '
';
- print '| ';
+ print ' |
| ';
print $langs->trans("DateCreationShort");
print ' | ';
- print dol_print_date($cashcontrol->date_creation, 'dayhour');
+ print dol_print_date($object->date_creation, 'dayhour');
print ' |
';
- print '| '.$langs->trans("CashDesk").' ID | ';
- print $cashcontrol->posnumber;
+ print ' |
| '.$langs->trans("InitialBankBalance").' | ';
+ print price($object->opening, 0, $langs, 1, -1, -1, $conf->currency);
+ print " |
";
+
+ print '| '.$langs->trans("Cash").' | ';
+ print price($object->cash, 0, $langs, 1, -1, -1, $conf->currency);
print " |
";
+ print '| '.$langs->trans("Cheque").' | ';
+ print price($object->cheque, 0, $langs, 1, -1, -1, $conf->currency);
+ print " |
";
+ print '| '.$langs->trans("Card").' | ';
+ print price($object->card, 0, $langs, 1, -1, -1, $conf->currency);
+ print " |
";
+
print "
\n";
print '
';
@@ -322,7 +366,10 @@ if (empty($action) || $action=="view")
print '
';
print '
';
- if ($cashcontrol->status==1) print '
';
+ if ($object->status == CashControl::STATUS_DRAFT)
+ {
+ print '
';
+ }
print '
';
print '
';
diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php
index 37f73f6712f..0acb9c0dd82 100644
--- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php
+++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php
@@ -32,7 +32,7 @@ class CashControl extends CommonObject
/**
* @var string ID to identify managed object
*/
- public $element = 'CashControl';
+ public $element = 'cashcontrol';
/**
* @var string Name of table without prefix where object is stored
@@ -55,29 +55,29 @@ class CashControl extends CommonObject
public $picto = 'bank';
public $fields=array(
- 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>10),
- '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, 'notnul'=>1, 'position'=>19),
- 'posnumber' =>array('type'=>'varchar(30)', 'label'=>'CashDesk', 'enabled'=>1, 'visible'=>1, 'notnul'=>1, 'position'=>20),
- 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>0, 'position'=>24),
- 'opening' =>array('type'=>'double(24,8)', 'label'=>'Opening', 'enabled'=>1, 'visible'=>1, 'position'=>25),
- 'cash' =>array('type'=>'double(24,8)', 'label'=>'Cash', 'enabled'=>1, 'visible'=>1, 'position'=>30),
- 'cheque' =>array('type'=>'double(24,8)', 'label'=>'Cheque', 'enabled'=>1, 'visible'=>1, 'position'=>33),
- 'card' =>array('type'=>'double(24,8)', 'label'=>'CreditCard', 'enabled'=>1, 'visible'=>1, 'position'=>36),
- 'year_close' =>array('type'=>'integer', 'label'=>'Year close', 'enabled'=>1, 'visible'=>1, 'notnul'=>1, 'position'=>50),
- 'month_close' =>array('type'=>'integer', 'label'=>'Month close', 'enabled'=>1, 'visible'=>1, 'position'=>55),
- 'day_close' =>array('type'=>'integer', 'label'=>'Day close', 'enabled'=>1, 'visible'=>1, 'position'=>60),
- 'date_creation' =>array('type'=>'datetime', 'label'=>'Date creation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
- 'tms' =>array('type'=>'timestamp', 'label'=>'Tms', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>505),
- 'import_key' =>array('type'=>'varchar(14)', 'label'=>'Import key', 'enabled'=>1, 'visible'=>0, 'position'=>510),
- 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated')),
+ 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>10),
+ '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, 'notnul'=>1, 'position'=>19),
+ 'posnumber' =>array('type'=>'varchar(30)', 'label'=>'CashDesk', 'enabled'=>1, 'visible'=>1, 'notnul'=>1, 'position'=>20),
+ 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>0, 'position'=>24),
+ 'opening' =>array('type'=>'double(24,8)', 'label'=>'Opening', 'enabled'=>1, 'visible'=>1, 'position'=>25),
+ 'cash' =>array('type'=>'double(24,8)', 'label'=>'Cash', 'enabled'=>1, 'visible'=>1, 'position'=>30),
+ 'cheque' =>array('type'=>'double(24,8)', 'label'=>'Cheque', 'enabled'=>1, 'visible'=>1, 'position'=>33),
+ 'card' =>array('type'=>'double(24,8)', 'label'=>'CreditCard', 'enabled'=>1, 'visible'=>1, 'position'=>36),
+ 'year_close' =>array('type'=>'integer', 'label'=>'Year close', 'enabled'=>1, 'visible'=>1, 'notnul'=>1, 'position'=>50),
+ 'month_close' =>array('type'=>'integer', 'label'=>'Month close', 'enabled'=>1, 'visible'=>1, 'position'=>55),
+ 'day_close' =>array('type'=>'integer', 'label'=>'Day close', 'enabled'=>1, 'visible'=>1, 'position'=>60),
+ 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValid', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>490),
+ 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
+ 'tms' =>array('type'=>'timestamp', 'label'=>'Tms', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>505),
+ 'import_key' =>array('type'=>'varchar(14)', 'label'=>'Import key', 'enabled'=>1, 'visible'=>0, 'position'=>510),
+ 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated')),
);
public $id;
public $opening;
public $status;
- public $date_creation;
public $year_close;
public $month_close;
public $day_close;
@@ -86,9 +86,12 @@ class CashControl extends CommonObject
public $cash;
public $cheque;
public $card;
+ public $date_valid;
+ public $date_creation;
+ public $date_modification;
const STATUS_DRAFT = 0;
- const STATUS_VALIDATE = 1;
+ const STATUS_VALIDATED = 1;
/**
@@ -125,7 +128,7 @@ class CashControl extends CommonObject
$sql .= "entity";
//$sql .= ", ref";
$sql .= ", opening";
- $sql .= ", status";
+ $sql .= ", status";
$sql .= ", date_creation";
$sql .= ", posmodule";
$sql .= ", posnumber";
@@ -139,7 +142,7 @@ class CashControl extends CommonObject
//$sql .= "'(PROV)', ";
$sql .= $conf->entity;
$sql .= ", ".($this->opening > 0 ? $this->opening : 0);
- $sql .= ", 0"; // Draft by default
+ $sql .= ", 0"; // Draft by default
$sql .= ", '".$this->db->idate(dol_now())."'";
$sql .= ", '".$this->db->escape($this->posmodule)."'";
$sql .= ", '".$this->db->escape($this->posnumber)."'";
@@ -203,14 +206,14 @@ class CashControl extends CommonObject
}
/*
- $posmodule = $this->posmodule;
- if (! empty($user->rights->$posmodule->use))
- {
- $this->error='NotEnoughPermissions';
- dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
- return -1;
- }
- */
+ $posmodule = $this->posmodule;
+ if (! empty($user->rights->$posmodule->use))
+ {
+ $this->error='NotEnoughPermissions';
+ dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
+ return -1;
+ }
+ */
$now=dol_now();
@@ -231,13 +234,13 @@ class CashControl extends CommonObject
}
if (!$error) {
- $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."pos_cash_fence");
+ $this->status = self::STATUS_VALIDATED;
+ $this->date_valid = $now;
+ $this->fk_user_valid = $user->id;
}
if (! $error && ! $notrigger)
{
- $this->context=array('date_valid'=>$now);
-
// Call trigger
$result=$this->call_trigger('CASHCONTROL_VALIDATE', $user);
if ($result < 0) $error++;
@@ -260,49 +263,85 @@ class CashControl extends CommonObject
/**
- * Load object in memory from database
+ * Load object in memory from the database
*
- * @param int $id Id object
- * @return int <0 if KO, >0 if OK
+ * @param int $id Id object
+ * @param string $ref Ref
+ * @return int <0 if KO, 0 if not found, >0 if OK
*/
- public function fetch($id)
+ public function fetch($id, $ref = null)
{
- global $conf;
-
- $sql = "SELECT";
- $sql .= " *";
- $sql .= " FROM ".MAIN_DB_PREFIX."pos_cash_fence";
- $sql .= " WHERE rowid = ".$id;
- $sql .= " AND entity = ".$conf->entity;
-
- dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
- $resql = $this->db->query($sql);
- if ($resql) {
- if ($this->db->num_rows($resql)) {
- $obj = $this->db->fetch_object($resql);
- $this->ref = $obj->id;
- $this->label = $obj->label;
- $this->opening = $obj->opening;
- $this->status = $obj->status;
- $this->year_close = $obj->year_close;
- $this->month_close = $obj->month_close;
- $this->day_close = $obj->day_close;
- $this->posmodule = $obj->posmodule;
- $this->posnumber = $obj->posnumber;
- $this->date_creation = $obj->date_creation;
- $this->tms = $obj->tms;
- $this->id=$id;
- }
- $this->db->free($resql);
-
- return 1;
- } else {
- $this->error = "Error ".$this->db->lasterror();
- return -1;
- }
+ $result = $this->fetchCommon($id, $ref);
+ if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines();
+ return $result;
}
+ /**
+ * Return label of the status
+ *
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
+ */
+ public function getLibStatut($mode=0)
+ {
+ return $this->LibStatut($this->status, $mode);
+ }
+
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return the status
+ *
+ * @param int $status Id status
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
+ */
+ public function LibStatut($status, $mode=0)
+ {
+ // phpcs:enable
+ if (empty($this->labelstatus))
+ {
+ global $langs;
+ //$langs->load("mymodule");
+ $this->labelstatus[0] = $langs->trans('Draft');
+ $this->labelstatus[1] = $langs->trans('Closed');
+ }
+
+ if ($mode == 0)
+ {
+ return $this->labelstatus[$status];
+ }
+ elseif ($mode == 1)
+ {
+ return $this->labelstatus[$status];
+ }
+ elseif ($mode == 2)
+ {
+ if ($status == 1) return img_picto($this->labelstatus[$status],'statut6', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
+ elseif ($status == 0) return img_picto($this->labelstatus[$status],'statut0', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
+ }
+ elseif ($mode == 3)
+ {
+ if ($status == 1) return img_picto($this->labelstatus[$status],'statut6', '', false, 0, 0, '', 'valignmiddle');
+ elseif ($status == 0) return img_picto($this->labelstatus[$status],'statut0', '', false, 0, 0, '', 'valignmiddle');
+ }
+ elseif ($mode == 4)
+ {
+ if ($status == 1) return img_picto($this->labelstatus[$status],'statut6', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
+ elseif ($status == 0) return img_picto($this->labelstatus[$status],'statut0', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
+ }
+ elseif ($mode == 5)
+ {
+ if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut6', '', false, 0, 0, '', 'valignmiddle');
+ elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut0', '', false, 0, 0, '', 'valignmiddle');
+ }
+ elseif ($mode == 6)
+ {
+ if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut6', '', false, 0, 0, '', 'valignmiddle');
+ elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut0', '', false, 0, 0, '', 'valignmiddle');
+ }
+ }
+
/**
* Return clicable link of object (with eventually picto)
*
@@ -310,7 +349,7 @@ class CashControl extends CommonObject
* @param string $option Where point the link ('stock', 'composition', 'category', 'supplier', '')
* @param int $maxlength Maxlength of ref
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
- * @param int $notooltip No tooltip
+ * @param int $notooltip No tooltip
* @return string String with URL
*/
public function getNomUrl($withpicto=0, $option='', $maxlength=0, $save_lastsearch_value=-1, $notooltip=0)
diff --git a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php
index f2c19394df9..b3eee673198 100644
--- a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php
+++ b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php
@@ -56,10 +56,10 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
*/
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
- if (empty($conf->blockedlog->enabled)) return 0; // Module not active, we do nothing
+ if (empty($conf->blockedlog->enabled)) return 0; // Module not active, we do nothing
// Test if event/record is qualified
- $listofqualifiedelement = array('facture', 'don', 'payment', 'payment_donation', 'subscription','payment_various');
+ $listofqualifiedelement = array('facture', 'don', 'payment', 'payment_donation', 'subscription', 'payment_various', 'cashcontrol');
if (! in_array($object->element, $listofqualifiedelement)) return 1;
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
@@ -80,6 +80,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
|| $action==='BILL_SUPPLIER_VALIDATE' || $action==='BILL_SUPPLIER_DELETE' || $action === 'BILL_SUPPLIER_SENTBYMAIL'
|| $action==='MEMBER_SUBSCRIPTION_CREATE' || $action==='MEMBER_SUBSCRIPTION_MODIFY' || $action==='MEMBER_SUBSCRIPTION_DELETE'
|| $action==='DON_VALIDATE' || $action==='DON_MODIFY' || $action==='DON_DELETE'
+ || $action==='CASHCONTROL_VALIDATE'
|| (in_array($object->element, array('facture','suplier_invoice')) && $action === 'DOC_DOWNLOAD') || (in_array($object->element, array('facture','suplier_invoice')) && $action === 'DOC_PREVIEW')
)
{
@@ -88,6 +89,10 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
if (in_array($action, array(
'MEMBER_SUBSCRIPTION_CREATE','MEMBER_SUBSCRIPTION_MODIFY','MEMBER_SUBSCRIPTION_DELETE',
'DON_VALIDATE','DON_MODIFY','DON_DELETE'))) $amounts = (double) $object->amount;
+ elseif ($action == 'CASHCONTROL_VALIDATE')
+ {
+ $amounts = (double) $object->cash + (double) $object->cheque + (double) $object->card;
+ }
else $amounts = (double) $object->total_ttc;
}
/*if ($action === 'BILL_PAYED' || $action==='BILL_UNPAYED'
@@ -103,7 +108,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
$amounts = 0;
if(!empty($object->amounts)) {
foreach($object->amounts as $amount) {
- $amounts+= price2num($amount);
+ $amounts += price2num($amount);
}
}
}
diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php
index 8115f8c80e3..5aa5e75d3b1 100644
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -1953,13 +1953,14 @@ else
$totalpaid += $objp->amount;
$i++;
}
+ $totalpaid = price2num($totalpaid); // Round $totalpaid to fix floating problem after addition into loop
if ($object->paid == 0)
{
print '
| '.$langs->trans("AlreadyPaid").': | '.price($totalpaid).' | |
';
print '
| '.$langs->trans("AmountExpected").': | '.price($object->total_ttc).' | |
';
- $remaintopay = $object->total_ttc - $totalpaid;
+ $remaintopay = price2num($object->total_ttc - $totalpaid);
print '
| '.$langs->trans("RemainderToPay").': | ';
print ''.price($remaintopay).' | |
';
diff --git a/htdocs/langs/en_US/blockedlog.lang b/htdocs/langs/en_US/blockedlog.lang
index 88d3662be9c..0dac5a6fd8c 100644
--- a/htdocs/langs/en_US/blockedlog.lang
+++ b/htdocs/langs/en_US/blockedlog.lang
@@ -8,8 +8,8 @@ BrowseBlockedLog=Unalterable logs
ShowAllFingerPrintsMightBeTooLong=Show all archived logs (might be long)
ShowAllFingerPrintsErrorsMightBeTooLong=Show all non-valid archive logs (might be long)
DownloadBlockChain=Download fingerprints
-KoCheckFingerprintValidity=Archived log is not valid. It means someone (a hacker?) has modified some data of this archived log after it was recorded, or has erased the previous archived record (check that line with previous # exists).
-OkCheckFingerprintValidity=Archived log is valid. It means all data on this line were not modified and record follow the previous one.
+KoCheckFingerprintValidity=Archived log record is not valid. It means someone (a hacker?) has modified some data of this archived log record after it was recorded, or has erased the previous archived record (check that line with previous # exists).
+OkCheckFingerprintValidity=Archived log record is valid. It means all data on this line were not modified and record follow the previous one.
OkCheckFingerprintValidityButChainIsKo=Archived log seems valid compared to previous one but the chain was corrupted previously.
AddedByAuthority=Stored into remote authority
NotAddedByAuthorityYet=Not yet stored into remote authority
@@ -35,6 +35,7 @@ logDON_DELETE=Donation logical deletion
logMEMBER_SUBSCRIPTION_CREATE=Member subscription created
logMEMBER_SUBSCRIPTION_MODIFY=Member subscription modified
logMEMBER_SUBSCRIPTION_DELETE=Member subscription logical deletion
+logCASHCONTROL_VALIDATE=Cash fence recording
BlockedLogBillDownload=Customer invoice download
BlockedLogBillPreview=Customer invoice preview
BlockedlogInfoDialog=Log Details
diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang
index dc1c72f3a3e..c581e6eae94 100644
--- a/htdocs/langs/en_US/stocks.lang
+++ b/htdocs/langs/en_US/stocks.lang
@@ -53,7 +53,7 @@ PMPValue=Weighted average price
PMPValueShort=WAP
EnhancedValueOfWarehouses=Warehouses value
UserWarehouseAutoCreate=Create a user warehouse automatically when creating a user
-AllowAddLimitStockByWarehouse=Allow to add limit and desired stock per couple (product, warehouse) instead of per product
+AllowAddLimitStockByWarehouse=Manage also values for minimum and desired stock per couple (product, warehouse) in addition to values per product
IndependantSubProductStock=Product stock and subproduct stock are independent
QtyDispatched=Quantity dispatched
QtyDispatchedShort=Qty dispatched