cashcontrol.class.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. <?php
  2. /* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
  4. * Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
  5. * Copyright (C) 2018 Andreu Bisquerra <jove@bisquerra.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  19. */
  20. /**
  21. * \file htdocs/compta/cashcontrol/class/cashcontrol.class.php
  22. * \ingroup cashdesk|takepos
  23. * \brief This file is CRUD class file (Create/Read/Update/Delete) for cash fence table
  24. */
  25. /**
  26. * Class to manage cash fence
  27. */
  28. class CashControl extends CommonObject
  29. {
  30. /**
  31. * @var string ID to identify managed object
  32. */
  33. public $element = 'cashcontrol';
  34. /**
  35. * @var string Name of table without prefix where object is stored
  36. */
  37. public $table_element = 'pos_cash_fence';
  38. /**
  39. * @var int Does pos_cash_fence support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
  40. */
  41. public $ismultientitymanaged = 1;
  42. /**
  43. * @var int Does pos_cash_fence support extrafields ? 0=No, 1=Yes
  44. */
  45. public $isextrafieldmanaged = 0;
  46. /**
  47. * @var string String with name of icon for pos_cash_fence. Must be the part after the 'object_' into object_pos_cash_fence.png
  48. */
  49. public $picto = 'cash-register';
  50. /**
  51. * 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
  52. * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
  53. * 'label' the translation key.
  54. * 'picto' is code of a picto to show before value in forms
  55. * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM)
  56. * 'position' is the sort order of field.
  57. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
  58. * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
  59. * 'noteditable' says if field is not editable (1 or 0)
  60. * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
  61. * 'index' if we want an index in database.
  62. * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
  63. * 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
  64. * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
  65. * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'maxwidth200', 'wordbreak', 'tdoverflowmax200'
  66. * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click.
  67. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
  68. * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
  69. * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
  70. * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1.
  71. * 'comment' is not used. You can store here any text of your choice. It is not used by application.
  72. *
  73. * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor.
  74. */
  75. public $fields = array(
  76. 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>10),
  77. 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>15),
  78. 'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>18),
  79. 'posmodule' =>array('type'=>'varchar(30)', 'label'=>'Module', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>19),
  80. 'posnumber' =>array('type'=>'varchar(30)', 'label'=>'Terminal', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>20, 'css'=>'center'),
  81. 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>0, 'position'=>24),
  82. 'opening' =>array('type'=>'price', 'label'=>'Opening', 'enabled'=>1, 'visible'=>1, 'position'=>25, 'csslist'=>'amount'),
  83. 'cash' =>array('type'=>'price', 'label'=>'Cash', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'csslist'=>'amount'),
  84. 'cheque' =>array('type'=>'price', 'label'=>'Cheque', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'csslist'=>'amount'),
  85. 'card' =>array('type'=>'price', 'label'=>'CreditCard', 'enabled'=>1, 'visible'=>1, 'position'=>36, 'csslist'=>'amount'),
  86. 'year_close' =>array('type'=>'integer', 'label'=>'Year close', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>50, 'css'=>'center'),
  87. 'month_close' =>array('type'=>'integer', 'label'=>'Month close', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'css'=>'center'),
  88. 'day_close' =>array('type'=>'integer', 'label'=>'Day close', 'enabled'=>1, 'visible'=>1, 'position'=>60, 'css'=>'center'),
  89. 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
  90. 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>502),
  91. 'tms' =>array('type'=>'timestamp', 'label'=>'Tms', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>505),
  92. 'fk_user_creat' =>array('type'=>'integer:User', 'label'=>'UserCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>600),
  93. 'fk_user_valid' =>array('type'=>'integer:User', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>602),
  94. 'import_key' =>array('type'=>'varchar(14)', 'label'=>'Import key', 'enabled'=>1, 'visible'=>0, 'position'=>700),
  95. 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated')),
  96. );
  97. /**
  98. * @var int Object Id
  99. */
  100. public $id;
  101. public $label;
  102. public $opening;
  103. public $status;
  104. public $year_close;
  105. public $month_close;
  106. public $day_close;
  107. public $posmodule;
  108. public $posnumber;
  109. public $cash;
  110. public $cheque;
  111. public $card;
  112. /**
  113. * @var integer|string date_creation
  114. */
  115. public $date_creation;
  116. public $fk_user_creat;
  117. /**
  118. * @var integer|string $date_modification
  119. */
  120. public $date_modification;
  121. /**
  122. * @var integer|string $date_modification
  123. * @deprecated
  124. */
  125. public $tms;
  126. /**
  127. * @var integer|string $date_valid
  128. */
  129. public $date_valid;
  130. public $fk_user_valid;
  131. const STATUS_DRAFT = 0;
  132. const STATUS_VALIDATED = 1;
  133. const STATUS_CLOSED = 1; // For the moment CLOSED = VALIDATED
  134. /**
  135. * Constructor
  136. *
  137. * @param DoliDB $db Database handler
  138. */
  139. public function __construct(DoliDB $db)
  140. {
  141. $this->db = $db;
  142. }
  143. /**
  144. * Create in database
  145. *
  146. * @param User $user User that create
  147. * @param int $notrigger 0=launch triggers after, 1=disable triggers
  148. * @return int <0 if KO, Id of created object if OK
  149. */
  150. public function create(User $user, $notrigger = 0)
  151. {
  152. global $conf;
  153. $error = 0;
  154. // Clean data
  155. if (empty($this->cash)) {
  156. $this->cash = 0;
  157. }
  158. if (empty($this->cheque)) {
  159. $this->cheque = 0;
  160. }
  161. if (empty($this->card)) {
  162. $this->card = 0;
  163. }
  164. // Insert request
  165. $sql = "INSERT INTO ".MAIN_DB_PREFIX."pos_cash_fence (";
  166. $sql .= "entity";
  167. //$sql .= ", ref";
  168. $sql .= ", opening";
  169. $sql .= ", status";
  170. $sql .= ", date_creation";
  171. $sql .= ", posmodule";
  172. $sql .= ", posnumber";
  173. $sql .= ", day_close";
  174. $sql .= ", month_close";
  175. $sql .= ", year_close";
  176. $sql .= ", cash";
  177. $sql .= ", cheque";
  178. $sql .= ", card";
  179. $sql .= ") VALUES (";
  180. //$sql .= "'(PROV)', ";
  181. $sql .= ((int) $conf->entity);
  182. $sql .= ", ".(is_numeric($this->opening) ? price2num($this->opening, 'MT') : 0);
  183. $sql .= ", 0"; // Draft by default
  184. $sql .= ", '".$this->db->idate(dol_now())."'";
  185. $sql .= ", '".$this->db->escape($this->posmodule)."'";
  186. $sql .= ", '".$this->db->escape($this->posnumber)."'";
  187. $sql .= ", ".($this->day_close > 0 ? $this->day_close : "null");
  188. $sql .= ", ".($this->month_close > 0 ? $this->month_close : "null");
  189. $sql .= ", ".((int) $this->year_close);
  190. $sql .= ", ".price2num($this->cash, 'MT');
  191. $sql .= ", ".price2num($this->cheque, 'MT');
  192. $sql .= ", ".price2num($this->card, 'MT');
  193. $sql .= ")";
  194. $this->db->begin();
  195. dol_syslog(get_class($this)."::create", LOG_DEBUG);
  196. $resql = $this->db->query($sql);
  197. if (!$resql) {
  198. $error++;
  199. $this->errors[] = "Error ".$this->db->lasterror();
  200. }
  201. if (!$error) {
  202. $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."pos_cash_fence");
  203. $sql = 'UPDATE '.MAIN_DB_PREFIX.'pos_cash_fence SET ref = rowid where rowid = '.((int) $this->id);
  204. $this->db->query($sql);
  205. }
  206. // Commit or rollback
  207. if ($error) {
  208. foreach ($this->errors as $errmsg) {
  209. dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
  210. $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
  211. }
  212. $this->db->rollback();
  213. return -1 * $error;
  214. } else {
  215. $this->db->commit();
  216. return $this->id;
  217. }
  218. }
  219. /**
  220. * Validate cash fence
  221. *
  222. * @param User $user User
  223. * @param number $notrigger No trigger
  224. * @return int <0 if KO, >0 if OK
  225. */
  226. public function valid(User $user, $notrigger = 0)
  227. {
  228. global $conf, $langs;
  229. require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  230. $error = 0;
  231. // Protection
  232. if ($this->status == self::STATUS_VALIDATED) {
  233. dol_syslog(get_class($this)."::valid action abandonned: already validated", LOG_WARNING);
  234. return 0;
  235. }
  236. /*
  237. $posmodule = $this->posmodule;
  238. if (!empty($user->rights->$posmodule->use))
  239. {
  240. $this->error='NotEnoughPermissions';
  241. dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
  242. return -1;
  243. }
  244. */
  245. $now = dol_now();
  246. // Update request
  247. $sql = "UPDATE ".MAIN_DB_PREFIX."pos_cash_fence";
  248. $sql .= " SET status = ".self::STATUS_VALIDATED.",";
  249. $sql .= " date_valid='".$this->db->idate($now)."',";
  250. $sql .= " fk_user_valid = ".$user->id;
  251. $sql .= " WHERE rowid=".((int) $this->id);
  252. $this->db->begin();
  253. dol_syslog(get_class($this)."::close", LOG_DEBUG);
  254. $resql = $this->db->query($sql);
  255. if (!$resql) {
  256. $error++;
  257. $this->errors[] = "Error ".$this->db->lasterror();
  258. }
  259. if (!$error) {
  260. $this->status = self::STATUS_VALIDATED;
  261. $this->date_valid = $now;
  262. $this->fk_user_valid = $user->id;
  263. }
  264. if (!$error && !$notrigger) {
  265. // Call trigger
  266. $result = $this->call_trigger('CASHCONTROL_VALIDATE', $user);
  267. if ($result < 0) {
  268. $error++;
  269. }
  270. // End call triggers
  271. }
  272. // Commit or rollback
  273. if ($error) {
  274. foreach ($this->errors as $errmsg) {
  275. dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
  276. $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
  277. }
  278. $this->db->rollback();
  279. return -1 * $error;
  280. } else {
  281. $this->db->commit();
  282. return $this->id;
  283. }
  284. }
  285. /**
  286. * Load object in memory from the database
  287. *
  288. * @param int $id Id object
  289. * @param string $ref Ref
  290. * @return int <0 if KO, 0 if not found, >0 if OK
  291. */
  292. public function fetch($id, $ref = null)
  293. {
  294. $result = $this->fetchCommon($id, $ref);
  295. //if ($result > 0 && !empty($this->table_element_line)) $this->fetchLines();
  296. return $result;
  297. }
  298. /**
  299. * Update object into database
  300. *
  301. * @param User $user User that modifies
  302. * @param bool $notrigger false=launch triggers after, true=disable triggers
  303. * @return int <0 if KO, >0 if OK
  304. */
  305. public function update(User $user, $notrigger = false)
  306. {
  307. return $this->updateCommon($user, $notrigger);
  308. }
  309. /**
  310. * Delete object in database
  311. *
  312. * @param User $user User that deletes
  313. * @param bool $notrigger false=launch triggers after, true=disable triggers
  314. * @return int <0 if KO, >0 if OK
  315. */
  316. public function delete(User $user, $notrigger = false)
  317. {
  318. return $this->deleteCommon($user, $notrigger);
  319. //return $this->deleteCommon($user, $notrigger, 1);
  320. }
  321. /**
  322. * Return label of the status
  323. *
  324. * @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
  325. * @return string Label of status
  326. */
  327. public function getLibStatut($mode = 0)
  328. {
  329. return $this->LibStatut($this->status, $mode);
  330. }
  331. // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
  332. /**
  333. * Return the status
  334. *
  335. * @param int $status Id status
  336. * @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
  337. * @return string Label of status
  338. */
  339. public function LibStatut($status, $mode = 0)
  340. {
  341. // phpcs:enable
  342. if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
  343. global $langs;
  344. //$langs->load("mymodule");
  345. $this->labelStatus[0] = $langs->transnoentitiesnoconv('Draft');
  346. $this->labelStatus[1] = $langs->transnoentitiesnoconv('Closed');
  347. $this->labelStatusShort[0] = $langs->transnoentitiesnoconv('Draft');
  348. $this->labelStatusShort[1] = $langs->transnoentitiesnoconv('Closed');
  349. }
  350. $statusType = 'status0';
  351. if ($status == self::STATUS_VALIDATED) {
  352. $statusType = 'status6';
  353. }
  354. return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
  355. }
  356. /**
  357. * Return clicable link of object (with eventually picto)
  358. *
  359. * @param int $withpicto Add picto into link
  360. * @param string $option On what the link point to ('nolink', ...)
  361. * @param int $notooltip 1=Disable tooltip
  362. * @param string $morecss Add more css on link
  363. * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
  364. * @return string String with URL
  365. */
  366. public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
  367. {
  368. global $conf, $langs, $hookmanager;
  369. if (!empty($conf->dol_no_mouse_hover)) {
  370. $notooltip = 1; // Force disable tooltips
  371. }
  372. $result = '';
  373. $newref = ($this->ref ? $this->ref : $this->id);
  374. $label = '<u>'.$langs->trans("CashControl").'</u>';
  375. $label .= '<br>';
  376. $label .= '<b>'.$langs->trans('Ref').':</b> '.($this->ref ? $this->ref : $this->id);
  377. $url = DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card.php?id='.$this->id;
  378. if ($option != 'nolink') {
  379. // Add param to save lastsearch_values or not
  380. $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
  381. if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
  382. $add_save_lastsearch_values = 1;
  383. }
  384. if ($add_save_lastsearch_values) {
  385. $url .= '&save_lastsearch_values=1';
  386. }
  387. }
  388. $linkclose = '';
  389. if (empty($notooltip)) {
  390. if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
  391. $label = $langs->trans("ShowMyObject");
  392. $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
  393. }
  394. $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
  395. $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
  396. } else {
  397. $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
  398. }
  399. $linkstart = '<a href="'.$url.'"';
  400. $linkstart .= $linkclose.'>';
  401. $linkend = '</a>';
  402. $result .= $linkstart;
  403. if ($withpicto) {
  404. $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
  405. }
  406. if ($withpicto != 2) {
  407. $result .= $this->ref;
  408. }
  409. $result .= $linkend;
  410. //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
  411. global $action;
  412. $hookmanager->initHooks(array('cashfencedao'));
  413. $parameters = array('id'=>$this->id, 'getnomurl' => &$result);
  414. $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
  415. if ($reshook > 0) {
  416. $result = $hookmanager->resPrint;
  417. } else {
  418. $result .= $hookmanager->resPrint;
  419. }
  420. return $result;
  421. }
  422. /**
  423. * Return clicable link of object (with eventually picto)
  424. *
  425. * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
  426. * @param array $arraydata Array of data
  427. * @return string HTML Code for Kanban thumb.
  428. */
  429. public function getKanbanView($option = '', $arraydata = null)
  430. {
  431. global $langs;
  432. $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
  433. $return = '<div class="box-flex-item box-flex-grow-zero">';
  434. $return .= '<div class="info-box info-box-sm">';
  435. $return .= '<span class="info-box-icon bg-infobox-action">';
  436. $return .= img_picto('', $this->picto);
  437. //var_dump($this->fields['rowid']);exit;
  438. $return .= '</span>';
  439. $return .= '<div class="info-box-content">';
  440. $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1, 1) : $this->ref).'</span>';
  441. if ($selected >= 0) {
  442. $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
  443. }
  444. if (property_exists($this, 'posmodule')) {
  445. $return .= '<br><span class="opacitymedium">'.substr($langs->trans("Module/Application"), 0, 12).'</span> : <span class="info-box-label">'.$this->posmodule.'</span>';
  446. }
  447. if (property_exists($this, 'year_close')) {
  448. $return .= '<br><span class="info-box-label opacitymedium" >'.$langs->trans("Year").'</span> : <span>'.$this->year_close.'</span>';
  449. }
  450. if (method_exists($this, 'getLibStatut')) {
  451. $return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(3).'</div>';
  452. }
  453. $return .= '</div>';
  454. $return .= '</div>';
  455. $return .= '</div>';
  456. return $return;
  457. }
  458. }