@@ -144,16 +144,16 @@ |
||
144 | 144 | if ($prevquarter > 1) { |
145 | 145 | $prevquarter--; |
146 | 146 | } else { |
147 | - $prevquarter = 4; |
|
148 | - $prevyear--; |
|
147 | + $prevquarter = 4; |
|
148 | + $prevyear--; |
|
149 | 149 | } |
150 | 150 | $nextyear = $year_start; |
151 | 151 | $nextquarter = $q; |
152 | 152 | if ($nextquarter < 4) { |
153 | 153 | $nextquarter++; |
154 | 154 | } else { |
155 | - $nextquarter = 1; |
|
156 | - $nextyear++; |
|
155 | + $nextquarter = 1; |
|
156 | + $nextyear++; |
|
157 | 157 | } |
158 | 158 | $description .= $fsearch; |
159 | 159 | $builddate = dol_now(); |
@@ -127,39 +127,39 @@ discard block |
||
127 | 127 | |
128 | 128 | if (empty($reshook)) |
129 | 129 | { |
130 | - // Cancel |
|
131 | - if (GETPOST('cancel', 'alpha') && !empty($backtopage)) |
|
132 | - { |
|
133 | - header("Location: ".$backtopage); |
|
134 | - exit; |
|
135 | - } |
|
136 | - |
|
137 | - // Selection of new fields |
|
138 | - include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
|
139 | - |
|
140 | - // Purge search criteria |
|
141 | - if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers |
|
142 | - { |
|
143 | - foreach ($objectwebsiteaccount->fields as $key => $val) |
|
144 | - { |
|
145 | - $search[$key] = ''; |
|
146 | - } |
|
147 | - $toselect = ''; |
|
148 | - $search_array_options = array(); |
|
149 | - } |
|
150 | - if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') |
|
151 | - || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) |
|
152 | - { |
|
153 | - $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation |
|
154 | - } |
|
155 | - |
|
156 | - // Mass actions |
|
157 | - $objectclass = 'WebsiteAccount'; |
|
158 | - $objectlabel = 'WebsiteAccount'; |
|
159 | - $permissiontoread = $user->rights->societe->lire; |
|
160 | - $permissiontodelete = $user->rights->societe->supprimer; |
|
161 | - $uploaddir = $conf->societe->dir_output; |
|
162 | - include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; |
|
130 | + // Cancel |
|
131 | + if (GETPOST('cancel', 'alpha') && !empty($backtopage)) |
|
132 | + { |
|
133 | + header("Location: ".$backtopage); |
|
134 | + exit; |
|
135 | + } |
|
136 | + |
|
137 | + // Selection of new fields |
|
138 | + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
|
139 | + |
|
140 | + // Purge search criteria |
|
141 | + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers |
|
142 | + { |
|
143 | + foreach ($objectwebsiteaccount->fields as $key => $val) |
|
144 | + { |
|
145 | + $search[$key] = ''; |
|
146 | + } |
|
147 | + $toselect = ''; |
|
148 | + $search_array_options = array(); |
|
149 | + } |
|
150 | + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') |
|
151 | + || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) |
|
152 | + { |
|
153 | + $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation |
|
154 | + } |
|
155 | + |
|
156 | + // Mass actions |
|
157 | + $objectclass = 'WebsiteAccount'; |
|
158 | + $objectlabel = 'WebsiteAccount'; |
|
159 | + $permissiontoread = $user->rights->societe->lire; |
|
160 | + $permissiontodelete = $user->rights->societe->supprimer; |
|
161 | + $uploaddir = $conf->societe->dir_output; |
|
162 | + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | if (!empty($conf->website->enabled)) { |
238 | 238 | if (!empty($user->rights->societe->lire)) { |
239 | 239 | $newcardbutton .= dolGetButtonTitle($langs->trans("AddWebsiteAccount"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id)); |
240 | - } else { |
|
241 | - $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', 0); |
|
240 | + } else { |
|
241 | + $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', 0); |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | |
641 | 641 | // if we use supplier description of the products |
642 | 642 | if (!empty($productsupplier->desc_supplier) && !empty($conf->global->PRODUIT_FOURN_TEXTS)) { |
643 | - $desc = $productsupplier->desc_supplier; |
|
643 | + $desc = $productsupplier->desc_supplier; |
|
644 | 644 | } else $desc = $productsupplier->description; |
645 | 645 | |
646 | 646 | if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | $productsupplier->fourn_multicurrency_unitprice, |
690 | 690 | $date_start, |
691 | 691 | $date_end |
692 | - ); |
|
692 | + ); |
|
693 | 693 | |
694 | 694 | //var_dump($tva_tx);var_dump($productsupplier->fourn_pu);var_dump($price_base_type);exit; |
695 | 695 | if ($result < 0) |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | class mod_mo_advanced extends ModeleNumRefMos |
36 | 36 | { |
37 | 37 | /** |
38 | - * Dolibarr version of the loaded document |
|
39 | - * @var string |
|
40 | - */ |
|
38 | + * Dolibarr version of the loaded document |
|
39 | + * @var string |
|
40 | + */ |
|
41 | 41 | public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
42 | 42 | |
43 | 43 | /** |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | public $name = 'advanced'; |
52 | 52 | |
53 | 53 | |
54 | - /** |
|
55 | - * Returns the description of the numbering model |
|
56 | - * |
|
57 | - * @return string Texte descripif |
|
58 | - */ |
|
59 | - public function info() |
|
60 | - { |
|
61 | - global $conf, $langs, $db; |
|
54 | + /** |
|
55 | + * Returns the description of the numbering model |
|
56 | + * |
|
57 | + * @return string Texte descripif |
|
58 | + */ |
|
59 | + public function info() |
|
60 | + { |
|
61 | + global $conf, $langs, $db; |
|
62 | 62 | |
63 | 63 | $langs->load("bills"); |
64 | 64 | |
@@ -89,22 +89,22 @@ discard block |
||
89 | 89 | $texte .= '</form>'; |
90 | 90 | |
91 | 91 | return $texte; |
92 | - } |
|
93 | - |
|
94 | - /** |
|
95 | - * Return an example of numbering |
|
96 | - * |
|
97 | - * @return string Example |
|
98 | - */ |
|
99 | - public function getExample() |
|
100 | - { |
|
101 | - global $conf, $langs, $mysoc; |
|
102 | - |
|
103 | - $old_code_client = $mysoc->code_client; |
|
104 | - $old_code_type = $mysoc->typent_code; |
|
105 | - $mysoc->code_client = 'CCCCCCCCCC'; |
|
106 | - $mysoc->typent_code = 'TTTTTTTTTT'; |
|
107 | - $numExample = $this->getNextValue($mysoc, ''); |
|
92 | + } |
|
93 | + |
|
94 | + /** |
|
95 | + * Return an example of numbering |
|
96 | + * |
|
97 | + * @return string Example |
|
98 | + */ |
|
99 | + public function getExample() |
|
100 | + { |
|
101 | + global $conf, $langs, $mysoc; |
|
102 | + |
|
103 | + $old_code_client = $mysoc->code_client; |
|
104 | + $old_code_type = $mysoc->typent_code; |
|
105 | + $mysoc->code_client = 'CCCCCCCCCC'; |
|
106 | + $mysoc->typent_code = 'TTTTTTTTTT'; |
|
107 | + $numExample = $this->getNextValue($mysoc, ''); |
|
108 | 108 | $mysoc->code_client = $old_code_client; |
109 | 109 | $mysoc->typent_code = $old_code_type; |
110 | 110 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $numExample = $langs->trans('NotConfigured'); |
114 | 114 | } |
115 | 115 | return $numExample; |
116 | - } |
|
116 | + } |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Return next free value |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * @param Object $object Object we need next value for |
123 | 123 | * @return string Value if KO, <0 if KO |
124 | 124 | */ |
125 | - public function getNextValue($objprod, $object) |
|
126 | - { |
|
125 | + public function getNextValue($objprod, $object) |
|
126 | + { |
|
127 | 127 | global $db, $conf; |
128 | 128 | |
129 | 129 | require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
@@ -34,20 +34,20 @@ discard block |
||
34 | 34 | */ |
35 | 35 | class box_contacts extends ModeleBoxes |
36 | 36 | { |
37 | - public $boxcode = "lastcontacts"; |
|
38 | - public $boximg = "object_contact"; |
|
39 | - public $boxlabel = "BoxLastContacts"; |
|
40 | - public $depends = array("societe"); |
|
37 | + public $boxcode = "lastcontacts"; |
|
38 | + public $boximg = "object_contact"; |
|
39 | + public $boxlabel = "BoxLastContacts"; |
|
40 | + public $depends = array("societe"); |
|
41 | 41 | |
42 | 42 | /** |
43 | - * @var DoliDB Database handler. |
|
44 | - */ |
|
45 | - public $db; |
|
43 | + * @var DoliDB Database handler. |
|
44 | + */ |
|
45 | + public $db; |
|
46 | 46 | |
47 | - public $param; |
|
47 | + public $param; |
|
48 | 48 | |
49 | - public $info_box_head = array(); |
|
50 | - public $info_box_contents = array(); |
|
49 | + public $info_box_head = array(); |
|
50 | + public $info_box_contents = array(); |
|
51 | 51 | |
52 | 52 | |
53 | 53 | /** |
@@ -58,18 +58,18 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function __construct($db, $param) |
60 | 60 | { |
61 | - global $user; |
|
61 | + global $user; |
|
62 | 62 | |
63 | - $this->db = $db; |
|
63 | + $this->db = $db; |
|
64 | 64 | |
65 | - $this->hidden = !($user->rights->societe->lire && $user->rights->societe->contact->lire); |
|
65 | + $this->hidden = !($user->rights->societe->lire && $user->rights->societe->contact->lire); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Load data into info_box_contents array to show array later. |
70 | 70 | * |
71 | 71 | * @param int $max Maximum number of records to load |
72 | - * @return void |
|
72 | + * @return void |
|
73 | 73 | */ |
74 | 74 | public function loadBox($max = 5) |
75 | 75 | { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $contactstatic->phone_pro = $objp->phone; |
120 | 120 | $contactstatic->phone_perso = $objp->phone_perso; |
121 | 121 | $contactstatic->phone_mobile = $objp->phone_mobile; |
122 | - $contactstatic->email = $objp->spemail; |
|
122 | + $contactstatic->email = $objp->spemail; |
|
123 | 123 | $contactstatic->address = $objp->address; |
124 | 124 | $contactstatic->zip = $objp->zip; |
125 | 125 | $contactstatic->town = $objp->town; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | $societestatic->id = $objp->fk_soc; |
130 | 130 | $societestatic->name = $objp->socname; |
131 | - $societestatic->email = $objp->semail; |
|
131 | + $societestatic->email = $objp->semail; |
|
132 | 132 | $societestatic->name_alias = $objp->name_alias; |
133 | 133 | $societestatic->code_client = $objp->code_client; |
134 | 134 | $societestatic->code_fournisseur = $objp->code_fournisseur; |
@@ -31,179 +31,179 @@ |
||
31 | 31 | class box_last_modified_ticket extends ModeleBoxes |
32 | 32 | { |
33 | 33 | |
34 | - public $boxcode = "box_last_modified_ticket"; |
|
35 | - public $boximg = "ticket"; |
|
36 | - public $boxlabel; |
|
37 | - public $depends = array("ticket"); |
|
38 | - |
|
39 | - /** |
|
40 | - * @var DoliDB Database handler. |
|
41 | - */ |
|
42 | - public $db; |
|
43 | - |
|
44 | - public $param; |
|
45 | - public $info_box_head = array(); |
|
46 | - public $info_box_contents = array(); |
|
47 | - |
|
48 | - /** |
|
49 | - * Constructor |
|
50 | - * @param DoliDB $db Database handler |
|
51 | - * @param string $param More parameters |
|
52 | - */ |
|
53 | - public function __construct($db, $param = '') |
|
54 | - { |
|
55 | - global $langs; |
|
34 | + public $boxcode = "box_last_modified_ticket"; |
|
35 | + public $boximg = "ticket"; |
|
36 | + public $boxlabel; |
|
37 | + public $depends = array("ticket"); |
|
38 | + |
|
39 | + /** |
|
40 | + * @var DoliDB Database handler. |
|
41 | + */ |
|
42 | + public $db; |
|
43 | + |
|
44 | + public $param; |
|
45 | + public $info_box_head = array(); |
|
46 | + public $info_box_contents = array(); |
|
47 | + |
|
48 | + /** |
|
49 | + * Constructor |
|
50 | + * @param DoliDB $db Database handler |
|
51 | + * @param string $param More parameters |
|
52 | + */ |
|
53 | + public function __construct($db, $param = '') |
|
54 | + { |
|
55 | + global $langs; |
|
56 | 56 | $langs->load("boxes"); |
57 | 57 | $this->db = $db; |
58 | 58 | |
59 | - $this->boxlabel = $langs->transnoentitiesnoconv("BoxLastModifiedTicket"); |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * Load data into info_box_contents array to show array later. |
|
64 | - * |
|
65 | - * @param int $max Maximum number of records to load |
|
66 | - * @return void |
|
67 | - */ |
|
68 | - public function loadBox($max = 5) |
|
69 | - { |
|
70 | - global $conf, $user, $langs; |
|
71 | - |
|
72 | - $this->max = $max; |
|
73 | - |
|
74 | - require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php"; |
|
75 | - |
|
76 | - $text = $langs->trans("BoxLastModifiedTicketDescription", $max); |
|
77 | - $this->info_box_head = array( |
|
78 | - 'text' => $text, |
|
79 | - 'limit' => dol_strlen($text) |
|
80 | - ); |
|
81 | - |
|
82 | - $this->info_box_contents[0][0] = array( |
|
83 | - 'td' => 'class="left"', |
|
84 | - 'text' => $langs->trans("BoxLastModifiedTicketContent"), |
|
85 | - ); |
|
86 | - |
|
87 | - if ($user->rights->ticket->read) { |
|
88 | - $sql = "SELECT t.rowid as id, t.ref, t.track_id, t.fk_soc, t.fk_user_create, t.fk_user_assign, t.subject, t.message, t.fk_statut, t.type_code, t.category_code, t.severity_code, t.datec, t.date_read, t.date_close, t.origin_email "; |
|
89 | - $sql .= ", type.label as type_label, category.label as category_label, severity.label as severity_label"; |
|
90 | - $sql .= ", s.nom as company_name, s.email as socemail, s.client, s.fournisseur"; |
|
91 | - $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; |
|
92 | - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code"; |
|
93 | - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code"; |
|
94 | - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code=t.severity_code"; |
|
95 | - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=t.fk_soc"; |
|
96 | - |
|
97 | - $sql .= " WHERE t.entity = ".$conf->entity; |
|
98 | - // $sql.= " AND e.rowid = er.fk_event"; |
|
99 | - //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " WHERE s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
100 | - if ($user->socid) { |
|
101 | - $sql .= " AND t.fk_soc= ".$user->socid; |
|
102 | - } |
|
103 | - |
|
104 | - $sql .= " ORDER BY t.tms DESC, t.rowid DESC "; |
|
105 | - $sql .= $this->db->plimit($max, 0); |
|
106 | - |
|
107 | - $resql = $this->db->query($sql); |
|
108 | - if ($resql) { |
|
109 | - $num = $this->db->num_rows($resql); |
|
110 | - |
|
111 | - $i = 0; |
|
112 | - |
|
113 | - while ($i < $num) { |
|
114 | - $objp = $this->db->fetch_object($resql); |
|
115 | - $datec = $this->db->jdate($objp->datec); |
|
116 | - $dateterm = $this->db->jdate($objp->fin_validite); |
|
117 | - $dateclose = $this->db->jdate($objp->date_cloture); |
|
118 | - $late = ''; |
|
119 | - |
|
120 | - $ticket = new Ticket($this->db); |
|
121 | - $ticket->id = $objp->id; |
|
122 | - $ticket->track_id = $objp->track_id; |
|
123 | - $ticket->ref = $objp->ref; |
|
124 | - $ticket->fk_statut = $objp->fk_statut; |
|
125 | - $ticket->subject = $objp->subject; |
|
126 | - if ($objp->fk_soc > 0) { |
|
127 | - $thirdparty = new Societe($this->db); |
|
128 | - $thirdparty->id = $objp->fk_soc; |
|
129 | - $thirdparty->email = $objp->socemail; |
|
130 | - $thirdparty->client = $objp->client; |
|
131 | - $thirdparty->fournisseur = $objp->fournisseur; |
|
132 | - $thirdparty->name = $objp->company_name; |
|
133 | - $link = $thirdparty->getNomUrl(1); |
|
134 | - } else { |
|
135 | - $link = dol_print_email($objp->origin_email); |
|
136 | - } |
|
137 | - |
|
138 | - |
|
139 | - $r = 0; |
|
140 | - |
|
141 | - // Ticket |
|
142 | - $this->info_box_contents[$i][0] = array( |
|
143 | - 'td' => 'class="nowraponall"', |
|
144 | - 'text' => $ticket->getNomUrl(1), |
|
145 | - 'asis' => 1, |
|
146 | - ); |
|
147 | - $r++; |
|
148 | - |
|
149 | - // Subject |
|
150 | - $this->info_box_contents[$i][$r] = array( |
|
151 | - 'td' => 'class="nowrap"', |
|
152 | - 'text' => $objp->subject, // Some event have no ref |
|
153 | - 'url' => DOL_URL_ROOT."/ticket/card.php?track_id=".$objp->track_id, |
|
154 | - ); |
|
155 | - $r++; |
|
156 | - |
|
157 | - // Customer |
|
158 | - $this->info_box_contents[$i][$r] = array( |
|
159 | - 'td' => 'class="tdoverflowmax150 maxwidth300onsmartphone"', |
|
160 | - 'text' => $link, |
|
161 | - 'asis' => 1, |
|
162 | - ); |
|
163 | - $r++; |
|
164 | - |
|
165 | - |
|
166 | - // Date creation |
|
167 | - $this->info_box_contents[$i][$r] = array( |
|
168 | - 'td' => 'class="right"', |
|
169 | - 'text' => dol_print_date($datec, 'dayhour') |
|
170 | - ); |
|
171 | - $r++; |
|
172 | - |
|
173 | - // Statut |
|
174 | - $this->info_box_contents[$i][$r] = array( |
|
175 | - 'td' => 'class="right nowraponall"', |
|
176 | - 'text' => $ticket->getLibStatut(3) |
|
177 | - ); |
|
178 | - $r++; |
|
179 | - |
|
180 | - $i++; |
|
181 | - } |
|
182 | - |
|
183 | - if ($num == 0) { |
|
184 | - $this->info_box_contents[$i][0] = array('td' => 'class="center"', 'text'=>$langs->trans("BoxLastModifiedTicketNoRecordedTickets")); |
|
185 | - } |
|
186 | - } else { |
|
187 | - dol_print_error($this->db); |
|
188 | - } |
|
189 | - } else { |
|
190 | - $this->info_box_contents[0][0] = array( |
|
191 | - 'td' => 'class="left"', |
|
192 | - 'text' => $langs->trans("ReadPermissionNotAllowed"), |
|
193 | - ); |
|
194 | - } |
|
195 | - } |
|
196 | - |
|
197 | - /** |
|
198 | - * Method to show box |
|
199 | - * |
|
200 | - * @param array $head Array with properties of box title |
|
201 | - * @param array $contents Array with properties of box lines |
|
202 | - * @param int $nooutput No print, only return string |
|
203 | - * @return string |
|
204 | - */ |
|
205 | - public function showBox($head = null, $contents = null, $nooutput = 0) |
|
206 | - { |
|
207 | - parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); |
|
208 | - } |
|
59 | + $this->boxlabel = $langs->transnoentitiesnoconv("BoxLastModifiedTicket"); |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * Load data into info_box_contents array to show array later. |
|
64 | + * |
|
65 | + * @param int $max Maximum number of records to load |
|
66 | + * @return void |
|
67 | + */ |
|
68 | + public function loadBox($max = 5) |
|
69 | + { |
|
70 | + global $conf, $user, $langs; |
|
71 | + |
|
72 | + $this->max = $max; |
|
73 | + |
|
74 | + require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php"; |
|
75 | + |
|
76 | + $text = $langs->trans("BoxLastModifiedTicketDescription", $max); |
|
77 | + $this->info_box_head = array( |
|
78 | + 'text' => $text, |
|
79 | + 'limit' => dol_strlen($text) |
|
80 | + ); |
|
81 | + |
|
82 | + $this->info_box_contents[0][0] = array( |
|
83 | + 'td' => 'class="left"', |
|
84 | + 'text' => $langs->trans("BoxLastModifiedTicketContent"), |
|
85 | + ); |
|
86 | + |
|
87 | + if ($user->rights->ticket->read) { |
|
88 | + $sql = "SELECT t.rowid as id, t.ref, t.track_id, t.fk_soc, t.fk_user_create, t.fk_user_assign, t.subject, t.message, t.fk_statut, t.type_code, t.category_code, t.severity_code, t.datec, t.date_read, t.date_close, t.origin_email "; |
|
89 | + $sql .= ", type.label as type_label, category.label as category_label, severity.label as severity_label"; |
|
90 | + $sql .= ", s.nom as company_name, s.email as socemail, s.client, s.fournisseur"; |
|
91 | + $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; |
|
92 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code"; |
|
93 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code"; |
|
94 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code=t.severity_code"; |
|
95 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=t.fk_soc"; |
|
96 | + |
|
97 | + $sql .= " WHERE t.entity = ".$conf->entity; |
|
98 | + // $sql.= " AND e.rowid = er.fk_event"; |
|
99 | + //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " WHERE s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
100 | + if ($user->socid) { |
|
101 | + $sql .= " AND t.fk_soc= ".$user->socid; |
|
102 | + } |
|
103 | + |
|
104 | + $sql .= " ORDER BY t.tms DESC, t.rowid DESC "; |
|
105 | + $sql .= $this->db->plimit($max, 0); |
|
106 | + |
|
107 | + $resql = $this->db->query($sql); |
|
108 | + if ($resql) { |
|
109 | + $num = $this->db->num_rows($resql); |
|
110 | + |
|
111 | + $i = 0; |
|
112 | + |
|
113 | + while ($i < $num) { |
|
114 | + $objp = $this->db->fetch_object($resql); |
|
115 | + $datec = $this->db->jdate($objp->datec); |
|
116 | + $dateterm = $this->db->jdate($objp->fin_validite); |
|
117 | + $dateclose = $this->db->jdate($objp->date_cloture); |
|
118 | + $late = ''; |
|
119 | + |
|
120 | + $ticket = new Ticket($this->db); |
|
121 | + $ticket->id = $objp->id; |
|
122 | + $ticket->track_id = $objp->track_id; |
|
123 | + $ticket->ref = $objp->ref; |
|
124 | + $ticket->fk_statut = $objp->fk_statut; |
|
125 | + $ticket->subject = $objp->subject; |
|
126 | + if ($objp->fk_soc > 0) { |
|
127 | + $thirdparty = new Societe($this->db); |
|
128 | + $thirdparty->id = $objp->fk_soc; |
|
129 | + $thirdparty->email = $objp->socemail; |
|
130 | + $thirdparty->client = $objp->client; |
|
131 | + $thirdparty->fournisseur = $objp->fournisseur; |
|
132 | + $thirdparty->name = $objp->company_name; |
|
133 | + $link = $thirdparty->getNomUrl(1); |
|
134 | + } else { |
|
135 | + $link = dol_print_email($objp->origin_email); |
|
136 | + } |
|
137 | + |
|
138 | + |
|
139 | + $r = 0; |
|
140 | + |
|
141 | + // Ticket |
|
142 | + $this->info_box_contents[$i][0] = array( |
|
143 | + 'td' => 'class="nowraponall"', |
|
144 | + 'text' => $ticket->getNomUrl(1), |
|
145 | + 'asis' => 1, |
|
146 | + ); |
|
147 | + $r++; |
|
148 | + |
|
149 | + // Subject |
|
150 | + $this->info_box_contents[$i][$r] = array( |
|
151 | + 'td' => 'class="nowrap"', |
|
152 | + 'text' => $objp->subject, // Some event have no ref |
|
153 | + 'url' => DOL_URL_ROOT."/ticket/card.php?track_id=".$objp->track_id, |
|
154 | + ); |
|
155 | + $r++; |
|
156 | + |
|
157 | + // Customer |
|
158 | + $this->info_box_contents[$i][$r] = array( |
|
159 | + 'td' => 'class="tdoverflowmax150 maxwidth300onsmartphone"', |
|
160 | + 'text' => $link, |
|
161 | + 'asis' => 1, |
|
162 | + ); |
|
163 | + $r++; |
|
164 | + |
|
165 | + |
|
166 | + // Date creation |
|
167 | + $this->info_box_contents[$i][$r] = array( |
|
168 | + 'td' => 'class="right"', |
|
169 | + 'text' => dol_print_date($datec, 'dayhour') |
|
170 | + ); |
|
171 | + $r++; |
|
172 | + |
|
173 | + // Statut |
|
174 | + $this->info_box_contents[$i][$r] = array( |
|
175 | + 'td' => 'class="right nowraponall"', |
|
176 | + 'text' => $ticket->getLibStatut(3) |
|
177 | + ); |
|
178 | + $r++; |
|
179 | + |
|
180 | + $i++; |
|
181 | + } |
|
182 | + |
|
183 | + if ($num == 0) { |
|
184 | + $this->info_box_contents[$i][0] = array('td' => 'class="center"', 'text'=>$langs->trans("BoxLastModifiedTicketNoRecordedTickets")); |
|
185 | + } |
|
186 | + } else { |
|
187 | + dol_print_error($this->db); |
|
188 | + } |
|
189 | + } else { |
|
190 | + $this->info_box_contents[0][0] = array( |
|
191 | + 'td' => 'class="left"', |
|
192 | + 'text' => $langs->trans("ReadPermissionNotAllowed"), |
|
193 | + ); |
|
194 | + } |
|
195 | + } |
|
196 | + |
|
197 | + /** |
|
198 | + * Method to show box |
|
199 | + * |
|
200 | + * @param array $head Array with properties of box title |
|
201 | + * @param array $contents Array with properties of box lines |
|
202 | + * @param int $nooutput No print, only return string |
|
203 | + * @return string |
|
204 | + */ |
|
205 | + public function showBox($head = null, $contents = null, $nooutput = 0) |
|
206 | + { |
|
207 | + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); |
|
208 | + } |
|
209 | 209 | } |
@@ -30,75 +30,75 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class box_lastlogin extends ModeleBoxes |
32 | 32 | { |
33 | - public $boxcode = "lastlogin"; |
|
34 | - public $boximg = "object_user"; |
|
35 | - public $boxlabel = 'BoxLoginInformation'; |
|
36 | - public $depends = array("user"); |
|
33 | + public $boxcode = "lastlogin"; |
|
34 | + public $boximg = "object_user"; |
|
35 | + public $boxlabel = 'BoxLoginInformation'; |
|
36 | + public $depends = array("user"); |
|
37 | 37 | |
38 | - /** |
|
39 | - * @var DoliDB Database handler. |
|
40 | - */ |
|
41 | - public $db; |
|
38 | + /** |
|
39 | + * @var DoliDB Database handler. |
|
40 | + */ |
|
41 | + public $db; |
|
42 | 42 | |
43 | - public $param; |
|
44 | - public $enabled = 1; |
|
43 | + public $param; |
|
44 | + public $enabled = 1; |
|
45 | 45 | |
46 | - public $info_box_head = array(); |
|
47 | - public $info_box_contents = array(); |
|
46 | + public $info_box_head = array(); |
|
47 | + public $info_box_contents = array(); |
|
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * Constructor |
|
52 | - * |
|
53 | - * @param DoliDB $db Database handler |
|
54 | - * @param string $param More parameters |
|
55 | - */ |
|
56 | - public function __construct($db, $param) |
|
57 | - { |
|
58 | - global $conf; |
|
50 | + /** |
|
51 | + * Constructor |
|
52 | + * |
|
53 | + * @param DoliDB $db Database handler |
|
54 | + * @param string $param More parameters |
|
55 | + */ |
|
56 | + public function __construct($db, $param) |
|
57 | + { |
|
58 | + global $conf; |
|
59 | 59 | |
60 | - $this->db = $db; |
|
61 | - } |
|
60 | + $this->db = $db; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Charge les donnees en memoire pour affichage ulterieur |
|
65 | - * |
|
66 | - * @param int $max Maximum number of records to load |
|
67 | - * @return void |
|
68 | - */ |
|
69 | - public function loadBox($max = 5) |
|
70 | - { |
|
71 | - global $conf, $user, $langs; |
|
63 | + /** |
|
64 | + * Charge les donnees en memoire pour affichage ulterieur |
|
65 | + * |
|
66 | + * @param int $max Maximum number of records to load |
|
67 | + * @return void |
|
68 | + */ |
|
69 | + public function loadBox($max = 5) |
|
70 | + { |
|
71 | + global $conf, $user, $langs; |
|
72 | 72 | |
73 | - $textHead = $langs->trans("BoxLoginInformation"); |
|
74 | - $this->info_box_head = array( |
|
75 | - 'text' => $textHead, |
|
76 | - 'limit'=> dol_strlen($textHead), |
|
77 | - ); |
|
73 | + $textHead = $langs->trans("BoxLoginInformation"); |
|
74 | + $this->info_box_head = array( |
|
75 | + 'text' => $textHead, |
|
76 | + 'limit'=> dol_strlen($textHead), |
|
77 | + ); |
|
78 | 78 | |
79 | - $line = 0; |
|
80 | - $this->info_box_contents[$line][0] = array( |
|
81 | - 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', |
|
82 | - 'text' => $langs->trans("User"), |
|
83 | - ); |
|
84 | - $this->info_box_contents[$line][1] = array( |
|
85 | - 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', |
|
86 | - 'text' => $user->getNomUrl(-1), |
|
87 | - 'asis' => 1 |
|
88 | - ); |
|
79 | + $line = 0; |
|
80 | + $this->info_box_contents[$line][0] = array( |
|
81 | + 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', |
|
82 | + 'text' => $langs->trans("User"), |
|
83 | + ); |
|
84 | + $this->info_box_contents[$line][1] = array( |
|
85 | + 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', |
|
86 | + 'text' => $user->getNomUrl(-1), |
|
87 | + 'asis' => 1 |
|
88 | + ); |
|
89 | 89 | |
90 | - $line = 1; |
|
91 | - $this->info_box_contents[$line][0] = array( |
|
92 | - 'td' => '', |
|
93 | - 'text' => $langs->trans("PreviousConnexion"), |
|
94 | - ); |
|
95 | - if ($user->datepreviouslogin) $tmp = dol_print_date($user->datepreviouslogin, "dayhour", 'tzuser'); |
|
96 | - else $tmp = $langs->trans("Unknown"); |
|
97 | - $this->info_box_contents[$line][1] = array( |
|
98 | - 'td' => '', |
|
99 | - 'text' => $tmp, |
|
100 | - ); |
|
101 | - } |
|
90 | + $line = 1; |
|
91 | + $this->info_box_contents[$line][0] = array( |
|
92 | + 'td' => '', |
|
93 | + 'text' => $langs->trans("PreviousConnexion"), |
|
94 | + ); |
|
95 | + if ($user->datepreviouslogin) $tmp = dol_print_date($user->datepreviouslogin, "dayhour", 'tzuser'); |
|
96 | + else $tmp = $langs->trans("Unknown"); |
|
97 | + $this->info_box_contents[$line][1] = array( |
|
98 | + 'td' => '', |
|
99 | + 'text' => $tmp, |
|
100 | + ); |
|
101 | + } |
|
102 | 102 | |
103 | 103 | |
104 | 104 | /** |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * @param int $nooutput No print, only return string |
110 | 110 | * @return void |
111 | 111 | */ |
112 | - public function showBox($head = null, $contents = null, $nooutput = 0) |
|
113 | - { |
|
112 | + public function showBox($head = null, $contents = null, $nooutput = 0) |
|
113 | + { |
|
114 | 114 | parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); |
115 | 115 | } |
116 | 116 | } |
@@ -31,177 +31,177 @@ |
||
31 | 31 | class box_last_ticket extends ModeleBoxes |
32 | 32 | { |
33 | 33 | |
34 | - public $boxcode = "box_last_ticket"; |
|
35 | - public $boximg = "ticket"; |
|
36 | - public $boxlabel; |
|
37 | - public $depends = array("ticket"); |
|
38 | - |
|
39 | - /** |
|
40 | - * @var DoliDB Database handler. |
|
41 | - */ |
|
42 | - public $db; |
|
43 | - |
|
44 | - public $param; |
|
45 | - public $info_box_head = array(); |
|
46 | - public $info_box_contents = array(); |
|
47 | - |
|
48 | - /** |
|
49 | - * Constructor |
|
50 | - * @param DoliDB $db Database handler |
|
51 | - * @param string $param More parameters |
|
52 | - */ |
|
53 | - public function __construct($db, $param = '') |
|
54 | - { |
|
55 | - global $langs; |
|
56 | - $langs->load("boxes"); |
|
57 | - $this->db = $db; |
|
58 | - |
|
59 | - $this->boxlabel = $langs->transnoentitiesnoconv("BoxLastTicket"); |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * Load data into info_box_contents array to show array later. |
|
64 | - * |
|
65 | - * @param int $max Maximum number of records to load |
|
66 | - * @return void |
|
67 | - */ |
|
68 | - public function loadBox($max = 5) |
|
69 | - { |
|
70 | - global $conf, $user, $langs; |
|
71 | - |
|
72 | - $this->max = $max; |
|
73 | - |
|
74 | - require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php"; |
|
75 | - |
|
76 | - $text = $langs->trans("BoxLastTicketDescription", $max); |
|
77 | - $this->info_box_head = array( |
|
78 | - 'text' => $text, |
|
79 | - 'limit' => dol_strlen($text), |
|
80 | - ); |
|
81 | - |
|
82 | - $this->info_box_contents[0][0] = array( |
|
83 | - 'td' => 'class="left"', |
|
84 | - 'text' => $langs->trans("BoxLastTicketContent"), |
|
85 | - ); |
|
86 | - |
|
87 | - if ($user->rights->ticket->read) { |
|
88 | - $sql = "SELECT t.rowid as id, t.ref, t.track_id, t.fk_soc, t.fk_user_create, t.fk_user_assign, t.subject, t.message, t.fk_statut, t.type_code, t.category_code, t.severity_code, t.datec, t.date_read, t.date_close, t.origin_email "; |
|
89 | - $sql .= ", type.label as type_label, category.label as category_label, severity.label as severity_label"; |
|
90 | - $sql .= ", s.nom as company_name, s.email as socemail, s.client, s.fournisseur"; |
|
91 | - $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; |
|
92 | - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code"; |
|
93 | - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code"; |
|
94 | - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code=t.severity_code"; |
|
95 | - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=t.fk_soc"; |
|
96 | - |
|
97 | - $sql .= " WHERE t.entity = ".$conf->entity; |
|
98 | - // $sql.= " AND e.rowid = er.fk_event"; |
|
99 | - //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " WHERE s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
100 | - if ($user->socid) { |
|
101 | - $sql .= " AND t.fk_soc= ".$user->socid; |
|
102 | - } |
|
103 | - |
|
104 | - //$sql.= " AND t.fk_statut > 9"; |
|
105 | - |
|
106 | - $sql .= " ORDER BY t.datec DESC, t.rowid DESC "; |
|
107 | - $sql .= $this->db->plimit($max, 0); |
|
108 | - |
|
109 | - $resql = $this->db->query($sql); |
|
110 | - if ($resql) { |
|
111 | - $num = $this->db->num_rows($resql); |
|
112 | - |
|
113 | - $i = 0; |
|
114 | - |
|
115 | - while ($i < $num) { |
|
116 | - $objp = $this->db->fetch_object($resql); |
|
117 | - $datec = $this->db->jdate($objp->datec); |
|
118 | - $dateterm = $this->db->jdate($objp->fin_validite); |
|
119 | - $dateclose = $this->db->jdate($objp->date_cloture); |
|
120 | - $late = ''; |
|
121 | - |
|
122 | - $ticket = new Ticket($this->db); |
|
123 | - $ticket->id = $objp->id; |
|
124 | - $ticket->track_id = $objp->track_id; |
|
125 | - $ticket->ref = $objp->ref; |
|
126 | - $ticket->fk_statut = $objp->fk_statut; |
|
127 | - $ticket->subject = $objp->subject; |
|
128 | - if ($objp->fk_soc > 0) { |
|
129 | - $thirdparty = new Societe($this->db); |
|
130 | - $thirdparty->id = $objp->fk_soc; |
|
131 | - $thirdparty->email = $objp->socemail; |
|
132 | - $thirdparty->client = $objp->client; |
|
133 | - $thirdparty->fournisseur = $objp->fournisseur; |
|
134 | - $thirdparty->name = $objp->company_name; |
|
135 | - $link = $thirdparty->getNomUrl(1); |
|
136 | - } else { |
|
137 | - $link = dol_print_email($objp->origin_email); |
|
138 | - } |
|
139 | - |
|
140 | - $r = 0; |
|
141 | - |
|
142 | - // Ticket |
|
143 | - $this->info_box_contents[$i][$r] = array( |
|
144 | - 'td' => 'class="nowraponall"', |
|
145 | - 'text' => $ticket->getNomUrl(1), |
|
146 | - 'asis' => 1 |
|
147 | - ); |
|
148 | - $r++; |
|
149 | - |
|
150 | - // Subject |
|
151 | - $this->info_box_contents[$i][$r] = array( |
|
152 | - 'td' => '', |
|
153 | - 'text' => $objp->subject, // Some event have no ref |
|
154 | - 'url' => DOL_URL_ROOT."/ticket/card.php?track_id=".$objp->track_id, |
|
155 | - ); |
|
156 | - $r++; |
|
157 | - |
|
158 | - // Customer |
|
159 | - $this->info_box_contents[$i][$r] = array( |
|
160 | - 'td' => '', |
|
161 | - 'text' => $link, |
|
162 | - 'asis' => 1, |
|
163 | - ); |
|
164 | - $r++; |
|
165 | - |
|
166 | - // Date creation |
|
167 | - $this->info_box_contents[$i][$r] = array( |
|
168 | - 'td' => 'class="right"', |
|
169 | - 'text' => dol_print_date($datec, 'dayhour'), |
|
170 | - ); |
|
171 | - $r++; |
|
172 | - |
|
173 | - // Statut |
|
174 | - $this->info_box_contents[$i][$r] = array( |
|
175 | - 'td' => 'class="right nowraponall"', |
|
176 | - 'text' => $ticket->getLibStatut(3), |
|
177 | - ); |
|
178 | - $r++; |
|
179 | - |
|
180 | - $i++; |
|
181 | - } |
|
182 | - |
|
183 | - if ($num == 0) { |
|
184 | - $this->info_box_contents[$i][0] = array('td' => 'class="center"', 'text' => $langs->trans("BoxLastTicketNoRecordedTickets")); |
|
185 | - } |
|
186 | - } else { |
|
187 | - dol_print_error($this->db); |
|
188 | - } |
|
189 | - } else { |
|
190 | - $this->info_box_contents[0][0] = array('td' => 'class="left"', |
|
191 | - 'text' => $langs->trans("ReadPermissionNotAllowed")); |
|
192 | - } |
|
193 | - } |
|
194 | - |
|
195 | - /** |
|
196 | - * Method to show box |
|
197 | - * |
|
198 | - * @param array $head Array with properties of box title |
|
199 | - * @param array $contents Array with properties of box lines |
|
200 | - * @param int $nooutput No print, only return string |
|
201 | - * @return string |
|
202 | - */ |
|
203 | - public function showBox($head = null, $contents = null, $nooutput = 0) |
|
204 | - { |
|
205 | - parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); |
|
206 | - } |
|
34 | + public $boxcode = "box_last_ticket"; |
|
35 | + public $boximg = "ticket"; |
|
36 | + public $boxlabel; |
|
37 | + public $depends = array("ticket"); |
|
38 | + |
|
39 | + /** |
|
40 | + * @var DoliDB Database handler. |
|
41 | + */ |
|
42 | + public $db; |
|
43 | + |
|
44 | + public $param; |
|
45 | + public $info_box_head = array(); |
|
46 | + public $info_box_contents = array(); |
|
47 | + |
|
48 | + /** |
|
49 | + * Constructor |
|
50 | + * @param DoliDB $db Database handler |
|
51 | + * @param string $param More parameters |
|
52 | + */ |
|
53 | + public function __construct($db, $param = '') |
|
54 | + { |
|
55 | + global $langs; |
|
56 | + $langs->load("boxes"); |
|
57 | + $this->db = $db; |
|
58 | + |
|
59 | + $this->boxlabel = $langs->transnoentitiesnoconv("BoxLastTicket"); |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * Load data into info_box_contents array to show array later. |
|
64 | + * |
|
65 | + * @param int $max Maximum number of records to load |
|
66 | + * @return void |
|
67 | + */ |
|
68 | + public function loadBox($max = 5) |
|
69 | + { |
|
70 | + global $conf, $user, $langs; |
|
71 | + |
|
72 | + $this->max = $max; |
|
73 | + |
|
74 | + require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php"; |
|
75 | + |
|
76 | + $text = $langs->trans("BoxLastTicketDescription", $max); |
|
77 | + $this->info_box_head = array( |
|
78 | + 'text' => $text, |
|
79 | + 'limit' => dol_strlen($text), |
|
80 | + ); |
|
81 | + |
|
82 | + $this->info_box_contents[0][0] = array( |
|
83 | + 'td' => 'class="left"', |
|
84 | + 'text' => $langs->trans("BoxLastTicketContent"), |
|
85 | + ); |
|
86 | + |
|
87 | + if ($user->rights->ticket->read) { |
|
88 | + $sql = "SELECT t.rowid as id, t.ref, t.track_id, t.fk_soc, t.fk_user_create, t.fk_user_assign, t.subject, t.message, t.fk_statut, t.type_code, t.category_code, t.severity_code, t.datec, t.date_read, t.date_close, t.origin_email "; |
|
89 | + $sql .= ", type.label as type_label, category.label as category_label, severity.label as severity_label"; |
|
90 | + $sql .= ", s.nom as company_name, s.email as socemail, s.client, s.fournisseur"; |
|
91 | + $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; |
|
92 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code"; |
|
93 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code"; |
|
94 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code=t.severity_code"; |
|
95 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=t.fk_soc"; |
|
96 | + |
|
97 | + $sql .= " WHERE t.entity = ".$conf->entity; |
|
98 | + // $sql.= " AND e.rowid = er.fk_event"; |
|
99 | + //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " WHERE s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; |
|
100 | + if ($user->socid) { |
|
101 | + $sql .= " AND t.fk_soc= ".$user->socid; |
|
102 | + } |
|
103 | + |
|
104 | + //$sql.= " AND t.fk_statut > 9"; |
|
105 | + |
|
106 | + $sql .= " ORDER BY t.datec DESC, t.rowid DESC "; |
|
107 | + $sql .= $this->db->plimit($max, 0); |
|
108 | + |
|
109 | + $resql = $this->db->query($sql); |
|
110 | + if ($resql) { |
|
111 | + $num = $this->db->num_rows($resql); |
|
112 | + |
|
113 | + $i = 0; |
|
114 | + |
|
115 | + while ($i < $num) { |
|
116 | + $objp = $this->db->fetch_object($resql); |
|
117 | + $datec = $this->db->jdate($objp->datec); |
|
118 | + $dateterm = $this->db->jdate($objp->fin_validite); |
|
119 | + $dateclose = $this->db->jdate($objp->date_cloture); |
|
120 | + $late = ''; |
|
121 | + |
|
122 | + $ticket = new Ticket($this->db); |
|
123 | + $ticket->id = $objp->id; |
|
124 | + $ticket->track_id = $objp->track_id; |
|
125 | + $ticket->ref = $objp->ref; |
|
126 | + $ticket->fk_statut = $objp->fk_statut; |
|
127 | + $ticket->subject = $objp->subject; |
|
128 | + if ($objp->fk_soc > 0) { |
|
129 | + $thirdparty = new Societe($this->db); |
|
130 | + $thirdparty->id = $objp->fk_soc; |
|
131 | + $thirdparty->email = $objp->socemail; |
|
132 | + $thirdparty->client = $objp->client; |
|
133 | + $thirdparty->fournisseur = $objp->fournisseur; |
|
134 | + $thirdparty->name = $objp->company_name; |
|
135 | + $link = $thirdparty->getNomUrl(1); |
|
136 | + } else { |
|
137 | + $link = dol_print_email($objp->origin_email); |
|
138 | + } |
|
139 | + |
|
140 | + $r = 0; |
|
141 | + |
|
142 | + // Ticket |
|
143 | + $this->info_box_contents[$i][$r] = array( |
|
144 | + 'td' => 'class="nowraponall"', |
|
145 | + 'text' => $ticket->getNomUrl(1), |
|
146 | + 'asis' => 1 |
|
147 | + ); |
|
148 | + $r++; |
|
149 | + |
|
150 | + // Subject |
|
151 | + $this->info_box_contents[$i][$r] = array( |
|
152 | + 'td' => '', |
|
153 | + 'text' => $objp->subject, // Some event have no ref |
|
154 | + 'url' => DOL_URL_ROOT."/ticket/card.php?track_id=".$objp->track_id, |
|
155 | + ); |
|
156 | + $r++; |
|
157 | + |
|
158 | + // Customer |
|
159 | + $this->info_box_contents[$i][$r] = array( |
|
160 | + 'td' => '', |
|
161 | + 'text' => $link, |
|
162 | + 'asis' => 1, |
|
163 | + ); |
|
164 | + $r++; |
|
165 | + |
|
166 | + // Date creation |
|
167 | + $this->info_box_contents[$i][$r] = array( |
|
168 | + 'td' => 'class="right"', |
|
169 | + 'text' => dol_print_date($datec, 'dayhour'), |
|
170 | + ); |
|
171 | + $r++; |
|
172 | + |
|
173 | + // Statut |
|
174 | + $this->info_box_contents[$i][$r] = array( |
|
175 | + 'td' => 'class="right nowraponall"', |
|
176 | + 'text' => $ticket->getLibStatut(3), |
|
177 | + ); |
|
178 | + $r++; |
|
179 | + |
|
180 | + $i++; |
|
181 | + } |
|
182 | + |
|
183 | + if ($num == 0) { |
|
184 | + $this->info_box_contents[$i][0] = array('td' => 'class="center"', 'text' => $langs->trans("BoxLastTicketNoRecordedTickets")); |
|
185 | + } |
|
186 | + } else { |
|
187 | + dol_print_error($this->db); |
|
188 | + } |
|
189 | + } else { |
|
190 | + $this->info_box_contents[0][0] = array('td' => 'class="left"', |
|
191 | + 'text' => $langs->trans("ReadPermissionNotAllowed")); |
|
192 | + } |
|
193 | + } |
|
194 | + |
|
195 | + /** |
|
196 | + * Method to show box |
|
197 | + * |
|
198 | + * @param array $head Array with properties of box title |
|
199 | + * @param array $contents Array with properties of box lines |
|
200 | + * @param int $nooutput No print, only return string |
|
201 | + * @return string |
|
202 | + */ |
|
203 | + public function showBox($head = null, $contents = null, $nooutput = 0) |
|
204 | + { |
|
205 | + parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); |
|
206 | + } |
|
207 | 207 | } |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | public $WithoutAmbi; |
48 | 48 | |
49 | 49 | /** |
50 | - * @var DoliDB Database handler. |
|
51 | - */ |
|
52 | - public $db; |
|
50 | + * @var DoliDB Database handler. |
|
51 | + */ |
|
52 | + public $db; |
|
53 | 53 | |
54 | 54 | public $conf; |
55 | 55 | public $lang; |
@@ -145,22 +145,22 @@ discard block |
||
145 | 145 | { |
146 | 146 | $pass = ""; |
147 | 147 | for ($i = 0; $i < $this->NbMaj; $i++) { |
148 | - // Y |
|
148 | + // Y |
|
149 | 149 | $pass .= $this->Maj[mt_rand(0, strlen($this->Maj) - 1)]; |
150 | 150 | } |
151 | 151 | |
152 | 152 | for ($i = 0; $i < $this->NbNum; $i++) { |
153 | - // X |
|
153 | + // X |
|
154 | 154 | $pass .= $this->Nb[mt_rand(0, strlen($this->Nb) - 1)]; |
155 | 155 | } |
156 | 156 | |
157 | 157 | for ($i = 0; $i < $this->NbSpe; $i++) { |
158 | - // @ |
|
158 | + // @ |
|
159 | 159 | $pass .= $this->Spe[mt_rand(0, strlen($this->Spe) - 1)]; |
160 | 160 | } |
161 | 161 | |
162 | 162 | for ($i = strlen($pass); $i < $this->length2; $i++) { |
163 | - // y |
|
163 | + // y |
|
164 | 164 | $pass .= $this->All[mt_rand(0, strlen($this->All) - 1)]; |
165 | 165 | } |
166 | 166 | |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | * @param string $password Password to check |
212 | 212 | * @return bool |
213 | 213 | */ |
214 | - private function consecutiveInterationSameCharacter($password) |
|
215 | - { |
|
214 | + private function consecutiveInterationSameCharacter($password) |
|
215 | + { |
|
216 | 216 | $last = ""; |
217 | 217 | |
218 | 218 | if (empty($this->NbRepeat)) return 1; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | continue; |
229 | 229 | } |
230 | 230 | |
231 | - $count++; |
|
231 | + $count++; |
|
232 | 232 | if ($count > $this->NbRepeat) { |
233 | 233 | return false; |
234 | 234 | } |