@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * \brief File to manage no password generation. |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | -require_once DOL_DOCUMENT_ROOT .'/core/modules/security/generate/modules_genpassword.php'; |
|
| 27 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/security/generate/modules_genpassword.php'; |
|
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -67,23 +67,23 @@ discard block |
||
| 67 | 67 | $this->id = "Perso"; |
| 68 | 68 | $this->length = $langs->trans("SetupPerso"); |
| 69 | 69 | |
| 70 | - $this->db=$db; |
|
| 71 | - $this->conf=$conf; |
|
| 72 | - $this->langs=$langs; |
|
| 73 | - $this->user=$user; |
|
| 70 | + $this->db = $db; |
|
| 71 | + $this->conf = $conf; |
|
| 72 | + $this->langs = $langs; |
|
| 73 | + $this->user = $user; |
|
| 74 | 74 | |
| 75 | - if(empty($conf->global->USER_PASSWORD_PATTERN)){ |
|
| 75 | + if (empty($conf->global->USER_PASSWORD_PATTERN)) { |
|
| 76 | 76 | // default value (8carac, 1maj, 1digit, 1spe, 3 repeat, no ambi at auto generation. |
| 77 | - dolibarr_set_const($db, "USER_PASSWORD_PATTERN", '8;1;1;1;3;1','chaine',0,'',$conf->entity); |
|
| 77 | + dolibarr_set_const($db, "USER_PASSWORD_PATTERN", '8;1;1;1;3;1', 'chaine', 0, '', $conf->entity); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | $this->Maj = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; |
| 81 | 81 | $this->Min = strtolower($this->Maj); |
| 82 | 82 | $this->Nb = "0123456789"; |
| 83 | 83 | $this->Spe = "!@#$%&*()_-+={}[]\\|:;'/"; |
| 84 | - $this->Ambi = array("1","I","l","|","O","0"); |
|
| 84 | + $this->Ambi = array("1", "I", "l", "|", "O", "0"); |
|
| 85 | 85 | |
| 86 | - $tabConf = explode(";",$conf->global->USER_PASSWORD_PATTERN); |
|
| 86 | + $tabConf = explode(";", $conf->global->USER_PASSWORD_PATTERN); |
|
| 87 | 87 | $this->length2 = $tabConf[0]; |
| 88 | 88 | $this->NbMaj = $tabConf[1]; |
| 89 | 89 | $this->NbNum = $tabConf[2]; |
@@ -93,13 +93,13 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | if ($this->WithoutAmbi) |
| 95 | 95 | { |
| 96 | - $this->Maj = str_replace($this->Ambi,"",$this->Maj); |
|
| 97 | - $this->Min = str_replace($this->Ambi,"",$this->Min); |
|
| 98 | - $this->Nb = str_replace($this->Ambi,"",$this->Nb); |
|
| 99 | - $this->Spe = str_replace($this->Ambi,"",$this->Spe); |
|
| 96 | + $this->Maj = str_replace($this->Ambi, "", $this->Maj); |
|
| 97 | + $this->Min = str_replace($this->Ambi, "", $this->Min); |
|
| 98 | + $this->Nb = str_replace($this->Ambi, "", $this->Nb); |
|
| 99 | + $this->Spe = str_replace($this->Ambi, "", $this->Spe); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - $pattern = $this->Min . (! empty($this->NbMaj)?$this->Maj:'') . (! empty($this->NbNum)?$this->Nb:'') . (! empty($this->NbSpe)?$this->Spe:''); |
|
| 102 | + $pattern = $this->Min.(!empty($this->NbMaj) ? $this->Maj : '').(!empty($this->NbNum) ? $this->Nb : '').(!empty($this->NbSpe) ? $this->Spe : ''); |
|
| 103 | 103 | $this->All = str_shuffle($pattern); |
| 104 | 104 | |
| 105 | 105 | //$this->All = str_shuffle($this->Maj. $this->Min. $this->Nb. $this->Spe); |
@@ -137,20 +137,20 @@ discard block |
||
| 137 | 137 | function getNewGeneratedPassword() |
| 138 | 138 | { |
| 139 | 139 | $pass = ""; |
| 140 | - for($i=0; $i<$this->NbMaj; $i++){ // Y |
|
| 141 | - $pass .= $this->Maj[mt_rand(0,strlen($this->Maj) - 1)]; |
|
| 140 | + for ($i = 0; $i < $this->NbMaj; $i++) { // Y |
|
| 141 | + $pass .= $this->Maj[mt_rand(0, strlen($this->Maj) - 1)]; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - for($i=0; $i<$this->NbNum; $i++){ // X |
|
| 145 | - $pass .= $this->Nb[mt_rand(0,strlen($this->Nb) - 1)]; |
|
| 144 | + for ($i = 0; $i < $this->NbNum; $i++) { // X |
|
| 145 | + $pass .= $this->Nb[mt_rand(0, strlen($this->Nb) - 1)]; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - for($i=0; $i<$this->NbSpe; $i++){ // @ |
|
| 149 | - $pass .= $this->Spe[mt_rand(0,strlen($this->Spe) - 1)]; |
|
| 148 | + for ($i = 0; $i < $this->NbSpe; $i++) { // @ |
|
| 149 | + $pass .= $this->Spe[mt_rand(0, strlen($this->Spe) - 1)]; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - for($i=strlen($pass);$i<$this->length2; $i++){ // y |
|
| 153 | - $pass .= $this->All[mt_rand(0,strlen($this->All) -1)]; |
|
| 152 | + for ($i = strlen($pass); $i < $this->length2; $i++) { // y |
|
| 153 | + $pass .= $this->All[mt_rand(0, strlen($this->All) - 1)]; |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | $pass = str_shuffle($pass); |
@@ -176,19 +176,19 @@ discard block |
||
| 176 | 176 | $num = str_split($this->Nb); |
| 177 | 177 | $spe = str_split($this->Spe); |
| 178 | 178 | |
| 179 | - if(count(array_intersect($password_a, $maj)) < $this->NbMaj){ |
|
| 179 | + if (count(array_intersect($password_a, $maj)) < $this->NbMaj) { |
|
| 180 | 180 | return 0; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - if(count(array_intersect($password_a, $num)) < $this->NbNum){ |
|
| 183 | + if (count(array_intersect($password_a, $num)) < $this->NbNum) { |
|
| 184 | 184 | return 0; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - if(count(array_intersect($password_a, $spe)) < $this->NbSpe){ |
|
| 187 | + if (count(array_intersect($password_a, $spe)) < $this->NbSpe) { |
|
| 188 | 188 | return 0; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - if(!$this->consecutiveInterationSameCharacter($password)){ |
|
| 191 | + if (!$this->consecutiveInterationSameCharacter($password)) { |
|
| 192 | 192 | return 0; |
| 193 | 193 | } |
| 194 | 194 | |
@@ -201,19 +201,19 @@ discard block |
||
| 201 | 201 | * @param string $password Password to check |
| 202 | 202 | * @return int 0 if KO, >0 if OK |
| 203 | 203 | */ |
| 204 | - function consecutiveInterationSameCharacter($password){ |
|
| 204 | + function consecutiveInterationSameCharacter($password) { |
|
| 205 | 205 | $last = ""; |
| 206 | 206 | $count = 0; |
| 207 | 207 | $char = str_split($password); |
| 208 | - foreach($char as $c){ |
|
| 209 | - if($c != $last){ |
|
| 208 | + foreach ($char as $c) { |
|
| 209 | + if ($c != $last) { |
|
| 210 | 210 | $last = $c; |
| 211 | 211 | $count = 0; |
| 212 | - }else{ |
|
| 212 | + } else { |
|
| 213 | 213 | $count++; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - if($count >= $this->NbRepeat) { |
|
| 216 | + if ($count >= $this->NbRepeat) { |
|
| 217 | 217 | return 0; |
| 218 | 218 | } |
| 219 | 219 | } |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | */ |
| 5 | 5 | class Comment extends CommonObject |
| 6 | 6 | { |
| 7 | - public $element='comment'; //!< Id that identify managed objects |
|
| 8 | - public $table_element='comment'; //!< Name of table without prefix where object is stored |
|
| 7 | + public $element = 'comment'; //!< Id that identify managed objects |
|
| 8 | + public $table_element = 'comment'; //!< Name of table without prefix where object is stored |
|
| 9 | 9 | |
| 10 | 10 | var $fk_element; |
| 11 | 11 | var $element_type; |
@@ -43,30 +43,30 @@ discard block |
||
| 43 | 43 | * @param int $notrigger 0=launch triggers after, 1=disable triggers |
| 44 | 44 | * @return int <0 if KO, Id of created object if OK |
| 45 | 45 | */ |
| 46 | - function create($user, $notrigger=0) |
|
| 46 | + function create($user, $notrigger = 0) |
|
| 47 | 47 | { |
| 48 | 48 | global $conf, $langs; |
| 49 | 49 | |
| 50 | - $error=0; |
|
| 50 | + $error = 0; |
|
| 51 | 51 | |
| 52 | 52 | // Insert request |
| 53 | 53 | $sql = "INSERT INTO ".MAIN_DB_PREFIX."comment ("; |
| 54 | - $sql.= "description"; |
|
| 55 | - $sql.= ", datec"; |
|
| 56 | - $sql.= ", fk_element"; |
|
| 57 | - $sql.= ", element_type"; |
|
| 58 | - $sql.= ", fk_user_author"; |
|
| 59 | - $sql.= ", entity"; |
|
| 60 | - $sql.= ", import_key"; |
|
| 61 | - $sql.= ") VALUES ("; |
|
| 62 | - $sql.= "'".$this->db->escape($this->description)."'"; |
|
| 63 | - $sql.= ", ".($this->datec!=''?"'".$this->db->idate($this->datec)."'":'null'); |
|
| 64 | - $sql.= ", '".(isset($this->fk_element)?$this->fk_element:"null")."'"; |
|
| 65 | - $sql.= ", '".$this->db->escape($this->element_type)."'"; |
|
| 66 | - $sql.= ", '".(isset($this->fk_user_author)?$this->fk_user_author:"null")."'"; |
|
| 67 | - $sql.= ", ".(!empty($this->entity)?$this->entity:'1'); |
|
| 68 | - $sql.= ", ".(!empty($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null"); |
|
| 69 | - $sql.= ")"; |
|
| 54 | + $sql .= "description"; |
|
| 55 | + $sql .= ", datec"; |
|
| 56 | + $sql .= ", fk_element"; |
|
| 57 | + $sql .= ", element_type"; |
|
| 58 | + $sql .= ", fk_user_author"; |
|
| 59 | + $sql .= ", entity"; |
|
| 60 | + $sql .= ", import_key"; |
|
| 61 | + $sql .= ") VALUES ("; |
|
| 62 | + $sql .= "'".$this->db->escape($this->description)."'"; |
|
| 63 | + $sql .= ", ".($this->datec != '' ? "'".$this->db->idate($this->datec)."'" : 'null'); |
|
| 64 | + $sql .= ", '".(isset($this->fk_element) ? $this->fk_element : "null")."'"; |
|
| 65 | + $sql .= ", '".$this->db->escape($this->element_type)."'"; |
|
| 66 | + $sql .= ", '".(isset($this->fk_user_author) ? $this->fk_user_author : "null")."'"; |
|
| 67 | + $sql .= ", ".(!empty($this->entity) ? $this->entity : '1'); |
|
| 68 | + $sql .= ", ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); |
|
| 69 | + $sql .= ")"; |
|
| 70 | 70 | |
| 71 | 71 | //var_dump($this->db); |
| 72 | 72 | //echo $sql; |
@@ -74,17 +74,17 @@ discard block |
||
| 74 | 74 | $this->db->begin(); |
| 75 | 75 | |
| 76 | 76 | dol_syslog(get_class($this)."::create", LOG_DEBUG); |
| 77 | - $resql=$this->db->query($sql); |
|
| 78 | - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } |
|
| 77 | + $resql = $this->db->query($sql); |
|
| 78 | + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } |
|
| 79 | 79 | |
| 80 | - if (! $error) |
|
| 80 | + if (!$error) |
|
| 81 | 81 | { |
| 82 | 82 | $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task_comment"); |
| 83 | 83 | |
| 84 | - if (! $notrigger) |
|
| 84 | + if (!$notrigger) |
|
| 85 | 85 | { |
| 86 | 86 | // Call trigger |
| 87 | - $result=$this->call_trigger('TASK_COMMENT_CREATE',$user); |
|
| 87 | + $result = $this->call_trigger('TASK_COMMENT_CREATE', $user); |
|
| 88 | 88 | if ($result < 0) { $error++; } |
| 89 | 89 | // End call triggers |
| 90 | 90 | } |
@@ -93,13 +93,13 @@ discard block |
||
| 93 | 93 | // Commit or rollback |
| 94 | 94 | if ($error) |
| 95 | 95 | { |
| 96 | - foreach($this->errors as $errmsg) |
|
| 96 | + foreach ($this->errors as $errmsg) |
|
| 97 | 97 | { |
| 98 | 98 | dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); |
| 99 | - $this->error.=($this->error?', '.$errmsg:$errmsg); |
|
| 99 | + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); |
|
| 100 | 100 | } |
| 101 | 101 | $this->db->rollback(); |
| 102 | - return -1*$error; |
|
| 102 | + return -1 * $error; |
|
| 103 | 103 | } |
| 104 | 104 | else |
| 105 | 105 | { |
@@ -116,25 +116,25 @@ discard block |
||
| 116 | 116 | * @param int $ref ref object |
| 117 | 117 | * @return int <0 if KO, 0 if not found, >0 if OK |
| 118 | 118 | */ |
| 119 | - function fetch($id, $ref='') |
|
| 119 | + function fetch($id, $ref = '') |
|
| 120 | 120 | { |
| 121 | 121 | global $langs; |
| 122 | 122 | |
| 123 | 123 | $sql = "SELECT"; |
| 124 | - $sql.= " c.rowid,"; |
|
| 125 | - $sql.= " c.description,"; |
|
| 126 | - $sql.= " c.datec,"; |
|
| 127 | - $sql.= " c.tms,"; |
|
| 128 | - $sql.= " c.fk_element,"; |
|
| 129 | - $sql.= " c.element_type,"; |
|
| 130 | - $sql.= " c.fk_user_author,"; |
|
| 131 | - $sql.= " c.entity,"; |
|
| 132 | - $sql.= " c.import_key"; |
|
| 133 | - $sql.= " FROM ".MAIN_DB_PREFIX."comment as c"; |
|
| 134 | - $sql.= " WHERE c.rowid = ".$id; |
|
| 124 | + $sql .= " c.rowid,"; |
|
| 125 | + $sql .= " c.description,"; |
|
| 126 | + $sql .= " c.datec,"; |
|
| 127 | + $sql .= " c.tms,"; |
|
| 128 | + $sql .= " c.fk_element,"; |
|
| 129 | + $sql .= " c.element_type,"; |
|
| 130 | + $sql .= " c.fk_user_author,"; |
|
| 131 | + $sql .= " c.entity,"; |
|
| 132 | + $sql .= " c.import_key"; |
|
| 133 | + $sql .= " FROM ".MAIN_DB_PREFIX."comment as c"; |
|
| 134 | + $sql .= " WHERE c.rowid = ".$id; |
|
| 135 | 135 | |
| 136 | 136 | dol_syslog(get_class($this)."::fetch", LOG_DEBUG); |
| 137 | - $resql=$this->db->query($sql); |
|
| 137 | + $resql = $this->db->query($sql); |
|
| 138 | 138 | if ($resql) |
| 139 | 139 | { |
| 140 | 140 | $num_rows = $this->db->num_rows($resql); |
@@ -143,14 +143,14 @@ discard block |
||
| 143 | 143 | { |
| 144 | 144 | $obj = $this->db->fetch_object($resql); |
| 145 | 145 | |
| 146 | - $this->id = $obj->rowid; |
|
| 147 | - $this->description = $obj->description; |
|
| 148 | - $this->element_type = $obj->element_type; |
|
| 149 | - $this->datec = $this->db->jdate($obj->datec); |
|
| 150 | - $this->tms = $obj->tms; |
|
| 151 | - $this->fk_user_author = $obj->fk_user_author; |
|
| 146 | + $this->id = $obj->rowid; |
|
| 147 | + $this->description = $obj->description; |
|
| 148 | + $this->element_type = $obj->element_type; |
|
| 149 | + $this->datec = $this->db->jdate($obj->datec); |
|
| 150 | + $this->tms = $obj->tms; |
|
| 151 | + $this->fk_user_author = $obj->fk_user_author; |
|
| 152 | 152 | $this->fk_element = $obj->fk_element; |
| 153 | - $this->entity = $obj->entity; |
|
| 153 | + $this->entity = $obj->entity; |
|
| 154 | 154 | $this->import_key = $obj->import_key; |
| 155 | 155 | } |
| 156 | 156 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | } |
| 162 | 162 | else |
| 163 | 163 | { |
| 164 | - $this->error="Error ".$this->db->lasterror(); |
|
| 164 | + $this->error = "Error ".$this->db->lasterror(); |
|
| 165 | 165 | return -1; |
| 166 | 166 | } |
| 167 | 167 | } |
@@ -174,40 +174,40 @@ discard block |
||
| 174 | 174 | * @param int $notrigger 0=launch triggers after, 1=disable triggers |
| 175 | 175 | * @return int <=0 if KO, >0 if OK |
| 176 | 176 | */ |
| 177 | - function update(User $user, $notrigger=0) |
|
| 177 | + function update(User $user, $notrigger = 0) |
|
| 178 | 178 | { |
| 179 | 179 | global $conf, $langs; |
| 180 | - $error=0; |
|
| 180 | + $error = 0; |
|
| 181 | 181 | |
| 182 | 182 | // Clean parameters |
| 183 | - if (isset($this->fk_element)) $this->fk_project=(int) trim($this->fk_element); |
|
| 184 | - if (isset($this->fk_user_author)) $this->fk_user_author=(int) trim($this->fk_user_author); |
|
| 185 | - if (isset($this->description)) $this->description=trim($this->description); |
|
| 183 | + if (isset($this->fk_element)) $this->fk_project = (int) trim($this->fk_element); |
|
| 184 | + if (isset($this->fk_user_author)) $this->fk_user_author = (int) trim($this->fk_user_author); |
|
| 185 | + if (isset($this->description)) $this->description = trim($this->description); |
|
| 186 | 186 | |
| 187 | 187 | |
| 188 | 188 | // Update request |
| 189 | 189 | $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_comment SET"; |
| 190 | - $sql.= " description=".(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").","; |
|
| 191 | - $sql.= " datec=".($this->datec!=''?"'".$this->db->idate($this->datec)."'":'null').","; |
|
| 192 | - $sql.= " fk_element=".(isset($this->fk_element)?$this->fk_element:"null").","; |
|
| 193 | - $sql.= " element_type='".$this->db->escape($this->element_type)."',"; |
|
| 194 | - $sql.= " fk_user_author=".(isset($this->fk_user_author)?$this->fk_user_author:"null").","; |
|
| 195 | - $sql.= " entity=".(!empty($this->entity)?$this->entity:'1').","; |
|
| 196 | - $sql.= " import_key=".(!empty($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null"); |
|
| 197 | - $sql.= " WHERE rowid=".$this->id; |
|
| 190 | + $sql .= " description=".(isset($this->description) ? "'".$this->db->escape($this->description)."'" : "null").","; |
|
| 191 | + $sql .= " datec=".($this->datec != '' ? "'".$this->db->idate($this->datec)."'" : 'null').","; |
|
| 192 | + $sql .= " fk_element=".(isset($this->fk_element) ? $this->fk_element : "null").","; |
|
| 193 | + $sql .= " element_type='".$this->db->escape($this->element_type)."',"; |
|
| 194 | + $sql .= " fk_user_author=".(isset($this->fk_user_author) ? $this->fk_user_author : "null").","; |
|
| 195 | + $sql .= " entity=".(!empty($this->entity) ? $this->entity : '1').","; |
|
| 196 | + $sql .= " import_key=".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); |
|
| 197 | + $sql .= " WHERE rowid=".$this->id; |
|
| 198 | 198 | |
| 199 | 199 | $this->db->begin(); |
| 200 | 200 | |
| 201 | 201 | dol_syslog(get_class($this)."::update", LOG_DEBUG); |
| 202 | 202 | $resql = $this->db->query($sql); |
| 203 | - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } |
|
| 203 | + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } |
|
| 204 | 204 | |
| 205 | - if (! $error) |
|
| 205 | + if (!$error) |
|
| 206 | 206 | { |
| 207 | - if (! $notrigger) |
|
| 207 | + if (!$notrigger) |
|
| 208 | 208 | { |
| 209 | 209 | // Call trigger |
| 210 | - $result=$this->call_trigger('TASK_COMMENT_MODIFY',$user); |
|
| 210 | + $result = $this->call_trigger('TASK_COMMENT_MODIFY', $user); |
|
| 211 | 211 | if ($result < 0) { $error++; } |
| 212 | 212 | // End call triggers |
| 213 | 213 | } |
@@ -216,13 +216,13 @@ discard block |
||
| 216 | 216 | // Commit or rollback |
| 217 | 217 | if ($error) |
| 218 | 218 | { |
| 219 | - foreach($this->errors as $errmsg) |
|
| 219 | + foreach ($this->errors as $errmsg) |
|
| 220 | 220 | { |
| 221 | 221 | dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); |
| 222 | - $this->error.=($this->error?', '.$errmsg:$errmsg); |
|
| 222 | + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); |
|
| 223 | 223 | } |
| 224 | 224 | $this->db->rollback(); |
| 225 | - return -1*$error; |
|
| 225 | + return -1 * $error; |
|
| 226 | 226 | } |
| 227 | 227 | else |
| 228 | 228 | { |
@@ -239,27 +239,27 @@ discard block |
||
| 239 | 239 | * @param int $notrigger 0=launch triggers after, 1=disable triggers |
| 240 | 240 | * @return int <0 if KO, >0 if OK |
| 241 | 241 | */ |
| 242 | - function delete($user, $notrigger=0) |
|
| 242 | + function delete($user, $notrigger = 0) |
|
| 243 | 243 | { |
| 244 | 244 | global $conf, $langs; |
| 245 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
| 245 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
| 246 | 246 | |
| 247 | - $error=0; |
|
| 247 | + $error = 0; |
|
| 248 | 248 | |
| 249 | 249 | $this->db->begin(); |
| 250 | 250 | |
| 251 | 251 | $sql = "DELETE FROM ".MAIN_DB_PREFIX."comment"; |
| 252 | - $sql.= " WHERE rowid=".$this->id; |
|
| 252 | + $sql .= " WHERE rowid=".$this->id; |
|
| 253 | 253 | |
| 254 | 254 | $resql = $this->db->query($sql); |
| 255 | - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } |
|
| 255 | + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } |
|
| 256 | 256 | |
| 257 | - if (! $error) |
|
| 257 | + if (!$error) |
|
| 258 | 258 | { |
| 259 | - if (! $notrigger) |
|
| 259 | + if (!$notrigger) |
|
| 260 | 260 | { |
| 261 | 261 | // Call trigger |
| 262 | - $result=$this->call_trigger('TASK_COMMENT_DELETE',$user); |
|
| 262 | + $result = $this->call_trigger('TASK_COMMENT_DELETE', $user); |
|
| 263 | 263 | if ($result < 0) { $error++; } |
| 264 | 264 | // End call triggers |
| 265 | 265 | } |
@@ -268,14 +268,14 @@ discard block |
||
| 268 | 268 | // Commit or rollback |
| 269 | 269 | if ($error) |
| 270 | 270 | { |
| 271 | - foreach($this->errors as $errmsg) |
|
| 271 | + foreach ($this->errors as $errmsg) |
|
| 272 | 272 | { |
| 273 | 273 | dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); |
| 274 | - $this->error.=($this->error?', '.$errmsg:$errmsg); |
|
| 274 | + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); |
|
| 275 | 275 | } |
| 276 | 276 | $this->db->rollback(); |
| 277 | - return -1*$error; |
|
| 278 | - }else{ |
|
| 277 | + return -1 * $error; |
|
| 278 | + } else { |
|
| 279 | 279 | $this->db->commit(); |
| 280 | 280 | return 1; |
| 281 | 281 | } |
@@ -291,25 +291,25 @@ discard block |
||
| 291 | 291 | */ |
| 292 | 292 | public static function fetchAllFor($element_type, $fk_element) |
| 293 | 293 | { |
| 294 | - global $db,$conf; |
|
| 294 | + global $db, $conf; |
|
| 295 | 295 | $TComments = array(); |
| 296 | - if(!empty($element_type) && !empty($fk_element)) { |
|
| 296 | + if (!empty($element_type) && !empty($fk_element)) { |
|
| 297 | 297 | $sql = "SELECT"; |
| 298 | - $sql.= " c.rowid"; |
|
| 299 | - $sql.= " FROM ".MAIN_DB_PREFIX."comment as c"; |
|
| 300 | - $sql.= " WHERE c.fk_element = ".$fk_element; |
|
| 301 | - $sql.= " AND c.element_type = '".$element_type."'"; |
|
| 302 | - $sql.= " AND c.entity = ".$conf->entity; |
|
| 303 | - $sql.= " ORDER BY c.tms DESC"; |
|
| 298 | + $sql .= " c.rowid"; |
|
| 299 | + $sql .= " FROM ".MAIN_DB_PREFIX."comment as c"; |
|
| 300 | + $sql .= " WHERE c.fk_element = ".$fk_element; |
|
| 301 | + $sql .= " AND c.element_type = '".$element_type."'"; |
|
| 302 | + $sql .= " AND c.entity = ".$conf->entity; |
|
| 303 | + $sql .= " ORDER BY c.tms DESC"; |
|
| 304 | 304 | |
| 305 | 305 | dol_syslog("Comment::fetchAllFor", LOG_DEBUG); |
| 306 | - $resql=$db->query($sql); |
|
| 306 | + $resql = $db->query($sql); |
|
| 307 | 307 | if ($resql) |
| 308 | 308 | { |
| 309 | 309 | $num_rows = $db->num_rows($resql); |
| 310 | 310 | if ($num_rows > 0) |
| 311 | 311 | { |
| 312 | - while($obj = $db->fetch_object($resql)) |
|
| 312 | + while ($obj = $db->fetch_object($resql)) |
|
| 313 | 313 | { |
| 314 | 314 | $comment = new self($db); |
| 315 | 315 | $comment->fetch($obj->rowid); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; |
| 77 | 77 | if (empty($newmask)) // This should no happen |
| 78 | 78 | { |
| 79 | - $newmask='0664'; |
|
| 79 | + $newmask='0664'; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
@@ -86,179 +86,179 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | if ($dirins && $action == 'initmodule' && $modulename) |
| 88 | 88 | { |
| 89 | - if (preg_match('/\s/', $modulename)) |
|
| 90 | - { |
|
| 91 | - $error++; |
|
| 92 | - setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - if (! $error) |
|
| 96 | - { |
|
| 97 | - $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; |
|
| 98 | - $destdir = $dirins.'/'.strtolower($modulename); |
|
| 99 | - |
|
| 100 | - $arrayreplacement=array( |
|
| 101 | - 'mymodule'=>strtolower($modulename), |
|
| 102 | - 'MyModule'=>$modulename |
|
| 103 | - ); |
|
| 104 | - |
|
| 105 | - $result = dolCopyDir($srcdir, $destdir, 0, 0, $arrayreplacement); |
|
| 106 | - //dol_mkdir($destfile); |
|
| 107 | - if ($result <= 0) |
|
| 108 | - { |
|
| 109 | - if ($result < 0) |
|
| 110 | - { |
|
| 111 | - $error++; |
|
| 112 | - $langs->load("errors"); |
|
| 113 | - setEventMessages($langs->trans("ErrorFailToCopyDir", $srcdir, $destdir), null, 'errors'); |
|
| 114 | - } |
|
| 115 | - else // $result == 0 |
|
| 116 | - { |
|
| 117 | - setEventMessages($langs->trans("AllFilesDidAlreadyExist", $srcdir, $destdir), null, 'warnings'); |
|
| 118 | - } |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - // Delete some files |
|
| 122 | - dol_delete_file($destdir.'/myobject_card.php'); |
|
| 123 | - dol_delete_file($destdir.'/myobject_note.php'); |
|
| 124 | - dol_delete_file($destdir.'/myobject_document.php'); |
|
| 125 | - dol_delete_file($destdir.'/myobject_agenda.php'); |
|
| 126 | - dol_delete_file($destdir.'/myobject_list.php'); |
|
| 127 | - dol_delete_file($destdir.'/lib/myobject.lib.php'); |
|
| 128 | - dol_delete_file($destdir.'/test/phpunit/MyObjectTest.php'); |
|
| 129 | - dol_delete_file($destdir.'/sql/llx_myobject.sql'); |
|
| 130 | - dol_delete_file($destdir.'/sql/llx_myobject_extrafields.sql'); |
|
| 131 | - dol_delete_file($destdir.'/sql/llx_myobject.key.sql'); |
|
| 132 | - dol_delete_file($destdir.'/scripts/myobject.php'); |
|
| 133 | - dol_delete_file($destdir.'/img/object_myobject.png'); |
|
| 134 | - dol_delete_file($destdir.'/class/myobject.class.php'); |
|
| 135 | - dol_delete_file($destdir.'/class/api_myobject.class.php'); |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - // Edit PHP files |
|
| 139 | - if (! $error) |
|
| 140 | - { |
|
| 141 | - $listofphpfilestoedit = dol_dir_list($destdir, 'files', 1, '\.(php|MD|js|sql|txt|xml|lang)$', '', 'fullname', SORT_ASC, 0, 1); |
|
| 142 | - foreach($listofphpfilestoedit as $phpfileval) |
|
| 143 | - { |
|
| 144 | - //var_dump($phpfileval['fullname']); |
|
| 145 | - $arrayreplacement=array( |
|
| 146 | - 'mymodule'=>strtolower($modulename), |
|
| 147 | - 'MyModule'=>$modulename, |
|
| 148 | - 'MYMODULE'=>strtoupper($modulename), |
|
| 149 | - 'My module'=>$modulename, |
|
| 150 | - 'my module'=>$modulename, |
|
| 151 | - 'Mon module'=>$modulename, |
|
| 152 | - 'mon module'=>$modulename, |
|
| 153 | - 'htdocs/modulebuilder/template'=>strtolower($modulename), |
|
| 154 | - '---Put here your own copyright and developer email---'=>dol_print_date($now,'%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') |
|
| 155 | - ); |
|
| 156 | - |
|
| 157 | - |
|
| 158 | - $result=dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); |
|
| 159 | - //var_dump($result); |
|
| 160 | - if ($result < 0) |
|
| 161 | - { |
|
| 162 | - setEventMessages($langs->trans("ErrorFailToMakeReplacementInto", $phpfileval['fullname']), null, 'errors'); |
|
| 163 | - } |
|
| 164 | - } |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - if (! $error) |
|
| 168 | - { |
|
| 169 | - setEventMessages('ModuleInitialized', null); |
|
| 170 | - $module=$modulename; |
|
| 171 | - $modulename = ''; |
|
| 172 | - } |
|
| 89 | + if (preg_match('/\s/', $modulename)) |
|
| 90 | + { |
|
| 91 | + $error++; |
|
| 92 | + setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + if (! $error) |
|
| 96 | + { |
|
| 97 | + $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; |
|
| 98 | + $destdir = $dirins.'/'.strtolower($modulename); |
|
| 99 | + |
|
| 100 | + $arrayreplacement=array( |
|
| 101 | + 'mymodule'=>strtolower($modulename), |
|
| 102 | + 'MyModule'=>$modulename |
|
| 103 | + ); |
|
| 104 | + |
|
| 105 | + $result = dolCopyDir($srcdir, $destdir, 0, 0, $arrayreplacement); |
|
| 106 | + //dol_mkdir($destfile); |
|
| 107 | + if ($result <= 0) |
|
| 108 | + { |
|
| 109 | + if ($result < 0) |
|
| 110 | + { |
|
| 111 | + $error++; |
|
| 112 | + $langs->load("errors"); |
|
| 113 | + setEventMessages($langs->trans("ErrorFailToCopyDir", $srcdir, $destdir), null, 'errors'); |
|
| 114 | + } |
|
| 115 | + else // $result == 0 |
|
| 116 | + { |
|
| 117 | + setEventMessages($langs->trans("AllFilesDidAlreadyExist", $srcdir, $destdir), null, 'warnings'); |
|
| 118 | + } |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + // Delete some files |
|
| 122 | + dol_delete_file($destdir.'/myobject_card.php'); |
|
| 123 | + dol_delete_file($destdir.'/myobject_note.php'); |
|
| 124 | + dol_delete_file($destdir.'/myobject_document.php'); |
|
| 125 | + dol_delete_file($destdir.'/myobject_agenda.php'); |
|
| 126 | + dol_delete_file($destdir.'/myobject_list.php'); |
|
| 127 | + dol_delete_file($destdir.'/lib/myobject.lib.php'); |
|
| 128 | + dol_delete_file($destdir.'/test/phpunit/MyObjectTest.php'); |
|
| 129 | + dol_delete_file($destdir.'/sql/llx_myobject.sql'); |
|
| 130 | + dol_delete_file($destdir.'/sql/llx_myobject_extrafields.sql'); |
|
| 131 | + dol_delete_file($destdir.'/sql/llx_myobject.key.sql'); |
|
| 132 | + dol_delete_file($destdir.'/scripts/myobject.php'); |
|
| 133 | + dol_delete_file($destdir.'/img/object_myobject.png'); |
|
| 134 | + dol_delete_file($destdir.'/class/myobject.class.php'); |
|
| 135 | + dol_delete_file($destdir.'/class/api_myobject.class.php'); |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + // Edit PHP files |
|
| 139 | + if (! $error) |
|
| 140 | + { |
|
| 141 | + $listofphpfilestoedit = dol_dir_list($destdir, 'files', 1, '\.(php|MD|js|sql|txt|xml|lang)$', '', 'fullname', SORT_ASC, 0, 1); |
|
| 142 | + foreach($listofphpfilestoedit as $phpfileval) |
|
| 143 | + { |
|
| 144 | + //var_dump($phpfileval['fullname']); |
|
| 145 | + $arrayreplacement=array( |
|
| 146 | + 'mymodule'=>strtolower($modulename), |
|
| 147 | + 'MyModule'=>$modulename, |
|
| 148 | + 'MYMODULE'=>strtoupper($modulename), |
|
| 149 | + 'My module'=>$modulename, |
|
| 150 | + 'my module'=>$modulename, |
|
| 151 | + 'Mon module'=>$modulename, |
|
| 152 | + 'mon module'=>$modulename, |
|
| 153 | + 'htdocs/modulebuilder/template'=>strtolower($modulename), |
|
| 154 | + '---Put here your own copyright and developer email---'=>dol_print_date($now,'%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') |
|
| 155 | + ); |
|
| 156 | + |
|
| 157 | + |
|
| 158 | + $result=dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); |
|
| 159 | + //var_dump($result); |
|
| 160 | + if ($result < 0) |
|
| 161 | + { |
|
| 162 | + setEventMessages($langs->trans("ErrorFailToMakeReplacementInto", $phpfileval['fullname']), null, 'errors'); |
|
| 163 | + } |
|
| 164 | + } |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + if (! $error) |
|
| 168 | + { |
|
| 169 | + setEventMessages('ModuleInitialized', null); |
|
| 170 | + $module=$modulename; |
|
| 171 | + $modulename = ''; |
|
| 172 | + } |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | if ($dirins && $action == 'initobject' && $module && $objectname) |
| 176 | 176 | { |
| 177 | - if (preg_match('/\s/', $objectname)) |
|
| 178 | - { |
|
| 179 | - $error++; |
|
| 180 | - setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; |
|
| 184 | - $destdir = $dirins.'/'.strtolower($module); |
|
| 185 | - |
|
| 186 | - // Scan dir class to find if an object with same name already exists. |
|
| 187 | - if (! $error) |
|
| 188 | - { |
|
| 189 | - $dirlist=dol_dir_list($destdir.'/class','files',0,'\.txt$'); |
|
| 190 | - $alreadyfound=false; |
|
| 191 | - foreach($dirlist as $key => $val) |
|
| 192 | - { |
|
| 193 | - $filefound=preg_replace('/\.txt$/','',$val['name']); |
|
| 194 | - if (strtolower($objectname) == strtolower($filefound) && $objectname != $filefound) |
|
| 195 | - { |
|
| 196 | - $alreadyfound=true; |
|
| 197 | - $error++; |
|
| 198 | - setEventMessages($langs->trans("AnObjectAlreadyExistWithThisNameAndDiffCase"), null, 'errors'); |
|
| 199 | - break; |
|
| 200 | - } |
|
| 201 | - } |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - if (! $error) |
|
| 205 | - { |
|
| 206 | - // Delete some files |
|
| 207 | - $filetogenerate = array( |
|
| 208 | - 'myobject_card.php'=>strtolower($objectname).'_card.php', |
|
| 209 | - 'myobject_note.php'=>strtolower($objectname).'_note.php', |
|
| 210 | - 'myobject_document.php'=>strtolower($objectname).'_document.php', |
|
| 211 | - 'myobject_agenda.php'=>strtolower($objectname).'_agenda.php', |
|
| 212 | - 'myobject_list.php'=>strtolower($objectname).'_list.php', |
|
| 213 | - 'lib/myobject.lib.php'=>'lib/'.strtolower($objectname).'.lib.php', |
|
| 214 | - 'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.$objectname.'Test.php', |
|
| 215 | - 'sql/llx_myobject.sql'=>'sql/llx_'.strtolower($objectname).'.sql', |
|
| 216 | - 'sql/llx_myobject_extrafields.sql'=>'sql/llx_'.strtolower($objectname).'_extrafields.sql', |
|
| 217 | - 'sql/llx_myobject.key.sql'=>'sql/llx_'.strtolower($objectname).'.key.sql', |
|
| 218 | - 'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php', |
|
| 219 | - 'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png', |
|
| 220 | - 'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php', |
|
| 221 | - 'class/api_myobject.class.php'=>'class/api_'.strtolower($objectname).'.class.php' |
|
| 222 | - ); |
|
| 223 | - |
|
| 224 | - foreach($filetogenerate as $srcfile => $destfile) |
|
| 225 | - { |
|
| 226 | - $result = dol_copy($srcdir.'/'.$srcfile, $destdir.'/'.$destfile, $newmask, 0); |
|
| 227 | - if ($result <= 0) |
|
| 228 | - { |
|
| 229 | - if ($result < 0) |
|
| 230 | - { |
|
| 231 | - $error++; |
|
| 232 | - $langs->load("errors"); |
|
| 233 | - setEventMessages($langs->trans("ErrorFailToCopyFile", $srcdir.'/'.$srcfile, $destdir.'/'.$destfile), null, 'errors'); |
|
| 234 | - } |
|
| 235 | - else // $result == 0 |
|
| 236 | - { |
|
| 237 | - setEventMessages($langs->trans("FileAlreadyExists", $destfile), null, 'warnings'); |
|
| 238 | - } |
|
| 239 | - } |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - if (! $error) |
|
| 243 | - { |
|
| 244 | - // Scan for object class files |
|
| 245 | - $listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$'); |
|
| 246 | - |
|
| 247 | - $firstobjectname=''; |
|
| 248 | - foreach($listofobject as $fileobj) |
|
| 249 | - { |
|
| 250 | - if (preg_match('/^api_/',$fileobj['name'])) continue; |
|
| 251 | - if (preg_match('/^actions_/',$fileobj['name'])) continue; |
|
| 252 | - |
|
| 253 | - $tmpcontent=file_get_contents($fileobj['fullname']); |
|
| 254 | - if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims',$tmpcontent,$reg)) |
|
| 255 | - { |
|
| 256 | - $objectnameloop = $reg[1]; |
|
| 257 | - if (empty($firstobjectname)) $firstobjectname = $objectnameloop; |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - // Regenerate left menu entry in descriptor for $objectname |
|
| 261 | - $stringtoadd=" |
|
| 177 | + if (preg_match('/\s/', $objectname)) |
|
| 178 | + { |
|
| 179 | + $error++; |
|
| 180 | + setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; |
|
| 184 | + $destdir = $dirins.'/'.strtolower($module); |
|
| 185 | + |
|
| 186 | + // Scan dir class to find if an object with same name already exists. |
|
| 187 | + if (! $error) |
|
| 188 | + { |
|
| 189 | + $dirlist=dol_dir_list($destdir.'/class','files',0,'\.txt$'); |
|
| 190 | + $alreadyfound=false; |
|
| 191 | + foreach($dirlist as $key => $val) |
|
| 192 | + { |
|
| 193 | + $filefound=preg_replace('/\.txt$/','',$val['name']); |
|
| 194 | + if (strtolower($objectname) == strtolower($filefound) && $objectname != $filefound) |
|
| 195 | + { |
|
| 196 | + $alreadyfound=true; |
|
| 197 | + $error++; |
|
| 198 | + setEventMessages($langs->trans("AnObjectAlreadyExistWithThisNameAndDiffCase"), null, 'errors'); |
|
| 199 | + break; |
|
| 200 | + } |
|
| 201 | + } |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + if (! $error) |
|
| 205 | + { |
|
| 206 | + // Delete some files |
|
| 207 | + $filetogenerate = array( |
|
| 208 | + 'myobject_card.php'=>strtolower($objectname).'_card.php', |
|
| 209 | + 'myobject_note.php'=>strtolower($objectname).'_note.php', |
|
| 210 | + 'myobject_document.php'=>strtolower($objectname).'_document.php', |
|
| 211 | + 'myobject_agenda.php'=>strtolower($objectname).'_agenda.php', |
|
| 212 | + 'myobject_list.php'=>strtolower($objectname).'_list.php', |
|
| 213 | + 'lib/myobject.lib.php'=>'lib/'.strtolower($objectname).'.lib.php', |
|
| 214 | + 'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.$objectname.'Test.php', |
|
| 215 | + 'sql/llx_myobject.sql'=>'sql/llx_'.strtolower($objectname).'.sql', |
|
| 216 | + 'sql/llx_myobject_extrafields.sql'=>'sql/llx_'.strtolower($objectname).'_extrafields.sql', |
|
| 217 | + 'sql/llx_myobject.key.sql'=>'sql/llx_'.strtolower($objectname).'.key.sql', |
|
| 218 | + 'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php', |
|
| 219 | + 'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png', |
|
| 220 | + 'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php', |
|
| 221 | + 'class/api_myobject.class.php'=>'class/api_'.strtolower($objectname).'.class.php' |
|
| 222 | + ); |
|
| 223 | + |
|
| 224 | + foreach($filetogenerate as $srcfile => $destfile) |
|
| 225 | + { |
|
| 226 | + $result = dol_copy($srcdir.'/'.$srcfile, $destdir.'/'.$destfile, $newmask, 0); |
|
| 227 | + if ($result <= 0) |
|
| 228 | + { |
|
| 229 | + if ($result < 0) |
|
| 230 | + { |
|
| 231 | + $error++; |
|
| 232 | + $langs->load("errors"); |
|
| 233 | + setEventMessages($langs->trans("ErrorFailToCopyFile", $srcdir.'/'.$srcfile, $destdir.'/'.$destfile), null, 'errors'); |
|
| 234 | + } |
|
| 235 | + else // $result == 0 |
|
| 236 | + { |
|
| 237 | + setEventMessages($langs->trans("FileAlreadyExists", $destfile), null, 'warnings'); |
|
| 238 | + } |
|
| 239 | + } |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + if (! $error) |
|
| 243 | + { |
|
| 244 | + // Scan for object class files |
|
| 245 | + $listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$'); |
|
| 246 | + |
|
| 247 | + $firstobjectname=''; |
|
| 248 | + foreach($listofobject as $fileobj) |
|
| 249 | + { |
|
| 250 | + if (preg_match('/^api_/',$fileobj['name'])) continue; |
|
| 251 | + if (preg_match('/^actions_/',$fileobj['name'])) continue; |
|
| 252 | + |
|
| 253 | + $tmpcontent=file_get_contents($fileobj['fullname']); |
|
| 254 | + if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims',$tmpcontent,$reg)) |
|
| 255 | + { |
|
| 256 | + $objectnameloop = $reg[1]; |
|
| 257 | + if (empty($firstobjectname)) $firstobjectname = $objectnameloop; |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + // Regenerate left menu entry in descriptor for $objectname |
|
| 261 | + $stringtoadd=" |
|
| 262 | 262 | \t\t\$this->menu[\$r++]=array( |
| 263 | 263 | 'fk_menu'=>'fk_mainmenu=mymodule', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
| 264 | 264 | 'type'=>'left', // This is a Left menu entry |
@@ -286,123 +286,123 @@ discard block |
||
| 286 | 286 | 'target'=>'', |
| 287 | 287 | 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
| 288 | 288 | "; |
| 289 | - $stringtoadd = preg_replace('/MyObject/', $objectnameloop, $stringtoadd); |
|
| 290 | - $stringtoadd = preg_replace('/mymodule/', strtolower($module), $stringtoadd); |
|
| 291 | - $stringtoadd = preg_replace('/myobject/', strtolower($objectnameloop), $stringtoadd); |
|
| 289 | + $stringtoadd = preg_replace('/MyObject/', $objectnameloop, $stringtoadd); |
|
| 290 | + $stringtoadd = preg_replace('/mymodule/', strtolower($module), $stringtoadd); |
|
| 291 | + $stringtoadd = preg_replace('/myobject/', strtolower($objectnameloop), $stringtoadd); |
|
| 292 | 292 | |
| 293 | - $moduledescriptorfile=$destdir.'/core/modules/mod'.$module.'.class.php'; |
|
| 293 | + $moduledescriptorfile=$destdir.'/core/modules/mod'.$module.'.class.php'; |
|
| 294 | 294 | |
| 295 | - // TODO Allow a replace with regex using dolReplaceRegexInFile |
|
| 296 | - // TODO Avoid duplicate addition |
|
| 295 | + // TODO Allow a replace with regex using dolReplaceRegexInFile |
|
| 296 | + // TODO Avoid duplicate addition |
|
| 297 | 297 | |
| 298 | - dolReplaceInFile($moduledescriptorfile, array('END MODULEBUILDER LEFTMENU MYOBJECT */' => '*/'."\n".$stringtoadd."\n\t\t/* END MODULEBUILDER LEFTMENU MYOBJECT */")); |
|
| 298 | + dolReplaceInFile($moduledescriptorfile, array('END MODULEBUILDER LEFTMENU MYOBJECT */' => '*/'."\n".$stringtoadd."\n\t\t/* END MODULEBUILDER LEFTMENU MYOBJECT */")); |
|
| 299 | 299 | |
| 300 | 300 | // Add module descriptor to list of files to replace "MyObject' string with real name of object. |
| 301 | - $filetogenerate[]='core/modules/mod'.$module.'.class.php'; |
|
| 302 | - |
|
| 303 | - // TODO |
|
| 304 | - } |
|
| 305 | - } |
|
| 306 | - } |
|
| 307 | - |
|
| 308 | - if (! $error) |
|
| 309 | - { |
|
| 310 | - // Edit PHP files |
|
| 311 | - foreach($filetogenerate as $destfile) |
|
| 312 | - { |
|
| 313 | - $phpfileval['fullname'] = $destdir.'/'.$destfile; |
|
| 314 | - |
|
| 315 | - //var_dump($phpfileval['fullname']); |
|
| 316 | - $arrayreplacement=array( |
|
| 317 | - 'mymodule'=>strtolower($module), |
|
| 318 | - 'MyModule'=>$module, |
|
| 319 | - 'MYMODULE'=>strtoupper($module), |
|
| 320 | - 'My module'=>$module, |
|
| 321 | - 'my module'=>$module, |
|
| 322 | - 'mon module'=>$module, |
|
| 323 | - 'Mon module'=>$module, |
|
| 324 | - 'htdocs/modulebuilder/template/'=>strtolower($modulename), |
|
| 325 | - 'myobject'=>strtolower($objectname), |
|
| 326 | - 'MyObject'=>$objectname |
|
| 327 | - ); |
|
| 328 | - |
|
| 329 | - $result=dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); |
|
| 330 | - //var_dump($result); |
|
| 331 | - if ($result < 0) |
|
| 332 | - { |
|
| 333 | - setEventMessages($langs->trans("ErrorFailToMakeReplacementInto", $phpfileval['fullname']), null, 'errors'); |
|
| 334 | - } |
|
| 335 | - } |
|
| 336 | - } |
|
| 337 | - |
|
| 338 | - if (! $error) |
|
| 339 | - { |
|
| 340 | - // Edit the class file to write properties |
|
| 341 | - $object=rebuildObjectClass($destdir, $module, $objectname, $newmask); |
|
| 342 | - if (is_numeric($object) && $object < 0) $error++; |
|
| 343 | - } |
|
| 344 | - if (! $error) |
|
| 345 | - { |
|
| 346 | - // Edit sql with new properties |
|
| 347 | - $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, '', $object); |
|
| 348 | - if ($result < 0) $error++; |
|
| 349 | - } |
|
| 350 | - |
|
| 351 | - if (! $error) |
|
| 352 | - { |
|
| 353 | - setEventMessages($langs->trans('FilesForObjectInitialized', $objectname), null); |
|
| 354 | - } |
|
| 301 | + $filetogenerate[]='core/modules/mod'.$module.'.class.php'; |
|
| 302 | + |
|
| 303 | + // TODO |
|
| 304 | + } |
|
| 305 | + } |
|
| 306 | + } |
|
| 307 | + |
|
| 308 | + if (! $error) |
|
| 309 | + { |
|
| 310 | + // Edit PHP files |
|
| 311 | + foreach($filetogenerate as $destfile) |
|
| 312 | + { |
|
| 313 | + $phpfileval['fullname'] = $destdir.'/'.$destfile; |
|
| 314 | + |
|
| 315 | + //var_dump($phpfileval['fullname']); |
|
| 316 | + $arrayreplacement=array( |
|
| 317 | + 'mymodule'=>strtolower($module), |
|
| 318 | + 'MyModule'=>$module, |
|
| 319 | + 'MYMODULE'=>strtoupper($module), |
|
| 320 | + 'My module'=>$module, |
|
| 321 | + 'my module'=>$module, |
|
| 322 | + 'mon module'=>$module, |
|
| 323 | + 'Mon module'=>$module, |
|
| 324 | + 'htdocs/modulebuilder/template/'=>strtolower($modulename), |
|
| 325 | + 'myobject'=>strtolower($objectname), |
|
| 326 | + 'MyObject'=>$objectname |
|
| 327 | + ); |
|
| 328 | + |
|
| 329 | + $result=dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); |
|
| 330 | + //var_dump($result); |
|
| 331 | + if ($result < 0) |
|
| 332 | + { |
|
| 333 | + setEventMessages($langs->trans("ErrorFailToMakeReplacementInto", $phpfileval['fullname']), null, 'errors'); |
|
| 334 | + } |
|
| 335 | + } |
|
| 336 | + } |
|
| 337 | + |
|
| 338 | + if (! $error) |
|
| 339 | + { |
|
| 340 | + // Edit the class file to write properties |
|
| 341 | + $object=rebuildObjectClass($destdir, $module, $objectname, $newmask); |
|
| 342 | + if (is_numeric($object) && $object < 0) $error++; |
|
| 343 | + } |
|
| 344 | + if (! $error) |
|
| 345 | + { |
|
| 346 | + // Edit sql with new properties |
|
| 347 | + $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, '', $object); |
|
| 348 | + if ($result < 0) $error++; |
|
| 349 | + } |
|
| 350 | + |
|
| 351 | + if (! $error) |
|
| 352 | + { |
|
| 353 | + setEventMessages($langs->trans('FilesForObjectInitialized', $objectname), null); |
|
| 354 | + } |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | if ($dirins && $action == 'addproperty' && !empty($module) && ! empty($tabobj)) |
| 358 | 358 | { |
| 359 | - $objectname = $tabobj; |
|
| 360 | - |
|
| 361 | - $srcdir = $dirread.'/'.strtolower($module); |
|
| 362 | - $destdir = $dirins.'/'.strtolower($module); |
|
| 363 | - dol_mkdir($destdir); |
|
| 364 | - |
|
| 365 | - $addfieldentry = array( |
|
| 366 | - 'name'=>GETPOST('propname','aZ09'),'label'=>GETPOST('proplabel','alpha'),'type'=>GETPOST('proptype','alpha'), |
|
| 367 | - 'arrayofkeyval'=>GETPOST('proparrayofkeyval','none'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}' |
|
| 368 | - 'visible'=>GETPOST('propvisible','int'),'enabled'=>GETPOST('propenabled','int'), |
|
| 369 | - 'position'=>GETPOST('propposition','int'),'notnull'=>GETPOST('propnotnull','int'),'index'=>GETPOST('propindex','int'),'searchall'=>GETPOST('propsearchall','int'), |
|
| 370 | - 'isameasure'=>GETPOST('propisameasure','int'), 'comment'=>GETPOST('propcomment','alpha'),'help'=>GETPOST('prophelp')); |
|
| 371 | - |
|
| 372 | - if (! empty($addfieldentry['arrayofkeyval']) && ! is_array($addfieldentry['arrayofkeyval'])) |
|
| 373 | - { |
|
| 374 | - $addfieldentry['arrayofkeyval'] = dol_json_decode($addfieldentry['arrayofkeyval'], true); |
|
| 375 | - } |
|
| 376 | - |
|
| 377 | - // Edit the class file to write properties |
|
| 378 | - if (! $error) |
|
| 379 | - { |
|
| 380 | - $object=rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry); |
|
| 359 | + $objectname = $tabobj; |
|
| 360 | + |
|
| 361 | + $srcdir = $dirread.'/'.strtolower($module); |
|
| 362 | + $destdir = $dirins.'/'.strtolower($module); |
|
| 363 | + dol_mkdir($destdir); |
|
| 364 | + |
|
| 365 | + $addfieldentry = array( |
|
| 366 | + 'name'=>GETPOST('propname','aZ09'),'label'=>GETPOST('proplabel','alpha'),'type'=>GETPOST('proptype','alpha'), |
|
| 367 | + 'arrayofkeyval'=>GETPOST('proparrayofkeyval','none'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}' |
|
| 368 | + 'visible'=>GETPOST('propvisible','int'),'enabled'=>GETPOST('propenabled','int'), |
|
| 369 | + 'position'=>GETPOST('propposition','int'),'notnull'=>GETPOST('propnotnull','int'),'index'=>GETPOST('propindex','int'),'searchall'=>GETPOST('propsearchall','int'), |
|
| 370 | + 'isameasure'=>GETPOST('propisameasure','int'), 'comment'=>GETPOST('propcomment','alpha'),'help'=>GETPOST('prophelp')); |
|
| 371 | + |
|
| 372 | + if (! empty($addfieldentry['arrayofkeyval']) && ! is_array($addfieldentry['arrayofkeyval'])) |
|
| 373 | + { |
|
| 374 | + $addfieldentry['arrayofkeyval'] = dol_json_decode($addfieldentry['arrayofkeyval'], true); |
|
| 375 | + } |
|
| 376 | + |
|
| 377 | + // Edit the class file to write properties |
|
| 378 | + if (! $error) |
|
| 379 | + { |
|
| 380 | + $object=rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry); |
|
| 381 | 381 | if (is_numeric($result) && $result <= 0) $error++; |
| 382 | - } |
|
| 382 | + } |
|
| 383 | 383 | |
| 384 | - // Edit sql with new properties |
|
| 385 | - if (! $error) |
|
| 386 | - { |
|
| 387 | - $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object); |
|
| 384 | + // Edit sql with new properties |
|
| 385 | + if (! $error) |
|
| 386 | + { |
|
| 387 | + $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object); |
|
| 388 | 388 | if ($result <= 0) |
| 389 | 389 | { |
| 390 | 390 | $error++; |
| 391 | 391 | } |
| 392 | - } |
|
| 392 | + } |
|
| 393 | 393 | |
| 394 | - if (! $error) |
|
| 395 | - { |
|
| 396 | - clearstatcache(); |
|
| 394 | + if (! $error) |
|
| 395 | + { |
|
| 396 | + clearstatcache(); |
|
| 397 | 397 | |
| 398 | - setEventMessages($langs->trans('FilesForObjectUpdated', $objectname), null); |
|
| 398 | + setEventMessages($langs->trans('FilesForObjectUpdated', $objectname), null); |
|
| 399 | 399 | |
| 400 | - // Make a redirect to reload all data |
|
| 401 | - header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.$module.'&tabobj='.$objectname); |
|
| 400 | + // Make a redirect to reload all data |
|
| 401 | + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.$module.'&tabobj='.$objectname); |
|
| 402 | 402 | |
| 403 | - clearstatcache(); |
|
| 404 | - exit; |
|
| 405 | - } |
|
| 403 | + clearstatcache(); |
|
| 404 | + exit; |
|
| 405 | + } |
|
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | if ($dirins && $action == 'confirm_deleteproperty' && $propertykey) |
@@ -433,171 +433,171 @@ discard block |
||
| 433 | 433 | |
| 434 | 434 | setEventMessages($langs->trans('FilesForObjectUpdated', $objectname), null); |
| 435 | 435 | |
| 436 | - // Make a redirect to reload all data |
|
| 437 | - header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.$module.'&tabobj='.$objectname); |
|
| 436 | + // Make a redirect to reload all data |
|
| 437 | + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.$module.'&tabobj='.$objectname); |
|
| 438 | 438 | |
| 439 | - clearstatcache(); |
|
| 440 | - exit; |
|
| 439 | + clearstatcache(); |
|
| 440 | + exit; |
|
| 441 | 441 | } |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | if ($dirins && $action == 'confirm_delete') |
| 445 | 445 | { |
| 446 | - if (preg_match('/\s/', $module)) |
|
| 447 | - { |
|
| 448 | - $error++; |
|
| 449 | - setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); |
|
| 450 | - } |
|
| 451 | - |
|
| 452 | - if (! $error) |
|
| 453 | - { |
|
| 454 | - $modulelowercase=strtolower($module); |
|
| 455 | - |
|
| 456 | - // Dir for module |
|
| 457 | - $dir = $dirins.'/'.$modulelowercase; |
|
| 458 | - |
|
| 459 | - $result = dol_delete_dir_recursive($dir); |
|
| 460 | - |
|
| 461 | - if ($result > 0) |
|
| 462 | - { |
|
| 463 | - setEventMessages($langs->trans("DirWasRemoved", $modulelowercase), null); |
|
| 464 | - } |
|
| 465 | - else |
|
| 466 | - { |
|
| 467 | - setEventMessages($langs->trans("PurgeNothingToDelete"), null, 'warnings'); |
|
| 468 | - } |
|
| 469 | - } |
|
| 470 | - |
|
| 471 | - //header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?module=initmodule'); |
|
| 472 | - //exit; |
|
| 473 | - $action = ''; |
|
| 474 | - $module = 'deletemodule'; |
|
| 446 | + if (preg_match('/\s/', $module)) |
|
| 447 | + { |
|
| 448 | + $error++; |
|
| 449 | + setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); |
|
| 450 | + } |
|
| 451 | + |
|
| 452 | + if (! $error) |
|
| 453 | + { |
|
| 454 | + $modulelowercase=strtolower($module); |
|
| 455 | + |
|
| 456 | + // Dir for module |
|
| 457 | + $dir = $dirins.'/'.$modulelowercase; |
|
| 458 | + |
|
| 459 | + $result = dol_delete_dir_recursive($dir); |
|
| 460 | + |
|
| 461 | + if ($result > 0) |
|
| 462 | + { |
|
| 463 | + setEventMessages($langs->trans("DirWasRemoved", $modulelowercase), null); |
|
| 464 | + } |
|
| 465 | + else |
|
| 466 | + { |
|
| 467 | + setEventMessages($langs->trans("PurgeNothingToDelete"), null, 'warnings'); |
|
| 468 | + } |
|
| 469 | + } |
|
| 470 | + |
|
| 471 | + //header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?module=initmodule'); |
|
| 472 | + //exit; |
|
| 473 | + $action = ''; |
|
| 474 | + $module = 'deletemodule'; |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | if ($dirins && $action == 'confirm_deleteobject' && $objectname) |
| 478 | 478 | { |
| 479 | - if (preg_match('/[^a-z0-9]/i', $objectname)) |
|
| 480 | - { |
|
| 481 | - $error++; |
|
| 482 | - setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); |
|
| 483 | - } |
|
| 484 | - |
|
| 485 | - if (! $error) |
|
| 486 | - { |
|
| 487 | - $modulelowercase=strtolower($module); |
|
| 488 | - $objectlowercase=strtolower($objectname); |
|
| 489 | - |
|
| 490 | - // Dir for module |
|
| 491 | - $dir = $dirins.'/'.$modulelowercase; |
|
| 492 | - |
|
| 493 | - // Delete some files |
|
| 494 | - $filetogenerate = array( |
|
| 495 | - 'myobject_card.php'=>strtolower($objectname).'_card.php', |
|
| 496 | - 'myobject_note.php'=>strtolower($objectname).'_note.php', |
|
| 497 | - 'myobject_document.php'=>strtolower($objectname).'_document.php', |
|
| 498 | - 'myobject_agenda.php'=>strtolower($objectname).'_agenda.php', |
|
| 499 | - 'myobject_list.php'=>strtolower($objectname).'_list.php', |
|
| 500 | - 'lib/myobject.lib.php'=>'lib/'.strtolower($objectname).'.lib.php', |
|
| 501 | - 'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.$objectname.'Test.php', |
|
| 502 | - 'sql/llx_myobject.sql'=>'sql/llx_'.strtolower($objectname).'.sql', |
|
| 503 | - 'sql/llx_myobject_extrafields.sql'=>'sql/llx_'.strtolower($objectname).'_extrafields.sql', |
|
| 504 | - 'sql/llx_myobject.key.sql'=>'sql/llx_'.strtolower($objectname).'.key.sql', |
|
| 505 | - 'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php', |
|
| 506 | - 'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png', |
|
| 507 | - 'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php', |
|
| 508 | - 'class/api_myobject.class.php'=>'class/api_'.strtolower($objectname).'.class.php' |
|
| 509 | - ); |
|
| 510 | - |
|
| 511 | - $resultko = 0; |
|
| 512 | - foreach($filetogenerate as $filetodelete) |
|
| 513 | - { |
|
| 514 | - $resulttmp = dol_delete_file($dir.'/'.$filetodelete, 0, 0, 1); |
|
| 515 | - if (! $resulttmp) $resultko++; |
|
| 516 | - } |
|
| 517 | - |
|
| 518 | - if ($resultko == 0) |
|
| 519 | - { |
|
| 520 | - setEventMessages($langs->trans("FilesDeleted"), null); |
|
| 521 | - } |
|
| 522 | - else |
|
| 523 | - { |
|
| 524 | - setEventMessages($langs->trans("ErrorSomeFilesCouldNotBeDeleted"), null, 'warnings'); |
|
| 525 | - } |
|
| 526 | - } |
|
| 527 | - |
|
| 528 | - //header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?module=initmodule'); |
|
| 529 | - //exit; |
|
| 530 | - $action = ''; |
|
| 531 | - $tabobj = 'deleteobject'; |
|
| 479 | + if (preg_match('/[^a-z0-9]/i', $objectname)) |
|
| 480 | + { |
|
| 481 | + $error++; |
|
| 482 | + setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); |
|
| 483 | + } |
|
| 484 | + |
|
| 485 | + if (! $error) |
|
| 486 | + { |
|
| 487 | + $modulelowercase=strtolower($module); |
|
| 488 | + $objectlowercase=strtolower($objectname); |
|
| 489 | + |
|
| 490 | + // Dir for module |
|
| 491 | + $dir = $dirins.'/'.$modulelowercase; |
|
| 492 | + |
|
| 493 | + // Delete some files |
|
| 494 | + $filetogenerate = array( |
|
| 495 | + 'myobject_card.php'=>strtolower($objectname).'_card.php', |
|
| 496 | + 'myobject_note.php'=>strtolower($objectname).'_note.php', |
|
| 497 | + 'myobject_document.php'=>strtolower($objectname).'_document.php', |
|
| 498 | + 'myobject_agenda.php'=>strtolower($objectname).'_agenda.php', |
|
| 499 | + 'myobject_list.php'=>strtolower($objectname).'_list.php', |
|
| 500 | + 'lib/myobject.lib.php'=>'lib/'.strtolower($objectname).'.lib.php', |
|
| 501 | + 'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.$objectname.'Test.php', |
|
| 502 | + 'sql/llx_myobject.sql'=>'sql/llx_'.strtolower($objectname).'.sql', |
|
| 503 | + 'sql/llx_myobject_extrafields.sql'=>'sql/llx_'.strtolower($objectname).'_extrafields.sql', |
|
| 504 | + 'sql/llx_myobject.key.sql'=>'sql/llx_'.strtolower($objectname).'.key.sql', |
|
| 505 | + 'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php', |
|
| 506 | + 'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png', |
|
| 507 | + 'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php', |
|
| 508 | + 'class/api_myobject.class.php'=>'class/api_'.strtolower($objectname).'.class.php' |
|
| 509 | + ); |
|
| 510 | + |
|
| 511 | + $resultko = 0; |
|
| 512 | + foreach($filetogenerate as $filetodelete) |
|
| 513 | + { |
|
| 514 | + $resulttmp = dol_delete_file($dir.'/'.$filetodelete, 0, 0, 1); |
|
| 515 | + if (! $resulttmp) $resultko++; |
|
| 516 | + } |
|
| 517 | + |
|
| 518 | + if ($resultko == 0) |
|
| 519 | + { |
|
| 520 | + setEventMessages($langs->trans("FilesDeleted"), null); |
|
| 521 | + } |
|
| 522 | + else |
|
| 523 | + { |
|
| 524 | + setEventMessages($langs->trans("ErrorSomeFilesCouldNotBeDeleted"), null, 'warnings'); |
|
| 525 | + } |
|
| 526 | + } |
|
| 527 | + |
|
| 528 | + //header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?module=initmodule'); |
|
| 529 | + //exit; |
|
| 530 | + $action = ''; |
|
| 531 | + $tabobj = 'deleteobject'; |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | |
| 535 | 535 | if ($dirins && $action == 'generatepackage') |
| 536 | 536 | { |
| 537 | - $modulelowercase=strtolower($module); |
|
| 538 | - |
|
| 539 | - // Dir for module |
|
| 540 | - $dir = $dirins.'/'.$modulelowercase; |
|
| 541 | - // Zip file to build |
|
| 542 | - $FILENAMEZIP=''; |
|
| 543 | - |
|
| 544 | - // Load module |
|
| 545 | - dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); |
|
| 546 | - $class='mod'.$module; |
|
| 547 | - |
|
| 548 | - if (class_exists($class)) |
|
| 549 | - { |
|
| 550 | - try { |
|
| 551 | - $moduleobj = new $class($db); |
|
| 552 | - } |
|
| 553 | - catch(Exception $e) |
|
| 554 | - { |
|
| 555 | - $error++; |
|
| 556 | - dol_print_error($e->getMessage()); |
|
| 557 | - } |
|
| 558 | - } |
|
| 559 | - else |
|
| 560 | - { |
|
| 561 | - $error++; |
|
| 562 | - $langs->load("errors"); |
|
| 563 | - dol_print_error($langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module)); |
|
| 564 | - exit; |
|
| 565 | - } |
|
| 566 | - |
|
| 567 | - $arrayversion=explode('.',$moduleobj->version,3); |
|
| 568 | - if (count($arrayversion)) |
|
| 569 | - { |
|
| 570 | - $FILENAMEZIP="module_".$modulelowercase.'-'.$arrayversion[0].'.'.$arrayversion[1].($arrayversion[2]?".".$arrayversion[2]:"").".zip"; |
|
| 571 | - |
|
| 572 | - $dirofmodule = dol_buildpath($modulelowercase, 0).'/bin'; |
|
| 573 | - $outputfilezip = $dirofmodule.'/'.$FILENAMEZIP; |
|
| 537 | + $modulelowercase=strtolower($module); |
|
| 538 | + |
|
| 539 | + // Dir for module |
|
| 540 | + $dir = $dirins.'/'.$modulelowercase; |
|
| 541 | + // Zip file to build |
|
| 542 | + $FILENAMEZIP=''; |
|
| 543 | + |
|
| 544 | + // Load module |
|
| 545 | + dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); |
|
| 546 | + $class='mod'.$module; |
|
| 547 | + |
|
| 548 | + if (class_exists($class)) |
|
| 549 | + { |
|
| 550 | + try { |
|
| 551 | + $moduleobj = new $class($db); |
|
| 552 | + } |
|
| 553 | + catch(Exception $e) |
|
| 554 | + { |
|
| 555 | + $error++; |
|
| 556 | + dol_print_error($e->getMessage()); |
|
| 557 | + } |
|
| 558 | + } |
|
| 559 | + else |
|
| 560 | + { |
|
| 561 | + $error++; |
|
| 562 | + $langs->load("errors"); |
|
| 563 | + dol_print_error($langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module)); |
|
| 564 | + exit; |
|
| 565 | + } |
|
| 566 | + |
|
| 567 | + $arrayversion=explode('.',$moduleobj->version,3); |
|
| 568 | + if (count($arrayversion)) |
|
| 569 | + { |
|
| 570 | + $FILENAMEZIP="module_".$modulelowercase.'-'.$arrayversion[0].'.'.$arrayversion[1].($arrayversion[2]?".".$arrayversion[2]:"").".zip"; |
|
| 571 | + |
|
| 572 | + $dirofmodule = dol_buildpath($modulelowercase, 0).'/bin'; |
|
| 573 | + $outputfilezip = $dirofmodule.'/'.$FILENAMEZIP; |
|
| 574 | 574 | if ($dirofmodule) |
| 575 | 575 | { |
| 576 | - if (! dol_is_dir($dirofmodule)) dol_mkdir($dirofmodule); |
|
| 577 | - $result = dol_compress_dir($dir, $outputfilezip, 'zip'); |
|
| 576 | + if (! dol_is_dir($dirofmodule)) dol_mkdir($dirofmodule); |
|
| 577 | + $result = dol_compress_dir($dir, $outputfilezip, 'zip'); |
|
| 578 | 578 | } |
| 579 | 579 | else |
| 580 | 580 | { |
| 581 | 581 | $result = -1; |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | - if ($result > 0) |
|
| 585 | - { |
|
| 586 | - setEventMessages($langs->trans("ZipFileGeneratedInto", $outputfilezip), null); |
|
| 587 | - } |
|
| 588 | - else |
|
| 589 | - { |
|
| 590 | - $error++; |
|
| 591 | - $langs->load("errors"); |
|
| 592 | - setEventMessages($langs->trans("ErrorFailToGenerateFile", $outputfilezip), null, 'errors'); |
|
| 593 | - } |
|
| 594 | - } |
|
| 595 | - else |
|
| 596 | - { |
|
| 597 | - $error++; |
|
| 598 | - $langs->load("errors"); |
|
| 599 | - setEventMessages($langs->trans("ErrorCheckVersionIsDefined"), null, 'errors'); |
|
| 600 | - } |
|
| 584 | + if ($result > 0) |
|
| 585 | + { |
|
| 586 | + setEventMessages($langs->trans("ZipFileGeneratedInto", $outputfilezip), null); |
|
| 587 | + } |
|
| 588 | + else |
|
| 589 | + { |
|
| 590 | + $error++; |
|
| 591 | + $langs->load("errors"); |
|
| 592 | + setEventMessages($langs->trans("ErrorFailToGenerateFile", $outputfilezip), null, 'errors'); |
|
| 593 | + } |
|
| 594 | + } |
|
| 595 | + else |
|
| 596 | + { |
|
| 597 | + $error++; |
|
| 598 | + $langs->load("errors"); |
|
| 599 | + setEventMessages($langs->trans("ErrorCheckVersionIsDefined"), null, 'errors'); |
|
| 600 | + } |
|
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | if ($dirins && $action == 'generatedoc') |
@@ -673,40 +673,40 @@ discard block |
||
| 673 | 673 | // Save file |
| 674 | 674 | if ($action == 'savefile' && empty($cancel)) |
| 675 | 675 | { |
| 676 | - $relofcustom = basename($dirins); |
|
| 677 | - |
|
| 678 | - if ($relofcustom) |
|
| 679 | - { |
|
| 680 | - // Check that relative path ($file) start with name 'custom' |
|
| 681 | - if (! preg_match('/^'.$relofcustom.'/', $file)) $file=$relofcustom.'/'.$file; |
|
| 682 | - |
|
| 683 | - $pathoffile=dol_buildpath($file, 0); |
|
| 684 | - $pathoffilebackup=dol_buildpath($file.'.back', 0); |
|
| 685 | - |
|
| 686 | - // Save old version |
|
| 687 | - if (dol_is_file($pathoffile)) |
|
| 688 | - { |
|
| 689 | - dol_copy($pathoffile, $pathoffilebackup, 0, 1); |
|
| 690 | - } |
|
| 691 | - |
|
| 692 | - $content = GETPOST('editfilecontent','none'); |
|
| 693 | - |
|
| 694 | - // Save file on disk |
|
| 695 | - if ($content) |
|
| 696 | - { |
|
| 697 | - dol_delete_file($pathoffile); |
|
| 698 | - file_put_contents($pathoffile, $content); |
|
| 699 | - @chmod($pathoffile, octdec($newmask)); |
|
| 700 | - |
|
| 701 | - setEventMessages($langs->trans("FileSaved"), null); |
|
| 702 | - } |
|
| 703 | - else |
|
| 704 | - { |
|
| 676 | + $relofcustom = basename($dirins); |
|
| 677 | + |
|
| 678 | + if ($relofcustom) |
|
| 679 | + { |
|
| 680 | + // Check that relative path ($file) start with name 'custom' |
|
| 681 | + if (! preg_match('/^'.$relofcustom.'/', $file)) $file=$relofcustom.'/'.$file; |
|
| 682 | + |
|
| 683 | + $pathoffile=dol_buildpath($file, 0); |
|
| 684 | + $pathoffilebackup=dol_buildpath($file.'.back', 0); |
|
| 685 | + |
|
| 686 | + // Save old version |
|
| 687 | + if (dol_is_file($pathoffile)) |
|
| 688 | + { |
|
| 689 | + dol_copy($pathoffile, $pathoffilebackup, 0, 1); |
|
| 690 | + } |
|
| 691 | + |
|
| 692 | + $content = GETPOST('editfilecontent','none'); |
|
| 693 | + |
|
| 694 | + // Save file on disk |
|
| 695 | + if ($content) |
|
| 696 | + { |
|
| 697 | + dol_delete_file($pathoffile); |
|
| 698 | + file_put_contents($pathoffile, $content); |
|
| 699 | + @chmod($pathoffile, octdec($newmask)); |
|
| 700 | + |
|
| 701 | + setEventMessages($langs->trans("FileSaved"), null); |
|
| 702 | + } |
|
| 703 | + else |
|
| 704 | + { |
|
| 705 | 705 | setEventMessages($langs->trans("ContentCantBeEmpty"), null, 'errors'); |
| 706 | - //$action='editfile'; |
|
| 707 | - $error++; |
|
| 708 | - } |
|
| 709 | - } |
|
| 706 | + //$action='editfile'; |
|
| 707 | + $error++; |
|
| 708 | + } |
|
| 709 | + } |
|
| 710 | 710 | } |
| 711 | 711 | |
| 712 | 712 | // Enable module |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | // Set dir where external modules are installed |
| 771 | 771 | if (! dol_is_dir($dirins)) |
| 772 | 772 | { |
| 773 | - dol_mkdir($dirins); |
|
| 773 | + dol_mkdir($dirins); |
|
| 774 | 774 | } |
| 775 | 775 | $dirins_ok=(dol_is_dir($dirins)); |
| 776 | 776 | |
@@ -827,30 +827,30 @@ discard block |
||
| 827 | 827 | $message=''; |
| 828 | 828 | if (! $dirins) |
| 829 | 829 | { |
| 830 | - $message=info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT)); |
|
| 831 | - $allowfromweb=-1; |
|
| 830 | + $message=info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT)); |
|
| 831 | + $allowfromweb=-1; |
|
| 832 | 832 | } |
| 833 | 833 | else |
| 834 | 834 | { |
| 835 | - if ($dirins_ok) |
|
| 836 | - { |
|
| 837 | - if (! is_writable(dol_osencode($dirins))) |
|
| 838 | - { |
|
| 839 | - $langs->load("errors"); |
|
| 840 | - $message=info_admin($langs->trans("ErrorFailedToWriteInDir",$dirins)); |
|
| 841 | - $allowfromweb=0; |
|
| 842 | - } |
|
| 843 | - } |
|
| 844 | - else |
|
| 845 | - { |
|
| 846 | - |
|
| 847 | - $message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); |
|
| 848 | - $allowfromweb=0; |
|
| 849 | - } |
|
| 835 | + if ($dirins_ok) |
|
| 836 | + { |
|
| 837 | + if (! is_writable(dol_osencode($dirins))) |
|
| 838 | + { |
|
| 839 | + $langs->load("errors"); |
|
| 840 | + $message=info_admin($langs->trans("ErrorFailedToWriteInDir",$dirins)); |
|
| 841 | + $allowfromweb=0; |
|
| 842 | + } |
|
| 843 | + } |
|
| 844 | + else |
|
| 845 | + { |
|
| 846 | + |
|
| 847 | + $message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); |
|
| 848 | + $allowfromweb=0; |
|
| 849 | + } |
|
| 850 | 850 | } |
| 851 | 851 | if ($message) |
| 852 | 852 | { |
| 853 | - print $message; |
|
| 853 | + print $message; |
|
| 854 | 854 | } |
| 855 | 855 | |
| 856 | 856 | //print $langs->trans("ModuleBuilderDesc3", count($listofmodules), $FILEFLAG).'<br>'; |
@@ -865,27 +865,27 @@ discard block |
||
| 865 | 865 | { |
| 866 | 866 | $modulelowercase=strtolower($module); |
| 867 | 867 | |
| 868 | - // Load module |
|
| 869 | - dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); |
|
| 870 | - $class='mod'.$module; |
|
| 871 | - |
|
| 872 | - if (class_exists($class)) |
|
| 873 | - { |
|
| 874 | - try { |
|
| 875 | - $moduleobj = new $class($db); |
|
| 876 | - } |
|
| 877 | - catch(Exception $e) |
|
| 878 | - { |
|
| 879 | - $error++; |
|
| 880 | - print $e->getMessage(); |
|
| 881 | - } |
|
| 882 | - } |
|
| 883 | - else |
|
| 884 | - { |
|
| 885 | - if (empty($forceddirread)) $error++; |
|
| 886 | - $langs->load("errors"); |
|
| 887 | - print img_warning('').' '.$langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).'<br>'; |
|
| 888 | - } |
|
| 868 | + // Load module |
|
| 869 | + dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); |
|
| 870 | + $class='mod'.$module; |
|
| 871 | + |
|
| 872 | + if (class_exists($class)) |
|
| 873 | + { |
|
| 874 | + try { |
|
| 875 | + $moduleobj = new $class($db); |
|
| 876 | + } |
|
| 877 | + catch(Exception $e) |
|
| 878 | + { |
|
| 879 | + $error++; |
|
| 880 | + print $e->getMessage(); |
|
| 881 | + } |
|
| 882 | + } |
|
| 883 | + else |
|
| 884 | + { |
|
| 885 | + if (empty($forceddirread)) $error++; |
|
| 886 | + $langs->load("errors"); |
|
| 887 | + print img_warning('').' '.$langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).'<br>'; |
|
| 888 | + } |
|
| 889 | 889 | } |
| 890 | 890 | |
| 891 | 891 | print '<br>'; |
@@ -902,10 +902,10 @@ discard block |
||
| 902 | 902 | |
| 903 | 903 | foreach($listofmodules as $tmpmodule => $tmpmodulewithcase) |
| 904 | 904 | { |
| 905 | - $head[$h][0] = $_SERVER["PHP_SELF"].'?module='.$tmpmodulewithcase.($forceddirread?'@'.$dirread:''); |
|
| 906 | - $head[$h][1] = $tmpmodulewithcase; |
|
| 907 | - $head[$h][2] = $tmpmodulewithcase; |
|
| 908 | - $h++; |
|
| 905 | + $head[$h][0] = $_SERVER["PHP_SELF"].'?module='.$tmpmodulewithcase.($forceddirread?'@'.$dirread:''); |
|
| 906 | + $head[$h][1] = $tmpmodulewithcase; |
|
| 907 | + $head[$h][2] = $tmpmodulewithcase; |
|
| 908 | + $h++; |
|
| 909 | 909 | } |
| 910 | 910 | |
| 911 | 911 | $head[$h][0] = $_SERVER["PHP_SELF"].'?module=deletemodule'; |
@@ -918,671 +918,671 @@ discard block |
||
| 918 | 918 | |
| 919 | 919 | if ($module == 'initmodule') |
| 920 | 920 | { |
| 921 | - // New module |
|
| 922 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 923 | - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 924 | - print '<input type="hidden" name="action" value="initmodule">'; |
|
| 925 | - print '<input type="hidden" name="module" value="initmodule">'; |
|
| 921 | + // New module |
|
| 922 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 923 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 924 | + print '<input type="hidden" name="action" value="initmodule">'; |
|
| 925 | + print '<input type="hidden" name="module" value="initmodule">'; |
|
| 926 | 926 | |
| 927 | - print $langs->trans("EnterNameOfModuleDesc").'<br><br>'; |
|
| 927 | + print $langs->trans("EnterNameOfModuleDesc").'<br><br>'; |
|
| 928 | 928 | |
| 929 | - print '<input type="text" name="modulename" value="'.dol_escape_htmltag($modulename).'" placeholder="'.dol_escape_htmltag($langs->trans("ModuleKey")).'">'; |
|
| 930 | - print '<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans("Create")).'"'.($dirins?'':' disabled="disabled"').'>'; |
|
| 931 | - print '</form>'; |
|
| 929 | + print '<input type="text" name="modulename" value="'.dol_escape_htmltag($modulename).'" placeholder="'.dol_escape_htmltag($langs->trans("ModuleKey")).'">'; |
|
| 930 | + print '<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans("Create")).'"'.($dirins?'':' disabled="disabled"').'>'; |
|
| 931 | + print '</form>'; |
|
| 932 | 932 | } |
| 933 | 933 | elseif ($module == 'deletemodule') |
| 934 | 934 | { |
| 935 | - print '<form name="delete">'; |
|
| 936 | - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 937 | - print '<input type="hidden" name="action" value="confirm_delete">'; |
|
| 938 | - print '<input type="hidden" name="module" value="deletemodule">'; |
|
| 935 | + print '<form name="delete">'; |
|
| 936 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 937 | + print '<input type="hidden" name="action" value="confirm_delete">'; |
|
| 938 | + print '<input type="hidden" name="module" value="deletemodule">'; |
|
| 939 | 939 | |
| 940 | - print $langs->trans("EnterNameOfModuleToDeleteDesc").'<br><br>'; |
|
| 940 | + print $langs->trans("EnterNameOfModuleToDeleteDesc").'<br><br>'; |
|
| 941 | 941 | |
| 942 | - print '<input type="text" name="module" placeholder="'.dol_escape_htmltag($langs->trans("ModuleKey")).'" value="">'; |
|
| 943 | - print '<input type="submit" class="buttonDelete" value="'.$langs->trans("Delete").'"'.($dirins?'':' disabled="disabled"').'>'; |
|
| 944 | - print '</form>'; |
|
| 942 | + print '<input type="text" name="module" placeholder="'.dol_escape_htmltag($langs->trans("ModuleKey")).'" value="">'; |
|
| 943 | + print '<input type="submit" class="buttonDelete" value="'.$langs->trans("Delete").'"'.($dirins?'':' disabled="disabled"').'>'; |
|
| 944 | + print '</form>'; |
|
| 945 | 945 | } |
| 946 | 946 | elseif (! empty($module)) |
| 947 | 947 | { |
| 948 | 948 | // Tabs for module |
| 949 | - if (! $error) |
|
| 950 | - { |
|
| 951 | - $head2 = array(); |
|
| 952 | - $h=0; |
|
| 953 | - |
|
| 954 | - $modulelowercase=strtolower($module); |
|
| 955 | - $const_name = 'MAIN_MODULE_'.strtoupper($module); |
|
| 956 | - |
|
| 957 | - $param=''; |
|
| 958 | - if ($tab) $param.= '&tab='.$tab; |
|
| 959 | - if ($module) $param.='&module='.$module; |
|
| 960 | - if ($tabobj) $param.='&tabobj='.$tabobj; |
|
| 961 | - |
|
| 962 | - $urltomodulesetup='<a href="'.DOL_URL_ROOT.'/admin/modules.php?search_keyword='.urlencode($module).'">'.$langs->trans('Home').'-'.$langs->trans("Setup").'-'.$langs->trans("Modules").'</a>'; |
|
| 963 | - $linktoenabledisable=''; |
|
| 964 | - if (! empty($conf->global->$const_name)) // If module is already activated |
|
| 965 | - { |
|
| 966 | - $linktoenabledisable.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=reset&value=mod' . $module . $param . '">'; |
|
| 967 | - $linktoenabledisable.=img_picto($langs->trans("Activated"),'switch_on'); |
|
| 968 | - $linktoenabledisable.='</a>'; |
|
| 969 | - } |
|
| 970 | - else |
|
| 971 | - { |
|
| 972 | - $linktoenabledisable.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=set&value=mod' . $module . $param . '">'; |
|
| 973 | - $linktoenabledisable.=img_picto($langs->trans("Disabled"),'switch_off'); |
|
| 974 | - $linktoenabledisable.="</a>\n"; |
|
| 975 | - } |
|
| 976 | - if (! empty($conf->$modulelowercase->enabled)) |
|
| 977 | - { |
|
| 978 | - $modulestatusinfo=img_warning().' '.$langs->trans("ModuleIsLive"); |
|
| 979 | - } |
|
| 980 | - else |
|
| 981 | - { |
|
| 982 | - $modulestatusinfo=img_info('').' '.$langs->trans("ModuleIsNotActive", $urltomodulesetup); |
|
| 983 | - } |
|
| 984 | - |
|
| 985 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=description&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 986 | - $head2[$h][1] = $langs->trans("Description"); |
|
| 987 | - $head2[$h][2] = 'description'; |
|
| 988 | - $h++; |
|
| 989 | - |
|
| 990 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=specifications&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 991 | - $head2[$h][1] = $langs->trans("Specifications"); |
|
| 992 | - $head2[$h][2] = 'specifications'; |
|
| 993 | - $h++; |
|
| 994 | - |
|
| 995 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=languages&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 996 | - $head2[$h][1] = $langs->trans("Languages"); |
|
| 997 | - $head2[$h][2] = 'languages'; |
|
| 998 | - $h++; |
|
| 999 | - |
|
| 1000 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1001 | - $head2[$h][1] = $langs->trans("Objects"); |
|
| 1002 | - $head2[$h][2] = 'objects'; |
|
| 1003 | - $h++; |
|
| 1004 | - |
|
| 1005 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=menus&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1006 | - $head2[$h][1] = $langs->trans("Menus"); |
|
| 1007 | - $head2[$h][2] = 'menus'; |
|
| 1008 | - $h++; |
|
| 1009 | - |
|
| 1010 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=permissions&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1011 | - $head2[$h][1] = $langs->trans("Permissions"); |
|
| 1012 | - $head2[$h][2] = 'permissions'; |
|
| 1013 | - $h++; |
|
| 1014 | - |
|
| 1015 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=hooks&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1016 | - $head2[$h][1] = $langs->trans("Hooks"); |
|
| 1017 | - $head2[$h][2] = 'hooks'; |
|
| 1018 | - $h++; |
|
| 1019 | - |
|
| 1020 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=triggers&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1021 | - $head2[$h][1] = $langs->trans("Triggers"); |
|
| 1022 | - $head2[$h][2] = 'triggers'; |
|
| 1023 | - $h++; |
|
| 1024 | - |
|
| 1025 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=widgets&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1026 | - $head2[$h][1] = $langs->trans("Widgets"); |
|
| 1027 | - $head2[$h][2] = 'widgets'; |
|
| 1028 | - $h++; |
|
| 1029 | - |
|
| 1030 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=cron&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1031 | - $head2[$h][1] = $langs->trans("CronList"); |
|
| 1032 | - $head2[$h][2] = 'cron'; |
|
| 1033 | - $h++; |
|
| 1034 | - |
|
| 1035 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=buildpackage&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1036 | - $head2[$h][1] = $langs->trans("BuildPackage"); |
|
| 1037 | - $head2[$h][2] = 'buildpackage'; |
|
| 1038 | - $h++; |
|
| 1039 | - |
|
| 1040 | - print $modulestatusinfo; |
|
| 1041 | - print ' '.$linktoenabledisable; |
|
| 1042 | - print '<br><br>'; |
|
| 1043 | - |
|
| 1044 | - if ($tab == 'description') |
|
| 1045 | - { |
|
| 1046 | - $pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php'; |
|
| 1047 | - $pathtofilereadme = $modulelowercase.'/README.md'; |
|
| 1048 | - $pathtochangelog = $modulelowercase.'/ChangeLog.md'; |
|
| 1049 | - |
|
| 1050 | - if ($action != 'editfile' || empty($file)) |
|
| 1051 | - { |
|
| 1052 | - dol_fiche_head($head2, $tab, '', -1, ''); // Description - level 2 |
|
| 1053 | - |
|
| 1054 | - print $langs->trans("ModuleBuilderDesc".$tab).'<br><br>'; |
|
| 1055 | - |
|
| 1056 | - print '<span class="fa fa-file"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>'; |
|
| 1057 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1058 | - print '<br>'; |
|
| 1059 | - |
|
| 1060 | - print '<span class="fa fa-file"></span> '.$langs->trans("ReadmeFile").' : <strong>'.$pathtofilereadme.'</strong>'; |
|
| 1061 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=markdown&file='.urlencode($pathtofilereadme).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1062 | - print '<br>'; |
|
| 1063 | - |
|
| 1064 | - print '<span class="fa fa-file"></span> '.$langs->trans("ChangeLog").' : <strong>'.$pathtochangelog.'</strong>'; |
|
| 1065 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=markdown&file='.urlencode($pathtochangelog).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1066 | - print '<br>'; |
|
| 1067 | - |
|
| 1068 | - print '<br>'; |
|
| 1069 | - print '<br>'; |
|
| 1070 | - |
|
| 1071 | - print_fiche_titre($langs->trans("DescriptorFile")); |
|
| 1072 | - |
|
| 1073 | - if (! empty($moduleobj)) |
|
| 1074 | - { |
|
| 1075 | - print '<div class="underbanner clearboth"></div>'; |
|
| 1076 | - print '<div class="fichecenter">'; |
|
| 1077 | - |
|
| 1078 | - print '<table class="border centpercent">'; |
|
| 1079 | - print '<tr class="liste_titre"><td class="titlefield">'; |
|
| 1080 | - print $langs->trans("Parameter"); |
|
| 1081 | - print '</td><td>'; |
|
| 1082 | - print $langs->trans("Value"); |
|
| 1083 | - print '</td></tr>'; |
|
| 1084 | - |
|
| 1085 | - print '<tr><td>'; |
|
| 1086 | - print $langs->trans("Numero"); |
|
| 1087 | - print '</td><td>'; |
|
| 1088 | - print $moduleobj->numero; |
|
| 1089 | - print ' (<a href="'.DOL_URL_ROOT.'/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info" target="_blank">'.$langs->trans("SeeIDsInUse").'</a>'; |
|
| 1090 | - print ' - <a href="https://wiki.dolibarr.org/index.php/List_of_modules_id" target="_blank">'.$langs->trans("SeeReservedIDsRangeHere").'</a>)'; |
|
| 1091 | - print '</td></tr>'; |
|
| 1092 | - |
|
| 1093 | - print '<tr><td>'; |
|
| 1094 | - print $langs->trans("Name"); |
|
| 1095 | - print '</td><td>'; |
|
| 1096 | - print $moduleobj->getName(); |
|
| 1097 | - print '</td></tr>'; |
|
| 1098 | - |
|
| 1099 | - print '<tr><td>'; |
|
| 1100 | - print $langs->trans("Version"); |
|
| 1101 | - print '</td><td>'; |
|
| 1102 | - print $moduleobj->getVersion(); |
|
| 1103 | - print '</td></tr>'; |
|
| 1104 | - |
|
| 1105 | - print '<tr><td>'; |
|
| 1106 | - print $langs->trans("Family"); |
|
| 1107 | - //print "<br>'crm','financial','hr','projects','products','ecm','technic','interface','other'"; |
|
| 1108 | - print '</td><td>'; |
|
| 1109 | - print $moduleobj->family; |
|
| 1110 | - print '</td></tr>'; |
|
| 1111 | - |
|
| 1112 | - print '<tr><td>'; |
|
| 1113 | - print $langs->trans("EditorName"); |
|
| 1114 | - print '</td><td>'; |
|
| 1115 | - print $moduleobj->editor_name; |
|
| 1116 | - print '</td></tr>'; |
|
| 1117 | - |
|
| 1118 | - print '<tr><td>'; |
|
| 1119 | - print $langs->trans("EditorUrl"); |
|
| 1120 | - print '</td><td>'; |
|
| 1121 | - print $moduleobj->editor_url; |
|
| 1122 | - print '</td></tr>'; |
|
| 1123 | - |
|
| 1124 | - print '<tr><td>'; |
|
| 1125 | - print $langs->trans("Description"); |
|
| 1126 | - print '</td><td>'; |
|
| 1127 | - print $moduleobj->getDesc(); |
|
| 1128 | - print '</td></tr>'; |
|
| 1129 | - |
|
| 1130 | - print '</table>'; |
|
| 1131 | - |
|
| 1132 | - print '<br><br>'; |
|
| 1133 | - |
|
| 1134 | - // Readme file |
|
| 1135 | - print_fiche_titre($langs->trans("ReadmeFile")); |
|
| 949 | + if (! $error) |
|
| 950 | + { |
|
| 951 | + $head2 = array(); |
|
| 952 | + $h=0; |
|
| 1136 | 953 | |
| 1137 | - print '<div class="underbanner clearboth"></div>'; |
|
| 1138 | - print '<div class="fichecenter">'; |
|
| 954 | + $modulelowercase=strtolower($module); |
|
| 955 | + $const_name = 'MAIN_MODULE_'.strtoupper($module); |
|
| 1139 | 956 | |
| 1140 | - print $moduleobj->getDescLong(); |
|
| 957 | + $param=''; |
|
| 958 | + if ($tab) $param.= '&tab='.$tab; |
|
| 959 | + if ($module) $param.='&module='.$module; |
|
| 960 | + if ($tabobj) $param.='&tabobj='.$tabobj; |
|
| 1141 | 961 | |
| 1142 | - print '<br><br>'; |
|
| 962 | + $urltomodulesetup='<a href="'.DOL_URL_ROOT.'/admin/modules.php?search_keyword='.urlencode($module).'">'.$langs->trans('Home').'-'.$langs->trans("Setup").'-'.$langs->trans("Modules").'</a>'; |
|
| 963 | + $linktoenabledisable=''; |
|
| 964 | + if (! empty($conf->global->$const_name)) // If module is already activated |
|
| 965 | + { |
|
| 966 | + $linktoenabledisable.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=reset&value=mod' . $module . $param . '">'; |
|
| 967 | + $linktoenabledisable.=img_picto($langs->trans("Activated"),'switch_on'); |
|
| 968 | + $linktoenabledisable.='</a>'; |
|
| 969 | + } |
|
| 970 | + else |
|
| 971 | + { |
|
| 972 | + $linktoenabledisable.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=set&value=mod' . $module . $param . '">'; |
|
| 973 | + $linktoenabledisable.=img_picto($langs->trans("Disabled"),'switch_off'); |
|
| 974 | + $linktoenabledisable.="</a>\n"; |
|
| 975 | + } |
|
| 976 | + if (! empty($conf->$modulelowercase->enabled)) |
|
| 977 | + { |
|
| 978 | + $modulestatusinfo=img_warning().' '.$langs->trans("ModuleIsLive"); |
|
| 979 | + } |
|
| 980 | + else |
|
| 981 | + { |
|
| 982 | + $modulestatusinfo=img_info('').' '.$langs->trans("ModuleIsNotActive", $urltomodulesetup); |
|
| 983 | + } |
|
| 1143 | 984 | |
| 1144 | - // ChangeLog |
|
| 1145 | - print_fiche_titre($langs->trans("ChangeLog")); |
|
| 985 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=description&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 986 | + $head2[$h][1] = $langs->trans("Description"); |
|
| 987 | + $head2[$h][2] = 'description'; |
|
| 988 | + $h++; |
|
| 989 | + |
|
| 990 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=specifications&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 991 | + $head2[$h][1] = $langs->trans("Specifications"); |
|
| 992 | + $head2[$h][2] = 'specifications'; |
|
| 993 | + $h++; |
|
| 994 | + |
|
| 995 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=languages&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 996 | + $head2[$h][1] = $langs->trans("Languages"); |
|
| 997 | + $head2[$h][2] = 'languages'; |
|
| 998 | + $h++; |
|
| 999 | + |
|
| 1000 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1001 | + $head2[$h][1] = $langs->trans("Objects"); |
|
| 1002 | + $head2[$h][2] = 'objects'; |
|
| 1003 | + $h++; |
|
| 1004 | + |
|
| 1005 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=menus&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1006 | + $head2[$h][1] = $langs->trans("Menus"); |
|
| 1007 | + $head2[$h][2] = 'menus'; |
|
| 1008 | + $h++; |
|
| 1009 | + |
|
| 1010 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=permissions&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1011 | + $head2[$h][1] = $langs->trans("Permissions"); |
|
| 1012 | + $head2[$h][2] = 'permissions'; |
|
| 1013 | + $h++; |
|
| 1014 | + |
|
| 1015 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=hooks&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1016 | + $head2[$h][1] = $langs->trans("Hooks"); |
|
| 1017 | + $head2[$h][2] = 'hooks'; |
|
| 1018 | + $h++; |
|
| 1019 | + |
|
| 1020 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=triggers&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1021 | + $head2[$h][1] = $langs->trans("Triggers"); |
|
| 1022 | + $head2[$h][2] = 'triggers'; |
|
| 1023 | + $h++; |
|
| 1024 | + |
|
| 1025 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=widgets&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1026 | + $head2[$h][1] = $langs->trans("Widgets"); |
|
| 1027 | + $head2[$h][2] = 'widgets'; |
|
| 1028 | + $h++; |
|
| 1029 | + |
|
| 1030 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=cron&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1031 | + $head2[$h][1] = $langs->trans("CronList"); |
|
| 1032 | + $head2[$h][2] = 'cron'; |
|
| 1033 | + $h++; |
|
| 1034 | + |
|
| 1035 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=buildpackage&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1036 | + $head2[$h][1] = $langs->trans("BuildPackage"); |
|
| 1037 | + $head2[$h][2] = 'buildpackage'; |
|
| 1038 | + $h++; |
|
| 1039 | + |
|
| 1040 | + print $modulestatusinfo; |
|
| 1041 | + print ' '.$linktoenabledisable; |
|
| 1042 | + print '<br><br>'; |
|
| 1043 | + |
|
| 1044 | + if ($tab == 'description') |
|
| 1045 | + { |
|
| 1046 | + $pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php'; |
|
| 1047 | + $pathtofilereadme = $modulelowercase.'/README.md'; |
|
| 1048 | + $pathtochangelog = $modulelowercase.'/ChangeLog.md'; |
|
| 1146 | 1049 | |
| 1147 | - print '<div class="underbanner clearboth"></div>'; |
|
| 1148 | - print '<div class="fichecenter">'; |
|
| 1050 | + if ($action != 'editfile' || empty($file)) |
|
| 1051 | + { |
|
| 1052 | + dol_fiche_head($head2, $tab, '', -1, ''); // Description - level 2 |
|
| 1149 | 1053 | |
| 1150 | - print $moduleobj->getChangeLog(); |
|
| 1054 | + print $langs->trans("ModuleBuilderDesc".$tab).'<br><br>'; |
|
| 1151 | 1055 | |
| 1152 | - print '</div>'; |
|
| 1153 | - } |
|
| 1154 | - else |
|
| 1155 | - { |
|
| 1156 | - print $langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).'<br>'; |
|
| 1157 | - } |
|
| 1056 | + print '<span class="fa fa-file"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>'; |
|
| 1057 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1058 | + print '<br>'; |
|
| 1158 | 1059 | |
| 1159 | - dol_fiche_end(); |
|
| 1160 | - } |
|
| 1161 | - else |
|
| 1162 | - { |
|
| 1163 | - $fullpathoffile=dol_buildpath($file, 0, 1); // Description - level 2 |
|
| 1060 | + print '<span class="fa fa-file"></span> '.$langs->trans("ReadmeFile").' : <strong>'.$pathtofilereadme.'</strong>'; |
|
| 1061 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=markdown&file='.urlencode($pathtofilereadme).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1062 | + print '<br>'; |
|
| 1164 | 1063 | |
| 1165 | - if ($fullpathoffile) |
|
| 1166 | - { |
|
| 1167 | - $content = file_get_contents($fullpathoffile); |
|
| 1168 | - } |
|
| 1064 | + print '<span class="fa fa-file"></span> '.$langs->trans("ChangeLog").' : <strong>'.$pathtochangelog.'</strong>'; |
|
| 1065 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=markdown&file='.urlencode($pathtochangelog).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1066 | + print '<br>'; |
|
| 1169 | 1067 | |
| 1170 | - // New module |
|
| 1171 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1172 | - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1173 | - print '<input type="hidden" name="action" value="savefile">'; |
|
| 1174 | - print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 1175 | - print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 1176 | - print '<input type="hidden" name="module" value="'.$module.'">'; |
|
| 1068 | + print '<br>'; |
|
| 1069 | + print '<br>'; |
|
| 1070 | + |
|
| 1071 | + print_fiche_titre($langs->trans("DescriptorFile")); |
|
| 1072 | + |
|
| 1073 | + if (! empty($moduleobj)) |
|
| 1074 | + { |
|
| 1075 | + print '<div class="underbanner clearboth"></div>'; |
|
| 1076 | + print '<div class="fichecenter">'; |
|
| 1077 | + |
|
| 1078 | + print '<table class="border centpercent">'; |
|
| 1079 | + print '<tr class="liste_titre"><td class="titlefield">'; |
|
| 1080 | + print $langs->trans("Parameter"); |
|
| 1081 | + print '</td><td>'; |
|
| 1082 | + print $langs->trans("Value"); |
|
| 1083 | + print '</td></tr>'; |
|
| 1084 | + |
|
| 1085 | + print '<tr><td>'; |
|
| 1086 | + print $langs->trans("Numero"); |
|
| 1087 | + print '</td><td>'; |
|
| 1088 | + print $moduleobj->numero; |
|
| 1089 | + print ' (<a href="'.DOL_URL_ROOT.'/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info" target="_blank">'.$langs->trans("SeeIDsInUse").'</a>'; |
|
| 1090 | + print ' - <a href="https://wiki.dolibarr.org/index.php/List_of_modules_id" target="_blank">'.$langs->trans("SeeReservedIDsRangeHere").'</a>)'; |
|
| 1091 | + print '</td></tr>'; |
|
| 1092 | + |
|
| 1093 | + print '<tr><td>'; |
|
| 1094 | + print $langs->trans("Name"); |
|
| 1095 | + print '</td><td>'; |
|
| 1096 | + print $moduleobj->getName(); |
|
| 1097 | + print '</td></tr>'; |
|
| 1098 | + |
|
| 1099 | + print '<tr><td>'; |
|
| 1100 | + print $langs->trans("Version"); |
|
| 1101 | + print '</td><td>'; |
|
| 1102 | + print $moduleobj->getVersion(); |
|
| 1103 | + print '</td></tr>'; |
|
| 1104 | + |
|
| 1105 | + print '<tr><td>'; |
|
| 1106 | + print $langs->trans("Family"); |
|
| 1107 | + //print "<br>'crm','financial','hr','projects','products','ecm','technic','interface','other'"; |
|
| 1108 | + print '</td><td>'; |
|
| 1109 | + print $moduleobj->family; |
|
| 1110 | + print '</td></tr>'; |
|
| 1111 | + |
|
| 1112 | + print '<tr><td>'; |
|
| 1113 | + print $langs->trans("EditorName"); |
|
| 1114 | + print '</td><td>'; |
|
| 1115 | + print $moduleobj->editor_name; |
|
| 1116 | + print '</td></tr>'; |
|
| 1117 | + |
|
| 1118 | + print '<tr><td>'; |
|
| 1119 | + print $langs->trans("EditorUrl"); |
|
| 1120 | + print '</td><td>'; |
|
| 1121 | + print $moduleobj->editor_url; |
|
| 1122 | + print '</td></tr>'; |
|
| 1123 | + |
|
| 1124 | + print '<tr><td>'; |
|
| 1125 | + print $langs->trans("Description"); |
|
| 1126 | + print '</td><td>'; |
|
| 1127 | + print $moduleobj->getDesc(); |
|
| 1128 | + print '</td></tr>'; |
|
| 1129 | + |
|
| 1130 | + print '</table>'; |
|
| 1131 | + |
|
| 1132 | + print '<br><br>'; |
|
| 1133 | + |
|
| 1134 | + // Readme file |
|
| 1135 | + print_fiche_titre($langs->trans("ReadmeFile")); |
|
| 1136 | + |
|
| 1137 | + print '<div class="underbanner clearboth"></div>'; |
|
| 1138 | + print '<div class="fichecenter">'; |
|
| 1139 | + |
|
| 1140 | + print $moduleobj->getDescLong(); |
|
| 1141 | + |
|
| 1142 | + print '<br><br>'; |
|
| 1143 | + |
|
| 1144 | + // ChangeLog |
|
| 1145 | + print_fiche_titre($langs->trans("ChangeLog")); |
|
| 1146 | + |
|
| 1147 | + print '<div class="underbanner clearboth"></div>'; |
|
| 1148 | + print '<div class="fichecenter">'; |
|
| 1149 | + |
|
| 1150 | + print $moduleobj->getChangeLog(); |
|
| 1151 | + |
|
| 1152 | + print '</div>'; |
|
| 1153 | + } |
|
| 1154 | + else |
|
| 1155 | + { |
|
| 1156 | + print $langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).'<br>'; |
|
| 1157 | + } |
|
| 1177 | 1158 | |
| 1178 | - dol_fiche_head($head2, $tab, '', -1, ''); |
|
| 1159 | + dol_fiche_end(); |
|
| 1160 | + } |
|
| 1161 | + else |
|
| 1162 | + { |
|
| 1163 | + $fullpathoffile=dol_buildpath($file, 0, 1); // Description - level 2 |
|
| 1179 | 1164 | |
| 1180 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%', ''); |
|
| 1181 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 1165 | + if ($fullpathoffile) |
|
| 1166 | + { |
|
| 1167 | + $content = file_get_contents($fullpathoffile); |
|
| 1168 | + } |
|
| 1182 | 1169 | |
| 1183 | - dol_fiche_end(); |
|
| 1170 | + // New module |
|
| 1171 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1172 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1173 | + print '<input type="hidden" name="action" value="savefile">'; |
|
| 1174 | + print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 1175 | + print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 1176 | + print '<input type="hidden" name="module" value="'.$module.'">'; |
|
| 1184 | 1177 | |
| 1185 | - print '<center>'; |
|
| 1186 | - print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
|
| 1187 | - print ' '; |
|
| 1188 | - print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; |
|
| 1189 | - print '</center>'; |
|
| 1178 | + dol_fiche_head($head2, $tab, '', -1, ''); |
|
| 1190 | 1179 | |
| 1191 | - print '</form>'; |
|
| 1192 | - } |
|
| 1193 | - } |
|
| 1194 | - else |
|
| 1195 | - { |
|
| 1196 | - dol_fiche_head($head2, $tab, '', -1, ''); // Level 2 |
|
| 1197 | - } |
|
| 1180 | + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%', ''); |
|
| 1181 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 1182 | + |
|
| 1183 | + dol_fiche_end(); |
|
| 1184 | + |
|
| 1185 | + print '<center>'; |
|
| 1186 | + print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
|
| 1187 | + print ' '; |
|
| 1188 | + print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; |
|
| 1189 | + print '</center>'; |
|
| 1190 | + |
|
| 1191 | + print '</form>'; |
|
| 1192 | + } |
|
| 1193 | + } |
|
| 1194 | + else |
|
| 1195 | + { |
|
| 1196 | + dol_fiche_head($head2, $tab, '', -1, ''); // Level 2 |
|
| 1197 | + } |
|
| 1198 | 1198 | |
| 1199 | 1199 | |
| 1200 | - if ($tab == 'specifications') |
|
| 1201 | - { |
|
| 1202 | - if ($action != 'editfile' || empty($file)) |
|
| 1203 | - { |
|
| 1204 | - print $langs->trans("SpecDefDesc").'<br>'; |
|
| 1205 | - print '<br>'; |
|
| 1200 | + if ($tab == 'specifications') |
|
| 1201 | + { |
|
| 1202 | + if ($action != 'editfile' || empty($file)) |
|
| 1203 | + { |
|
| 1204 | + print $langs->trans("SpecDefDesc").'<br>'; |
|
| 1205 | + print '<br>'; |
|
| 1206 | 1206 | |
| 1207 | - $specs=dol_dir_list(dol_buildpath($modulelowercase.'/doc', 0), 'files', 1, '(\.md|\.asciidoc)$'); |
|
| 1207 | + $specs=dol_dir_list(dol_buildpath($modulelowercase.'/doc', 0), 'files', 1, '(\.md|\.asciidoc)$'); |
|
| 1208 | 1208 | |
| 1209 | - foreach ($specs as $spec) |
|
| 1210 | - { |
|
| 1211 | - $pathtofile = $modulelowercase.'/doc/'.$spec['relativename']; |
|
| 1209 | + foreach ($specs as $spec) |
|
| 1210 | + { |
|
| 1211 | + $pathtofile = $modulelowercase.'/doc/'.$spec['relativename']; |
|
| 1212 | 1212 | $format='asciidoc'; |
| 1213 | 1213 | if (preg_match('/\.md$/i', $spec['name'])) $format='markdown'; |
| 1214 | - print '<span class="fa fa-file"></span> '.$langs->trans("SpecificationFile").' : <strong>'.$pathtofile.'</strong>'; |
|
| 1215 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format='.$format.'&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1216 | - print '<br>'; |
|
| 1217 | - } |
|
| 1218 | - } |
|
| 1219 | - else |
|
| 1220 | - { |
|
| 1221 | - // Use MD or asciidoc |
|
| 1222 | - |
|
| 1223 | - //print $langs->trans("UseAsciiDocFormat").'<br>'; |
|
| 1224 | - |
|
| 1225 | - $fullpathoffile=dol_buildpath($file, 0); |
|
| 1226 | - |
|
| 1227 | - $content = file_get_contents($fullpathoffile); |
|
| 1228 | - |
|
| 1229 | - // New module |
|
| 1230 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1231 | - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1232 | - print '<input type="hidden" name="action" value="savefile">'; |
|
| 1233 | - print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 1234 | - print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 1235 | - print '<input type="hidden" name="module" value="'.$module.'">'; |
|
| 1236 | - |
|
| 1237 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 1238 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 1239 | - print '<br>'; |
|
| 1240 | - print '<center>'; |
|
| 1241 | - print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
|
| 1242 | - print ' '; |
|
| 1243 | - print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; |
|
| 1244 | - print '</center>'; |
|
| 1245 | - |
|
| 1246 | - print '</form>'; |
|
| 1247 | - } |
|
| 1248 | - } |
|
| 1249 | - |
|
| 1250 | - if ($tab == 'languages') |
|
| 1251 | - { |
|
| 1252 | - if ($action != 'editfile' || empty($file)) |
|
| 1253 | - { |
|
| 1254 | - print $langs->trans("LanguageDefDesc").'<br>'; |
|
| 1255 | - print '<br>'; |
|
| 1256 | - |
|
| 1257 | - |
|
| 1258 | - print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
|
| 1259 | - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1260 | - print '<input type="hidden" name="action" value="addlanguage">'; |
|
| 1261 | - print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 1262 | - print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 1263 | - print '<input type="hidden" name="module" value="'.$module.'">'; |
|
| 1264 | - print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300', 1); |
|
| 1265 | - print '<input type="submit" name="addlanguage" class="button" value="'.dol_escape_htmltag($langs->trans("AddLanguageFile")).'"><br>'; |
|
| 1266 | - print '</form>'; |
|
| 1214 | + print '<span class="fa fa-file"></span> '.$langs->trans("SpecificationFile").' : <strong>'.$pathtofile.'</strong>'; |
|
| 1215 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format='.$format.'&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1216 | + print '<br>'; |
|
| 1217 | + } |
|
| 1218 | + } |
|
| 1219 | + else |
|
| 1220 | + { |
|
| 1221 | + // Use MD or asciidoc |
|
| 1267 | 1222 | |
| 1268 | - print '<br>'; |
|
| 1269 | - print '<br>'; |
|
| 1223 | + //print $langs->trans("UseAsciiDocFormat").'<br>'; |
|
| 1270 | 1224 | |
| 1271 | - $langfiles=dol_dir_list(dol_buildpath($modulelowercase.'/langs', 0), 'files', 1, '\.lang$'); |
|
| 1225 | + $fullpathoffile=dol_buildpath($file, 0); |
|
| 1272 | 1226 | |
| 1273 | - foreach ($langfiles as $langfile) |
|
| 1274 | - { |
|
| 1275 | - $pathtofile = $modulelowercase.'/langs/'.$langfile['relativename']; |
|
| 1276 | - print '<span class="fa fa-file"></span> '.$langs->trans("LanguageFile").' '.basename(dirname($pathtofile)).' : <strong>'.$pathtofile.'</strong>'; |
|
| 1277 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format='.$format.'&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1278 | - print '<br>'; |
|
| 1279 | - } |
|
| 1280 | - } |
|
| 1281 | - else |
|
| 1282 | - { |
|
| 1283 | - // Edit text language file |
|
| 1284 | - |
|
| 1285 | - //print $langs->trans("UseAsciiDocFormat").'<br>'; |
|
| 1286 | - |
|
| 1287 | - $fullpathoffile=dol_buildpath($file, 0); |
|
| 1288 | - |
|
| 1289 | - $content = file_get_contents($fullpathoffile); |
|
| 1290 | - |
|
| 1291 | - // New module |
|
| 1292 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1293 | - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1294 | - print '<input type="hidden" name="action" value="savefile">'; |
|
| 1295 | - print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 1296 | - print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 1297 | - print '<input type="hidden" name="module" value="'.$module.'">'; |
|
| 1298 | - |
|
| 1299 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 1300 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'text')); |
|
| 1301 | - print '<br>'; |
|
| 1302 | - print '<center>'; |
|
| 1303 | - print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
|
| 1304 | - print ' '; |
|
| 1305 | - print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; |
|
| 1306 | - print '</center>'; |
|
| 1227 | + $content = file_get_contents($fullpathoffile); |
|
| 1307 | 1228 | |
| 1308 | - print '</form>'; |
|
| 1309 | - } |
|
| 1310 | - } |
|
| 1311 | - |
|
| 1312 | - if ($tab == 'objects') |
|
| 1313 | - { |
|
| 1314 | - $head3 = array(); |
|
| 1315 | - $h=0; |
|
| 1316 | - |
|
| 1317 | - // Dir for module |
|
| 1318 | - $dir = $dirread.'/'.$modulelowercase.'/class'; |
|
| 1319 | - |
|
| 1320 | - $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj=newobject'; |
|
| 1321 | - $head3[$h][1] = $langs->trans("NewObject"); |
|
| 1322 | - $head3[$h][2] = 'newobject'; |
|
| 1323 | - $h++; |
|
| 1324 | - |
|
| 1325 | - // Scan for object class files |
|
| 1326 | - $listofobject = dol_dir_list($dir, 'files', 0, '\.class\.php$'); |
|
| 1327 | - |
|
| 1328 | - $firstobjectname=''; |
|
| 1329 | - foreach($listofobject as $fileobj) |
|
| 1330 | - { |
|
| 1331 | - if (preg_match('/^api_/',$fileobj['name'])) continue; |
|
| 1332 | - if (preg_match('/^actions_/',$fileobj['name'])) continue; |
|
| 1333 | - |
|
| 1334 | - $tmpcontent=file_get_contents($fileobj['fullname']); |
|
| 1335 | - if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims',$tmpcontent,$reg)) |
|
| 1336 | - { |
|
| 1337 | - //$objectname = preg_replace('/\.txt$/', '', $fileobj['name']); |
|
| 1338 | - $objectname = $reg[1]; |
|
| 1339 | - if (empty($firstobjectname)) $firstobjectname = $objectname; |
|
| 1340 | - |
|
| 1341 | - $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj='.$objectname; |
|
| 1342 | - $head3[$h][1] = $objectname; |
|
| 1343 | - $head3[$h][2] = $objectname; |
|
| 1344 | - $h++; |
|
| 1345 | - } |
|
| 1346 | - } |
|
| 1347 | - |
|
| 1348 | - $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj=deleteobject'; |
|
| 1349 | - $head3[$h][1] = $langs->trans("DangerZone"); |
|
| 1350 | - $head3[$h][2] = 'deleteobject'; |
|
| 1351 | - $h++; |
|
| 1352 | - |
|
| 1353 | - // If tabobj was not defined, then we check if there is one obj. If yes, we force on it, if no, we will show tab to create new objects. |
|
| 1354 | - if ($tabobj == 'newobjectifnoobj') |
|
| 1355 | - { |
|
| 1356 | - if ($firstobjectname) $tabobj=$firstobjectname; |
|
| 1357 | - else $tabobj = 'newobject'; |
|
| 1358 | - } |
|
| 1359 | - |
|
| 1360 | - dol_fiche_head($head3, $tabobj, '', -1, ''); // Level 3 |
|
| 1361 | - |
|
| 1362 | - if ($tabobj == 'newobject') |
|
| 1363 | - { |
|
| 1364 | - // New object tab |
|
| 1365 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1366 | - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1367 | - print '<input type="hidden" name="action" value="initobject">'; |
|
| 1368 | - print '<input type="hidden" name="tab" value="objects">'; |
|
| 1369 | - print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">'; |
|
| 1370 | - |
|
| 1371 | - print $langs->trans("EnterNameOfObjectDesc").'<br><br>'; |
|
| 1372 | - |
|
| 1373 | - print '<input type="text" name="objectname" value="'.dol_escape_htmltag($modulename).'" placeholder="'.dol_escape_htmltag($langs->trans("ObjectKey")).'">'; |
|
| 1374 | - print '<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans("Create")).'"'.($dirins?'':' disabled="disabled"').'>'; |
|
| 1375 | - print '</form>'; |
|
| 1376 | - } |
|
| 1377 | - elseif ($tabobj == 'deleteobject') |
|
| 1378 | - { |
|
| 1379 | - // Delete object tab |
|
| 1380 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1381 | - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1382 | - print '<input type="hidden" name="action" value="confirm_deleteobject">'; |
|
| 1383 | - print '<input type="hidden" name="tab" value="objects">'; |
|
| 1384 | - print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">'; |
|
| 1385 | - |
|
| 1386 | - print $langs->trans("EnterNameOfObjectToDeleteDesc").'<br><br>'; |
|
| 1387 | - |
|
| 1388 | - print '<input type="text" name="objectname" value="'.dol_escape_htmltag($modulename).'" placeholder="'.dol_escape_htmltag($langs->trans("ObjectKey")).'">'; |
|
| 1389 | - print '<input type="submit" class="buttonDelete" name="delete" value="'.dol_escape_htmltag($langs->trans("Delete")).'"'.($dirins?'':' disabled="disabled"').'>'; |
|
| 1390 | - print '</form>'; |
|
| 1391 | - } |
|
| 1392 | - else |
|
| 1393 | - { // tabobj = module |
|
| 1394 | - if ($action == 'deleteproperty') |
|
| 1395 | - { |
|
| 1396 | - $formconfirm = $form->formconfirm( |
|
| 1397 | - $_SERVER["PHP_SELF"].'?propertykey='.urlencode(GETPOST('propertykey','alpha')).'&objectname='.urlencode($objectname).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj), |
|
| 1398 | - $langs->trans('Delete'), $langs->trans('ConfirmDeleteProperty', GETPOST('propertykey','alpha')), 'confirm_deleteproperty', '', 0, 1 |
|
| 1399 | - ); |
|
| 1400 | - |
|
| 1401 | - // Print form confirm |
|
| 1402 | - print $formconfirm; |
|
| 1403 | - } |
|
| 1404 | - |
|
| 1405 | - if ($action != 'editfile' || empty($file)) |
|
| 1406 | - { |
|
| 1407 | - try { |
|
| 1408 | - $pathtoclass = strtolower($module).'/class/'.strtolower($tabobj).'.class.php'; |
|
| 1409 | - $pathtoapi = strtolower($module).'/class/api_'.strtolower($tabobj).'.class.php'; |
|
| 1410 | - $pathtoagenda = strtolower($module).'/'.strtolower($tabobj).'_agenda.php'; |
|
| 1411 | - $pathtocard = strtolower($module).'/'.strtolower($tabobj).'_card.php'; |
|
| 1412 | - $pathtodocument = strtolower($module).'/'.strtolower($tabobj).'_document.php'; |
|
| 1413 | - $pathtolist = strtolower($module).'/'.strtolower($tabobj).'_list.php'; |
|
| 1414 | - $pathtonote = strtolower($module).'/'.strtolower($tabobj).'_note.php'; |
|
| 1415 | - $pathtophpunit = strtolower($module).'/test/phpunit/'.$tabobj.'Test.php'; |
|
| 1416 | - $pathtosql = strtolower($module).'/sql/llx_'.strtolower($tabobj).'.sql'; |
|
| 1417 | - $pathtosqlextra = strtolower($module).'/sql/llx_'.strtolower($tabobj).'_extrafields.sql'; |
|
| 1418 | - $pathtosqlkey = strtolower($module).'/sql/llx_'.strtolower($tabobj).'.key.sql'; |
|
| 1419 | - $pathtolib = strtolower($module).'/lib/'.strtolower($tabobj).'.lib.php'; |
|
| 1420 | - $pathtopicto = strtolower($module).'/img/object_'.strtolower($tabobj).'.png'; |
|
| 1421 | - |
|
| 1422 | - $realpathtoclass = dol_buildpath($pathtoclass, 0, 1); |
|
| 1423 | - $realpathtoapi = dol_buildpath($pathtoapi, 0, 1); |
|
| 1424 | - $realpathtoagenda = dol_buildpath($pathtoagenda, 0, 1); |
|
| 1425 | - $realpathtocard = dol_buildpath($pathtocard, 0, 1); |
|
| 1426 | - $realpathtodocument = dol_buildpath($pathtodocument, 0, 1); |
|
| 1427 | - $realpathtolist = dol_buildpath($pathtolist, 0, 1); |
|
| 1428 | - $realpathtonote = dol_buildpath($pathtonote, 0, 1); |
|
| 1429 | - $realpathtophpunit = dol_buildpath($pathtophpunit, 0, 1); |
|
| 1430 | - $realpathtosql = dol_buildpath($pathtosql, 0, 1); |
|
| 1431 | - $realpathtosqlextra = dol_buildpath($pathtosqlextra, 0, 1); |
|
| 1432 | - $realpathtosqlkey = dol_buildpath($pathtosqlkey, 0, 1); |
|
| 1433 | - $realpathtolib = dol_buildpath($pathtolib, 0, 1); |
|
| 1434 | - $realpathtopicto = dol_buildpath($pathtopicto, 0, 1); |
|
| 1435 | - |
|
| 1436 | - print '<div class="fichehalfleft">'; |
|
| 1437 | - print '<span class="fa fa-file"></span> '.$langs->trans("ClassFile").' : <strong>'.($realpathtoclass?'':'<strike>').$pathtoclass.($realpathtoclass?'':'</strike>').'</strong>'; |
|
| 1438 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoclass).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1439 | - print '<br>'; |
|
| 1440 | - print '<span class="fa fa-file"></span> '.$langs->trans("ApiClassFile").' : <strong>'.($realpathtoapi?'':'<strike>').$pathtoapi.($realpathtoapi?'':'</strike>').'</strong>'; |
|
| 1441 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoapi).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1442 | - print ' <a href="'.DOL_URL_ROOT.'/api/index.php/explorer/" target="apiexplorer">'.$langs->trans("GoToApiExplorer").'</a>'; |
|
| 1443 | - print '<br>'; |
|
| 1444 | - print '<span class="fa fa-file"></span> '.$langs->trans("TestClassFile").' : <strong>'.($realpathtophpunit?'':'<strike>').$pathtophpunit.($realpathtophpunit?'':'</strike>').'</strong>'; |
|
| 1445 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtophpunit).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1446 | - print '<br>'; |
|
| 1447 | - |
|
| 1448 | - print '<br>'; |
|
| 1449 | - |
|
| 1450 | - print '<span class="fa fa-file"></span> '.$langs->trans("PageForLib").' : <strong>'.($realpathtolib?'':'<strike>').$pathtolib.($realpathtodocument?'':'</strike>').'</strong>'; |
|
| 1451 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtolib).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1452 | - print '<br>'; |
|
| 1453 | - print '<span class="fa fa-file"></span> '.$langs->trans("PageForPicto").' : <strong>'.($realpathtopicto?'':'<strike>').$pathtopicto.($realpathtopicto?'':'</strike>').'</strong>'; |
|
| 1454 | - //print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtopicto).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1455 | - print '<br>'; |
|
| 1456 | - |
|
| 1457 | - print '<br>'; |
|
| 1458 | - print '<span class="fa fa-file"></span> '.$langs->trans("SqlFile").' : <strong>'.($realpathtosql?'':'<strike>').$pathtosql.($realpathtosql?'':'</strike>').'</strong>'; |
|
| 1459 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=sql&file='.urlencode($pathtosql).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1460 | - print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("DropTableIfEmpty").'</a>'; |
|
| 1461 | - //print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>'; |
|
| 1462 | - print '<br>'; |
|
| 1463 | - print '<span class="fa fa-file"></span> '.$langs->trans("SqlFileExtraFields").' : <strong>'.($realpathtosqlextra?'':'<strike>').$pathtosqlextra.($realpathtosqlextra?'':'</strike>').'</strong>'; |
|
| 1464 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&file='.urlencode($pathtosqlextra).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1465 | - //print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>'; |
|
| 1466 | - print '<br>'; |
|
| 1467 | - print '<span class="fa fa-file"></span> '.$langs->trans("SqlFileKey").' : <strong>'.($realpathtosqlkey?'':'<strike>').$pathtosqlkey.($realpathtosqlkey?'':'</strike>').'</strong>'; |
|
| 1468 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=sql&file='.urlencode($pathtosqlkey).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1469 | - //print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>'; |
|
| 1470 | - print '<br>'; |
|
| 1471 | - |
|
| 1472 | - print '<br>'; |
|
| 1473 | - print '</div>'; |
|
| 1474 | - |
|
| 1475 | - $urloflist = dol_buildpath($pathtolist, 1); |
|
| 1476 | - $urlofcard = dol_buildpath($pathtocard, 1); |
|
| 1477 | - |
|
| 1478 | - print '<div class="fichehalfleft">'; |
|
| 1479 | - print '<span class="fa fa-file"></span> '.$langs->trans("PageForList").' : <strong><a href="'.$urloflist.'" target="_test">'.($realpathtosql?'':'<strike>').$pathtolist.($realpathtosql?'':'</strike>').'</a></strong>'; |
|
| 1480 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtolist).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1481 | - print '<br>'; |
|
| 1482 | - print '<span class="fa fa-file"></span> '.$langs->trans("PageForCreateEditView").' : <strong><a href="'.$urlofcard.'?action=create" target="_test">'.($realpathtocard?'':'<strike>').$pathtocard.($realpathtocard?'':'</strike>').'?action=create</a></strong>'; |
|
| 1483 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtocard).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1484 | - print '<br>'; |
|
| 1485 | - print '<span class="fa fa-file"></span> '.$langs->trans("PageForAgendaTab").' : <strong>'.($realpathtoagenda?'':'<strike>').$pathtoagenda.($realpathtoagenda?'':'</strike>').'</strong>'; |
|
| 1486 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoagenda).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1487 | - print '<br>'; |
|
| 1488 | - print '<span class="fa fa-file"></span> '.$langs->trans("PageForDocumentTab").' : <strong>'.($realpathtodocument?'':'<strike>').$pathtodocument.($realpathtodocument?'':'</strike>').'</strong>'; |
|
| 1489 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtodocument).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1490 | - print '<br>'; |
|
| 1491 | - print '<span class="fa fa-file"></span> '.$langs->trans("PageForNoteTab").' : <strong>'.($realpathtonote?'':'<strike>').$pathtonote.($realpathtonote?'':'</strike>').'</strong>'; |
|
| 1492 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtonote).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1493 | - print '<br>'; |
|
| 1494 | - |
|
| 1495 | - print '<br>'; |
|
| 1496 | - |
|
| 1497 | - print '</div>'; |
|
| 1498 | - |
|
| 1499 | - print '<br><br><br>'; |
|
| 1500 | - |
|
| 1501 | - if (empty($forceddirread)) |
|
| 1502 | - { |
|
| 1503 | - $result = dol_include_once($pathtoclass); |
|
| 1504 | - } |
|
| 1505 | - else |
|
| 1506 | - { |
|
| 1507 | - $result = @include_once($dirread.'/'.$pathtoclass); |
|
| 1508 | - } |
|
| 1509 | - if (class_exists($tabobj)) |
|
| 1510 | - { |
|
| 1511 | - try { |
|
| 1512 | - $tmpobjet = @new $tabobj($db); |
|
| 1513 | - } |
|
| 1514 | - catch(Exception $e) |
|
| 1515 | - { |
|
| 1516 | - dol_syslog('Failed to load Constructor of class: '.$e->getMessage(), LOG_WARNING); |
|
| 1517 | - } |
|
| 1518 | - } |
|
| 1519 | - |
|
| 1520 | - if (! empty($tmpobjet)) |
|
| 1521 | - { |
|
| 1522 | - $reflector = new ReflectionClass($tabobj); |
|
| 1523 | - $properties = $reflector->getProperties(); // Can also use get_object_vars |
|
| 1524 | - $propdefault = $reflector->getDefaultProperties(); // Can also use get_object_vars |
|
| 1525 | - //$propstat = $reflector->getStaticProperties(); |
|
| 1526 | - |
|
| 1527 | - print load_fiche_titre($langs->trans("Properties"), '', ''); |
|
| 1528 | - |
|
| 1529 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1530 | - |
|
| 1531 | - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1532 | - print '<input type="hidden" name="action" value="addproperty">'; |
|
| 1533 | - print '<input type="hidden" name="tab" value="objects">'; |
|
| 1534 | - print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module.($forceddirread?'@'.$dirread:'')).'">'; |
|
| 1535 | - print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">'; |
|
| 1536 | - |
|
| 1537 | - print '<div class="div-table-responsive">'; |
|
| 1538 | - print '<table class="noborder">'; |
|
| 1539 | - print '<tr class="liste_titre">'; |
|
| 1540 | - print '<td>'.$langs->trans("Property"); |
|
| 1541 | - print ' (<a href="https://wiki.dolibarr.org/index.php/Language_and_development_rules#Table_and_fields_structures" target="_blank">'.$langs->trans("Example").'</a>)'; |
|
| 1542 | - print '</td>'; |
|
| 1543 | - print '<td>'; |
|
| 1544 | - print $form->textwithpicto($langs->trans("Label"), $langs->trans("YouCanUseTranslationKey")); |
|
| 1545 | - print '</td>'; |
|
| 1546 | - print '<td>'.$langs->trans("Type").'</td>'; |
|
| 1547 | - print '<td>'.$form->textwithpicto($langs->trans("ArrayOfKeyValues"), $langs->trans("ArrayOfKeyValuesDesc")).'</td>'; |
|
| 1548 | - print '<td class="center">'.$langs->trans("NotNull").'</td>'; |
|
| 1549 | - //print '<td>'.$langs->trans("DefaultValue").'</td>'; |
|
| 1550 | - print '<td class="center">'.$langs->trans("DatabaseIndex").'</td>'; |
|
| 1551 | - print '<td class="right">'.$langs->trans("Position").'</td>'; |
|
| 1552 | - print '<td class="center">'.$form->textwithpicto($langs->trans("Enabled"), $langs->trans("EnabledDesc")).'</td>'; |
|
| 1553 | - print '<td class="center">'.$form->textwithpicto($langs->trans("Visible"), $langs->trans("VisibleDesc")).'</td>'; |
|
| 1554 | - print '<td class="center">'.$form->textwithpicto($langs->trans("IsAMeasure"), $langs->trans("IsAMeasureDesc")).'</td>'; |
|
| 1555 | - print '<td class="center">'.$form->textwithpicto($langs->trans("SearchAll"), $langs->trans("SearchAllDesc")).'</td>'; |
|
| 1556 | - print '<td>'.$langs->trans("Comment").'</td>'; |
|
| 1557 | - print '<td></td>'; |
|
| 1558 | - print '</tr>'; |
|
| 1559 | - |
|
| 1560 | - $properties = dol_sort_array($tmpobjet->fields, 'position'); |
|
| 1561 | - |
|
| 1562 | - if (! empty($properties)) |
|
| 1563 | - { |
|
| 1564 | - // Line to add a property |
|
| 1565 | - print '<tr>'; |
|
| 1566 | - print '<td><input class="text" name="propname" value="'.dol_escape_htmltag(GETPOST('propname','alpha')).'"></td>'; |
|
| 1567 | - print '<td><input class="text" name="proplabel" value="'.dol_escape_htmltag(GETPOST('proplabel','alpha')).'"></td>'; |
|
| 1568 | - print '<td><input class="text" name="proptype" value="'.dol_escape_htmltag(GETPOST('proptype','alpha')).'"></td>'; |
|
| 1569 | - print '<td><input class="text" name="proparrayofkeyval" value="'.dol_escape_htmltag(GETPOST('proparrayofkeyval','none')).'"></td>'; |
|
| 1570 | - print '<td class="center"><input class="text" size="2" name="propnotnull" value="'.dol_escape_htmltag(GETPOST('propnotnull','alpha')).'"></td>'; |
|
| 1571 | - //print '<td><input class="text" name="propdefault" value=""></td>'; |
|
| 1572 | - print '<td class="center"><input class="text" size="2" name="propindex" value="'.dol_escape_htmltag(GETPOST('propindex','alpha')).'"></td>'; |
|
| 1573 | - print '<td class="right"><input class="text right" size="2" name="propposition" value="'.dol_escape_htmltag(GETPOST('propposition','alpha')).'"></td>'; |
|
| 1574 | - print '<td class="center"><input class="text" size="2" name="propenabled" value="'.dol_escape_htmltag(GETPOST('propenabled','alpha')).'"></td>'; |
|
| 1575 | - print '<td class="center"><input class="text" size="2" name="propvisible" value="'.dol_escape_htmltag(GETPOST('propvisible','alpha')).'"></td>'; |
|
| 1576 | - print '<td class="center"><input class="text" size="2" name="propisameasure" value="'.dol_escape_htmltag(GETPOST('propisameasure','alpha')).'"></td>'; |
|
| 1577 | - print '<td class="center"><input class="text" size="2" name="propsearchall" value="'.dol_escape_htmltag(GETPOST('propsearchall','alpha')).'"></td>'; |
|
| 1578 | - print '<td><input class="text" name="propcomment" value="'.dol_escape_htmltag(GETPOST('propcomment','alpha')).'"></td>'; |
|
| 1579 | - print '<td align="center">'; |
|
| 1580 | - print '<input class="button" type="submit" name="add" value="'.$langs->trans("Add").'">'; |
|
| 1581 | - print '</td></tr>'; |
|
| 1582 | - |
|
| 1583 | - foreach($properties as $propkey => $propval) |
|
| 1584 | - { |
|
| 1585 | - /* If from Reflection |
|
| 1229 | + // New module |
|
| 1230 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1231 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1232 | + print '<input type="hidden" name="action" value="savefile">'; |
|
| 1233 | + print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 1234 | + print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 1235 | + print '<input type="hidden" name="module" value="'.$module.'">'; |
|
| 1236 | + |
|
| 1237 | + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 1238 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 1239 | + print '<br>'; |
|
| 1240 | + print '<center>'; |
|
| 1241 | + print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
|
| 1242 | + print ' '; |
|
| 1243 | + print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; |
|
| 1244 | + print '</center>'; |
|
| 1245 | + |
|
| 1246 | + print '</form>'; |
|
| 1247 | + } |
|
| 1248 | + } |
|
| 1249 | + |
|
| 1250 | + if ($tab == 'languages') |
|
| 1251 | + { |
|
| 1252 | + if ($action != 'editfile' || empty($file)) |
|
| 1253 | + { |
|
| 1254 | + print $langs->trans("LanguageDefDesc").'<br>'; |
|
| 1255 | + print '<br>'; |
|
| 1256 | + |
|
| 1257 | + |
|
| 1258 | + print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
|
| 1259 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1260 | + print '<input type="hidden" name="action" value="addlanguage">'; |
|
| 1261 | + print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 1262 | + print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 1263 | + print '<input type="hidden" name="module" value="'.$module.'">'; |
|
| 1264 | + print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300', 1); |
|
| 1265 | + print '<input type="submit" name="addlanguage" class="button" value="'.dol_escape_htmltag($langs->trans("AddLanguageFile")).'"><br>'; |
|
| 1266 | + print '</form>'; |
|
| 1267 | + |
|
| 1268 | + print '<br>'; |
|
| 1269 | + print '<br>'; |
|
| 1270 | + |
|
| 1271 | + $langfiles=dol_dir_list(dol_buildpath($modulelowercase.'/langs', 0), 'files', 1, '\.lang$'); |
|
| 1272 | + |
|
| 1273 | + foreach ($langfiles as $langfile) |
|
| 1274 | + { |
|
| 1275 | + $pathtofile = $modulelowercase.'/langs/'.$langfile['relativename']; |
|
| 1276 | + print '<span class="fa fa-file"></span> '.$langs->trans("LanguageFile").' '.basename(dirname($pathtofile)).' : <strong>'.$pathtofile.'</strong>'; |
|
| 1277 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format='.$format.'&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1278 | + print '<br>'; |
|
| 1279 | + } |
|
| 1280 | + } |
|
| 1281 | + else |
|
| 1282 | + { |
|
| 1283 | + // Edit text language file |
|
| 1284 | + |
|
| 1285 | + //print $langs->trans("UseAsciiDocFormat").'<br>'; |
|
| 1286 | + |
|
| 1287 | + $fullpathoffile=dol_buildpath($file, 0); |
|
| 1288 | + |
|
| 1289 | + $content = file_get_contents($fullpathoffile); |
|
| 1290 | + |
|
| 1291 | + // New module |
|
| 1292 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1293 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1294 | + print '<input type="hidden" name="action" value="savefile">'; |
|
| 1295 | + print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 1296 | + print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 1297 | + print '<input type="hidden" name="module" value="'.$module.'">'; |
|
| 1298 | + |
|
| 1299 | + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 1300 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'text')); |
|
| 1301 | + print '<br>'; |
|
| 1302 | + print '<center>'; |
|
| 1303 | + print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
|
| 1304 | + print ' '; |
|
| 1305 | + print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; |
|
| 1306 | + print '</center>'; |
|
| 1307 | + |
|
| 1308 | + print '</form>'; |
|
| 1309 | + } |
|
| 1310 | + } |
|
| 1311 | + |
|
| 1312 | + if ($tab == 'objects') |
|
| 1313 | + { |
|
| 1314 | + $head3 = array(); |
|
| 1315 | + $h=0; |
|
| 1316 | + |
|
| 1317 | + // Dir for module |
|
| 1318 | + $dir = $dirread.'/'.$modulelowercase.'/class'; |
|
| 1319 | + |
|
| 1320 | + $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj=newobject'; |
|
| 1321 | + $head3[$h][1] = $langs->trans("NewObject"); |
|
| 1322 | + $head3[$h][2] = 'newobject'; |
|
| 1323 | + $h++; |
|
| 1324 | + |
|
| 1325 | + // Scan for object class files |
|
| 1326 | + $listofobject = dol_dir_list($dir, 'files', 0, '\.class\.php$'); |
|
| 1327 | + |
|
| 1328 | + $firstobjectname=''; |
|
| 1329 | + foreach($listofobject as $fileobj) |
|
| 1330 | + { |
|
| 1331 | + if (preg_match('/^api_/',$fileobj['name'])) continue; |
|
| 1332 | + if (preg_match('/^actions_/',$fileobj['name'])) continue; |
|
| 1333 | + |
|
| 1334 | + $tmpcontent=file_get_contents($fileobj['fullname']); |
|
| 1335 | + if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims',$tmpcontent,$reg)) |
|
| 1336 | + { |
|
| 1337 | + //$objectname = preg_replace('/\.txt$/', '', $fileobj['name']); |
|
| 1338 | + $objectname = $reg[1]; |
|
| 1339 | + if (empty($firstobjectname)) $firstobjectname = $objectname; |
|
| 1340 | + |
|
| 1341 | + $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj='.$objectname; |
|
| 1342 | + $head3[$h][1] = $objectname; |
|
| 1343 | + $head3[$h][2] = $objectname; |
|
| 1344 | + $h++; |
|
| 1345 | + } |
|
| 1346 | + } |
|
| 1347 | + |
|
| 1348 | + $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj=deleteobject'; |
|
| 1349 | + $head3[$h][1] = $langs->trans("DangerZone"); |
|
| 1350 | + $head3[$h][2] = 'deleteobject'; |
|
| 1351 | + $h++; |
|
| 1352 | + |
|
| 1353 | + // If tabobj was not defined, then we check if there is one obj. If yes, we force on it, if no, we will show tab to create new objects. |
|
| 1354 | + if ($tabobj == 'newobjectifnoobj') |
|
| 1355 | + { |
|
| 1356 | + if ($firstobjectname) $tabobj=$firstobjectname; |
|
| 1357 | + else $tabobj = 'newobject'; |
|
| 1358 | + } |
|
| 1359 | + |
|
| 1360 | + dol_fiche_head($head3, $tabobj, '', -1, ''); // Level 3 |
|
| 1361 | + |
|
| 1362 | + if ($tabobj == 'newobject') |
|
| 1363 | + { |
|
| 1364 | + // New object tab |
|
| 1365 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1366 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1367 | + print '<input type="hidden" name="action" value="initobject">'; |
|
| 1368 | + print '<input type="hidden" name="tab" value="objects">'; |
|
| 1369 | + print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">'; |
|
| 1370 | + |
|
| 1371 | + print $langs->trans("EnterNameOfObjectDesc").'<br><br>'; |
|
| 1372 | + |
|
| 1373 | + print '<input type="text" name="objectname" value="'.dol_escape_htmltag($modulename).'" placeholder="'.dol_escape_htmltag($langs->trans("ObjectKey")).'">'; |
|
| 1374 | + print '<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans("Create")).'"'.($dirins?'':' disabled="disabled"').'>'; |
|
| 1375 | + print '</form>'; |
|
| 1376 | + } |
|
| 1377 | + elseif ($tabobj == 'deleteobject') |
|
| 1378 | + { |
|
| 1379 | + // Delete object tab |
|
| 1380 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1381 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1382 | + print '<input type="hidden" name="action" value="confirm_deleteobject">'; |
|
| 1383 | + print '<input type="hidden" name="tab" value="objects">'; |
|
| 1384 | + print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">'; |
|
| 1385 | + |
|
| 1386 | + print $langs->trans("EnterNameOfObjectToDeleteDesc").'<br><br>'; |
|
| 1387 | + |
|
| 1388 | + print '<input type="text" name="objectname" value="'.dol_escape_htmltag($modulename).'" placeholder="'.dol_escape_htmltag($langs->trans("ObjectKey")).'">'; |
|
| 1389 | + print '<input type="submit" class="buttonDelete" name="delete" value="'.dol_escape_htmltag($langs->trans("Delete")).'"'.($dirins?'':' disabled="disabled"').'>'; |
|
| 1390 | + print '</form>'; |
|
| 1391 | + } |
|
| 1392 | + else |
|
| 1393 | + { // tabobj = module |
|
| 1394 | + if ($action == 'deleteproperty') |
|
| 1395 | + { |
|
| 1396 | + $formconfirm = $form->formconfirm( |
|
| 1397 | + $_SERVER["PHP_SELF"].'?propertykey='.urlencode(GETPOST('propertykey','alpha')).'&objectname='.urlencode($objectname).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj), |
|
| 1398 | + $langs->trans('Delete'), $langs->trans('ConfirmDeleteProperty', GETPOST('propertykey','alpha')), 'confirm_deleteproperty', '', 0, 1 |
|
| 1399 | + ); |
|
| 1400 | + |
|
| 1401 | + // Print form confirm |
|
| 1402 | + print $formconfirm; |
|
| 1403 | + } |
|
| 1404 | + |
|
| 1405 | + if ($action != 'editfile' || empty($file)) |
|
| 1406 | + { |
|
| 1407 | + try { |
|
| 1408 | + $pathtoclass = strtolower($module).'/class/'.strtolower($tabobj).'.class.php'; |
|
| 1409 | + $pathtoapi = strtolower($module).'/class/api_'.strtolower($tabobj).'.class.php'; |
|
| 1410 | + $pathtoagenda = strtolower($module).'/'.strtolower($tabobj).'_agenda.php'; |
|
| 1411 | + $pathtocard = strtolower($module).'/'.strtolower($tabobj).'_card.php'; |
|
| 1412 | + $pathtodocument = strtolower($module).'/'.strtolower($tabobj).'_document.php'; |
|
| 1413 | + $pathtolist = strtolower($module).'/'.strtolower($tabobj).'_list.php'; |
|
| 1414 | + $pathtonote = strtolower($module).'/'.strtolower($tabobj).'_note.php'; |
|
| 1415 | + $pathtophpunit = strtolower($module).'/test/phpunit/'.$tabobj.'Test.php'; |
|
| 1416 | + $pathtosql = strtolower($module).'/sql/llx_'.strtolower($tabobj).'.sql'; |
|
| 1417 | + $pathtosqlextra = strtolower($module).'/sql/llx_'.strtolower($tabobj).'_extrafields.sql'; |
|
| 1418 | + $pathtosqlkey = strtolower($module).'/sql/llx_'.strtolower($tabobj).'.key.sql'; |
|
| 1419 | + $pathtolib = strtolower($module).'/lib/'.strtolower($tabobj).'.lib.php'; |
|
| 1420 | + $pathtopicto = strtolower($module).'/img/object_'.strtolower($tabobj).'.png'; |
|
| 1421 | + |
|
| 1422 | + $realpathtoclass = dol_buildpath($pathtoclass, 0, 1); |
|
| 1423 | + $realpathtoapi = dol_buildpath($pathtoapi, 0, 1); |
|
| 1424 | + $realpathtoagenda = dol_buildpath($pathtoagenda, 0, 1); |
|
| 1425 | + $realpathtocard = dol_buildpath($pathtocard, 0, 1); |
|
| 1426 | + $realpathtodocument = dol_buildpath($pathtodocument, 0, 1); |
|
| 1427 | + $realpathtolist = dol_buildpath($pathtolist, 0, 1); |
|
| 1428 | + $realpathtonote = dol_buildpath($pathtonote, 0, 1); |
|
| 1429 | + $realpathtophpunit = dol_buildpath($pathtophpunit, 0, 1); |
|
| 1430 | + $realpathtosql = dol_buildpath($pathtosql, 0, 1); |
|
| 1431 | + $realpathtosqlextra = dol_buildpath($pathtosqlextra, 0, 1); |
|
| 1432 | + $realpathtosqlkey = dol_buildpath($pathtosqlkey, 0, 1); |
|
| 1433 | + $realpathtolib = dol_buildpath($pathtolib, 0, 1); |
|
| 1434 | + $realpathtopicto = dol_buildpath($pathtopicto, 0, 1); |
|
| 1435 | + |
|
| 1436 | + print '<div class="fichehalfleft">'; |
|
| 1437 | + print '<span class="fa fa-file"></span> '.$langs->trans("ClassFile").' : <strong>'.($realpathtoclass?'':'<strike>').$pathtoclass.($realpathtoclass?'':'</strike>').'</strong>'; |
|
| 1438 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoclass).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1439 | + print '<br>'; |
|
| 1440 | + print '<span class="fa fa-file"></span> '.$langs->trans("ApiClassFile").' : <strong>'.($realpathtoapi?'':'<strike>').$pathtoapi.($realpathtoapi?'':'</strike>').'</strong>'; |
|
| 1441 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoapi).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1442 | + print ' <a href="'.DOL_URL_ROOT.'/api/index.php/explorer/" target="apiexplorer">'.$langs->trans("GoToApiExplorer").'</a>'; |
|
| 1443 | + print '<br>'; |
|
| 1444 | + print '<span class="fa fa-file"></span> '.$langs->trans("TestClassFile").' : <strong>'.($realpathtophpunit?'':'<strike>').$pathtophpunit.($realpathtophpunit?'':'</strike>').'</strong>'; |
|
| 1445 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtophpunit).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1446 | + print '<br>'; |
|
| 1447 | + |
|
| 1448 | + print '<br>'; |
|
| 1449 | + |
|
| 1450 | + print '<span class="fa fa-file"></span> '.$langs->trans("PageForLib").' : <strong>'.($realpathtolib?'':'<strike>').$pathtolib.($realpathtodocument?'':'</strike>').'</strong>'; |
|
| 1451 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtolib).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1452 | + print '<br>'; |
|
| 1453 | + print '<span class="fa fa-file"></span> '.$langs->trans("PageForPicto").' : <strong>'.($realpathtopicto?'':'<strike>').$pathtopicto.($realpathtopicto?'':'</strike>').'</strong>'; |
|
| 1454 | + //print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtopicto).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1455 | + print '<br>'; |
|
| 1456 | + |
|
| 1457 | + print '<br>'; |
|
| 1458 | + print '<span class="fa fa-file"></span> '.$langs->trans("SqlFile").' : <strong>'.($realpathtosql?'':'<strike>').$pathtosql.($realpathtosql?'':'</strike>').'</strong>'; |
|
| 1459 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=sql&file='.urlencode($pathtosql).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1460 | + print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("DropTableIfEmpty").'</a>'; |
|
| 1461 | + //print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>'; |
|
| 1462 | + print '<br>'; |
|
| 1463 | + print '<span class="fa fa-file"></span> '.$langs->trans("SqlFileExtraFields").' : <strong>'.($realpathtosqlextra?'':'<strike>').$pathtosqlextra.($realpathtosqlextra?'':'</strike>').'</strong>'; |
|
| 1464 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&file='.urlencode($pathtosqlextra).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1465 | + //print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>'; |
|
| 1466 | + print '<br>'; |
|
| 1467 | + print '<span class="fa fa-file"></span> '.$langs->trans("SqlFileKey").' : <strong>'.($realpathtosqlkey?'':'<strike>').$pathtosqlkey.($realpathtosqlkey?'':'</strike>').'</strong>'; |
|
| 1468 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=sql&file='.urlencode($pathtosqlkey).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1469 | + //print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>'; |
|
| 1470 | + print '<br>'; |
|
| 1471 | + |
|
| 1472 | + print '<br>'; |
|
| 1473 | + print '</div>'; |
|
| 1474 | + |
|
| 1475 | + $urloflist = dol_buildpath($pathtolist, 1); |
|
| 1476 | + $urlofcard = dol_buildpath($pathtocard, 1); |
|
| 1477 | + |
|
| 1478 | + print '<div class="fichehalfleft">'; |
|
| 1479 | + print '<span class="fa fa-file"></span> '.$langs->trans("PageForList").' : <strong><a href="'.$urloflist.'" target="_test">'.($realpathtosql?'':'<strike>').$pathtolist.($realpathtosql?'':'</strike>').'</a></strong>'; |
|
| 1480 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtolist).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1481 | + print '<br>'; |
|
| 1482 | + print '<span class="fa fa-file"></span> '.$langs->trans("PageForCreateEditView").' : <strong><a href="'.$urlofcard.'?action=create" target="_test">'.($realpathtocard?'':'<strike>').$pathtocard.($realpathtocard?'':'</strike>').'?action=create</a></strong>'; |
|
| 1483 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtocard).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1484 | + print '<br>'; |
|
| 1485 | + print '<span class="fa fa-file"></span> '.$langs->trans("PageForAgendaTab").' : <strong>'.($realpathtoagenda?'':'<strike>').$pathtoagenda.($realpathtoagenda?'':'</strike>').'</strong>'; |
|
| 1486 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoagenda).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1487 | + print '<br>'; |
|
| 1488 | + print '<span class="fa fa-file"></span> '.$langs->trans("PageForDocumentTab").' : <strong>'.($realpathtodocument?'':'<strike>').$pathtodocument.($realpathtodocument?'':'</strike>').'</strong>'; |
|
| 1489 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtodocument).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1490 | + print '<br>'; |
|
| 1491 | + print '<span class="fa fa-file"></span> '.$langs->trans("PageForNoteTab").' : <strong>'.($realpathtonote?'':'<strike>').$pathtonote.($realpathtonote?'':'</strike>').'</strong>'; |
|
| 1492 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtonote).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1493 | + print '<br>'; |
|
| 1494 | + |
|
| 1495 | + print '<br>'; |
|
| 1496 | + |
|
| 1497 | + print '</div>'; |
|
| 1498 | + |
|
| 1499 | + print '<br><br><br>'; |
|
| 1500 | + |
|
| 1501 | + if (empty($forceddirread)) |
|
| 1502 | + { |
|
| 1503 | + $result = dol_include_once($pathtoclass); |
|
| 1504 | + } |
|
| 1505 | + else |
|
| 1506 | + { |
|
| 1507 | + $result = @include_once($dirread.'/'.$pathtoclass); |
|
| 1508 | + } |
|
| 1509 | + if (class_exists($tabobj)) |
|
| 1510 | + { |
|
| 1511 | + try { |
|
| 1512 | + $tmpobjet = @new $tabobj($db); |
|
| 1513 | + } |
|
| 1514 | + catch(Exception $e) |
|
| 1515 | + { |
|
| 1516 | + dol_syslog('Failed to load Constructor of class: '.$e->getMessage(), LOG_WARNING); |
|
| 1517 | + } |
|
| 1518 | + } |
|
| 1519 | + |
|
| 1520 | + if (! empty($tmpobjet)) |
|
| 1521 | + { |
|
| 1522 | + $reflector = new ReflectionClass($tabobj); |
|
| 1523 | + $properties = $reflector->getProperties(); // Can also use get_object_vars |
|
| 1524 | + $propdefault = $reflector->getDefaultProperties(); // Can also use get_object_vars |
|
| 1525 | + //$propstat = $reflector->getStaticProperties(); |
|
| 1526 | + |
|
| 1527 | + print load_fiche_titre($langs->trans("Properties"), '', ''); |
|
| 1528 | + |
|
| 1529 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1530 | + |
|
| 1531 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1532 | + print '<input type="hidden" name="action" value="addproperty">'; |
|
| 1533 | + print '<input type="hidden" name="tab" value="objects">'; |
|
| 1534 | + print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module.($forceddirread?'@'.$dirread:'')).'">'; |
|
| 1535 | + print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">'; |
|
| 1536 | + |
|
| 1537 | + print '<div class="div-table-responsive">'; |
|
| 1538 | + print '<table class="noborder">'; |
|
| 1539 | + print '<tr class="liste_titre">'; |
|
| 1540 | + print '<td>'.$langs->trans("Property"); |
|
| 1541 | + print ' (<a href="https://wiki.dolibarr.org/index.php/Language_and_development_rules#Table_and_fields_structures" target="_blank">'.$langs->trans("Example").'</a>)'; |
|
| 1542 | + print '</td>'; |
|
| 1543 | + print '<td>'; |
|
| 1544 | + print $form->textwithpicto($langs->trans("Label"), $langs->trans("YouCanUseTranslationKey")); |
|
| 1545 | + print '</td>'; |
|
| 1546 | + print '<td>'.$langs->trans("Type").'</td>'; |
|
| 1547 | + print '<td>'.$form->textwithpicto($langs->trans("ArrayOfKeyValues"), $langs->trans("ArrayOfKeyValuesDesc")).'</td>'; |
|
| 1548 | + print '<td class="center">'.$langs->trans("NotNull").'</td>'; |
|
| 1549 | + //print '<td>'.$langs->trans("DefaultValue").'</td>'; |
|
| 1550 | + print '<td class="center">'.$langs->trans("DatabaseIndex").'</td>'; |
|
| 1551 | + print '<td class="right">'.$langs->trans("Position").'</td>'; |
|
| 1552 | + print '<td class="center">'.$form->textwithpicto($langs->trans("Enabled"), $langs->trans("EnabledDesc")).'</td>'; |
|
| 1553 | + print '<td class="center">'.$form->textwithpicto($langs->trans("Visible"), $langs->trans("VisibleDesc")).'</td>'; |
|
| 1554 | + print '<td class="center">'.$form->textwithpicto($langs->trans("IsAMeasure"), $langs->trans("IsAMeasureDesc")).'</td>'; |
|
| 1555 | + print '<td class="center">'.$form->textwithpicto($langs->trans("SearchAll"), $langs->trans("SearchAllDesc")).'</td>'; |
|
| 1556 | + print '<td>'.$langs->trans("Comment").'</td>'; |
|
| 1557 | + print '<td></td>'; |
|
| 1558 | + print '</tr>'; |
|
| 1559 | + |
|
| 1560 | + $properties = dol_sort_array($tmpobjet->fields, 'position'); |
|
| 1561 | + |
|
| 1562 | + if (! empty($properties)) |
|
| 1563 | + { |
|
| 1564 | + // Line to add a property |
|
| 1565 | + print '<tr>'; |
|
| 1566 | + print '<td><input class="text" name="propname" value="'.dol_escape_htmltag(GETPOST('propname','alpha')).'"></td>'; |
|
| 1567 | + print '<td><input class="text" name="proplabel" value="'.dol_escape_htmltag(GETPOST('proplabel','alpha')).'"></td>'; |
|
| 1568 | + print '<td><input class="text" name="proptype" value="'.dol_escape_htmltag(GETPOST('proptype','alpha')).'"></td>'; |
|
| 1569 | + print '<td><input class="text" name="proparrayofkeyval" value="'.dol_escape_htmltag(GETPOST('proparrayofkeyval','none')).'"></td>'; |
|
| 1570 | + print '<td class="center"><input class="text" size="2" name="propnotnull" value="'.dol_escape_htmltag(GETPOST('propnotnull','alpha')).'"></td>'; |
|
| 1571 | + //print '<td><input class="text" name="propdefault" value=""></td>'; |
|
| 1572 | + print '<td class="center"><input class="text" size="2" name="propindex" value="'.dol_escape_htmltag(GETPOST('propindex','alpha')).'"></td>'; |
|
| 1573 | + print '<td class="right"><input class="text right" size="2" name="propposition" value="'.dol_escape_htmltag(GETPOST('propposition','alpha')).'"></td>'; |
|
| 1574 | + print '<td class="center"><input class="text" size="2" name="propenabled" value="'.dol_escape_htmltag(GETPOST('propenabled','alpha')).'"></td>'; |
|
| 1575 | + print '<td class="center"><input class="text" size="2" name="propvisible" value="'.dol_escape_htmltag(GETPOST('propvisible','alpha')).'"></td>'; |
|
| 1576 | + print '<td class="center"><input class="text" size="2" name="propisameasure" value="'.dol_escape_htmltag(GETPOST('propisameasure','alpha')).'"></td>'; |
|
| 1577 | + print '<td class="center"><input class="text" size="2" name="propsearchall" value="'.dol_escape_htmltag(GETPOST('propsearchall','alpha')).'"></td>'; |
|
| 1578 | + print '<td><input class="text" name="propcomment" value="'.dol_escape_htmltag(GETPOST('propcomment','alpha')).'"></td>'; |
|
| 1579 | + print '<td align="center">'; |
|
| 1580 | + print '<input class="button" type="submit" name="add" value="'.$langs->trans("Add").'">'; |
|
| 1581 | + print '</td></tr>'; |
|
| 1582 | + |
|
| 1583 | + foreach($properties as $propkey => $propval) |
|
| 1584 | + { |
|
| 1585 | + /* If from Reflection |
|
| 1586 | 1586 | if ($propval->class == $tabobj) |
| 1587 | 1587 | { |
| 1588 | 1588 | $propname=$propval->getName(); |
@@ -1596,154 +1596,154 @@ discard block |
||
| 1596 | 1596 | if (in_array($propname, array('fk_element', 'lines'))) continue; |
| 1597 | 1597 | }*/ |
| 1598 | 1598 | |
| 1599 | - $propname=$propkey; |
|
| 1600 | - $proplabel=$propval['label']; |
|
| 1601 | - $proptype=$propval['type']; |
|
| 1602 | - $proparrayofkeyval=$propval['arrayofkeyval']; |
|
| 1603 | - $propnotnull=$propval['notnull']; |
|
| 1604 | - $propsearchall=$propval['searchall']; |
|
| 1605 | - //$propdefault=$propval['default']; |
|
| 1606 | - $propindex=$propval['index']; |
|
| 1607 | - $propposition=$propval['position']; |
|
| 1608 | - $propenabled=$propval['enabled']; |
|
| 1609 | - $propvisible=$propval['visible']; |
|
| 1610 | - $propisameasure=$propval['isameasure']; |
|
| 1611 | - $propcomment=$propval['comment']; |
|
| 1612 | - |
|
| 1613 | - print '<tr class="oddeven">'; |
|
| 1614 | - |
|
| 1615 | - print '<td>'; |
|
| 1616 | - print $propname; |
|
| 1617 | - print '</td>'; |
|
| 1618 | - print '<td>'; |
|
| 1619 | - print $proplabel; |
|
| 1620 | - print '</td>'; |
|
| 1621 | - print '<td>'; |
|
| 1622 | - print $proptype; |
|
| 1623 | - print '</td>'; |
|
| 1624 | - print '<td>'; |
|
| 1625 | - if ($proparrayofkeyval) |
|
| 1626 | - { |
|
| 1627 | - print json_encode($proparrayofkeyval); |
|
| 1628 | - } |
|
| 1629 | - print '</td>'; |
|
| 1630 | - print '<td class="center">'; |
|
| 1631 | - print $propnotnull; |
|
| 1632 | - print '</td>'; |
|
| 1633 | - /*print '<td>'; |
|
| 1599 | + $propname=$propkey; |
|
| 1600 | + $proplabel=$propval['label']; |
|
| 1601 | + $proptype=$propval['type']; |
|
| 1602 | + $proparrayofkeyval=$propval['arrayofkeyval']; |
|
| 1603 | + $propnotnull=$propval['notnull']; |
|
| 1604 | + $propsearchall=$propval['searchall']; |
|
| 1605 | + //$propdefault=$propval['default']; |
|
| 1606 | + $propindex=$propval['index']; |
|
| 1607 | + $propposition=$propval['position']; |
|
| 1608 | + $propenabled=$propval['enabled']; |
|
| 1609 | + $propvisible=$propval['visible']; |
|
| 1610 | + $propisameasure=$propval['isameasure']; |
|
| 1611 | + $propcomment=$propval['comment']; |
|
| 1612 | + |
|
| 1613 | + print '<tr class="oddeven">'; |
|
| 1614 | + |
|
| 1615 | + print '<td>'; |
|
| 1616 | + print $propname; |
|
| 1617 | + print '</td>'; |
|
| 1618 | + print '<td>'; |
|
| 1619 | + print $proplabel; |
|
| 1620 | + print '</td>'; |
|
| 1621 | + print '<td>'; |
|
| 1622 | + print $proptype; |
|
| 1623 | + print '</td>'; |
|
| 1624 | + print '<td>'; |
|
| 1625 | + if ($proparrayofkeyval) |
|
| 1626 | + { |
|
| 1627 | + print json_encode($proparrayofkeyval); |
|
| 1628 | + } |
|
| 1629 | + print '</td>'; |
|
| 1630 | + print '<td class="center">'; |
|
| 1631 | + print $propnotnull; |
|
| 1632 | + print '</td>'; |
|
| 1633 | + /*print '<td>'; |
|
| 1634 | 1634 | print $propdefault; |
| 1635 | 1635 | print '</td>';*/ |
| 1636 | - print '<td class="center">'; |
|
| 1637 | - print $propindex?'X':''; |
|
| 1638 | - print '</td>'; |
|
| 1639 | - print '<td align="right">'; |
|
| 1640 | - print $propposition; |
|
| 1641 | - print '</td>'; |
|
| 1642 | - print '<td class="center">'; |
|
| 1643 | - print $propenabled?$propenabled:''; |
|
| 1644 | - print '</td>'; |
|
| 1645 | - print '<td class="center">'; |
|
| 1646 | - print $propvisible?$propvisible:''; |
|
| 1647 | - print '</td>'; |
|
| 1648 | - print '<td class="center">'; |
|
| 1649 | - print $propisameasure?$propisameasure:''; |
|
| 1650 | - print '</td>'; |
|
| 1651 | - print '<td class="center">'; |
|
| 1652 | - print $propsearchall?'X':''; |
|
| 1653 | - print '</td>'; |
|
| 1654 | - print '<td>'; |
|
| 1655 | - print $propcomment; |
|
| 1656 | - print '</td>'; |
|
| 1657 | - print '<td class="center">'; |
|
| 1658 | - print '<a href="'.$_SERVER["PHP_SELF"].'?action=deleteproperty&propertykey='.urlencode($propname).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj).'">'.img_delete().'</a>'; |
|
| 1659 | - print '</td>'; |
|
| 1660 | - |
|
| 1661 | - print '</tr>'; |
|
| 1662 | - } |
|
| 1663 | - } |
|
| 1664 | - else |
|
| 1665 | - { |
|
| 1666 | - print '<tr><td><span class="warning">'.$langs->trans('Property $field not found into the class. The class was probably not generated by modulebuilder.').'</warning></td></tr>'; |
|
| 1667 | - } |
|
| 1668 | - print '</table>'; |
|
| 1636 | + print '<td class="center">'; |
|
| 1637 | + print $propindex?'X':''; |
|
| 1638 | + print '</td>'; |
|
| 1639 | + print '<td align="right">'; |
|
| 1640 | + print $propposition; |
|
| 1641 | + print '</td>'; |
|
| 1642 | + print '<td class="center">'; |
|
| 1643 | + print $propenabled?$propenabled:''; |
|
| 1644 | + print '</td>'; |
|
| 1645 | + print '<td class="center">'; |
|
| 1646 | + print $propvisible?$propvisible:''; |
|
| 1647 | + print '</td>'; |
|
| 1648 | + print '<td class="center">'; |
|
| 1649 | + print $propisameasure?$propisameasure:''; |
|
| 1650 | + print '</td>'; |
|
| 1651 | + print '<td class="center">'; |
|
| 1652 | + print $propsearchall?'X':''; |
|
| 1653 | + print '</td>'; |
|
| 1654 | + print '<td>'; |
|
| 1655 | + print $propcomment; |
|
| 1656 | + print '</td>'; |
|
| 1657 | + print '<td class="center">'; |
|
| 1658 | + print '<a href="'.$_SERVER["PHP_SELF"].'?action=deleteproperty&propertykey='.urlencode($propname).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj).'">'.img_delete().'</a>'; |
|
| 1659 | + print '</td>'; |
|
| 1660 | + |
|
| 1661 | + print '</tr>'; |
|
| 1662 | + } |
|
| 1663 | + } |
|
| 1664 | + else |
|
| 1665 | + { |
|
| 1666 | + print '<tr><td><span class="warning">'.$langs->trans('Property $field not found into the class. The class was probably not generated by modulebuilder.').'</warning></td></tr>'; |
|
| 1667 | + } |
|
| 1668 | + print '</table>'; |
|
| 1669 | 1669 | print '</div>'; |
| 1670 | 1670 | |
| 1671 | - print '</form>'; |
|
| 1672 | - } |
|
| 1673 | - else |
|
| 1674 | - { |
|
| 1675 | - print '<tr><td><span class="warning">'.$langs->trans('Failed to init the object with the new.').'</warning></td></tr>'; |
|
| 1676 | - } |
|
| 1677 | - } |
|
| 1678 | - catch(Exception $e) |
|
| 1679 | - { |
|
| 1680 | - print $e->getMessage(); |
|
| 1681 | - } |
|
| 1682 | - } |
|
| 1683 | - else |
|
| 1684 | - { |
|
| 1685 | - if (empty($forceddirread)) |
|
| 1686 | - { |
|
| 1687 | - $fullpathoffile=dol_buildpath($file, 0); |
|
| 1688 | - } |
|
| 1689 | - else |
|
| 1690 | - { |
|
| 1691 | - $fullpathoffile=$dirread.'/'.$file; |
|
| 1692 | - } |
|
| 1693 | - |
|
| 1694 | - $content = file_get_contents($fullpathoffile); |
|
| 1695 | - |
|
| 1696 | - // New module |
|
| 1697 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1698 | - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1699 | - print '<input type="hidden" name="action" value="savefile">'; |
|
| 1700 | - print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 1701 | - print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 1702 | - print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">'; |
|
| 1703 | - print '<input type="hidden" name="module" value="'.$module.($forceddirread?'@'.$dirread:'').'">'; |
|
| 1704 | - |
|
| 1705 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 1706 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 1707 | - print '<br>'; |
|
| 1708 | - print '<center>'; |
|
| 1709 | - print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
|
| 1710 | - print ' '; |
|
| 1711 | - print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; |
|
| 1712 | - print '</center>'; |
|
| 1713 | - |
|
| 1714 | - print '</form>'; |
|
| 1715 | - } |
|
| 1716 | - } |
|
| 1717 | - |
|
| 1718 | - dol_fiche_end(); // Level 3 |
|
| 1719 | - } |
|
| 1720 | - |
|
| 1721 | - if ($tab == 'menus') |
|
| 1722 | - { |
|
| 1723 | - $pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php'; |
|
| 1724 | - |
|
| 1725 | - //$menus = $moduleobj->; |
|
| 1726 | - |
|
| 1727 | - if ($action != 'editfile' || empty($file)) |
|
| 1728 | - { |
|
| 1729 | - print $langs->trans("MenusDefDesc", '<a href="'.DOL_URL_ROOT.'/admin/menus/index.php">'.$langs->trans('Menus').'</a>').'<br>'; |
|
| 1730 | - print '<br>'; |
|
| 1731 | - |
|
| 1732 | - print '<span class="fa fa-file"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>'; |
|
| 1733 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1734 | - print '<br>'; |
|
| 1735 | - |
|
| 1736 | - print '<br>'; |
|
| 1737 | - //print load_fiche_titre($langs->trans("MenusList"), '', ''); |
|
| 1738 | - |
|
| 1739 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1740 | - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1741 | - print '<input type="hidden" name="action" value="addproperty">'; |
|
| 1742 | - print '<input type="hidden" name="tab" value="objects">'; |
|
| 1743 | - print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">'; |
|
| 1744 | - print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">'; |
|
| 1745 | - |
|
| 1746 | - /* |
|
| 1671 | + print '</form>'; |
|
| 1672 | + } |
|
| 1673 | + else |
|
| 1674 | + { |
|
| 1675 | + print '<tr><td><span class="warning">'.$langs->trans('Failed to init the object with the new.').'</warning></td></tr>'; |
|
| 1676 | + } |
|
| 1677 | + } |
|
| 1678 | + catch(Exception $e) |
|
| 1679 | + { |
|
| 1680 | + print $e->getMessage(); |
|
| 1681 | + } |
|
| 1682 | + } |
|
| 1683 | + else |
|
| 1684 | + { |
|
| 1685 | + if (empty($forceddirread)) |
|
| 1686 | + { |
|
| 1687 | + $fullpathoffile=dol_buildpath($file, 0); |
|
| 1688 | + } |
|
| 1689 | + else |
|
| 1690 | + { |
|
| 1691 | + $fullpathoffile=$dirread.'/'.$file; |
|
| 1692 | + } |
|
| 1693 | + |
|
| 1694 | + $content = file_get_contents($fullpathoffile); |
|
| 1695 | + |
|
| 1696 | + // New module |
|
| 1697 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1698 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1699 | + print '<input type="hidden" name="action" value="savefile">'; |
|
| 1700 | + print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 1701 | + print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 1702 | + print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">'; |
|
| 1703 | + print '<input type="hidden" name="module" value="'.$module.($forceddirread?'@'.$dirread:'').'">'; |
|
| 1704 | + |
|
| 1705 | + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 1706 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 1707 | + print '<br>'; |
|
| 1708 | + print '<center>'; |
|
| 1709 | + print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
|
| 1710 | + print ' '; |
|
| 1711 | + print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; |
|
| 1712 | + print '</center>'; |
|
| 1713 | + |
|
| 1714 | + print '</form>'; |
|
| 1715 | + } |
|
| 1716 | + } |
|
| 1717 | + |
|
| 1718 | + dol_fiche_end(); // Level 3 |
|
| 1719 | + } |
|
| 1720 | + |
|
| 1721 | + if ($tab == 'menus') |
|
| 1722 | + { |
|
| 1723 | + $pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php'; |
|
| 1724 | + |
|
| 1725 | + //$menus = $moduleobj->; |
|
| 1726 | + |
|
| 1727 | + if ($action != 'editfile' || empty($file)) |
|
| 1728 | + { |
|
| 1729 | + print $langs->trans("MenusDefDesc", '<a href="'.DOL_URL_ROOT.'/admin/menus/index.php">'.$langs->trans('Menus').'</a>').'<br>'; |
|
| 1730 | + print '<br>'; |
|
| 1731 | + |
|
| 1732 | + print '<span class="fa fa-file"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>'; |
|
| 1733 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1734 | + print '<br>'; |
|
| 1735 | + |
|
| 1736 | + print '<br>'; |
|
| 1737 | + //print load_fiche_titre($langs->trans("MenusList"), '', ''); |
|
| 1738 | + |
|
| 1739 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1740 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1741 | + print '<input type="hidden" name="action" value="addproperty">'; |
|
| 1742 | + print '<input type="hidden" name="tab" value="objects">'; |
|
| 1743 | + print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">'; |
|
| 1744 | + print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">'; |
|
| 1745 | + |
|
| 1746 | + /* |
|
| 1747 | 1747 | print '<div class="div-table-responsive">'; |
| 1748 | 1748 | print '<table class="noborder">'; |
| 1749 | 1749 | |
@@ -1814,58 +1814,58 @@ discard block |
||
| 1814 | 1814 | |
| 1815 | 1815 | print '</form>'; |
| 1816 | 1816 | */ |
| 1817 | - } |
|
| 1818 | - else |
|
| 1819 | - { |
|
| 1820 | - $fullpathoffile=dol_buildpath($file, 0); |
|
| 1821 | - |
|
| 1822 | - $content = file_get_contents($fullpathoffile); |
|
| 1823 | - |
|
| 1824 | - // New module |
|
| 1825 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1826 | - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1827 | - print '<input type="hidden" name="action" value="savefile">'; |
|
| 1828 | - print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 1829 | - print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 1830 | - print '<input type="hidden" name="module" value="'.$module.'">'; |
|
| 1831 | - |
|
| 1832 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 1833 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 1834 | - print '<br>'; |
|
| 1835 | - print '<center>'; |
|
| 1836 | - print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
|
| 1837 | - print ' '; |
|
| 1838 | - print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; |
|
| 1839 | - print '</center>'; |
|
| 1817 | + } |
|
| 1818 | + else |
|
| 1819 | + { |
|
| 1820 | + $fullpathoffile=dol_buildpath($file, 0); |
|
| 1840 | 1821 | |
| 1841 | - print '</form>'; |
|
| 1842 | - } |
|
| 1843 | - } |
|
| 1822 | + $content = file_get_contents($fullpathoffile); |
|
| 1844 | 1823 | |
| 1845 | - if ($tab == 'permissions') |
|
| 1846 | - { |
|
| 1847 | - $pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php'; |
|
| 1824 | + // New module |
|
| 1825 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1826 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1827 | + print '<input type="hidden" name="action" value="savefile">'; |
|
| 1828 | + print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 1829 | + print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 1830 | + print '<input type="hidden" name="module" value="'.$module.'">'; |
|
| 1848 | 1831 | |
| 1849 | - //$perms = $moduleobj->; |
|
| 1832 | + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 1833 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 1834 | + print '<br>'; |
|
| 1835 | + print '<center>'; |
|
| 1836 | + print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
|
| 1837 | + print ' '; |
|
| 1838 | + print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; |
|
| 1839 | + print '</center>'; |
|
| 1850 | 1840 | |
| 1851 | - if ($action != 'editfile' || empty($file)) |
|
| 1852 | - { |
|
| 1853 | - print $langs->trans("PermissionsDefDesc", '<a href="'.DOL_URL_ROOT.'/admin/perms.php">'.$langs->trans('DefaultPermissions').'</a>').'<br>'; |
|
| 1854 | - print '<br>'; |
|
| 1841 | + print '</form>'; |
|
| 1842 | + } |
|
| 1843 | + } |
|
| 1855 | 1844 | |
| 1856 | - print '<span class="fa fa-file"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>'; |
|
| 1857 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1858 | - print '<br>'; |
|
| 1845 | + if ($tab == 'permissions') |
|
| 1846 | + { |
|
| 1847 | + $pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php'; |
|
| 1859 | 1848 | |
| 1860 | - print '<br>'; |
|
| 1861 | - print load_fiche_titre($langs->trans("ListOfPermissionsDefined"), '', ''); |
|
| 1849 | + //$perms = $moduleobj->; |
|
| 1862 | 1850 | |
| 1863 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1864 | - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1865 | - print '<input type="hidden" name="action" value="addproperty">'; |
|
| 1866 | - print '<input type="hidden" name="tab" value="objects">'; |
|
| 1867 | - print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">'; |
|
| 1868 | - print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">'; |
|
| 1851 | + if ($action != 'editfile' || empty($file)) |
|
| 1852 | + { |
|
| 1853 | + print $langs->trans("PermissionsDefDesc", '<a href="'.DOL_URL_ROOT.'/admin/perms.php">'.$langs->trans('DefaultPermissions').'</a>').'<br>'; |
|
| 1854 | + print '<br>'; |
|
| 1855 | + |
|
| 1856 | + print '<span class="fa fa-file"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>'; |
|
| 1857 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1858 | + print '<br>'; |
|
| 1859 | + |
|
| 1860 | + print '<br>'; |
|
| 1861 | + print load_fiche_titre($langs->trans("ListOfPermissionsDefined"), '', ''); |
|
| 1862 | + |
|
| 1863 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1864 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1865 | + print '<input type="hidden" name="action" value="addproperty">'; |
|
| 1866 | + print '<input type="hidden" name="tab" value="objects">'; |
|
| 1867 | + print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">'; |
|
| 1868 | + print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">'; |
|
| 1869 | 1869 | |
| 1870 | 1870 | print 'TODO...'; |
| 1871 | 1871 | /* |
@@ -1939,81 +1939,81 @@ discard block |
||
| 1939 | 1939 | |
| 1940 | 1940 | print '</form>'; |
| 1941 | 1941 | */ |
| 1942 | - } |
|
| 1943 | - else |
|
| 1944 | - { |
|
| 1945 | - $fullpathoffile=dol_buildpath($file, 0); |
|
| 1946 | - |
|
| 1947 | - $content = file_get_contents($fullpathoffile); |
|
| 1948 | - |
|
| 1949 | - // New module |
|
| 1950 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1951 | - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1952 | - print '<input type="hidden" name="action" value="savefile">'; |
|
| 1953 | - print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 1954 | - print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 1955 | - print '<input type="hidden" name="module" value="'.$module.'">'; |
|
| 1956 | - |
|
| 1957 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 1958 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 1959 | - print '<br>'; |
|
| 1960 | - print '<center>'; |
|
| 1961 | - print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
|
| 1962 | - print ' '; |
|
| 1963 | - print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; |
|
| 1964 | - print '</center>'; |
|
| 1942 | + } |
|
| 1943 | + else |
|
| 1944 | + { |
|
| 1945 | + $fullpathoffile=dol_buildpath($file, 0); |
|
| 1965 | 1946 | |
| 1966 | - print '</form>'; |
|
| 1967 | - } |
|
| 1968 | - } |
|
| 1947 | + $content = file_get_contents($fullpathoffile); |
|
| 1948 | + |
|
| 1949 | + // New module |
|
| 1950 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1951 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1952 | + print '<input type="hidden" name="action" value="savefile">'; |
|
| 1953 | + print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 1954 | + print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 1955 | + print '<input type="hidden" name="module" value="'.$module.'">'; |
|
| 1956 | + |
|
| 1957 | + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 1958 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 1959 | + print '<br>'; |
|
| 1960 | + print '<center>'; |
|
| 1961 | + print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
|
| 1962 | + print ' '; |
|
| 1963 | + print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; |
|
| 1964 | + print '</center>'; |
|
| 1965 | + |
|
| 1966 | + print '</form>'; |
|
| 1967 | + } |
|
| 1968 | + } |
|
| 1969 | 1969 | |
| 1970 | - if ($tab == 'hooks') |
|
| 1971 | - { |
|
| 1972 | - if ($action != 'editfile' || empty($file)) |
|
| 1970 | + if ($tab == 'hooks') |
|
| 1971 | + { |
|
| 1972 | + if ($action != 'editfile' || empty($file)) |
|
| 1973 | 1973 | { |
| 1974 | 1974 | print $langs->trans("HooksDefDesc").'<br>'; |
| 1975 | 1975 | print '<br>'; |
| 1976 | 1976 | |
| 1977 | - $pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php'; |
|
| 1977 | + $pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php'; |
|
| 1978 | 1978 | print '<span class="fa fa-file"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>'; |
| 1979 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1980 | - print '<br>'; |
|
| 1979 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1980 | + print '<br>'; |
|
| 1981 | 1981 | |
| 1982 | - $pathtohook = strtolower($module).'/class/actions_'.strtolower($module).'.class.php'; |
|
| 1982 | + $pathtohook = strtolower($module).'/class/actions_'.strtolower($module).'.class.php'; |
|
| 1983 | 1983 | print '<span class="fa fa-file"></span> '.$langs->trans("HooksFile").' : <strong>'.$pathtohook.'</strong>'; |
| 1984 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format=php&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1985 | - print '<br>'; |
|
| 1984 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format=php&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1985 | + print '<br>'; |
|
| 1986 | 1986 | } |
| 1987 | 1987 | else |
| 1988 | 1988 | { |
| 1989 | - $fullpathoffile=dol_buildpath($file, 0); |
|
| 1990 | - |
|
| 1991 | - $content = file_get_contents($fullpathoffile); |
|
| 1992 | - |
|
| 1993 | - // New module |
|
| 1994 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1995 | - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1996 | - print '<input type="hidden" name="action" value="savefile">'; |
|
| 1997 | - print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 1998 | - print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 1999 | - print '<input type="hidden" name="module" value="'.$module.'">'; |
|
| 2000 | - |
|
| 2001 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 2002 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 2003 | - print '<br>'; |
|
| 2004 | - print '<center>'; |
|
| 2005 | - print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
|
| 2006 | - print ' '; |
|
| 2007 | - print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; |
|
| 2008 | - print '</center>'; |
|
| 2009 | - |
|
| 2010 | - print '</form>'; |
|
| 1989 | + $fullpathoffile=dol_buildpath($file, 0); |
|
| 1990 | + |
|
| 1991 | + $content = file_get_contents($fullpathoffile); |
|
| 1992 | + |
|
| 1993 | + // New module |
|
| 1994 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 1995 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1996 | + print '<input type="hidden" name="action" value="savefile">'; |
|
| 1997 | + print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 1998 | + print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 1999 | + print '<input type="hidden" name="module" value="'.$module.'">'; |
|
| 2000 | + |
|
| 2001 | + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 2002 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 2003 | + print '<br>'; |
|
| 2004 | + print '<center>'; |
|
| 2005 | + print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
|
| 2006 | + print ' '; |
|
| 2007 | + print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; |
|
| 2008 | + print '</center>'; |
|
| 2009 | + |
|
| 2010 | + print '</form>'; |
|
| 2011 | 2011 | } |
| 2012 | - } |
|
| 2012 | + } |
|
| 2013 | 2013 | |
| 2014 | - if ($tab == 'triggers') |
|
| 2015 | - { |
|
| 2016 | - require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; |
|
| 2014 | + if ($tab == 'triggers') |
|
| 2015 | + { |
|
| 2016 | + require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; |
|
| 2017 | 2017 | |
| 2018 | 2018 | $interfaces = new Interfaces($db); |
| 2019 | 2019 | $triggers = $interfaces->getTriggersList(array('/'.strtolower($module).'/core/triggers')); |
@@ -2025,14 +2025,14 @@ discard block |
||
| 2025 | 2025 | |
| 2026 | 2026 | if (! empty($triggers)) |
| 2027 | 2027 | { |
| 2028 | - foreach ($triggers as $trigger) |
|
| 2029 | - { |
|
| 2030 | - $pathtofile = $trigger['relpath']; |
|
| 2031 | - |
|
| 2032 | - print '<span class="fa fa-file"></span> '.$langs->trans("TriggersFile").' : <strong>'.$pathtofile.'</strong>'; |
|
| 2033 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 2034 | - print '<br>'; |
|
| 2035 | - } |
|
| 2028 | + foreach ($triggers as $trigger) |
|
| 2029 | + { |
|
| 2030 | + $pathtofile = $trigger['relpath']; |
|
| 2031 | + |
|
| 2032 | + print '<span class="fa fa-file"></span> '.$langs->trans("TriggersFile").' : <strong>'.$pathtofile.'</strong>'; |
|
| 2033 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 2034 | + print '<br>'; |
|
| 2035 | + } |
|
| 2036 | 2036 | } |
| 2037 | 2037 | else |
| 2038 | 2038 | { |
@@ -2041,34 +2041,34 @@ discard block |
||
| 2041 | 2041 | } |
| 2042 | 2042 | else |
| 2043 | 2043 | { |
| 2044 | - $fullpathoffile=dol_buildpath($file, 0); |
|
| 2045 | - |
|
| 2046 | - $content = file_get_contents($fullpathoffile); |
|
| 2047 | - |
|
| 2048 | - // New module |
|
| 2049 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 2050 | - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 2051 | - print '<input type="hidden" name="action" value="savefile">'; |
|
| 2052 | - print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 2053 | - print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 2054 | - print '<input type="hidden" name="module" value="'.$module.'">'; |
|
| 2055 | - |
|
| 2056 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 2057 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 2058 | - print '<br>'; |
|
| 2059 | - print '<center>'; |
|
| 2060 | - print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
|
| 2061 | - print ' '; |
|
| 2062 | - print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; |
|
| 2063 | - print '</center>'; |
|
| 2064 | - |
|
| 2065 | - print '</form>'; |
|
| 2044 | + $fullpathoffile=dol_buildpath($file, 0); |
|
| 2045 | + |
|
| 2046 | + $content = file_get_contents($fullpathoffile); |
|
| 2047 | + |
|
| 2048 | + // New module |
|
| 2049 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 2050 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 2051 | + print '<input type="hidden" name="action" value="savefile">'; |
|
| 2052 | + print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 2053 | + print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 2054 | + print '<input type="hidden" name="module" value="'.$module.'">'; |
|
| 2055 | + |
|
| 2056 | + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 2057 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 2058 | + print '<br>'; |
|
| 2059 | + print '<center>'; |
|
| 2060 | + print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
|
| 2061 | + print ' '; |
|
| 2062 | + print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; |
|
| 2063 | + print '</center>'; |
|
| 2064 | + |
|
| 2065 | + print '</form>'; |
|
| 2066 | 2066 | } |
| 2067 | - } |
|
| 2067 | + } |
|
| 2068 | 2068 | |
| 2069 | - if ($tab == 'widgets') |
|
| 2070 | - { |
|
| 2071 | - require_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; |
|
| 2069 | + if ($tab == 'widgets') |
|
| 2070 | + { |
|
| 2071 | + require_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; |
|
| 2072 | 2072 | |
| 2073 | 2073 | $widgets = ModeleBoxes::getWidgetsList(array('/'.strtolower($module).'/core/boxes')); |
| 2074 | 2074 | |
@@ -2076,260 +2076,260 @@ discard block |
||
| 2076 | 2076 | { |
| 2077 | 2077 | if (! empty($widget)) |
| 2078 | 2078 | { |
| 2079 | - foreach ($widgets as $widget) |
|
| 2080 | - { |
|
| 2081 | - $pathtofile = $widget['relpath']; |
|
| 2082 | - |
|
| 2083 | - print '<span class="fa fa-file"></span> '.$langs->trans("WidgetFile").' : <strong>'.$pathtofile.'</strong>'; |
|
| 2084 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 2085 | - print '<br>'; |
|
| 2086 | - } |
|
| 2087 | - } |
|
| 2088 | - else |
|
| 2089 | - { |
|
| 2090 | - print $langs->trans("NoWidget"); |
|
| 2091 | - } |
|
| 2079 | + foreach ($widgets as $widget) |
|
| 2080 | + { |
|
| 2081 | + $pathtofile = $widget['relpath']; |
|
| 2082 | + |
|
| 2083 | + print '<span class="fa fa-file"></span> '.$langs->trans("WidgetFile").' : <strong>'.$pathtofile.'</strong>'; |
|
| 2084 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 2085 | + print '<br>'; |
|
| 2086 | + } |
|
| 2087 | + } |
|
| 2088 | + else |
|
| 2089 | + { |
|
| 2090 | + print $langs->trans("NoWidget"); |
|
| 2091 | + } |
|
| 2092 | 2092 | } |
| 2093 | 2093 | else |
| 2094 | 2094 | { |
| 2095 | - $fullpathoffile=dol_buildpath($file, 0); |
|
| 2096 | - |
|
| 2097 | - $content = file_get_contents($fullpathoffile); |
|
| 2098 | - |
|
| 2099 | - // New module |
|
| 2100 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 2101 | - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 2102 | - print '<input type="hidden" name="action" value="savefile">'; |
|
| 2103 | - print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 2104 | - print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 2105 | - print '<input type="hidden" name="module" value="'.$module.'">'; |
|
| 2106 | - |
|
| 2107 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 2108 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 2109 | - print '<br>'; |
|
| 2110 | - print '<center>'; |
|
| 2111 | - print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
|
| 2112 | - print ' '; |
|
| 2113 | - print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; |
|
| 2114 | - print '</center>'; |
|
| 2115 | - |
|
| 2116 | - print '</form>'; |
|
| 2095 | + $fullpathoffile=dol_buildpath($file, 0); |
|
| 2096 | + |
|
| 2097 | + $content = file_get_contents($fullpathoffile); |
|
| 2098 | + |
|
| 2099 | + // New module |
|
| 2100 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 2101 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 2102 | + print '<input type="hidden" name="action" value="savefile">'; |
|
| 2103 | + print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 2104 | + print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 2105 | + print '<input type="hidden" name="module" value="'.$module.'">'; |
|
| 2106 | + |
|
| 2107 | + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 2108 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 2109 | + print '<br>'; |
|
| 2110 | + print '<center>'; |
|
| 2111 | + print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
|
| 2112 | + print ' '; |
|
| 2113 | + print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; |
|
| 2114 | + print '</center>'; |
|
| 2115 | + |
|
| 2116 | + print '</form>'; |
|
| 2117 | 2117 | } |
| 2118 | - } |
|
| 2118 | + } |
|
| 2119 | 2119 | |
| 2120 | - if ($tab == 'cron') |
|
| 2121 | - { |
|
| 2122 | - $pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php'; |
|
| 2120 | + if ($tab == 'cron') |
|
| 2121 | + { |
|
| 2122 | + $pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php'; |
|
| 2123 | 2123 | |
| 2124 | - $cronjobs = $moduleobj->cronjobs; |
|
| 2124 | + $cronjobs = $moduleobj->cronjobs; |
|
| 2125 | 2125 | |
| 2126 | - if ($action != 'editfile' || empty($file)) |
|
| 2127 | - { |
|
| 2128 | - print $langs->trans("CronJobDefDesc", '<a href="'.DOL_URL_ROOT.'/cron/list.php?status=-2">'.$langs->trans('CronList').'</a>').'<br>'; |
|
| 2129 | - print '<br>'; |
|
| 2126 | + if ($action != 'editfile' || empty($file)) |
|
| 2127 | + { |
|
| 2128 | + print $langs->trans("CronJobDefDesc", '<a href="'.DOL_URL_ROOT.'/cron/list.php?status=-2">'.$langs->trans('CronList').'</a>').'<br>'; |
|
| 2129 | + print '<br>'; |
|
| 2130 | 2130 | |
| 2131 | - print '<span class="fa fa-file"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>'; |
|
| 2132 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 2133 | - print '<br>'; |
|
| 2131 | + print '<span class="fa fa-file"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>'; |
|
| 2132 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 2133 | + print '<br>'; |
|
| 2134 | 2134 | |
| 2135 | - print '<br>'; |
|
| 2136 | - print load_fiche_titre($langs->trans("CronJobProfiles"), '', ''); |
|
| 2135 | + print '<br>'; |
|
| 2136 | + print load_fiche_titre($langs->trans("CronJobProfiles"), '', ''); |
|
| 2137 | + |
|
| 2138 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 2139 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 2140 | + print '<input type="hidden" name="action" value="addproperty">'; |
|
| 2141 | + print '<input type="hidden" name="tab" value="objects">'; |
|
| 2142 | + print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">'; |
|
| 2143 | + print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">'; |
|
| 2144 | + |
|
| 2145 | + print '<div class="div-table-responsive">'; |
|
| 2146 | + print '<table class="noborder">'; |
|
| 2147 | + |
|
| 2148 | + print '<tr class="liste_titre">'; |
|
| 2149 | + print_liste_field_titre("CronLabel",$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); |
|
| 2150 | + print_liste_field_titre("CronTask",'','',"",$param,'',$sortfield,$sortorder); |
|
| 2151 | + print_liste_field_titre("CronFrequency",'',"","",$param,'',$sortfield,$sortorder); |
|
| 2152 | + print_liste_field_titre("StatusAtInstall",$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); |
|
| 2153 | + print_liste_field_titre("Comment",$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); |
|
| 2154 | + print "</tr>\n"; |
|
| 2155 | + |
|
| 2156 | + if (count($cronjobs)) |
|
| 2157 | + { |
|
| 2158 | + foreach ($cronjobs as $cron) |
|
| 2159 | + { |
|
| 2160 | + print '<tr class="oddeven">'; |
|
| 2161 | + |
|
| 2162 | + print '<td>'; |
|
| 2163 | + print $cron['label']; |
|
| 2164 | + print '</td>'; |
|
| 2165 | + |
|
| 2166 | + print '<td>'; |
|
| 2167 | + if ($cron['jobtype']=='method') |
|
| 2168 | + { |
|
| 2169 | + $text=$langs->trans("CronClass"); |
|
| 2170 | + $texttoshow=$langs->trans('CronModule').': '.$module.'<br>'; |
|
| 2171 | + $texttoshow.=$langs->trans('CronClass').': '. $cron['class'].'<br>'; |
|
| 2172 | + $texttoshow.=$langs->trans('CronObject').': '. $cron['objectname'].'<br>'; |
|
| 2173 | + $texttoshow.=$langs->trans('CronMethod').': '. $cron['method']; |
|
| 2174 | + $texttoshow.='<br>'.$langs->trans('CronArgs').': '. $cron['parameters']; |
|
| 2175 | + $texttoshow.='<br>'.$langs->trans('Comment').': '. $langs->trans($cron['comment']); |
|
| 2176 | + } |
|
| 2177 | + elseif ($cron['jobtype']=='command') |
|
| 2178 | + { |
|
| 2179 | + $text=$langs->trans('CronCommand'); |
|
| 2180 | + $texttoshow=$langs->trans('CronCommand').': '.dol_trunc($cron['command']); |
|
| 2181 | + $texttoshow.='<br>'.$langs->trans('CronArgs').': '. $cron['parameters']; |
|
| 2182 | + $texttoshow.='<br>'.$langs->trans('Comment').': '. $langs->trans($cron['comment']); |
|
| 2183 | + } |
|
| 2184 | + print $form->textwithpicto($text, $texttoshow, 1); |
|
| 2185 | + print '</td>'; |
|
| 2186 | + |
|
| 2187 | + print '<td>'; |
|
| 2188 | + if($cron['unitfrequency'] == "60") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Minutes'); |
|
| 2189 | + if($cron['unitfrequency'] == "3600") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Hours'); |
|
| 2190 | + if($cron['unitfrequency'] == "86400") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Days'); |
|
| 2191 | + if($cron['unitfrequency'] == "604800") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Weeks'); |
|
| 2192 | + print '</td>'; |
|
| 2193 | + |
|
| 2194 | + print '<td>'; |
|
| 2195 | + print $cron['status']; |
|
| 2196 | + print '</td>'; |
|
| 2197 | + |
|
| 2198 | + print '<td>'; |
|
| 2199 | + if (!empty($cron['comment'])) {print $cron['comment'];} |
|
| 2200 | + print '</td>'; |
|
| 2201 | + |
|
| 2202 | + print '</tr>'; |
|
| 2203 | + } |
|
| 2204 | + } |
|
| 2205 | + else |
|
| 2206 | + { |
|
| 2207 | + print '<tr><td class="opacitymedium" colspan="5">'.$langs->trans("None").'</td></tr>'; |
|
| 2208 | + } |
|
| 2137 | 2209 | |
| 2138 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 2139 | - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 2140 | - print '<input type="hidden" name="action" value="addproperty">'; |
|
| 2141 | - print '<input type="hidden" name="tab" value="objects">'; |
|
| 2142 | - print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">'; |
|
| 2143 | - print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">'; |
|
| 2210 | + print '</table>'; |
|
| 2211 | + print '</div>'; |
|
| 2144 | 2212 | |
| 2145 | - print '<div class="div-table-responsive">'; |
|
| 2146 | - print '<table class="noborder">'; |
|
| 2213 | + print '</form>'; |
|
| 2214 | + } |
|
| 2215 | + else |
|
| 2216 | + { |
|
| 2217 | + $fullpathoffile=dol_buildpath($file, 0); |
|
| 2147 | 2218 | |
| 2148 | - print '<tr class="liste_titre">'; |
|
| 2149 | - print_liste_field_titre("CronLabel",$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); |
|
| 2150 | - print_liste_field_titre("CronTask",'','',"",$param,'',$sortfield,$sortorder); |
|
| 2151 | - print_liste_field_titre("CronFrequency",'',"","",$param,'',$sortfield,$sortorder); |
|
| 2152 | - print_liste_field_titre("StatusAtInstall",$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); |
|
| 2153 | - print_liste_field_titre("Comment",$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); |
|
| 2154 | - print "</tr>\n"; |
|
| 2219 | + $content = file_get_contents($fullpathoffile); |
|
| 2155 | 2220 | |
| 2156 | - if (count($cronjobs)) |
|
| 2157 | - { |
|
| 2158 | - foreach ($cronjobs as $cron) |
|
| 2159 | - { |
|
| 2160 | - print '<tr class="oddeven">'; |
|
| 2221 | + // New module |
|
| 2222 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 2223 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 2224 | + print '<input type="hidden" name="action" value="savefile">'; |
|
| 2225 | + print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 2226 | + print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 2227 | + print '<input type="hidden" name="module" value="'.$module.'">'; |
|
| 2161 | 2228 | |
| 2162 | - print '<td>'; |
|
| 2163 | - print $cron['label']; |
|
| 2164 | - print '</td>'; |
|
| 2229 | + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 2230 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 2231 | + print '<br>'; |
|
| 2232 | + print '<center>'; |
|
| 2233 | + print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
|
| 2234 | + print ' '; |
|
| 2235 | + print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; |
|
| 2236 | + print '</center>'; |
|
| 2165 | 2237 | |
| 2166 | - print '<td>'; |
|
| 2167 | - if ($cron['jobtype']=='method') |
|
| 2168 | - { |
|
| 2169 | - $text=$langs->trans("CronClass"); |
|
| 2170 | - $texttoshow=$langs->trans('CronModule').': '.$module.'<br>'; |
|
| 2171 | - $texttoshow.=$langs->trans('CronClass').': '. $cron['class'].'<br>'; |
|
| 2172 | - $texttoshow.=$langs->trans('CronObject').': '. $cron['objectname'].'<br>'; |
|
| 2173 | - $texttoshow.=$langs->trans('CronMethod').': '. $cron['method']; |
|
| 2174 | - $texttoshow.='<br>'.$langs->trans('CronArgs').': '. $cron['parameters']; |
|
| 2175 | - $texttoshow.='<br>'.$langs->trans('Comment').': '. $langs->trans($cron['comment']); |
|
| 2176 | - } |
|
| 2177 | - elseif ($cron['jobtype']=='command') |
|
| 2178 | - { |
|
| 2179 | - $text=$langs->trans('CronCommand'); |
|
| 2180 | - $texttoshow=$langs->trans('CronCommand').': '.dol_trunc($cron['command']); |
|
| 2181 | - $texttoshow.='<br>'.$langs->trans('CronArgs').': '. $cron['parameters']; |
|
| 2182 | - $texttoshow.='<br>'.$langs->trans('Comment').': '. $langs->trans($cron['comment']); |
|
| 2183 | - } |
|
| 2184 | - print $form->textwithpicto($text, $texttoshow, 1); |
|
| 2185 | - print '</td>'; |
|
| 2238 | + print '</form>'; |
|
| 2239 | + } |
|
| 2240 | + } |
|
| 2186 | 2241 | |
| 2187 | - print '<td>'; |
|
| 2188 | - if($cron['unitfrequency'] == "60") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Minutes'); |
|
| 2189 | - if($cron['unitfrequency'] == "3600") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Hours'); |
|
| 2190 | - if($cron['unitfrequency'] == "86400") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Days'); |
|
| 2191 | - if($cron['unitfrequency'] == "604800") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Weeks'); |
|
| 2192 | - print '</td>'; |
|
| 2242 | + if ($tab == 'buildpackage') |
|
| 2243 | + { |
|
| 2244 | + if (! class_exists('ZipArchive') && ! defined('ODTPHP_PATHTOPCLZIP')) |
|
| 2245 | + { |
|
| 2246 | + print img_warning().' '.$langs->trans("ErrNoZipEngine"); |
|
| 2247 | + print '<br>'; |
|
| 2248 | + } |
|
| 2193 | 2249 | |
| 2194 | - print '<td>'; |
|
| 2195 | - print $cron['status']; |
|
| 2196 | - print '</td>'; |
|
| 2250 | + $modulelowercase=strtolower($module); |
|
| 2197 | 2251 | |
| 2198 | - print '<td>'; |
|
| 2199 | - if (!empty($cron['comment'])) {print $cron['comment'];} |
|
| 2200 | - print '</td>'; |
|
| 2252 | + // Zip file to build |
|
| 2253 | + $FILENAMEZIP=''; |
|
| 2201 | 2254 | |
| 2202 | - print '</tr>'; |
|
| 2203 | - } |
|
| 2204 | - } |
|
| 2205 | - else |
|
| 2206 | - { |
|
| 2207 | - print '<tr><td class="opacitymedium" colspan="5">'.$langs->trans("None").'</td></tr>'; |
|
| 2208 | - } |
|
| 2255 | + // Load module |
|
| 2256 | + dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); |
|
| 2257 | + $class='mod'.$module; |
|
| 2209 | 2258 | |
| 2210 | - print '</table>'; |
|
| 2211 | - print '</div>'; |
|
| 2259 | + if (class_exists($class)) |
|
| 2260 | + { |
|
| 2261 | + try { |
|
| 2262 | + $moduleobj = new $class($db); |
|
| 2263 | + } |
|
| 2264 | + catch(Exception $e) |
|
| 2265 | + { |
|
| 2266 | + $error++; |
|
| 2267 | + dol_print_error($e->getMessage()); |
|
| 2268 | + } |
|
| 2269 | + } |
|
| 2270 | + else |
|
| 2271 | + { |
|
| 2272 | + $error++; |
|
| 2273 | + $langs->load("errors"); |
|
| 2274 | + dol_print_error($langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module)); |
|
| 2275 | + exit; |
|
| 2276 | + } |
|
| 2212 | 2277 | |
| 2213 | - print '</form>'; |
|
| 2214 | - } |
|
| 2215 | - else |
|
| 2216 | - { |
|
| 2217 | - $fullpathoffile=dol_buildpath($file, 0); |
|
| 2218 | - |
|
| 2219 | - $content = file_get_contents($fullpathoffile); |
|
| 2220 | - |
|
| 2221 | - // New module |
|
| 2222 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 2223 | - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 2224 | - print '<input type="hidden" name="action" value="savefile">'; |
|
| 2225 | - print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
|
| 2226 | - print '<input type="hidden" name="tab" value="'.$tab.'">'; |
|
| 2227 | - print '<input type="hidden" name="module" value="'.$module.'">'; |
|
| 2228 | - |
|
| 2229 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 2230 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 2231 | - print '<br>'; |
|
| 2232 | - print '<center>'; |
|
| 2233 | - print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
|
| 2234 | - print ' '; |
|
| 2235 | - print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; |
|
| 2236 | - print '</center>'; |
|
| 2278 | + $arrayversion=explode('.',$moduleobj->version,3); |
|
| 2279 | + if (count($arrayversion)) |
|
| 2280 | + { |
|
| 2281 | + $FILENAMEZIP="module_".$modulelowercase.'-'.$arrayversion[0].'.'.$arrayversion[1].($arrayversion[2]?".".$arrayversion[2]:"").".zip"; |
|
| 2282 | + $outputfilezip = dol_buildpath($modulelowercase, 0).'/bin/'.$FILENAMEZIP; |
|
| 2237 | 2283 | |
| 2238 | - print '</form>'; |
|
| 2239 | - } |
|
| 2240 | - } |
|
| 2241 | - |
|
| 2242 | - if ($tab == 'buildpackage') |
|
| 2243 | - { |
|
| 2244 | - if (! class_exists('ZipArchive') && ! defined('ODTPHP_PATHTOPCLZIP')) |
|
| 2245 | - { |
|
| 2246 | - print img_warning().' '.$langs->trans("ErrNoZipEngine"); |
|
| 2247 | - print '<br>'; |
|
| 2248 | - } |
|
| 2249 | - |
|
| 2250 | - $modulelowercase=strtolower($module); |
|
| 2251 | - |
|
| 2252 | - // Zip file to build |
|
| 2253 | - $FILENAMEZIP=''; |
|
| 2254 | - |
|
| 2255 | - // Load module |
|
| 2256 | - dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); |
|
| 2257 | - $class='mod'.$module; |
|
| 2258 | - |
|
| 2259 | - if (class_exists($class)) |
|
| 2260 | - { |
|
| 2261 | - try { |
|
| 2262 | - $moduleobj = new $class($db); |
|
| 2263 | - } |
|
| 2264 | - catch(Exception $e) |
|
| 2265 | - { |
|
| 2266 | - $error++; |
|
| 2267 | - dol_print_error($e->getMessage()); |
|
| 2268 | - } |
|
| 2269 | - } |
|
| 2270 | - else |
|
| 2271 | - { |
|
| 2272 | - $error++; |
|
| 2273 | - $langs->load("errors"); |
|
| 2274 | - dol_print_error($langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module)); |
|
| 2275 | - exit; |
|
| 2276 | - } |
|
| 2277 | - |
|
| 2278 | - $arrayversion=explode('.',$moduleobj->version,3); |
|
| 2279 | - if (count($arrayversion)) |
|
| 2280 | - { |
|
| 2281 | - $FILENAMEZIP="module_".$modulelowercase.'-'.$arrayversion[0].'.'.$arrayversion[1].($arrayversion[2]?".".$arrayversion[2]:"").".zip"; |
|
| 2282 | - $outputfilezip = dol_buildpath($modulelowercase, 0).'/bin/'.$FILENAMEZIP; |
|
| 2283 | - |
|
| 2284 | - $FILENAMEDOC=$modulelowercase.'.html'; |
|
| 2285 | - $outputfiledoc = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOC; |
|
| 2286 | - } |
|
| 2287 | - |
|
| 2288 | - print '<br>'; |
|
| 2289 | - |
|
| 2290 | - print '<span class="fa fa-file"></span> '. $langs->trans("PathToModulePackage") . ' : '; |
|
| 2291 | - if (! dol_is_file($outputfilezip)) print '<strong>'.$langs->trans("FileNotYetGenerated").'</strong>'; |
|
| 2292 | - else { |
|
| 2293 | - $relativepath = $modulelowercase.'/bin/'.$FILENAMEZIP; |
|
| 2294 | - print '<strong><a href="'.DOL_URL_ROOT.'/document.php?modulepart=packages&file='.urlencode($relativepath).'">'.$outputfilezip.'</a></strong>'; |
|
| 2295 | - print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfilezip), 'dayhour').')'; |
|
| 2296 | - } |
|
| 2297 | - print '</strong><br>'; |
|
| 2298 | - |
|
| 2299 | - print '<br>'; |
|
| 2300 | - |
|
| 2301 | - print '<form name="generatepackage">'; |
|
| 2302 | - print '<input type="hidden" name="action" value="generatepackage">'; |
|
| 2303 | - print '<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).'">'; |
|
| 2304 | - print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">'; |
|
| 2305 | - print '<input type="submit" class="button" name="generatepackage" value="'.$langs->trans("BuildPackage").'">'; |
|
| 2306 | - print '</form>'; |
|
| 2307 | - |
|
| 2308 | - print '<br><br><br>'; |
|
| 2309 | - |
|
| 2310 | - print '<span class="fa fa-file"></span> '. $langs->trans("PathToModuleDocumentation") . ' : '; |
|
| 2311 | - if (! dol_is_file($outputfiledoc)) print '<strong>'.$langs->trans("FileNotYetGenerated").'</strong>'; |
|
| 2312 | - else { |
|
| 2313 | - print '<strong>'.$outputfiledoc.'</strong>'; |
|
| 2314 | - print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledoc), 'dayhour').')'; |
|
| 2315 | - } |
|
| 2316 | - print '</strong><br>'; |
|
| 2317 | - |
|
| 2318 | - print '<br>'; |
|
| 2319 | - |
|
| 2320 | - print '<form name="generatedoc">'; |
|
| 2321 | - print '<input type="hidden" name="action" value="generatedoc">'; |
|
| 2322 | - print '<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).'">'; |
|
| 2323 | - print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">'; |
|
| 2324 | - print '<input type="submit" class="button" name="generatedoc" value="'.$langs->trans("BuildDocumentation").'">'; |
|
| 2325 | - print '</form>'; |
|
| 2326 | - } |
|
| 2327 | - |
|
| 2328 | - if ($tab != 'description') |
|
| 2329 | - { |
|
| 2330 | - dol_fiche_end(); |
|
| 2331 | - } |
|
| 2332 | - } |
|
| 2284 | + $FILENAMEDOC=$modulelowercase.'.html'; |
|
| 2285 | + $outputfiledoc = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOC; |
|
| 2286 | + } |
|
| 2287 | + |
|
| 2288 | + print '<br>'; |
|
| 2289 | + |
|
| 2290 | + print '<span class="fa fa-file"></span> '. $langs->trans("PathToModulePackage") . ' : '; |
|
| 2291 | + if (! dol_is_file($outputfilezip)) print '<strong>'.$langs->trans("FileNotYetGenerated").'</strong>'; |
|
| 2292 | + else { |
|
| 2293 | + $relativepath = $modulelowercase.'/bin/'.$FILENAMEZIP; |
|
| 2294 | + print '<strong><a href="'.DOL_URL_ROOT.'/document.php?modulepart=packages&file='.urlencode($relativepath).'">'.$outputfilezip.'</a></strong>'; |
|
| 2295 | + print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfilezip), 'dayhour').')'; |
|
| 2296 | + } |
|
| 2297 | + print '</strong><br>'; |
|
| 2298 | + |
|
| 2299 | + print '<br>'; |
|
| 2300 | + |
|
| 2301 | + print '<form name="generatepackage">'; |
|
| 2302 | + print '<input type="hidden" name="action" value="generatepackage">'; |
|
| 2303 | + print '<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).'">'; |
|
| 2304 | + print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">'; |
|
| 2305 | + print '<input type="submit" class="button" name="generatepackage" value="'.$langs->trans("BuildPackage").'">'; |
|
| 2306 | + print '</form>'; |
|
| 2307 | + |
|
| 2308 | + print '<br><br><br>'; |
|
| 2309 | + |
|
| 2310 | + print '<span class="fa fa-file"></span> '. $langs->trans("PathToModuleDocumentation") . ' : '; |
|
| 2311 | + if (! dol_is_file($outputfiledoc)) print '<strong>'.$langs->trans("FileNotYetGenerated").'</strong>'; |
|
| 2312 | + else { |
|
| 2313 | + print '<strong>'.$outputfiledoc.'</strong>'; |
|
| 2314 | + print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledoc), 'dayhour').')'; |
|
| 2315 | + } |
|
| 2316 | + print '</strong><br>'; |
|
| 2317 | + |
|
| 2318 | + print '<br>'; |
|
| 2319 | + |
|
| 2320 | + print '<form name="generatedoc">'; |
|
| 2321 | + print '<input type="hidden" name="action" value="generatedoc">'; |
|
| 2322 | + print '<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).'">'; |
|
| 2323 | + print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">'; |
|
| 2324 | + print '<input type="submit" class="button" name="generatedoc" value="'.$langs->trans("BuildDocumentation").'">'; |
|
| 2325 | + print '</form>'; |
|
| 2326 | + } |
|
| 2327 | + |
|
| 2328 | + if ($tab != 'description') |
|
| 2329 | + { |
|
| 2330 | + dol_fiche_end(); |
|
| 2331 | + } |
|
| 2332 | + } |
|
| 2333 | 2333 | } |
| 2334 | 2334 | |
| 2335 | 2335 | dol_fiche_end(); // End modules |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * \brief Home page for module builder module |
| 24 | 24 | */ |
| 25 | 25 | |
| 26 | -if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check anti SQL+XSS injection attack test |
|
| 26 | +if (!defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check anti SQL+XSS injection attack test |
|
| 27 | 27 | |
| 28 | 28 | require '../main.inc.php'; |
| 29 | 29 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
@@ -34,49 +34,49 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | $langs->loadLangs(array("admin", "modulebuilder", "other", "cron")); |
| 36 | 36 | |
| 37 | -$action=GETPOST('action','aZ09'); |
|
| 38 | -$confirm=GETPOST('confirm','alpha'); |
|
| 39 | -$cancel=GETPOST('cancel','alpha'); |
|
| 37 | +$action = GETPOST('action', 'aZ09'); |
|
| 38 | +$confirm = GETPOST('confirm', 'alpha'); |
|
| 39 | +$cancel = GETPOST('cancel', 'alpha'); |
|
| 40 | 40 | |
| 41 | -$module=GETPOST('module','alpha'); |
|
| 42 | -$tab=GETPOST('tab','aZ09'); |
|
| 43 | -$tabobj=GETPOST('tabobj','alpha'); |
|
| 44 | -$propertykey=GETPOST('propertykey','alpha'); |
|
| 45 | -if (empty($module)) $module='initmodule'; |
|
| 46 | -if (empty($tab)) $tab='description'; |
|
| 47 | -if (empty($tabobj)) $tabobj='newobjectifnoobj'; |
|
| 48 | -$file=GETPOST('file','alpha'); |
|
| 41 | +$module = GETPOST('module', 'alpha'); |
|
| 42 | +$tab = GETPOST('tab', 'aZ09'); |
|
| 43 | +$tabobj = GETPOST('tabobj', 'alpha'); |
|
| 44 | +$propertykey = GETPOST('propertykey', 'alpha'); |
|
| 45 | +if (empty($module)) $module = 'initmodule'; |
|
| 46 | +if (empty($tab)) $tab = 'description'; |
|
| 47 | +if (empty($tabobj)) $tabobj = 'newobjectifnoobj'; |
|
| 48 | +$file = GETPOST('file', 'alpha'); |
|
| 49 | 49 | |
| 50 | -$modulename=dol_sanitizeFileName(GETPOST('modulename','alpha')); |
|
| 51 | -$objectname=dol_sanitizeFileName(GETPOST('objectname','alpha')); |
|
| 50 | +$modulename = dol_sanitizeFileName(GETPOST('modulename', 'alpha')); |
|
| 51 | +$objectname = dol_sanitizeFileName(GETPOST('objectname', 'alpha')); |
|
| 52 | 52 | |
| 53 | 53 | // Security check |
| 54 | 54 | if (empty($conf->modulebuilder->enabled)) accessforbidden('ModuleBuilderNotAllowed'); |
| 55 | -if (! $user->admin && empty($conf->global->MODULEBUILDER_FOREVERYONE)) accessforbidden('ModuleBuilderNotAllowed'); |
|
| 55 | +if (!$user->admin && empty($conf->global->MODULEBUILDER_FOREVERYONE)) accessforbidden('ModuleBuilderNotAllowed'); |
|
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | // Dir for custom dirs |
| 59 | -$tmp=explode(',', $dolibarr_main_document_root_alt); |
|
| 59 | +$tmp = explode(',', $dolibarr_main_document_root_alt); |
|
| 60 | 60 | $dirins = $tmp[0]; |
| 61 | 61 | $dirread = $dirins; |
| 62 | 62 | $forceddirread = 0; |
| 63 | 63 | |
| 64 | 64 | $tmpdir = explode('@', $module); |
| 65 | -if (! empty($tmpdir[1])) |
|
| 65 | +if (!empty($tmpdir[1])) |
|
| 66 | 66 | { |
| 67 | - $module=$tmpdir[0]; |
|
| 68 | - $dirread=$tmpdir[1]; |
|
| 69 | - $forceddirread=1; |
|
| 67 | + $module = $tmpdir[0]; |
|
| 68 | + $dirread = $tmpdir[1]; |
|
| 69 | + $forceddirread = 1; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | -$FILEFLAG='modulebuilder.txt'; |
|
| 72 | +$FILEFLAG = 'modulebuilder.txt'; |
|
| 73 | 73 | |
| 74 | -$now=dol_now(); |
|
| 74 | +$now = dol_now(); |
|
| 75 | 75 | $newmask = 0; |
| 76 | -if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; |
|
| 76 | +if (empty($newmask) && !empty($conf->global->MAIN_UMASK)) $newmask = $conf->global->MAIN_UMASK; |
|
| 77 | 77 | if (empty($newmask)) // This should no happen |
| 78 | 78 | { |
| 79 | - $newmask='0664'; |
|
| 79 | + $newmask = '0664'; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
@@ -92,12 +92,12 @@ discard block |
||
| 92 | 92 | setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - if (! $error) |
|
| 95 | + if (!$error) |
|
| 96 | 96 | { |
| 97 | 97 | $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; |
| 98 | 98 | $destdir = $dirins.'/'.strtolower($modulename); |
| 99 | 99 | |
| 100 | - $arrayreplacement=array( |
|
| 100 | + $arrayreplacement = array( |
|
| 101 | 101 | 'mymodule'=>strtolower($modulename), |
| 102 | 102 | 'MyModule'=>$modulename |
| 103 | 103 | ); |
@@ -136,13 +136,13 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | // Edit PHP files |
| 139 | - if (! $error) |
|
| 139 | + if (!$error) |
|
| 140 | 140 | { |
| 141 | 141 | $listofphpfilestoedit = dol_dir_list($destdir, 'files', 1, '\.(php|MD|js|sql|txt|xml|lang)$', '', 'fullname', SORT_ASC, 0, 1); |
| 142 | - foreach($listofphpfilestoedit as $phpfileval) |
|
| 142 | + foreach ($listofphpfilestoedit as $phpfileval) |
|
| 143 | 143 | { |
| 144 | 144 | //var_dump($phpfileval['fullname']); |
| 145 | - $arrayreplacement=array( |
|
| 145 | + $arrayreplacement = array( |
|
| 146 | 146 | 'mymodule'=>strtolower($modulename), |
| 147 | 147 | 'MyModule'=>$modulename, |
| 148 | 148 | 'MYMODULE'=>strtoupper($modulename), |
@@ -151,11 +151,11 @@ discard block |
||
| 151 | 151 | 'Mon module'=>$modulename, |
| 152 | 152 | 'mon module'=>$modulename, |
| 153 | 153 | 'htdocs/modulebuilder/template'=>strtolower($modulename), |
| 154 | - '---Put here your own copyright and developer email---'=>dol_print_date($now,'%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') |
|
| 154 | + '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '') |
|
| 155 | 155 | ); |
| 156 | 156 | |
| 157 | 157 | |
| 158 | - $result=dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); |
|
| 158 | + $result = dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); |
|
| 159 | 159 | //var_dump($result); |
| 160 | 160 | if ($result < 0) |
| 161 | 161 | { |
@@ -164,10 +164,10 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - if (! $error) |
|
| 167 | + if (!$error) |
|
| 168 | 168 | { |
| 169 | 169 | setEventMessages('ModuleInitialized', null); |
| 170 | - $module=$modulename; |
|
| 170 | + $module = $modulename; |
|
| 171 | 171 | $modulename = ''; |
| 172 | 172 | } |
| 173 | 173 | } |
@@ -184,16 +184,16 @@ discard block |
||
| 184 | 184 | $destdir = $dirins.'/'.strtolower($module); |
| 185 | 185 | |
| 186 | 186 | // Scan dir class to find if an object with same name already exists. |
| 187 | - if (! $error) |
|
| 187 | + if (!$error) |
|
| 188 | 188 | { |
| 189 | - $dirlist=dol_dir_list($destdir.'/class','files',0,'\.txt$'); |
|
| 190 | - $alreadyfound=false; |
|
| 191 | - foreach($dirlist as $key => $val) |
|
| 189 | + $dirlist = dol_dir_list($destdir.'/class', 'files', 0, '\.txt$'); |
|
| 190 | + $alreadyfound = false; |
|
| 191 | + foreach ($dirlist as $key => $val) |
|
| 192 | 192 | { |
| 193 | - $filefound=preg_replace('/\.txt$/','',$val['name']); |
|
| 193 | + $filefound = preg_replace('/\.txt$/', '', $val['name']); |
|
| 194 | 194 | if (strtolower($objectname) == strtolower($filefound) && $objectname != $filefound) |
| 195 | 195 | { |
| 196 | - $alreadyfound=true; |
|
| 196 | + $alreadyfound = true; |
|
| 197 | 197 | $error++; |
| 198 | 198 | setEventMessages($langs->trans("AnObjectAlreadyExistWithThisNameAndDiffCase"), null, 'errors'); |
| 199 | 199 | break; |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - if (! $error) |
|
| 204 | + if (!$error) |
|
| 205 | 205 | { |
| 206 | 206 | // Delete some files |
| 207 | 207 | $filetogenerate = array( |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | 'class/api_myobject.class.php'=>'class/api_'.strtolower($objectname).'.class.php' |
| 222 | 222 | ); |
| 223 | 223 | |
| 224 | - foreach($filetogenerate as $srcfile => $destfile) |
|
| 224 | + foreach ($filetogenerate as $srcfile => $destfile) |
|
| 225 | 225 | { |
| 226 | 226 | $result = dol_copy($srcdir.'/'.$srcfile, $destdir.'/'.$destfile, $newmask, 0); |
| 227 | 227 | if ($result <= 0) |
@@ -239,26 +239,26 @@ discard block |
||
| 239 | 239 | } |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - if (! $error) |
|
| 242 | + if (!$error) |
|
| 243 | 243 | { |
| 244 | 244 | // Scan for object class files |
| 245 | 245 | $listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$'); |
| 246 | 246 | |
| 247 | - $firstobjectname=''; |
|
| 248 | - foreach($listofobject as $fileobj) |
|
| 247 | + $firstobjectname = ''; |
|
| 248 | + foreach ($listofobject as $fileobj) |
|
| 249 | 249 | { |
| 250 | - if (preg_match('/^api_/',$fileobj['name'])) continue; |
|
| 251 | - if (preg_match('/^actions_/',$fileobj['name'])) continue; |
|
| 250 | + if (preg_match('/^api_/', $fileobj['name'])) continue; |
|
| 251 | + if (preg_match('/^actions_/', $fileobj['name'])) continue; |
|
| 252 | 252 | |
| 253 | - $tmpcontent=file_get_contents($fileobj['fullname']); |
|
| 254 | - if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims',$tmpcontent,$reg)) |
|
| 253 | + $tmpcontent = file_get_contents($fileobj['fullname']); |
|
| 254 | + if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) |
|
| 255 | 255 | { |
| 256 | 256 | $objectnameloop = $reg[1]; |
| 257 | 257 | if (empty($firstobjectname)) $firstobjectname = $objectnameloop; |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | // Regenerate left menu entry in descriptor for $objectname |
| 261 | - $stringtoadd=" |
|
| 261 | + $stringtoadd = " |
|
| 262 | 262 | \t\t\$this->menu[\$r++]=array( |
| 263 | 263 | 'fk_menu'=>'fk_mainmenu=mymodule', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
| 264 | 264 | 'type'=>'left', // This is a Left menu entry |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | $stringtoadd = preg_replace('/mymodule/', strtolower($module), $stringtoadd); |
| 291 | 291 | $stringtoadd = preg_replace('/myobject/', strtolower($objectnameloop), $stringtoadd); |
| 292 | 292 | |
| 293 | - $moduledescriptorfile=$destdir.'/core/modules/mod'.$module.'.class.php'; |
|
| 293 | + $moduledescriptorfile = $destdir.'/core/modules/mod'.$module.'.class.php'; |
|
| 294 | 294 | |
| 295 | 295 | // TODO Allow a replace with regex using dolReplaceRegexInFile |
| 296 | 296 | // TODO Avoid duplicate addition |
@@ -298,22 +298,22 @@ discard block |
||
| 298 | 298 | dolReplaceInFile($moduledescriptorfile, array('END MODULEBUILDER LEFTMENU MYOBJECT */' => '*/'."\n".$stringtoadd."\n\t\t/* END MODULEBUILDER LEFTMENU MYOBJECT */")); |
| 299 | 299 | |
| 300 | 300 | // Add module descriptor to list of files to replace "MyObject' string with real name of object. |
| 301 | - $filetogenerate[]='core/modules/mod'.$module.'.class.php'; |
|
| 301 | + $filetogenerate[] = 'core/modules/mod'.$module.'.class.php'; |
|
| 302 | 302 | |
| 303 | 303 | // TODO |
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - if (! $error) |
|
| 308 | + if (!$error) |
|
| 309 | 309 | { |
| 310 | 310 | // Edit PHP files |
| 311 | - foreach($filetogenerate as $destfile) |
|
| 311 | + foreach ($filetogenerate as $destfile) |
|
| 312 | 312 | { |
| 313 | 313 | $phpfileval['fullname'] = $destdir.'/'.$destfile; |
| 314 | 314 | |
| 315 | 315 | //var_dump($phpfileval['fullname']); |
| 316 | - $arrayreplacement=array( |
|
| 316 | + $arrayreplacement = array( |
|
| 317 | 317 | 'mymodule'=>strtolower($module), |
| 318 | 318 | 'MyModule'=>$module, |
| 319 | 319 | 'MYMODULE'=>strtoupper($module), |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | 'MyObject'=>$objectname |
| 327 | 327 | ); |
| 328 | 328 | |
| 329 | - $result=dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); |
|
| 329 | + $result = dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); |
|
| 330 | 330 | //var_dump($result); |
| 331 | 331 | if ($result < 0) |
| 332 | 332 | { |
@@ -335,26 +335,26 @@ discard block |
||
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - if (! $error) |
|
| 338 | + if (!$error) |
|
| 339 | 339 | { |
| 340 | 340 | // Edit the class file to write properties |
| 341 | - $object=rebuildObjectClass($destdir, $module, $objectname, $newmask); |
|
| 341 | + $object = rebuildObjectClass($destdir, $module, $objectname, $newmask); |
|
| 342 | 342 | if (is_numeric($object) && $object < 0) $error++; |
| 343 | 343 | } |
| 344 | - if (! $error) |
|
| 344 | + if (!$error) |
|
| 345 | 345 | { |
| 346 | 346 | // Edit sql with new properties |
| 347 | - $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, '', $object); |
|
| 347 | + $result = rebuildObjectSql($destdir, $module, $objectname, $newmask, '', $object); |
|
| 348 | 348 | if ($result < 0) $error++; |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | - if (! $error) |
|
| 351 | + if (!$error) |
|
| 352 | 352 | { |
| 353 | 353 | setEventMessages($langs->trans('FilesForObjectInitialized', $objectname), null); |
| 354 | 354 | } |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | -if ($dirins && $action == 'addproperty' && !empty($module) && ! empty($tabobj)) |
|
| 357 | +if ($dirins && $action == 'addproperty' && !empty($module) && !empty($tabobj)) |
|
| 358 | 358 | { |
| 359 | 359 | $objectname = $tabobj; |
| 360 | 360 | |
@@ -363,35 +363,35 @@ discard block |
||
| 363 | 363 | dol_mkdir($destdir); |
| 364 | 364 | |
| 365 | 365 | $addfieldentry = array( |
| 366 | - 'name'=>GETPOST('propname','aZ09'),'label'=>GETPOST('proplabel','alpha'),'type'=>GETPOST('proptype','alpha'), |
|
| 367 | - 'arrayofkeyval'=>GETPOST('proparrayofkeyval','none'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}' |
|
| 368 | - 'visible'=>GETPOST('propvisible','int'),'enabled'=>GETPOST('propenabled','int'), |
|
| 369 | - 'position'=>GETPOST('propposition','int'),'notnull'=>GETPOST('propnotnull','int'),'index'=>GETPOST('propindex','int'),'searchall'=>GETPOST('propsearchall','int'), |
|
| 370 | - 'isameasure'=>GETPOST('propisameasure','int'), 'comment'=>GETPOST('propcomment','alpha'),'help'=>GETPOST('prophelp')); |
|
| 366 | + 'name'=>GETPOST('propname', 'aZ09'), 'label'=>GETPOST('proplabel', 'alpha'), 'type'=>GETPOST('proptype', 'alpha'), |
|
| 367 | + 'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'none'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}' |
|
| 368 | + 'visible'=>GETPOST('propvisible', 'int'), 'enabled'=>GETPOST('propenabled', 'int'), |
|
| 369 | + 'position'=>GETPOST('propposition', 'int'), 'notnull'=>GETPOST('propnotnull', 'int'), 'index'=>GETPOST('propindex', 'int'), 'searchall'=>GETPOST('propsearchall', 'int'), |
|
| 370 | + 'isameasure'=>GETPOST('propisameasure', 'int'), 'comment'=>GETPOST('propcomment', 'alpha'), 'help'=>GETPOST('prophelp')); |
|
| 371 | 371 | |
| 372 | - if (! empty($addfieldentry['arrayofkeyval']) && ! is_array($addfieldentry['arrayofkeyval'])) |
|
| 372 | + if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) |
|
| 373 | 373 | { |
| 374 | 374 | $addfieldentry['arrayofkeyval'] = dol_json_decode($addfieldentry['arrayofkeyval'], true); |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | // Edit the class file to write properties |
| 378 | - if (! $error) |
|
| 378 | + if (!$error) |
|
| 379 | 379 | { |
| 380 | - $object=rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry); |
|
| 380 | + $object = rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry); |
|
| 381 | 381 | if (is_numeric($result) && $result <= 0) $error++; |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | // Edit sql with new properties |
| 385 | - if (! $error) |
|
| 385 | + if (!$error) |
|
| 386 | 386 | { |
| 387 | - $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object); |
|
| 387 | + $result = rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object); |
|
| 388 | 388 | if ($result <= 0) |
| 389 | 389 | { |
| 390 | 390 | $error++; |
| 391 | 391 | } |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | - if (! $error) |
|
| 394 | + if (!$error) |
|
| 395 | 395 | { |
| 396 | 396 | clearstatcache(); |
| 397 | 397 | |
@@ -414,20 +414,20 @@ discard block |
||
| 414 | 414 | dol_mkdir($destdir); |
| 415 | 415 | |
| 416 | 416 | // Edit the class file to write properties |
| 417 | - if (! $error) |
|
| 417 | + if (!$error) |
|
| 418 | 418 | { |
| 419 | - $object=rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, array(), $propertykey); |
|
| 419 | + $object = rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, array(), $propertykey); |
|
| 420 | 420 | if (is_numeric($object) && $object <= 0) $error++; |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | // Edit sql with new properties |
| 424 | - if (! $error) |
|
| 424 | + if (!$error) |
|
| 425 | 425 | { |
| 426 | - $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object); |
|
| 426 | + $result = rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object); |
|
| 427 | 427 | if ($result <= 0) $error++; |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | - if (! $error) |
|
| 430 | + if (!$error) |
|
| 431 | 431 | { |
| 432 | 432 | clearstatcache(); |
| 433 | 433 | |
@@ -449,9 +449,9 @@ discard block |
||
| 449 | 449 | setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | - if (! $error) |
|
| 452 | + if (!$error) |
|
| 453 | 453 | { |
| 454 | - $modulelowercase=strtolower($module); |
|
| 454 | + $modulelowercase = strtolower($module); |
|
| 455 | 455 | |
| 456 | 456 | // Dir for module |
| 457 | 457 | $dir = $dirins.'/'.$modulelowercase; |
@@ -482,10 +482,10 @@ discard block |
||
| 482 | 482 | setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | - if (! $error) |
|
| 485 | + if (!$error) |
|
| 486 | 486 | { |
| 487 | - $modulelowercase=strtolower($module); |
|
| 488 | - $objectlowercase=strtolower($objectname); |
|
| 487 | + $modulelowercase = strtolower($module); |
|
| 488 | + $objectlowercase = strtolower($objectname); |
|
| 489 | 489 | |
| 490 | 490 | // Dir for module |
| 491 | 491 | $dir = $dirins.'/'.$modulelowercase; |
@@ -509,10 +509,10 @@ discard block |
||
| 509 | 509 | ); |
| 510 | 510 | |
| 511 | 511 | $resultko = 0; |
| 512 | - foreach($filetogenerate as $filetodelete) |
|
| 512 | + foreach ($filetogenerate as $filetodelete) |
|
| 513 | 513 | { |
| 514 | 514 | $resulttmp = dol_delete_file($dir.'/'.$filetodelete, 0, 0, 1); |
| 515 | - if (! $resulttmp) $resultko++; |
|
| 515 | + if (!$resulttmp) $resultko++; |
|
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | if ($resultko == 0) |
@@ -534,23 +534,23 @@ discard block |
||
| 534 | 534 | |
| 535 | 535 | if ($dirins && $action == 'generatepackage') |
| 536 | 536 | { |
| 537 | - $modulelowercase=strtolower($module); |
|
| 537 | + $modulelowercase = strtolower($module); |
|
| 538 | 538 | |
| 539 | 539 | // Dir for module |
| 540 | 540 | $dir = $dirins.'/'.$modulelowercase; |
| 541 | 541 | // Zip file to build |
| 542 | - $FILENAMEZIP=''; |
|
| 542 | + $FILENAMEZIP = ''; |
|
| 543 | 543 | |
| 544 | 544 | // Load module |
| 545 | 545 | dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); |
| 546 | - $class='mod'.$module; |
|
| 546 | + $class = 'mod'.$module; |
|
| 547 | 547 | |
| 548 | 548 | if (class_exists($class)) |
| 549 | 549 | { |
| 550 | 550 | try { |
| 551 | 551 | $moduleobj = new $class($db); |
| 552 | 552 | } |
| 553 | - catch(Exception $e) |
|
| 553 | + catch (Exception $e) |
|
| 554 | 554 | { |
| 555 | 555 | $error++; |
| 556 | 556 | dol_print_error($e->getMessage()); |
@@ -564,16 +564,16 @@ discard block |
||
| 564 | 564 | exit; |
| 565 | 565 | } |
| 566 | 566 | |
| 567 | - $arrayversion=explode('.',$moduleobj->version,3); |
|
| 567 | + $arrayversion = explode('.', $moduleobj->version, 3); |
|
| 568 | 568 | if (count($arrayversion)) |
| 569 | 569 | { |
| 570 | - $FILENAMEZIP="module_".$modulelowercase.'-'.$arrayversion[0].'.'.$arrayversion[1].($arrayversion[2]?".".$arrayversion[2]:"").".zip"; |
|
| 570 | + $FILENAMEZIP = "module_".$modulelowercase.'-'.$arrayversion[0].'.'.$arrayversion[1].($arrayversion[2] ? ".".$arrayversion[2] : "").".zip"; |
|
| 571 | 571 | |
| 572 | 572 | $dirofmodule = dol_buildpath($modulelowercase, 0).'/bin'; |
| 573 | 573 | $outputfilezip = $dirofmodule.'/'.$FILENAMEZIP; |
| 574 | 574 | if ($dirofmodule) |
| 575 | 575 | { |
| 576 | - if (! dol_is_dir($dirofmodule)) dol_mkdir($dirofmodule); |
|
| 576 | + if (!dol_is_dir($dirofmodule)) dol_mkdir($dirofmodule); |
|
| 577 | 577 | $result = dol_compress_dir($dir, $outputfilezip, 'zip'); |
| 578 | 578 | } |
| 579 | 579 | else |
@@ -602,23 +602,23 @@ discard block |
||
| 602 | 602 | |
| 603 | 603 | if ($dirins && $action == 'generatedoc') |
| 604 | 604 | { |
| 605 | - $modulelowercase=strtolower($module); |
|
| 605 | + $modulelowercase = strtolower($module); |
|
| 606 | 606 | |
| 607 | 607 | // Dir for module |
| 608 | 608 | $dir = $dirins.'/'.$modulelowercase; |
| 609 | 609 | // Zip file to build |
| 610 | - $FILENAMEDOC=''; |
|
| 610 | + $FILENAMEDOC = ''; |
|
| 611 | 611 | |
| 612 | 612 | // Load module |
| 613 | 613 | dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); |
| 614 | - $class='mod'.$module; |
|
| 614 | + $class = 'mod'.$module; |
|
| 615 | 615 | |
| 616 | 616 | if (class_exists($class)) |
| 617 | 617 | { |
| 618 | 618 | try { |
| 619 | 619 | $moduleobj = new $class($db); |
| 620 | 620 | } |
| 621 | - catch(Exception $e) |
|
| 621 | + catch (Exception $e) |
|
| 622 | 622 | { |
| 623 | 623 | $error++; |
| 624 | 624 | dol_print_error($e->getMessage()); |
@@ -632,16 +632,16 @@ discard block |
||
| 632 | 632 | exit; |
| 633 | 633 | } |
| 634 | 634 | |
| 635 | - $arrayversion=explode('.',$moduleobj->version,3); |
|
| 635 | + $arrayversion = explode('.', $moduleobj->version, 3); |
|
| 636 | 636 | if (count($arrayversion)) |
| 637 | 637 | { |
| 638 | - $FILENAMEDOC=$modulelowercase.'.html'; |
|
| 638 | + $FILENAMEDOC = $modulelowercase.'.html'; |
|
| 639 | 639 | |
| 640 | 640 | $dirofmodule = dol_buildpath($modulelowercase, 0).'/doc'; |
| 641 | 641 | $outputfiledoc = $dirofmodule.'/'.$FILENAMEDOC; |
| 642 | 642 | if ($dirofmodule) |
| 643 | 643 | { |
| 644 | - if (! dol_is_dir($dirofmodule)) dol_mkdir($dirofmodule); |
|
| 644 | + if (!dol_is_dir($dirofmodule)) dol_mkdir($dirofmodule); |
|
| 645 | 645 | //... |
| 646 | 646 | |
| 647 | 647 | $result = 0; |
@@ -678,10 +678,10 @@ discard block |
||
| 678 | 678 | if ($relofcustom) |
| 679 | 679 | { |
| 680 | 680 | // Check that relative path ($file) start with name 'custom' |
| 681 | - if (! preg_match('/^'.$relofcustom.'/', $file)) $file=$relofcustom.'/'.$file; |
|
| 681 | + if (!preg_match('/^'.$relofcustom.'/', $file)) $file = $relofcustom.'/'.$file; |
|
| 682 | 682 | |
| 683 | - $pathoffile=dol_buildpath($file, 0); |
|
| 684 | - $pathoffilebackup=dol_buildpath($file.'.back', 0); |
|
| 683 | + $pathoffile = dol_buildpath($file, 0); |
|
| 684 | + $pathoffilebackup = dol_buildpath($file.'.back', 0); |
|
| 685 | 685 | |
| 686 | 686 | // Save old version |
| 687 | 687 | if (dol_is_file($pathoffile)) |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | dol_copy($pathoffile, $pathoffilebackup, 0, 1); |
| 690 | 690 | } |
| 691 | 691 | |
| 692 | - $content = GETPOST('editfilecontent','none'); |
|
| 692 | + $content = GETPOST('editfilecontent', 'none'); |
|
| 693 | 693 | |
| 694 | 694 | // Save file on disk |
| 695 | 695 | if ($content) |
@@ -712,24 +712,24 @@ discard block |
||
| 712 | 712 | // Enable module |
| 713 | 713 | if ($action == 'set' && $user->admin) |
| 714 | 714 | { |
| 715 | - $param=''; |
|
| 716 | - if ($module) $param.='&module='.$module; |
|
| 717 | - if ($tab) $param.='&tab='.$tab; |
|
| 718 | - if ($tabobj) $param.='&tabobj='.$tabobj; |
|
| 715 | + $param = ''; |
|
| 716 | + if ($module) $param .= '&module='.$module; |
|
| 717 | + if ($tab) $param .= '&tab='.$tab; |
|
| 718 | + if ($tabobj) $param .= '&tabobj='.$tabobj; |
|
| 719 | 719 | |
| 720 | - $value = GETPOST('value','alpha'); |
|
| 720 | + $value = GETPOST('value', 'alpha'); |
|
| 721 | 721 | $resarray = activateModule($value); |
| 722 | - if (! empty($resarray['errors'])) setEventMessages('', $resarray['errors'], 'errors'); |
|
| 722 | + if (!empty($resarray['errors'])) setEventMessages('', $resarray['errors'], 'errors'); |
|
| 723 | 723 | else |
| 724 | 724 | { |
| 725 | 725 | //var_dump($resarray);exit; |
| 726 | 726 | if ($resarray['nbperms'] > 0) |
| 727 | 727 | { |
| 728 | - $tmpsql="SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1"; |
|
| 729 | - $resqltmp=$db->query($tmpsql); |
|
| 728 | + $tmpsql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1"; |
|
| 729 | + $resqltmp = $db->query($tmpsql); |
|
| 730 | 730 | if ($resqltmp) |
| 731 | 731 | { |
| 732 | - $obj=$db->fetch_object($resqltmp); |
|
| 732 | + $obj = $db->fetch_object($resqltmp); |
|
| 733 | 733 | //var_dump($obj->nb);exit; |
| 734 | 734 | if ($obj && $obj->nb > 1) |
| 735 | 735 | { |
@@ -747,13 +747,13 @@ discard block |
||
| 747 | 747 | // Disable module |
| 748 | 748 | if ($action == 'reset' && $user->admin) |
| 749 | 749 | { |
| 750 | - $param=''; |
|
| 751 | - if ($module) $param.='&module='.$module; |
|
| 752 | - if ($tab) $param.='&tab='.$tab; |
|
| 753 | - if ($tabobj) $param.='&tabobj='.$tabobj; |
|
| 750 | + $param = ''; |
|
| 751 | + if ($module) $param .= '&module='.$module; |
|
| 752 | + if ($tab) $param .= '&tab='.$tab; |
|
| 753 | + if ($tabobj) $param .= '&tabobj='.$tabobj; |
|
| 754 | 754 | |
| 755 | - $value = GETPOST('value','alpha'); |
|
| 756 | - $result=unActivateModule($value); |
|
| 755 | + $value = GETPOST('value', 'alpha'); |
|
| 756 | + $result = unActivateModule($value); |
|
| 757 | 757 | if ($result) setEventMessages($result, null, 'errors'); |
| 758 | 758 | header("Location: ".$_SERVER["PHP_SELF"]."?".$param); |
| 759 | 759 | exit; |
@@ -768,11 +768,11 @@ discard block |
||
| 768 | 768 | $formadmin = new FormAdmin($db); |
| 769 | 769 | |
| 770 | 770 | // Set dir where external modules are installed |
| 771 | -if (! dol_is_dir($dirins)) |
|
| 771 | +if (!dol_is_dir($dirins)) |
|
| 772 | 772 | { |
| 773 | 773 | dol_mkdir($dirins); |
| 774 | 774 | } |
| 775 | -$dirins_ok=(dol_is_dir($dirins)); |
|
| 775 | +$dirins_ok = (dol_is_dir($dirins)); |
|
| 776 | 776 | |
| 777 | 777 | llxHeader('', $langs->trans("ModuleBuilder"), '', '', 0, 0, |
| 778 | 778 | array( |
@@ -783,20 +783,20 @@ discard block |
||
| 783 | 783 | ), array()); |
| 784 | 784 | |
| 785 | 785 | |
| 786 | -$text=$langs->trans("ModuleBuilder"); |
|
| 786 | +$text = $langs->trans("ModuleBuilder"); |
|
| 787 | 787 | |
| 788 | 788 | print load_fiche_titre($text, '', 'title_setup'); |
| 789 | 789 | |
| 790 | 790 | // Search modules to edit |
| 791 | -$listofmodules=array(); |
|
| 791 | +$listofmodules = array(); |
|
| 792 | 792 | |
| 793 | -$dirsincustom=dol_dir_list($dirread, 'directories'); |
|
| 793 | +$dirsincustom = dol_dir_list($dirread, 'directories'); |
|
| 794 | 794 | if (is_array($dirsincustom) && count($dirsincustom) > 0) { |
| 795 | 795 | foreach ($dirsincustom as $dircustomcursor) { |
| 796 | 796 | $fullname = $dircustomcursor['fullname']; |
| 797 | - if (dol_is_file($fullname . '/' . $FILEFLAG)) { |
|
| 797 | + if (dol_is_file($fullname.'/'.$FILEFLAG)) { |
|
| 798 | 798 | // Get real name of module (MyModule instead of mymodule) |
| 799 | - $descriptorfiles = dol_dir_list($fullname . '/core/modules/', 'files', 0, 'mod.*\.class\.php$'); |
|
| 799 | + $descriptorfiles = dol_dir_list($fullname.'/core/modules/', 'files', 0, 'mod.*\.class\.php$'); |
|
| 800 | 800 | $modulenamewithcase = ''; |
| 801 | 801 | foreach ($descriptorfiles as $descriptorcursor) { |
| 802 | 802 | $modulenamewithcase = preg_replace('/^mod/', '', $descriptorcursor['name']); |
@@ -816,36 +816,36 @@ discard block |
||
| 816 | 816 | } |
| 817 | 817 | |
| 818 | 818 | // Show description of content |
| 819 | -$newdircustom=$dirins; |
|
| 820 | -if (empty($newdircustom)) $newdircustom=img_warning(); |
|
| 819 | +$newdircustom = $dirins; |
|
| 820 | +if (empty($newdircustom)) $newdircustom = img_warning(); |
|
| 821 | 821 | print $langs->trans("ModuleBuilderDesc", 'https://wiki.dolibarr.org/index.php/Module_development#Create_your_module').'<br>'; |
| 822 | 822 | print $langs->trans("ModuleBuilderDesc2", 'conf/conf.php', $newdircustom).'<br>'; |
| 823 | 823 | // If dirread was forced to somewhere else, by using URL |
| 824 | 824 | // htdocs/modulebuilder/index.php?module=Inventory@/home/ldestailleur/git/dolibarr/htdocs/product |
| 825 | 825 | if ($forceddirread) print $langs->trans("DirScanned").' : <strong>'.$dirread.'</strong><br>'; |
| 826 | 826 | |
| 827 | -$message=''; |
|
| 828 | -if (! $dirins) |
|
| 827 | +$message = ''; |
|
| 828 | +if (!$dirins) |
|
| 829 | 829 | { |
| 830 | - $message=info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT)); |
|
| 831 | - $allowfromweb=-1; |
|
| 830 | + $message = info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT)); |
|
| 831 | + $allowfromweb = -1; |
|
| 832 | 832 | } |
| 833 | 833 | else |
| 834 | 834 | { |
| 835 | 835 | if ($dirins_ok) |
| 836 | 836 | { |
| 837 | - if (! is_writable(dol_osencode($dirins))) |
|
| 837 | + if (!is_writable(dol_osencode($dirins))) |
|
| 838 | 838 | { |
| 839 | 839 | $langs->load("errors"); |
| 840 | - $message=info_admin($langs->trans("ErrorFailedToWriteInDir",$dirins)); |
|
| 841 | - $allowfromweb=0; |
|
| 840 | + $message = info_admin($langs->trans("ErrorFailedToWriteInDir", $dirins)); |
|
| 841 | + $allowfromweb = 0; |
|
| 842 | 842 | } |
| 843 | 843 | } |
| 844 | 844 | else |
| 845 | 845 | { |
| 846 | 846 | |
| 847 | - $message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); |
|
| 848 | - $allowfromweb=0; |
|
| 847 | + $message = info_admin($langs->trans("NotExistsDirect", $dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); |
|
| 848 | + $allowfromweb = 0; |
|
| 849 | 849 | } |
| 850 | 850 | } |
| 851 | 851 | if ($message) |
@@ -858,23 +858,23 @@ discard block |
||
| 858 | 858 | |
| 859 | 859 | |
| 860 | 860 | // Load module descriptor |
| 861 | -$error=0; |
|
| 861 | +$error = 0; |
|
| 862 | 862 | $moduleobj = null; |
| 863 | 863 | |
| 864 | -if (! empty($module) && $module != 'initmodule' && $module != 'deletemodule') |
|
| 864 | +if (!empty($module) && $module != 'initmodule' && $module != 'deletemodule') |
|
| 865 | 865 | { |
| 866 | - $modulelowercase=strtolower($module); |
|
| 866 | + $modulelowercase = strtolower($module); |
|
| 867 | 867 | |
| 868 | 868 | // Load module |
| 869 | 869 | dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); |
| 870 | - $class='mod'.$module; |
|
| 870 | + $class = 'mod'.$module; |
|
| 871 | 871 | |
| 872 | 872 | if (class_exists($class)) |
| 873 | 873 | { |
| 874 | 874 | try { |
| 875 | 875 | $moduleobj = new $class($db); |
| 876 | 876 | } |
| 877 | - catch(Exception $e) |
|
| 877 | + catch (Exception $e) |
|
| 878 | 878 | { |
| 879 | 879 | $error++; |
| 880 | 880 | print $e->getMessage(); |
@@ -893,16 +893,16 @@ discard block |
||
| 893 | 893 | |
| 894 | 894 | // Tabs for all modules |
| 895 | 895 | $head = array(); |
| 896 | -$h=0; |
|
| 896 | +$h = 0; |
|
| 897 | 897 | |
| 898 | 898 | $head[$h][0] = $_SERVER["PHP_SELF"].'?module=initmodule'; |
| 899 | 899 | $head[$h][1] = $langs->trans("NewModule"); |
| 900 | 900 | $head[$h][2] = 'initmodule'; |
| 901 | 901 | $h++; |
| 902 | 902 | |
| 903 | -foreach($listofmodules as $tmpmodule => $tmpmodulewithcase) |
|
| 903 | +foreach ($listofmodules as $tmpmodule => $tmpmodulewithcase) |
|
| 904 | 904 | { |
| 905 | - $head[$h][0] = $_SERVER["PHP_SELF"].'?module='.$tmpmodulewithcase.($forceddirread?'@'.$dirread:''); |
|
| 905 | + $head[$h][0] = $_SERVER["PHP_SELF"].'?module='.$tmpmodulewithcase.($forceddirread ? '@'.$dirread : ''); |
|
| 906 | 906 | $head[$h][1] = $tmpmodulewithcase; |
| 907 | 907 | $head[$h][2] = $tmpmodulewithcase; |
| 908 | 908 | $h++; |
@@ -914,7 +914,7 @@ discard block |
||
| 914 | 914 | $h++; |
| 915 | 915 | |
| 916 | 916 | |
| 917 | -dol_fiche_head($head, $module, $langs->trans("Modules"), -1, 'generic', 0, $infomodulesfound); // Modules |
|
| 917 | +dol_fiche_head($head, $module, $langs->trans("Modules"), -1, 'generic', 0, $infomodulesfound); // Modules |
|
| 918 | 918 | |
| 919 | 919 | if ($module == 'initmodule') |
| 920 | 920 | { |
@@ -927,7 +927,7 @@ discard block |
||
| 927 | 927 | print $langs->trans("EnterNameOfModuleDesc").'<br><br>'; |
| 928 | 928 | |
| 929 | 929 | print '<input type="text" name="modulename" value="'.dol_escape_htmltag($modulename).'" placeholder="'.dol_escape_htmltag($langs->trans("ModuleKey")).'">'; |
| 930 | - print '<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans("Create")).'"'.($dirins?'':' disabled="disabled"').'>'; |
|
| 930 | + print '<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans("Create")).'"'.($dirins ? '' : ' disabled="disabled"').'>'; |
|
| 931 | 931 | print '</form>'; |
| 932 | 932 | } |
| 933 | 933 | elseif ($module == 'deletemodule') |
@@ -940,99 +940,99 @@ discard block |
||
| 940 | 940 | print $langs->trans("EnterNameOfModuleToDeleteDesc").'<br><br>'; |
| 941 | 941 | |
| 942 | 942 | print '<input type="text" name="module" placeholder="'.dol_escape_htmltag($langs->trans("ModuleKey")).'" value="">'; |
| 943 | - print '<input type="submit" class="buttonDelete" value="'.$langs->trans("Delete").'"'.($dirins?'':' disabled="disabled"').'>'; |
|
| 943 | + print '<input type="submit" class="buttonDelete" value="'.$langs->trans("Delete").'"'.($dirins ? '' : ' disabled="disabled"').'>'; |
|
| 944 | 944 | print '</form>'; |
| 945 | 945 | } |
| 946 | -elseif (! empty($module)) |
|
| 946 | +elseif (!empty($module)) |
|
| 947 | 947 | { |
| 948 | 948 | // Tabs for module |
| 949 | - if (! $error) |
|
| 949 | + if (!$error) |
|
| 950 | 950 | { |
| 951 | 951 | $head2 = array(); |
| 952 | - $h=0; |
|
| 952 | + $h = 0; |
|
| 953 | 953 | |
| 954 | - $modulelowercase=strtolower($module); |
|
| 954 | + $modulelowercase = strtolower($module); |
|
| 955 | 955 | $const_name = 'MAIN_MODULE_'.strtoupper($module); |
| 956 | 956 | |
| 957 | - $param=''; |
|
| 958 | - if ($tab) $param.= '&tab='.$tab; |
|
| 959 | - if ($module) $param.='&module='.$module; |
|
| 960 | - if ($tabobj) $param.='&tabobj='.$tabobj; |
|
| 957 | + $param = ''; |
|
| 958 | + if ($tab) $param .= '&tab='.$tab; |
|
| 959 | + if ($module) $param .= '&module='.$module; |
|
| 960 | + if ($tabobj) $param .= '&tabobj='.$tabobj; |
|
| 961 | 961 | |
| 962 | - $urltomodulesetup='<a href="'.DOL_URL_ROOT.'/admin/modules.php?search_keyword='.urlencode($module).'">'.$langs->trans('Home').'-'.$langs->trans("Setup").'-'.$langs->trans("Modules").'</a>'; |
|
| 963 | - $linktoenabledisable=''; |
|
| 964 | - if (! empty($conf->global->$const_name)) // If module is already activated |
|
| 962 | + $urltomodulesetup = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?search_keyword='.urlencode($module).'">'.$langs->trans('Home').'-'.$langs->trans("Setup").'-'.$langs->trans("Modules").'</a>'; |
|
| 963 | + $linktoenabledisable = ''; |
|
| 964 | + if (!empty($conf->global->$const_name)) // If module is already activated |
|
| 965 | 965 | { |
| 966 | - $linktoenabledisable.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=reset&value=mod' . $module . $param . '">'; |
|
| 967 | - $linktoenabledisable.=img_picto($langs->trans("Activated"),'switch_on'); |
|
| 968 | - $linktoenabledisable.='</a>'; |
|
| 966 | + $linktoenabledisable .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=reset&value=mod'.$module.$param.'">'; |
|
| 967 | + $linktoenabledisable .= img_picto($langs->trans("Activated"), 'switch_on'); |
|
| 968 | + $linktoenabledisable .= '</a>'; |
|
| 969 | 969 | } |
| 970 | 970 | else |
| 971 | 971 | { |
| 972 | - $linktoenabledisable.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=set&value=mod' . $module . $param . '">'; |
|
| 973 | - $linktoenabledisable.=img_picto($langs->trans("Disabled"),'switch_off'); |
|
| 974 | - $linktoenabledisable.="</a>\n"; |
|
| 972 | + $linktoenabledisable .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=set&value=mod'.$module.$param.'">'; |
|
| 973 | + $linktoenabledisable .= img_picto($langs->trans("Disabled"), 'switch_off'); |
|
| 974 | + $linktoenabledisable .= "</a>\n"; |
|
| 975 | 975 | } |
| 976 | - if (! empty($conf->$modulelowercase->enabled)) |
|
| 976 | + if (!empty($conf->$modulelowercase->enabled)) |
|
| 977 | 977 | { |
| 978 | - $modulestatusinfo=img_warning().' '.$langs->trans("ModuleIsLive"); |
|
| 978 | + $modulestatusinfo = img_warning().' '.$langs->trans("ModuleIsLive"); |
|
| 979 | 979 | } |
| 980 | 980 | else |
| 981 | 981 | { |
| 982 | - $modulestatusinfo=img_info('').' '.$langs->trans("ModuleIsNotActive", $urltomodulesetup); |
|
| 982 | + $modulestatusinfo = img_info('').' '.$langs->trans("ModuleIsNotActive", $urltomodulesetup); |
|
| 983 | 983 | } |
| 984 | 984 | |
| 985 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=description&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 985 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=description&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
| 986 | 986 | $head2[$h][1] = $langs->trans("Description"); |
| 987 | 987 | $head2[$h][2] = 'description'; |
| 988 | 988 | $h++; |
| 989 | 989 | |
| 990 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=specifications&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 990 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=specifications&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
| 991 | 991 | $head2[$h][1] = $langs->trans("Specifications"); |
| 992 | 992 | $head2[$h][2] = 'specifications'; |
| 993 | 993 | $h++; |
| 994 | 994 | |
| 995 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=languages&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 995 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=languages&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
| 996 | 996 | $head2[$h][1] = $langs->trans("Languages"); |
| 997 | 997 | $head2[$h][2] = 'languages'; |
| 998 | 998 | $h++; |
| 999 | 999 | |
| 1000 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1000 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
| 1001 | 1001 | $head2[$h][1] = $langs->trans("Objects"); |
| 1002 | 1002 | $head2[$h][2] = 'objects'; |
| 1003 | 1003 | $h++; |
| 1004 | 1004 | |
| 1005 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=menus&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1005 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=menus&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
| 1006 | 1006 | $head2[$h][1] = $langs->trans("Menus"); |
| 1007 | 1007 | $head2[$h][2] = 'menus'; |
| 1008 | 1008 | $h++; |
| 1009 | 1009 | |
| 1010 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=permissions&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1010 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=permissions&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
| 1011 | 1011 | $head2[$h][1] = $langs->trans("Permissions"); |
| 1012 | 1012 | $head2[$h][2] = 'permissions'; |
| 1013 | 1013 | $h++; |
| 1014 | 1014 | |
| 1015 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=hooks&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1015 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=hooks&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
| 1016 | 1016 | $head2[$h][1] = $langs->trans("Hooks"); |
| 1017 | 1017 | $head2[$h][2] = 'hooks'; |
| 1018 | 1018 | $h++; |
| 1019 | 1019 | |
| 1020 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=triggers&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1020 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=triggers&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
| 1021 | 1021 | $head2[$h][1] = $langs->trans("Triggers"); |
| 1022 | 1022 | $head2[$h][2] = 'triggers'; |
| 1023 | 1023 | $h++; |
| 1024 | 1024 | |
| 1025 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=widgets&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1025 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=widgets&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
| 1026 | 1026 | $head2[$h][1] = $langs->trans("Widgets"); |
| 1027 | 1027 | $head2[$h][2] = 'widgets'; |
| 1028 | 1028 | $h++; |
| 1029 | 1029 | |
| 1030 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=cron&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1030 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=cron&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
| 1031 | 1031 | $head2[$h][1] = $langs->trans("CronList"); |
| 1032 | 1032 | $head2[$h][2] = 'cron'; |
| 1033 | 1033 | $h++; |
| 1034 | 1034 | |
| 1035 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=buildpackage&module='.$module.($forceddirread?'@'.$dirread:''); |
|
| 1035 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=buildpackage&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
| 1036 | 1036 | $head2[$h][1] = $langs->trans("BuildPackage"); |
| 1037 | 1037 | $head2[$h][2] = 'buildpackage'; |
| 1038 | 1038 | $h++; |
@@ -1049,20 +1049,20 @@ discard block |
||
| 1049 | 1049 | |
| 1050 | 1050 | if ($action != 'editfile' || empty($file)) |
| 1051 | 1051 | { |
| 1052 | - dol_fiche_head($head2, $tab, '', -1, ''); // Description - level 2 |
|
| 1052 | + dol_fiche_head($head2, $tab, '', -1, ''); // Description - level 2 |
|
| 1053 | 1053 | |
| 1054 | 1054 | print $langs->trans("ModuleBuilderDesc".$tab).'<br><br>'; |
| 1055 | 1055 | |
| 1056 | 1056 | print '<span class="fa fa-file"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>'; |
| 1057 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1057 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1058 | 1058 | print '<br>'; |
| 1059 | 1059 | |
| 1060 | 1060 | print '<span class="fa fa-file"></span> '.$langs->trans("ReadmeFile").' : <strong>'.$pathtofilereadme.'</strong>'; |
| 1061 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=markdown&file='.urlencode($pathtofilereadme).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1061 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=markdown&file='.urlencode($pathtofilereadme).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1062 | 1062 | print '<br>'; |
| 1063 | 1063 | |
| 1064 | 1064 | print '<span class="fa fa-file"></span> '.$langs->trans("ChangeLog").' : <strong>'.$pathtochangelog.'</strong>'; |
| 1065 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=markdown&file='.urlencode($pathtochangelog).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1065 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=markdown&file='.urlencode($pathtochangelog).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1066 | 1066 | print '<br>'; |
| 1067 | 1067 | |
| 1068 | 1068 | print '<br>'; |
@@ -1070,7 +1070,7 @@ discard block |
||
| 1070 | 1070 | |
| 1071 | 1071 | print_fiche_titre($langs->trans("DescriptorFile")); |
| 1072 | 1072 | |
| 1073 | - if (! empty($moduleobj)) |
|
| 1073 | + if (!empty($moduleobj)) |
|
| 1074 | 1074 | { |
| 1075 | 1075 | print '<div class="underbanner clearboth"></div>'; |
| 1076 | 1076 | print '<div class="fichecenter">'; |
@@ -1160,7 +1160,7 @@ discard block |
||
| 1160 | 1160 | } |
| 1161 | 1161 | else |
| 1162 | 1162 | { |
| 1163 | - $fullpathoffile=dol_buildpath($file, 0, 1); // Description - level 2 |
|
| 1163 | + $fullpathoffile = dol_buildpath($file, 0, 1); // Description - level 2 |
|
| 1164 | 1164 | |
| 1165 | 1165 | if ($fullpathoffile) |
| 1166 | 1166 | { |
@@ -1177,8 +1177,8 @@ discard block |
||
| 1177 | 1177 | |
| 1178 | 1178 | dol_fiche_head($head2, $tab, '', -1, ''); |
| 1179 | 1179 | |
| 1180 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%', ''); |
|
| 1181 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 1180 | + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%', ''); |
|
| 1181 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); |
|
| 1182 | 1182 | |
| 1183 | 1183 | dol_fiche_end(); |
| 1184 | 1184 | |
@@ -1193,7 +1193,7 @@ discard block |
||
| 1193 | 1193 | } |
| 1194 | 1194 | else |
| 1195 | 1195 | { |
| 1196 | - dol_fiche_head($head2, $tab, '', -1, ''); // Level 2 |
|
| 1196 | + dol_fiche_head($head2, $tab, '', -1, ''); // Level 2 |
|
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | 1199 | |
@@ -1204,13 +1204,13 @@ discard block |
||
| 1204 | 1204 | print $langs->trans("SpecDefDesc").'<br>'; |
| 1205 | 1205 | print '<br>'; |
| 1206 | 1206 | |
| 1207 | - $specs=dol_dir_list(dol_buildpath($modulelowercase.'/doc', 0), 'files', 1, '(\.md|\.asciidoc)$'); |
|
| 1207 | + $specs = dol_dir_list(dol_buildpath($modulelowercase.'/doc', 0), 'files', 1, '(\.md|\.asciidoc)$'); |
|
| 1208 | 1208 | |
| 1209 | 1209 | foreach ($specs as $spec) |
| 1210 | 1210 | { |
| 1211 | 1211 | $pathtofile = $modulelowercase.'/doc/'.$spec['relativename']; |
| 1212 | - $format='asciidoc'; |
|
| 1213 | - if (preg_match('/\.md$/i', $spec['name'])) $format='markdown'; |
|
| 1212 | + $format = 'asciidoc'; |
|
| 1213 | + if (preg_match('/\.md$/i', $spec['name'])) $format = 'markdown'; |
|
| 1214 | 1214 | print '<span class="fa fa-file"></span> '.$langs->trans("SpecificationFile").' : <strong>'.$pathtofile.'</strong>'; |
| 1215 | 1215 | print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format='.$format.'&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
| 1216 | 1216 | print '<br>'; |
@@ -1222,7 +1222,7 @@ discard block |
||
| 1222 | 1222 | |
| 1223 | 1223 | //print $langs->trans("UseAsciiDocFormat").'<br>'; |
| 1224 | 1224 | |
| 1225 | - $fullpathoffile=dol_buildpath($file, 0); |
|
| 1225 | + $fullpathoffile = dol_buildpath($file, 0); |
|
| 1226 | 1226 | |
| 1227 | 1227 | $content = file_get_contents($fullpathoffile); |
| 1228 | 1228 | |
@@ -1234,8 +1234,8 @@ discard block |
||
| 1234 | 1234 | print '<input type="hidden" name="tab" value="'.$tab.'">'; |
| 1235 | 1235 | print '<input type="hidden" name="module" value="'.$module.'">'; |
| 1236 | 1236 | |
| 1237 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 1238 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 1237 | + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 1238 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); |
|
| 1239 | 1239 | print '<br>'; |
| 1240 | 1240 | print '<center>'; |
| 1241 | 1241 | print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
@@ -1268,7 +1268,7 @@ discard block |
||
| 1268 | 1268 | print '<br>'; |
| 1269 | 1269 | print '<br>'; |
| 1270 | 1270 | |
| 1271 | - $langfiles=dol_dir_list(dol_buildpath($modulelowercase.'/langs', 0), 'files', 1, '\.lang$'); |
|
| 1271 | + $langfiles = dol_dir_list(dol_buildpath($modulelowercase.'/langs', 0), 'files', 1, '\.lang$'); |
|
| 1272 | 1272 | |
| 1273 | 1273 | foreach ($langfiles as $langfile) |
| 1274 | 1274 | { |
@@ -1284,7 +1284,7 @@ discard block |
||
| 1284 | 1284 | |
| 1285 | 1285 | //print $langs->trans("UseAsciiDocFormat").'<br>'; |
| 1286 | 1286 | |
| 1287 | - $fullpathoffile=dol_buildpath($file, 0); |
|
| 1287 | + $fullpathoffile = dol_buildpath($file, 0); |
|
| 1288 | 1288 | |
| 1289 | 1289 | $content = file_get_contents($fullpathoffile); |
| 1290 | 1290 | |
@@ -1296,8 +1296,8 @@ discard block |
||
| 1296 | 1296 | print '<input type="hidden" name="tab" value="'.$tab.'">'; |
| 1297 | 1297 | print '<input type="hidden" name="module" value="'.$module.'">'; |
| 1298 | 1298 | |
| 1299 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 1300 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'text')); |
|
| 1299 | + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 1300 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'text')); |
|
| 1301 | 1301 | print '<br>'; |
| 1302 | 1302 | print '<center>'; |
| 1303 | 1303 | print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
@@ -1312,12 +1312,12 @@ discard block |
||
| 1312 | 1312 | if ($tab == 'objects') |
| 1313 | 1313 | { |
| 1314 | 1314 | $head3 = array(); |
| 1315 | - $h=0; |
|
| 1315 | + $h = 0; |
|
| 1316 | 1316 | |
| 1317 | 1317 | // Dir for module |
| 1318 | 1318 | $dir = $dirread.'/'.$modulelowercase.'/class'; |
| 1319 | 1319 | |
| 1320 | - $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj=newobject'; |
|
| 1320 | + $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '').'&tabobj=newobject'; |
|
| 1321 | 1321 | $head3[$h][1] = $langs->trans("NewObject"); |
| 1322 | 1322 | $head3[$h][2] = 'newobject'; |
| 1323 | 1323 | $h++; |
@@ -1325,27 +1325,27 @@ discard block |
||
| 1325 | 1325 | // Scan for object class files |
| 1326 | 1326 | $listofobject = dol_dir_list($dir, 'files', 0, '\.class\.php$'); |
| 1327 | 1327 | |
| 1328 | - $firstobjectname=''; |
|
| 1329 | - foreach($listofobject as $fileobj) |
|
| 1328 | + $firstobjectname = ''; |
|
| 1329 | + foreach ($listofobject as $fileobj) |
|
| 1330 | 1330 | { |
| 1331 | - if (preg_match('/^api_/',$fileobj['name'])) continue; |
|
| 1332 | - if (preg_match('/^actions_/',$fileobj['name'])) continue; |
|
| 1331 | + if (preg_match('/^api_/', $fileobj['name'])) continue; |
|
| 1332 | + if (preg_match('/^actions_/', $fileobj['name'])) continue; |
|
| 1333 | 1333 | |
| 1334 | - $tmpcontent=file_get_contents($fileobj['fullname']); |
|
| 1335 | - if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims',$tmpcontent,$reg)) |
|
| 1334 | + $tmpcontent = file_get_contents($fileobj['fullname']); |
|
| 1335 | + if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) |
|
| 1336 | 1336 | { |
| 1337 | 1337 | //$objectname = preg_replace('/\.txt$/', '', $fileobj['name']); |
| 1338 | 1338 | $objectname = $reg[1]; |
| 1339 | 1339 | if (empty($firstobjectname)) $firstobjectname = $objectname; |
| 1340 | 1340 | |
| 1341 | - $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj='.$objectname; |
|
| 1341 | + $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '').'&tabobj='.$objectname; |
|
| 1342 | 1342 | $head3[$h][1] = $objectname; |
| 1343 | 1343 | $head3[$h][2] = $objectname; |
| 1344 | 1344 | $h++; |
| 1345 | 1345 | } |
| 1346 | 1346 | } |
| 1347 | 1347 | |
| 1348 | - $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj=deleteobject'; |
|
| 1348 | + $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '').'&tabobj=deleteobject'; |
|
| 1349 | 1349 | $head3[$h][1] = $langs->trans("DangerZone"); |
| 1350 | 1350 | $head3[$h][2] = 'deleteobject'; |
| 1351 | 1351 | $h++; |
@@ -1353,11 +1353,11 @@ discard block |
||
| 1353 | 1353 | // If tabobj was not defined, then we check if there is one obj. If yes, we force on it, if no, we will show tab to create new objects. |
| 1354 | 1354 | if ($tabobj == 'newobjectifnoobj') |
| 1355 | 1355 | { |
| 1356 | - if ($firstobjectname) $tabobj=$firstobjectname; |
|
| 1356 | + if ($firstobjectname) $tabobj = $firstobjectname; |
|
| 1357 | 1357 | else $tabobj = 'newobject'; |
| 1358 | 1358 | } |
| 1359 | 1359 | |
| 1360 | - dol_fiche_head($head3, $tabobj, '', -1, ''); // Level 3 |
|
| 1360 | + dol_fiche_head($head3, $tabobj, '', -1, ''); // Level 3 |
|
| 1361 | 1361 | |
| 1362 | 1362 | if ($tabobj == 'newobject') |
| 1363 | 1363 | { |
@@ -1371,7 +1371,7 @@ discard block |
||
| 1371 | 1371 | print $langs->trans("EnterNameOfObjectDesc").'<br><br>'; |
| 1372 | 1372 | |
| 1373 | 1373 | print '<input type="text" name="objectname" value="'.dol_escape_htmltag($modulename).'" placeholder="'.dol_escape_htmltag($langs->trans("ObjectKey")).'">'; |
| 1374 | - print '<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans("Create")).'"'.($dirins?'':' disabled="disabled"').'>'; |
|
| 1374 | + print '<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans("Create")).'"'.($dirins ? '' : ' disabled="disabled"').'>'; |
|
| 1375 | 1375 | print '</form>'; |
| 1376 | 1376 | } |
| 1377 | 1377 | elseif ($tabobj == 'deleteobject') |
@@ -1386,7 +1386,7 @@ discard block |
||
| 1386 | 1386 | print $langs->trans("EnterNameOfObjectToDeleteDesc").'<br><br>'; |
| 1387 | 1387 | |
| 1388 | 1388 | print '<input type="text" name="objectname" value="'.dol_escape_htmltag($modulename).'" placeholder="'.dol_escape_htmltag($langs->trans("ObjectKey")).'">'; |
| 1389 | - print '<input type="submit" class="buttonDelete" name="delete" value="'.dol_escape_htmltag($langs->trans("Delete")).'"'.($dirins?'':' disabled="disabled"').'>'; |
|
| 1389 | + print '<input type="submit" class="buttonDelete" name="delete" value="'.dol_escape_htmltag($langs->trans("Delete")).'"'.($dirins ? '' : ' disabled="disabled"').'>'; |
|
| 1390 | 1390 | print '</form>'; |
| 1391 | 1391 | } |
| 1392 | 1392 | else |
@@ -1394,8 +1394,8 @@ discard block |
||
| 1394 | 1394 | if ($action == 'deleteproperty') |
| 1395 | 1395 | { |
| 1396 | 1396 | $formconfirm = $form->formconfirm( |
| 1397 | - $_SERVER["PHP_SELF"].'?propertykey='.urlencode(GETPOST('propertykey','alpha')).'&objectname='.urlencode($objectname).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj), |
|
| 1398 | - $langs->trans('Delete'), $langs->trans('ConfirmDeleteProperty', GETPOST('propertykey','alpha')), 'confirm_deleteproperty', '', 0, 1 |
|
| 1397 | + $_SERVER["PHP_SELF"].'?propertykey='.urlencode(GETPOST('propertykey', 'alpha')).'&objectname='.urlencode($objectname).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj), |
|
| 1398 | + $langs->trans('Delete'), $langs->trans('ConfirmDeleteProperty', GETPOST('propertykey', 'alpha')), 'confirm_deleteproperty', '', 0, 1 |
|
| 1399 | 1399 | ); |
| 1400 | 1400 | |
| 1401 | 1401 | // Print form confirm |
@@ -1434,38 +1434,38 @@ discard block |
||
| 1434 | 1434 | $realpathtopicto = dol_buildpath($pathtopicto, 0, 1); |
| 1435 | 1435 | |
| 1436 | 1436 | print '<div class="fichehalfleft">'; |
| 1437 | - print '<span class="fa fa-file"></span> '.$langs->trans("ClassFile").' : <strong>'.($realpathtoclass?'':'<strike>').$pathtoclass.($realpathtoclass?'':'</strike>').'</strong>'; |
|
| 1438 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoclass).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1437 | + print '<span class="fa fa-file"></span> '.$langs->trans("ClassFile").' : <strong>'.($realpathtoclass ? '' : '<strike>').$pathtoclass.($realpathtoclass ? '' : '</strike>').'</strong>'; |
|
| 1438 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtoclass).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1439 | 1439 | print '<br>'; |
| 1440 | - print '<span class="fa fa-file"></span> '.$langs->trans("ApiClassFile").' : <strong>'.($realpathtoapi?'':'<strike>').$pathtoapi.($realpathtoapi?'':'</strike>').'</strong>'; |
|
| 1441 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoapi).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1440 | + print '<span class="fa fa-file"></span> '.$langs->trans("ApiClassFile").' : <strong>'.($realpathtoapi ? '' : '<strike>').$pathtoapi.($realpathtoapi ? '' : '</strike>').'</strong>'; |
|
| 1441 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtoapi).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1442 | 1442 | print ' <a href="'.DOL_URL_ROOT.'/api/index.php/explorer/" target="apiexplorer">'.$langs->trans("GoToApiExplorer").'</a>'; |
| 1443 | 1443 | print '<br>'; |
| 1444 | - print '<span class="fa fa-file"></span> '.$langs->trans("TestClassFile").' : <strong>'.($realpathtophpunit?'':'<strike>').$pathtophpunit.($realpathtophpunit?'':'</strike>').'</strong>'; |
|
| 1445 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtophpunit).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1444 | + print '<span class="fa fa-file"></span> '.$langs->trans("TestClassFile").' : <strong>'.($realpathtophpunit ? '' : '<strike>').$pathtophpunit.($realpathtophpunit ? '' : '</strike>').'</strong>'; |
|
| 1445 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtophpunit).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1446 | 1446 | print '<br>'; |
| 1447 | 1447 | |
| 1448 | 1448 | print '<br>'; |
| 1449 | 1449 | |
| 1450 | - print '<span class="fa fa-file"></span> '.$langs->trans("PageForLib").' : <strong>'.($realpathtolib?'':'<strike>').$pathtolib.($realpathtodocument?'':'</strike>').'</strong>'; |
|
| 1451 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtolib).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1450 | + print '<span class="fa fa-file"></span> '.$langs->trans("PageForLib").' : <strong>'.($realpathtolib ? '' : '<strike>').$pathtolib.($realpathtodocument ? '' : '</strike>').'</strong>'; |
|
| 1451 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtolib).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1452 | 1452 | print '<br>'; |
| 1453 | - print '<span class="fa fa-file"></span> '.$langs->trans("PageForPicto").' : <strong>'.($realpathtopicto?'':'<strike>').$pathtopicto.($realpathtopicto?'':'</strike>').'</strong>'; |
|
| 1453 | + print '<span class="fa fa-file"></span> '.$langs->trans("PageForPicto").' : <strong>'.($realpathtopicto ? '' : '<strike>').$pathtopicto.($realpathtopicto ? '' : '</strike>').'</strong>'; |
|
| 1454 | 1454 | //print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtopicto).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
| 1455 | 1455 | print '<br>'; |
| 1456 | 1456 | |
| 1457 | 1457 | print '<br>'; |
| 1458 | - print '<span class="fa fa-file"></span> '.$langs->trans("SqlFile").' : <strong>'.($realpathtosql?'':'<strike>').$pathtosql.($realpathtosql?'':'</strike>').'</strong>'; |
|
| 1459 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=sql&file='.urlencode($pathtosql).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1458 | + print '<span class="fa fa-file"></span> '.$langs->trans("SqlFile").' : <strong>'.($realpathtosql ? '' : '<strike>').$pathtosql.($realpathtosql ? '' : '</strike>').'</strong>'; |
|
| 1459 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=sql&file='.urlencode($pathtosql).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1460 | 1460 | print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("DropTableIfEmpty").'</a>'; |
| 1461 | 1461 | //print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>'; |
| 1462 | 1462 | print '<br>'; |
| 1463 | - print '<span class="fa fa-file"></span> '.$langs->trans("SqlFileExtraFields").' : <strong>'.($realpathtosqlextra?'':'<strike>').$pathtosqlextra.($realpathtosqlextra?'':'</strike>').'</strong>'; |
|
| 1464 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&file='.urlencode($pathtosqlextra).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1463 | + print '<span class="fa fa-file"></span> '.$langs->trans("SqlFileExtraFields").' : <strong>'.($realpathtosqlextra ? '' : '<strike>').$pathtosqlextra.($realpathtosqlextra ? '' : '</strike>').'</strong>'; |
|
| 1464 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&file='.urlencode($pathtosqlextra).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1465 | 1465 | //print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>'; |
| 1466 | 1466 | print '<br>'; |
| 1467 | - print '<span class="fa fa-file"></span> '.$langs->trans("SqlFileKey").' : <strong>'.($realpathtosqlkey?'':'<strike>').$pathtosqlkey.($realpathtosqlkey?'':'</strike>').'</strong>'; |
|
| 1468 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=sql&file='.urlencode($pathtosqlkey).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1467 | + print '<span class="fa fa-file"></span> '.$langs->trans("SqlFileKey").' : <strong>'.($realpathtosqlkey ? '' : '<strike>').$pathtosqlkey.($realpathtosqlkey ? '' : '</strike>').'</strong>'; |
|
| 1468 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=sql&file='.urlencode($pathtosqlkey).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1469 | 1469 | //print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>'; |
| 1470 | 1470 | print '<br>'; |
| 1471 | 1471 | |
@@ -1476,20 +1476,20 @@ discard block |
||
| 1476 | 1476 | $urlofcard = dol_buildpath($pathtocard, 1); |
| 1477 | 1477 | |
| 1478 | 1478 | print '<div class="fichehalfleft">'; |
| 1479 | - print '<span class="fa fa-file"></span> '.$langs->trans("PageForList").' : <strong><a href="'.$urloflist.'" target="_test">'.($realpathtosql?'':'<strike>').$pathtolist.($realpathtosql?'':'</strike>').'</a></strong>'; |
|
| 1480 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtolist).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1479 | + print '<span class="fa fa-file"></span> '.$langs->trans("PageForList").' : <strong><a href="'.$urloflist.'" target="_test">'.($realpathtosql ? '' : '<strike>').$pathtolist.($realpathtosql ? '' : '</strike>').'</a></strong>'; |
|
| 1480 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtolist).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1481 | 1481 | print '<br>'; |
| 1482 | - print '<span class="fa fa-file"></span> '.$langs->trans("PageForCreateEditView").' : <strong><a href="'.$urlofcard.'?action=create" target="_test">'.($realpathtocard?'':'<strike>').$pathtocard.($realpathtocard?'':'</strike>').'?action=create</a></strong>'; |
|
| 1483 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtocard).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1482 | + print '<span class="fa fa-file"></span> '.$langs->trans("PageForCreateEditView").' : <strong><a href="'.$urlofcard.'?action=create" target="_test">'.($realpathtocard ? '' : '<strike>').$pathtocard.($realpathtocard ? '' : '</strike>').'?action=create</a></strong>'; |
|
| 1483 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtocard).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1484 | 1484 | print '<br>'; |
| 1485 | - print '<span class="fa fa-file"></span> '.$langs->trans("PageForAgendaTab").' : <strong>'.($realpathtoagenda?'':'<strike>').$pathtoagenda.($realpathtoagenda?'':'</strike>').'</strong>'; |
|
| 1486 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoagenda).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1485 | + print '<span class="fa fa-file"></span> '.$langs->trans("PageForAgendaTab").' : <strong>'.($realpathtoagenda ? '' : '<strike>').$pathtoagenda.($realpathtoagenda ? '' : '</strike>').'</strong>'; |
|
| 1486 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtoagenda).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1487 | 1487 | print '<br>'; |
| 1488 | - print '<span class="fa fa-file"></span> '.$langs->trans("PageForDocumentTab").' : <strong>'.($realpathtodocument?'':'<strike>').$pathtodocument.($realpathtodocument?'':'</strike>').'</strong>'; |
|
| 1489 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtodocument).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1488 | + print '<span class="fa fa-file"></span> '.$langs->trans("PageForDocumentTab").' : <strong>'.($realpathtodocument ? '' : '<strike>').$pathtodocument.($realpathtodocument ? '' : '</strike>').'</strong>'; |
|
| 1489 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtodocument).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1490 | 1490 | print '<br>'; |
| 1491 | - print '<span class="fa fa-file"></span> '.$langs->trans("PageForNoteTab").' : <strong>'.($realpathtonote?'':'<strike>').$pathtonote.($realpathtonote?'':'</strike>').'</strong>'; |
|
| 1492 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtonote).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1491 | + print '<span class="fa fa-file"></span> '.$langs->trans("PageForNoteTab").' : <strong>'.($realpathtonote ? '' : '<strike>').$pathtonote.($realpathtonote ? '' : '</strike>').'</strong>'; |
|
| 1492 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtonote).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
| 1493 | 1493 | print '<br>'; |
| 1494 | 1494 | |
| 1495 | 1495 | print '<br>'; |
@@ -1511,17 +1511,17 @@ discard block |
||
| 1511 | 1511 | try { |
| 1512 | 1512 | $tmpobjet = @new $tabobj($db); |
| 1513 | 1513 | } |
| 1514 | - catch(Exception $e) |
|
| 1514 | + catch (Exception $e) |
|
| 1515 | 1515 | { |
| 1516 | 1516 | dol_syslog('Failed to load Constructor of class: '.$e->getMessage(), LOG_WARNING); |
| 1517 | 1517 | } |
| 1518 | 1518 | } |
| 1519 | 1519 | |
| 1520 | - if (! empty($tmpobjet)) |
|
| 1520 | + if (!empty($tmpobjet)) |
|
| 1521 | 1521 | { |
| 1522 | 1522 | $reflector = new ReflectionClass($tabobj); |
| 1523 | - $properties = $reflector->getProperties(); // Can also use get_object_vars |
|
| 1524 | - $propdefault = $reflector->getDefaultProperties(); // Can also use get_object_vars |
|
| 1523 | + $properties = $reflector->getProperties(); // Can also use get_object_vars |
|
| 1524 | + $propdefault = $reflector->getDefaultProperties(); // Can also use get_object_vars |
|
| 1525 | 1525 | //$propstat = $reflector->getStaticProperties(); |
| 1526 | 1526 | |
| 1527 | 1527 | print load_fiche_titre($langs->trans("Properties"), '', ''); |
@@ -1531,7 +1531,7 @@ discard block |
||
| 1531 | 1531 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
| 1532 | 1532 | print '<input type="hidden" name="action" value="addproperty">'; |
| 1533 | 1533 | print '<input type="hidden" name="tab" value="objects">'; |
| 1534 | - print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module.($forceddirread?'@'.$dirread:'')).'">'; |
|
| 1534 | + print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module.($forceddirread ? '@'.$dirread : '')).'">'; |
|
| 1535 | 1535 | print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">'; |
| 1536 | 1536 | |
| 1537 | 1537 | print '<div class="div-table-responsive">'; |
@@ -1559,28 +1559,28 @@ discard block |
||
| 1559 | 1559 | |
| 1560 | 1560 | $properties = dol_sort_array($tmpobjet->fields, 'position'); |
| 1561 | 1561 | |
| 1562 | - if (! empty($properties)) |
|
| 1562 | + if (!empty($properties)) |
|
| 1563 | 1563 | { |
| 1564 | 1564 | // Line to add a property |
| 1565 | 1565 | print '<tr>'; |
| 1566 | - print '<td><input class="text" name="propname" value="'.dol_escape_htmltag(GETPOST('propname','alpha')).'"></td>'; |
|
| 1567 | - print '<td><input class="text" name="proplabel" value="'.dol_escape_htmltag(GETPOST('proplabel','alpha')).'"></td>'; |
|
| 1568 | - print '<td><input class="text" name="proptype" value="'.dol_escape_htmltag(GETPOST('proptype','alpha')).'"></td>'; |
|
| 1569 | - print '<td><input class="text" name="proparrayofkeyval" value="'.dol_escape_htmltag(GETPOST('proparrayofkeyval','none')).'"></td>'; |
|
| 1570 | - print '<td class="center"><input class="text" size="2" name="propnotnull" value="'.dol_escape_htmltag(GETPOST('propnotnull','alpha')).'"></td>'; |
|
| 1566 | + print '<td><input class="text" name="propname" value="'.dol_escape_htmltag(GETPOST('propname', 'alpha')).'"></td>'; |
|
| 1567 | + print '<td><input class="text" name="proplabel" value="'.dol_escape_htmltag(GETPOST('proplabel', 'alpha')).'"></td>'; |
|
| 1568 | + print '<td><input class="text" name="proptype" value="'.dol_escape_htmltag(GETPOST('proptype', 'alpha')).'"></td>'; |
|
| 1569 | + print '<td><input class="text" name="proparrayofkeyval" value="'.dol_escape_htmltag(GETPOST('proparrayofkeyval', 'none')).'"></td>'; |
|
| 1570 | + print '<td class="center"><input class="text" size="2" name="propnotnull" value="'.dol_escape_htmltag(GETPOST('propnotnull', 'alpha')).'"></td>'; |
|
| 1571 | 1571 | //print '<td><input class="text" name="propdefault" value=""></td>'; |
| 1572 | - print '<td class="center"><input class="text" size="2" name="propindex" value="'.dol_escape_htmltag(GETPOST('propindex','alpha')).'"></td>'; |
|
| 1573 | - print '<td class="right"><input class="text right" size="2" name="propposition" value="'.dol_escape_htmltag(GETPOST('propposition','alpha')).'"></td>'; |
|
| 1574 | - print '<td class="center"><input class="text" size="2" name="propenabled" value="'.dol_escape_htmltag(GETPOST('propenabled','alpha')).'"></td>'; |
|
| 1575 | - print '<td class="center"><input class="text" size="2" name="propvisible" value="'.dol_escape_htmltag(GETPOST('propvisible','alpha')).'"></td>'; |
|
| 1576 | - print '<td class="center"><input class="text" size="2" name="propisameasure" value="'.dol_escape_htmltag(GETPOST('propisameasure','alpha')).'"></td>'; |
|
| 1577 | - print '<td class="center"><input class="text" size="2" name="propsearchall" value="'.dol_escape_htmltag(GETPOST('propsearchall','alpha')).'"></td>'; |
|
| 1578 | - print '<td><input class="text" name="propcomment" value="'.dol_escape_htmltag(GETPOST('propcomment','alpha')).'"></td>'; |
|
| 1572 | + print '<td class="center"><input class="text" size="2" name="propindex" value="'.dol_escape_htmltag(GETPOST('propindex', 'alpha')).'"></td>'; |
|
| 1573 | + print '<td class="right"><input class="text right" size="2" name="propposition" value="'.dol_escape_htmltag(GETPOST('propposition', 'alpha')).'"></td>'; |
|
| 1574 | + print '<td class="center"><input class="text" size="2" name="propenabled" value="'.dol_escape_htmltag(GETPOST('propenabled', 'alpha')).'"></td>'; |
|
| 1575 | + print '<td class="center"><input class="text" size="2" name="propvisible" value="'.dol_escape_htmltag(GETPOST('propvisible', 'alpha')).'"></td>'; |
|
| 1576 | + print '<td class="center"><input class="text" size="2" name="propisameasure" value="'.dol_escape_htmltag(GETPOST('propisameasure', 'alpha')).'"></td>'; |
|
| 1577 | + print '<td class="center"><input class="text" size="2" name="propsearchall" value="'.dol_escape_htmltag(GETPOST('propsearchall', 'alpha')).'"></td>'; |
|
| 1578 | + print '<td><input class="text" name="propcomment" value="'.dol_escape_htmltag(GETPOST('propcomment', 'alpha')).'"></td>'; |
|
| 1579 | 1579 | print '<td align="center">'; |
| 1580 | 1580 | print '<input class="button" type="submit" name="add" value="'.$langs->trans("Add").'">'; |
| 1581 | 1581 | print '</td></tr>'; |
| 1582 | 1582 | |
| 1583 | - foreach($properties as $propkey => $propval) |
|
| 1583 | + foreach ($properties as $propkey => $propval) |
|
| 1584 | 1584 | { |
| 1585 | 1585 | /* If from Reflection |
| 1586 | 1586 | if ($propval->class == $tabobj) |
@@ -1596,19 +1596,19 @@ discard block |
||
| 1596 | 1596 | if (in_array($propname, array('fk_element', 'lines'))) continue; |
| 1597 | 1597 | }*/ |
| 1598 | 1598 | |
| 1599 | - $propname=$propkey; |
|
| 1600 | - $proplabel=$propval['label']; |
|
| 1601 | - $proptype=$propval['type']; |
|
| 1602 | - $proparrayofkeyval=$propval['arrayofkeyval']; |
|
| 1603 | - $propnotnull=$propval['notnull']; |
|
| 1604 | - $propsearchall=$propval['searchall']; |
|
| 1599 | + $propname = $propkey; |
|
| 1600 | + $proplabel = $propval['label']; |
|
| 1601 | + $proptype = $propval['type']; |
|
| 1602 | + $proparrayofkeyval = $propval['arrayofkeyval']; |
|
| 1603 | + $propnotnull = $propval['notnull']; |
|
| 1604 | + $propsearchall = $propval['searchall']; |
|
| 1605 | 1605 | //$propdefault=$propval['default']; |
| 1606 | - $propindex=$propval['index']; |
|
| 1607 | - $propposition=$propval['position']; |
|
| 1608 | - $propenabled=$propval['enabled']; |
|
| 1609 | - $propvisible=$propval['visible']; |
|
| 1610 | - $propisameasure=$propval['isameasure']; |
|
| 1611 | - $propcomment=$propval['comment']; |
|
| 1606 | + $propindex = $propval['index']; |
|
| 1607 | + $propposition = $propval['position']; |
|
| 1608 | + $propenabled = $propval['enabled']; |
|
| 1609 | + $propvisible = $propval['visible']; |
|
| 1610 | + $propisameasure = $propval['isameasure']; |
|
| 1611 | + $propcomment = $propval['comment']; |
|
| 1612 | 1612 | |
| 1613 | 1613 | print '<tr class="oddeven">'; |
| 1614 | 1614 | |
@@ -1634,22 +1634,22 @@ discard block |
||
| 1634 | 1634 | print $propdefault; |
| 1635 | 1635 | print '</td>';*/ |
| 1636 | 1636 | print '<td class="center">'; |
| 1637 | - print $propindex?'X':''; |
|
| 1637 | + print $propindex ? 'X' : ''; |
|
| 1638 | 1638 | print '</td>'; |
| 1639 | 1639 | print '<td align="right">'; |
| 1640 | 1640 | print $propposition; |
| 1641 | 1641 | print '</td>'; |
| 1642 | 1642 | print '<td class="center">'; |
| 1643 | - print $propenabled?$propenabled:''; |
|
| 1643 | + print $propenabled ? $propenabled : ''; |
|
| 1644 | 1644 | print '</td>'; |
| 1645 | 1645 | print '<td class="center">'; |
| 1646 | - print $propvisible?$propvisible:''; |
|
| 1646 | + print $propvisible ? $propvisible : ''; |
|
| 1647 | 1647 | print '</td>'; |
| 1648 | 1648 | print '<td class="center">'; |
| 1649 | - print $propisameasure?$propisameasure:''; |
|
| 1649 | + print $propisameasure ? $propisameasure : ''; |
|
| 1650 | 1650 | print '</td>'; |
| 1651 | 1651 | print '<td class="center">'; |
| 1652 | - print $propsearchall?'X':''; |
|
| 1652 | + print $propsearchall ? 'X' : ''; |
|
| 1653 | 1653 | print '</td>'; |
| 1654 | 1654 | print '<td>'; |
| 1655 | 1655 | print $propcomment; |
@@ -1675,7 +1675,7 @@ discard block |
||
| 1675 | 1675 | print '<tr><td><span class="warning">'.$langs->trans('Failed to init the object with the new.').'</warning></td></tr>'; |
| 1676 | 1676 | } |
| 1677 | 1677 | } |
| 1678 | - catch(Exception $e) |
|
| 1678 | + catch (Exception $e) |
|
| 1679 | 1679 | { |
| 1680 | 1680 | print $e->getMessage(); |
| 1681 | 1681 | } |
@@ -1684,11 +1684,11 @@ discard block |
||
| 1684 | 1684 | { |
| 1685 | 1685 | if (empty($forceddirread)) |
| 1686 | 1686 | { |
| 1687 | - $fullpathoffile=dol_buildpath($file, 0); |
|
| 1687 | + $fullpathoffile = dol_buildpath($file, 0); |
|
| 1688 | 1688 | } |
| 1689 | 1689 | else |
| 1690 | 1690 | { |
| 1691 | - $fullpathoffile=$dirread.'/'.$file; |
|
| 1691 | + $fullpathoffile = $dirread.'/'.$file; |
|
| 1692 | 1692 | } |
| 1693 | 1693 | |
| 1694 | 1694 | $content = file_get_contents($fullpathoffile); |
@@ -1700,10 +1700,10 @@ discard block |
||
| 1700 | 1700 | print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
| 1701 | 1701 | print '<input type="hidden" name="tab" value="'.$tab.'">'; |
| 1702 | 1702 | print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">'; |
| 1703 | - print '<input type="hidden" name="module" value="'.$module.($forceddirread?'@'.$dirread:'').'">'; |
|
| 1703 | + print '<input type="hidden" name="module" value="'.$module.($forceddirread ? '@'.$dirread : '').'">'; |
|
| 1704 | 1704 | |
| 1705 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 1706 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 1705 | + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 1706 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); |
|
| 1707 | 1707 | print '<br>'; |
| 1708 | 1708 | print '<center>'; |
| 1709 | 1709 | print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
@@ -1715,7 +1715,7 @@ discard block |
||
| 1715 | 1715 | } |
| 1716 | 1716 | } |
| 1717 | 1717 | |
| 1718 | - dol_fiche_end(); // Level 3 |
|
| 1718 | + dol_fiche_end(); // Level 3 |
|
| 1719 | 1719 | } |
| 1720 | 1720 | |
| 1721 | 1721 | if ($tab == 'menus') |
@@ -1817,7 +1817,7 @@ discard block |
||
| 1817 | 1817 | } |
| 1818 | 1818 | else |
| 1819 | 1819 | { |
| 1820 | - $fullpathoffile=dol_buildpath($file, 0); |
|
| 1820 | + $fullpathoffile = dol_buildpath($file, 0); |
|
| 1821 | 1821 | |
| 1822 | 1822 | $content = file_get_contents($fullpathoffile); |
| 1823 | 1823 | |
@@ -1829,8 +1829,8 @@ discard block |
||
| 1829 | 1829 | print '<input type="hidden" name="tab" value="'.$tab.'">'; |
| 1830 | 1830 | print '<input type="hidden" name="module" value="'.$module.'">'; |
| 1831 | 1831 | |
| 1832 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 1833 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 1832 | + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 1833 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); |
|
| 1834 | 1834 | print '<br>'; |
| 1835 | 1835 | print '<center>'; |
| 1836 | 1836 | print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
@@ -1942,7 +1942,7 @@ discard block |
||
| 1942 | 1942 | } |
| 1943 | 1943 | else |
| 1944 | 1944 | { |
| 1945 | - $fullpathoffile=dol_buildpath($file, 0); |
|
| 1945 | + $fullpathoffile = dol_buildpath($file, 0); |
|
| 1946 | 1946 | |
| 1947 | 1947 | $content = file_get_contents($fullpathoffile); |
| 1948 | 1948 | |
@@ -1954,8 +1954,8 @@ discard block |
||
| 1954 | 1954 | print '<input type="hidden" name="tab" value="'.$tab.'">'; |
| 1955 | 1955 | print '<input type="hidden" name="module" value="'.$module.'">'; |
| 1956 | 1956 | |
| 1957 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 1958 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 1957 | + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 1958 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); |
|
| 1959 | 1959 | print '<br>'; |
| 1960 | 1960 | print '<center>'; |
| 1961 | 1961 | print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
@@ -1986,7 +1986,7 @@ discard block |
||
| 1986 | 1986 | } |
| 1987 | 1987 | else |
| 1988 | 1988 | { |
| 1989 | - $fullpathoffile=dol_buildpath($file, 0); |
|
| 1989 | + $fullpathoffile = dol_buildpath($file, 0); |
|
| 1990 | 1990 | |
| 1991 | 1991 | $content = file_get_contents($fullpathoffile); |
| 1992 | 1992 | |
@@ -1998,8 +1998,8 @@ discard block |
||
| 1998 | 1998 | print '<input type="hidden" name="tab" value="'.$tab.'">'; |
| 1999 | 1999 | print '<input type="hidden" name="module" value="'.$module.'">'; |
| 2000 | 2000 | |
| 2001 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 2002 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 2001 | + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 2002 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); |
|
| 2003 | 2003 | print '<br>'; |
| 2004 | 2004 | print '<center>'; |
| 2005 | 2005 | print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
@@ -2023,7 +2023,7 @@ discard block |
||
| 2023 | 2023 | print $langs->trans("TriggerDefDesc").'<br>'; |
| 2024 | 2024 | print '<br>'; |
| 2025 | 2025 | |
| 2026 | - if (! empty($triggers)) |
|
| 2026 | + if (!empty($triggers)) |
|
| 2027 | 2027 | { |
| 2028 | 2028 | foreach ($triggers as $trigger) |
| 2029 | 2029 | { |
@@ -2041,7 +2041,7 @@ discard block |
||
| 2041 | 2041 | } |
| 2042 | 2042 | else |
| 2043 | 2043 | { |
| 2044 | - $fullpathoffile=dol_buildpath($file, 0); |
|
| 2044 | + $fullpathoffile = dol_buildpath($file, 0); |
|
| 2045 | 2045 | |
| 2046 | 2046 | $content = file_get_contents($fullpathoffile); |
| 2047 | 2047 | |
@@ -2053,8 +2053,8 @@ discard block |
||
| 2053 | 2053 | print '<input type="hidden" name="tab" value="'.$tab.'">'; |
| 2054 | 2054 | print '<input type="hidden" name="module" value="'.$module.'">'; |
| 2055 | 2055 | |
| 2056 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 2057 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 2056 | + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 2057 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); |
|
| 2058 | 2058 | print '<br>'; |
| 2059 | 2059 | print '<center>'; |
| 2060 | 2060 | print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
@@ -2074,7 +2074,7 @@ discard block |
||
| 2074 | 2074 | |
| 2075 | 2075 | if ($action != 'editfile' || empty($file)) |
| 2076 | 2076 | { |
| 2077 | - if (! empty($widget)) |
|
| 2077 | + if (!empty($widget)) |
|
| 2078 | 2078 | { |
| 2079 | 2079 | foreach ($widgets as $widget) |
| 2080 | 2080 | { |
@@ -2092,7 +2092,7 @@ discard block |
||
| 2092 | 2092 | } |
| 2093 | 2093 | else |
| 2094 | 2094 | { |
| 2095 | - $fullpathoffile=dol_buildpath($file, 0); |
|
| 2095 | + $fullpathoffile = dol_buildpath($file, 0); |
|
| 2096 | 2096 | |
| 2097 | 2097 | $content = file_get_contents($fullpathoffile); |
| 2098 | 2098 | |
@@ -2104,8 +2104,8 @@ discard block |
||
| 2104 | 2104 | print '<input type="hidden" name="tab" value="'.$tab.'">'; |
| 2105 | 2105 | print '<input type="hidden" name="module" value="'.$module.'">'; |
| 2106 | 2106 | |
| 2107 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 2108 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 2107 | + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 2108 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); |
|
| 2109 | 2109 | print '<br>'; |
| 2110 | 2110 | print '<center>'; |
| 2111 | 2111 | print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
@@ -2146,11 +2146,11 @@ discard block |
||
| 2146 | 2146 | print '<table class="noborder">'; |
| 2147 | 2147 | |
| 2148 | 2148 | print '<tr class="liste_titre">'; |
| 2149 | - print_liste_field_titre("CronLabel",$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); |
|
| 2150 | - print_liste_field_titre("CronTask",'','',"",$param,'',$sortfield,$sortorder); |
|
| 2151 | - print_liste_field_titre("CronFrequency",'',"","",$param,'',$sortfield,$sortorder); |
|
| 2152 | - print_liste_field_titre("StatusAtInstall",$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); |
|
| 2153 | - print_liste_field_titre("Comment",$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); |
|
| 2149 | + print_liste_field_titre("CronLabel", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder); |
|
| 2150 | + print_liste_field_titre("CronTask", '', '', "", $param, '', $sortfield, $sortorder); |
|
| 2151 | + print_liste_field_titre("CronFrequency", '', "", "", $param, '', $sortfield, $sortorder); |
|
| 2152 | + print_liste_field_titre("StatusAtInstall", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder); |
|
| 2153 | + print_liste_field_titre("Comment", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder); |
|
| 2154 | 2154 | print "</tr>\n"; |
| 2155 | 2155 | |
| 2156 | 2156 | if (count($cronjobs)) |
@@ -2164,31 +2164,31 @@ discard block |
||
| 2164 | 2164 | print '</td>'; |
| 2165 | 2165 | |
| 2166 | 2166 | print '<td>'; |
| 2167 | - if ($cron['jobtype']=='method') |
|
| 2167 | + if ($cron['jobtype'] == 'method') |
|
| 2168 | 2168 | { |
| 2169 | - $text=$langs->trans("CronClass"); |
|
| 2170 | - $texttoshow=$langs->trans('CronModule').': '.$module.'<br>'; |
|
| 2171 | - $texttoshow.=$langs->trans('CronClass').': '. $cron['class'].'<br>'; |
|
| 2172 | - $texttoshow.=$langs->trans('CronObject').': '. $cron['objectname'].'<br>'; |
|
| 2173 | - $texttoshow.=$langs->trans('CronMethod').': '. $cron['method']; |
|
| 2174 | - $texttoshow.='<br>'.$langs->trans('CronArgs').': '. $cron['parameters']; |
|
| 2175 | - $texttoshow.='<br>'.$langs->trans('Comment').': '. $langs->trans($cron['comment']); |
|
| 2169 | + $text = $langs->trans("CronClass"); |
|
| 2170 | + $texttoshow = $langs->trans('CronModule').': '.$module.'<br>'; |
|
| 2171 | + $texttoshow .= $langs->trans('CronClass').': '.$cron['class'].'<br>'; |
|
| 2172 | + $texttoshow .= $langs->trans('CronObject').': '.$cron['objectname'].'<br>'; |
|
| 2173 | + $texttoshow .= $langs->trans('CronMethod').': '.$cron['method']; |
|
| 2174 | + $texttoshow .= '<br>'.$langs->trans('CronArgs').': '.$cron['parameters']; |
|
| 2175 | + $texttoshow .= '<br>'.$langs->trans('Comment').': '.$langs->trans($cron['comment']); |
|
| 2176 | 2176 | } |
| 2177 | - elseif ($cron['jobtype']=='command') |
|
| 2177 | + elseif ($cron['jobtype'] == 'command') |
|
| 2178 | 2178 | { |
| 2179 | - $text=$langs->trans('CronCommand'); |
|
| 2180 | - $texttoshow=$langs->trans('CronCommand').': '.dol_trunc($cron['command']); |
|
| 2181 | - $texttoshow.='<br>'.$langs->trans('CronArgs').': '. $cron['parameters']; |
|
| 2182 | - $texttoshow.='<br>'.$langs->trans('Comment').': '. $langs->trans($cron['comment']); |
|
| 2179 | + $text = $langs->trans('CronCommand'); |
|
| 2180 | + $texttoshow = $langs->trans('CronCommand').': '.dol_trunc($cron['command']); |
|
| 2181 | + $texttoshow .= '<br>'.$langs->trans('CronArgs').': '.$cron['parameters']; |
|
| 2182 | + $texttoshow .= '<br>'.$langs->trans('Comment').': '.$langs->trans($cron['comment']); |
|
| 2183 | 2183 | } |
| 2184 | 2184 | print $form->textwithpicto($text, $texttoshow, 1); |
| 2185 | 2185 | print '</td>'; |
| 2186 | 2186 | |
| 2187 | 2187 | print '<td>'; |
| 2188 | - if($cron['unitfrequency'] == "60") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Minutes'); |
|
| 2189 | - if($cron['unitfrequency'] == "3600") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Hours'); |
|
| 2190 | - if($cron['unitfrequency'] == "86400") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Days'); |
|
| 2191 | - if($cron['unitfrequency'] == "604800") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Weeks'); |
|
| 2188 | + if ($cron['unitfrequency'] == "60") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Minutes'); |
|
| 2189 | + if ($cron['unitfrequency'] == "3600") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Hours'); |
|
| 2190 | + if ($cron['unitfrequency'] == "86400") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Days'); |
|
| 2191 | + if ($cron['unitfrequency'] == "604800") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Weeks'); |
|
| 2192 | 2192 | print '</td>'; |
| 2193 | 2193 | |
| 2194 | 2194 | print '<td>'; |
@@ -2196,7 +2196,7 @@ discard block |
||
| 2196 | 2196 | print '</td>'; |
| 2197 | 2197 | |
| 2198 | 2198 | print '<td>'; |
| 2199 | - if (!empty($cron['comment'])) {print $cron['comment'];} |
|
| 2199 | + if (!empty($cron['comment'])) {print $cron['comment']; } |
|
| 2200 | 2200 | print '</td>'; |
| 2201 | 2201 | |
| 2202 | 2202 | print '</tr>'; |
@@ -2214,7 +2214,7 @@ discard block |
||
| 2214 | 2214 | } |
| 2215 | 2215 | else |
| 2216 | 2216 | { |
| 2217 | - $fullpathoffile=dol_buildpath($file, 0); |
|
| 2217 | + $fullpathoffile = dol_buildpath($file, 0); |
|
| 2218 | 2218 | |
| 2219 | 2219 | $content = file_get_contents($fullpathoffile); |
| 2220 | 2220 | |
@@ -2226,8 +2226,8 @@ discard block |
||
| 2226 | 2226 | print '<input type="hidden" name="tab" value="'.$tab.'">'; |
| 2227 | 2227 | print '<input type="hidden" name="module" value="'.$module.'">'; |
| 2228 | 2228 | |
| 2229 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 2230 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
| 2229 | + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
| 2230 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); |
|
| 2231 | 2231 | print '<br>'; |
| 2232 | 2232 | print '<center>'; |
| 2233 | 2233 | print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
@@ -2241,27 +2241,27 @@ discard block |
||
| 2241 | 2241 | |
| 2242 | 2242 | if ($tab == 'buildpackage') |
| 2243 | 2243 | { |
| 2244 | - if (! class_exists('ZipArchive') && ! defined('ODTPHP_PATHTOPCLZIP')) |
|
| 2244 | + if (!class_exists('ZipArchive') && !defined('ODTPHP_PATHTOPCLZIP')) |
|
| 2245 | 2245 | { |
| 2246 | 2246 | print img_warning().' '.$langs->trans("ErrNoZipEngine"); |
| 2247 | 2247 | print '<br>'; |
| 2248 | 2248 | } |
| 2249 | 2249 | |
| 2250 | - $modulelowercase=strtolower($module); |
|
| 2250 | + $modulelowercase = strtolower($module); |
|
| 2251 | 2251 | |
| 2252 | 2252 | // Zip file to build |
| 2253 | - $FILENAMEZIP=''; |
|
| 2253 | + $FILENAMEZIP = ''; |
|
| 2254 | 2254 | |
| 2255 | 2255 | // Load module |
| 2256 | 2256 | dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); |
| 2257 | - $class='mod'.$module; |
|
| 2257 | + $class = 'mod'.$module; |
|
| 2258 | 2258 | |
| 2259 | 2259 | if (class_exists($class)) |
| 2260 | 2260 | { |
| 2261 | 2261 | try { |
| 2262 | 2262 | $moduleobj = new $class($db); |
| 2263 | 2263 | } |
| 2264 | - catch(Exception $e) |
|
| 2264 | + catch (Exception $e) |
|
| 2265 | 2265 | { |
| 2266 | 2266 | $error++; |
| 2267 | 2267 | dol_print_error($e->getMessage()); |
@@ -2275,20 +2275,20 @@ discard block |
||
| 2275 | 2275 | exit; |
| 2276 | 2276 | } |
| 2277 | 2277 | |
| 2278 | - $arrayversion=explode('.',$moduleobj->version,3); |
|
| 2278 | + $arrayversion = explode('.', $moduleobj->version, 3); |
|
| 2279 | 2279 | if (count($arrayversion)) |
| 2280 | 2280 | { |
| 2281 | - $FILENAMEZIP="module_".$modulelowercase.'-'.$arrayversion[0].'.'.$arrayversion[1].($arrayversion[2]?".".$arrayversion[2]:"").".zip"; |
|
| 2281 | + $FILENAMEZIP = "module_".$modulelowercase.'-'.$arrayversion[0].'.'.$arrayversion[1].($arrayversion[2] ? ".".$arrayversion[2] : "").".zip"; |
|
| 2282 | 2282 | $outputfilezip = dol_buildpath($modulelowercase, 0).'/bin/'.$FILENAMEZIP; |
| 2283 | 2283 | |
| 2284 | - $FILENAMEDOC=$modulelowercase.'.html'; |
|
| 2284 | + $FILENAMEDOC = $modulelowercase.'.html'; |
|
| 2285 | 2285 | $outputfiledoc = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOC; |
| 2286 | 2286 | } |
| 2287 | 2287 | |
| 2288 | 2288 | print '<br>'; |
| 2289 | 2289 | |
| 2290 | - print '<span class="fa fa-file"></span> '. $langs->trans("PathToModulePackage") . ' : '; |
|
| 2291 | - if (! dol_is_file($outputfilezip)) print '<strong>'.$langs->trans("FileNotYetGenerated").'</strong>'; |
|
| 2290 | + print '<span class="fa fa-file"></span> '.$langs->trans("PathToModulePackage").' : '; |
|
| 2291 | + if (!dol_is_file($outputfilezip)) print '<strong>'.$langs->trans("FileNotYetGenerated").'</strong>'; |
|
| 2292 | 2292 | else { |
| 2293 | 2293 | $relativepath = $modulelowercase.'/bin/'.$FILENAMEZIP; |
| 2294 | 2294 | print '<strong><a href="'.DOL_URL_ROOT.'/document.php?modulepart=packages&file='.urlencode($relativepath).'">'.$outputfilezip.'</a></strong>'; |
@@ -2307,8 +2307,8 @@ discard block |
||
| 2307 | 2307 | |
| 2308 | 2308 | print '<br><br><br>'; |
| 2309 | 2309 | |
| 2310 | - print '<span class="fa fa-file"></span> '. $langs->trans("PathToModuleDocumentation") . ' : '; |
|
| 2311 | - if (! dol_is_file($outputfiledoc)) print '<strong>'.$langs->trans("FileNotYetGenerated").'</strong>'; |
|
| 2310 | + print '<span class="fa fa-file"></span> '.$langs->trans("PathToModuleDocumentation").' : '; |
|
| 2311 | + if (!dol_is_file($outputfiledoc)) print '<strong>'.$langs->trans("FileNotYetGenerated").'</strong>'; |
|
| 2312 | 2312 | else { |
| 2313 | 2313 | print '<strong>'.$outputfiledoc.'</strong>'; |
| 2314 | 2314 | print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledoc), 'dayhour').')'; |