--- /tmp/dsg/dolibarr/htdocs/core/boxes/github_19.0.3_box_accountancy_last_manual_entries.php
+++ /tmp/dsg/dolibarr/htdocs/core/boxes/client_box_accountancy_last_manual_entries.php
@@ -35,4 +35,4 @@
- public $boxcode = "accountancy_last_manual_entries";
- public $boximg = "accounting";
- public $boxlabel = "BoxLastManualEntries";
- public $depends = array("accounting");
+ public $boxcode = "accountancy_last_manual_entries";
+ public $boximg = "object_invoice";
+ public $boxlabel = "BoxLastManualEntries";
+ public $depends = array("accounting");
@@ -41,3 +41,3 @@
- * @var DoliDB Database handler.
- */
- public $db;
+ * @var DoliDB Database handler.
+ */
+ public $db;
@@ -45 +45 @@
- public $param;
+ public $param;
@@ -47,2 +47,2 @@
- public $info_box_head = array();
- public $info_box_contents = array();
+ public $info_box_head = array();
+ public $info_box_contents = array();
@@ -51,9 +51,9 @@
- /**
- * Constructor
- *
- * @param DoliDB $db Database handler
- * @param string $param More parameters
- */
- public function __construct($db, $param)
- {
- global $user;
+ /**
+ * Constructor
+ *
+ * @param DoliDB $db Database handler
+ * @param string $param More parameters
+ */
+ public function __construct($db, $param)
+ {
+ global $user;
@@ -61 +61 @@
- $this->db = $db;
+ $this->db = $db;
@@ -63,2 +63,2 @@
- $this->hidden = !$user->hasRight('accounting', 'mouvements', 'lire');
- }
+ $this->hidden = !($user->rights->accounting->mouvements->lire);
+ }
@@ -66,9 +66,9 @@
- /**
- * Load data for box to show them later
- *
- * @param int $max Maximum number of records to load
- * @return void
- */
- public function loadBox($max = 5)
- {
- global $user, $langs, $conf;
+ /**
+ * Load data for box to show them later
+ *
+ * @param int $max Maximum number of records to load
+ * @return void
+ */
+ public function loadBox($max = 5)
+ {
+ global $user, $langs, $conf;
@@ -76 +76 @@
- include_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
@@ -78 +78 @@
- $bookkeepingstatic = new BookKeeping($this->db);
+ $bookkeepingstatic = new BookKeeping($this->db);
@@ -80 +80 @@
- $this->info_box_head = array('text' => $langs->trans("BoxTitleLastManualEntries", $max));
+ $this->info_box_head = array('text' => $langs->trans("BoxTitleLastManualEntries", $max));
@@ -82,11 +82,12 @@
- if ($user->hasRight('accounting', 'mouvements', 'lire')) {
- $sql = "SELECT DISTINCT b.piece_num";
- $sql .= ", b.doc_date as date_movement";
- $sql .= ", b.label_operation";
- $sql .= ", b.montant as amount";
- $sql .= ", b.code_journal";
- $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
- $sql .= " WHERE b.fk_doc = 0";
- $sql .= " AND b.entity = ".$conf->entity;
- $sql .= " ORDER BY b.piece_num DESC ";
- $sql .= $this->db->plimit($max, 0);
+ if ($user->rights->accounting->mouvements->lire)
+ {
+ $sql = "SELECT DISTINCT b.piece_num";
+ $sql .= ", b.doc_date as date_movement";
+ $sql .= ", b.label_operation";
+ $sql .= ", b.montant";
+ $sql .= ", b.code_journal";
+ $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
+ $sql .= " WHERE b.fk_doc = 0";
+ $sql .= " AND b.entity = ".$conf->entity;
+ $sql .= " ORDER BY b.piece_num DESC ";
+ $sql .= $this->db->plimit($max, 0);
@@ -94,3 +95,3 @@
- $result = $this->db->query($sql);
- if ($result) {
- $num = $this->db->num_rows($result);
+ $result = $this->db->query($sql);
+ if ($result) {
+ $num = $this->db->num_rows($result);
@@ -98 +99 @@
- $line = 0;
+ $line = 0;
@@ -100,3 +101,3 @@
- while ($line < $num) {
- $objp = $this->db->fetch_object($result);
- $date = $this->db->jdate($objp->date_movement);
+ while ($line < $num) {
+ $objp = $this->db->fetch_object($result);
+ $date = $this->db->jdate($objp->date_movement);
@@ -104,2 +105,2 @@
- $label = $objp->label_operation;
- $amount = $objp->amount;
+ $label = $objp->label_operation;
+ $amount = $objp->montant;
@@ -107,3 +108 @@
- // adding id (rowid) will give two lines (debit and credit)
- // so rowid isn't in sql request
- // $bookkeepingstatic->id = $objp->id;
+ $bookkeepingstatic->id = $objp->id;
@@ -118,5 +117,5 @@
- $this->info_box_contents[$line][] = array(
- 'td' => 'class="center nowraponall"',
- 'text' => dol_print_date($date, 'day'),
- 'asis' => 1,
- );
+ $this->info_box_contents[$line][] = array(
+ 'td' => 'class="right"',
+ 'text' => dol_print_date($date, 'day'),
+ 'asis' => 1,
+ );
@@ -136,4 +135,4 @@
- $this->info_box_contents[$line][] = array(
- 'td' => 'class="nowraponall right amount"',
- 'text' => price($amount, 0, $langs, 0, -1, -1, $conf->currency),
- );
+ $this->info_box_contents[$line][] = array(
+ 'td' => 'class="nowraponall right"',
+ 'text' => price($amount, 0, $langs, 0, -1, -1, $conf->currency),
+ );
@@ -141,2 +140,2 @@
- $line++;
- }
+ $line++;
+ }
@@ -144,6 +143,4 @@
- if ($num == 0) {
- $this->info_box_contents[$line][0] = array(
- 'td' => 'class="center"',
- 'text'=> ''.$langs->trans("NoRecordedManualEntries").''
- );
- }
+ if ($num == 0) $this->info_box_contents[$line][0] = array(
+ 'td' => 'class="center opacitymedium"',
+ 'text'=>$langs->trans("NoRecordedManualEntries")
+ );
@@ -151,15 +148,15 @@
- $this->db->free($result);
- } else {
- $this->info_box_contents[0][0] = array(
- 'td' => '',
- 'maxlength'=>500,
- 'text' => ($this->db->error().' sql='.$sql),
- );
- }
- } else {
- $this->info_box_contents[0][0] = array(
- 'td' => 'class="nohover left"',
- 'text' => ''.$langs->trans("ReadPermissionNotAllowed").''
- );
- }
- }
+ $this->db->free($result);
+ } else {
+ $this->info_box_contents[0][0] = array(
+ 'td' => '',
+ 'maxlength'=>500,
+ 'text' => ($this->db->error().' sql='.$sql),
+ );
+ }
+ } else {
+ $this->info_box_contents[0][0] = array(
+ 'td' => 'class="nohover opacitymedium left"',
+ 'text' => $langs->trans("ReadPermissionNotAllowed")
+ );
+ }
+ }
@@ -175,4 +172,4 @@
- public function showBox($head = null, $contents = null, $nooutput = 0)
- {
- return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
- }
+ public function showBox($head = null, $contents = null, $nooutput = 0)
+ {
+ return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
+ }
--- /tmp/dsg/dolibarr/htdocs/core/boxes/github_19.0.3_box_accountancy_suspense_account.php
+++ /tmp/dsg/dolibarr/htdocs/core/boxes/client_box_accountancy_suspense_account.php
@@ -18 +18 @@
- * along with this program. If not, see .
+ * along with this program. If not, see .
@@ -35,4 +35,4 @@
- public $boxcode = "accountancy_suspense_account";
- public $boximg = "accounting";
- public $boxlabel = "BoxSuspenseAccount";
- public $depends = array("accounting");
+ public $boxcode = "accountancy_suspense_account";
+ public $boximg = "object_invoice";
+ public $boxlabel = "BoxSuspenseAccount";
+ public $depends = array("accounting");
@@ -40,4 +40,4 @@
- /**
- * @var DoliDB Database handler.
- */
- public $db;
+ /**
+ * @var DoliDB Database handler.
+ */
+ public $db;
@@ -45 +45 @@
- public $param;
+ public $param;
@@ -47,2 +47,2 @@
- public $info_box_head = array();
- public $info_box_contents = array();
+ public $info_box_head = array();
+ public $info_box_contents = array();
@@ -51,9 +51,9 @@
- /**
- * Constructor
- *
- * @param DoliDB $db Database handler
- * @param string $param More parameters
- */
- public function __construct($db, $param)
- {
- global $user;
+ /**
+ * Constructor
+ *
+ * @param DoliDB $db Database handler
+ * @param string $param More parameters
+ */
+ public function __construct($db, $param)
+ {
+ global $user;
@@ -61 +61 @@
- $this->db = $db;
+ $this->db = $db;
@@ -63,2 +63,2 @@
- $this->hidden = !$user->hasRight('accounting', 'mouvements', 'lire');
- }
+ $this->hidden = !($user->rights->accounting->mouvements->lire);
+ }
@@ -66,8 +66,8 @@
- /**
- * Load data for box to show them later
- *
- * @return void
- */
- public function loadBox()
- {
- global $user, $langs, $conf;
+ /**
+ * Load data for box to show them later
+ *
+ * @return void
+ */
+ public function loadBox()
+ {
+ global $user, $langs, $conf;
@@ -75 +75 @@
- include_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
@@ -77 +77 @@
- //$bookkeepingstatic = new BookKeeping($this->db);
+ //$bookkeepingstatic = new BookKeeping($this->db);
@@ -79 +79 @@
- $this->info_box_head = array('text' => $langs->trans("BoxTitleSuspenseAccount"));
+ $this->info_box_head = array('text' => $langs->trans("BoxTitleSuspenseAccount"));
@@ -81 +81,2 @@
- if ($user->hasRight('accounting', 'mouvements', 'lire')) {
+ if ($user->rights->accounting->mouvements->lire)
+ {
@@ -83 +84,2 @@
- if (!empty($suspenseAccount) && $suspenseAccount > 0) {
+ if (!empty($suspenseAccount) && $suspenseAccount > 0)
+ {
@@ -86 +88 @@
- $sql .= " WHERE b.numero_compte = '".$this->db->escape($suspenseAccount)."'";
+ $sql .= " WHERE b.numero_compte = ".$suspenseAccount;
@@ -91 +93,2 @@
- if ($result) {
+ if ($result)
+ {
@@ -112,7 +115,7 @@
- } else {
- $this->info_box_contents[0][0] = array(
- 'td' => 'class="nohover"',
- 'text' => ''.$langs->trans("ReadPermissionNotAllowed").''
- );
- }
- }
+ } else {
+ $this->info_box_contents[0][0] = array(
+ 'td' => 'class="nohover"',
+ 'text' => ''.$langs->trans("ReadPermissionNotAllowed").''
+ );
+ }
+ }
@@ -128,4 +131,4 @@
- public function showBox($head = null, $contents = null, $nooutput = 0)
- {
- return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
- }
+ public function showBox($head = null, $contents = null, $nooutput = 0)
+ {
+ return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
+ }
--- /tmp/dsg/dolibarr/htdocs/core/boxes/github_19.0.3_box_actions.php
+++ /tmp/dsg/dolibarr/htdocs/core/boxes/client_box_actions.php
@@ -35,14 +35,14 @@
- public $boxcode = "lastactions";
- public $boximg = "object_action";
- public $boxlabel = "BoxOldestActions";
- public $depends = array("agenda");
-
- /**
- * @var DoliDB Database handler.
- */
- public $db;
-
- public $enabled = 1;
-
- public $info_box_head = array();
- public $info_box_contents = array();
+ public $boxcode = "lastactions";
+ public $boximg = "object_action";
+ public $boxlabel = "BoxLastActions";
+ public $depends = array("agenda");
+
+ /**
+ * @var DoliDB Database handler.
+ */
+ public $db;
+
+ public $param;
+
+ public $info_box_head = array();
+ public $info_box_contents = array();
@@ -57 +57 @@
- public function __construct($db, $param)
+ public function __construct($db, $param = '')
@@ -59,7 +59,5 @@
- global $user;
-
- $this->db = $db;
-
- $this->enabled = isModEnabled('agenda');
-
- $this->hidden = !($user->hasRight('agenda', 'myactions', 'read'));
+ global $user;
+
+ $this->db = $db;
+
+ $this->hidden = !($user->rights->agenda->myactions->read);
@@ -69,4 +67,4 @@
- * Load data for box to show them later
- *
- * @param int $max Maximum number of records to load
- * @return void
+ * Load data for box to show them later
+ *
+ * @param int $max Maximum number of records to load
+ * @return void
@@ -80,8 +78,8 @@
- include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
- include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
- $societestatic = new Societe($this->db);
- $actionstatic = new ActionComm($this->db);
-
- $this->info_box_head = array('text' => $langs->trans("BoxTitleOldestActionsToDo", $max));
-
- if ($user->hasRight('agenda', 'myactions', 'read')) {
+ include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
+ $societestatic = new Societe($this->db);
+ $actionstatic = new ActionComm($this->db);
+
+ $this->info_box_head = array('text' => $langs->trans("BoxTitleLastActionsToDo", $max));
+
+ if ($user->rights->agenda->myactions->read) {
@@ -89,5 +87,5 @@
- $sql .= ", ta.code";
- $sql .= ", ta.libelle as type_label";
- $sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
- $sql .= ", s.code_client, s.code_compta, s.client";
- $sql .= ", s.logo, s.email, s.entity";
+ $sql .= ", ta.code";
+ $sql .= ", ta.libelle as type_label";
+ $sql .= ", s.nom as name";
+ $sql .= ", s.rowid as socid";
+ $sql .= ", s.code_client";
@@ -95,3 +93 @@
- if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
- }
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
@@ -100 +96 @@
- $sql .= " AND a.entity IN (".getEntity('actioncomm').")";
+ $sql .= " AND a.entity = ".$conf->entity;
@@ -102,10 +98,4 @@
- if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
- $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".((int) $user->id).")";
- }
- if ($user->socid) {
- $sql .= " AND s.rowid = ".((int) $user->socid);
- }
- if (!$user->hasRight('agenda', 'allactions', 'read')) {
- $sql .= " AND (a.fk_user_author = ".((int) $user->id)." OR a.fk_user_action = ".((int) $user->id)." OR a.fk_user_done = ".((int) $user->id).")";
- }
- $sql .= " ORDER BY a.datep ASC";
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".$user->id.")";
+ if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
+ if (!$user->rights->agenda->allactions->read) $sql .= " AND (a.fk_user_author = ".$user->id." OR a.fk_user_action = ".$user->id." OR a.fk_user_done = ".$user->id.")";
+ $sql .= " ORDER BY a.datec DESC";
@@ -114 +104 @@
- dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
+ dol_syslog("Box_actions::loadBox", LOG_DEBUG);
@@ -116 +106 @@
- if ($result) {
+ if ($result) {
@@ -121 +110,0 @@
-
@@ -123 +112 @@
- while ($line < $num) {
+ while ($line < $num) {
@@ -127,19 +116,10 @@
-
- $actionstatic->id = $objp->id;
- $actionstatic->label = $objp->label;
- $actionstatic->type_label = $objp->type_label;
- $actionstatic->code = $objp->code;
-
- $societestatic->id = $objp->socid;
- $societestatic->name = $objp->name;
- //$societestatic->name_alias = $objp->name_alias;
- $societestatic->code_client = $objp->code_client;
- $societestatic->code_compta = $objp->code_compta;
- $societestatic->client = $objp->client;
- $societestatic->logo = $objp->logo;
- $societestatic->email = $objp->email;
- $societestatic->entity = $objp->entity;
-
- if ($objp->percentage >= 0 && $objp->percentage < 100 && $datelimite < ($now - $delay_warning)) {
- $late = img_warning($langs->trans("Late"));
- }
+ $actionstatic->id = $objp->id;
+ $actionstatic->label = $objp->label;
+ $actionstatic->type_label = $objp->type_label;
+ $actionstatic->code = $objp->code;
+ $societestatic->id = $objp->socid;
+ $societestatic->name = $objp->name;
+ $societestatic->code_client = $objp->code_client;
+
+ if ($objp->percentage >= 0 && $objp->percentage < 100 && $datelimite < ($now - $delay_warning))
+ $late = img_warning($langs->trans("Late"));
@@ -148,56 +128,52 @@
- //$label = empty($objp->label) ? $objp->type_label : $objp->label;
-
- $this->info_box_contents[$line][0] = array(
- 'td' => 'class="tdoverflowmax200"',
- 'text' => $actionstatic->getNomUrl(1),
- 'text2'=> $late,
- 'asis' => 1
- );
-
- $this->info_box_contents[$line][1] = array(
- 'td' => 'class="tdoverflowmax100"',
- 'text' => ($societestatic->id > 0 ? $societestatic->getNomUrl(1) : ''),
- 'asis' => 1
- );
-
- $this->info_box_contents[$line][2] = array(
- 'td' => 'class="center nowraponall"',
- 'text' => $datelimite ? dol_print_date($datelimite, "dayhour", 'tzuserrel') : '',
- 'asis' => 1
- );
-
- $this->info_box_contents[$line][3] = array(
- 'td' => 'class="right"',
- 'text' => ($objp->percentage >= 0 ? $objp->percentage.'%' : ''),
- 'asis' => 1
- );
-
- $this->info_box_contents[$line][4] = array(
- 'td' => 'class="right" width="18"',
- 'text' => $actionstatic->LibStatut($objp->percentage, 3),
- 'asis' => 1
- );
-
- $line++;
- }
-
- if ($num == 0) {
- $this->info_box_contents[$line][0] = array(
- 'td' => 'class="center"',
- 'text'=> ''.$langs->trans("NoActionsToDo").''
- );
- }
-
- $this->db->free($result);
- } else {
- $this->info_box_contents[0][0] = array(
- 'td' => '',
- 'maxlength'=>500,
- 'text' => ($this->db->error().' sql='.$sql)
- );
- }
- } else {
- $this->info_box_contents[0][0] = array(
- 'td' => 'class="nohover left"',
- 'text' => ''.$langs->trans("ReadPermissionNotAllowed").''
- );
+ $label = empty($objp->label) ? $objp->type_label : $objp->label;
+
+ $this->info_box_contents[$line][] = array(
+ 'td' => '',
+ 'text' => $actionstatic->getNomUrl(1),
+ 'text2'=> $late,
+ 'asis' => 1,
+ );
+
+ $this->info_box_contents[$line][] = array(
+ 'td' => '',
+ 'text' => ($societestatic->id > 0 ? $societestatic->getNomUrl(1) : ''),
+ 'asis' => 1,
+ );
+
+ $this->info_box_contents[$line][] = array(
+ 'td' => 'class="nowrap left"',
+ 'text' => dol_print_date($datelimite, "dayhour"),
+ );
+
+ $this->info_box_contents[$line][] = array(
+ 'td' => 'class="right"',
+ 'text' => ($objp->percentage >= 0 ? $objp->percentage.'%' : ''),
+ );
+
+ $this->info_box_contents[$line][] = array(
+ 'td' => 'class="right" width="18"',
+ 'text' => $actionstatic->LibStatut($objp->percentage, 3),
+ );
+
+ $line++;
+ }
+
+ if ($num == 0)
+ $this->info_box_contents[$line][0] = array(
+ 'td' => 'class="center"',
+ 'text'=>$langs->trans("NoActionsToDo"),
+ );
+
+ $this->db->free($result);
+ } else {
+ $this->info_box_contents[0][0] = array(
+ 'td' => '',
+ 'maxlength'=>500,
+ 'text' => ($this->db->error().' sql='.$sql),
+ );
+ }
+ } else {
+ $this->info_box_contents[0][0] = array(
+ 'td' => 'class="nohover opacitymedium left"',
+ 'text' => $langs->trans("ReadPermissionNotAllowed")
+ );
@@ -215,2 +191,2 @@
- public function showBox($head = null, $contents = null, $nooutput = 0)
- {
+ public function showBox($head = null, $contents = null, $nooutput = 0)
+ {
@@ -218,3 +194,4 @@
- $out = parent::showBox($this->info_box_head, $this->info_box_contents, 1);
-
- if (getDolGlobalString('SHOW_DIALOG_HOMEPAGE')) {
+ $out = parent::showBox($this->info_box_head, $this->info_box_contents);
+
+ if (!empty($conf->global->SHOW_DIALOG_HOMEPAGE))
+ {
@@ -223,4 +200,3 @@
- if (is_countable($contents) && count($contents) > 0) {
- $nblines = count($contents);
- }
- if ($contents[0][0]['text'] != $langs->trans("NoActionsToDo")) {
+ $nblines = count($contents);
+ if ($contents[0][0]['text'] != $langs->trans("NoActionsToDo"))
+ {
@@ -229,2 +205,4 @@
- for ($line = 0, $n = $nblines; $line < $n; $line++) {
- if (isset($contents[$line])) {
+ for ($line = 0, $n = $nblines; $line < $n; $line++)
+ {
+ if (isset($contents[$line]))
+ {
@@ -258,2 +236,3 @@
- if ($actioncejour) {
- $out .= '';
- }
- $this->info_box_contents[0][] = array(
- 'tr' => 'class="nohover showiffilter'.$this->boxcode.' hideobject"',
- 'td' => 'class="nohover"',
- 'textnoformat' => $boxcontent,
- );
-
-
- // Get list of project id allowed to user (in a string list separated by coma)
- $projectsListId = '';
- if (!$user->hasRight('projet', 'all', 'lire')) {
- $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
- }
-
- $sql = "SELECT pt.rowid, pt.ref, pt.fk_projet, pt.fk_task_parent, pt.datec, pt.dateo, pt.datee, pt.datev, pt.label, pt.description, pt.duration_effective, pt.planned_workload, pt.progress";
- $sql .= ", p.rowid project_id, p.ref project_ref, p.title project_title, p.fk_statut";
+ // set cookie by js
+ $boxcontent .= '';
+ }
+ $this->info_box_contents[0][] = array(
+ 'tr'=>'class="nohover showiffilter'.$this->boxcode.' hideobject"',
+ 'td' => 'class="nohover"',
+ 'textnoformat' => $boxcontent,
+ );
+
+
+ // Get list of project id allowed to user (in a string list separated by coma)
+ $projectsListId = '';
+ if (!$user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
+
+ $sql = "SELECT pt.rowid, pt.ref, pt.fk_projet, pt.fk_task_parent, pt.datec, pt.dateo, pt.datee, pt.datev, pt.label, pt.description, pt.duration_effective, pt.planned_workload, pt.progress";
+ $sql .= ", p.rowid project_id, p.ref project_ref, p.title project_title";
@@ -158,7 +158,8 @@
- if ($filterValue === 'im_task_contact') {
- $sql .= " JOIN ".MAIN_DB_PREFIX."element_contact as ec ON (ec.element_id = pt.rowid AND ec.fk_socpeople = ".((int) $user->id).")";
- $sql .= " JOIN ".MAIN_DB_PREFIX."c_type_contact as tc ON (ec.fk_c_type_contact = tc.rowid AND tc.element = 'project_task' AND tc.source = 'internal' )";
- } elseif ($filterValue === 'im_project_contact') {
- $sql .= " JOIN ".MAIN_DB_PREFIX."element_contact as ec ON (ec.element_id = p.rowid AND ec.fk_socpeople = ".((int) $user->id).")";
- $sql .= " JOIN ".MAIN_DB_PREFIX."c_type_contact as tc ON (ec.fk_c_type_contact = tc.rowid AND tc.element = 'project' AND tc.source = 'internal' )";
- }
+ if ($filterValue === 'im_task_contact') {
+ $sql .= " JOIN ".MAIN_DB_PREFIX."element_contact as ec ON (ec.element_id = pt.rowid AND ec.fk_socpeople = '".$user->id."' )";
+ $sql .= " JOIN ".MAIN_DB_PREFIX."c_type_contact as tc ON (ec.fk_c_type_contact = tc.rowid AND tc.element = 'project_task' AND tc.source = 'internal' )";
+ }
+ elseif ($filterValue === 'im_project_contact') {
+ $sql .= " JOIN ".MAIN_DB_PREFIX."element_contact as ec ON (ec.element_id = p.rowid AND ec.fk_socpeople = '".$user->id."' )";
+ $sql .= " JOIN ".MAIN_DB_PREFIX."c_type_contact as tc ON (ec.fk_c_type_contact = tc.rowid AND tc.element = 'project' AND tc.source = 'internal' )";
+ }
@@ -170,4 +171,2 @@
- $sql .= " AND p.usage_task = 1 ";
- if (!$user->hasRight('projet', 'all', 'lire')) {
- $sql .= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; // public and assigned to, or restricted to company for external users
- }
+ $sql .= " AND p.usage_task = 1 ";
+ if (!$user->rights->projet->all->lire) $sql .= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users
@@ -182,22 +181,22 @@
- while ($objp = $this->db->fetch_object($result)) {
- $taskstatic->id = $objp->rowid;
- $taskstatic->ref = $objp->ref;
- $taskstatic->label = $objp->label;
- $taskstatic->progress = $objp->progress;
- $taskstatic->fk_statut = $objp->fk_statut;
- $taskstatic->date_end = $this->db->jdate($objp->datee);
- $taskstatic->planned_workload = $objp->planned_workload;
- $taskstatic->duration_effective = $objp->duration_effective;
-
- $projectstatic->id = $objp->project_id;
- $projectstatic->ref = $objp->project_ref;
- $projectstatic->title = $objp->project_title;
-
- $label = $projectstatic->getNomUrl(1).' '.$taskstatic->getNomUrl(1).' '.dol_htmlentities($taskstatic->label);
-
- $boxcontent = getTaskProgressView($taskstatic, $label, true, false, false);
-
- $this->info_box_contents[$i][] = array(
- 'td' => '',
- 'text' => $boxcontent,
- );
+ while ($objp = $this->db->fetch_object($result)) {
+ $taskstatic->id = $objp->rowid;
+ $taskstatic->ref = $objp->ref;
+ $taskstatic->label = $objp->label;
+ $taskstatic->progress = $objp->progress;
+ $taskstatic->fk_statut = $objp->fk_statut;
+ $taskstatic->date_end = $objp->datee;
+ $taskstatic->planned_workload = $objp->planned_workload;
+ $taskstatic->duration_effective = $objp->duration_effective;
+
+ $projectstatic->id = $objp->project_id;
+ $projectstatic->ref = $objp->project_ref;
+ $projectstatic->title = $objp->project_title;
+
+ $label = $projectstatic->getNomUrl(1).' '.$taskstatic->getNomUrl(1).' '.dol_htmlentities($taskstatic->label);
+
+ $boxcontent = getTaskProgressView($taskstatic, $label, true, false, false);
+
+ $this->info_box_contents[$i][] = array(
+ 'td' => '',
+ 'text' => $boxcontent,
+ );
@@ -207,2 +206,2 @@
- dol_print_error($this->db);
- }
+ dol_print_error($this->db);
+ }
--- /tmp/dsg/dolibarr/htdocs/core/boxes/github_19.0.3_modules_boxes.php
+++ /tmp/dsg/dolibarr/htdocs/core/boxes/client_modules_boxes.php
@@ -24,2 +24,2 @@
- * \ingroup core
- * \brief File containing the parent class of boxes
+ * \ingroup facture
+ * \brief Fichier contenant la classe mere des boites
@@ -59 +59 @@
- public $hidden = false;
+ public $hidden = 0;
@@ -113,6 +112,0 @@
- * @var string Widget type ('graph' means the widget is a graph widget)
- */
- public $widgettype = '';
-
-
- /**
@@ -122 +116 @@
- * @param string $param More parameters
+ * @param string $param More parameters
@@ -145 +139 @@
- * @return int Return integer <0 if KO, >0 if OK
+ * @return int <0 if KO, >0 if OK
@@ -152 +146 @@
- $sql = "SELECT b.rowid as id, b.box_id, b.position, b.box_order, b.fk_user";
+ $sql = "SELECT b.rowid, b.box_id, b.position, b.box_order, b.fk_user";
@@ -155 +149 @@
- $sql .= " AND b.rowid = ".((int) $rowid);
+ $sql .= " AND b.rowid = ".$rowid;
@@ -159 +153,2 @@
- if ($resql) {
+ if ($resql)
+ {
@@ -161,3 +156,3 @@
- if ($obj) {
- $this->id = $obj->id;
- $this->rowid = $obj->id; // For backward compatibility
+ if ($obj)
+ {
+ $this->rowid = $obj->rowid;
@@ -169 +164,3 @@
- } else {
+ }
+ else
+ {
@@ -172 +169,3 @@
- } else {
+ }
+ else
+ {
@@ -174,0 +174,23 @@
+ }
+
+
+ /**
+ * Standard method to get content of a box
+ *
+ * @param array $head Array with properties of box title
+ * @param array $contents Array with properties of box lines
+ *
+ * @return string
+ */
+ public function outputBox($head = null, $contents = null)
+ {
+ global $langs, $user, $conf;
+
+ // Trick to get result into a var from a function that makes print instead of return
+ // TODO Replace ob_start with param nooutput=1 into showBox
+ ob_start();
+ $result = $this->showBox($head, $contents);
+ $output = ob_get_contents();
+ ob_end_clean();
+
+ return $output;
@@ -189,5 +211,3 @@
- if (!empty($this->hidden)) {
- return '\n\n'; // Nothing done if hidden (for example when user has no permission)
- }
-
- require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+ if (!empty($this->hidden)) return '\n\n'; // Nothing done if hidden (for example when user has no permission)
+
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -197,199 +217,170 @@
- $cachetime = 900; // 900 : 15mn
- $cachedir = DOL_DATA_ROOT.'/boxes/temp';
- $fileid = get_class($this).'id-'.$this->box_id.'-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'.cache';
- $filename = '/box-'.$fileid;
- $refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
- $out = '';
-
- if ($refresh) {
- dol_syslog(get_class($this).'::showBox');
-
- // Define nbcol and nblines of the box to show
- $nbcol = 0;
- if (isset($contents[0])) {
- $nbcol = count($contents[0]);
- }
- $nblines = count($contents);
-
- $out .= "\n\n";
-
- $out .= '
'."\n";
-
- if (!empty($head['text']) || !empty($head['sublink']) || !empty($head['subpicto']) || $nblines) {
- $out .= '
'."\n";
- }
-
- // Show box title
- if (!empty($head['text']) || !empty($head['sublink']) || !empty($head['subpicto'])) {
- $out .= '';
- $out .= ' 1) {
- $out .= ' colspan="'.$nbcol.'"';
- }
- $out .= '>';
- if (!empty($conf->use_javascript_ajax)) {
- //$out.= '';
- $out .= '';
- }
-
- $out .= " | ";
- $out .= "
\n";
- }
-
- // Show box lines
- if ($nblines) {
- // Loop on each record
- for ($i = 0, $n = $nblines; $i < $n; $i++) {
- if (isset($contents[$i])) {
- // TR
- if (isset($contents[$i][0]['tr'])) {
- $out .= '';
- } else {
- $out .= '
';
- }
-
- // Loop on each TD
- $nbcolthisline = count($contents[$i]);
- for ($j = 0; $j < $nbcolthisline; $j++) {
- // Define tdparam
- $tdparam = '';
- if (!empty($contents[$i][$j]['td'])) {
- $tdparam .= ' '.$contents[$i][$j]['td'];
- }
-
- $text = isset($contents[$i][$j]['text']) ? $contents[$i][$j]['text'] : '';
- $textwithnotags = preg_replace('/<([^>]+)>/i', '', $text);
- $text2 = isset($contents[$i][$j]['text2']) ? $contents[$i][$j]['text2'] : '';
- $text2withnotags = preg_replace('/<([^>]+)>/i', '', $text2);
-
- $textnoformat = isset($contents[$i][$j]['textnoformat']) ? $contents[$i][$j]['textnoformat'] : '';
- //$out.= "xxx $textwithnotags y";
- if (empty($contents[$i][$j]['tooltip'])) {
- $contents[$i][$j]['tooltip'] = "";
- }
- $tooltip = isset($contents[$i][$j]['tooltip']) ? $contents[$i][$j]['tooltip'] : '';
-
- $out .= ''."\n";
-
- // Url
- if (!empty($contents[$i][$j]['url']) && empty($contents[$i][$j]['logo'])) {
- $out .= 'trans("Show").' '.$tooltip, 1).'" class="classfortooltip"';
- }
- //$out.= ' alt="'.$textwithnotags.'"'; // Pas de alt sur un ""
- $out .= isset($contents[$i][$j]['target']) ? ' target="'.$contents[$i][$j]['target'].'"' : '';
- $out .= '>';
- }
-
- // Logo
- if (!empty($contents[$i][$j]['logo'])) {
- $logo = preg_replace("/^object_/i", "", $contents[$i][$j]['logo']);
- $out .= '';
- $out .= img_object($langs->trans("Show").' '.$tooltip, $logo, 'class="classfortooltip"');
- }
-
- $maxlength = $MAXLENGTHBOX;
- if (isset($contents[$i][$j]['maxlength'])) {
- $maxlength = $contents[$i][$j]['maxlength'];
- }
-
- if ($maxlength) {
- $textwithnotags = dol_trunc($textwithnotags, $maxlength);
- }
- if (preg_match('/^<(img|div|span)/i', $text) || !empty($contents[$i][$j]['asis'])) {
- $out .= $text; // show text with no html cleaning
- } else {
- $out .= $textwithnotags; // show text with html cleaning
- }
-
- // End Url
- if (!empty($contents[$i][$j]['url'])) {
- $out .= '';
- }
-
- if (preg_match('/^<(img|div|span)/i', $text2) || !empty($contents[$i][$j]['asis2'])) {
- $out .= $text2; // show text with no html cleaning
- } else {
- $out .= $text2withnotags; // show text with html cleaning
- }
-
- if (!empty($textnoformat)) {
- $out .= "\n".$textnoformat."\n";
- }
-
- $out .= " | \n";
- }
-
- $out .= "
\n";
- }
- }
- }
-
- if (!empty($head['text']) || !empty($head['sublink']) || !empty($head['subpicto']) || $nblines) {
- $out .= "
\n";
- }
-
- // If invisible box with no contents
- if (empty($head['text']) && empty($head['sublink']) && empty($head['subpicto']) && !$nblines) {
- $out .= "
\n";
- }
-
- $out .= "
\n";
-
- $out .= "\n\n";
- if (getDolGlobalString('MAIN_ACTIVATE_FILECACHE')) {
- dol_filecache($cachedir, $filename, $out);
- }
- } else {
- dol_syslog(get_class($this).'::showBoxCached');
- $out = "";
- $out .= dol_readcachefile($cachedir, $filename);
- }
-
- if ($nooutput) {
- return $out;
- } else {
- print $out;
- }
-
- return '';
+ $cachetime = 900; // 900 : 15mn
+ $cachedir = DOL_DATA_ROOT.'/boxes/temp';
+ $fileid = get_class($this).'id-'.$this->box_id.'-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'.cache';
+ $filename = '/box-'.$fileid;
+ $refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
+ $out = '';
+
+ if ($refresh) {
+ dol_syslog(get_class($this).'::showBox');
+
+ // Define nbcol and nblines of the box to show
+ $nbcol = 0;
+ if (isset($contents[0])) $nbcol = count($contents[0]);
+ $nblines = count($contents);
+
+ $out .= "\n\n";
+
+ $out .= ''."\n";
+
+ if (!empty($head['text']) || !empty($head['sublink']) || !empty($head['subpicto']) || $nblines)
+ {
+ $out .= '
'."\n";
+ }
+
+ // Show box title
+ if (!empty($head['text']) || !empty($head['sublink']) || !empty($head['subpicto']))
+ {
+ $out .= '';
+ $out .= ' 0) { $out .= ' colspan="'.$nbcol.'"'; }
+ $out .= '>';
+ if (!empty($conf->use_javascript_ajax))
+ {
+ //$out.= '';
+ $out .= '';
+ }
+
+ $out .= " | ";
+ $out .= "
\n";
+ }
+
+ // Show box lines
+ if ($nblines)
+ {
+ // Loop on each record
+ for ($i = 0, $n = $nblines; $i < $n; $i++)
+ {
+ if (isset($contents[$i]))
+ {
+ // TR
+ if (isset($contents[$i][0]['tr'])) $out .= '';
+ else $out .= '
';
+
+ // Loop on each TD
+ $nbcolthisline = count($contents[$i]);
+ for ($j = 0; $j < $nbcolthisline; $j++) {
+ // Define tdparam
+ $tdparam = '';
+ if (isset($contents[$i][$j]['td'])) $tdparam .= ' '.$contents[$i][$j]['td'];
+
+ $text = isset($contents[$i][$j]['text']) ? $contents[$i][$j]['text'] : '';
+ $textwithnotags = preg_replace('/<([^>]+)>/i', '', $text);
+ $text2 = isset($contents[$i][$j]['text2']) ? $contents[$i][$j]['text2'] : '';
+ $text2withnotags = preg_replace('/<([^>]+)>/i', '', $text2);
+
+ $textnoformat = isset($contents[$i][$j]['textnoformat']) ? $contents[$i][$j]['textnoformat'] : '';
+ //$out.= "xxx $textwithnotags y";
+ if (empty($contents[$i][$j]['tooltip'])) $contents[$i][$j]['tooltip'] = "";
+ $tooltip = isset($contents[$i][$j]['tooltip']) ? $contents[$i][$j]['tooltip'] : '';
+
+ $out .= ''."\n";
+
+ // Url
+ if (!empty($contents[$i][$j]['url']) && empty($contents[$i][$j]['logo']))
+ {
+ $out .= 'trans("Show").' '.$tooltip, 1).'" class="classfortooltip"';
+ }
+ //$out.= ' alt="'.$textwithnotags.'"'; // Pas de alt sur un ""
+ $out .= isset($contents[$i][$j]['target']) ? ' target="'.$contents[$i][$j]['target'].'"' : '';
+ $out .= '>';
+ }
+
+ // Logo
+ if (!empty($contents[$i][$j]['logo']))
+ {
+ $logo = preg_replace("/^object_/i", "", $contents[$i][$j]['logo']);
+ $out .= '';
+ $out .= img_object($langs->trans("Show").' '.$tooltip, $logo, 'class="classfortooltip"');
+ }
+
+ $maxlength = $MAXLENGTHBOX;
+ if (!empty($contents[$i][$j]['maxlength'])) $maxlength = $contents[$i][$j]['maxlength'];
+
+ if ($maxlength) $textwithnotags = dol_trunc($textwithnotags, $maxlength);
+ if (preg_match('/^<(img|div|span)/i', $text) || !empty($contents[$i][$j]['asis'])) $out .= $text; // show text with no html cleaning
+ else $out .= $textwithnotags; // show text with html cleaning
+
+ // End Url
+ if (!empty($contents[$i][$j]['url'])) $out .= '';
+
+ if (preg_match('/^<(img|div|span)/i', $text2) || !empty($contents[$i][$j]['asis2'])) $out .= $text2; // show text with no html cleaning
+ else $out .= $text2withnotags; // show text with html cleaning
+
+ if (!empty($textnoformat)) $out .= "\n".$textnoformat."\n";
+
+ $out .= " | \n";
+ }
+
+ $out .= "
\n";
+ }
+ }
+ }
+
+ if (!empty($head['text']) || !empty($head['sublink']) || !empty($head['subpicto']) || $nblines)
+ {
+ $out .= "
\n";
+ }
+
+ // If invisible box with no contents
+ if (empty($head['text']) && empty($head['sublink']) && empty($head['subpicto']) && !$nblines) $out .= "
\n";
+
+ $out .= "
\n";
+
+ $out .= "\n\n";
+ if (!empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
+ dol_filecache($cachedir, $filename, $out);
+ }
+ } else {
+ dol_syslog(get_class($this).'::showBoxCached');
+ $out = "";
+ $out .= dol_readcachefile($cachedir, $filename);
+ }
+
+ if ($nooutput) return $out;
+ else print $out;
+
+ return '';
@@ -420 +411,2 @@
- if (is_array($forcedirwidget)) {
+ if (is_array($forcedirwidget))
+ {
@@ -424 +416,2 @@
- foreach ($dirwidget as $reldir) {
+ foreach ($dirwidget as $reldir)
+ {
@@ -429,3 +422 @@
- if (!is_dir($newdir)) {
- continue;
- }
+ if (!is_dir($newdir)) continue;
@@ -434,7 +425,7 @@
- if (is_resource($handle)) {
- while (($file = readdir($handle)) !== false) {
- $reg = array();
- if (is_readable($newdir.'/'.$file) && preg_match('/^(.+)\.php/', $file, $reg)) {
- if (preg_match('/\.back$/', $file) || preg_match('/^(.+)\.disabled\.php/', $file)) {
- continue;
- }
+ if (is_resource($handle))
+ {
+ while (($file = readdir($handle)) !== false)
+ {
+ if (is_readable($newdir.'/'.$file) && preg_match('/^(.+)\.php/', $file, $reg))
+ {
+ if (preg_match('/\.back$/', $file)) continue;
@@ -446 +437,2 @@
- if (in_array($modName, $modules)) {
+ if (in_array($modName, $modules))
+ {
@@ -449 +441,3 @@
- } else {
+ }
+ else
+ {
@@ -452 +446,3 @@
- } catch (Exception $e) {
+ }
+ catch (Exception $e)
+ {
@@ -470 +465,0 @@
- //echo "";print_r($modules);echo "
";
@@ -478 +473,2 @@
- foreach ($orders as $key => $value) {
+ foreach ($orders as $key => $value)
+ {
@@ -480,5 +476,4 @@
- if (empty($modName)) {
- continue;
- }
-
- if (!class_exists($modName)) {
+ if (empty($modName)) continue;
+
+ if (!class_exists($modName))
+ {
@@ -490 +485,2 @@
- if (is_object($objMod)) {
+ if (is_object($objMod))
+ {
@@ -493 +488,0 @@
- $disabledbymodule = 0; // TODO Set to 2 if module is not enabled
@@ -497,3 +492 @@
- if (preg_match('/NORUN$/i', $files[$key])) {
- $disabledbyname = 1;
- }
+ if (preg_match('/NORUN$/i', $files[$key])) $disabledbyname = 1;
@@ -502 +495 @@
- $widget[$j]['picto'] = (empty($objMod->picto) ? (empty($objMod->boximg) ? img_object('', 'generic') : $objMod->boximg) : img_object('', $objMod->picto));
+ $widget[$j]['picto'] = $objMod->picto ?img_object('', $objMod->picto) : img_object('', 'generic');
@@ -507 +500 @@
- $widget[$j]['version'] = empty($objMod->version) ? '' : $objMod->version;
+ //$widget[$j]['version'] = $objMod->getVersion();
@@ -509,3 +502 @@
- if ($disabledbyname > 0 || $disabledbymodule > 1) {
- $widget[$j]['status'] = '';
- }
+ if ($disabledbyname > 0 || $disabledbymodule > 1) $widget[$j]['status'] = '';
@@ -516,3 +507 @@
- if ($disabledbymodule == 2) {
- $text .= $langs->trans("WidgetDisabledAsModuleDisabled", $module).'
';
- }
+ if ($disabledbymodule == 2) $text .= $langs->trans("HooksDisabledAsModuleDisabled", $module).'
';