@@ -115,31 +115,31 @@ discard block |
||
| 115 | 115 | $formmail=new FormMail($db); |
| 116 | 116 | if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) |
| 117 | 117 | { |
| 118 | - $tmp=FormMail::getAvailableSubstitKey('formemail'); |
|
| 119 | - $tmp['__(AnyTranslationKey)__']='Translation'; |
|
| 120 | - $helpsubstit = $langs->trans("AvailableVariables").':<br>'; |
|
| 121 | - $helpsubstitforlines = $langs->trans("AvailableVariables").':<br>'; |
|
| 122 | - foreach($tmp as $key => $val) |
|
| 123 | - { |
|
| 124 | - $helpsubstit.=$key.' -> '.$val.'<br>'; |
|
| 125 | - $helpsubstitforlines.=$key.' -> '.$val.'<br>'; |
|
| 126 | - } |
|
| 118 | + $tmp=FormMail::getAvailableSubstitKey('formemail'); |
|
| 119 | + $tmp['__(AnyTranslationKey)__']='Translation'; |
|
| 120 | + $helpsubstit = $langs->trans("AvailableVariables").':<br>'; |
|
| 121 | + $helpsubstitforlines = $langs->trans("AvailableVariables").':<br>'; |
|
| 122 | + foreach($tmp as $key => $val) |
|
| 123 | + { |
|
| 124 | + $helpsubstit.=$key.' -> '.$val.'<br>'; |
|
| 125 | + $helpsubstitforlines.=$key.' -> '.$val.'<br>'; |
|
| 126 | + } |
|
| 127 | 127 | } |
| 128 | 128 | else |
| 129 | 129 | { |
| 130 | - $tmp=FormMail::getAvailableSubstitKey('formemailwithlines'); |
|
| 131 | - $tmp['__(AnyTranslationKey)__']='Translation'; |
|
| 132 | - $helpsubstit = $langs->trans("AvailableVariables").':<br>'; |
|
| 133 | - $helpsubstitforlines = $langs->trans("AvailableVariables").':<br>'; |
|
| 134 | - foreach($tmp as $key => $val) |
|
| 135 | - { |
|
| 136 | - $helpsubstit.=$key.' -> '.$val.'<br>'; |
|
| 137 | - } |
|
| 138 | - $tmp=FormMail::getAvailableSubstitKey('formemailforlines'); |
|
| 139 | - foreach($tmp as $key => $val) |
|
| 140 | - { |
|
| 141 | - $helpsubstitforlines.=$key.' -> '.$val.'<br>'; |
|
| 142 | - } |
|
| 130 | + $tmp=FormMail::getAvailableSubstitKey('formemailwithlines'); |
|
| 131 | + $tmp['__(AnyTranslationKey)__']='Translation'; |
|
| 132 | + $helpsubstit = $langs->trans("AvailableVariables").':<br>'; |
|
| 133 | + $helpsubstitforlines = $langs->trans("AvailableVariables").':<br>'; |
|
| 134 | + foreach($tmp as $key => $val) |
|
| 135 | + { |
|
| 136 | + $helpsubstit.=$key.' -> '.$val.'<br>'; |
|
| 137 | + } |
|
| 138 | + $tmp=FormMail::getAvailableSubstitKey('formemailforlines'); |
|
| 139 | + foreach($tmp as $key => $val) |
|
| 140 | + { |
|
| 141 | + $helpsubstitforlines.=$key.' -> '.$val.'<br>'; |
|
| 142 | + } |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | |
@@ -197,193 +197,193 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | if (empty($reshook)) |
| 199 | 199 | { |
| 200 | - // Purge search criteria |
|
| 201 | - if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers |
|
| 202 | - { |
|
| 203 | - $search_label=''; |
|
| 204 | - $search_type_template=''; |
|
| 205 | - $search_lang=''; |
|
| 206 | - $search_fk_user=''; |
|
| 207 | - $search_topic=''; |
|
| 208 | - $toselect=''; |
|
| 209 | - $search_array_options=array(); |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - // Actions add or modify an entry into a dictionary |
|
| 213 | - if (GETPOST('actionadd') || GETPOST('actionmodify')) |
|
| 214 | - { |
|
| 215 | - $listfield=explode(',', str_replace(' ', '',$tabfield[$id])); |
|
| 216 | - $listfieldinsert=explode(',',$tabfieldinsert[$id]); |
|
| 217 | - $listfieldmodify=explode(',',$tabfieldinsert[$id]); |
|
| 218 | - $listfieldvalue=explode(',',$tabfieldvalue[$id]); |
|
| 219 | - |
|
| 220 | - // Check that all fields are filled |
|
| 221 | - $ok=1; |
|
| 222 | - foreach ($listfield as $f => $value) |
|
| 223 | - { |
|
| 224 | - // Not mandatory fields |
|
| 225 | - if ($value == 'joinfiles') continue; |
|
| 226 | - if ($value == 'content') continue; |
|
| 227 | - if ($value == 'content_lines') continue; |
|
| 228 | - |
|
| 229 | - if (GETPOST('actionmodify') && $value == 'topic') $_POST['topic']=$_POST['topic-'.$rowid]; |
|
| 230 | - |
|
| 231 | - if ((! isset($_POST[$value]) || $_POST[$value]=='' || $_POST[$value]=='-1') && $value != 'lang' && $value != 'fk_user' && $value != 'position') |
|
| 232 | - { |
|
| 233 | - $ok=0; |
|
| 234 | - $fieldnamekey=$listfield[$f]; |
|
| 235 | - // We take translate key of field |
|
| 236 | - if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label'; |
|
| 237 | - if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments'; |
|
| 238 | - if ($fieldnamekey == 'code') $fieldnamekey = 'Code'; |
|
| 239 | - if ($fieldnamekey == 'note') $fieldnamekey = 'Note'; |
|
| 240 | - if ($fieldnamekey == 'type_template') $fieldnamekey = 'TypeOfTemplate'; |
|
| 241 | - if ($fieldnamekey == 'fk_user') $fieldnamekey = 'Owner'; |
|
| 242 | - if ($fieldnamekey == 'private') $fieldnamekey = 'Private'; |
|
| 243 | - if ($fieldnamekey == 'position') $fieldnamekey = 'Position'; |
|
| 244 | - if ($fieldnamekey == 'topic') $fieldnamekey = 'Topic'; |
|
| 245 | - |
|
| 246 | - setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); |
|
| 247 | - } |
|
| 248 | - } |
|
| 249 | - |
|
| 250 | - // Si verif ok et action add, on ajoute la ligne |
|
| 251 | - if ($ok && GETPOST('actionadd')) |
|
| 252 | - { |
|
| 253 | - // Add new entry |
|
| 254 | - $sql = "INSERT INTO ".$tabname[$id]." ("; |
|
| 255 | - // List of fields |
|
| 256 | - $sql.= $tabfieldinsert[$id]; |
|
| 257 | - $sql.=",active)"; |
|
| 258 | - $sql.= " VALUES("; |
|
| 259 | - |
|
| 260 | - // List of values |
|
| 261 | - $i=0; |
|
| 262 | - foreach ($listfieldinsert as $f => $value) |
|
| 263 | - { |
|
| 264 | - //var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value); |
|
| 265 | - $keycode=$listfieldvalue[$i]; |
|
| 266 | - if ($value == 'lang') $keycode='langcode'; |
|
| 267 | - if ($value == 'entity') $_POST[$keycode] = $conf->entity; |
|
| 268 | - if ($i) $sql.=","; |
|
| 269 | - if ($value == 'fk_user' && ! ($_POST[$keycode] > 0)) $_POST[$keycode]=''; |
|
| 270 | - if ($value == 'private' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='0'; |
|
| 271 | - if ($value == 'position' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='1'; |
|
| 272 | - if ($_POST[$keycode] == '' && $keycode != 'langcode') $sql.="null"; // lang must be '' if not defined so the unique key that include lang will work |
|
| 273 | - elseif ($_POST[$keycode] == '0' && $keycode == 'langcode') $sql.="null"; |
|
| 274 | - else $sql.="'".$db->escape($_POST[$keycode])."'"; |
|
| 275 | - $i++; |
|
| 276 | - } |
|
| 277 | - $sql.=",1)"; |
|
| 278 | - |
|
| 279 | - dol_syslog("actionadd", LOG_DEBUG); |
|
| 280 | - $result = $db->query($sql); |
|
| 281 | - if ($result) // Add is ok |
|
| 282 | - { |
|
| 283 | - setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); |
|
| 284 | - $_POST=array('id'=>$id); // Clean $_POST array, we keep only |
|
| 285 | - } |
|
| 286 | - else |
|
| 287 | - { |
|
| 288 | - if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { |
|
| 289 | - setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); |
|
| 290 | - } |
|
| 291 | - else { |
|
| 292 | - dol_print_error($db); |
|
| 293 | - } |
|
| 294 | - } |
|
| 295 | - } |
|
| 296 | - |
|
| 297 | - // Si verif ok et action modify, on modifie la ligne |
|
| 298 | - if ($ok && GETPOST('actionmodify')) |
|
| 299 | - { |
|
| 300 | - $rowidcol="rowid"; |
|
| 301 | - |
|
| 302 | - // Modify entry |
|
| 303 | - $sql = "UPDATE ".$tabname[$id]." SET "; |
|
| 304 | - // Modifie valeur des champs |
|
| 305 | - $i = 0; |
|
| 306 | - foreach ($listfieldmodify as $field) |
|
| 307 | - { |
|
| 308 | - $keycode=$listfieldvalue[$i]; |
|
| 309 | - if ($field == 'lang') $keycode='langcode'; |
|
| 310 | - |
|
| 311 | - if ($field == 'fk_user' && ! ($_POST['fk_user'] > 0)) $_POST['fk_user']=''; |
|
| 312 | - if ($field == 'topic') $_POST['topic']=$_POST['topic-'.$rowid]; |
|
| 313 | - if ($field == 'joinfiles') $_POST['joinfiles']=$_POST['joinfiles-'.$rowid]; |
|
| 314 | - if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid]; |
|
| 315 | - if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid]; |
|
| 316 | - if ($field == 'entity') $_POST[$keycode] = $conf->entity; |
|
| 317 | - if ($i) $sql.=","; |
|
| 318 | - $sql.= $field."="; |
|
| 319 | - if ($_POST[$keycode] == '' || ($keycode == 'langcode' && empty($_POST[$keycode]))) $sql.="null"; // For vat, we want/accept code = '' |
|
| 320 | - else $sql.="'".$db->escape($_POST[$keycode])."'"; |
|
| 321 | - $i++; |
|
| 322 | - } |
|
| 323 | - $sql.= " WHERE ".$rowidcol." = '".$rowid."'"; |
|
| 324 | - |
|
| 325 | - dol_syslog("actionmodify", LOG_DEBUG); |
|
| 326 | - //print $sql; |
|
| 327 | - $resql = $db->query($sql); |
|
| 328 | - if ($resql) |
|
| 329 | - { |
|
| 330 | - setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); |
|
| 331 | - } |
|
| 332 | - else |
|
| 333 | - { |
|
| 334 | - setEventMessages($db->error(), null, 'errors'); |
|
| 335 | - } |
|
| 336 | - } |
|
| 337 | - } |
|
| 338 | - |
|
| 339 | - if ($action == 'confirm_delete' && $confirm == 'yes') // delete |
|
| 340 | - { |
|
| 341 | - $rowidcol="rowid"; |
|
| 342 | - |
|
| 343 | - $sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'"; |
|
| 344 | - |
|
| 345 | - dol_syslog("delete", LOG_DEBUG); |
|
| 346 | - $result = $db->query($sql); |
|
| 347 | - if (! $result) |
|
| 348 | - { |
|
| 349 | - if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') |
|
| 350 | - { |
|
| 351 | - setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); |
|
| 352 | - } |
|
| 353 | - else |
|
| 354 | - { |
|
| 355 | - dol_print_error($db); |
|
| 356 | - } |
|
| 357 | - } |
|
| 358 | - } |
|
| 359 | - |
|
| 360 | - // activate |
|
| 361 | - if ($action == $acts[0]) |
|
| 362 | - { |
|
| 363 | - $rowidcol="rowid"; |
|
| 364 | - |
|
| 365 | - $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'"; |
|
| 366 | - |
|
| 367 | - $result = $db->query($sql); |
|
| 368 | - if (!$result) |
|
| 369 | - { |
|
| 370 | - dol_print_error($db); |
|
| 371 | - } |
|
| 372 | - } |
|
| 373 | - |
|
| 374 | - // disable |
|
| 375 | - if ($action == $acts[1]) |
|
| 376 | - { |
|
| 377 | - $rowidcol="rowid"; |
|
| 378 | - |
|
| 379 | - $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'"; |
|
| 380 | - |
|
| 381 | - $result = $db->query($sql); |
|
| 382 | - if (!$result) |
|
| 383 | - { |
|
| 384 | - dol_print_error($db); |
|
| 385 | - } |
|
| 386 | - } |
|
| 200 | + // Purge search criteria |
|
| 201 | + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers |
|
| 202 | + { |
|
| 203 | + $search_label=''; |
|
| 204 | + $search_type_template=''; |
|
| 205 | + $search_lang=''; |
|
| 206 | + $search_fk_user=''; |
|
| 207 | + $search_topic=''; |
|
| 208 | + $toselect=''; |
|
| 209 | + $search_array_options=array(); |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + // Actions add or modify an entry into a dictionary |
|
| 213 | + if (GETPOST('actionadd') || GETPOST('actionmodify')) |
|
| 214 | + { |
|
| 215 | + $listfield=explode(',', str_replace(' ', '',$tabfield[$id])); |
|
| 216 | + $listfieldinsert=explode(',',$tabfieldinsert[$id]); |
|
| 217 | + $listfieldmodify=explode(',',$tabfieldinsert[$id]); |
|
| 218 | + $listfieldvalue=explode(',',$tabfieldvalue[$id]); |
|
| 219 | + |
|
| 220 | + // Check that all fields are filled |
|
| 221 | + $ok=1; |
|
| 222 | + foreach ($listfield as $f => $value) |
|
| 223 | + { |
|
| 224 | + // Not mandatory fields |
|
| 225 | + if ($value == 'joinfiles') continue; |
|
| 226 | + if ($value == 'content') continue; |
|
| 227 | + if ($value == 'content_lines') continue; |
|
| 228 | + |
|
| 229 | + if (GETPOST('actionmodify') && $value == 'topic') $_POST['topic']=$_POST['topic-'.$rowid]; |
|
| 230 | + |
|
| 231 | + if ((! isset($_POST[$value]) || $_POST[$value]=='' || $_POST[$value]=='-1') && $value != 'lang' && $value != 'fk_user' && $value != 'position') |
|
| 232 | + { |
|
| 233 | + $ok=0; |
|
| 234 | + $fieldnamekey=$listfield[$f]; |
|
| 235 | + // We take translate key of field |
|
| 236 | + if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label'; |
|
| 237 | + if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments'; |
|
| 238 | + if ($fieldnamekey == 'code') $fieldnamekey = 'Code'; |
|
| 239 | + if ($fieldnamekey == 'note') $fieldnamekey = 'Note'; |
|
| 240 | + if ($fieldnamekey == 'type_template') $fieldnamekey = 'TypeOfTemplate'; |
|
| 241 | + if ($fieldnamekey == 'fk_user') $fieldnamekey = 'Owner'; |
|
| 242 | + if ($fieldnamekey == 'private') $fieldnamekey = 'Private'; |
|
| 243 | + if ($fieldnamekey == 'position') $fieldnamekey = 'Position'; |
|
| 244 | + if ($fieldnamekey == 'topic') $fieldnamekey = 'Topic'; |
|
| 245 | + |
|
| 246 | + setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); |
|
| 247 | + } |
|
| 248 | + } |
|
| 249 | + |
|
| 250 | + // Si verif ok et action add, on ajoute la ligne |
|
| 251 | + if ($ok && GETPOST('actionadd')) |
|
| 252 | + { |
|
| 253 | + // Add new entry |
|
| 254 | + $sql = "INSERT INTO ".$tabname[$id]." ("; |
|
| 255 | + // List of fields |
|
| 256 | + $sql.= $tabfieldinsert[$id]; |
|
| 257 | + $sql.=",active)"; |
|
| 258 | + $sql.= " VALUES("; |
|
| 259 | + |
|
| 260 | + // List of values |
|
| 261 | + $i=0; |
|
| 262 | + foreach ($listfieldinsert as $f => $value) |
|
| 263 | + { |
|
| 264 | + //var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value); |
|
| 265 | + $keycode=$listfieldvalue[$i]; |
|
| 266 | + if ($value == 'lang') $keycode='langcode'; |
|
| 267 | + if ($value == 'entity') $_POST[$keycode] = $conf->entity; |
|
| 268 | + if ($i) $sql.=","; |
|
| 269 | + if ($value == 'fk_user' && ! ($_POST[$keycode] > 0)) $_POST[$keycode]=''; |
|
| 270 | + if ($value == 'private' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='0'; |
|
| 271 | + if ($value == 'position' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='1'; |
|
| 272 | + if ($_POST[$keycode] == '' && $keycode != 'langcode') $sql.="null"; // lang must be '' if not defined so the unique key that include lang will work |
|
| 273 | + elseif ($_POST[$keycode] == '0' && $keycode == 'langcode') $sql.="null"; |
|
| 274 | + else $sql.="'".$db->escape($_POST[$keycode])."'"; |
|
| 275 | + $i++; |
|
| 276 | + } |
|
| 277 | + $sql.=",1)"; |
|
| 278 | + |
|
| 279 | + dol_syslog("actionadd", LOG_DEBUG); |
|
| 280 | + $result = $db->query($sql); |
|
| 281 | + if ($result) // Add is ok |
|
| 282 | + { |
|
| 283 | + setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); |
|
| 284 | + $_POST=array('id'=>$id); // Clean $_POST array, we keep only |
|
| 285 | + } |
|
| 286 | + else |
|
| 287 | + { |
|
| 288 | + if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { |
|
| 289 | + setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); |
|
| 290 | + } |
|
| 291 | + else { |
|
| 292 | + dol_print_error($db); |
|
| 293 | + } |
|
| 294 | + } |
|
| 295 | + } |
|
| 296 | + |
|
| 297 | + // Si verif ok et action modify, on modifie la ligne |
|
| 298 | + if ($ok && GETPOST('actionmodify')) |
|
| 299 | + { |
|
| 300 | + $rowidcol="rowid"; |
|
| 301 | + |
|
| 302 | + // Modify entry |
|
| 303 | + $sql = "UPDATE ".$tabname[$id]." SET "; |
|
| 304 | + // Modifie valeur des champs |
|
| 305 | + $i = 0; |
|
| 306 | + foreach ($listfieldmodify as $field) |
|
| 307 | + { |
|
| 308 | + $keycode=$listfieldvalue[$i]; |
|
| 309 | + if ($field == 'lang') $keycode='langcode'; |
|
| 310 | + |
|
| 311 | + if ($field == 'fk_user' && ! ($_POST['fk_user'] > 0)) $_POST['fk_user']=''; |
|
| 312 | + if ($field == 'topic') $_POST['topic']=$_POST['topic-'.$rowid]; |
|
| 313 | + if ($field == 'joinfiles') $_POST['joinfiles']=$_POST['joinfiles-'.$rowid]; |
|
| 314 | + if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid]; |
|
| 315 | + if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid]; |
|
| 316 | + if ($field == 'entity') $_POST[$keycode] = $conf->entity; |
|
| 317 | + if ($i) $sql.=","; |
|
| 318 | + $sql.= $field."="; |
|
| 319 | + if ($_POST[$keycode] == '' || ($keycode == 'langcode' && empty($_POST[$keycode]))) $sql.="null"; // For vat, we want/accept code = '' |
|
| 320 | + else $sql.="'".$db->escape($_POST[$keycode])."'"; |
|
| 321 | + $i++; |
|
| 322 | + } |
|
| 323 | + $sql.= " WHERE ".$rowidcol." = '".$rowid."'"; |
|
| 324 | + |
|
| 325 | + dol_syslog("actionmodify", LOG_DEBUG); |
|
| 326 | + //print $sql; |
|
| 327 | + $resql = $db->query($sql); |
|
| 328 | + if ($resql) |
|
| 329 | + { |
|
| 330 | + setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); |
|
| 331 | + } |
|
| 332 | + else |
|
| 333 | + { |
|
| 334 | + setEventMessages($db->error(), null, 'errors'); |
|
| 335 | + } |
|
| 336 | + } |
|
| 337 | + } |
|
| 338 | + |
|
| 339 | + if ($action == 'confirm_delete' && $confirm == 'yes') // delete |
|
| 340 | + { |
|
| 341 | + $rowidcol="rowid"; |
|
| 342 | + |
|
| 343 | + $sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'"; |
|
| 344 | + |
|
| 345 | + dol_syslog("delete", LOG_DEBUG); |
|
| 346 | + $result = $db->query($sql); |
|
| 347 | + if (! $result) |
|
| 348 | + { |
|
| 349 | + if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') |
|
| 350 | + { |
|
| 351 | + setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); |
|
| 352 | + } |
|
| 353 | + else |
|
| 354 | + { |
|
| 355 | + dol_print_error($db); |
|
| 356 | + } |
|
| 357 | + } |
|
| 358 | + } |
|
| 359 | + |
|
| 360 | + // activate |
|
| 361 | + if ($action == $acts[0]) |
|
| 362 | + { |
|
| 363 | + $rowidcol="rowid"; |
|
| 364 | + |
|
| 365 | + $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'"; |
|
| 366 | + |
|
| 367 | + $result = $db->query($sql); |
|
| 368 | + if (!$result) |
|
| 369 | + { |
|
| 370 | + dol_print_error($db); |
|
| 371 | + } |
|
| 372 | + } |
|
| 373 | + |
|
| 374 | + // disable |
|
| 375 | + if ($action == $acts[1]) |
|
| 376 | + { |
|
| 377 | + $rowidcol="rowid"; |
|
| 378 | + |
|
| 379 | + $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'"; |
|
| 380 | + |
|
| 381 | + $result = $db->query($sql); |
|
| 382 | + if (!$result) |
|
| 383 | + { |
|
| 384 | + dol_print_error($db); |
|
| 385 | + } |
|
| 386 | + } |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | // Confirmation de la suppression de la ligne |
| 410 | 410 | if ($action == 'delete') |
| 411 | 411 | { |
| 412 | - print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1); |
|
| 412 | + print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1); |
|
| 413 | 413 | } |
| 414 | 414 | //var_dump($elementList); |
| 415 | 415 | |
@@ -433,20 +433,20 @@ discard block |
||
| 433 | 433 | if ($search_topic) $sql.=natural_search('topic', $search_topic); |
| 434 | 434 | if ($sortfield) |
| 435 | 435 | { |
| 436 | - // If sort order is "country", we use country_code instead |
|
| 436 | + // If sort order is "country", we use country_code instead |
|
| 437 | 437 | if ($sortfield == 'country') $sortfield='country_code'; |
| 438 | - $sql.= " ORDER BY ".$sortfield; |
|
| 439 | - if ($sortorder) |
|
| 440 | - { |
|
| 441 | - $sql.=" ".strtoupper($sortorder); |
|
| 442 | - } |
|
| 443 | - $sql.=", "; |
|
| 444 | - // Clear the required sort criteria for the tabsqlsort to be able to force it with selected value |
|
| 445 | - $tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i','',$tabsqlsort[$id]); |
|
| 446 | - $tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.',/i','',$tabsqlsort[$id]); |
|
| 438 | + $sql.= " ORDER BY ".$sortfield; |
|
| 439 | + if ($sortorder) |
|
| 440 | + { |
|
| 441 | + $sql.=" ".strtoupper($sortorder); |
|
| 442 | + } |
|
| 443 | + $sql.=", "; |
|
| 444 | + // Clear the required sort criteria for the tabsqlsort to be able to force it with selected value |
|
| 445 | + $tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i','',$tabsqlsort[$id]); |
|
| 446 | + $tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.',/i','',$tabsqlsort[$id]); |
|
| 447 | 447 | } |
| 448 | 448 | else { |
| 449 | - $sql.=" ORDER BY "; |
|
| 449 | + $sql.=" ORDER BY "; |
|
| 450 | 450 | } |
| 451 | 451 | $sql.=$tabsqlsort[$id]; |
| 452 | 452 | $sql.=$db->plimit($listlimit+1,$offset); |
@@ -469,38 +469,38 @@ discard block |
||
| 469 | 469 | print '<tr class="liste_titre">'; |
| 470 | 470 | foreach ($fieldlist as $field => $value) |
| 471 | 471 | { |
| 472 | - // Determine le nom du champ par rapport aux noms possibles |
|
| 473 | - // dans les dictionnaires de donnees |
|
| 474 | - $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut |
|
| 475 | - $valuetoshow=$langs->trans($valuetoshow); // try to translate |
|
| 476 | - $align="left"; |
|
| 477 | - if ($fieldlist[$field]=='fk_user') { $valuetoshow=$langs->trans("Owner");} |
|
| 478 | - if ($fieldlist[$field]=='lang') { $valuetoshow=(empty($conf->global->MAIN_MULTILANGS) ? ' ' : $langs->trans("Language")); } |
|
| 479 | - if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } |
|
| 480 | - if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } |
|
| 481 | - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); } |
|
| 482 | - if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } |
|
| 483 | - if ($fieldlist[$field]=='private') { $align='center'; } |
|
| 484 | - if ($fieldlist[$field]=='position') { $align='center'; } |
|
| 485 | - |
|
| 486 | - if ($fieldlist[$field]=='topic') { $valuetoshow=''; } |
|
| 487 | - if ($fieldlist[$field]=='joinfiles') { $valuetoshow=''; } |
|
| 488 | - if ($fieldlist[$field]=='content') { $valuetoshow=''; } |
|
| 489 | - if ($fieldlist[$field]=='content_lines') { $valuetoshow=''; } |
|
| 490 | - |
|
| 491 | - if ($valuetoshow != '') |
|
| 492 | - { |
|
| 493 | - print '<td align="'.$align.'">'; |
|
| 494 | - if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>'; |
|
| 495 | - else if (! empty($tabhelp[$id][$value])) |
|
| 496 | - { |
|
| 497 | - if (in_array($value, array('topic'))) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, $value); // Tooltip on click |
|
| 498 | - else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover |
|
| 499 | - } |
|
| 500 | - else print $valuetoshow; |
|
| 501 | - print '</td>'; |
|
| 502 | - } |
|
| 503 | - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; |
|
| 472 | + // Determine le nom du champ par rapport aux noms possibles |
|
| 473 | + // dans les dictionnaires de donnees |
|
| 474 | + $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut |
|
| 475 | + $valuetoshow=$langs->trans($valuetoshow); // try to translate |
|
| 476 | + $align="left"; |
|
| 477 | + if ($fieldlist[$field]=='fk_user') { $valuetoshow=$langs->trans("Owner");} |
|
| 478 | + if ($fieldlist[$field]=='lang') { $valuetoshow=(empty($conf->global->MAIN_MULTILANGS) ? ' ' : $langs->trans("Language")); } |
|
| 479 | + if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } |
|
| 480 | + if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } |
|
| 481 | + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); } |
|
| 482 | + if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } |
|
| 483 | + if ($fieldlist[$field]=='private') { $align='center'; } |
|
| 484 | + if ($fieldlist[$field]=='position') { $align='center'; } |
|
| 485 | + |
|
| 486 | + if ($fieldlist[$field]=='topic') { $valuetoshow=''; } |
|
| 487 | + if ($fieldlist[$field]=='joinfiles') { $valuetoshow=''; } |
|
| 488 | + if ($fieldlist[$field]=='content') { $valuetoshow=''; } |
|
| 489 | + if ($fieldlist[$field]=='content_lines') { $valuetoshow=''; } |
|
| 490 | + |
|
| 491 | + if ($valuetoshow != '') |
|
| 492 | + { |
|
| 493 | + print '<td align="'.$align.'">'; |
|
| 494 | + if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>'; |
|
| 495 | + else if (! empty($tabhelp[$id][$value])) |
|
| 496 | + { |
|
| 497 | + if (in_array($value, array('topic'))) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, $value); // Tooltip on click |
|
| 498 | + else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover |
|
| 499 | + } |
|
| 500 | + else print $valuetoshow; |
|
| 501 | + print '</td>'; |
|
| 502 | + } |
|
| 503 | + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; |
|
| 504 | 504 | } |
| 505 | 505 | print '<td>'; |
| 506 | 506 | print '<input type="hidden" name="id" value="' . $id . '">'; |
@@ -618,85 +618,85 @@ discard block |
||
| 618 | 618 | $resql=$db->query($sql); |
| 619 | 619 | if ($resql) |
| 620 | 620 | { |
| 621 | - $num = $db->num_rows($resql); |
|
| 622 | - $i = 0; |
|
| 623 | - $var=true; |
|
| 624 | - |
|
| 625 | - $param = '&id='.$id; |
|
| 626 | - $paramwithsearch = $param; |
|
| 627 | - if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder; |
|
| 628 | - if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield; |
|
| 629 | - if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha'); |
|
| 630 | - |
|
| 631 | - // There is several pages |
|
| 632 | - if ($num > $listlimit) |
|
| 633 | - { |
|
| 634 | - print '<tr class="none"><td align="right" colspan="'.(3+count($fieldlist)).'">'; |
|
| 635 | - print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>'); |
|
| 636 | - print '</td></tr>'; |
|
| 637 | - } |
|
| 638 | - |
|
| 639 | - |
|
| 640 | - // Title line with search boxes |
|
| 641 | - print '<tr class="liste_titre">'; |
|
| 642 | - $filterfound=0; |
|
| 643 | - foreach ($fieldlist as $field => $value) |
|
| 644 | - { |
|
| 645 | - if ($value == 'label') print '<td class="liste_titre"><input type="text" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>'; |
|
| 646 | - elseif ($value == 'lang') |
|
| 647 | - { |
|
| 648 | - print '<td class="liste_titre">'; |
|
| 649 | - print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth150'); |
|
| 650 | - print '</td>'; |
|
| 651 | - } |
|
| 652 | - elseif ($value == 'fk_user') |
|
| 653 | - { |
|
| 654 | - print '<td class="liste_titre">'; |
|
| 655 | - $restrictid=array(); |
|
| 656 | - if (! $user->admin) $restrictid=array($user->id); |
|
| 657 | - //var_dump($restrictid); |
|
| 658 | - print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth200'); |
|
| 659 | - print '</td>'; |
|
| 660 | - } |
|
| 661 | - elseif ($value == 'topic') print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>'; |
|
| 662 | - elseif ($value == 'type_template') |
|
| 663 | - { |
|
| 664 | - print '<td class="liste_titre">'.$form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200 maxwidth100onsmartphone').'</td>'; |
|
| 665 | - } |
|
| 666 | - elseif (! in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>'; |
|
| 667 | - } |
|
| 668 | - if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>'; |
|
| 669 | - // Action column |
|
| 670 | - print '<td class="liste_titre" align="right" width="64">'; |
|
| 671 | - $searchpicto=$form->showFilterButtons(); |
|
| 672 | - print $searchpicto; |
|
| 673 | - print '</td>'; |
|
| 674 | - print '</tr>'; |
|
| 675 | - |
|
| 676 | - // Title of lines |
|
| 677 | - print '<tr class="liste_titre">'; |
|
| 678 | - foreach ($fieldlist as $field => $value) |
|
| 679 | - { |
|
| 680 | - // Determine le nom du champ par rapport aux noms possibles |
|
| 681 | - // dans les dictionnaires de donnees |
|
| 682 | - $showfield=1; // By defaut |
|
| 683 | - $align="left"; |
|
| 684 | - $sortable=1; |
|
| 685 | - $valuetoshow=''; |
|
| 686 | - /* |
|
| 621 | + $num = $db->num_rows($resql); |
|
| 622 | + $i = 0; |
|
| 623 | + $var=true; |
|
| 624 | + |
|
| 625 | + $param = '&id='.$id; |
|
| 626 | + $paramwithsearch = $param; |
|
| 627 | + if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder; |
|
| 628 | + if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield; |
|
| 629 | + if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha'); |
|
| 630 | + |
|
| 631 | + // There is several pages |
|
| 632 | + if ($num > $listlimit) |
|
| 633 | + { |
|
| 634 | + print '<tr class="none"><td align="right" colspan="'.(3+count($fieldlist)).'">'; |
|
| 635 | + print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>'); |
|
| 636 | + print '</td></tr>'; |
|
| 637 | + } |
|
| 638 | + |
|
| 639 | + |
|
| 640 | + // Title line with search boxes |
|
| 641 | + print '<tr class="liste_titre">'; |
|
| 642 | + $filterfound=0; |
|
| 643 | + foreach ($fieldlist as $field => $value) |
|
| 644 | + { |
|
| 645 | + if ($value == 'label') print '<td class="liste_titre"><input type="text" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>'; |
|
| 646 | + elseif ($value == 'lang') |
|
| 647 | + { |
|
| 648 | + print '<td class="liste_titre">'; |
|
| 649 | + print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth150'); |
|
| 650 | + print '</td>'; |
|
| 651 | + } |
|
| 652 | + elseif ($value == 'fk_user') |
|
| 653 | + { |
|
| 654 | + print '<td class="liste_titre">'; |
|
| 655 | + $restrictid=array(); |
|
| 656 | + if (! $user->admin) $restrictid=array($user->id); |
|
| 657 | + //var_dump($restrictid); |
|
| 658 | + print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth200'); |
|
| 659 | + print '</td>'; |
|
| 660 | + } |
|
| 661 | + elseif ($value == 'topic') print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>'; |
|
| 662 | + elseif ($value == 'type_template') |
|
| 663 | + { |
|
| 664 | + print '<td class="liste_titre">'.$form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200 maxwidth100onsmartphone').'</td>'; |
|
| 665 | + } |
|
| 666 | + elseif (! in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>'; |
|
| 667 | + } |
|
| 668 | + if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>'; |
|
| 669 | + // Action column |
|
| 670 | + print '<td class="liste_titre" align="right" width="64">'; |
|
| 671 | + $searchpicto=$form->showFilterButtons(); |
|
| 672 | + print $searchpicto; |
|
| 673 | + print '</td>'; |
|
| 674 | + print '</tr>'; |
|
| 675 | + |
|
| 676 | + // Title of lines |
|
| 677 | + print '<tr class="liste_titre">'; |
|
| 678 | + foreach ($fieldlist as $field => $value) |
|
| 679 | + { |
|
| 680 | + // Determine le nom du champ par rapport aux noms possibles |
|
| 681 | + // dans les dictionnaires de donnees |
|
| 682 | + $showfield=1; // By defaut |
|
| 683 | + $align="left"; |
|
| 684 | + $sortable=1; |
|
| 685 | + $valuetoshow=''; |
|
| 686 | + /* |
|
| 687 | 687 | $tmparray=getLabelOfField($fieldlist[$field]); |
| 688 | 688 | $showfield=$tmp['showfield']; |
| 689 | 689 | $valuetoshow=$tmp['valuetoshow']; |
| 690 | 690 | $align=$tmp['align']; |
| 691 | 691 | $sortable=$tmp['sortable']; |
| 692 | 692 | */ |
| 693 | - $valuetoshow=ucfirst($fieldlist[$field]); // By defaut |
|
| 694 | - $valuetoshow=$langs->trans($valuetoshow); // try to translate |
|
| 695 | - if ($fieldlist[$field]=='fk_user') { $valuetoshow=$langs->trans("Owner"); } |
|
| 696 | - if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } |
|
| 697 | - if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } |
|
| 698 | - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); } |
|
| 699 | - if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } |
|
| 693 | + $valuetoshow=ucfirst($fieldlist[$field]); // By defaut |
|
| 694 | + $valuetoshow=$langs->trans($valuetoshow); // try to translate |
|
| 695 | + if ($fieldlist[$field]=='fk_user') { $valuetoshow=$langs->trans("Owner"); } |
|
| 696 | + if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } |
|
| 697 | + if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } |
|
| 698 | + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); } |
|
| 699 | + if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } |
|
| 700 | 700 | if ($fieldlist[$field]=='private') { $align='center'; } |
| 701 | 701 | if ($fieldlist[$field]=='position') { $align='center'; } |
| 702 | 702 | |
@@ -704,180 +704,180 @@ discard block |
||
| 704 | 704 | if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); $showfield=0;} |
| 705 | 705 | if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); $showfield=0; } |
| 706 | 706 | |
| 707 | - // Affiche nom du champ |
|
| 708 | - if ($showfield) |
|
| 709 | - { |
|
| 710 | - if (! empty($tabhelp[$id][$value])) |
|
| 711 | - { |
|
| 712 | - if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value); // Tooltip on click |
|
| 713 | - else $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, '', 1); // Tooltip on hover |
|
| 714 | - } |
|
| 715 | - print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder); |
|
| 716 | - } |
|
| 717 | - } |
|
| 718 | - |
|
| 719 | - print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder); |
|
| 720 | - print getTitleFieldOfList(''); |
|
| 721 | - print '</tr>'; |
|
| 722 | - |
|
| 723 | - if ($num) |
|
| 724 | - { |
|
| 725 | - // Lines with values |
|
| 726 | - while ($i < $num) |
|
| 727 | - { |
|
| 728 | - $obj = $db->fetch_object($resql); |
|
| 729 | - |
|
| 730 | - print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">'; |
|
| 731 | - |
|
| 732 | - if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code))) |
|
| 733 | - { |
|
| 734 | - $tmpaction='edit'; |
|
| 735 | - $parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); |
|
| 736 | - $reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks |
|
| 737 | - $error=$hookmanager->error; $errors=$hookmanager->errors; |
|
| 738 | - |
|
| 739 | - // Show fields |
|
| 740 | - if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit'); |
|
| 741 | - |
|
| 742 | - print '<td></td><td></td><td></td>'; |
|
| 743 | - print '<td align="center">'; |
|
| 744 | - print '<input type="hidden" name="page" value="'.$page.'">'; |
|
| 745 | - print '<input type="hidden" name="rowid" value="'.$rowid.'">'; |
|
| 746 | - print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">'; |
|
| 747 | - print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>'; |
|
| 748 | - print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">'; |
|
| 749 | - print '</td>'; |
|
| 750 | - |
|
| 751 | - $fieldsforcontent = array('topic', 'joinfiles', 'content'); |
|
| 752 | - if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) |
|
| 753 | - { |
|
| 754 | - $fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines'); |
|
| 755 | - } |
|
| 756 | - foreach ($fieldsforcontent as $tmpfieldlist) |
|
| 757 | - { |
|
| 758 | - $showfield = 1; |
|
| 759 | - $align = "left"; |
|
| 760 | - $valuetoshow = $obj->{$tmpfieldlist}; |
|
| 707 | + // Affiche nom du champ |
|
| 708 | + if ($showfield) |
|
| 709 | + { |
|
| 710 | + if (! empty($tabhelp[$id][$value])) |
|
| 711 | + { |
|
| 712 | + if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value); // Tooltip on click |
|
| 713 | + else $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, '', 1); // Tooltip on hover |
|
| 714 | + } |
|
| 715 | + print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder); |
|
| 716 | + } |
|
| 717 | + } |
|
| 761 | 718 | |
| 762 | - $class = 'tddict'; |
|
| 763 | - // Show value for field |
|
| 764 | - if ($showfield) { |
|
| 719 | + print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder); |
|
| 720 | + print getTitleFieldOfList(''); |
|
| 721 | + print '</tr>'; |
|
| 722 | + |
|
| 723 | + if ($num) |
|
| 724 | + { |
|
| 725 | + // Lines with values |
|
| 726 | + while ($i < $num) |
|
| 727 | + { |
|
| 728 | + $obj = $db->fetch_object($resql); |
|
| 729 | + |
|
| 730 | + print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">'; |
|
| 731 | + |
|
| 732 | + if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code))) |
|
| 733 | + { |
|
| 734 | + $tmpaction='edit'; |
|
| 735 | + $parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); |
|
| 736 | + $reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks |
|
| 737 | + $error=$hookmanager->error; $errors=$hookmanager->errors; |
|
| 738 | + |
|
| 739 | + // Show fields |
|
| 740 | + if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit'); |
|
| 741 | + |
|
| 742 | + print '<td></td><td></td><td></td>'; |
|
| 743 | + print '<td align="center">'; |
|
| 744 | + print '<input type="hidden" name="page" value="'.$page.'">'; |
|
| 745 | + print '<input type="hidden" name="rowid" value="'.$rowid.'">'; |
|
| 746 | + print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">'; |
|
| 747 | + print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>'; |
|
| 748 | + print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">'; |
|
| 749 | + print '</td>'; |
|
| 750 | + |
|
| 751 | + $fieldsforcontent = array('topic', 'joinfiles', 'content'); |
|
| 752 | + if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) |
|
| 753 | + { |
|
| 754 | + $fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines'); |
|
| 755 | + } |
|
| 756 | + foreach ($fieldsforcontent as $tmpfieldlist) |
|
| 757 | + { |
|
| 758 | + $showfield = 1; |
|
| 759 | + $align = "left"; |
|
| 760 | + $valuetoshow = $obj->{$tmpfieldlist}; |
|
| 761 | + |
|
| 762 | + $class = 'tddict'; |
|
| 763 | + // Show value for field |
|
| 764 | + if ($showfield) { |
|
| 765 | 765 | // Show line for topic, joinfiles and content |
| 766 | - print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$rowid.' ">'; |
|
| 767 | - print '<td colspan="8">'; |
|
| 768 | - if ($tmpfieldlist == 'topic') |
|
| 769 | - { |
|
| 770 | - print '<strong>' . $form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> '; |
|
| 771 | - print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">'; |
|
| 772 | - } |
|
| 773 | - if ($tmpfieldlist == 'joinfiles') |
|
| 774 | - { |
|
| 775 | - print '<strong>' . $form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> '; |
|
| 776 | - print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'-'.$rowid.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">'; |
|
| 777 | - } |
|
| 778 | - if ($tmpfieldlist == 'content') |
|
| 779 | - { |
|
| 780 | - $okforextended = true; |
|
| 781 | - if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false; |
|
| 782 | - $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%'); |
|
| 783 | - print $doleditor->Create(1); |
|
| 784 | - } |
|
| 785 | - print '</td>'; |
|
| 786 | - print '<td></td>'; |
|
| 787 | - print '<td></td>'; |
|
| 788 | - } |
|
| 789 | - } |
|
| 790 | - } |
|
| 791 | - else |
|
| 792 | - { |
|
| 793 | - $tmpaction = 'view'; |
|
| 794 | - $parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); |
|
| 795 | - $reshook=$hookmanager->executeHooks('viewDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks |
|
| 766 | + print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$rowid.' ">'; |
|
| 767 | + print '<td colspan="8">'; |
|
| 768 | + if ($tmpfieldlist == 'topic') |
|
| 769 | + { |
|
| 770 | + print '<strong>' . $form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> '; |
|
| 771 | + print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">'; |
|
| 772 | + } |
|
| 773 | + if ($tmpfieldlist == 'joinfiles') |
|
| 774 | + { |
|
| 775 | + print '<strong>' . $form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> '; |
|
| 776 | + print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'-'.$rowid.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">'; |
|
| 777 | + } |
|
| 778 | + if ($tmpfieldlist == 'content') |
|
| 779 | + { |
|
| 780 | + $okforextended = true; |
|
| 781 | + if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false; |
|
| 782 | + $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%'); |
|
| 783 | + print $doleditor->Create(1); |
|
| 784 | + } |
|
| 785 | + print '</td>'; |
|
| 786 | + print '<td></td>'; |
|
| 787 | + print '<td></td>'; |
|
| 788 | + } |
|
| 789 | + } |
|
| 790 | + } |
|
| 791 | + else |
|
| 792 | + { |
|
| 793 | + $tmpaction = 'view'; |
|
| 794 | + $parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); |
|
| 795 | + $reshook=$hookmanager->executeHooks('viewDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks |
|
| 796 | 796 | |
| 797 | - $error=$hookmanager->error; $errors=$hookmanager->errors; |
|
| 797 | + $error=$hookmanager->error; $errors=$hookmanager->errors; |
|
| 798 | 798 | |
| 799 | - if (empty($reshook)) |
|
| 800 | - { |
|
| 801 | - foreach ($fieldlist as $field => $value) |
|
| 802 | - { |
|
| 803 | - if (in_array($fieldlist[$field], array('content','content_lines'))) continue; |
|
| 804 | - $showfield=1; |
|
| 805 | - $align="left"; |
|
| 806 | - $valuetoshow=$obj->{$fieldlist[$field]}; |
|
| 807 | - if ($value == 'type_template') |
|
| 808 | - { |
|
| 809 | - $valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow; |
|
| 810 | - } |
|
| 811 | - if ($value == 'lang' && $valuetoshow) |
|
| 812 | - { |
|
| 813 | - $valuetoshow = $valuetoshow.' - '.$langs->trans("Language_".$valuetoshow); |
|
| 814 | - } |
|
| 815 | - if ($value == 'fk_user') |
|
| 816 | - { |
|
| 817 | - if ($valuetoshow > 0) |
|
| 818 | - { |
|
| 819 | - $fuser=new User($db); |
|
| 820 | - $fuser->fetch($valuetoshow); |
|
| 821 | - $valuetoshow = $fuser->getNomUrl(1); |
|
| 822 | - } |
|
| 823 | - } |
|
| 824 | - if ($value == 'private') |
|
| 825 | - { |
|
| 826 | - $align="center"; |
|
| 827 | - if ($valuetoshow) $valuetoshow=yn($valuetoshow); |
|
| 828 | - else $valuetoshow=''; |
|
| 829 | - } |
|
| 830 | - if ($value == 'position') |
|
| 831 | - { |
|
| 832 | - $align="center"; |
|
| 833 | - } |
|
| 834 | - if ($value == 'joinfiles') |
|
| 835 | - { |
|
| 836 | - $align="center"; |
|
| 837 | - if ($valuetoshow) $valuetoshow=1; |
|
| 838 | - else $valuetoshow=''; |
|
| 839 | - } |
|
| 840 | - |
|
| 841 | - $class='tddict'; |
|
| 799 | + if (empty($reshook)) |
|
| 800 | + { |
|
| 801 | + foreach ($fieldlist as $field => $value) |
|
| 802 | + { |
|
| 803 | + if (in_array($fieldlist[$field], array('content','content_lines'))) continue; |
|
| 804 | + $showfield=1; |
|
| 805 | + $align="left"; |
|
| 806 | + $valuetoshow=$obj->{$fieldlist[$field]}; |
|
| 807 | + if ($value == 'type_template') |
|
| 808 | + { |
|
| 809 | + $valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow; |
|
| 810 | + } |
|
| 811 | + if ($value == 'lang' && $valuetoshow) |
|
| 812 | + { |
|
| 813 | + $valuetoshow = $valuetoshow.' - '.$langs->trans("Language_".$valuetoshow); |
|
| 814 | + } |
|
| 815 | + if ($value == 'fk_user') |
|
| 816 | + { |
|
| 817 | + if ($valuetoshow > 0) |
|
| 818 | + { |
|
| 819 | + $fuser=new User($db); |
|
| 820 | + $fuser->fetch($valuetoshow); |
|
| 821 | + $valuetoshow = $fuser->getNomUrl(1); |
|
| 822 | + } |
|
| 823 | + } |
|
| 824 | + if ($value == 'private') |
|
| 825 | + { |
|
| 826 | + $align="center"; |
|
| 827 | + if ($valuetoshow) $valuetoshow=yn($valuetoshow); |
|
| 828 | + else $valuetoshow=''; |
|
| 829 | + } |
|
| 830 | + if ($value == 'position') |
|
| 831 | + { |
|
| 832 | + $align="center"; |
|
| 833 | + } |
|
| 834 | + if ($value == 'joinfiles') |
|
| 835 | + { |
|
| 836 | + $align="center"; |
|
| 837 | + if ($valuetoshow) $valuetoshow=1; |
|
| 838 | + else $valuetoshow=''; |
|
| 839 | + } |
|
| 840 | + |
|
| 841 | + $class='tddict'; |
|
| 842 | 842 | // Show value for field |
| 843 | 843 | if ($showfield) |
| 844 | 844 | { |
| 845 | - print '<!-- '.$fieldlist[$field].' -->'; |
|
| 846 | - print '<td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>'; |
|
| 845 | + print '<!-- '.$fieldlist[$field].' -->'; |
|
| 846 | + print '<td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>'; |
|
| 847 | 847 | } |
| 848 | - } |
|
| 849 | - } |
|
| 848 | + } |
|
| 849 | + } |
|
| 850 | 850 | |
| 851 | - // Can an entry be erased or disabled ? |
|
| 852 | - $iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default |
|
| 853 | - if (! $user->admin && $obj->fk_user != $user->id) |
|
| 854 | - { |
|
| 855 | - $iserasable=0; |
|
| 856 | - $canbedisabled=0; |
|
| 857 | - $canbemodified=0; |
|
| 858 | - } |
|
| 851 | + // Can an entry be erased or disabled ? |
|
| 852 | + $iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default |
|
| 853 | + if (! $user->admin && $obj->fk_user != $user->id) |
|
| 854 | + { |
|
| 855 | + $iserasable=0; |
|
| 856 | + $canbedisabled=0; |
|
| 857 | + $canbemodified=0; |
|
| 858 | + } |
|
| 859 | 859 | |
| 860 | - $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):''); |
|
| 861 | - if ($param) $url .= '&'.$param; |
|
| 862 | - $url.='&'; |
|
| 860 | + $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):''); |
|
| 861 | + if ($param) $url .= '&'.$param; |
|
| 862 | + $url.='&'; |
|
| 863 | 863 | |
| 864 | - // Status / Active |
|
| 865 | - print '<td align="center" class="nowrap">'; |
|
| 866 | - if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>'; |
|
| 867 | - print "</td>"; |
|
| 864 | + // Status / Active |
|
| 865 | + print '<td align="center" class="nowrap">'; |
|
| 866 | + if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>'; |
|
| 867 | + print "</td>"; |
|
| 868 | 868 | |
| 869 | - // Modify link / Delete link |
|
| 870 | - print '<td class="center nowraponall" width="64">'; |
|
| 871 | - if ($canbemodified) print '<a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a>'; |
|
| 872 | - if ($iserasable) |
|
| 873 | - { |
|
| 874 | - print ' <a href="'.$url.'action=delete">'.img_delete().'</a>'; |
|
| 875 | - //else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin |
|
| 876 | - } |
|
| 877 | - print '</td>'; |
|
| 869 | + // Modify link / Delete link |
|
| 870 | + print '<td class="center nowraponall" width="64">'; |
|
| 871 | + if ($canbemodified) print '<a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a>'; |
|
| 872 | + if ($iserasable) |
|
| 873 | + { |
|
| 874 | + print ' <a href="'.$url.'action=delete">'.img_delete().'</a>'; |
|
| 875 | + //else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin |
|
| 876 | + } |
|
| 877 | + print '</td>'; |
|
| 878 | 878 | |
| 879 | 879 | |
| 880 | - /* |
|
| 880 | + /* |
|
| 881 | 881 | $fieldsforcontent = array('content'); |
| 882 | 882 | if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) |
| 883 | 883 | { |
@@ -904,16 +904,16 @@ discard block |
||
| 904 | 904 | |
| 905 | 905 | } |
| 906 | 906 | }*/ |
| 907 | - } |
|
| 908 | - print "</tr>\n"; |
|
| 907 | + } |
|
| 908 | + print "</tr>\n"; |
|
| 909 | 909 | |
| 910 | 910 | |
| 911 | - $i++; |
|
| 912 | - } |
|
| 913 | - } |
|
| 911 | + $i++; |
|
| 912 | + } |
|
| 913 | + } |
|
| 914 | 914 | } |
| 915 | 915 | else { |
| 916 | - dol_print_error($db); |
|
| 916 | + dol_print_error($db); |
|
| 917 | 917 | } |
| 918 | 918 | |
| 919 | 919 | print '</table>'; |
@@ -42,139 +42,139 @@ discard block |
||
| 42 | 42 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; |
| 43 | 43 | |
| 44 | 44 | // Load traductions files requiredby by page |
| 45 | -$langs->loadLangs(array("errors","admin","mails","languages")); |
|
| 45 | +$langs->loadLangs(array("errors", "admin", "mails", "languages")); |
|
| 46 | 46 | |
| 47 | -$action = GETPOST('action','alpha')?GETPOST('action','alpha'):'view'; |
|
| 48 | -$confirm = GETPOST('confirm','alpha'); // Result of a confirmation |
|
| 47 | +$action = GETPOST('action', 'alpha') ?GETPOST('action', 'alpha') : 'view'; |
|
| 48 | +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation |
|
| 49 | 49 | |
| 50 | -$id = GETPOST('id','int'); |
|
| 51 | -$rowid = GETPOST('rowid','alpha'); |
|
| 52 | -$search_label=GETPOST('search_label','alpha'); |
|
| 53 | -$search_type_template=GETPOST('search_type_template','alpha'); |
|
| 54 | -$search_lang=GETPOST('search_lang','alpha'); |
|
| 55 | -$search_fk_user=GETPOST('search_fk_user','intcomma'); |
|
| 56 | -$search_topic=GETPOST('search_topic','alpha'); |
|
| 50 | +$id = GETPOST('id', 'int'); |
|
| 51 | +$rowid = GETPOST('rowid', 'alpha'); |
|
| 52 | +$search_label = GETPOST('search_label', 'alpha'); |
|
| 53 | +$search_type_template = GETPOST('search_type_template', 'alpha'); |
|
| 54 | +$search_lang = GETPOST('search_lang', 'alpha'); |
|
| 55 | +$search_fk_user = GETPOST('search_fk_user', 'intcomma'); |
|
| 56 | +$search_topic = GETPOST('search_topic', 'alpha'); |
|
| 57 | 57 | |
| 58 | -$allowed=1; |
|
| 59 | -if (! $allowed) accessforbidden(); |
|
| 58 | +$allowed = 1; |
|
| 59 | +if (!$allowed) accessforbidden(); |
|
| 60 | 60 | |
| 61 | 61 | $acts[0] = "activate"; |
| 62 | 62 | $acts[1] = "disable"; |
| 63 | -$actl[0] = img_picto($langs->trans("Disabled"),'switch_off'); |
|
| 64 | -$actl[1] = img_picto($langs->trans("Activated"),'switch_on'); |
|
| 63 | +$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off'); |
|
| 64 | +$actl[1] = img_picto($langs->trans("Activated"), 'switch_on'); |
|
| 65 | 65 | |
| 66 | -$listoffset=GETPOST('listoffset','alpha'); |
|
| 67 | -$listlimit =GETPOST('listlimit','alpha')>0?GETPOST('listlimit','alpha'):1000; |
|
| 66 | +$listoffset = GETPOST('listoffset', 'alpha'); |
|
| 67 | +$listlimit = GETPOST('listlimit', 'alpha') > 0 ?GETPOST('listlimit', 'alpha') : 1000; |
|
| 68 | 68 | $active = 1; |
| 69 | 69 | |
| 70 | -$sortfield = GETPOST("sortfield",'alpha'); |
|
| 71 | -$sortorder = GETPOST("sortorder",'alpha'); |
|
| 72 | -$page = GETPOST("page",'int'); |
|
| 70 | +$sortfield = GETPOST("sortfield", 'alpha'); |
|
| 71 | +$sortorder = GETPOST("sortorder", 'alpha'); |
|
| 72 | +$page = GETPOST("page", 'int'); |
|
| 73 | 73 | if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 |
| 74 | -$offset = $listlimit * $page ; |
|
| 74 | +$offset = $listlimit * $page; |
|
| 75 | 75 | $pageprev = $page - 1; |
| 76 | 76 | $pagenext = $page + 1; |
| 77 | 77 | |
| 78 | -if (empty($sortfield)) $sortfield='label, lang, position'; |
|
| 79 | -if (empty($sortorder)) $sortorder='ASC'; |
|
| 78 | +if (empty($sortfield)) $sortfield = 'label, lang, position'; |
|
| 79 | +if (empty($sortorder)) $sortorder = 'ASC'; |
|
| 80 | 80 | |
| 81 | 81 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
| 82 | 82 | $hookmanager->initHooks(array('emailtemplates')); |
| 83 | 83 | |
| 84 | 84 | // Name of SQL tables of dictionaries |
| 85 | -$tabname=array(); |
|
| 86 | -$tabname[25]= MAIN_DB_PREFIX."c_email_templates"; |
|
| 85 | +$tabname = array(); |
|
| 86 | +$tabname[25] = MAIN_DB_PREFIX."c_email_templates"; |
|
| 87 | 87 | |
| 88 | 88 | // Criteria to sort dictionaries |
| 89 | -$tabsqlsort=array(); |
|
| 90 | -$tabsqlsort[25]="label ASC, lang ASC, position ASC"; |
|
| 89 | +$tabsqlsort = array(); |
|
| 90 | +$tabsqlsort[25] = "label ASC, lang ASC, position ASC"; |
|
| 91 | 91 | |
| 92 | 92 | // Nom des champs en resultat de select pour affichage du dictionnaire |
| 93 | -$tabfield=array(); |
|
| 94 | -$tabfield[25]= "label,type_template,lang,fk_user,private,position,topic,joinfiles,content"; |
|
| 95 | -if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfield[25].=',content_lines'; |
|
| 93 | +$tabfield = array(); |
|
| 94 | +$tabfield[25] = "label,type_template,lang,fk_user,private,position,topic,joinfiles,content"; |
|
| 95 | +if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfield[25] .= ',content_lines'; |
|
| 96 | 96 | |
| 97 | 97 | // Nom des champs d'edition pour modification d'un enregistrement |
| 98 | -$tabfieldvalue=array(); |
|
| 99 | -$tabfieldvalue[25]= "label,type_template,fk_user,lang,private,position,topic,joinfiles,content"; |
|
| 100 | -if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldvalue[25].=',content_lines'; |
|
| 98 | +$tabfieldvalue = array(); |
|
| 99 | +$tabfieldvalue[25] = "label,type_template,fk_user,lang,private,position,topic,joinfiles,content"; |
|
| 100 | +if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldvalue[25] .= ',content_lines'; |
|
| 101 | 101 | |
| 102 | 102 | // Nom des champs dans la table pour insertion d'un enregistrement |
| 103 | -$tabfieldinsert=array(); |
|
| 104 | -$tabfieldinsert[25]= "label,type_template,fk_user,lang,private,position,topic,joinfiles,content"; |
|
| 105 | -if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldinsert[25].=',content_lines'; |
|
| 106 | -$tabfieldinsert[25].=',entity'; // Must be at end because not into other arrays |
|
| 103 | +$tabfieldinsert = array(); |
|
| 104 | +$tabfieldinsert[25] = "label,type_template,fk_user,lang,private,position,topic,joinfiles,content"; |
|
| 105 | +if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldinsert[25] .= ',content_lines'; |
|
| 106 | +$tabfieldinsert[25] .= ',entity'; // Must be at end because not into other arrays |
|
| 107 | 107 | |
| 108 | 108 | // Condition to show dictionary in setup page |
| 109 | -$tabcond=array(); |
|
| 110 | -$tabcond[25]= true; |
|
| 109 | +$tabcond = array(); |
|
| 110 | +$tabcond[25] = true; |
|
| 111 | 111 | |
| 112 | 112 | // List of help for fields |
| 113 | 113 | // Set MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES to allow edit of template for lines |
| 114 | 114 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
| 115 | -$formmail=new FormMail($db); |
|
| 115 | +$formmail = new FormMail($db); |
|
| 116 | 116 | if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) |
| 117 | 117 | { |
| 118 | - $tmp=FormMail::getAvailableSubstitKey('formemail'); |
|
| 119 | - $tmp['__(AnyTranslationKey)__']='Translation'; |
|
| 118 | + $tmp = FormMail::getAvailableSubstitKey('formemail'); |
|
| 119 | + $tmp['__(AnyTranslationKey)__'] = 'Translation'; |
|
| 120 | 120 | $helpsubstit = $langs->trans("AvailableVariables").':<br>'; |
| 121 | 121 | $helpsubstitforlines = $langs->trans("AvailableVariables").':<br>'; |
| 122 | - foreach($tmp as $key => $val) |
|
| 122 | + foreach ($tmp as $key => $val) |
|
| 123 | 123 | { |
| 124 | - $helpsubstit.=$key.' -> '.$val.'<br>'; |
|
| 125 | - $helpsubstitforlines.=$key.' -> '.$val.'<br>'; |
|
| 124 | + $helpsubstit .= $key.' -> '.$val.'<br>'; |
|
| 125 | + $helpsubstitforlines .= $key.' -> '.$val.'<br>'; |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | else |
| 129 | 129 | { |
| 130 | - $tmp=FormMail::getAvailableSubstitKey('formemailwithlines'); |
|
| 131 | - $tmp['__(AnyTranslationKey)__']='Translation'; |
|
| 130 | + $tmp = FormMail::getAvailableSubstitKey('formemailwithlines'); |
|
| 131 | + $tmp['__(AnyTranslationKey)__'] = 'Translation'; |
|
| 132 | 132 | $helpsubstit = $langs->trans("AvailableVariables").':<br>'; |
| 133 | 133 | $helpsubstitforlines = $langs->trans("AvailableVariables").':<br>'; |
| 134 | - foreach($tmp as $key => $val) |
|
| 134 | + foreach ($tmp as $key => $val) |
|
| 135 | 135 | { |
| 136 | - $helpsubstit.=$key.' -> '.$val.'<br>'; |
|
| 136 | + $helpsubstit .= $key.' -> '.$val.'<br>'; |
|
| 137 | 137 | } |
| 138 | - $tmp=FormMail::getAvailableSubstitKey('formemailforlines'); |
|
| 139 | - foreach($tmp as $key => $val) |
|
| 138 | + $tmp = FormMail::getAvailableSubstitKey('formemailforlines'); |
|
| 139 | + foreach ($tmp as $key => $val) |
|
| 140 | 140 | { |
| 141 | - $helpsubstitforlines.=$key.' -> '.$val.'<br>'; |
|
| 141 | + $helpsubstitforlines .= $key.' -> '.$val.'<br>'; |
|
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | |
| 146 | -$tabhelp=array(); |
|
| 147 | -$tabhelp[25] = array('topic'=>$helpsubstit,'joinfiles'=>$langs->trans('AttachMainDocByDefault'), 'content'=>$helpsubstit,'content_lines'=>$helpsubstitforlines,'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList")); |
|
| 146 | +$tabhelp = array(); |
|
| 147 | +$tabhelp[25] = array('topic'=>$helpsubstit, 'joinfiles'=>$langs->trans('AttachMainDocByDefault'), 'content'=>$helpsubstit, 'content_lines'=>$helpsubstitforlines, 'type_template'=>$langs->trans("TemplateForElement"), 'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList")); |
|
| 148 | 148 | |
| 149 | 149 | // List of check for fields (NOT USED YET) |
| 150 | -$tabfieldcheck=array(); |
|
| 150 | +$tabfieldcheck = array(); |
|
| 151 | 151 | $tabfieldcheck[25] = array(); |
| 152 | 152 | |
| 153 | 153 | |
| 154 | 154 | // Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact") |
| 155 | 155 | $elementList = array(); |
| 156 | -$sourceList=array(); |
|
| 156 | +$sourceList = array(); |
|
| 157 | 157 | |
| 158 | 158 | // We save list of template email Dolibarr can manage. This list can found by a grep into code on "->param['models']" |
| 159 | 159 | $elementList = array(); |
| 160 | -if ($conf->propal->enabled) $elementList['propal_send']=$langs->trans('MailToSendProposal'); |
|
| 161 | -if ($conf->commande->enabled) $elementList['order_send']=$langs->trans('MailToSendOrder'); |
|
| 162 | -if ($conf->facture->enabled) $elementList['facture_send']=$langs->trans('MailToSendInvoice'); |
|
| 163 | -if ($conf->expedition->enabled) $elementList['shipping_send']=$langs->trans('MailToSendShipment'); |
|
| 164 | -if ($conf->ficheinter->enabled) $elementList['fichinter_send']=$langs->trans('MailToSendIntervention'); |
|
| 165 | -if ($conf->supplier_proposal->enabled) $elementList['supplier_proposal_send']=$langs->trans('MailToSendSupplierRequestForQuotation'); |
|
| 166 | -if ($conf->fournisseur->enabled) $elementList['order_supplier_send']=$langs->trans('MailToSendSupplierOrder'); |
|
| 167 | -if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice'); |
|
| 168 | -if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty'); |
|
| 169 | -if ($conf->adherent->enabled) $elementList['member']=$langs->trans('MailToMember'); |
|
| 170 | -if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract'); |
|
| 171 | -$elementList['user']=$langs->trans('MailToUser'); |
|
| 172 | -$elementList['all'] =$langs->trans('VisibleEverywhere'); |
|
| 173 | -$elementList['none']=$langs->trans('VisibleNowhere'); |
|
| 174 | - |
|
| 175 | - |
|
| 176 | -$parameters=array('elementList'=>$elementList); |
|
| 177 | -$reshook=$hookmanager->executeHooks('emailElementlist',$parameters); // Note that $action and $object may have been modified by some hooks |
|
| 160 | +if ($conf->propal->enabled) $elementList['propal_send'] = $langs->trans('MailToSendProposal'); |
|
| 161 | +if ($conf->commande->enabled) $elementList['order_send'] = $langs->trans('MailToSendOrder'); |
|
| 162 | +if ($conf->facture->enabled) $elementList['facture_send'] = $langs->trans('MailToSendInvoice'); |
|
| 163 | +if ($conf->expedition->enabled) $elementList['shipping_send'] = $langs->trans('MailToSendShipment'); |
|
| 164 | +if ($conf->ficheinter->enabled) $elementList['fichinter_send'] = $langs->trans('MailToSendIntervention'); |
|
| 165 | +if ($conf->supplier_proposal->enabled) $elementList['supplier_proposal_send'] = $langs->trans('MailToSendSupplierRequestForQuotation'); |
|
| 166 | +if ($conf->fournisseur->enabled) $elementList['order_supplier_send'] = $langs->trans('MailToSendSupplierOrder'); |
|
| 167 | +if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send'] = $langs->trans('MailToSendSupplierInvoice'); |
|
| 168 | +if ($conf->societe->enabled) $elementList['thirdparty'] = $langs->trans('MailToThirdparty'); |
|
| 169 | +if ($conf->adherent->enabled) $elementList['member'] = $langs->trans('MailToMember'); |
|
| 170 | +if ($conf->contrat->enabled) $elementList['contract'] = $langs->trans('MailToSendContract'); |
|
| 171 | +$elementList['user'] = $langs->trans('MailToUser'); |
|
| 172 | +$elementList['all'] = $langs->trans('VisibleEverywhere'); |
|
| 173 | +$elementList['none'] = $langs->trans('VisibleNowhere'); |
|
| 174 | + |
|
| 175 | + |
|
| 176 | +$parameters = array('elementList'=>$elementList); |
|
| 177 | +$reshook = $hookmanager->executeHooks('emailElementlist', $parameters); // Note that $action and $object may have been modified by some hooks |
|
| 178 | 178 | if ($reshook == 0) { |
| 179 | 179 | foreach ($hookmanager->resArray as $item => $value) { |
| 180 | 180 | $elementList[$item] = $value; |
@@ -188,37 +188,37 @@ discard block |
||
| 188 | 188 | * Actions |
| 189 | 189 | */ |
| 190 | 190 | |
| 191 | -if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; } |
|
| 192 | -if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } |
|
| 191 | +if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } |
|
| 192 | +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } |
|
| 193 | 193 | |
| 194 | -$parameters=array(); |
|
| 195 | -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
| 194 | +$parameters = array(); |
|
| 195 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 196 | 196 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 197 | 197 | |
| 198 | 198 | if (empty($reshook)) |
| 199 | 199 | { |
| 200 | 200 | // Purge search criteria |
| 201 | - if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers |
|
| 201 | + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers |
|
| 202 | 202 | { |
| 203 | - $search_label=''; |
|
| 204 | - $search_type_template=''; |
|
| 205 | - $search_lang=''; |
|
| 206 | - $search_fk_user=''; |
|
| 207 | - $search_topic=''; |
|
| 208 | - $toselect=''; |
|
| 209 | - $search_array_options=array(); |
|
| 203 | + $search_label = ''; |
|
| 204 | + $search_type_template = ''; |
|
| 205 | + $search_lang = ''; |
|
| 206 | + $search_fk_user = ''; |
|
| 207 | + $search_topic = ''; |
|
| 208 | + $toselect = ''; |
|
| 209 | + $search_array_options = array(); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | // Actions add or modify an entry into a dictionary |
| 213 | 213 | if (GETPOST('actionadd') || GETPOST('actionmodify')) |
| 214 | 214 | { |
| 215 | - $listfield=explode(',', str_replace(' ', '',$tabfield[$id])); |
|
| 216 | - $listfieldinsert=explode(',',$tabfieldinsert[$id]); |
|
| 217 | - $listfieldmodify=explode(',',$tabfieldinsert[$id]); |
|
| 218 | - $listfieldvalue=explode(',',$tabfieldvalue[$id]); |
|
| 215 | + $listfield = explode(',', str_replace(' ', '', $tabfield[$id])); |
|
| 216 | + $listfieldinsert = explode(',', $tabfieldinsert[$id]); |
|
| 217 | + $listfieldmodify = explode(',', $tabfieldinsert[$id]); |
|
| 218 | + $listfieldvalue = explode(',', $tabfieldvalue[$id]); |
|
| 219 | 219 | |
| 220 | 220 | // Check that all fields are filled |
| 221 | - $ok=1; |
|
| 221 | + $ok = 1; |
|
| 222 | 222 | foreach ($listfield as $f => $value) |
| 223 | 223 | { |
| 224 | 224 | // Not mandatory fields |
@@ -226,14 +226,14 @@ discard block |
||
| 226 | 226 | if ($value == 'content') continue; |
| 227 | 227 | if ($value == 'content_lines') continue; |
| 228 | 228 | |
| 229 | - if (GETPOST('actionmodify') && $value == 'topic') $_POST['topic']=$_POST['topic-'.$rowid]; |
|
| 229 | + if (GETPOST('actionmodify') && $value == 'topic') $_POST['topic'] = $_POST['topic-'.$rowid]; |
|
| 230 | 230 | |
| 231 | - if ((! isset($_POST[$value]) || $_POST[$value]=='' || $_POST[$value]=='-1') && $value != 'lang' && $value != 'fk_user' && $value != 'position') |
|
| 231 | + if ((!isset($_POST[$value]) || $_POST[$value] == '' || $_POST[$value] == '-1') && $value != 'lang' && $value != 'fk_user' && $value != 'position') |
|
| 232 | 232 | { |
| 233 | - $ok=0; |
|
| 234 | - $fieldnamekey=$listfield[$f]; |
|
| 233 | + $ok = 0; |
|
| 234 | + $fieldnamekey = $listfield[$f]; |
|
| 235 | 235 | // We take translate key of field |
| 236 | - if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label'; |
|
| 236 | + if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey = 'Label'; |
|
| 237 | 237 | if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments'; |
| 238 | 238 | if ($fieldnamekey == 'code') $fieldnamekey = 'Code'; |
| 239 | 239 | if ($fieldnamekey == 'note') $fieldnamekey = 'Note'; |
@@ -253,35 +253,35 @@ discard block |
||
| 253 | 253 | // Add new entry |
| 254 | 254 | $sql = "INSERT INTO ".$tabname[$id]." ("; |
| 255 | 255 | // List of fields |
| 256 | - $sql.= $tabfieldinsert[$id]; |
|
| 257 | - $sql.=",active)"; |
|
| 258 | - $sql.= " VALUES("; |
|
| 256 | + $sql .= $tabfieldinsert[$id]; |
|
| 257 | + $sql .= ",active)"; |
|
| 258 | + $sql .= " VALUES("; |
|
| 259 | 259 | |
| 260 | 260 | // List of values |
| 261 | - $i=0; |
|
| 261 | + $i = 0; |
|
| 262 | 262 | foreach ($listfieldinsert as $f => $value) |
| 263 | 263 | { |
| 264 | 264 | //var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value); |
| 265 | - $keycode=$listfieldvalue[$i]; |
|
| 266 | - if ($value == 'lang') $keycode='langcode'; |
|
| 265 | + $keycode = $listfieldvalue[$i]; |
|
| 266 | + if ($value == 'lang') $keycode = 'langcode'; |
|
| 267 | 267 | if ($value == 'entity') $_POST[$keycode] = $conf->entity; |
| 268 | - if ($i) $sql.=","; |
|
| 269 | - if ($value == 'fk_user' && ! ($_POST[$keycode] > 0)) $_POST[$keycode]=''; |
|
| 270 | - if ($value == 'private' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='0'; |
|
| 271 | - if ($value == 'position' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='1'; |
|
| 272 | - if ($_POST[$keycode] == '' && $keycode != 'langcode') $sql.="null"; // lang must be '' if not defined so the unique key that include lang will work |
|
| 273 | - elseif ($_POST[$keycode] == '0' && $keycode == 'langcode') $sql.="null"; |
|
| 274 | - else $sql.="'".$db->escape($_POST[$keycode])."'"; |
|
| 268 | + if ($i) $sql .= ","; |
|
| 269 | + if ($value == 'fk_user' && !($_POST[$keycode] > 0)) $_POST[$keycode] = ''; |
|
| 270 | + if ($value == 'private' && !is_numeric($_POST[$keycode])) $_POST[$keycode] = '0'; |
|
| 271 | + if ($value == 'position' && !is_numeric($_POST[$keycode])) $_POST[$keycode] = '1'; |
|
| 272 | + if ($_POST[$keycode] == '' && $keycode != 'langcode') $sql .= "null"; // lang must be '' if not defined so the unique key that include lang will work |
|
| 273 | + elseif ($_POST[$keycode] == '0' && $keycode == 'langcode') $sql .= "null"; |
|
| 274 | + else $sql .= "'".$db->escape($_POST[$keycode])."'"; |
|
| 275 | 275 | $i++; |
| 276 | 276 | } |
| 277 | - $sql.=",1)"; |
|
| 277 | + $sql .= ",1)"; |
|
| 278 | 278 | |
| 279 | 279 | dol_syslog("actionadd", LOG_DEBUG); |
| 280 | 280 | $result = $db->query($sql); |
| 281 | 281 | if ($result) // Add is ok |
| 282 | 282 | { |
| 283 | 283 | setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); |
| 284 | - $_POST=array('id'=>$id); // Clean $_POST array, we keep only |
|
| 284 | + $_POST = array('id'=>$id); // Clean $_POST array, we keep only |
|
| 285 | 285 | } |
| 286 | 286 | else |
| 287 | 287 | { |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | // Si verif ok et action modify, on modifie la ligne |
| 298 | 298 | if ($ok && GETPOST('actionmodify')) |
| 299 | 299 | { |
| 300 | - $rowidcol="rowid"; |
|
| 300 | + $rowidcol = "rowid"; |
|
| 301 | 301 | |
| 302 | 302 | // Modify entry |
| 303 | 303 | $sql = "UPDATE ".$tabname[$id]." SET "; |
@@ -305,22 +305,22 @@ discard block |
||
| 305 | 305 | $i = 0; |
| 306 | 306 | foreach ($listfieldmodify as $field) |
| 307 | 307 | { |
| 308 | - $keycode=$listfieldvalue[$i]; |
|
| 309 | - if ($field == 'lang') $keycode='langcode'; |
|
| 310 | - |
|
| 311 | - if ($field == 'fk_user' && ! ($_POST['fk_user'] > 0)) $_POST['fk_user']=''; |
|
| 312 | - if ($field == 'topic') $_POST['topic']=$_POST['topic-'.$rowid]; |
|
| 313 | - if ($field == 'joinfiles') $_POST['joinfiles']=$_POST['joinfiles-'.$rowid]; |
|
| 314 | - if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid]; |
|
| 315 | - if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid]; |
|
| 308 | + $keycode = $listfieldvalue[$i]; |
|
| 309 | + if ($field == 'lang') $keycode = 'langcode'; |
|
| 310 | + |
|
| 311 | + if ($field == 'fk_user' && !($_POST['fk_user'] > 0)) $_POST['fk_user'] = ''; |
|
| 312 | + if ($field == 'topic') $_POST['topic'] = $_POST['topic-'.$rowid]; |
|
| 313 | + if ($field == 'joinfiles') $_POST['joinfiles'] = $_POST['joinfiles-'.$rowid]; |
|
| 314 | + if ($field == 'content') $_POST['content'] = $_POST['content-'.$rowid]; |
|
| 315 | + if ($field == 'content_lines') $_POST['content_lines'] = $_POST['content_lines-'.$rowid]; |
|
| 316 | 316 | if ($field == 'entity') $_POST[$keycode] = $conf->entity; |
| 317 | - if ($i) $sql.=","; |
|
| 318 | - $sql.= $field."="; |
|
| 319 | - if ($_POST[$keycode] == '' || ($keycode == 'langcode' && empty($_POST[$keycode]))) $sql.="null"; // For vat, we want/accept code = '' |
|
| 320 | - else $sql.="'".$db->escape($_POST[$keycode])."'"; |
|
| 317 | + if ($i) $sql .= ","; |
|
| 318 | + $sql .= $field."="; |
|
| 319 | + if ($_POST[$keycode] == '' || ($keycode == 'langcode' && empty($_POST[$keycode]))) $sql .= "null"; // For vat, we want/accept code = '' |
|
| 320 | + else $sql .= "'".$db->escape($_POST[$keycode])."'"; |
|
| 321 | 321 | $i++; |
| 322 | 322 | } |
| 323 | - $sql.= " WHERE ".$rowidcol." = '".$rowid."'"; |
|
| 323 | + $sql .= " WHERE ".$rowidcol." = '".$rowid."'"; |
|
| 324 | 324 | |
| 325 | 325 | dol_syslog("actionmodify", LOG_DEBUG); |
| 326 | 326 | //print $sql; |
@@ -338,13 +338,13 @@ discard block |
||
| 338 | 338 | |
| 339 | 339 | if ($action == 'confirm_delete' && $confirm == 'yes') // delete |
| 340 | 340 | { |
| 341 | - $rowidcol="rowid"; |
|
| 341 | + $rowidcol = "rowid"; |
|
| 342 | 342 | |
| 343 | 343 | $sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'"; |
| 344 | 344 | |
| 345 | 345 | dol_syslog("delete", LOG_DEBUG); |
| 346 | 346 | $result = $db->query($sql); |
| 347 | - if (! $result) |
|
| 347 | + if (!$result) |
|
| 348 | 348 | { |
| 349 | 349 | if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') |
| 350 | 350 | { |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | // activate |
| 361 | 361 | if ($action == $acts[0]) |
| 362 | 362 | { |
| 363 | - $rowidcol="rowid"; |
|
| 363 | + $rowidcol = "rowid"; |
|
| 364 | 364 | |
| 365 | 365 | $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'"; |
| 366 | 366 | |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | // disable |
| 375 | 375 | if ($action == $acts[1]) |
| 376 | 376 | { |
| 377 | - $rowidcol="rowid"; |
|
| 377 | + $rowidcol = "rowid"; |
|
| 378 | 378 | |
| 379 | 379 | $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'"; |
| 380 | 380 | |
@@ -392,15 +392,15 @@ discard block |
||
| 392 | 392 | */ |
| 393 | 393 | |
| 394 | 394 | $form = new Form($db); |
| 395 | -$formadmin=new FormAdmin($db); |
|
| 395 | +$formadmin = new FormAdmin($db); |
|
| 396 | 396 | |
| 397 | 397 | llxHeader(); |
| 398 | 398 | |
| 399 | -$titre=$langs->trans("EMailsSetup"); |
|
| 400 | -$linkback=''; |
|
| 401 | -$titlepicto='title_setup'; |
|
| 399 | +$titre = $langs->trans("EMailsSetup"); |
|
| 400 | +$linkback = ''; |
|
| 401 | +$titlepicto = 'title_setup'; |
|
| 402 | 402 | |
| 403 | -print load_fiche_titre($titre,$linkback,$titlepicto); |
|
| 403 | +print load_fiche_titre($titre, $linkback, $titlepicto); |
|
| 404 | 404 | |
| 405 | 405 | $head = email_admin_prepare_head(); |
| 406 | 406 | |
@@ -409,58 +409,58 @@ discard block |
||
| 409 | 409 | // Confirmation de la suppression de la ligne |
| 410 | 410 | if ($action == 'delete') |
| 411 | 411 | { |
| 412 | - print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1); |
|
| 412 | + print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1); |
|
| 413 | 413 | } |
| 414 | 414 | //var_dump($elementList); |
| 415 | 415 | |
| 416 | 416 | |
| 417 | -$sql="SELECT rowid as rowid, label, type_template, lang, fk_user, private, position, topic, joinfiles, content_lines, content, active"; |
|
| 418 | -$sql.=" FROM ".MAIN_DB_PREFIX."c_email_templates"; |
|
| 419 | -$sql.=" WHERE entity IN (".getEntity('email_template').")"; |
|
| 420 | -if (! $user->admin) |
|
| 417 | +$sql = "SELECT rowid as rowid, label, type_template, lang, fk_user, private, position, topic, joinfiles, content_lines, content, active"; |
|
| 418 | +$sql .= " FROM ".MAIN_DB_PREFIX."c_email_templates"; |
|
| 419 | +$sql .= " WHERE entity IN (".getEntity('email_template').")"; |
|
| 420 | +if (!$user->admin) |
|
| 421 | 421 | { |
| 422 | - $sql.=" AND (private = 0 OR (private = 1 AND fk_user = ".$user->id."))"; // Show only public and private to me |
|
| 423 | - $sql.=" AND (active = 1 OR fk_user = ".$user->id.")"; // Show only active or owned by me |
|
| 422 | + $sql .= " AND (private = 0 OR (private = 1 AND fk_user = ".$user->id."))"; // Show only public and private to me |
|
| 423 | + $sql .= " AND (active = 1 OR fk_user = ".$user->id.")"; // Show only active or owned by me |
|
| 424 | 424 | } |
| 425 | 425 | if (empty($conf->global->MAIN_MULTILANGS)) |
| 426 | 426 | { |
| 427 | - $sql.= " AND (lang = '".$langs->defaultlang."' OR lang IS NULL OR lang = '')"; |
|
| 427 | + $sql .= " AND (lang = '".$langs->defaultlang."' OR lang IS NULL OR lang = '')"; |
|
| 428 | 428 | } |
| 429 | -if ($search_label) $sql.=natural_search('label', $search_label); |
|
| 430 | -if ($search_type_template != '' && $search_type_template != '-1') $sql.=natural_search('type_template', $search_type_template); |
|
| 431 | -if ($search_lang) $sql.=natural_search('lang', $search_lang); |
|
| 432 | -if ($search_fk_user != '' && $search_fk_user != '-1') $sql.=natural_search('fk_user', $search_fk_user, 2); |
|
| 433 | -if ($search_topic) $sql.=natural_search('topic', $search_topic); |
|
| 429 | +if ($search_label) $sql .= natural_search('label', $search_label); |
|
| 430 | +if ($search_type_template != '' && $search_type_template != '-1') $sql .= natural_search('type_template', $search_type_template); |
|
| 431 | +if ($search_lang) $sql .= natural_search('lang', $search_lang); |
|
| 432 | +if ($search_fk_user != '' && $search_fk_user != '-1') $sql .= natural_search('fk_user', $search_fk_user, 2); |
|
| 433 | +if ($search_topic) $sql .= natural_search('topic', $search_topic); |
|
| 434 | 434 | if ($sortfield) |
| 435 | 435 | { |
| 436 | 436 | // If sort order is "country", we use country_code instead |
| 437 | - if ($sortfield == 'country') $sortfield='country_code'; |
|
| 438 | - $sql.= " ORDER BY ".$sortfield; |
|
| 437 | + if ($sortfield == 'country') $sortfield = 'country_code'; |
|
| 438 | + $sql .= " ORDER BY ".$sortfield; |
|
| 439 | 439 | if ($sortorder) |
| 440 | 440 | { |
| 441 | - $sql.=" ".strtoupper($sortorder); |
|
| 441 | + $sql .= " ".strtoupper($sortorder); |
|
| 442 | 442 | } |
| 443 | - $sql.=", "; |
|
| 443 | + $sql .= ", "; |
|
| 444 | 444 | // Clear the required sort criteria for the tabsqlsort to be able to force it with selected value |
| 445 | - $tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i','',$tabsqlsort[$id]); |
|
| 446 | - $tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.',/i','',$tabsqlsort[$id]); |
|
| 445 | + $tabsqlsort[$id] = preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i', '', $tabsqlsort[$id]); |
|
| 446 | + $tabsqlsort[$id] = preg_replace('/([a-z]+\.)?'.$sortfield.',/i', '', $tabsqlsort[$id]); |
|
| 447 | 447 | } |
| 448 | 448 | else { |
| 449 | - $sql.=" ORDER BY "; |
|
| 449 | + $sql .= " ORDER BY "; |
|
| 450 | 450 | } |
| 451 | -$sql.=$tabsqlsort[$id]; |
|
| 452 | -$sql.=$db->plimit($listlimit+1,$offset); |
|
| 451 | +$sql .= $tabsqlsort[$id]; |
|
| 452 | +$sql .= $db->plimit($listlimit + 1, $offset); |
|
| 453 | 453 | //print $sql; |
| 454 | 454 | |
| 455 | -$fieldlist=explode(',',$tabfield[$id]); |
|
| 455 | +$fieldlist = explode(',', $tabfield[$id]); |
|
| 456 | 456 | |
| 457 | 457 | // Form to add a new line |
| 458 | -$alabelisused=0; |
|
| 459 | -$var=false; |
|
| 458 | +$alabelisused = 0; |
|
| 459 | +$var = false; |
|
| 460 | 460 | |
| 461 | 461 | print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">'; |
| 462 | 462 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
| 463 | -print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">'; |
|
| 463 | +print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">'; |
|
| 464 | 464 | |
| 465 | 465 | print '<div class="div-table-responsive-no-min">'; |
| 466 | 466 | print '<table class="noborder" width="100%">'; |
@@ -471,39 +471,39 @@ discard block |
||
| 471 | 471 | { |
| 472 | 472 | // Determine le nom du champ par rapport aux noms possibles |
| 473 | 473 | // dans les dictionnaires de donnees |
| 474 | - $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut |
|
| 475 | - $valuetoshow=$langs->trans($valuetoshow); // try to translate |
|
| 476 | - $align="left"; |
|
| 477 | - if ($fieldlist[$field]=='fk_user') { $valuetoshow=$langs->trans("Owner");} |
|
| 478 | - if ($fieldlist[$field]=='lang') { $valuetoshow=(empty($conf->global->MAIN_MULTILANGS) ? ' ' : $langs->trans("Language")); } |
|
| 479 | - if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } |
|
| 480 | - if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } |
|
| 481 | - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); } |
|
| 482 | - if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } |
|
| 483 | - if ($fieldlist[$field]=='private') { $align='center'; } |
|
| 484 | - if ($fieldlist[$field]=='position') { $align='center'; } |
|
| 485 | - |
|
| 486 | - if ($fieldlist[$field]=='topic') { $valuetoshow=''; } |
|
| 487 | - if ($fieldlist[$field]=='joinfiles') { $valuetoshow=''; } |
|
| 488 | - if ($fieldlist[$field]=='content') { $valuetoshow=''; } |
|
| 489 | - if ($fieldlist[$field]=='content_lines') { $valuetoshow=''; } |
|
| 474 | + $valuetoshow = ucfirst($fieldlist[$field]); // Par defaut |
|
| 475 | + $valuetoshow = $langs->trans($valuetoshow); // try to translate |
|
| 476 | + $align = "left"; |
|
| 477 | + if ($fieldlist[$field] == 'fk_user') { $valuetoshow = $langs->trans("Owner"); } |
|
| 478 | + if ($fieldlist[$field] == 'lang') { $valuetoshow = (empty($conf->global->MAIN_MULTILANGS) ? ' ' : $langs->trans("Language")); } |
|
| 479 | + if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); } |
|
| 480 | + if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); } |
|
| 481 | + if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') { $valuetoshow = $langs->trans("Label"); } |
|
| 482 | + if ($fieldlist[$field] == 'type_template') { $valuetoshow = $langs->trans("TypeOfTemplate"); } |
|
| 483 | + if ($fieldlist[$field] == 'private') { $align = 'center'; } |
|
| 484 | + if ($fieldlist[$field] == 'position') { $align = 'center'; } |
|
| 485 | + |
|
| 486 | + if ($fieldlist[$field] == 'topic') { $valuetoshow = ''; } |
|
| 487 | + if ($fieldlist[$field] == 'joinfiles') { $valuetoshow = ''; } |
|
| 488 | + if ($fieldlist[$field] == 'content') { $valuetoshow = ''; } |
|
| 489 | + if ($fieldlist[$field] == 'content_lines') { $valuetoshow = ''; } |
|
| 490 | 490 | |
| 491 | 491 | if ($valuetoshow != '') |
| 492 | 492 | { |
| 493 | 493 | print '<td align="'.$align.'">'; |
| 494 | - if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>'; |
|
| 495 | - else if (! empty($tabhelp[$id][$value])) |
|
| 494 | + if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>'; |
|
| 495 | + else if (!empty($tabhelp[$id][$value])) |
|
| 496 | 496 | { |
| 497 | - if (in_array($value, array('topic'))) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, $value); // Tooltip on click |
|
| 498 | - else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover |
|
| 497 | + if (in_array($value, array('topic'))) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, $value); // Tooltip on click |
|
| 498 | + else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover |
|
| 499 | 499 | } |
| 500 | 500 | else print $valuetoshow; |
| 501 | 501 | print '</td>'; |
| 502 | 502 | } |
| 503 | - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; |
|
| 503 | + if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1; |
|
| 504 | 504 | } |
| 505 | 505 | print '<td>'; |
| 506 | -print '<input type="hidden" name="id" value="' . $id . '">'; |
|
| 506 | +print '<input type="hidden" name="id" value="'.$id.'">'; |
|
| 507 | 507 | print '</td>'; |
| 508 | 508 | print '</tr>'; |
| 509 | 509 | |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | |
| 529 | 529 | |
| 530 | 530 | // Line to enter new values (input fields) |
| 531 | -print "<tr " . $bcnd[$var] . ">"; |
|
| 531 | +print "<tr ".$bcnd[$var].">"; |
|
| 532 | 532 | |
| 533 | 533 | if (empty($reshook)) |
| 534 | 534 | { |
@@ -544,29 +544,29 @@ discard block |
||
| 544 | 544 | print "</tr>"; |
| 545 | 545 | |
| 546 | 546 | $fieldsforcontent = array('topic', 'joinfiles', 'content'); |
| 547 | -if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $fieldsforcontent = array('content','content_lines'); } |
|
| 547 | +if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $fieldsforcontent = array('content', 'content_lines'); } |
|
| 548 | 548 | foreach ($fieldsforcontent as $tmpfieldlist) |
| 549 | 549 | { |
| 550 | 550 | print '<tr class="impair nodrag nodrop nohover"><td colspan="6" class="nobottom">'; |
| 551 | 551 | // Label |
| 552 | 552 | if ($tmpfieldlist == 'topic') |
| 553 | 553 | { |
| 554 | - print '<strong>' . $form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> '; |
|
| 554 | + print '<strong>'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> '; |
|
| 555 | 555 | } |
| 556 | 556 | if ($tmpfieldlist == 'joinfiles') |
| 557 | 557 | { |
| 558 | - print '<strong>' . $form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> '; |
|
| 558 | + print '<strong>'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> '; |
|
| 559 | 559 | } |
| 560 | 560 | if ($tmpfieldlist == 'content') |
| 561 | 561 | print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist); |
| 562 | 562 | if ($tmpfieldlist == 'content_lines') |
| 563 | - print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '<br>'; |
|
| 563 | + print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>'; |
|
| 564 | 564 | // Input field |
| 565 | 565 | if ($tmpfieldlist == 'topic') { |
| 566 | - print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">'; |
|
| 566 | + print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">'; |
|
| 567 | 567 | } |
| 568 | 568 | else if ($tmpfieldlist == 'joinfiles') { |
| 569 | - print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">'; |
|
| 569 | + print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">'; |
|
| 570 | 570 | } |
| 571 | 571 | else |
| 572 | 572 | { |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | $okforextended = true; |
| 576 | 576 | if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) |
| 577 | 577 | $okforextended = false; |
| 578 | - $doleditor = new DolEditor($tmpfieldlist, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 120, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%'); |
|
| 578 | + $doleditor = new DolEditor($tmpfieldlist, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 120, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%'); |
|
| 579 | 579 | print $doleditor->Create(1); |
| 580 | 580 | } |
| 581 | 581 | else |
@@ -583,9 +583,9 @@ discard block |
||
| 583 | 583 | } |
| 584 | 584 | print '</td>'; |
| 585 | 585 | if ($tmpfieldlist == 'topic') { |
| 586 | - print '<td align="center" rowspan="' . (count($fieldsforcontent)) . '">'; |
|
| 586 | + print '<td align="center" rowspan="'.(count($fieldsforcontent)).'">'; |
|
| 587 | 587 | if ($action != 'edit') { |
| 588 | - print '<input type="submit" class="button" name="actionadd" value="' . $langs->trans("Add") . '">'; |
|
| 588 | + print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">'; |
|
| 589 | 589 | } |
| 590 | 590 | print '</td>'; |
| 591 | 591 | } |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | |
| 596 | 596 | |
| 597 | 597 | |
| 598 | -$colspan=count($fieldlist)+1; |
|
| 598 | +$colspan = count($fieldlist) + 1; |
|
| 599 | 599 | //print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height |
| 600 | 600 | |
| 601 | 601 | print '</table>'; |
@@ -608,38 +608,38 @@ discard block |
||
| 608 | 608 | |
| 609 | 609 | print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">'; |
| 610 | 610 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
| 611 | -print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">'; |
|
| 611 | +print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">'; |
|
| 612 | 612 | |
| 613 | 613 | print '<div class="div-table-responsive-no-min">'; |
| 614 | 614 | print '<table class="noborder" width="100%">'; |
| 615 | 615 | |
| 616 | 616 | // List of available record in database |
| 617 | 617 | dol_syslog("htdocs/admin/dict", LOG_DEBUG); |
| 618 | -$resql=$db->query($sql); |
|
| 618 | +$resql = $db->query($sql); |
|
| 619 | 619 | if ($resql) |
| 620 | 620 | { |
| 621 | 621 | $num = $db->num_rows($resql); |
| 622 | 622 | $i = 0; |
| 623 | - $var=true; |
|
| 623 | + $var = true; |
|
| 624 | 624 | |
| 625 | 625 | $param = '&id='.$id; |
| 626 | 626 | $paramwithsearch = $param; |
| 627 | - if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder; |
|
| 628 | - if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield; |
|
| 629 | - if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha'); |
|
| 627 | + if ($sortorder) $paramwithsearch .= '&sortorder='.$sortorder; |
|
| 628 | + if ($sortfield) $paramwithsearch .= '&sortfield='.$sortfield; |
|
| 629 | + if (GETPOST('from')) $paramwithsearch .= '&from='.GETPOST('from', 'alpha'); |
|
| 630 | 630 | |
| 631 | 631 | // There is several pages |
| 632 | 632 | if ($num > $listlimit) |
| 633 | 633 | { |
| 634 | - print '<tr class="none"><td align="right" colspan="'.(3+count($fieldlist)).'">'; |
|
| 635 | - print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>'); |
|
| 634 | + print '<tr class="none"><td align="right" colspan="'.(3 + count($fieldlist)).'">'; |
|
| 635 | + print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>'); |
|
| 636 | 636 | print '</td></tr>'; |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | |
| 640 | 640 | // Title line with search boxes |
| 641 | 641 | print '<tr class="liste_titre">'; |
| 642 | - $filterfound=0; |
|
| 642 | + $filterfound = 0; |
|
| 643 | 643 | foreach ($fieldlist as $field => $value) |
| 644 | 644 | { |
| 645 | 645 | if ($value == 'label') print '<td class="liste_titre"><input type="text" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>'; |
@@ -652,8 +652,8 @@ discard block |
||
| 652 | 652 | elseif ($value == 'fk_user') |
| 653 | 653 | { |
| 654 | 654 | print '<td class="liste_titre">'; |
| 655 | - $restrictid=array(); |
|
| 656 | - if (! $user->admin) $restrictid=array($user->id); |
|
| 655 | + $restrictid = array(); |
|
| 656 | + if (!$user->admin) $restrictid = array($user->id); |
|
| 657 | 657 | //var_dump($restrictid); |
| 658 | 658 | print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth200'); |
| 659 | 659 | print '</td>'; |
@@ -663,12 +663,12 @@ discard block |
||
| 663 | 663 | { |
| 664 | 664 | print '<td class="liste_titre">'.$form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200 maxwidth100onsmartphone').'</td>'; |
| 665 | 665 | } |
| 666 | - elseif (! in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>'; |
|
| 666 | + elseif (!in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>'; |
|
| 667 | 667 | } |
| 668 | 668 | if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>'; |
| 669 | 669 | // Action column |
| 670 | 670 | print '<td class="liste_titre" align="right" width="64">'; |
| 671 | - $searchpicto=$form->showFilterButtons(); |
|
| 671 | + $searchpicto = $form->showFilterButtons(); |
|
| 672 | 672 | print $searchpicto; |
| 673 | 673 | print '</td>'; |
| 674 | 674 | print '</tr>'; |
@@ -679,10 +679,10 @@ discard block |
||
| 679 | 679 | { |
| 680 | 680 | // Determine le nom du champ par rapport aux noms possibles |
| 681 | 681 | // dans les dictionnaires de donnees |
| 682 | - $showfield=1; // By defaut |
|
| 683 | - $align="left"; |
|
| 684 | - $sortable=1; |
|
| 685 | - $valuetoshow=''; |
|
| 682 | + $showfield = 1; // By defaut |
|
| 683 | + $align = "left"; |
|
| 684 | + $sortable = 1; |
|
| 685 | + $valuetoshow = ''; |
|
| 686 | 686 | /* |
| 687 | 687 | $tmparray=getLabelOfField($fieldlist[$field]); |
| 688 | 688 | $showfield=$tmp['showfield']; |
@@ -690,33 +690,33 @@ discard block |
||
| 690 | 690 | $align=$tmp['align']; |
| 691 | 691 | $sortable=$tmp['sortable']; |
| 692 | 692 | */ |
| 693 | - $valuetoshow=ucfirst($fieldlist[$field]); // By defaut |
|
| 694 | - $valuetoshow=$langs->trans($valuetoshow); // try to translate |
|
| 695 | - if ($fieldlist[$field]=='fk_user') { $valuetoshow=$langs->trans("Owner"); } |
|
| 696 | - if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } |
|
| 697 | - if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } |
|
| 698 | - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); } |
|
| 699 | - if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } |
|
| 700 | - if ($fieldlist[$field]=='private') { $align='center'; } |
|
| 701 | - if ($fieldlist[$field]=='position') { $align='center'; } |
|
| 702 | - |
|
| 703 | - if ($fieldlist[$field]=='joinfiles') { $valuetoshow=$langs->trans("FilesAttachedToEmail"); $align='center'; } |
|
| 704 | - if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); $showfield=0;} |
|
| 705 | - if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); $showfield=0; } |
|
| 693 | + $valuetoshow = ucfirst($fieldlist[$field]); // By defaut |
|
| 694 | + $valuetoshow = $langs->trans($valuetoshow); // try to translate |
|
| 695 | + if ($fieldlist[$field] == 'fk_user') { $valuetoshow = $langs->trans("Owner"); } |
|
| 696 | + if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); } |
|
| 697 | + if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); } |
|
| 698 | + if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') { $valuetoshow = $langs->trans("Label"); } |
|
| 699 | + if ($fieldlist[$field] == 'type_template') { $valuetoshow = $langs->trans("TypeOfTemplate"); } |
|
| 700 | + if ($fieldlist[$field] == 'private') { $align = 'center'; } |
|
| 701 | + if ($fieldlist[$field] == 'position') { $align = 'center'; } |
|
| 702 | + |
|
| 703 | + if ($fieldlist[$field] == 'joinfiles') { $valuetoshow = $langs->trans("FilesAttachedToEmail"); $align = 'center'; } |
|
| 704 | + if ($fieldlist[$field] == 'content') { $valuetoshow = $langs->trans("Content"); $showfield = 0; } |
|
| 705 | + if ($fieldlist[$field] == 'content_lines') { $valuetoshow = $langs->trans("ContentLines"); $showfield = 0; } |
|
| 706 | 706 | |
| 707 | 707 | // Affiche nom du champ |
| 708 | 708 | if ($showfield) |
| 709 | 709 | { |
| 710 | - if (! empty($tabhelp[$id][$value])) |
|
| 710 | + if (!empty($tabhelp[$id][$value])) |
|
| 711 | 711 | { |
| 712 | - if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value); // Tooltip on click |
|
| 713 | - else $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, '', 1); // Tooltip on hover |
|
| 712 | + if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value); // Tooltip on click |
|
| 713 | + else $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, '', 1); // Tooltip on hover |
|
| 714 | 714 | } |
| 715 | - print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder); |
|
| 715 | + print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "align=".$align, $sortfield, $sortorder); |
|
| 716 | 716 | } |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | - print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder); |
|
| 719 | + print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder); |
|
| 720 | 720 | print getTitleFieldOfList(''); |
| 721 | 721 | print '</tr>'; |
| 722 | 722 | |
@@ -729,27 +729,27 @@ discard block |
||
| 729 | 729 | |
| 730 | 730 | print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">'; |
| 731 | 731 | |
| 732 | - if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code))) |
|
| 732 | + if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) |
|
| 733 | 733 | { |
| 734 | - $tmpaction='edit'; |
|
| 735 | - $parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); |
|
| 736 | - $reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks |
|
| 737 | - $error=$hookmanager->error; $errors=$hookmanager->errors; |
|
| 734 | + $tmpaction = 'edit'; |
|
| 735 | + $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); |
|
| 736 | + $reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks |
|
| 737 | + $error = $hookmanager->error; $errors = $hookmanager->errors; |
|
| 738 | 738 | |
| 739 | 739 | // Show fields |
| 740 | - if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit'); |
|
| 740 | + if (empty($reshook)) fieldList($fieldlist, $obj, $tabname[$id], 'edit'); |
|
| 741 | 741 | |
| 742 | 742 | print '<td></td><td></td><td></td>'; |
| 743 | 743 | print '<td align="center">'; |
| 744 | 744 | print '<input type="hidden" name="page" value="'.$page.'">'; |
| 745 | 745 | print '<input type="hidden" name="rowid" value="'.$rowid.'">'; |
| 746 | 746 | print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">'; |
| 747 | - print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>'; |
|
| 747 | + print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>'; |
|
| 748 | 748 | print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">'; |
| 749 | 749 | print '</td>'; |
| 750 | 750 | |
| 751 | 751 | $fieldsforcontent = array('topic', 'joinfiles', 'content'); |
| 752 | - if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) |
|
| 752 | + if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) |
|
| 753 | 753 | { |
| 754 | 754 | $fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines'); |
| 755 | 755 | } |
@@ -767,19 +767,19 @@ discard block |
||
| 767 | 767 | print '<td colspan="8">'; |
| 768 | 768 | if ($tmpfieldlist == 'topic') |
| 769 | 769 | { |
| 770 | - print '<strong>' . $form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> '; |
|
| 771 | - print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">'; |
|
| 770 | + print '<strong>'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> '; |
|
| 771 | + print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">'; |
|
| 772 | 772 | } |
| 773 | 773 | if ($tmpfieldlist == 'joinfiles') |
| 774 | 774 | { |
| 775 | - print '<strong>' . $form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> '; |
|
| 776 | - print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'-'.$rowid.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">'; |
|
| 775 | + print '<strong>'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> '; |
|
| 776 | + print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">'; |
|
| 777 | 777 | } |
| 778 | 778 | if ($tmpfieldlist == 'content') |
| 779 | 779 | { |
| 780 | 780 | $okforextended = true; |
| 781 | 781 | if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false; |
| 782 | - $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%'); |
|
| 782 | + $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%'); |
|
| 783 | 783 | print $doleditor->Create(1); |
| 784 | 784 | } |
| 785 | 785 | print '</td>'; |
@@ -791,22 +791,22 @@ discard block |
||
| 791 | 791 | else |
| 792 | 792 | { |
| 793 | 793 | $tmpaction = 'view'; |
| 794 | - $parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); |
|
| 795 | - $reshook=$hookmanager->executeHooks('viewDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks |
|
| 794 | + $parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); |
|
| 795 | + $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks |
|
| 796 | 796 | |
| 797 | - $error=$hookmanager->error; $errors=$hookmanager->errors; |
|
| 797 | + $error = $hookmanager->error; $errors = $hookmanager->errors; |
|
| 798 | 798 | |
| 799 | 799 | if (empty($reshook)) |
| 800 | 800 | { |
| 801 | 801 | foreach ($fieldlist as $field => $value) |
| 802 | 802 | { |
| 803 | - if (in_array($fieldlist[$field], array('content','content_lines'))) continue; |
|
| 804 | - $showfield=1; |
|
| 805 | - $align="left"; |
|
| 806 | - $valuetoshow=$obj->{$fieldlist[$field]}; |
|
| 803 | + if (in_array($fieldlist[$field], array('content', 'content_lines'))) continue; |
|
| 804 | + $showfield = 1; |
|
| 805 | + $align = "left"; |
|
| 806 | + $valuetoshow = $obj->{$fieldlist[$field]}; |
|
| 807 | 807 | if ($value == 'type_template') |
| 808 | 808 | { |
| 809 | - $valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow; |
|
| 809 | + $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow; |
|
| 810 | 810 | } |
| 811 | 811 | if ($value == 'lang' && $valuetoshow) |
| 812 | 812 | { |
@@ -816,29 +816,29 @@ discard block |
||
| 816 | 816 | { |
| 817 | 817 | if ($valuetoshow > 0) |
| 818 | 818 | { |
| 819 | - $fuser=new User($db); |
|
| 819 | + $fuser = new User($db); |
|
| 820 | 820 | $fuser->fetch($valuetoshow); |
| 821 | 821 | $valuetoshow = $fuser->getNomUrl(1); |
| 822 | 822 | } |
| 823 | 823 | } |
| 824 | 824 | if ($value == 'private') |
| 825 | 825 | { |
| 826 | - $align="center"; |
|
| 827 | - if ($valuetoshow) $valuetoshow=yn($valuetoshow); |
|
| 828 | - else $valuetoshow=''; |
|
| 826 | + $align = "center"; |
|
| 827 | + if ($valuetoshow) $valuetoshow = yn($valuetoshow); |
|
| 828 | + else $valuetoshow = ''; |
|
| 829 | 829 | } |
| 830 | 830 | if ($value == 'position') |
| 831 | 831 | { |
| 832 | - $align="center"; |
|
| 832 | + $align = "center"; |
|
| 833 | 833 | } |
| 834 | 834 | if ($value == 'joinfiles') |
| 835 | 835 | { |
| 836 | - $align="center"; |
|
| 837 | - if ($valuetoshow) $valuetoshow=1; |
|
| 838 | - else $valuetoshow=''; |
|
| 836 | + $align = "center"; |
|
| 837 | + if ($valuetoshow) $valuetoshow = 1; |
|
| 838 | + else $valuetoshow = ''; |
|
| 839 | 839 | } |
| 840 | 840 | |
| 841 | - $class='tddict'; |
|
| 841 | + $class = 'tddict'; |
|
| 842 | 842 | // Show value for field |
| 843 | 843 | if ($showfield) |
| 844 | 844 | { |
@@ -849,17 +849,17 @@ discard block |
||
| 849 | 849 | } |
| 850 | 850 | |
| 851 | 851 | // Can an entry be erased or disabled ? |
| 852 | - $iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default |
|
| 853 | - if (! $user->admin && $obj->fk_user != $user->id) |
|
| 852 | + $iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default |
|
| 853 | + if (!$user->admin && $obj->fk_user != $user->id) |
|
| 854 | 854 | { |
| 855 | - $iserasable=0; |
|
| 856 | - $canbedisabled=0; |
|
| 857 | - $canbemodified=0; |
|
| 855 | + $iserasable = 0; |
|
| 856 | + $canbedisabled = 0; |
|
| 857 | + $canbemodified = 0; |
|
| 858 | 858 | } |
| 859 | 859 | |
| 860 | - $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):''); |
|
| 860 | + $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : ''); |
|
| 861 | 861 | if ($param) $url .= '&'.$param; |
| 862 | - $url.='&'; |
|
| 862 | + $url .= '&'; |
|
| 863 | 863 | |
| 864 | 864 | // Status / Active |
| 865 | 865 | print '<td align="center" class="nowrap">'; |
@@ -937,12 +937,12 @@ discard block |
||
| 937 | 937 | * @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered |
| 938 | 938 | * @return void |
| 939 | 939 | */ |
| 940 | -function fieldList($fieldlist, $obj='', $tabname='', $context='') |
|
| 940 | +function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') |
|
| 941 | 941 | { |
| 942 | 942 | global $conf, $langs, $user, $db; |
| 943 | 943 | global $form; |
| 944 | 944 | global $region_id; |
| 945 | - global $elementList,$sourceList,$localtax_typeList; |
|
| 945 | + global $elementList, $sourceList, $localtax_typeList; |
|
| 946 | 946 | global $bc; |
| 947 | 947 | |
| 948 | 948 | $formadmin = new FormAdmin($db); |
@@ -961,24 +961,24 @@ discard block |
||
| 961 | 961 | { |
| 962 | 962 | if ($context == 'add') // I am not admin and we show the add form |
| 963 | 963 | { |
| 964 | - print $user->getNomUrl(1); // Me |
|
| 965 | - $forcedvalue=$user->id; |
|
| 964 | + print $user->getNomUrl(1); // Me |
|
| 965 | + $forcedvalue = $user->id; |
|
| 966 | 966 | } |
| 967 | 967 | else |
| 968 | 968 | { |
| 969 | - if ($obj && ! empty($obj->{$fieldlist[$field]}) && $obj->{$fieldlist[$field]} > 0) |
|
| 969 | + if ($obj && !empty($obj->{$fieldlist[$field]}) && $obj->{$fieldlist[$field]} > 0) |
|
| 970 | 970 | { |
| 971 | - $fuser=new User($db); |
|
| 971 | + $fuser = new User($db); |
|
| 972 | 972 | $fuser->fetch($obj->{$fieldlist[$field]}); |
| 973 | 973 | print $fuser->getNomUrl(1); |
| 974 | - $forcedvalue=$fuser->id; |
|
| 974 | + $forcedvalue = $fuser->id; |
|
| 975 | 975 | } |
| 976 | 976 | else |
| 977 | 977 | { |
| 978 | - $forcedvalue=$obj->{$fieldlist[$field]}; |
|
| 978 | + $forcedvalue = $obj->{$fieldlist[$field]}; |
|
| 979 | 979 | } |
| 980 | 980 | } |
| 981 | - $keyname=$fieldlist[$field]; |
|
| 981 | + $keyname = $fieldlist[$field]; |
|
| 982 | 982 | print '<input type="hidden" value="'.$forcedvalue.'" name="'.$keyname.'">'; |
| 983 | 983 | } |
| 984 | 984 | print '</td>'; |
@@ -986,7 +986,7 @@ discard block |
||
| 986 | 986 | elseif ($fieldlist[$field] == 'lang') |
| 987 | 987 | { |
| 988 | 988 | print '<td>'; |
| 989 | - if (! empty($conf->global->MAIN_MULTILANGS)) |
|
| 989 | + if (!empty($conf->global->MAIN_MULTILANGS)) |
|
| 990 | 990 | { |
| 991 | 991 | $selectedlang = $langs->defaultlang; |
| 992 | 992 | if ($context == 'edit') $selectedlang = $obj->{$fieldlist[$field]}; |
@@ -994,12 +994,12 @@ discard block |
||
| 994 | 994 | } |
| 995 | 995 | else |
| 996 | 996 | { |
| 997 | - if (! empty($obj->{$fieldlist[$field]})) |
|
| 997 | + if (!empty($obj->{$fieldlist[$field]})) |
|
| 998 | 998 | { |
| 999 | 999 | print $obj->{$fieldlist[$field]}.' - '.$langs->trans('Language_'.$obj->{$fieldlist[$field]}); |
| 1000 | 1000 | } |
| 1001 | - $keyname=$fieldlist[$field]; |
|
| 1002 | - if ($keyname == 'lang') $keyname='langcode'; // Avoid conflict with lang param |
|
| 1001 | + $keyname = $fieldlist[$field]; |
|
| 1002 | + if ($keyname == 'lang') $keyname = 'langcode'; // Avoid conflict with lang param |
|
| 1003 | 1003 | print '<input type="hidden" value="'.$obj->{$fieldlist[$field]}.'" name="'.$keyname.'">'; |
| 1004 | 1004 | } |
| 1005 | 1005 | print '</td>'; |
@@ -1008,7 +1008,7 @@ discard block |
||
| 1008 | 1008 | elseif ($fieldlist[$field] == 'type_template') |
| 1009 | 1009 | { |
| 1010 | 1010 | print '<td>'; |
| 1011 | - if ($context == 'edit' && ! empty($obj->{$fieldlist[$field]}) && ! in_array($obj->{$fieldlist[$field]}, array_keys($elementList))) |
|
| 1011 | + if ($context == 'edit' && !empty($obj->{$fieldlist[$field]}) && !in_array($obj->{$fieldlist[$field]}, array_keys($elementList))) |
|
| 1012 | 1012 | { |
| 1013 | 1013 | // Current tempalte type is an unknown type, so we must keep it as it is. |
| 1014 | 1014 | print '<input type="hidden" name="type_template" value="'.$obj->{$fieldlist[$field]}.'">'; |
@@ -1016,7 +1016,7 @@ discard block |
||
| 1016 | 1016 | } |
| 1017 | 1017 | else |
| 1018 | 1018 | { |
| 1019 | - print $form->selectarray('type_template', $elementList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200'); |
|
| 1019 | + print $form->selectarray('type_template', $elementList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200'); |
|
| 1020 | 1020 | } |
| 1021 | 1021 | print '</td>'; |
| 1022 | 1022 | } |
@@ -1025,16 +1025,16 @@ discard block |
||
| 1025 | 1025 | elseif ($context == 'hide' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue; |
| 1026 | 1026 | else |
| 1027 | 1027 | { |
| 1028 | - $size=''; $class=''; $classtd=''; |
|
| 1029 | - if ($fieldlist[$field]=='code') $class='maxwidth100'; |
|
| 1030 | - if ($fieldlist[$field]=='private') { $class='maxwidth50'; $classtd='center'; } |
|
| 1031 | - if ($fieldlist[$field]=='position') { $class='maxwidth50'; $classtd='center'; } |
|
| 1032 | - if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent'; |
|
| 1033 | - if ($fieldlist[$field]=='topic') $class='quatrevingtpercent'; |
|
| 1034 | - if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" '; |
|
| 1035 | - |
|
| 1036 | - print '<td'.($classtd?' class="'.$classtd.'"':'').'>'; |
|
| 1037 | - if ($fieldlist[$field]=='private') |
|
| 1028 | + $size = ''; $class = ''; $classtd = ''; |
|
| 1029 | + if ($fieldlist[$field] == 'code') $class = 'maxwidth100'; |
|
| 1030 | + if ($fieldlist[$field] == 'private') { $class = 'maxwidth50'; $classtd = 'center'; } |
|
| 1031 | + if ($fieldlist[$field] == 'position') { $class = 'maxwidth50'; $classtd = 'center'; } |
|
| 1032 | + if ($fieldlist[$field] == 'libelle') $class = 'quatrevingtpercent'; |
|
| 1033 | + if ($fieldlist[$field] == 'topic') $class = 'quatrevingtpercent'; |
|
| 1034 | + if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type') $size = 'size="2" '; |
|
| 1035 | + |
|
| 1036 | + print '<td'.($classtd ? ' class="'.$classtd.'"' : '').'>'; |
|
| 1037 | + if ($fieldlist[$field] == 'private') |
|
| 1038 | 1038 | { |
| 1039 | 1039 | if (empty($user->admin)) |
| 1040 | 1040 | { |
@@ -1043,12 +1043,12 @@ discard block |
||
| 1043 | 1043 | else |
| 1044 | 1044 | { |
| 1045 | 1045 | //print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="1" name="'.$fieldlist[$field].'">'; |
| 1046 | - print $form->selectyesno($fieldlist[$field], (isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1); |
|
| 1046 | + print $form->selectyesno($fieldlist[$field], (isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1); |
|
| 1047 | 1047 | } |
| 1048 | 1048 | } |
| 1049 | 1049 | else |
| 1050 | 1050 | { |
| 1051 | - print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">'; |
|
| 1051 | + print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">'; |
|
| 1052 | 1052 | } |
| 1053 | 1053 | print '</td>'; |
| 1054 | 1054 | } |
@@ -56,7 +56,9 @@ discard block |
||
| 56 | 56 | $search_topic=GETPOST('search_topic','alpha'); |
| 57 | 57 | |
| 58 | 58 | $allowed=1; |
| 59 | -if (! $allowed) accessforbidden(); |
|
| 59 | +if (! $allowed) { |
|
| 60 | + accessforbidden(); |
|
| 61 | +} |
|
| 60 | 62 | |
| 61 | 63 | $acts[0] = "activate"; |
| 62 | 64 | $acts[1] = "disable"; |
@@ -75,8 +77,12 @@ discard block |
||
| 75 | 77 | $pageprev = $page - 1; |
| 76 | 78 | $pagenext = $page + 1; |
| 77 | 79 | |
| 78 | -if (empty($sortfield)) $sortfield='label, lang, position'; |
|
| 79 | -if (empty($sortorder)) $sortorder='ASC'; |
|
| 80 | +if (empty($sortfield)) { |
|
| 81 | + $sortfield='label, lang, position'; |
|
| 82 | +} |
|
| 83 | +if (empty($sortorder)) { |
|
| 84 | + $sortorder='ASC'; |
|
| 85 | +} |
|
| 80 | 86 | |
| 81 | 87 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
| 82 | 88 | $hookmanager->initHooks(array('emailtemplates')); |
@@ -92,17 +98,23 @@ discard block |
||
| 92 | 98 | // Nom des champs en resultat de select pour affichage du dictionnaire |
| 93 | 99 | $tabfield=array(); |
| 94 | 100 | $tabfield[25]= "label,type_template,lang,fk_user,private,position,topic,joinfiles,content"; |
| 95 | -if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfield[25].=',content_lines'; |
|
| 101 | +if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { |
|
| 102 | + $tabfield[25].=',content_lines'; |
|
| 103 | +} |
|
| 96 | 104 | |
| 97 | 105 | // Nom des champs d'edition pour modification d'un enregistrement |
| 98 | 106 | $tabfieldvalue=array(); |
| 99 | 107 | $tabfieldvalue[25]= "label,type_template,fk_user,lang,private,position,topic,joinfiles,content"; |
| 100 | -if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldvalue[25].=',content_lines'; |
|
| 108 | +if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { |
|
| 109 | + $tabfieldvalue[25].=',content_lines'; |
|
| 110 | +} |
|
| 101 | 111 | |
| 102 | 112 | // Nom des champs dans la table pour insertion d'un enregistrement |
| 103 | 113 | $tabfieldinsert=array(); |
| 104 | 114 | $tabfieldinsert[25]= "label,type_template,fk_user,lang,private,position,topic,joinfiles,content"; |
| 105 | -if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldinsert[25].=',content_lines'; |
|
| 115 | +if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { |
|
| 116 | + $tabfieldinsert[25].=',content_lines'; |
|
| 117 | +} |
|
| 106 | 118 | $tabfieldinsert[25].=',entity'; // Must be at end because not into other arrays |
| 107 | 119 | |
| 108 | 120 | // Condition to show dictionary in setup page |
@@ -124,8 +136,7 @@ discard block |
||
| 124 | 136 | $helpsubstit.=$key.' -> '.$val.'<br>'; |
| 125 | 137 | $helpsubstitforlines.=$key.' -> '.$val.'<br>'; |
| 126 | 138 | } |
| 127 | -} |
|
| 128 | -else |
|
| 139 | +} else |
|
| 129 | 140 | { |
| 130 | 141 | $tmp=FormMail::getAvailableSubstitKey('formemailwithlines'); |
| 131 | 142 | $tmp['__(AnyTranslationKey)__']='Translation'; |
@@ -157,17 +168,39 @@ discard block |
||
| 157 | 168 | |
| 158 | 169 | // We save list of template email Dolibarr can manage. This list can found by a grep into code on "->param['models']" |
| 159 | 170 | $elementList = array(); |
| 160 | -if ($conf->propal->enabled) $elementList['propal_send']=$langs->trans('MailToSendProposal'); |
|
| 161 | -if ($conf->commande->enabled) $elementList['order_send']=$langs->trans('MailToSendOrder'); |
|
| 162 | -if ($conf->facture->enabled) $elementList['facture_send']=$langs->trans('MailToSendInvoice'); |
|
| 163 | -if ($conf->expedition->enabled) $elementList['shipping_send']=$langs->trans('MailToSendShipment'); |
|
| 164 | -if ($conf->ficheinter->enabled) $elementList['fichinter_send']=$langs->trans('MailToSendIntervention'); |
|
| 165 | -if ($conf->supplier_proposal->enabled) $elementList['supplier_proposal_send']=$langs->trans('MailToSendSupplierRequestForQuotation'); |
|
| 166 | -if ($conf->fournisseur->enabled) $elementList['order_supplier_send']=$langs->trans('MailToSendSupplierOrder'); |
|
| 167 | -if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice'); |
|
| 168 | -if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty'); |
|
| 169 | -if ($conf->adherent->enabled) $elementList['member']=$langs->trans('MailToMember'); |
|
| 170 | -if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract'); |
|
| 171 | +if ($conf->propal->enabled) { |
|
| 172 | + $elementList['propal_send']=$langs->trans('MailToSendProposal'); |
|
| 173 | +} |
|
| 174 | +if ($conf->commande->enabled) { |
|
| 175 | + $elementList['order_send']=$langs->trans('MailToSendOrder'); |
|
| 176 | +} |
|
| 177 | +if ($conf->facture->enabled) { |
|
| 178 | + $elementList['facture_send']=$langs->trans('MailToSendInvoice'); |
|
| 179 | +} |
|
| 180 | +if ($conf->expedition->enabled) { |
|
| 181 | + $elementList['shipping_send']=$langs->trans('MailToSendShipment'); |
|
| 182 | +} |
|
| 183 | +if ($conf->ficheinter->enabled) { |
|
| 184 | + $elementList['fichinter_send']=$langs->trans('MailToSendIntervention'); |
|
| 185 | +} |
|
| 186 | +if ($conf->supplier_proposal->enabled) { |
|
| 187 | + $elementList['supplier_proposal_send']=$langs->trans('MailToSendSupplierRequestForQuotation'); |
|
| 188 | +} |
|
| 189 | +if ($conf->fournisseur->enabled) { |
|
| 190 | + $elementList['order_supplier_send']=$langs->trans('MailToSendSupplierOrder'); |
|
| 191 | +} |
|
| 192 | +if ($conf->fournisseur->enabled) { |
|
| 193 | + $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice'); |
|
| 194 | +} |
|
| 195 | +if ($conf->societe->enabled) { |
|
| 196 | + $elementList['thirdparty']=$langs->trans('MailToThirdparty'); |
|
| 197 | +} |
|
| 198 | +if ($conf->adherent->enabled) { |
|
| 199 | + $elementList['member']=$langs->trans('MailToMember'); |
|
| 200 | +} |
|
| 201 | +if ($conf->contrat->enabled) { |
|
| 202 | + $elementList['contract']=$langs->trans('MailToSendContract'); |
|
| 203 | +} |
|
| 171 | 204 | $elementList['user']=$langs->trans('MailToUser'); |
| 172 | 205 | $elementList['all'] =$langs->trans('VisibleEverywhere'); |
| 173 | 206 | $elementList['none']=$langs->trans('VisibleNowhere'); |
@@ -193,14 +226,18 @@ discard block |
||
| 193 | 226 | |
| 194 | 227 | $parameters=array(); |
| 195 | 228 | $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
| 196 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 229 | +if ($reshook < 0) { |
|
| 230 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 231 | +} |
|
| 197 | 232 | |
| 198 | 233 | if (empty($reshook)) |
| 199 | 234 | { |
| 200 | 235 | // Purge search criteria |
| 201 | - if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers |
|
| 236 | + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) { |
|
| 237 | + // All tests are required to be compatible with all browsers |
|
| 202 | 238 | { |
| 203 | 239 | $search_label=''; |
| 240 | + } |
|
| 204 | 241 | $search_type_template=''; |
| 205 | 242 | $search_lang=''; |
| 206 | 243 | $search_fk_user=''; |
@@ -222,26 +259,52 @@ discard block |
||
| 222 | 259 | foreach ($listfield as $f => $value) |
| 223 | 260 | { |
| 224 | 261 | // Not mandatory fields |
| 225 | - if ($value == 'joinfiles') continue; |
|
| 226 | - if ($value == 'content') continue; |
|
| 227 | - if ($value == 'content_lines') continue; |
|
| 262 | + if ($value == 'joinfiles') { |
|
| 263 | + continue; |
|
| 264 | + } |
|
| 265 | + if ($value == 'content') { |
|
| 266 | + continue; |
|
| 267 | + } |
|
| 268 | + if ($value == 'content_lines') { |
|
| 269 | + continue; |
|
| 270 | + } |
|
| 228 | 271 | |
| 229 | - if (GETPOST('actionmodify') && $value == 'topic') $_POST['topic']=$_POST['topic-'.$rowid]; |
|
| 272 | + if (GETPOST('actionmodify') && $value == 'topic') { |
|
| 273 | + $_POST['topic']=$_POST['topic-'.$rowid]; |
|
| 274 | + } |
|
| 230 | 275 | |
| 231 | 276 | if ((! isset($_POST[$value]) || $_POST[$value]=='' || $_POST[$value]=='-1') && $value != 'lang' && $value != 'fk_user' && $value != 'position') |
| 232 | 277 | { |
| 233 | 278 | $ok=0; |
| 234 | 279 | $fieldnamekey=$listfield[$f]; |
| 235 | 280 | // We take translate key of field |
| 236 | - if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label'; |
|
| 237 | - if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments'; |
|
| 238 | - if ($fieldnamekey == 'code') $fieldnamekey = 'Code'; |
|
| 239 | - if ($fieldnamekey == 'note') $fieldnamekey = 'Note'; |
|
| 240 | - if ($fieldnamekey == 'type_template') $fieldnamekey = 'TypeOfTemplate'; |
|
| 241 | - if ($fieldnamekey == 'fk_user') $fieldnamekey = 'Owner'; |
|
| 242 | - if ($fieldnamekey == 'private') $fieldnamekey = 'Private'; |
|
| 243 | - if ($fieldnamekey == 'position') $fieldnamekey = 'Position'; |
|
| 244 | - if ($fieldnamekey == 'topic') $fieldnamekey = 'Topic'; |
|
| 281 | + if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) { |
|
| 282 | + $fieldnamekey='Label'; |
|
| 283 | + } |
|
| 284 | + if ($fieldnamekey == 'libelle_facture') { |
|
| 285 | + $fieldnamekey = 'LabelOnDocuments'; |
|
| 286 | + } |
|
| 287 | + if ($fieldnamekey == 'code') { |
|
| 288 | + $fieldnamekey = 'Code'; |
|
| 289 | + } |
|
| 290 | + if ($fieldnamekey == 'note') { |
|
| 291 | + $fieldnamekey = 'Note'; |
|
| 292 | + } |
|
| 293 | + if ($fieldnamekey == 'type_template') { |
|
| 294 | + $fieldnamekey = 'TypeOfTemplate'; |
|
| 295 | + } |
|
| 296 | + if ($fieldnamekey == 'fk_user') { |
|
| 297 | + $fieldnamekey = 'Owner'; |
|
| 298 | + } |
|
| 299 | + if ($fieldnamekey == 'private') { |
|
| 300 | + $fieldnamekey = 'Private'; |
|
| 301 | + } |
|
| 302 | + if ($fieldnamekey == 'position') { |
|
| 303 | + $fieldnamekey = 'Position'; |
|
| 304 | + } |
|
| 305 | + if ($fieldnamekey == 'topic') { |
|
| 306 | + $fieldnamekey = 'Topic'; |
|
| 307 | + } |
|
| 245 | 308 | |
| 246 | 309 | setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); |
| 247 | 310 | } |
@@ -263,32 +326,50 @@ discard block |
||
| 263 | 326 | { |
| 264 | 327 | //var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value); |
| 265 | 328 | $keycode=$listfieldvalue[$i]; |
| 266 | - if ($value == 'lang') $keycode='langcode'; |
|
| 267 | - if ($value == 'entity') $_POST[$keycode] = $conf->entity; |
|
| 268 | - if ($i) $sql.=","; |
|
| 269 | - if ($value == 'fk_user' && ! ($_POST[$keycode] > 0)) $_POST[$keycode]=''; |
|
| 270 | - if ($value == 'private' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='0'; |
|
| 271 | - if ($value == 'position' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='1'; |
|
| 272 | - if ($_POST[$keycode] == '' && $keycode != 'langcode') $sql.="null"; // lang must be '' if not defined so the unique key that include lang will work |
|
| 273 | - elseif ($_POST[$keycode] == '0' && $keycode == 'langcode') $sql.="null"; |
|
| 274 | - else $sql.="'".$db->escape($_POST[$keycode])."'"; |
|
| 329 | + if ($value == 'lang') { |
|
| 330 | + $keycode='langcode'; |
|
| 331 | + } |
|
| 332 | + if ($value == 'entity') { |
|
| 333 | + $_POST[$keycode] = $conf->entity; |
|
| 334 | + } |
|
| 335 | + if ($i) { |
|
| 336 | + $sql.=","; |
|
| 337 | + } |
|
| 338 | + if ($value == 'fk_user' && ! ($_POST[$keycode] > 0)) { |
|
| 339 | + $_POST[$keycode]=''; |
|
| 340 | + } |
|
| 341 | + if ($value == 'private' && ! is_numeric($_POST[$keycode])) { |
|
| 342 | + $_POST[$keycode]='0'; |
|
| 343 | + } |
|
| 344 | + if ($value == 'position' && ! is_numeric($_POST[$keycode])) { |
|
| 345 | + $_POST[$keycode]='1'; |
|
| 346 | + } |
|
| 347 | + if ($_POST[$keycode] == '' && $keycode != 'langcode') { |
|
| 348 | + $sql.="null"; |
|
| 349 | + } |
|
| 350 | + // lang must be '' if not defined so the unique key that include lang will work |
|
| 351 | + elseif ($_POST[$keycode] == '0' && $keycode == 'langcode') { |
|
| 352 | + $sql.="null"; |
|
| 353 | + } else { |
|
| 354 | + $sql.="'".$db->escape($_POST[$keycode])."'"; |
|
| 355 | + } |
|
| 275 | 356 | $i++; |
| 276 | 357 | } |
| 277 | 358 | $sql.=",1)"; |
| 278 | 359 | |
| 279 | 360 | dol_syslog("actionadd", LOG_DEBUG); |
| 280 | 361 | $result = $db->query($sql); |
| 281 | - if ($result) // Add is ok |
|
| 362 | + if ($result) { |
|
| 363 | + // Add is ok |
|
| 282 | 364 | { |
| 283 | 365 | setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); |
| 284 | - $_POST=array('id'=>$id); // Clean $_POST array, we keep only |
|
| 285 | 366 | } |
| 286 | - else |
|
| 367 | + $_POST=array('id'=>$id); // Clean $_POST array, we keep only |
|
| 368 | + } else |
|
| 287 | 369 | { |
| 288 | 370 | if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { |
| 289 | 371 | setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); |
| 290 | - } |
|
| 291 | - else { |
|
| 372 | + } else { |
|
| 292 | 373 | dol_print_error($db); |
| 293 | 374 | } |
| 294 | 375 | } |
@@ -306,18 +387,39 @@ discard block |
||
| 306 | 387 | foreach ($listfieldmodify as $field) |
| 307 | 388 | { |
| 308 | 389 | $keycode=$listfieldvalue[$i]; |
| 309 | - if ($field == 'lang') $keycode='langcode'; |
|
| 310 | - |
|
| 311 | - if ($field == 'fk_user' && ! ($_POST['fk_user'] > 0)) $_POST['fk_user']=''; |
|
| 312 | - if ($field == 'topic') $_POST['topic']=$_POST['topic-'.$rowid]; |
|
| 313 | - if ($field == 'joinfiles') $_POST['joinfiles']=$_POST['joinfiles-'.$rowid]; |
|
| 314 | - if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid]; |
|
| 315 | - if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid]; |
|
| 316 | - if ($field == 'entity') $_POST[$keycode] = $conf->entity; |
|
| 317 | - if ($i) $sql.=","; |
|
| 390 | + if ($field == 'lang') { |
|
| 391 | + $keycode='langcode'; |
|
| 392 | + } |
|
| 393 | + |
|
| 394 | + if ($field == 'fk_user' && ! ($_POST['fk_user'] > 0)) { |
|
| 395 | + $_POST['fk_user']=''; |
|
| 396 | + } |
|
| 397 | + if ($field == 'topic') { |
|
| 398 | + $_POST['topic']=$_POST['topic-'.$rowid]; |
|
| 399 | + } |
|
| 400 | + if ($field == 'joinfiles') { |
|
| 401 | + $_POST['joinfiles']=$_POST['joinfiles-'.$rowid]; |
|
| 402 | + } |
|
| 403 | + if ($field == 'content') { |
|
| 404 | + $_POST['content']=$_POST['content-'.$rowid]; |
|
| 405 | + } |
|
| 406 | + if ($field == 'content_lines') { |
|
| 407 | + $_POST['content_lines']=$_POST['content_lines-'.$rowid]; |
|
| 408 | + } |
|
| 409 | + if ($field == 'entity') { |
|
| 410 | + $_POST[$keycode] = $conf->entity; |
|
| 411 | + } |
|
| 412 | + if ($i) { |
|
| 413 | + $sql.=","; |
|
| 414 | + } |
|
| 318 | 415 | $sql.= $field."="; |
| 319 | - if ($_POST[$keycode] == '' || ($keycode == 'langcode' && empty($_POST[$keycode]))) $sql.="null"; // For vat, we want/accept code = '' |
|
| 320 | - else $sql.="'".$db->escape($_POST[$keycode])."'"; |
|
| 416 | + if ($_POST[$keycode] == '' || ($keycode == 'langcode' && empty($_POST[$keycode]))) { |
|
| 417 | + $sql.="null"; |
|
| 418 | + } |
|
| 419 | + // For vat, we want/accept code = '' |
|
| 420 | + else { |
|
| 421 | + $sql.="'".$db->escape($_POST[$keycode])."'"; |
|
| 422 | + } |
|
| 321 | 423 | $i++; |
| 322 | 424 | } |
| 323 | 425 | $sql.= " WHERE ".$rowidcol." = '".$rowid."'"; |
@@ -328,17 +430,18 @@ discard block |
||
| 328 | 430 | if ($resql) |
| 329 | 431 | { |
| 330 | 432 | setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); |
| 331 | - } |
|
| 332 | - else |
|
| 433 | + } else |
|
| 333 | 434 | { |
| 334 | 435 | setEventMessages($db->error(), null, 'errors'); |
| 335 | 436 | } |
| 336 | 437 | } |
| 337 | 438 | } |
| 338 | 439 | |
| 339 | - if ($action == 'confirm_delete' && $confirm == 'yes') // delete |
|
| 440 | + if ($action == 'confirm_delete' && $confirm == 'yes') { |
|
| 441 | + // delete |
|
| 340 | 442 | { |
| 341 | 443 | $rowidcol="rowid"; |
| 444 | + } |
|
| 342 | 445 | |
| 343 | 446 | $sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'"; |
| 344 | 447 | |
@@ -349,8 +452,7 @@ discard block |
||
| 349 | 452 | if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') |
| 350 | 453 | { |
| 351 | 454 | setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); |
| 352 | - } |
|
| 353 | - else |
|
| 455 | + } else |
|
| 354 | 456 | { |
| 355 | 457 | dol_print_error($db); |
| 356 | 458 | } |
@@ -426,15 +528,27 @@ discard block |
||
| 426 | 528 | { |
| 427 | 529 | $sql.= " AND (lang = '".$langs->defaultlang."' OR lang IS NULL OR lang = '')"; |
| 428 | 530 | } |
| 429 | -if ($search_label) $sql.=natural_search('label', $search_label); |
|
| 430 | -if ($search_type_template != '' && $search_type_template != '-1') $sql.=natural_search('type_template', $search_type_template); |
|
| 431 | -if ($search_lang) $sql.=natural_search('lang', $search_lang); |
|
| 432 | -if ($search_fk_user != '' && $search_fk_user != '-1') $sql.=natural_search('fk_user', $search_fk_user, 2); |
|
| 433 | -if ($search_topic) $sql.=natural_search('topic', $search_topic); |
|
| 531 | +if ($search_label) { |
|
| 532 | + $sql.=natural_search('label', $search_label); |
|
| 533 | +} |
|
| 534 | +if ($search_type_template != '' && $search_type_template != '-1') { |
|
| 535 | + $sql.=natural_search('type_template', $search_type_template); |
|
| 536 | +} |
|
| 537 | +if ($search_lang) { |
|
| 538 | + $sql.=natural_search('lang', $search_lang); |
|
| 539 | +} |
|
| 540 | +if ($search_fk_user != '' && $search_fk_user != '-1') { |
|
| 541 | + $sql.=natural_search('fk_user', $search_fk_user, 2); |
|
| 542 | +} |
|
| 543 | +if ($search_topic) { |
|
| 544 | + $sql.=natural_search('topic', $search_topic); |
|
| 545 | +} |
|
| 434 | 546 | if ($sortfield) |
| 435 | 547 | { |
| 436 | 548 | // If sort order is "country", we use country_code instead |
| 437 | - if ($sortfield == 'country') $sortfield='country_code'; |
|
| 549 | + if ($sortfield == 'country') { |
|
| 550 | + $sortfield='country_code'; |
|
| 551 | + } |
|
| 438 | 552 | $sql.= " ORDER BY ".$sortfield; |
| 439 | 553 | if ($sortorder) |
| 440 | 554 | { |
@@ -444,8 +558,7 @@ discard block |
||
| 444 | 558 | // Clear the required sort criteria for the tabsqlsort to be able to force it with selected value |
| 445 | 559 | $tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i','',$tabsqlsort[$id]); |
| 446 | 560 | $tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.',/i','',$tabsqlsort[$id]); |
| 447 | -} |
|
| 448 | -else { |
|
| 561 | +} else { |
|
| 449 | 562 | $sql.=" ORDER BY "; |
| 450 | 563 | } |
| 451 | 564 | $sql.=$tabsqlsort[$id]; |
@@ -491,17 +604,27 @@ discard block |
||
| 491 | 604 | if ($valuetoshow != '') |
| 492 | 605 | { |
| 493 | 606 | print '<td align="'.$align.'">'; |
| 494 | - if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>'; |
|
| 495 | - else if (! empty($tabhelp[$id][$value])) |
|
| 607 | + if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) { |
|
| 608 | + print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>'; |
|
| 609 | + } else if (! empty($tabhelp[$id][$value])) |
|
| 496 | 610 | { |
| 497 | - if (in_array($value, array('topic'))) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, $value); // Tooltip on click |
|
| 498 | - else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover |
|
| 611 | + if (in_array($value, array('topic'))) { |
|
| 612 | + print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, $value); |
|
| 613 | + } |
|
| 614 | + // Tooltip on click |
|
| 615 | + else { |
|
| 616 | + print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); |
|
| 617 | + } |
|
| 618 | + // Tooltip on hover |
|
| 619 | + } else { |
|
| 620 | + print $valuetoshow; |
|
| 499 | 621 | } |
| 500 | - else print $valuetoshow; |
|
| 501 | 622 | print '</td>'; |
| 502 | 623 | } |
| 503 | - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; |
|
| 504 | -} |
|
| 624 | + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { |
|
| 625 | + $alabelisused=1; |
|
| 626 | + } |
|
| 627 | + } |
|
| 505 | 628 | print '<td>'; |
| 506 | 629 | print '<input type="hidden" name="id" value="' . $id . '">'; |
| 507 | 630 | print '</td>'; |
@@ -512,8 +635,9 @@ discard block |
||
| 512 | 635 | if (GETPOST('actionadd')) |
| 513 | 636 | { |
| 514 | 637 | foreach ($fieldlist as $key => $val) { |
| 515 | - if (GETPOST($val) != '') |
|
| 516 | - $obj->$val = GETPOST($val); |
|
| 638 | + if (GETPOST($val) != '') { |
|
| 639 | + $obj->$val = GETPOST($val); |
|
| 640 | + } |
|
| 517 | 641 | } |
| 518 | 642 | } |
| 519 | 643 | |
@@ -557,29 +681,30 @@ discard block |
||
| 557 | 681 | { |
| 558 | 682 | print '<strong>' . $form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> '; |
| 559 | 683 | } |
| 560 | - if ($tmpfieldlist == 'content') |
|
| 561 | - print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist); |
|
| 562 | - if ($tmpfieldlist == 'content_lines') |
|
| 563 | - print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '<br>'; |
|
| 684 | + if ($tmpfieldlist == 'content') { |
|
| 685 | + print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist); |
|
| 686 | + } |
|
| 687 | + if ($tmpfieldlist == 'content_lines') { |
|
| 688 | + print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '<br>'; |
|
| 689 | + } |
|
| 564 | 690 | // Input field |
| 565 | 691 | if ($tmpfieldlist == 'topic') { |
| 566 | 692 | print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">'; |
| 567 | - } |
|
| 568 | - else if ($tmpfieldlist == 'joinfiles') { |
|
| 693 | + } else if ($tmpfieldlist == 'joinfiles') { |
|
| 569 | 694 | print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">'; |
| 570 | - } |
|
| 571 | - else |
|
| 695 | + } else |
|
| 572 | 696 | { |
| 573 | 697 | if ($context != 'hide') { |
| 574 | 698 | // print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>'; |
| 575 | 699 | $okforextended = true; |
| 576 | - if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) |
|
| 577 | - $okforextended = false; |
|
| 700 | + if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { |
|
| 701 | + $okforextended = false; |
|
| 702 | + } |
|
| 578 | 703 | $doleditor = new DolEditor($tmpfieldlist, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 120, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%'); |
| 579 | 704 | print $doleditor->Create(1); |
| 705 | + } else { |
|
| 706 | + print ' '; |
|
| 580 | 707 | } |
| 581 | - else |
|
| 582 | - print ' '; |
|
| 583 | 708 | } |
| 584 | 709 | print '</td>'; |
| 585 | 710 | if ($tmpfieldlist == 'topic') { |
@@ -624,9 +749,15 @@ discard block |
||
| 624 | 749 | |
| 625 | 750 | $param = '&id='.$id; |
| 626 | 751 | $paramwithsearch = $param; |
| 627 | - if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder; |
|
| 628 | - if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield; |
|
| 629 | - if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha'); |
|
| 752 | + if ($sortorder) { |
|
| 753 | + $paramwithsearch.= '&sortorder='.$sortorder; |
|
| 754 | + } |
|
| 755 | + if ($sortfield) { |
|
| 756 | + $paramwithsearch.= '&sortfield='.$sortfield; |
|
| 757 | + } |
|
| 758 | + if (GETPOST('from')) { |
|
| 759 | + $paramwithsearch.= '&from='.GETPOST('from','alpha'); |
|
| 760 | + } |
|
| 630 | 761 | |
| 631 | 762 | // There is several pages |
| 632 | 763 | if ($num > $listlimit) |
@@ -642,30 +773,35 @@ discard block |
||
| 642 | 773 | $filterfound=0; |
| 643 | 774 | foreach ($fieldlist as $field => $value) |
| 644 | 775 | { |
| 645 | - if ($value == 'label') print '<td class="liste_titre"><input type="text" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>'; |
|
| 646 | - elseif ($value == 'lang') |
|
| 776 | + if ($value == 'label') { |
|
| 777 | + print '<td class="liste_titre"><input type="text" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>'; |
|
| 778 | + } elseif ($value == 'lang') |
|
| 647 | 779 | { |
| 648 | 780 | print '<td class="liste_titre">'; |
| 649 | 781 | print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth150'); |
| 650 | 782 | print '</td>'; |
| 651 | - } |
|
| 652 | - elseif ($value == 'fk_user') |
|
| 783 | + } elseif ($value == 'fk_user') |
|
| 653 | 784 | { |
| 654 | 785 | print '<td class="liste_titre">'; |
| 655 | 786 | $restrictid=array(); |
| 656 | - if (! $user->admin) $restrictid=array($user->id); |
|
| 787 | + if (! $user->admin) { |
|
| 788 | + $restrictid=array($user->id); |
|
| 789 | + } |
|
| 657 | 790 | //var_dump($restrictid); |
| 658 | 791 | print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth200'); |
| 659 | 792 | print '</td>'; |
| 660 | - } |
|
| 661 | - elseif ($value == 'topic') print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>'; |
|
| 662 | - elseif ($value == 'type_template') |
|
| 793 | + } elseif ($value == 'topic') { |
|
| 794 | + print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>'; |
|
| 795 | + } elseif ($value == 'type_template') |
|
| 663 | 796 | { |
| 664 | 797 | print '<td class="liste_titre">'.$form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200 maxwidth100onsmartphone').'</td>'; |
| 798 | + } elseif (! in_array($value, array('content', 'content_lines'))) { |
|
| 799 | + print '<td class="liste_titre"></td>'; |
|
| 665 | 800 | } |
| 666 | - elseif (! in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>'; |
|
| 667 | 801 | } |
| 668 | - if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>'; |
|
| 802 | + if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { |
|
| 803 | + print '<td class="liste_titre"></td>'; |
|
| 804 | + } |
|
| 669 | 805 | // Action column |
| 670 | 806 | print '<td class="liste_titre" align="right" width="64">'; |
| 671 | 807 | $searchpicto=$form->showFilterButtons(); |
@@ -709,8 +845,14 @@ discard block |
||
| 709 | 845 | { |
| 710 | 846 | if (! empty($tabhelp[$id][$value])) |
| 711 | 847 | { |
| 712 | - if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value); // Tooltip on click |
|
| 713 | - else $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, '', 1); // Tooltip on hover |
|
| 848 | + if (in_array($value, array('topic'))) { |
|
| 849 | + $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value); |
|
| 850 | + } |
|
| 851 | + // Tooltip on click |
|
| 852 | + else { |
|
| 853 | + $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, '', 1); |
|
| 854 | + } |
|
| 855 | + // Tooltip on hover |
|
| 714 | 856 | } |
| 715 | 857 | print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder); |
| 716 | 858 | } |
@@ -737,7 +879,9 @@ discard block |
||
| 737 | 879 | $error=$hookmanager->error; $errors=$hookmanager->errors; |
| 738 | 880 | |
| 739 | 881 | // Show fields |
| 740 | - if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit'); |
|
| 882 | + if (empty($reshook)) { |
|
| 883 | + fieldList($fieldlist,$obj,$tabname[$id],'edit'); |
|
| 884 | + } |
|
| 741 | 885 | |
| 742 | 886 | print '<td></td><td></td><td></td>'; |
| 743 | 887 | print '<td align="center">'; |
@@ -778,7 +922,9 @@ discard block |
||
| 778 | 922 | if ($tmpfieldlist == 'content') |
| 779 | 923 | { |
| 780 | 924 | $okforextended = true; |
| 781 | - if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false; |
|
| 925 | + if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { |
|
| 926 | + $okforextended = false; |
|
| 927 | + } |
|
| 782 | 928 | $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%'); |
| 783 | 929 | print $doleditor->Create(1); |
| 784 | 930 | } |
@@ -787,8 +933,7 @@ discard block |
||
| 787 | 933 | print '<td></td>'; |
| 788 | 934 | } |
| 789 | 935 | } |
| 790 | - } |
|
| 791 | - else |
|
| 936 | + } else |
|
| 792 | 937 | { |
| 793 | 938 | $tmpaction = 'view'; |
| 794 | 939 | $parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); |
@@ -800,7 +945,9 @@ discard block |
||
| 800 | 945 | { |
| 801 | 946 | foreach ($fieldlist as $field => $value) |
| 802 | 947 | { |
| 803 | - if (in_array($fieldlist[$field], array('content','content_lines'))) continue; |
|
| 948 | + if (in_array($fieldlist[$field], array('content','content_lines'))) { |
|
| 949 | + continue; |
|
| 950 | + } |
|
| 804 | 951 | $showfield=1; |
| 805 | 952 | $align="left"; |
| 806 | 953 | $valuetoshow=$obj->{$fieldlist[$field]}; |
@@ -824,8 +971,11 @@ discard block |
||
| 824 | 971 | if ($value == 'private') |
| 825 | 972 | { |
| 826 | 973 | $align="center"; |
| 827 | - if ($valuetoshow) $valuetoshow=yn($valuetoshow); |
|
| 828 | - else $valuetoshow=''; |
|
| 974 | + if ($valuetoshow) { |
|
| 975 | + $valuetoshow=yn($valuetoshow); |
|
| 976 | + } else { |
|
| 977 | + $valuetoshow=''; |
|
| 978 | + } |
|
| 829 | 979 | } |
| 830 | 980 | if ($value == 'position') |
| 831 | 981 | { |
@@ -834,8 +984,11 @@ discard block |
||
| 834 | 984 | if ($value == 'joinfiles') |
| 835 | 985 | { |
| 836 | 986 | $align="center"; |
| 837 | - if ($valuetoshow) $valuetoshow=1; |
|
| 838 | - else $valuetoshow=''; |
|
| 987 | + if ($valuetoshow) { |
|
| 988 | + $valuetoshow=1; |
|
| 989 | + } else { |
|
| 990 | + $valuetoshow=''; |
|
| 991 | + } |
|
| 839 | 992 | } |
| 840 | 993 | |
| 841 | 994 | $class='tddict'; |
@@ -858,17 +1011,23 @@ discard block |
||
| 858 | 1011 | } |
| 859 | 1012 | |
| 860 | 1013 | $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):''); |
| 861 | - if ($param) $url .= '&'.$param; |
|
| 1014 | + if ($param) { |
|
| 1015 | + $url .= '&'.$param; |
|
| 1016 | + } |
|
| 862 | 1017 | $url.='&'; |
| 863 | 1018 | |
| 864 | 1019 | // Status / Active |
| 865 | 1020 | print '<td align="center" class="nowrap">'; |
| 866 | - if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>'; |
|
| 1021 | + if ($canbedisabled) { |
|
| 1022 | + print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>'; |
|
| 1023 | + } |
|
| 867 | 1024 | print "</td>"; |
| 868 | 1025 | |
| 869 | 1026 | // Modify link / Delete link |
| 870 | 1027 | print '<td class="center nowraponall" width="64">'; |
| 871 | - if ($canbemodified) print '<a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a>'; |
|
| 1028 | + if ($canbemodified) { |
|
| 1029 | + print '<a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a>'; |
|
| 1030 | + } |
|
| 872 | 1031 | if ($iserasable) |
| 873 | 1032 | { |
| 874 | 1033 | print ' <a href="'.$url.'action=delete">'.img_delete().'</a>'; |
@@ -911,8 +1070,7 @@ discard block |
||
| 911 | 1070 | $i++; |
| 912 | 1071 | } |
| 913 | 1072 | } |
| 914 | -} |
|
| 915 | -else { |
|
| 1073 | +} else { |
|
| 916 | 1074 | dol_print_error($db); |
| 917 | 1075 | } |
| 918 | 1076 | |
@@ -956,15 +1114,16 @@ discard block |
||
| 956 | 1114 | if ($user->admin) |
| 957 | 1115 | { |
| 958 | 1116 | print $form->select_dolusers($obj->{$fieldlist[$field]}, 'fk_user', 1, null, 0, '', null, 0, 0, 1, '', 0, '', 'maxwidth200'); |
| 959 | - } |
|
| 960 | - else |
|
| 1117 | + } else |
|
| 961 | 1118 | { |
| 962 | - if ($context == 'add') // I am not admin and we show the add form |
|
| 1119 | + if ($context == 'add') { |
|
| 1120 | + // I am not admin and we show the add form |
|
| 963 | 1121 | { |
| 964 | - print $user->getNomUrl(1); // Me |
|
| 965 | - $forcedvalue=$user->id; |
|
| 1122 | + print $user->getNomUrl(1); |
|
| 966 | 1123 | } |
| 967 | - else |
|
| 1124 | + // Me |
|
| 1125 | + $forcedvalue=$user->id; |
|
| 1126 | + } else |
|
| 968 | 1127 | { |
| 969 | 1128 | if ($obj && ! empty($obj->{$fieldlist[$field]}) && $obj->{$fieldlist[$field]} > 0) |
| 970 | 1129 | { |
@@ -972,8 +1131,7 @@ discard block |
||
| 972 | 1131 | $fuser->fetch($obj->{$fieldlist[$field]}); |
| 973 | 1132 | print $fuser->getNomUrl(1); |
| 974 | 1133 | $forcedvalue=$fuser->id; |
| 975 | - } |
|
| 976 | - else |
|
| 1134 | + } else |
|
| 977 | 1135 | { |
| 978 | 1136 | $forcedvalue=$obj->{$fieldlist[$field]}; |
| 979 | 1137 | } |
@@ -982,24 +1140,27 @@ discard block |
||
| 982 | 1140 | print '<input type="hidden" value="'.$forcedvalue.'" name="'.$keyname.'">'; |
| 983 | 1141 | } |
| 984 | 1142 | print '</td>'; |
| 985 | - } |
|
| 986 | - elseif ($fieldlist[$field] == 'lang') |
|
| 1143 | + } elseif ($fieldlist[$field] == 'lang') |
|
| 987 | 1144 | { |
| 988 | 1145 | print '<td>'; |
| 989 | 1146 | if (! empty($conf->global->MAIN_MULTILANGS)) |
| 990 | 1147 | { |
| 991 | 1148 | $selectedlang = $langs->defaultlang; |
| 992 | - if ($context == 'edit') $selectedlang = $obj->{$fieldlist[$field]}; |
|
| 1149 | + if ($context == 'edit') { |
|
| 1150 | + $selectedlang = $obj->{$fieldlist[$field]}; |
|
| 1151 | + } |
|
| 993 | 1152 | print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1); |
| 994 | - } |
|
| 995 | - else |
|
| 1153 | + } else |
|
| 996 | 1154 | { |
| 997 | 1155 | if (! empty($obj->{$fieldlist[$field]})) |
| 998 | 1156 | { |
| 999 | 1157 | print $obj->{$fieldlist[$field]}.' - '.$langs->trans('Language_'.$obj->{$fieldlist[$field]}); |
| 1000 | 1158 | } |
| 1001 | 1159 | $keyname=$fieldlist[$field]; |
| 1002 | - if ($keyname == 'lang') $keyname='langcode'; // Avoid conflict with lang param |
|
| 1160 | + if ($keyname == 'lang') { |
|
| 1161 | + $keyname='langcode'; |
|
| 1162 | + } |
|
| 1163 | + // Avoid conflict with lang param |
|
| 1003 | 1164 | print '<input type="hidden" value="'.$obj->{$fieldlist[$field]}.'" name="'.$keyname.'">'; |
| 1004 | 1165 | } |
| 1005 | 1166 | print '</td>'; |
@@ -1013,25 +1174,34 @@ discard block |
||
| 1013 | 1174 | // Current tempalte type is an unknown type, so we must keep it as it is. |
| 1014 | 1175 | print '<input type="hidden" name="type_template" value="'.$obj->{$fieldlist[$field]}.'">'; |
| 1015 | 1176 | print $obj->{$fieldlist[$field]}; |
| 1016 | - } |
|
| 1017 | - else |
|
| 1177 | + } else |
|
| 1018 | 1178 | { |
| 1019 | 1179 | print $form->selectarray('type_template', $elementList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200'); |
| 1020 | 1180 | } |
| 1021 | 1181 | print '</td>'; |
| 1022 | - } |
|
| 1023 | - elseif ($context == 'add' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue; |
|
| 1024 | - elseif ($context == 'edit' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue; |
|
| 1025 | - elseif ($context == 'hide' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue; |
|
| 1026 | - else |
|
| 1182 | + } elseif ($context == 'add' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) { |
|
| 1183 | + continue; |
|
| 1184 | + } elseif ($context == 'edit' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) { |
|
| 1185 | + continue; |
|
| 1186 | + } elseif ($context == 'hide' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) { |
|
| 1187 | + continue; |
|
| 1188 | + } else |
|
| 1027 | 1189 | { |
| 1028 | 1190 | $size=''; $class=''; $classtd=''; |
| 1029 | - if ($fieldlist[$field]=='code') $class='maxwidth100'; |
|
| 1191 | + if ($fieldlist[$field]=='code') { |
|
| 1192 | + $class='maxwidth100'; |
|
| 1193 | + } |
|
| 1030 | 1194 | if ($fieldlist[$field]=='private') { $class='maxwidth50'; $classtd='center'; } |
| 1031 | 1195 | if ($fieldlist[$field]=='position') { $class='maxwidth50'; $classtd='center'; } |
| 1032 | - if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent'; |
|
| 1033 | - if ($fieldlist[$field]=='topic') $class='quatrevingtpercent'; |
|
| 1034 | - if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" '; |
|
| 1196 | + if ($fieldlist[$field]=='libelle') { |
|
| 1197 | + $class='quatrevingtpercent'; |
|
| 1198 | + } |
|
| 1199 | + if ($fieldlist[$field]=='topic') { |
|
| 1200 | + $class='quatrevingtpercent'; |
|
| 1201 | + } |
|
| 1202 | + if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') { |
|
| 1203 | + $size='size="2" '; |
|
| 1204 | + } |
|
| 1035 | 1205 | |
| 1036 | 1206 | print '<td'.($classtd?' class="'.$classtd.'"':'').'>'; |
| 1037 | 1207 | if ($fieldlist[$field]=='private') |
@@ -1039,14 +1209,12 @@ discard block |
||
| 1039 | 1209 | if (empty($user->admin)) |
| 1040 | 1210 | { |
| 1041 | 1211 | print $form->selectyesno($fieldlist[$field], '1', 1); |
| 1042 | - } |
|
| 1043 | - else |
|
| 1212 | + } else |
|
| 1044 | 1213 | { |
| 1045 | 1214 | //print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="1" name="'.$fieldlist[$field].'">'; |
| 1046 | 1215 | print $form->selectyesno($fieldlist[$field], (isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1); |
| 1047 | 1216 | } |
| 1048 | - } |
|
| 1049 | - else |
|
| 1217 | + } else |
|
| 1050 | 1218 | { |
| 1051 | 1219 | print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">'; |
| 1052 | 1220 | } |
@@ -27,19 +27,19 @@ discard block |
||
| 27 | 27 | * \brief Page with expense reports journal |
| 28 | 28 | */ |
| 29 | 29 | require '../../main.inc.php'; |
| 30 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php'; |
|
| 31 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
| 32 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; |
|
| 33 | -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; |
|
| 34 | -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; |
|
| 35 | -require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; |
|
| 36 | -require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; |
|
| 37 | -require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; |
|
| 30 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; |
|
| 31 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
|
| 32 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; |
|
| 33 | +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; |
|
| 34 | +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; |
|
| 35 | +require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; |
|
| 36 | +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; |
|
| 37 | +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; |
|
| 38 | 38 | |
| 39 | -$langs->loadLangs(array("commercial", "compta","bills","other","accountancy","trips","errors")); |
|
| 39 | +$langs->loadLangs(array("commercial", "compta", "bills", "other", "accountancy", "trips", "errors")); |
|
| 40 | 40 | |
| 41 | 41 | $id_journal = GETPOST('id_journal', 'int'); |
| 42 | -$action = GETPOST('action','aZ09'); |
|
| 42 | +$action = GETPOST('action', 'aZ09'); |
|
| 43 | 43 | |
| 44 | 44 | $date_startmonth = GETPOST('date_startmonth'); |
| 45 | 45 | $date_startday = GETPOST('date_startday'); |
@@ -71,13 +71,13 @@ discard block |
||
| 71 | 71 | $pastmonthyear = $year_current; |
| 72 | 72 | if ($pastmonth == 0) { |
| 73 | 73 | $pastmonth = 12; |
| 74 | - $pastmonthyear --; |
|
| 74 | + $pastmonthyear--; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); |
| 78 | 78 | $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); |
| 79 | 79 | |
| 80 | -if (! GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form |
|
| 80 | +if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form |
|
| 81 | 81 | { |
| 82 | 82 | $date_start = dol_get_first_day($pastmonthyear, $pastmonth, false); |
| 83 | 83 | $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); |
@@ -90,25 +90,25 @@ discard block |
||
| 90 | 90 | $sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_account,"; |
| 91 | 91 | $sql .= " f.accountancy_code, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte"; |
| 92 | 92 | //$sql .= " ct.accountancy_code_buy as account_tva"; |
| 93 | -$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd"; |
|
| 93 | +$sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd"; |
|
| 94 | 94 | //$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON erd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'"; |
| 95 | -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees"; |
|
| 96 | -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation"; |
|
| 97 | -$sql .= " JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport"; |
|
| 98 | -$sql .= " JOIN " . MAIN_DB_PREFIX . "user as u ON u.rowid = er.fk_user_author"; |
|
| 95 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f ON f.id = erd.fk_c_type_fees"; |
|
| 96 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = erd.fk_code_ventilation"; |
|
| 97 | +$sql .= " JOIN ".MAIN_DB_PREFIX."expensereport as er ON er.rowid = erd.fk_expensereport"; |
|
| 98 | +$sql .= " JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = er.fk_user_author"; |
|
| 99 | 99 | $sql .= " WHERE er.fk_statut > 0"; |
| 100 | 100 | $sql .= " AND erd.fk_code_ventilation > 0"; |
| 101 | -$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy |
|
| 101 | +$sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy |
|
| 102 | 102 | if ($date_start && $date_end) |
| 103 | - $sql .= " AND er.date_debut >= '" . $db->idate($date_start) . "' AND er.date_debut <= '" . $db->idate($date_end) . "'"; |
|
| 103 | + $sql .= " AND er.date_debut >= '".$db->idate($date_start)."' AND er.date_debut <= '".$db->idate($date_end)."'"; |
|
| 104 | 104 | // Already in bookkeeping or not |
| 105 | 105 | if ($in_bookkeeping == 'already') |
| 106 | 106 | { |
| 107 | - $sql .= " AND er.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')"; |
|
| 107 | + $sql .= " AND er.rowid IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')"; |
|
| 108 | 108 | } |
| 109 | 109 | if ($in_bookkeeping == 'notyet') |
| 110 | 110 | { |
| 111 | - $sql .= " AND er.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')"; |
|
| 111 | + $sql .= " AND er.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')"; |
|
| 112 | 112 | } |
| 113 | 113 | $sql .= " ORDER BY er.date_debut"; |
| 114 | 114 | |
@@ -116,38 +116,38 @@ discard block |
||
| 116 | 116 | $result = $db->query($sql); |
| 117 | 117 | if ($result) { |
| 118 | 118 | |
| 119 | - $taber = array (); |
|
| 120 | - $tabht = array (); |
|
| 121 | - $tabtva = array (); |
|
| 122 | - $def_tva = array (); |
|
| 123 | - $tabttc = array (); |
|
| 124 | - $tablocaltax1 = array (); |
|
| 125 | - $tablocaltax2 = array (); |
|
| 126 | - $tabuser = array (); |
|
| 119 | + $taber = array(); |
|
| 120 | + $tabht = array(); |
|
| 121 | + $tabtva = array(); |
|
| 122 | + $def_tva = array(); |
|
| 123 | + $tabttc = array(); |
|
| 124 | + $tablocaltax1 = array(); |
|
| 125 | + $tablocaltax2 = array(); |
|
| 126 | + $tabuser = array(); |
|
| 127 | 127 | |
| 128 | 128 | $num = $db->num_rows($result); |
| 129 | 129 | |
| 130 | 130 | // Variables |
| 131 | - $account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT)) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined'; |
|
| 132 | - $account_vat = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined'; |
|
| 131 | + $account_salary = (!empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT)) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined'; |
|
| 132 | + $account_vat = (!empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined'; |
|
| 133 | 133 | |
| 134 | 134 | $i = 0; |
| 135 | - while ( $i < $num ) { |
|
| 135 | + while ($i < $num) { |
|
| 136 | 136 | $obj = $db->fetch_object($result); |
| 137 | 137 | |
| 138 | 138 | // Controls |
| 139 | - $compta_user = (! empty($obj->user_accountancy_account)) ? $obj->user_accountancy_account : $account_salary; |
|
| 139 | + $compta_user = (!empty($obj->user_accountancy_account)) ? $obj->user_accountancy_account : $account_salary; |
|
| 140 | 140 | $compta_fees = $obj->compte; |
| 141 | 141 | |
| 142 | - $vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0); |
|
| 143 | - $compta_tva = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $account_vat); |
|
| 144 | - $compta_localtax1 = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva); |
|
| 145 | - $compta_localtax2 = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva); |
|
| 142 | + $vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), $mysoc, $mysoc, 0); |
|
| 143 | + $compta_tva = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $account_vat); |
|
| 144 | + $compta_localtax1 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva); |
|
| 145 | + $compta_localtax2 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva); |
|
| 146 | 146 | |
| 147 | 147 | // Define array to display all VAT rates that use this accounting account $compta_tva |
| 148 | - if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code)) |
|
| 148 | + if (price2num($obj->tva_tx) || !empty($obj->vat_src_code)) |
|
| 149 | 149 | { |
| 150 | - $def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')); |
|
| 150 | + $def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '')] = (vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '')); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $taber[$obj->rowid]["date"] = $db->jdate($obj->de); |
@@ -156,24 +156,24 @@ discard block |
||
| 156 | 156 | $taber[$obj->rowid]["fk_expensereportdet"] = $obj->erdid; |
| 157 | 157 | |
| 158 | 158 | // Avoid warnings |
| 159 | - if (! isset($tabttc[$obj->rowid][$compta_user])) $tabttc[$obj->rowid][$compta_user] = 0; |
|
| 160 | - if (! isset($tabht[$obj->rowid][$compta_fees])) $tabht[$obj->rowid][$compta_fees] = 0; |
|
| 161 | - if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0; |
|
| 162 | - if (! isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0; |
|
| 163 | - if (! isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0; |
|
| 159 | + if (!isset($tabttc[$obj->rowid][$compta_user])) $tabttc[$obj->rowid][$compta_user] = 0; |
|
| 160 | + if (!isset($tabht[$obj->rowid][$compta_fees])) $tabht[$obj->rowid][$compta_fees] = 0; |
|
| 161 | + if (!isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0; |
|
| 162 | + if (!isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0; |
|
| 163 | + if (!isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0; |
|
| 164 | 164 | |
| 165 | 165 | $tabttc[$obj->rowid][$compta_user] += $obj->total_ttc; |
| 166 | 166 | $tabht[$obj->rowid][$compta_fees] += $obj->total_ht; |
| 167 | 167 | $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva; |
| 168 | 168 | $tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1; |
| 169 | 169 | $tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2; |
| 170 | - $tabuser[$obj->rowid] = array ( |
|
| 170 | + $tabuser[$obj->rowid] = array( |
|
| 171 | 171 | 'id' => $obj->uid, |
| 172 | 172 | 'name' => dolGetFirstLastname($obj->firstname, $obj->lastname), |
| 173 | 173 | 'user_accountancy_code' => $obj->user_accountancy_account |
| 174 | 174 | ); |
| 175 | 175 | |
| 176 | - $i ++; |
|
| 176 | + $i++; |
|
| 177 | 177 | } |
| 178 | 178 | } else { |
| 179 | 179 | dol_print_error($db); |
@@ -194,9 +194,9 @@ discard block |
||
| 194 | 194 | $db->begin(); |
| 195 | 195 | |
| 196 | 196 | // Thirdparty |
| 197 | - if (! $errorforline) |
|
| 197 | + if (!$errorforline) |
|
| 198 | 198 | { |
| 199 | - foreach ( $tabttc[$key] as $k => $mt ) { |
|
| 199 | + foreach ($tabttc[$key] as $k => $mt) { |
|
| 200 | 200 | if ($mt) { |
| 201 | 201 | $bookkeeping = new BookKeeping($db); |
| 202 | 202 | $bookkeeping->doc_date = $val["date"]; |
@@ -241,9 +241,9 @@ discard block |
||
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | // Fees |
| 244 | - if (! $errorforline) |
|
| 244 | + if (!$errorforline) |
|
| 245 | 245 | { |
| 246 | - foreach ( $tabht[$key] as $k => $mt ) { |
|
| 246 | + foreach ($tabht[$key] as $k => $mt) { |
|
| 247 | 247 | if ($mt) { |
| 248 | 248 | // get compte id and label |
| 249 | 249 | $accountingaccount = new AccountingAccount($db); |
@@ -292,16 +292,16 @@ discard block |
||
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | // VAT |
| 295 | - if (! $errorforline) |
|
| 295 | + if (!$errorforline) |
|
| 296 | 296 | { |
| 297 | - $listoftax=array(0, 1, 2); |
|
| 298 | - foreach($listoftax as $numtax) |
|
| 297 | + $listoftax = array(0, 1, 2); |
|
| 298 | + foreach ($listoftax as $numtax) |
|
| 299 | 299 | { |
| 300 | 300 | $arrayofvat = $tabtva; |
| 301 | 301 | if ($numtax == 1) $arrayofvat = $tablocaltax1; |
| 302 | 302 | if ($numtax == 2) $arrayofvat = $tablocaltax2; |
| 303 | 303 | |
| 304 | - foreach ( $arrayofvat[$key] as $k => $mt ) { |
|
| 304 | + foreach ($arrayofvat[$key] as $k => $mt) { |
|
| 305 | 305 | if ($mt) { |
| 306 | 306 | // get compte id and label |
| 307 | 307 | $bookkeeping = new BookKeeping($db); |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | $bookkeeping->subledger_account = ''; |
| 315 | 315 | $bookkeeping->subledger_label = ''; |
| 316 | 316 | $bookkeeping->numero_compte = $k; |
| 317 | - $bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %'; |
|
| 317 | + $bookkeeping->label_operation = $langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %'; |
|
| 318 | 318 | $bookkeeping->montant = $mt; |
| 319 | 319 | $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; |
| 320 | 320 | $bookkeeping->debit = ($mt > 0) ? $mt : 0; |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | setEventMessages('Try to insert a non balanced transaction in book for '.$val["ref"].'. Canceled. Surely a bug.', null, 'errors'); |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | - if (! $errorforline) |
|
| 358 | + if (!$errorforline) |
|
| 359 | 359 | { |
| 360 | 360 | $db->commit(); |
| 361 | 361 | } |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | if ($error >= 10) |
| 367 | 367 | { |
| 368 | 368 | setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped"), null, 'errors'); |
| 369 | - break; // Break in the foreach |
|
| 369 | + break; // Break in the foreach |
|
| 370 | 370 | } |
| 371 | 371 | } |
| 372 | 372 | } |
@@ -385,20 +385,20 @@ discard block |
||
| 385 | 385 | setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings'); |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | - $action=''; |
|
| 388 | + $action = ''; |
|
| 389 | 389 | |
| 390 | 390 | // Must reload data, so we make a redirect |
| 391 | 391 | if (count($tabpay) != $error) |
| 392 | 392 | { |
| 393 | - $param='id_journal='.$id_journal; |
|
| 394 | - $param.='&date_startday='.$date_startday; |
|
| 395 | - $param.='&date_startmonth='.$date_startmonth; |
|
| 396 | - $param.='&date_startyear='.$date_startyear; |
|
| 397 | - $param.='&date_endday='.$date_endday; |
|
| 398 | - $param.='&date_endmonth='.$date_endmonth; |
|
| 399 | - $param.='&date_endyear='.$date_endyear; |
|
| 400 | - $param.='&in_bookkeeping='.$in_bookkeeping; |
|
| 401 | - header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:'')); |
|
| 393 | + $param = 'id_journal='.$id_journal; |
|
| 394 | + $param .= '&date_startday='.$date_startday; |
|
| 395 | + $param .= '&date_startmonth='.$date_startmonth; |
|
| 396 | + $param .= '&date_startyear='.$date_startyear; |
|
| 397 | + $param .= '&date_endday='.$date_endday; |
|
| 398 | + $param .= '&date_endmonth='.$date_endmonth; |
|
| 399 | + $param .= '&date_endyear='.$date_endyear; |
|
| 400 | + $param .= '&in_bookkeeping='.$in_bookkeeping; |
|
| 401 | + header("Location: ".$_SERVER['PHP_SELF'].($param ? '?'.$param : '')); |
|
| 402 | 402 | exit; |
| 403 | 403 | } |
| 404 | 404 | } |
@@ -524,17 +524,17 @@ discard block |
||
| 524 | 524 | |
| 525 | 525 | llxHeader('', $langs->trans("ExpenseReportsJournal")); |
| 526 | 526 | |
| 527 | - $nom = $langs->trans("ExpenseReportsJournal") . ' - ' . $accountingjournalstatic->getNomUrl(1); |
|
| 527 | + $nom = $langs->trans("ExpenseReportsJournal").' - '.$accountingjournalstatic->getNomUrl(1); |
|
| 528 | 528 | $nomlink = ''; |
| 529 | 529 | $periodlink = ''; |
| 530 | 530 | $exportlink = ''; |
| 531 | - $builddate=dol_now(); |
|
| 532 | - $description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>'; |
|
| 531 | + $builddate = dol_now(); |
|
| 532 | + $description .= $langs->trans("DescJournalOnlyBindedVisible").'<br>'; |
|
| 533 | 533 | |
| 534 | - $listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger")); |
|
| 535 | - $period = $form->select_date($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1); |
|
| 534 | + $listofchoices = array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger")); |
|
| 535 | + $period = $form->select_date($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0, 1).' - '.$form->select_date($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0, 1).' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1); |
|
| 536 | 536 | |
| 537 | - $varlink = 'id_journal=' . $id_journal; |
|
| 537 | + $varlink = 'id_journal='.$id_journal; |
|
| 538 | 538 | |
| 539 | 539 | journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); |
| 540 | 540 | |
@@ -545,11 +545,11 @@ discard block |
||
| 545 | 545 | } |
| 546 | 546 | print '<div class="tabsAction tabsActionNoBottom">'; |
| 547 | 547 | if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') { |
| 548 | - print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />'; |
|
| 548 | + print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />'; |
|
| 549 | 549 | } |
| 550 | 550 | else { |
| 551 | - if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />'; |
|
| 552 | - else print '<a href="#" class="butActionRefused" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>'; |
|
| 551 | + if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="'.$langs->trans("WriteBookKeeping").'" onclick="writebookkeeping();" />'; |
|
| 552 | + else print '<a href="#" class="butActionRefused" name="writebookkeeping">'.$langs->trans("WriteBookKeeping").'</a>'; |
|
| 553 | 553 | } |
| 554 | 554 | //print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />'; |
| 555 | 555 | print '</div>'; |
@@ -580,13 +580,13 @@ discard block |
||
| 580 | 580 | print "<table class=\"noborder\" width=\"100%\">"; |
| 581 | 581 | print "<tr class=\"liste_titre\">"; |
| 582 | 582 | print "<td></td>"; |
| 583 | - print "<td>" . $langs->trans("Date") . "</td>"; |
|
| 584 | - print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ExpenseReportRef") . ")</td>"; |
|
| 585 | - print "<td>" . $langs->trans("AccountAccounting") . "</td>"; |
|
| 586 | - print "<td>" . $langs->trans("SubledgerAccount") . "</td>"; |
|
| 587 | - print "<td>" . $langs->trans("LabelOperation") . "</td>"; |
|
| 588 | - print "<td align='right'>" . $langs->trans("Debit") . "</td>"; |
|
| 589 | - print "<td align='right'>" . $langs->trans("Credit") . "</td>"; |
|
| 583 | + print "<td>".$langs->trans("Date")."</td>"; |
|
| 584 | + print "<td>".$langs->trans("Piece").' ('.$langs->trans("ExpenseReportRef").")</td>"; |
|
| 585 | + print "<td>".$langs->trans("AccountAccounting")."</td>"; |
|
| 586 | + print "<td>".$langs->trans("SubledgerAccount")."</td>"; |
|
| 587 | + print "<td>".$langs->trans("LabelOperation")."</td>"; |
|
| 588 | + print "<td align='right'>".$langs->trans("Debit")."</td>"; |
|
| 589 | + print "<td align='right'>".$langs->trans("Credit")."</td>"; |
|
| 590 | 590 | print "</tr>\n"; |
| 591 | 591 | |
| 592 | 592 | $r = ''; |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | $expensereportstatic = new ExpenseReport($db); |
| 595 | 595 | $expensereportlinestatic = new ExpenseReportLine($db); |
| 596 | 596 | |
| 597 | - foreach ( $taber as $key => $val ) { |
|
| 597 | + foreach ($taber as $key => $val) { |
|
| 598 | 598 | $expensereportstatic->id = $key; |
| 599 | 599 | $expensereportstatic->ref = $val["ref"]; |
| 600 | 600 | $expensereportlinestatic->comments = html_entity_decode(dol_trunc($val["comments"], 32)); |
@@ -602,15 +602,15 @@ discard block |
||
| 602 | 602 | $date = dol_print_date($val["date"], 'day'); |
| 603 | 603 | |
| 604 | 604 | // Fees |
| 605 | - foreach ( $tabht[$key] as $k => $mt ) { |
|
| 605 | + foreach ($tabht[$key] as $k => $mt) { |
|
| 606 | 606 | $accountingaccount = new AccountingAccount($db); |
| 607 | 607 | $accountingaccount->fetch(null, $k, true); |
| 608 | 608 | |
| 609 | 609 | if ($mt) { |
| 610 | 610 | print '<tr class="oddeven">'; |
| 611 | 611 | print "<td><!-- Fees --></td>"; |
| 612 | - print "<td>" . $date . "</td>"; |
|
| 613 | - print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>"; |
|
| 612 | + print "<td>".$date."</td>"; |
|
| 613 | + print "<td>".$expensereportstatic->getNomUrl(1)."</td>"; |
|
| 614 | 614 | $userstatic->id = $tabuser[$key]['id']; |
| 615 | 615 | $userstatic->name = $tabuser[$key]['name']; |
| 616 | 616 | // Account |
@@ -627,19 +627,19 @@ discard block |
||
| 627 | 627 | print '</td>'; |
| 628 | 628 | $userstatic->id = $tabuser[$key]['id']; |
| 629 | 629 | $userstatic->name = $tabuser[$key]['name']; |
| 630 | - print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $accountingaccount->label . "</td>"; |
|
| 631 | - print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>"; |
|
| 632 | - print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>"; |
|
| 630 | + print "<td>".$userstatic->getNomUrl(0, 'user', 16).' - '.$accountingaccount->label."</td>"; |
|
| 631 | + print '<td align="right">'.($mt >= 0 ? price($mt) : '')."</td>"; |
|
| 632 | + print '<td align="right">'.($mt < 0 ? price(-$mt) : '')."</td>"; |
|
| 633 | 633 | print "</tr>"; |
| 634 | 634 | } |
| 635 | 635 | } |
| 636 | 636 | |
| 637 | 637 | // Third party |
| 638 | - foreach ( $tabttc[$key] as $k => $mt ) { |
|
| 638 | + foreach ($tabttc[$key] as $k => $mt) { |
|
| 639 | 639 | print '<tr class="oddeven">'; |
| 640 | 640 | print "<td><!-- Thirdparty --></td>"; |
| 641 | - print "<td>" . $date . "</td>"; |
|
| 642 | - print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>"; |
|
| 641 | + print "<td>".$date."</td>"; |
|
| 642 | + print "<td>".$expensereportstatic->getNomUrl(1)."</td>"; |
|
| 643 | 643 | $userstatic->id = $tabuser[$key]['id']; |
| 644 | 644 | $userstatic->name = $tabuser[$key]['name']; |
| 645 | 645 | // Account |
@@ -660,9 +660,9 @@ discard block |
||
| 660 | 660 | } |
| 661 | 661 | else print $accountoshow; |
| 662 | 662 | print '</td>'; |
| 663 | - print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("SubledgerAccount") . "</td>"; |
|
| 664 | - print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>"; |
|
| 665 | - print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>"; |
|
| 663 | + print "<td>".$userstatic->getNomUrl(0, 'user', 16).' - '.$langs->trans("SubledgerAccount")."</td>"; |
|
| 664 | + print '<td align="right">'.($mt < 0 ? -price(-$mt) : '')."</td>"; |
|
| 665 | + print '<td align="right">'.($mt >= 0 ? price($mt) : '')."</td>"; |
|
| 666 | 666 | print "</tr>"; |
| 667 | 667 | } |
| 668 | 668 | |
@@ -673,12 +673,12 @@ discard block |
||
| 673 | 673 | if ($numtax == 1) $arrayofvat = $tablocaltax1; |
| 674 | 674 | if ($numtax == 2) $arrayofvat = $tablocaltax2; |
| 675 | 675 | |
| 676 | - foreach ( $arrayofvat[$key] as $k => $mt ) { |
|
| 676 | + foreach ($arrayofvat[$key] as $k => $mt) { |
|
| 677 | 677 | if ($mt) { |
| 678 | 678 | print '<tr class="oddeven">'; |
| 679 | 679 | print "<td><!-- VAT --></td>"; |
| 680 | - print "<td>" . $date . "</td>"; |
|
| 681 | - print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>"; |
|
| 680 | + print "<td>".$date."</td>"; |
|
| 681 | + print "<td>".$expensereportstatic->getNomUrl(1)."</td>"; |
|
| 682 | 682 | // Account |
| 683 | 683 | print "<td>"; |
| 684 | 684 | $accountoshow = length_accountg($k); |
@@ -691,10 +691,10 @@ discard block |
||
| 691 | 691 | // Subledger account |
| 692 | 692 | print "<td>"; |
| 693 | 693 | print '</td>'; |
| 694 | - print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:''); |
|
| 694 | + print "<td>".$userstatic->getNomUrl(0, 'user', 16).' - '.$langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : ''); |
|
| 695 | 695 | print "</td>"; |
| 696 | - print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>"; |
|
| 697 | - print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>"; |
|
| 696 | + print '<td align="right">'.($mt >= 0 ? price($mt) : '')."</td>"; |
|
| 697 | + print '<td align="right">'.($mt < 0 ? price(-$mt) : '')."</td>"; |
|
| 698 | 698 | print "</tr>"; |
| 699 | 699 | } |
| 700 | 700 | } |
@@ -27,35 +27,35 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language |
| 29 | 29 | //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url. |
| 30 | -if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); |
|
| 30 | +if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); |
|
| 31 | 31 | //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations |
| 32 | -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); |
|
| 33 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); |
|
| 34 | -if (! defined('NOLOGIN')) define('NOLOGIN',1); // File must be accessed by logon page so without login |
|
| 32 | +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); |
|
| 33 | +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); |
|
| 34 | +if (!defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed by logon page so without login |
|
| 35 | 35 | //if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content |
| 36 | -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); |
|
| 37 | -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); |
|
| 36 | +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); |
|
| 37 | +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
| 38 | 38 | |
| 39 | 39 | // Colors |
| 40 | -$colorbackhmenu1='90,50,120'; // topmenu |
|
| 41 | -$colorbackvmenu1='255,255,255'; // vmenu |
|
| 42 | -$colortopbordertitle1=''; // top border of tables-lists title. not defined = default to colorbackhmenu1 |
|
| 43 | -$colorbacktitle1='240,240,240'; // title of tables-lists |
|
| 44 | -$colorbacktabcard1='255,255,255'; // card |
|
| 45 | -$colorbacktabactive='234,234,234'; |
|
| 46 | -$colorbacklineimpair1='255,255,255'; // line impair |
|
| 47 | -$colorbacklineimpair2='255,255,255'; // line impair |
|
| 48 | -$colorbacklinepair1='250,250,250'; // line pair |
|
| 49 | -$colorbacklinepair2='248,248,248'; // line pair |
|
| 50 | -$colorbacklinepairhover='244,244,244'; // line pair |
|
| 51 | -$colorbacklinebreak='214,218,220'; |
|
| 52 | -$colorbackbody='248,248,248'; |
|
| 53 | -$colortexttitlenotab='90,90,90'; |
|
| 54 | -$colortexttitle='20,20,20'; |
|
| 55 | -$colortext='0,0,0'; |
|
| 56 | -$colortextlink='0,0,120'; |
|
| 57 | -$fontsize='13'; |
|
| 58 | -$fontsizesmaller='11'; |
|
| 40 | +$colorbackhmenu1 = '90,50,120'; // topmenu |
|
| 41 | +$colorbackvmenu1 = '255,255,255'; // vmenu |
|
| 42 | +$colortopbordertitle1 = ''; // top border of tables-lists title. not defined = default to colorbackhmenu1 |
|
| 43 | +$colorbacktitle1 = '240,240,240'; // title of tables-lists |
|
| 44 | +$colorbacktabcard1 = '255,255,255'; // card |
|
| 45 | +$colorbacktabactive = '234,234,234'; |
|
| 46 | +$colorbacklineimpair1 = '255,255,255'; // line impair |
|
| 47 | +$colorbacklineimpair2 = '255,255,255'; // line impair |
|
| 48 | +$colorbacklinepair1 = '250,250,250'; // line pair |
|
| 49 | +$colorbacklinepair2 = '248,248,248'; // line pair |
|
| 50 | +$colorbacklinepairhover = '244,244,244'; // line pair |
|
| 51 | +$colorbacklinebreak = '214,218,220'; |
|
| 52 | +$colorbackbody = '248,248,248'; |
|
| 53 | +$colortexttitlenotab = '90,90,90'; |
|
| 54 | +$colortexttitle = '20,20,20'; |
|
| 55 | +$colortext = '0,0,0'; |
|
| 56 | +$colortextlink = '0,0,120'; |
|
| 57 | +$fontsize = '13'; |
|
| 58 | +$fontsizesmaller = '11'; |
|
| 59 | 59 | |
| 60 | 60 | if (defined('THEME_ONLY_CONSTANT')) return; |
| 61 | 61 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
| 66 | 66 | |
| 67 | 67 | // Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) |
| 68 | -if (empty($user->id) && ! empty($_SESSION['dol_login'])) $user->fetch('',$_SESSION['dol_login'],'',1); |
|
| 68 | +if (empty($user->id) && !empty($_SESSION['dol_login'])) $user->fetch('', $_SESSION['dol_login'], '', 1); |
|
| 69 | 69 | |
| 70 | 70 | |
| 71 | 71 | // Define css type |
@@ -77,132 +77,132 @@ discard block |
||
| 77 | 77 | // On the fly GZIP compression for all pages (if browser support it). Must set the bit 3 of constant to 1. |
| 78 | 78 | if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x04)) { ob_start("ob_gzhandler"); } |
| 79 | 79 | |
| 80 | -if (GETPOST('theme','alpha')) $conf->theme=GETPOST('theme','alpha'); // If theme was forced on URL |
|
| 81 | -if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL |
|
| 80 | +if (GETPOST('theme', 'alpha')) $conf->theme = GETPOST('theme', 'alpha'); // If theme was forced on URL |
|
| 81 | +if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL |
|
| 82 | 82 | |
| 83 | -$langs->load("main",0,1); |
|
| 84 | -$right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); |
|
| 85 | -$left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); |
|
| 83 | +$langs->load("main", 0, 1); |
|
| 84 | +$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right'); |
|
| 85 | +$left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left'); |
|
| 86 | 86 | |
| 87 | -$path=''; // This value may be used in future for external module to overwrite theme |
|
| 88 | -$theme='md'; // Value of theme |
|
| 89 | -if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; } |
|
| 87 | +$path = ''; // This value may be used in future for external module to overwrite theme |
|
| 88 | +$theme = 'md'; // Value of theme |
|
| 89 | +if (!empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path = '/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme = $conf->global->MAIN_OVERWRITE_THEME_RES; } |
|
| 90 | 90 | |
| 91 | 91 | // Define image path files and other constants |
| 92 | -$fontlist='roboto,arial,tahoma,verdana,helvetica'; //$fontlist='verdana,helvetica,arial,sans-serif'; |
|
| 93 | -$img_head=''; |
|
| 94 | -$img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png',1); |
|
| 95 | -$dol_hide_topmenu=$conf->dol_hide_topmenu; |
|
| 96 | -$dol_hide_leftmenu=$conf->dol_hide_leftmenu; |
|
| 97 | -$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen; |
|
| 98 | -$dol_no_mouse_hover=$conf->dol_no_mouse_hover; |
|
| 92 | +$fontlist = 'roboto,arial,tahoma,verdana,helvetica'; //$fontlist='verdana,helvetica,arial,sans-serif'; |
|
| 93 | +$img_head = ''; |
|
| 94 | +$img_button = dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png', 1); |
|
| 95 | +$dol_hide_topmenu = $conf->dol_hide_topmenu; |
|
| 96 | +$dol_hide_leftmenu = $conf->dol_hide_leftmenu; |
|
| 97 | +$dol_optimize_smallscreen = $conf->dol_optimize_smallscreen; |
|
| 98 | +$dol_no_mouse_hover = $conf->dol_no_mouse_hover; |
|
| 99 | 99 | |
| 100 | 100 | |
| 101 | 101 | //$conf->global->THEME_ELDY_ENABLE_PERSONALIZED=0; |
| 102 | 102 | //$user->conf->THEME_ELDY_ENABLE_PERSONALIZED=0; |
| 103 | 103 | //var_dump($user->conf->THEME_ELDY_RGB); |
| 104 | 104 | |
| 105 | -$useboldtitle=(isset($conf->global->THEME_ELDY_USEBOLDTITLE)?$conf->global->THEME_ELDY_USEBOLDTITLE:1); |
|
| 106 | -$borderwidth=2; |
|
| 105 | +$useboldtitle = (isset($conf->global->THEME_ELDY_USEBOLDTITLE) ? $conf->global->THEME_ELDY_USEBOLDTITLE : 1); |
|
| 106 | +$borderwidth = 2; |
|
| 107 | 107 | |
| 108 | 108 | // Case of option always editable |
| 109 | -if (! isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY=$colorbackbody; |
|
| 110 | -if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1=$colorbackhmenu1; |
|
| 111 | -if (! isset($conf->global->THEME_ELDY_VERMENU_BACK1)) $conf->global->THEME_ELDY_VERMENU_BACK1=$colorbackvmenu1; |
|
| 112 | -if (! isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1=$colorbacktitle1; |
|
| 113 | -if (! isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER==$colorbacklinepairhover; |
|
| 114 | -if (! isset($conf->global->THEME_ELDY_LINEBREAK)) $conf->global->THEME_ELDY_LINEBREAK=$colorbacklinebreak; |
|
| 115 | -if (! isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) $conf->global->THEME_ELDY_TEXTTITLENOTAB=$colortexttitlenotab; |
|
| 116 | -if (! isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK=$colortextlink; |
|
| 109 | +if (!isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY = $colorbackbody; |
|
| 110 | +if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1; |
|
| 111 | +if (!isset($conf->global->THEME_ELDY_VERMENU_BACK1)) $conf->global->THEME_ELDY_VERMENU_BACK1 = $colorbackvmenu1; |
|
| 112 | +if (!isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1 = $colorbacktitle1; |
|
| 113 | +if (!isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER == $colorbacklinepairhover; |
|
| 114 | +if (!isset($conf->global->THEME_ELDY_LINEBREAK)) $conf->global->THEME_ELDY_LINEBREAK = $colorbacklinebreak; |
|
| 115 | +if (!isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) $conf->global->THEME_ELDY_TEXTTITLENOTAB = $colortexttitlenotab; |
|
| 116 | +if (!isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK = $colortextlink; |
|
| 117 | 117 | |
| 118 | 118 | // Case of option editable only if option THEME_ELDY_ENABLE_PERSONALIZED is on |
| 119 | 119 | if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) |
| 120 | 120 | { |
| 121 | 121 | // 90A4AE, 607D8B, 455A64, 37474F |
| 122 | - $conf->global->THEME_ELDY_BACKTABCARD1='255,255,255'; // card |
|
| 123 | - $conf->global->THEME_ELDY_BACKTABACTIVE='234,234,234'; |
|
| 124 | - $conf->global->THEME_ELDY_TEXT='0,0,0'; |
|
| 125 | - $conf->global->THEME_ELDY_FONT_SIZE1='13'; |
|
| 126 | - $conf->global->THEME_ELDY_FONT_SIZE2='11'; |
|
| 122 | + $conf->global->THEME_ELDY_BACKTABCARD1 = '255,255,255'; // card |
|
| 123 | + $conf->global->THEME_ELDY_BACKTABACTIVE = '234,234,234'; |
|
| 124 | + $conf->global->THEME_ELDY_TEXT = '0,0,0'; |
|
| 125 | + $conf->global->THEME_ELDY_FONT_SIZE1 = '13'; |
|
| 126 | + $conf->global->THEME_ELDY_FONT_SIZE2 = '11'; |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | // Case of option availables only if THEME_ELDY_ENABLE_PERSONALIZED is on |
| 130 | -$colorbackhmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$user->conf->THEME_ELDY_TOPMENU_BACK1); |
|
| 131 | -$colorbackvmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$conf->global->THEME_ELDY_VERMENU_BACK1) :(empty($user->conf->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$user->conf->THEME_ELDY_VERMENU_BACK1); |
|
| 132 | -$colortopbordertitle1=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPBORDER_TITLE1)?$colortopbordertitle1:$conf->global->THEME_ELDY_TOPBORDER_TITLE1) :(empty($user->conf->THEME_ELDY_TOPBORDER_TITLE1)?$colortopbordertitle1:$user->conf->THEME_ELDY_TOPBORDER_TITLE1); |
|
| 133 | -$colorbacktitle1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTITLE1) ?$colorbacktitle1:$conf->global->THEME_ELDY_BACKTITLE1) :(empty($user->conf->THEME_ELDY_BACKTITLE1)?$colorbacktitle1:$user->conf->THEME_ELDY_BACKTITLE1); |
|
| 134 | -$colorbacktabcard1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTABCARD1) ?$colorbacktabcard1:$conf->global->THEME_ELDY_BACKTABCARD1) :(empty($user->conf->THEME_ELDY_BACKTABCARD1)?$colorbacktabcard1:$user->conf->THEME_ELDY_BACKTABCARD1); |
|
| 135 | -$colorbacktabactive =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTABACTIVE)?$colorbacktabactive:$conf->global->THEME_ELDY_BACKTABACTIVE):(empty($user->conf->THEME_ELDY_BACKTABACTIVE)?$colorbacktabactive:$user->conf->THEME_ELDY_BACKTABACTIVE); |
|
| 136 | -$colorbacklineimpair1=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEIMPAIR1) ?$colorbacklineimpair1:$conf->global->THEME_ELDY_LINEIMPAIR1):(empty($user->conf->THEME_ELDY_LINEIMPAIR1)?$colorbacklineimpair1:$user->conf->THEME_ELDY_LINEIMPAIR1); |
|
| 137 | -$colorbacklineimpair2=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEIMPAIR2) ?$colorbacklineimpair2:$conf->global->THEME_ELDY_LINEIMPAIR2):(empty($user->conf->THEME_ELDY_LINEIMPAIR2)?$colorbacklineimpair2:$user->conf->THEME_ELDY_LINEIMPAIR2); |
|
| 138 | -$colorbacklinepair1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR1) ?$colorbacklinepair1:$conf->global->THEME_ELDY_LINEPAIR1) :(empty($user->conf->THEME_ELDY_LINEPAIR1)?$colorbacklinepair1:$user->conf->THEME_ELDY_LINEPAIR1); |
|
| 139 | -$colorbacklinepair2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR2) ?$colorbacklinepair2:$conf->global->THEME_ELDY_LINEPAIR2) :(empty($user->conf->THEME_ELDY_LINEPAIR2)?$colorbacklinepair2:$user->conf->THEME_ELDY_LINEPAIR2); |
|
| 140 | -$colorbacklinebreak =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEBREAK) ?$colorbacklinebreak:$conf->global->THEME_ELDY_LINEBREAK) :(empty($user->conf->THEME_ELDY_LINEBREAK)?$colorbacklinebreak:$user->conf->THEME_ELDY_LINEBREAK); |
|
| 141 | -$colorbackbody =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKBODY) ?$colorbackbody:$conf->global->THEME_ELDY_BACKBODY) :(empty($user->conf->THEME_ELDY_BACKBODY)?$colorbackbody:$user->conf->THEME_ELDY_BACKBODY); |
|
| 142 | -$colortexttitlenotab =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXTTITLENOTAB)?$colortexttitlenotab:$conf->global->THEME_ELDY_TEXTTITLENOTAB) :(empty($user->conf->THEME_ELDY_TEXTTITLENOTAB)?$colortexttitlenotab:$user->conf->THEME_ELDY_TEXTTITLENOTAB); |
|
| 143 | -$colortexttitle =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXTTITLE) ?$colortext:$conf->global->THEME_ELDY_TEXTTITLE) :(empty($user->conf->THEME_ELDY_TEXTTITLE)?$colortexttitle:$user->conf->THEME_ELDY_TEXTTITLE); |
|
| 144 | -$colortext =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXT) ?$colortext:$conf->global->THEME_ELDY_TEXT) :(empty($user->conf->THEME_ELDY_TEXT)?$colortext:$user->conf->THEME_ELDY_TEXT); |
|
| 145 | -$colortextlink =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXTLINK) ?$colortext:$conf->global->THEME_ELDY_TEXTLINK) :(empty($user->conf->THEME_ELDY_TEXTLINK)?$colortextlink:$user->conf->THEME_ELDY_TEXTLINK); |
|
| 146 | -$fontsize =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE1) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE1) :(empty($user->conf->THEME_ELDY_FONT_SIZE1)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE1); |
|
| 147 | -$fontsizesmaller =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE2) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE2) :(empty($user->conf->THEME_ELDY_FONT_SIZE2)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE2); |
|
| 130 | +$colorbackhmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $conf->global->THEME_ELDY_TOPMENU_BACK1) : (empty($user->conf->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $user->conf->THEME_ELDY_TOPMENU_BACK1); |
|
| 131 | +$colorbackvmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_VERMENU_BACK1) ? $colorbackvmenu1 : $conf->global->THEME_ELDY_VERMENU_BACK1) : (empty($user->conf->THEME_ELDY_VERMENU_BACK1) ? $colorbackvmenu1 : $user->conf->THEME_ELDY_VERMENU_BACK1); |
|
| 132 | +$colortopbordertitle1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TOPBORDER_TITLE1) ? $colortopbordertitle1 : $conf->global->THEME_ELDY_TOPBORDER_TITLE1) : (empty($user->conf->THEME_ELDY_TOPBORDER_TITLE1) ? $colortopbordertitle1 : $user->conf->THEME_ELDY_TOPBORDER_TITLE1); |
|
| 133 | +$colorbacktitle1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_BACKTITLE1) ? $colorbacktitle1 : $conf->global->THEME_ELDY_BACKTITLE1) : (empty($user->conf->THEME_ELDY_BACKTITLE1) ? $colorbacktitle1 : $user->conf->THEME_ELDY_BACKTITLE1); |
|
| 134 | +$colorbacktabcard1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_BACKTABCARD1) ? $colorbacktabcard1 : $conf->global->THEME_ELDY_BACKTABCARD1) : (empty($user->conf->THEME_ELDY_BACKTABCARD1) ? $colorbacktabcard1 : $user->conf->THEME_ELDY_BACKTABCARD1); |
|
| 135 | +$colorbacktabactive = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_BACKTABACTIVE) ? $colorbacktabactive : $conf->global->THEME_ELDY_BACKTABACTIVE) : (empty($user->conf->THEME_ELDY_BACKTABACTIVE) ? $colorbacktabactive : $user->conf->THEME_ELDY_BACKTABACTIVE); |
|
| 136 | +$colorbacklineimpair1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEIMPAIR1) ? $colorbacklineimpair1 : $conf->global->THEME_ELDY_LINEIMPAIR1) : (empty($user->conf->THEME_ELDY_LINEIMPAIR1) ? $colorbacklineimpair1 : $user->conf->THEME_ELDY_LINEIMPAIR1); |
|
| 137 | +$colorbacklineimpair2 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEIMPAIR2) ? $colorbacklineimpair2 : $conf->global->THEME_ELDY_LINEIMPAIR2) : (empty($user->conf->THEME_ELDY_LINEIMPAIR2) ? $colorbacklineimpair2 : $user->conf->THEME_ELDY_LINEIMPAIR2); |
|
| 138 | +$colorbacklinepair1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEPAIR1) ? $colorbacklinepair1 : $conf->global->THEME_ELDY_LINEPAIR1) : (empty($user->conf->THEME_ELDY_LINEPAIR1) ? $colorbacklinepair1 : $user->conf->THEME_ELDY_LINEPAIR1); |
|
| 139 | +$colorbacklinepair2 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEPAIR2) ? $colorbacklinepair2 : $conf->global->THEME_ELDY_LINEPAIR2) : (empty($user->conf->THEME_ELDY_LINEPAIR2) ? $colorbacklinepair2 : $user->conf->THEME_ELDY_LINEPAIR2); |
|
| 140 | +$colorbacklinebreak = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEBREAK) ? $colorbacklinebreak : $conf->global->THEME_ELDY_LINEBREAK) : (empty($user->conf->THEME_ELDY_LINEBREAK) ? $colorbacklinebreak : $user->conf->THEME_ELDY_LINEBREAK); |
|
| 141 | +$colorbackbody = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_BACKBODY) ? $colorbackbody : $conf->global->THEME_ELDY_BACKBODY) : (empty($user->conf->THEME_ELDY_BACKBODY) ? $colorbackbody : $user->conf->THEME_ELDY_BACKBODY); |
|
| 142 | +$colortexttitlenotab = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXTTITLENOTAB) ? $colortexttitlenotab : $conf->global->THEME_ELDY_TEXTTITLENOTAB) : (empty($user->conf->THEME_ELDY_TEXTTITLENOTAB) ? $colortexttitlenotab : $user->conf->THEME_ELDY_TEXTTITLENOTAB); |
|
| 143 | +$colortexttitle = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXTTITLE) ? $colortext : $conf->global->THEME_ELDY_TEXTTITLE) : (empty($user->conf->THEME_ELDY_TEXTTITLE) ? $colortexttitle : $user->conf->THEME_ELDY_TEXTTITLE); |
|
| 144 | +$colortext = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXT) ? $colortext : $conf->global->THEME_ELDY_TEXT) : (empty($user->conf->THEME_ELDY_TEXT) ? $colortext : $user->conf->THEME_ELDY_TEXT); |
|
| 145 | +$colortextlink = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXTLINK) ? $colortext : $conf->global->THEME_ELDY_TEXTLINK) : (empty($user->conf->THEME_ELDY_TEXTLINK) ? $colortextlink : $user->conf->THEME_ELDY_TEXTLINK); |
|
| 146 | +$fontsize = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_FONT_SIZE1) ? $fontsize : $conf->global->THEME_ELDY_FONT_SIZE1) : (empty($user->conf->THEME_ELDY_FONT_SIZE1) ? $fontsize : $user->conf->THEME_ELDY_FONT_SIZE1); |
|
| 147 | +$fontsizesmaller = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_FONT_SIZE2) ? $fontsize : $conf->global->THEME_ELDY_FONT_SIZE2) : (empty($user->conf->THEME_ELDY_FONT_SIZE2) ? $fontsize : $user->conf->THEME_ELDY_FONT_SIZE2); |
|
| 148 | 148 | |
| 149 | 149 | // Hover color |
| 150 | -$colorbacklinepairhover=((! isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '0')?'':($conf->global->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$conf->global->THEME_ELDY_USE_HOVER)); |
|
| 151 | -if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)) |
|
| 150 | +$colorbacklinepairhover = ((!isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '0') ? '' : ($conf->global->THEME_ELDY_USE_HOVER === '1' ? 'edf4fb' : $conf->global->THEME_ELDY_USE_HOVER)); |
|
| 151 | +if (!empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)) |
|
| 152 | 152 | { |
| 153 | - $colorbacklinepairhover=((! isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0')?'':($user->conf->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$user->conf->THEME_ELDY_USE_HOVER)); |
|
| 153 | + $colorbacklinepairhover = ((!isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0') ? '' : ($user->conf->THEME_ELDY_USE_HOVER === '1' ? 'edf4fb' : $user->conf->THEME_ELDY_USE_HOVER)); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | -if (empty($colortopbordertitle1)) $colortopbordertitle1=$colorbackhmenu1; |
|
| 156 | +if (empty($colortopbordertitle1)) $colortopbordertitle1 = $colorbackhmenu1; |
|
| 157 | 157 | |
| 158 | 158 | |
| 159 | 159 | // Set text color to black or white |
| 160 | -$colorbackhmenu1=join(',',colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z' |
|
| 161 | -$tmppart=explode(',',$colorbackhmenu1); |
|
| 162 | -$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0); |
|
| 163 | -if ($tmpval <= 460) $colortextbackhmenu='FFFFFF'; |
|
| 164 | -else $colortextbackhmenu='000000'; |
|
| 165 | - |
|
| 166 | -$colorbackvmenu1=join(',',colorStringToArray($colorbackvmenu1)); // Normalize value to 'x,y,z' |
|
| 167 | -$tmppart=explode(',',$colorbackvmenu1); |
|
| 168 | -$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0); |
|
| 169 | -if ($tmpval <= 460) { $colortextbackvmenu='FFFFFF'; } |
|
| 170 | -else { $colortextbackvmenu='000000'; } |
|
| 171 | - |
|
| 172 | -$colorbacktitle1=join(',',colorStringToArray($colorbacktitle1)); // Normalize value to 'x,y,z' |
|
| 173 | -$tmppart=explode(',',$colorbacktitle1); |
|
| 160 | +$colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z' |
|
| 161 | +$tmppart = explode(',', $colorbackhmenu1); |
|
| 162 | +$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0); |
|
| 163 | +if ($tmpval <= 460) $colortextbackhmenu = 'FFFFFF'; |
|
| 164 | +else $colortextbackhmenu = '000000'; |
|
| 165 | + |
|
| 166 | +$colorbackvmenu1 = join(',', colorStringToArray($colorbackvmenu1)); // Normalize value to 'x,y,z' |
|
| 167 | +$tmppart = explode(',', $colorbackvmenu1); |
|
| 168 | +$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0); |
|
| 169 | +if ($tmpval <= 460) { $colortextbackvmenu = 'FFFFFF'; } |
|
| 170 | +else { $colortextbackvmenu = '000000'; } |
|
| 171 | + |
|
| 172 | +$colorbacktitle1 = join(',', colorStringToArray($colorbacktitle1)); // Normalize value to 'x,y,z' |
|
| 173 | +$tmppart = explode(',', $colorbacktitle1); |
|
| 174 | 174 | if ($colortexttitle == '') |
| 175 | 175 | { |
| 176 | - $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0); |
|
| 177 | - if ($tmpval <= 460) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; } |
|
| 178 | - else { $colortexttitle='101010'; $colorshadowtitle='FFFFFF'; } |
|
| 176 | + $tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0); |
|
| 177 | + if ($tmpval <= 460) { $colortexttitle = 'FFFFFF'; $colorshadowtitle = '888888'; } |
|
| 178 | + else { $colortexttitle = '101010'; $colorshadowtitle = 'FFFFFF'; } |
|
| 179 | 179 | } |
| 180 | -else $colorshadowtitle='888888'; |
|
| 180 | +else $colorshadowtitle = '888888'; |
|
| 181 | 181 | |
| 182 | -$colorbacktabcard1=join(',',colorStringToArray($colorbacktabcard1)); // Normalize value to 'x,y,z' |
|
| 183 | -$tmppart=explode(',',$colorbacktabcard1); |
|
| 184 | -$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0); |
|
| 185 | -if ($tmpval <= 460) { $colortextbacktab='FFFFFF'; } |
|
| 186 | -else { $colortextbacktab='111111'; } |
|
| 182 | +$colorbacktabcard1 = join(',', colorStringToArray($colorbacktabcard1)); // Normalize value to 'x,y,z' |
|
| 183 | +$tmppart = explode(',', $colorbacktabcard1); |
|
| 184 | +$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0); |
|
| 185 | +if ($tmpval <= 460) { $colortextbacktab = 'FFFFFF'; } |
|
| 186 | +else { $colortextbacktab = '111111'; } |
|
| 187 | 187 | |
| 188 | 188 | // Format color value to match expected format (may be 'FFFFFF' or '255,255,255') |
| 189 | -$colorbackhmenu1=join(',',colorStringToArray($colorbackhmenu1)); |
|
| 190 | -$colorbackvmenu1=join(',',colorStringToArray($colorbackvmenu1)); |
|
| 191 | -$colorbacktitle1=join(',',colorStringToArray($colorbacktitle1)); |
|
| 192 | -$colorbacktabcard1=join(',',colorStringToArray($colorbacktabcard1)); |
|
| 193 | -$colorbacktabactive=join(',',colorStringToArray($colorbacktabactive)); |
|
| 194 | -$colorbacklineimpair1=join(',',colorStringToArray($colorbacklineimpair1)); |
|
| 195 | -$colorbacklineimpair2=join(',',colorStringToArray($colorbacklineimpair2)); |
|
| 196 | -$colorbacklinepair1=join(',',colorStringToArray($colorbacklinepair1)); |
|
| 197 | -$colorbacklinepair2=join(',',colorStringToArray($colorbacklinepair2)); |
|
| 198 | -if ($colorbacklinepairhover != '') $colorbacklinepairhover=join(',',colorStringToArray($colorbacklinepairhover)); |
|
| 199 | -$colorbackbody=join(',',colorStringToArray($colorbackbody)); |
|
| 200 | -$colortexttitlenotab=join(',',colorStringToArray($colortexttitlenotab)); |
|
| 201 | -$colortexttitle=join(',',colorStringToArray($colortexttitle)); |
|
| 202 | -$colortext=join(',',colorStringToArray($colortext)); |
|
| 203 | -$colortextlink=join(',',colorStringToArray($colortextlink)); |
|
| 204 | - |
|
| 205 | -$nbtopmenuentries=$menumanager->showmenu('topnb'); |
|
| 189 | +$colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); |
|
| 190 | +$colorbackvmenu1 = join(',', colorStringToArray($colorbackvmenu1)); |
|
| 191 | +$colorbacktitle1 = join(',', colorStringToArray($colorbacktitle1)); |
|
| 192 | +$colorbacktabcard1 = join(',', colorStringToArray($colorbacktabcard1)); |
|
| 193 | +$colorbacktabactive = join(',', colorStringToArray($colorbacktabactive)); |
|
| 194 | +$colorbacklineimpair1 = join(',', colorStringToArray($colorbacklineimpair1)); |
|
| 195 | +$colorbacklineimpair2 = join(',', colorStringToArray($colorbacklineimpair2)); |
|
| 196 | +$colorbacklinepair1 = join(',', colorStringToArray($colorbacklinepair1)); |
|
| 197 | +$colorbacklinepair2 = join(',', colorStringToArray($colorbacklinepair2)); |
|
| 198 | +if ($colorbacklinepairhover != '') $colorbacklinepairhover = join(',', colorStringToArray($colorbacklinepairhover)); |
|
| 199 | +$colorbackbody = join(',', colorStringToArray($colorbackbody)); |
|
| 200 | +$colortexttitlenotab = join(',', colorStringToArray($colortexttitlenotab)); |
|
| 201 | +$colortexttitle = join(',', colorStringToArray($colortexttitle)); |
|
| 202 | +$colortext = join(',', colorStringToArray($colortext)); |
|
| 203 | +$colortextlink = join(',', colorStringToArray($colortextlink)); |
|
| 204 | + |
|
| 205 | +$nbtopmenuentries = $menumanager->showmenu('topnb'); |
|
| 206 | 206 | |
| 207 | 207 | print '/*'."\n"; |
| 208 | 208 | print 'colorbackbody='.$colorbackbody."\n"; |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | |
| 240 | 240 | body { |
| 241 | -<?php if (GETPOST('optioncss','aZ09') == 'print') { ?> |
|
| 241 | +<?php if (GETPOST('optioncss', 'aZ09') == 'print') { ?> |
|
| 242 | 242 | background-color: #FFFFFF; |
| 243 | 243 | <?php } else { ?> |
| 244 | 244 | background: rgb(<?php print $colorbackbody; ?>); |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | font-size: <?php print $fontsize ?>px; |
| 301 | 301 | font-family: <?php print $fontlist ?>; |
| 302 | 302 | border: none; |
| 303 | - border<?php echo empty($conf->global->THEME_HIDE_BORDER_ON_INPUT)?'-bottom':''; ?>: solid 1px rgba(0,0,0,.2); |
|
| 303 | + border<?php echo empty($conf->global->THEME_HIDE_BORDER_ON_INPUT) ? '-bottom' : ''; ?>: solid 1px rgba(0,0,0,.2); |
|
| 304 | 304 | outline: none; |
| 305 | 305 | margin: 0px 0px 0px 0px; |
| 306 | 306 | } |
@@ -360,39 +360,39 @@ discard block |
||
| 360 | 360 | white-space: normal; |
| 361 | 361 | } |
| 362 | 362 | input.buttonpaymentcb { |
| 363 | - background-image: url(<?php echo dol_buildpath($path.'/theme/common/credit_card.png',1) ?>); |
|
| 363 | + background-image: url(<?php echo dol_buildpath($path.'/theme/common/credit_card.png', 1) ?>); |
|
| 364 | 364 | background-size: 26px; |
| 365 | 365 | background-repeat: no-repeat; |
| 366 | 366 | background-position: 5px 5px; |
| 367 | 367 | } |
| 368 | 368 | input.buttonpaymentcheque { |
| 369 | - background-image: url(<?php echo dol_buildpath($path.'/theme/common/cheque.png',1) ?>); |
|
| 369 | + background-image: url(<?php echo dol_buildpath($path.'/theme/common/cheque.png', 1) ?>); |
|
| 370 | 370 | background-repeat: no-repeat; |
| 371 | 371 | background-position: 8px 7px; |
| 372 | 372 | } |
| 373 | 373 | input.buttonpaymentcb { |
| 374 | - background-image: url(<?php echo dol_buildpath($path.'/theme/common/credit_card.png',1) ?>); |
|
| 374 | + background-image: url(<?php echo dol_buildpath($path.'/theme/common/credit_card.png', 1) ?>); |
|
| 375 | 375 | background-size: 24px; |
| 376 | 376 | background-repeat: no-repeat; |
| 377 | 377 | background-position: 5px 4px; |
| 378 | 378 | } |
| 379 | 379 | input.buttonpaymentcheque { |
| 380 | - background-image: url(<?php echo dol_buildpath($path.'/paypal/img/object_paypal.png',1) ?>); |
|
| 380 | + background-image: url(<?php echo dol_buildpath($path.'/paypal/img/object_paypal.png', 1) ?>); |
|
| 381 | 381 | background-repeat: no-repeat; |
| 382 | 382 | background-position: 5px 4px; |
| 383 | 383 | } |
| 384 | 384 | input.buttonpaymentpaypal { |
| 385 | - background-image: url(<?php echo dol_buildpath($path.'/paypal/img/object_paypal.png',1) ?>); |
|
| 385 | + background-image: url(<?php echo dol_buildpath($path.'/paypal/img/object_paypal.png', 1) ?>); |
|
| 386 | 386 | background-repeat: no-repeat; |
| 387 | 387 | background-position: 8px 7px; |
| 388 | 388 | } |
| 389 | 389 | input.buttonpaymentpaybox { |
| 390 | - background-image: url(<?php echo dol_buildpath($path.'/paybox/img/object_paybox.png',1) ?>); |
|
| 390 | + background-image: url(<?php echo dol_buildpath($path.'/paybox/img/object_paybox.png', 1) ?>); |
|
| 391 | 391 | background-repeat: no-repeat; |
| 392 | 392 | background-position: 8px 7px; |
| 393 | 393 | } |
| 394 | 394 | input.buttonpaymentstripe { |
| 395 | - background-image: url(<?php echo dol_buildpath($path.'/stripe/img/object_stripe.png',1) ?>); |
|
| 395 | + background-image: url(<?php echo dol_buildpath($path.'/stripe/img/object_stripe.png', 1) ?>); |
|
| 396 | 396 | background-repeat: no-repeat; |
| 397 | 397 | background-position: 8px 7px; |
| 398 | 398 | } |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | text-align: justify; |
| 594 | 594 | } |
| 595 | 595 | .nowrap { |
| 596 | - white-space: <?php print ($dol_optimize_smallscreen?'normal':'nowrap'); ?>; |
|
| 596 | + white-space: <?php print ($dol_optimize_smallscreen ? 'normal' : 'nowrap'); ?>; |
|
| 597 | 597 | } |
| 598 | 598 | .liste_titre .nowrap { |
| 599 | 599 | white-space: nowrap; |
@@ -834,7 +834,7 @@ discard block |
||
| 834 | 834 | } |
| 835 | 835 | |
| 836 | 836 | .flexcontainer { |
| 837 | - <?php if (in_array($conf->browser->browsername, array('chrome','firefox'))) echo 'display: inline-flex;' ?> |
|
| 837 | + <?php if (in_array($conf->browser->browsername, array('chrome', 'firefox'))) echo 'display: inline-flex;' ?> |
|
| 838 | 838 | flex-flow: row wrap; |
| 839 | 839 | justify-content: flex-start; |
| 840 | 840 | } |
@@ -948,10 +948,10 @@ discard block |
||
| 948 | 948 | @media only screen and (max-width: 767px) |
| 949 | 949 | { |
| 950 | 950 | body { |
| 951 | - font-size: <?php print $fontsize+3; ?>px; |
|
| 951 | + font-size: <?php print $fontsize + 3; ?>px; |
|
| 952 | 952 | } |
| 953 | 953 | div.refidno { |
| 954 | - font-size: <?php print $fontsize+3; ?>px !important; |
|
| 954 | + font-size: <?php print $fontsize + 3; ?>px !important; |
|
| 955 | 955 | } |
| 956 | 956 | } |
| 957 | 957 | |
@@ -959,10 +959,10 @@ discard block |
||
| 959 | 959 | @media only screen and (max-width: 570px) |
| 960 | 960 | { |
| 961 | 961 | body { |
| 962 | - font-size: <?php print $fontsize+3; ?>px; |
|
| 962 | + font-size: <?php print $fontsize + 3; ?>px; |
|
| 963 | 963 | } |
| 964 | 964 | div.refidno { |
| 965 | - font-size: <?php print $fontsize+3; ?>px !important; |
|
| 965 | + font-size: <?php print $fontsize + 3; ?>px !important; |
|
| 966 | 966 | } |
| 967 | 967 | |
| 968 | 968 | .divmainbodylarge { margin-left: 20px; margin-right: 20px; } |
@@ -974,7 +974,7 @@ discard block |
||
| 974 | 974 | white-space: nowrap; |
| 975 | 975 | } |
| 976 | 976 | div.fiche { |
| 977 | - margin-top: <?php print ($dol_hide_topmenu?'12':'6'); ?>px !important; |
|
| 977 | + margin-top: <?php print ($dol_hide_topmenu ? '12' : '6'); ?>px !important; |
|
| 978 | 978 | } |
| 979 | 979 | div.titre { |
| 980 | 980 | /* margin-top: 12px; */ |
@@ -996,7 +996,7 @@ discard block |
||
| 996 | 996 | min-width: 20px; |
| 997 | 997 | min-height: 1.4em; |
| 998 | 998 | line-height: 1.4em; |
| 999 | - font-size: <?php print $fontsize+3; ?>px; |
|
| 999 | + font-size: <?php print $fontsize + 3; ?>px; |
|
| 1000 | 1000 | /* padding: .4em .1em; */ |
| 1001 | 1001 | /* border-bottom: 1px solid #BBB; */ |
| 1002 | 1002 | /* max-width: inherit; why this */ |
@@ -1024,7 +1024,7 @@ discard block |
||
| 1024 | 1024 | |
| 1025 | 1025 | #tooltip { |
| 1026 | 1026 | position: absolute; |
| 1027 | - width: <?php print dol_size(300,'width'); ?>px; |
|
| 1027 | + width: <?php print dol_size(300, 'width'); ?>px; |
|
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | 1030 | /* intput, input[type=text], */ |
@@ -1062,7 +1062,7 @@ discard block |
||
| 1062 | 1062 | } |
| 1063 | 1063 | } |
| 1064 | 1064 | .linkobject { cursor: pointer; } |
| 1065 | -<?php if (GETPOST('optioncss','aZ09') == 'print') { ?> |
|
| 1065 | +<?php if (GETPOST('optioncss', 'aZ09') == 'print') { ?> |
|
| 1066 | 1066 | .hideonprint { display: none; } |
| 1067 | 1067 | <?php } ?> |
| 1068 | 1068 | |
@@ -1109,14 +1109,14 @@ discard block |
||
| 1109 | 1109 | #id-right { /* This must stay id-right and not be replaced with echo $right */ |
| 1110 | 1110 | width: 100%; |
| 1111 | 1111 | padding-bottom: 10px; |
| 1112 | -<?php if (GETPOST('optioncss','aZ09') != 'print') { ?> |
|
| 1112 | +<?php if (GETPOST('optioncss', 'aZ09') != 'print') { ?> |
|
| 1113 | 1113 | padding-left: 229px; |
| 1114 | 1114 | padding-top: 12px; |
| 1115 | 1115 | <?php } ?> |
| 1116 | 1116 | } |
| 1117 | 1117 | |
| 1118 | 1118 | .side-nav { |
| 1119 | -<?php if (GETPOST('optioncss','aZ09') == 'print') { ?> |
|
| 1119 | +<?php if (GETPOST('optioncss', 'aZ09') == 'print') { ?> |
|
| 1120 | 1120 | display: none; |
| 1121 | 1121 | <?php } else { ?> |
| 1122 | 1122 | background: rgb(<?php echo $colorbackvmenu1; ?>); |
@@ -1127,7 +1127,7 @@ discard block |
||
| 1127 | 1127 | display: block; |
| 1128 | 1128 | font-family: "RobotoDraft","Roboto",sans-serif; |
| 1129 | 1129 | left: 0; |
| 1130 | -<?php if (in_array($conf->browser->layout, array('phone','tablet')) && ((GETPOST('testmenuhider') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> |
|
| 1130 | +<?php if (in_array($conf->browser->layout, array('phone', 'tablet')) && ((GETPOST('testmenuhider') || !empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> |
|
| 1131 | 1131 | <?php } else { ?> |
| 1132 | 1132 | position: fixed; |
| 1133 | 1133 | top: 50px; |
@@ -1156,7 +1156,7 @@ discard block |
||
| 1156 | 1156 | -moz-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); |
| 1157 | 1157 | transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); |
| 1158 | 1158 | -webkit-overflow-scrolling: touch; |
| 1159 | -<?php if (in_array($conf->browser->layout, array('phone','tablet')) && ((GETPOST('testmenuhider') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> |
|
| 1159 | +<?php if (in_array($conf->browser->layout, array('phone', 'tablet')) && ((GETPOST('testmenuhider') || !empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> |
|
| 1160 | 1160 | <?php } else { ?> |
| 1161 | 1161 | overflow-x: hidden; |
| 1162 | 1162 | overflow-y: auto; |
@@ -1168,7 +1168,7 @@ discard block |
||
| 1168 | 1168 | } |
| 1169 | 1169 | |
| 1170 | 1170 | /* For smartphone (testmenuhider is on) */ |
| 1171 | -<?php if (in_array($conf->browser->layout, array('phone','tablet')) && ((GETPOST('testmenuhider') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> |
|
| 1171 | +<?php if (in_array($conf->browser->layout, array('phone', 'tablet')) && ((GETPOST('testmenuhider') || !empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> |
|
| 1172 | 1172 | #id-container { |
| 1173 | 1173 | width: 100%; |
| 1174 | 1174 | } |
@@ -1180,7 +1180,7 @@ discard block |
||
| 1180 | 1180 | top: inherit !important; |
| 1181 | 1181 | } |
| 1182 | 1182 | .side-nav { |
| 1183 | -<?php if (in_array($conf->browser->layout, array('phone','tablet')) && ((GETPOST('testmenuhider') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> |
|
| 1183 | +<?php if (in_array($conf->browser->layout, array('phone', 'tablet')) && ((GETPOST('testmenuhider') || !empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> |
|
| 1184 | 1184 | <?php } else { ?> |
| 1185 | 1185 | overflow-x: initial !important; |
| 1186 | 1186 | overflow-y: scroll; |
@@ -1208,7 +1208,7 @@ discard block |
||
| 1208 | 1208 | z-index: 91; |
| 1209 | 1209 | background: rgb(<?php echo $colorbackvmenu1; ?>); |
| 1210 | 1210 | border-right: 1px solid rgba(0,0,0,0.3); |
| 1211 | -<?php if (in_array($conf->browser->layout, array('phone','tablet')) && ((GETPOST('testmenuhider') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> |
|
| 1211 | +<?php if (in_array($conf->browser->layout, array('phone', 'tablet')) && ((GETPOST('testmenuhider') || !empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> |
|
| 1212 | 1212 | top: 50px ! important; |
| 1213 | 1213 | <?php } else { ?> |
| 1214 | 1214 | top: 60px ! important; |
@@ -1221,9 +1221,9 @@ discard block |
||
| 1221 | 1221 | <?php } ?> |
| 1222 | 1222 | |
| 1223 | 1223 | div.fiche { |
| 1224 | - margin-<?php print $left; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?6:(empty($conf->dol_optimize_smallscreen)?'24':'6')); ?>px; |
|
| 1225 | - margin-<?php print $right; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?6:(empty($conf->dol_optimize_smallscreen)?'22':'6')); ?>px; |
|
| 1226 | - <?php if (! empty($conf->dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'; ?> |
|
| 1224 | + margin-<?php print $left; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print' ? 6 : (empty($conf->dol_optimize_smallscreen) ? '24' : '6')); ?>px; |
|
| 1225 | + margin-<?php print $right; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print' ? 6 : (empty($conf->dol_optimize_smallscreen) ? '22' : '6')); ?>px; |
|
| 1226 | + <?php if (!empty($conf->dol_hide_leftmenu) && !empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'; ?> |
|
| 1227 | 1227 | margin-bottom: 15px; |
| 1228 | 1228 | } |
| 1229 | 1229 | body.onlinepaymentbody div.fiche { /* For online payment page */ |
@@ -1237,25 +1237,25 @@ discard block |
||
| 1237 | 1237 | margin-top: 8px; |
| 1238 | 1238 | } |
| 1239 | 1239 | div.fichethirdleft { |
| 1240 | - <?php if ($conf->browser->layout != 'phone') { print "float: ".$left.";\n"; } ?> |
|
| 1241 | - <?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?> |
|
| 1240 | + <?php if ($conf->browser->layout != 'phone') { print "float: ".$left.";\n"; } ?> |
|
| 1241 | + <?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?> |
|
| 1242 | 1242 | <?php if ($conf->browser->layout == 'phone') { print "padding-bottom: 6px;\n"; } ?> |
| 1243 | 1243 | } |
| 1244 | 1244 | div.fichetwothirdright { |
| 1245 | - <?php if ($conf->browser->layout != 'phone') { print "float: ".$right.";\n"; } ?> |
|
| 1246 | - <?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?> |
|
| 1245 | + <?php if ($conf->browser->layout != 'phone') { print "float: ".$right.";\n"; } ?> |
|
| 1246 | + <?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?> |
|
| 1247 | 1247 | <?php if ($conf->browser->layout == 'phone') { print "padding-bottom: 6px\n"; } ?> |
| 1248 | 1248 | } |
| 1249 | 1249 | div.fichehalfleft { |
| 1250 | - <?php if ($conf->browser->layout != 'phone') { print "float: ".$left.";\n"; } ?> |
|
| 1251 | - <?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?> |
|
| 1250 | + <?php if ($conf->browser->layout != 'phone') { print "float: ".$left.";\n"; } ?> |
|
| 1251 | + <?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?> |
|
| 1252 | 1252 | } |
| 1253 | 1253 | div.fichehalfright { |
| 1254 | - <?php if ($conf->browser->layout != 'phone') { print "float: ".$right.";\n"; } ?> |
|
| 1255 | - <?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?> |
|
| 1254 | + <?php if ($conf->browser->layout != 'phone') { print "float: ".$right.";\n"; } ?> |
|
| 1255 | + <?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?> |
|
| 1256 | 1256 | } |
| 1257 | 1257 | div.ficheaddleft { |
| 1258 | - <?php if ($conf->browser->layout != 'phone') { print "padding-".$left.": 16px;\n"; } |
|
| 1258 | + <?php if ($conf->browser->layout != 'phone') { print "padding-".$left.": 16px;\n"; } |
|
| 1259 | 1259 | else print "margin-top: 10px;\n"; ?> |
| 1260 | 1260 | } |
| 1261 | 1261 | div.firstcolumn div.box { |
@@ -1268,9 +1268,9 @@ discard block |
||
| 1268 | 1268 | @media only screen and (max-width: 900px) |
| 1269 | 1269 | { |
| 1270 | 1270 | div.fiche { |
| 1271 | - margin-<?php print $left; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?6:($dol_hide_leftmenu?'4':'20')); ?>px; |
|
| 1272 | - margin-<?php print $right; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?8:16); ?>px; |
|
| 1273 | - <?php if (! empty($conf->dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'; ?> |
|
| 1271 | + margin-<?php print $left; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print' ? 6 : ($dol_hide_leftmenu ? '4' : '20')); ?>px; |
|
| 1272 | + margin-<?php print $right; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print' ? 8 : 16); ?>px; |
|
| 1273 | + <?php if (!empty($conf->dol_hide_leftmenu) && !empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'; ?> |
|
| 1274 | 1274 | margin-bottom: 15px; |
| 1275 | 1275 | } |
| 1276 | 1276 | div.fichecenter { |
@@ -1448,16 +1448,16 @@ discard block |
||
| 1448 | 1448 | /* ============================================================================== */ |
| 1449 | 1449 | |
| 1450 | 1450 | <?php |
| 1451 | -$minwidthtmenu=66; /* minimum width for one top menu entry */ |
|
| 1452 | -$heightmenu=48; /* height of top menu, part with image */ |
|
| 1453 | -$heightmenu2=48; /* height of top menu, ârt with login */ |
|
| 1451 | +$minwidthtmenu = 66; /* minimum width for one top menu entry */ |
|
| 1452 | +$heightmenu = 48; /* height of top menu, part with image */ |
|
| 1453 | +$heightmenu2 = 48; /* height of top menu, ârt with login */ |
|
| 1454 | 1454 | $disableimages = 0; |
| 1455 | 1455 | $maxwidthloginblock = 110; |
| 1456 | -if (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $heightmenu = 30; $disableimages = 1; $maxwidthloginblock = 180; $minwidthtmenu=0; } |
|
| 1456 | +if (!empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $heightmenu = 30; $disableimages = 1; $maxwidthloginblock = 180; $minwidthtmenu = 0; } |
|
| 1457 | 1457 | ?> |
| 1458 | 1458 | |
| 1459 | 1459 | div#tmenu_tooltip { |
| 1460 | -<?php if (GETPOST('optioncss','aZ09') == 'print') { ?> |
|
| 1460 | +<?php if (GETPOST('optioncss', 'aZ09') == 'print') { ?> |
|
| 1461 | 1461 | display:none; |
| 1462 | 1462 | <?php } else { ?> |
| 1463 | 1463 | background: rgb(<?php echo $colorbackhmenu1 ?>); |
@@ -1473,7 +1473,7 @@ discard block |
||
| 1473 | 1473 | } |
| 1474 | 1474 | |
| 1475 | 1475 | div#tmenu_tooltip { |
| 1476 | -<?php if (GETPOST('optioncss','aZ09') == 'print') { ?> |
|
| 1476 | +<?php if (GETPOST('optioncss', 'aZ09') == 'print') { ?> |
|
| 1477 | 1477 | display:none; |
| 1478 | 1478 | <?php } else { ?> |
| 1479 | 1479 | /* padding-<?php echo $right; ?>: <?php echo ($maxwidthloginblock - 10); ?>px; */ |
@@ -1487,7 +1487,7 @@ discard block |
||
| 1487 | 1487 | } |
| 1488 | 1488 | |
| 1489 | 1489 | div.tmenudiv { |
| 1490 | -<?php if (GETPOST('optioncss','aZ09') == 'print') { ?> |
|
| 1490 | +<?php if (GETPOST('optioncss', 'aZ09') == 'print') { ?> |
|
| 1491 | 1491 | display:none; |
| 1492 | 1492 | <?php } else { ?> |
| 1493 | 1493 | position: relative; |
@@ -1552,12 +1552,12 @@ discard block |
||
| 1552 | 1552 | */ |
| 1553 | 1553 | } |
| 1554 | 1554 | li.tmenu, li.tmenusel { |
| 1555 | - <?php print $minwidthtmenu?'min-width: '.$minwidthtmenu.'px;':''; ?> |
|
| 1555 | + <?php print $minwidthtmenu ? 'min-width: '.$minwidthtmenu.'px;' : ''; ?> |
|
| 1556 | 1556 | text-align: center; |
| 1557 | 1557 | vertical-align: bottom; |
| 1558 | 1558 | <?php if (empty($conf->global->MAIN_MENU_INVERT)) { ?> |
| 1559 | 1559 | float: <?php print $left; ?>; |
| 1560 | - <?php if (! $disableimages) { ?> |
|
| 1560 | + <?php if (!$disableimages) { ?> |
|
| 1561 | 1561 | height: <?php print $heightmenu; ?>px; |
| 1562 | 1562 | padding: 0px 0px 2px 0px; |
| 1563 | 1563 | <?php } else { ?> |
@@ -1577,7 +1577,7 @@ discard block |
||
| 1577 | 1577 | background-image: linear-gradient(bottom, rgba(250,250,250,0.3) 0%, rgba(0,0,0,0.3) 100%) !important; |
| 1578 | 1578 | background: rgb(<?php echo $colorbackhmenu1 ?>); |
| 1579 | 1579 | */ |
| 1580 | - /* background: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/nav-overlay3.png',1); ?>) 50% 0 repeat-x !important; Nicer but problem when menu wrap on 2 lines */ |
|
| 1580 | + /* background: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/nav-overlay3.png', 1); ?>) 50% 0 repeat-x !important; Nicer but problem when menu wrap on 2 lines */ |
|
| 1581 | 1581 | } |
| 1582 | 1582 | li.tmenusel, li.tmenu:hover { |
| 1583 | 1583 | opacity: .50; /* show only a slight shadow */ |
@@ -1591,10 +1591,10 @@ discard block |
||
| 1591 | 1591 | margin-top: 0px; |
| 1592 | 1592 | <?php if (empty($conf->dol_optimize_smallscreen)) { ?> |
| 1593 | 1593 | width: 5px; |
| 1594 | - <?php if (! $disableimages) { ?> |
|
| 1595 | - height: <?php print $heightmenu+4; ?>px; |
|
| 1594 | + <?php if (!$disableimages) { ?> |
|
| 1595 | + height: <?php print $heightmenu + 4; ?>px; |
|
| 1596 | 1596 | <?php } ?> |
| 1597 | - /* background: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menutab-r.png',1); ?>) 0 -6px no-repeat; */ |
|
| 1597 | + /* background: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menutab-r.png', 1); ?>) 0 -6px no-repeat; */ |
|
| 1598 | 1598 | <?php } ?> |
| 1599 | 1599 | } |
| 1600 | 1600 | div.tmenucenter |
@@ -1625,7 +1625,7 @@ discard block |
||
| 1625 | 1625 | position : relative; |
| 1626 | 1626 | background-repeat:no-repeat; |
| 1627 | 1627 | background-position:center top; |
| 1628 | - height: <?php echo ($heightmenu-19); ?>px; |
|
| 1628 | + height: <?php echo ($heightmenu - 19); ?>px; |
|
| 1629 | 1629 | margin-left: 0px; |
| 1630 | 1630 | min-width: 40px; |
| 1631 | 1631 | } |
@@ -1634,128 +1634,128 @@ discard block |
||
| 1634 | 1634 | <?php if (empty($dol_hide_topmenu)) { ?> |
| 1635 | 1635 | |
| 1636 | 1636 | div.mainmenu.home{ |
| 1637 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/home.png',1) ?>); |
|
| 1637 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/home.png', 1) ?>); |
|
| 1638 | 1638 | background-position-x: center; |
| 1639 | 1639 | } |
| 1640 | 1640 | |
| 1641 | 1641 | div.mainmenu.billing { |
| 1642 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/money.png',1) ?>); |
|
| 1642 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/money.png', 1) ?>); |
|
| 1643 | 1643 | } |
| 1644 | 1644 | |
| 1645 | 1645 | div.mainmenu.accountancy { |
| 1646 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/money.png',1) ?>); |
|
| 1646 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/money.png', 1) ?>); |
|
| 1647 | 1647 | } |
| 1648 | 1648 | |
| 1649 | 1649 | div.mainmenu.agenda { |
| 1650 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/agenda.png',1) ?>); |
|
| 1650 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/agenda.png', 1) ?>); |
|
| 1651 | 1651 | } |
| 1652 | 1652 | |
| 1653 | 1653 | div.mainmenu.bank { |
| 1654 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/bank.png',1) ?>); |
|
| 1654 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/bank.png', 1) ?>); |
|
| 1655 | 1655 | } |
| 1656 | 1656 | |
| 1657 | 1657 | div.mainmenu.cashdesk { |
| 1658 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/pointofsale.png',1) ?>); |
|
| 1658 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/pointofsale.png', 1) ?>); |
|
| 1659 | 1659 | } |
| 1660 | 1660 | |
| 1661 | 1661 | div.mainmenu.companies { |
| 1662 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/company.png',1) ?>); |
|
| 1662 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/company.png', 1) ?>); |
|
| 1663 | 1663 | } |
| 1664 | 1664 | |
| 1665 | 1665 | div.mainmenu.commercial { |
| 1666 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/commercial.png',1) ?>); |
|
| 1666 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/commercial.png', 1) ?>); |
|
| 1667 | 1667 | } |
| 1668 | 1668 | |
| 1669 | 1669 | div.mainmenu.ecm { |
| 1670 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/ecm.png',1) ?>); |
|
| 1670 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/ecm.png', 1) ?>); |
|
| 1671 | 1671 | } |
| 1672 | 1672 | |
| 1673 | 1673 | div.mainmenu.externalsite { |
| 1674 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/externalsite.png',1) ?>); |
|
| 1674 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/externalsite.png', 1) ?>); |
|
| 1675 | 1675 | } |
| 1676 | 1676 | |
| 1677 | 1677 | div.mainmenu.ftp { |
| 1678 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/tools.png',1) ?>); |
|
| 1678 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/tools.png', 1) ?>); |
|
| 1679 | 1679 | } |
| 1680 | 1680 | |
| 1681 | 1681 | div.mainmenu.hrm { |
| 1682 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/holiday.png',1) ?>); |
|
| 1682 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/holiday.png', 1) ?>); |
|
| 1683 | 1683 | } |
| 1684 | 1684 | |
| 1685 | 1685 | div.mainmenu.members { |
| 1686 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/members.png',1) ?>); |
|
| 1686 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/members.png', 1) ?>); |
|
| 1687 | 1687 | } |
| 1688 | 1688 | |
| 1689 | 1689 | div.mainmenu.menu { |
| 1690 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/menu.png',1) ?>); |
|
| 1690 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/menu.png', 1) ?>); |
|
| 1691 | 1691 | top: 7px; |
| 1692 | 1692 | } |
| 1693 | 1693 | |
| 1694 | 1694 | div.mainmenu.products { |
| 1695 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/products.png',1) ?>); |
|
| 1695 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/products.png', 1) ?>); |
|
| 1696 | 1696 | } |
| 1697 | 1697 | |
| 1698 | 1698 | div.mainmenu.project { |
| 1699 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/project.png',1) ?>); |
|
| 1699 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/project.png', 1) ?>); |
|
| 1700 | 1700 | } |
| 1701 | 1701 | |
| 1702 | 1702 | div.mainmenu.ticketsup { |
| 1703 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/ticketsup.png',1) ?>); |
|
| 1703 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/ticketsup.png', 1) ?>); |
|
| 1704 | 1704 | } |
| 1705 | 1705 | |
| 1706 | 1706 | div.mainmenu.tools { |
| 1707 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/tools.png',1) ?>); |
|
| 1707 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/tools.png', 1) ?>); |
|
| 1708 | 1708 | } |
| 1709 | 1709 | |
| 1710 | 1710 | div.mainmenu.website { |
| 1711 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/externalsite.png',1) ?>); |
|
| 1711 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/externalsite.png', 1) ?>); |
|
| 1712 | 1712 | } |
| 1713 | 1713 | |
| 1714 | 1714 | <?php |
| 1715 | 1715 | // Add here more div for other menu entries. moduletomainmenu=array('module name'=>'name of class for div') |
| 1716 | 1716 | |
| 1717 | -$moduletomainmenu=array('user'=>'','syslog'=>'','societe'=>'companies','projet'=>'project','propale'=>'commercial','commande'=>'commercial', |
|
| 1718 | - 'produit'=>'products','service'=>'products','stock'=>'products', |
|
| 1719 | - 'don'=>'accountancy','tax'=>'accountancy','banque'=>'accountancy','facture'=>'accountancy','compta'=>'accountancy','accounting'=>'accountancy','adherent'=>'members','import'=>'tools','export'=>'tools','mailing'=>'tools', |
|
| 1720 | - 'contrat'=>'commercial','ficheinter'=>'commercial','ticketsup'=>'ticketsup','deplacement'=>'commercial', |
|
| 1717 | +$moduletomainmenu = array('user'=>'', 'syslog'=>'', 'societe'=>'companies', 'projet'=>'project', 'propale'=>'commercial', 'commande'=>'commercial', |
|
| 1718 | + 'produit'=>'products', 'service'=>'products', 'stock'=>'products', |
|
| 1719 | + 'don'=>'accountancy', 'tax'=>'accountancy', 'banque'=>'accountancy', 'facture'=>'accountancy', 'compta'=>'accountancy', 'accounting'=>'accountancy', 'adherent'=>'members', 'import'=>'tools', 'export'=>'tools', 'mailing'=>'tools', |
|
| 1720 | + 'contrat'=>'commercial', 'ficheinter'=>'commercial', 'ticketsup'=>'ticketsup', 'deplacement'=>'commercial', |
|
| 1721 | 1721 | 'fournisseur'=>'companies', |
| 1722 | - 'barcode'=>'','fckeditor'=>'','categorie'=>'', |
|
| 1722 | + 'barcode'=>'', 'fckeditor'=>'', 'categorie'=>'', |
|
| 1723 | 1723 | ); |
| 1724 | -$mainmenuused='home'; |
|
| 1725 | -foreach($conf->modules as $val) |
|
| 1724 | +$mainmenuused = 'home'; |
|
| 1725 | +foreach ($conf->modules as $val) |
|
| 1726 | 1726 | { |
| 1727 | - $mainmenuused.=','.(isset($moduletomainmenu[$val])?$moduletomainmenu[$val]:$val); |
|
| 1727 | + $mainmenuused .= ','.(isset($moduletomainmenu[$val]) ? $moduletomainmenu[$val] : $val); |
|
| 1728 | 1728 | } |
| 1729 | 1729 | //var_dump($mainmenuused); |
| 1730 | -$mainmenuusedarray=array_unique(explode(',',$mainmenuused)); |
|
| 1730 | +$mainmenuusedarray = array_unique(explode(',', $mainmenuused)); |
|
| 1731 | 1731 | |
| 1732 | -$generic=1; |
|
| 1732 | +$generic = 1; |
|
| 1733 | 1733 | // Put here list of menu entries when the div.mainmenu.menuentry was previously defined |
| 1734 | -$divalreadydefined=array('home','companies','products','commercial','externalsite','accountancy','project','tools','members','agenda','ftp','holiday','hrm','bookmark','cashdesk','ecm','geoipmaxmind','gravatar','clicktodial','paypal','stripe','webservices','website'); |
|
| 1734 | +$divalreadydefined = array('home', 'companies', 'products', 'commercial', 'externalsite', 'accountancy', 'project', 'tools', 'members', 'agenda', 'ftp', 'holiday', 'hrm', 'bookmark', 'cashdesk', 'ecm', 'geoipmaxmind', 'gravatar', 'clicktodial', 'paypal', 'stripe', 'webservices', 'website'); |
|
| 1735 | 1735 | // Put here list of menu entries we are sure we don't want |
| 1736 | -$divnotrequired=array('multicurrency','salaries','ticketsup','margin','opensurvey','paybox','expensereport','incoterm','prelevement','propal','workflow','notification','supplier_proposal','cron','product','productbatch','expedition'); |
|
| 1737 | -foreach($mainmenuusedarray as $val) |
|
| 1736 | +$divnotrequired = array('multicurrency', 'salaries', 'ticketsup', 'margin', 'opensurvey', 'paybox', 'expensereport', 'incoterm', 'prelevement', 'propal', 'workflow', 'notification', 'supplier_proposal', 'cron', 'product', 'productbatch', 'expedition'); |
|
| 1737 | +foreach ($mainmenuusedarray as $val) |
|
| 1738 | 1738 | { |
| 1739 | - if (empty($val) || in_array($val,$divalreadydefined)) continue; |
|
| 1740 | - if (in_array($val,$divnotrequired)) continue; |
|
| 1739 | + if (empty($val) || in_array($val, $divalreadydefined)) continue; |
|
| 1740 | + if (in_array($val, $divnotrequired)) continue; |
|
| 1741 | 1741 | //print "XXX".$val; |
| 1742 | 1742 | |
| 1743 | 1743 | // Search img file in module dir |
| 1744 | - $found=0; $url=''; |
|
| 1745 | - foreach($conf->file->dol_document_root as $dirroot) |
|
| 1744 | + $found = 0; $url = ''; |
|
| 1745 | + foreach ($conf->file->dol_document_root as $dirroot) |
|
| 1746 | 1746 | { |
| 1747 | 1747 | if (file_exists($dirroot."/".$val."/img/".$val.".png")) |
| 1748 | 1748 | { |
| 1749 | - $url=dol_buildpath('/'.$val.'/img/'.$val.'.png', 1); |
|
| 1750 | - $found=1; |
|
| 1749 | + $url = dol_buildpath('/'.$val.'/img/'.$val.'.png', 1); |
|
| 1750 | + $found = 1; |
|
| 1751 | 1751 | break; |
| 1752 | 1752 | } |
| 1753 | 1753 | } |
| 1754 | 1754 | // Img file not found |
| 1755 | - if (! $found) |
|
| 1755 | + if (!$found) |
|
| 1756 | 1756 | { |
| 1757 | - $url=dol_buildpath($path.'/theme/'.$theme.'/img/menus/generic'.$generic.".png",1); |
|
| 1758 | - $found=1; |
|
| 1757 | + $url = dol_buildpath($path.'/theme/'.$theme.'/img/menus/generic'.$generic.".png", 1); |
|
| 1758 | + $found = 1; |
|
| 1759 | 1759 | if ($generic < 4) $generic++; |
| 1760 | 1760 | print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n"; |
| 1761 | 1761 | } |
@@ -1895,7 +1895,7 @@ discard block |
||
| 1895 | 1895 | padding-bottom: 3px; |
| 1896 | 1896 | <?php print $left; ?>: 0; |
| 1897 | 1897 | top: 0px; |
| 1898 | -<?php if (in_array($conf->browser->layout, array('phone','tablet')) && ((GETPOST('testmenuhider') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> |
|
| 1898 | +<?php if (in_array($conf->browser->layout, array('phone', 'tablet')) && ((GETPOST('testmenuhider') || !empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> |
|
| 1899 | 1899 | position: absolute; |
| 1900 | 1900 | <?php } else { ?> |
| 1901 | 1901 | position: fixed; |
@@ -1907,7 +1907,7 @@ discard block |
||
| 1907 | 1907 | background: rgb(<?php echo $colorbackvmenu1; ?>); |
| 1908 | 1908 | width: 228px; |
| 1909 | 1909 | height: 43px; |
| 1910 | - <?php if (GETPOST('optioncss','aZ09') == 'print') { ?> |
|
| 1910 | + <?php if (GETPOST('optioncss', 'aZ09') == 'print') { ?> |
|
| 1911 | 1911 | display: none; |
| 1912 | 1912 | <?php } ?> |
| 1913 | 1913 | } |
@@ -1983,11 +1983,11 @@ discard block |
||
| 1983 | 1983 | vertical-align: middle; |
| 1984 | 1984 | } |
| 1985 | 1985 | .span-icon-user { |
| 1986 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/object_user.png',1); ?>); |
|
| 1986 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/object_user.png', 1); ?>); |
|
| 1987 | 1987 | background-repeat: no-repeat; |
| 1988 | 1988 | } |
| 1989 | 1989 | .span-icon-password { |
| 1990 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/lock.png',1); ?>); |
|
| 1990 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/lock.png', 1); ?>); |
|
| 1991 | 1991 | background-repeat: no-repeat; |
| 1992 | 1992 | } |
| 1993 | 1993 | |
@@ -2007,7 +2007,7 @@ discard block |
||
| 2007 | 2007 | |
| 2008 | 2008 | .vmenu { |
| 2009 | 2009 | margin-left: 4px; |
| 2010 | - <?php if (GETPOST('optioncss','aZ09') == 'print') { ?> |
|
| 2010 | + <?php if (GETPOST('optioncss', 'aZ09') == 'print') { ?> |
|
| 2011 | 2011 | display: none; |
| 2012 | 2012 | <?php } ?> |
| 2013 | 2013 | } |
@@ -2295,7 +2295,7 @@ discard block |
||
| 2295 | 2295 | a.tab:hover |
| 2296 | 2296 | { |
| 2297 | 2297 | /* |
| 2298 | - background: rgba(<?php echo $colorbacktabcard1; ?>, 0.5) url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/nav-overlay3.png',1); ?>) 50% 0 repeat-x; |
|
| 2298 | + background: rgba(<?php echo $colorbacktabcard1; ?>, 0.5) url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/nav-overlay3.png', 1); ?>) 50% 0 repeat-x; |
|
| 2299 | 2299 | color: #<?php echo $colortextbacktab; ?>; |
| 2300 | 2300 | */ |
| 2301 | 2301 | text-decoration: underline; |
@@ -2348,8 +2348,8 @@ discard block |
||
| 2348 | 2348 | border-color: #c5c5c5; |
| 2349 | 2349 | border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); |
| 2350 | 2350 | display: inline-block; |
| 2351 | - padding: 0.4em <?php echo ($dol_optimize_smallscreen?'0.4':'0.7'); ?>em; |
|
| 2352 | - margin: 0em <?php echo ($dol_optimize_smallscreen?'0.7':'0.9'); ?>em; |
|
| 2351 | + padding: 0.4em <?php echo ($dol_optimize_smallscreen ? '0.4' : '0.7'); ?>em; |
|
| 2352 | + margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.7' : '0.9'); ?>em; |
|
| 2353 | 2353 | line-height: 20px; |
| 2354 | 2354 | text-align: center; |
| 2355 | 2355 | vertical-align: middle; |
@@ -2436,7 +2436,7 @@ discard block |
||
| 2436 | 2436 | background-color: transparent ! important; |
| 2437 | 2437 | } |
| 2438 | 2438 | |
| 2439 | -<?php if (! empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) { ?> |
|
| 2439 | +<?php if (!empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) { ?> |
|
| 2440 | 2440 | .butActionRefused { |
| 2441 | 2441 | display: none; |
| 2442 | 2442 | } |
@@ -2454,7 +2454,7 @@ discard block |
||
| 2454 | 2454 | |
| 2455 | 2455 | #undertopmenu { |
| 2456 | 2456 | background-repeat: repeat-x; |
| 2457 | - margin-top: <?php echo ($dol_hide_topmenu?'6':'0'); ?>px; |
|
| 2457 | + margin-top: <?php echo ($dol_hide_topmenu ? '6' : '0'); ?>px; |
|
| 2458 | 2458 | } |
| 2459 | 2459 | |
| 2460 | 2460 | |
@@ -2942,7 +2942,7 @@ discard block |
||
| 2942 | 2942 | div.liste_titre_bydiv, .liste_titre div.tagtr, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable thead tr |
| 2943 | 2943 | { |
| 2944 | 2944 | background: rgb(<?php echo $colorbacktitle1; ?>); |
| 2945 | - font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>; |
|
| 2945 | + font-weight: <?php echo $useboldtitle ? 'bold' : 'normal'; ?>; |
|
| 2946 | 2946 | border-bottom: 1px solid #FDFFFF; |
| 2947 | 2947 | |
| 2948 | 2948 | color: rgb(<?php echo $colortexttitle; ?>); |
@@ -2960,7 +2960,7 @@ discard block |
||
| 2960 | 2960 | tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste_titre div, div.liste_titre |
| 2961 | 2961 | { |
| 2962 | 2962 | font-family: <?php print $fontlist ?>; |
| 2963 | - font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>; |
|
| 2963 | + font-weight: <?php echo $useboldtitle ? 'bold' : 'normal'; ?>; |
|
| 2964 | 2964 | vertical-align: middle; |
| 2965 | 2965 | height: 24px; |
| 2966 | 2966 | } |
@@ -3235,7 +3235,7 @@ discard block |
||
| 3235 | 3235 | background-repeat: repeat-x; |
| 3236 | 3236 | color: rgb(<?php echo $colortexttitle; ?>); |
| 3237 | 3237 | font-family: <?php print $fontlist ?>, sans-serif; |
| 3238 | - font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>; |
|
| 3238 | + font-weight: <?php echo $useboldtitle ? 'bold' : 'normal'; ?>; |
|
| 3239 | 3239 | border-bottom: 1px solid #FDFFFF; |
| 3240 | 3240 | white-space: nowrap; |
| 3241 | 3241 | } |
@@ -3398,12 +3398,12 @@ discard block |
||
| 3398 | 3398 | |
| 3399 | 3399 | .logo_setup |
| 3400 | 3400 | { |
| 3401 | - content:url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/logo_setup.svg',1) ?>); /* content is used to best fit the container */ |
|
| 3401 | + content:url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/logo_setup.svg', 1) ?>); /* content is used to best fit the container */ |
|
| 3402 | 3402 | display: inline-block; |
| 3403 | 3403 | } |
| 3404 | 3404 | .nographyet |
| 3405 | 3405 | { |
| 3406 | - content:url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/nographyet.svg',1) ?>); |
|
| 3406 | + content:url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/nographyet.svg', 1) ?>); |
|
| 3407 | 3407 | display: inline-block; |
| 3408 | 3408 | opacity: 0.1; |
| 3409 | 3409 | background-repeat: no-repeat; |
@@ -3422,7 +3422,7 @@ discard block |
||
| 3422 | 3422 | padding-top: 5px; |
| 3423 | 3423 | padding-bottom: 5px; |
| 3424 | 3424 | /* text-shadow: 1px 1px 2px #FFFFFF; */ |
| 3425 | - <?php print (empty($conf->dol_optimize_smallscreen)?'':'margin-top: 4px;'); ?> |
|
| 3425 | + <?php print (empty($conf->dol_optimize_smallscreen) ? '' : 'margin-top: 4px;'); ?> |
|
| 3426 | 3426 | } |
| 3427 | 3427 | |
| 3428 | 3428 | #dolpaymenttable { min-width: 300px; font-size: 16px; } /* Width must have min to make stripe input area visible */ |
@@ -3528,11 +3528,11 @@ discard block |
||
| 3528 | 3528 | } |
| 3529 | 3529 | |
| 3530 | 3530 | div.ui-tooltip { |
| 3531 | - max-width: <?php print dol_size(600,'width'); ?>px !important; |
|
| 3531 | + max-width: <?php print dol_size(600, 'width'); ?>px !important; |
|
| 3532 | 3532 | } |
| 3533 | 3533 | |
| 3534 | 3534 | .mytooltip { |
| 3535 | - width: <?php print dol_size(450,'width'); ?>px; |
|
| 3535 | + width: <?php print dol_size(450, 'width'); ?>px; |
|
| 3536 | 3536 | border-top: solid 1px #BBBBBB; |
| 3537 | 3537 | border-<?php print $left; ?>: solid 1px #BBBBBB; |
| 3538 | 3538 | border-<?php print $right; ?>: solid 1px #444444; |
@@ -3777,7 +3777,7 @@ discard block |
||
| 3777 | 3777 | |
| 3778 | 3778 | .ui-widget-content { border: solid 1px rgba(0,0,0,.3); background: #fff !important; } |
| 3779 | 3779 | |
| 3780 | -.ui-autocomplete-loading { background: white url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/working.gif',1) ?>) right center no-repeat; } |
|
| 3780 | +.ui-autocomplete-loading { background: white url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/working.gif', 1) ?>) right center no-repeat; } |
|
| 3781 | 3781 | .ui-autocomplete { |
| 3782 | 3782 | position:absolute; |
| 3783 | 3783 | width:auto; |
@@ -3818,14 +3818,14 @@ discard block |
||
| 3818 | 3818 | /* ============================================================================== */ |
| 3819 | 3819 | |
| 3820 | 3820 | .editkey_textarea, .editkey_ckeditor, .editkey_string, .editkey_email, .editkey_numeric, .editkey_select, .editkey_autocomplete { |
| 3821 | - background: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/edit.png',1) ?>) right top no-repeat; |
|
| 3821 | + background: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/edit.png', 1) ?>) right top no-repeat; |
|
| 3822 | 3822 | cursor: pointer; |
| 3823 | 3823 | margin-right: 3px; |
| 3824 | 3824 | margin-top: 3px; |
| 3825 | 3825 | } |
| 3826 | 3826 | |
| 3827 | 3827 | .editkey_datepicker { |
| 3828 | - background: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/calendar.png',1) ?>) right center no-repeat; |
|
| 3828 | + background: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/calendar.png', 1) ?>) right center no-repeat; |
|
| 3829 | 3829 | cursor: pointer; |
| 3830 | 3830 | margin-right: 3px; |
| 3831 | 3831 | margin-top: 3px; |
@@ -4003,7 +4003,7 @@ discard block |
||
| 4003 | 4003 | font-family:<?php echo $fontlist; ?>; |
| 4004 | 4004 | font-size:<?php echo $fontsize; ?>px; |
| 4005 | 4005 | } |
| 4006 | -.ui-button { margin-left: -2px; <?php print (preg_match('/chrome/',$conf->browser->name)?'padding-top: 1px;':''); ?> } |
|
| 4006 | +.ui-button { margin-left: -2px; <?php print (preg_match('/chrome/', $conf->browser->name) ? 'padding-top: 1px;' : ''); ?> } |
|
| 4007 | 4007 | .ui-button-icon-only .ui-button-text { height: 8px; } |
| 4008 | 4008 | .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: 2px 0px 6px 0px; } |
| 4009 | 4009 | .ui-button-text |
@@ -4132,7 +4132,7 @@ discard block |
||
| 4132 | 4132 | /* ============================================================================== */ |
| 4133 | 4133 | |
| 4134 | 4134 | div.scroll2 { |
| 4135 | - width: <?php print isset($_SESSION['dol_screenwidth'])?max($_SESSION['dol_screenwidth']-830,450):'450'; ?>px !important; |
|
| 4135 | + width: <?php print isset($_SESSION['dol_screenwidth']) ?max($_SESSION['dol_screenwidth'] - 830, 450) : '450'; ?>px !important; |
|
| 4136 | 4136 | } |
| 4137 | 4137 | |
| 4138 | 4138 | .gtaskname div, .gtaskname { |
@@ -4273,9 +4273,9 @@ discard block |
||
| 4273 | 4273 | float: right; |
| 4274 | 4274 | } |
| 4275 | 4275 | |
| 4276 | -.ecmjqft LI.directory { font-weight:normal; background: url(<?php echo dol_buildpath($path.'/theme/common/treemenu/folder2.png',1); ?>) left top no-repeat; } |
|
| 4277 | -.ecmjqft LI.expanded { font-weight:normal; background: url(<?php echo dol_buildpath($path.'/theme/common/treemenu/folder2-expanded.png',1); ?>) left top no-repeat; } |
|
| 4278 | -.ecmjqft LI.wait { font-weight:normal; background: url(<?php echo dol_buildpath('/theme/'.$theme.'/img/working.gif',1); ?>) left top no-repeat; } |
|
| 4276 | +.ecmjqft LI.directory { font-weight:normal; background: url(<?php echo dol_buildpath($path.'/theme/common/treemenu/folder2.png', 1); ?>) left top no-repeat; } |
|
| 4277 | +.ecmjqft LI.expanded { font-weight:normal; background: url(<?php echo dol_buildpath($path.'/theme/common/treemenu/folder2-expanded.png', 1); ?>) left top no-repeat; } |
|
| 4278 | +.ecmjqft LI.wait { font-weight:normal; background: url(<?php echo dol_buildpath('/theme/'.$theme.'/img/working.gif', 1); ?>) left top no-repeat; } |
|
| 4279 | 4279 | |
| 4280 | 4280 | |
| 4281 | 4281 | /* ============================================================================== */ |
@@ -4284,12 +4284,12 @@ discard block |
||
| 4284 | 4284 | |
| 4285 | 4285 | .jnotify-container { |
| 4286 | 4286 | position: fixed !important; |
| 4287 | -<?php if (! empty($conf->global->MAIN_JQUERY_JNOTIFY_BOTTOM)) { ?> |
|
| 4287 | +<?php if (!empty($conf->global->MAIN_JQUERY_JNOTIFY_BOTTOM)) { ?> |
|
| 4288 | 4288 | top: auto !important; |
| 4289 | 4289 | bottom: 4px !important; |
| 4290 | 4290 | <?php } ?> |
| 4291 | 4291 | text-align: center; |
| 4292 | - min-width: <?php echo $dol_optimize_smallscreen?'200':'480'; ?>px; |
|
| 4292 | + min-width: <?php echo $dol_optimize_smallscreen ? '200' : '480'; ?>px; |
|
| 4293 | 4293 | width: auto; |
| 4294 | 4294 | max-width: 1024px; |
| 4295 | 4295 | padding-left: 10px !important; |
@@ -4342,10 +4342,10 @@ discard block |
||
| 4342 | 4342 | table.dataTable tr.odd td.sorting_1, table.dataTable tr.even td.sorting_1 { |
| 4343 | 4343 | background: none !important; |
| 4344 | 4344 | } |
| 4345 | -.sorting_asc { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_asc.png',1); ?>') no-repeat center right !important; } |
|
| 4346 | -.sorting_desc { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_desc.png',1); ?>') no-repeat center right !important; } |
|
| 4347 | -.sorting_asc_disabled { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_asc_disabled.png',1); ?>') no-repeat center right !important; } |
|
| 4348 | -.sorting_desc_disabled { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_desc_disabled.png',1); ?>') no-repeat center right !important; } |
|
| 4345 | +.sorting_asc { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_asc.png', 1); ?>') no-repeat center right !important; } |
|
| 4346 | +.sorting_desc { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_desc.png', 1); ?>') no-repeat center right !important; } |
|
| 4347 | +.sorting_asc_disabled { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_asc_disabled.png', 1); ?>') no-repeat center right !important; } |
|
| 4348 | +.sorting_desc_disabled { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_desc_disabled.png', 1); ?>') no-repeat center right !important; } |
|
| 4349 | 4349 | .dataTables_paginate { |
| 4350 | 4350 | margin-top: 8px; |
| 4351 | 4351 | } |
@@ -5002,12 +5002,12 @@ discard block |
||
| 5002 | 5002 | /* ============================================================================== */ |
| 5003 | 5003 | |
| 5004 | 5004 | .menu_choix1 a { |
| 5005 | - background: url('<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/money.png',1) ?>') top left no-repeat; |
|
| 5005 | + background: url('<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/money.png', 1) ?>') top left no-repeat; |
|
| 5006 | 5006 | background-position-y: 15px; |
| 5007 | 5007 | } |
| 5008 | 5008 | |
| 5009 | 5009 | .menu_choix2 a { |
| 5010 | - background: url('<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/home.png',1) ?>') top left no-repeat; |
|
| 5010 | + background: url('<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/home.png', 1) ?>') top left no-repeat; |
|
| 5011 | 5011 | background-position-y: 15px; |
| 5012 | 5012 | } |
| 5013 | 5013 | .menu_choix1,.menu_choix2 { |
@@ -5100,7 +5100,7 @@ discard block |
||
| 5100 | 5100 | |
| 5101 | 5101 | #tooltip { |
| 5102 | 5102 | position: absolute; |
| 5103 | - width: <?php print dol_size(350,'width'); ?>px; |
|
| 5103 | + width: <?php print dol_size(350, 'width'); ?>px; |
|
| 5104 | 5104 | } |
| 5105 | 5105 | |
| 5106 | 5106 | div.tabBar { |
@@ -5175,7 +5175,7 @@ discard block |
||
| 5175 | 5175 | @media only screen and (max-width: 570px) |
| 5176 | 5176 | { |
| 5177 | 5177 | div#tmenu_tooltip { |
| 5178 | - <?php if (GETPOST('optioncss','aZ09') == 'print') { ?> |
|
| 5178 | + <?php if (GETPOST('optioncss', 'aZ09') == 'print') { ?> |
|
| 5179 | 5179 | display:none; |
| 5180 | 5180 | <?php } else { ?> |
| 5181 | 5181 | /* padding-<?php echo $right; ?>: 78px; */ |
@@ -5198,7 +5198,7 @@ discard block |
||
| 5198 | 5198 | |
| 5199 | 5199 | #tooltip { |
| 5200 | 5200 | position: absolute; |
| 5201 | - width: <?php print dol_size(300,'width'); ?>px; |
|
| 5201 | + width: <?php print dol_size(300, 'width'); ?>px; |
|
| 5202 | 5202 | } |
| 5203 | 5203 | select { |
| 5204 | 5204 | width: 98%; |
@@ -26,35 +26,35 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language |
| 28 | 28 | //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url. |
| 29 | -if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); |
|
| 29 | +if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); |
|
| 30 | 30 | //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations |
| 31 | -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); |
|
| 32 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); |
|
| 33 | -if (! defined('NOLOGIN')) define('NOLOGIN',1); // File must be accessed by logon page so without login |
|
| 31 | +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); |
|
| 32 | +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); |
|
| 33 | +if (!defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed by logon page so without login |
|
| 34 | 34 | //if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content |
| 35 | -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); |
|
| 36 | -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); |
|
| 35 | +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); |
|
| 36 | +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
| 37 | 37 | |
| 38 | 38 | // Colors |
| 39 | -$colorbackhmenu1='80,90,120'; // topmenu |
|
| 40 | -$colorbackvmenu1='248,248,248'; // vmenu |
|
| 41 | -$colortopbordertitle1='200,200,200'; // top border of title |
|
| 42 | -$colorbacktitle1='220,220,223'; // title of tables,list |
|
| 43 | -$colorbacktabcard1='255,255,255'; // card |
|
| 44 | -$colorbacktabactive='234,234,234'; |
|
| 45 | -$colorbacklineimpair1='255,255,255'; // line impair |
|
| 46 | -$colorbacklineimpair2='255,255,255'; // line impair |
|
| 47 | -$colorbacklinepair1='248,248,248'; // line pair |
|
| 48 | -$colorbacklinepair2='248,248,248'; // line pair |
|
| 49 | -$colorbacklinepairhover='238,246,252'; // line pair |
|
| 50 | -$colorbacklinebreak='214,218,220'; // line break |
|
| 51 | -$colorbackbody='255,255,255'; |
|
| 52 | -$colortexttitlenotab='100,60,20'; |
|
| 53 | -$colortexttitle='0,0,0'; |
|
| 54 | -$colortext='0,0,0'; |
|
| 55 | -$colortextlink='0,0,100'; |
|
| 56 | -$fontsize='13'; |
|
| 57 | -$fontsizesmaller='12'; |
|
| 39 | +$colorbackhmenu1 = '80,90,120'; // topmenu |
|
| 40 | +$colorbackvmenu1 = '248,248,248'; // vmenu |
|
| 41 | +$colortopbordertitle1 = '200,200,200'; // top border of title |
|
| 42 | +$colorbacktitle1 = '220,220,223'; // title of tables,list |
|
| 43 | +$colorbacktabcard1 = '255,255,255'; // card |
|
| 44 | +$colorbacktabactive = '234,234,234'; |
|
| 45 | +$colorbacklineimpair1 = '255,255,255'; // line impair |
|
| 46 | +$colorbacklineimpair2 = '255,255,255'; // line impair |
|
| 47 | +$colorbacklinepair1 = '248,248,248'; // line pair |
|
| 48 | +$colorbacklinepair2 = '248,248,248'; // line pair |
|
| 49 | +$colorbacklinepairhover = '238,246,252'; // line pair |
|
| 50 | +$colorbacklinebreak = '214,218,220'; // line break |
|
| 51 | +$colorbackbody = '255,255,255'; |
|
| 52 | +$colortexttitlenotab = '100,60,20'; |
|
| 53 | +$colortexttitle = '0,0,0'; |
|
| 54 | +$colortext = '0,0,0'; |
|
| 55 | +$colortextlink = '0,0,100'; |
|
| 56 | +$fontsize = '13'; |
|
| 57 | +$fontsizesmaller = '12'; |
|
| 58 | 58 | |
| 59 | 59 | if (defined('THEME_ONLY_CONSTANT')) return; |
| 60 | 60 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
| 65 | 65 | |
| 66 | 66 | // Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) |
| 67 | -if (empty($user->id) && ! empty($_SESSION['dol_login'])) $user->fetch('',$_SESSION['dol_login'],'',1); |
|
| 67 | +if (empty($user->id) && !empty($_SESSION['dol_login'])) $user->fetch('', $_SESSION['dol_login'], '', 1); |
|
| 68 | 68 | |
| 69 | 69 | |
| 70 | 70 | // Define css type |
@@ -76,131 +76,131 @@ discard block |
||
| 76 | 76 | // On the fly GZIP compression for all pages (if browser support it). Must set the bit 3 of constant to 1. |
| 77 | 77 | if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x04)) { ob_start("ob_gzhandler"); } |
| 78 | 78 | |
| 79 | -if (GETPOST('theme','alpha')) $conf->theme=GETPOST('theme','alpha'); // If theme was forced on URL |
|
| 80 | -if (GETPOST('lang','aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL |
|
| 79 | +if (GETPOST('theme', 'alpha')) $conf->theme = GETPOST('theme', 'alpha'); // If theme was forced on URL |
|
| 80 | +if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL |
|
| 81 | 81 | |
| 82 | -$langs->load("main",0,1); |
|
| 83 | -$right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); |
|
| 84 | -$left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); |
|
| 82 | +$langs->load("main", 0, 1); |
|
| 83 | +$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right'); |
|
| 84 | +$left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left'); |
|
| 85 | 85 | |
| 86 | -$path=''; // This value may be used in future for external module to overwrite theme |
|
| 87 | -$theme='eldy'; // Value of theme |
|
| 88 | -if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; } |
|
| 86 | +$path = ''; // This value may be used in future for external module to overwrite theme |
|
| 87 | +$theme = 'eldy'; // Value of theme |
|
| 88 | +if (!empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path = '/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme = $conf->global->MAIN_OVERWRITE_THEME_RES; } |
|
| 89 | 89 | |
| 90 | 90 | // Define image path files and other constants |
| 91 | -$fontlist='roboto,arial,tahoma,verdana,helvetica'; //$fontlist='helvetica, verdana, arial, sans-serif'; |
|
| 91 | +$fontlist = 'roboto,arial,tahoma,verdana,helvetica'; //$fontlist='helvetica, verdana, arial, sans-serif'; |
|
| 92 | 92 | //$fontlist='"open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;'; |
| 93 | -$img_head=''; |
|
| 94 | -$img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png',1); |
|
| 95 | -$dol_hide_topmenu=$conf->dol_hide_topmenu; |
|
| 96 | -$dol_hide_leftmenu=$conf->dol_hide_leftmenu; |
|
| 97 | -$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen; |
|
| 98 | -$dol_no_mouse_hover=$conf->dol_no_mouse_hover; |
|
| 93 | +$img_head = ''; |
|
| 94 | +$img_button = dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png', 1); |
|
| 95 | +$dol_hide_topmenu = $conf->dol_hide_topmenu; |
|
| 96 | +$dol_hide_leftmenu = $conf->dol_hide_leftmenu; |
|
| 97 | +$dol_optimize_smallscreen = $conf->dol_optimize_smallscreen; |
|
| 98 | +$dol_no_mouse_hover = $conf->dol_no_mouse_hover; |
|
| 99 | 99 | |
| 100 | 100 | //$conf->global->THEME_ELDY_ENABLE_PERSONALIZED=0; |
| 101 | 101 | //$user->conf->THEME_ELDY_ENABLE_PERSONALIZED=0; |
| 102 | 102 | //var_dump($user->conf->THEME_ELDY_RGB); |
| 103 | 103 | |
| 104 | -$useboldtitle=(isset($conf->global->THEME_ELDY_USEBOLDTITLE)?$conf->global->THEME_ELDY_USEBOLDTITLE:0); |
|
| 105 | -$borderwidth=1; |
|
| 104 | +$useboldtitle = (isset($conf->global->THEME_ELDY_USEBOLDTITLE) ? $conf->global->THEME_ELDY_USEBOLDTITLE : 0); |
|
| 105 | +$borderwidth = 1; |
|
| 106 | 106 | |
| 107 | 107 | // Case of option always editable |
| 108 | -if (! isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY=$colorbackbody; |
|
| 109 | -if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1=$colorbackhmenu1; |
|
| 110 | -if (! isset($conf->global->THEME_ELDY_VERMENU_BACK1)) $conf->global->THEME_ELDY_VERMENU_BACK1=$colorbackvmenu1; |
|
| 111 | -if (! isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1=$colorbacktitle1; |
|
| 112 | -if (! isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER=$colorbacklinepairhover; |
|
| 113 | -if (! isset($conf->global->THEME_ELDY_LINEBREAK)) $conf->global->THEME_ELDY_LINEBREAK=$colorbacklinebreak; |
|
| 114 | -if (! isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) $conf->global->THEME_ELDY_TEXTTITLENOTAB=$colortexttitlenotab; |
|
| 115 | -if (! isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK=$colortextlink; |
|
| 108 | +if (!isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY = $colorbackbody; |
|
| 109 | +if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1; |
|
| 110 | +if (!isset($conf->global->THEME_ELDY_VERMENU_BACK1)) $conf->global->THEME_ELDY_VERMENU_BACK1 = $colorbackvmenu1; |
|
| 111 | +if (!isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1 = $colorbacktitle1; |
|
| 112 | +if (!isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER = $colorbacklinepairhover; |
|
| 113 | +if (!isset($conf->global->THEME_ELDY_LINEBREAK)) $conf->global->THEME_ELDY_LINEBREAK = $colorbacklinebreak; |
|
| 114 | +if (!isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) $conf->global->THEME_ELDY_TEXTTITLENOTAB = $colortexttitlenotab; |
|
| 115 | +if (!isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK = $colortextlink; |
|
| 116 | 116 | |
| 117 | 117 | // Case of option editable only if option THEME_ELDY_ENABLE_PERSONALIZED is on |
| 118 | 118 | if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) |
| 119 | 119 | { |
| 120 | - $conf->global->THEME_ELDY_BACKTABCARD1='255,255,255'; // card |
|
| 121 | - $conf->global->THEME_ELDY_BACKTABACTIVE='234,234,234'; |
|
| 122 | - $conf->global->THEME_ELDY_TEXT='0,0,0'; |
|
| 123 | - $conf->global->THEME_ELDY_FONT_SIZE1='13'; |
|
| 124 | - $conf->global->THEME_ELDY_FONT_SIZE2='12'; |
|
| 120 | + $conf->global->THEME_ELDY_BACKTABCARD1 = '255,255,255'; // card |
|
| 121 | + $conf->global->THEME_ELDY_BACKTABACTIVE = '234,234,234'; |
|
| 122 | + $conf->global->THEME_ELDY_TEXT = '0,0,0'; |
|
| 123 | + $conf->global->THEME_ELDY_FONT_SIZE1 = '13'; |
|
| 124 | + $conf->global->THEME_ELDY_FONT_SIZE2 = '12'; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | // Case of option availables only if THEME_ELDY_ENABLE_PERSONALIZED is on |
| 128 | -$colorbackhmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$user->conf->THEME_ELDY_TOPMENU_BACK1); |
|
| 129 | -$colorbackvmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$conf->global->THEME_ELDY_VERMENU_BACK1) :(empty($user->conf->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$user->conf->THEME_ELDY_VERMENU_BACK1); |
|
| 130 | -$colortopbordertitle1=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPBORDER_TITLE1)?$colortopbordertitle1:$conf->global->THEME_ELDY_TOPBORDER_TITLE1) :(empty($user->conf->THEME_ELDY_TOPBORDER_TITLE1)?$colortopbordertitle1:$user->conf->THEME_ELDY_TOPBORDER_TITLE1); |
|
| 131 | -$colorbacktitle1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTITLE1) ?$colorbacktitle1:$conf->global->THEME_ELDY_BACKTITLE1) :(empty($user->conf->THEME_ELDY_BACKTITLE1)?$colorbacktitle1:$user->conf->THEME_ELDY_BACKTITLE1); |
|
| 132 | -$colorbacktabcard1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTABCARD1) ?$colorbacktabcard1:$conf->global->THEME_ELDY_BACKTABCARD1) :(empty($user->conf->THEME_ELDY_BACKTABCARD1)?$colorbacktabcard1:$user->conf->THEME_ELDY_BACKTABCARD1); |
|
| 133 | -$colorbacktabactive =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTABACTIVE)?$colorbacktabactive:$conf->global->THEME_ELDY_BACKTABACTIVE):(empty($user->conf->THEME_ELDY_BACKTABACTIVE)?$colorbacktabactive:$user->conf->THEME_ELDY_BACKTABACTIVE); |
|
| 134 | -$colorbacklineimpair1=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEIMPAIR1) ?$colorbacklineimpair1:$conf->global->THEME_ELDY_LINEIMPAIR1):(empty($user->conf->THEME_ELDY_LINEIMPAIR1)?$colorbacklineimpair1:$user->conf->THEME_ELDY_LINEIMPAIR1); |
|
| 135 | -$colorbacklineimpair2=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEIMPAIR2) ?$colorbacklineimpair2:$conf->global->THEME_ELDY_LINEIMPAIR2):(empty($user->conf->THEME_ELDY_LINEIMPAIR2)?$colorbacklineimpair2:$user->conf->THEME_ELDY_LINEIMPAIR2); |
|
| 136 | -$colorbacklinepair1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR1) ?$colorbacklinepair1:$conf->global->THEME_ELDY_LINEPAIR1) :(empty($user->conf->THEME_ELDY_LINEPAIR1)?$colorbacklinepair1:$user->conf->THEME_ELDY_LINEPAIR1); |
|
| 137 | -$colorbacklinepair2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR2) ?$colorbacklinepair2:$conf->global->THEME_ELDY_LINEPAIR2) :(empty($user->conf->THEME_ELDY_LINEPAIR2)?$colorbacklinepair2:$user->conf->THEME_ELDY_LINEPAIR2); |
|
| 138 | -$colorbacklinebreak =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEBREAK) ?$colorbacklinebreak:$conf->global->THEME_ELDY_LINEBREAK) :(empty($user->conf->THEME_ELDY_LINEBREAK)?$colorbacklinebreak:$user->conf->THEME_ELDY_LINEBREAK); |
|
| 139 | -$colorbackbody =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKBODY) ?$colorbackbody:$conf->global->THEME_ELDY_BACKBODY) :(empty($user->conf->THEME_ELDY_BACKBODY)?$colorbackbody:$user->conf->THEME_ELDY_BACKBODY); |
|
| 140 | -$colortexttitlenotab =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXTTITLENOTAB)?$colortexttitlenotab:$conf->global->THEME_ELDY_TEXTTITLENOTAB) :(empty($user->conf->THEME_ELDY_TEXTTITLENOTAB)?$colortexttitlenotab:$user->conf->THEME_ELDY_TEXTTITLENOTAB); |
|
| 141 | -$colortexttitle =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXTTITLE) ?$colortexttitle:$conf->global->THEME_ELDY_TEXTTITLE) :(empty($user->conf->THEME_ELDY_TEXTTITLE)?$colortexttitle:$user->conf->THEME_ELDY_TEXTTITLE); |
|
| 142 | -$colortext =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXT) ?$colortext:$conf->global->THEME_ELDY_TEXT) :(empty($user->conf->THEME_ELDY_TEXT)?$colortext:$user->conf->THEME_ELDY_TEXT); |
|
| 143 | -$colortextlink =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXTLINK) ?$colortextlink:$conf->global->THEME_ELDY_TEXTLINK) :(empty($user->conf->THEME_ELDY_TEXTLINK)?$colortextlink:$user->conf->THEME_ELDY_TEXTLINK); |
|
| 144 | -$fontsize =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE1) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE1) :(empty($user->conf->THEME_ELDY_FONT_SIZE1)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE1); |
|
| 145 | -$fontsizesmaller =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE2) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE2) :(empty($user->conf->THEME_ELDY_FONT_SIZE2)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE2); |
|
| 128 | +$colorbackhmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $conf->global->THEME_ELDY_TOPMENU_BACK1) : (empty($user->conf->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $user->conf->THEME_ELDY_TOPMENU_BACK1); |
|
| 129 | +$colorbackvmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_VERMENU_BACK1) ? $colorbackvmenu1 : $conf->global->THEME_ELDY_VERMENU_BACK1) : (empty($user->conf->THEME_ELDY_VERMENU_BACK1) ? $colorbackvmenu1 : $user->conf->THEME_ELDY_VERMENU_BACK1); |
|
| 130 | +$colortopbordertitle1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TOPBORDER_TITLE1) ? $colortopbordertitle1 : $conf->global->THEME_ELDY_TOPBORDER_TITLE1) : (empty($user->conf->THEME_ELDY_TOPBORDER_TITLE1) ? $colortopbordertitle1 : $user->conf->THEME_ELDY_TOPBORDER_TITLE1); |
|
| 131 | +$colorbacktitle1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_BACKTITLE1) ? $colorbacktitle1 : $conf->global->THEME_ELDY_BACKTITLE1) : (empty($user->conf->THEME_ELDY_BACKTITLE1) ? $colorbacktitle1 : $user->conf->THEME_ELDY_BACKTITLE1); |
|
| 132 | +$colorbacktabcard1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_BACKTABCARD1) ? $colorbacktabcard1 : $conf->global->THEME_ELDY_BACKTABCARD1) : (empty($user->conf->THEME_ELDY_BACKTABCARD1) ? $colorbacktabcard1 : $user->conf->THEME_ELDY_BACKTABCARD1); |
|
| 133 | +$colorbacktabactive = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_BACKTABACTIVE) ? $colorbacktabactive : $conf->global->THEME_ELDY_BACKTABACTIVE) : (empty($user->conf->THEME_ELDY_BACKTABACTIVE) ? $colorbacktabactive : $user->conf->THEME_ELDY_BACKTABACTIVE); |
|
| 134 | +$colorbacklineimpair1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEIMPAIR1) ? $colorbacklineimpair1 : $conf->global->THEME_ELDY_LINEIMPAIR1) : (empty($user->conf->THEME_ELDY_LINEIMPAIR1) ? $colorbacklineimpair1 : $user->conf->THEME_ELDY_LINEIMPAIR1); |
|
| 135 | +$colorbacklineimpair2 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEIMPAIR2) ? $colorbacklineimpair2 : $conf->global->THEME_ELDY_LINEIMPAIR2) : (empty($user->conf->THEME_ELDY_LINEIMPAIR2) ? $colorbacklineimpair2 : $user->conf->THEME_ELDY_LINEIMPAIR2); |
|
| 136 | +$colorbacklinepair1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEPAIR1) ? $colorbacklinepair1 : $conf->global->THEME_ELDY_LINEPAIR1) : (empty($user->conf->THEME_ELDY_LINEPAIR1) ? $colorbacklinepair1 : $user->conf->THEME_ELDY_LINEPAIR1); |
|
| 137 | +$colorbacklinepair2 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEPAIR2) ? $colorbacklinepair2 : $conf->global->THEME_ELDY_LINEPAIR2) : (empty($user->conf->THEME_ELDY_LINEPAIR2) ? $colorbacklinepair2 : $user->conf->THEME_ELDY_LINEPAIR2); |
|
| 138 | +$colorbacklinebreak = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEBREAK) ? $colorbacklinebreak : $conf->global->THEME_ELDY_LINEBREAK) : (empty($user->conf->THEME_ELDY_LINEBREAK) ? $colorbacklinebreak : $user->conf->THEME_ELDY_LINEBREAK); |
|
| 139 | +$colorbackbody = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_BACKBODY) ? $colorbackbody : $conf->global->THEME_ELDY_BACKBODY) : (empty($user->conf->THEME_ELDY_BACKBODY) ? $colorbackbody : $user->conf->THEME_ELDY_BACKBODY); |
|
| 140 | +$colortexttitlenotab = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXTTITLENOTAB) ? $colortexttitlenotab : $conf->global->THEME_ELDY_TEXTTITLENOTAB) : (empty($user->conf->THEME_ELDY_TEXTTITLENOTAB) ? $colortexttitlenotab : $user->conf->THEME_ELDY_TEXTTITLENOTAB); |
|
| 141 | +$colortexttitle = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXTTITLE) ? $colortexttitle : $conf->global->THEME_ELDY_TEXTTITLE) : (empty($user->conf->THEME_ELDY_TEXTTITLE) ? $colortexttitle : $user->conf->THEME_ELDY_TEXTTITLE); |
|
| 142 | +$colortext = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXT) ? $colortext : $conf->global->THEME_ELDY_TEXT) : (empty($user->conf->THEME_ELDY_TEXT) ? $colortext : $user->conf->THEME_ELDY_TEXT); |
|
| 143 | +$colortextlink = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXTLINK) ? $colortextlink : $conf->global->THEME_ELDY_TEXTLINK) : (empty($user->conf->THEME_ELDY_TEXTLINK) ? $colortextlink : $user->conf->THEME_ELDY_TEXTLINK); |
|
| 144 | +$fontsize = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_FONT_SIZE1) ? $fontsize : $conf->global->THEME_ELDY_FONT_SIZE1) : (empty($user->conf->THEME_ELDY_FONT_SIZE1) ? $fontsize : $user->conf->THEME_ELDY_FONT_SIZE1); |
|
| 145 | +$fontsizesmaller = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_FONT_SIZE2) ? $fontsize : $conf->global->THEME_ELDY_FONT_SIZE2) : (empty($user->conf->THEME_ELDY_FONT_SIZE2) ? $fontsize : $user->conf->THEME_ELDY_FONT_SIZE2); |
|
| 146 | 146 | |
| 147 | 147 | // Hover color |
| 148 | -$colorbacklinepairhover=((! isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '0')?'':($conf->global->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$conf->global->THEME_ELDY_USE_HOVER)); |
|
| 149 | -if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)) |
|
| 148 | +$colorbacklinepairhover = ((!isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '0') ? '' : ($conf->global->THEME_ELDY_USE_HOVER === '1' ? 'edf4fb' : $conf->global->THEME_ELDY_USE_HOVER)); |
|
| 149 | +if (!empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)) |
|
| 150 | 150 | { |
| 151 | - $colorbacklinepairhover=((! isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0')?'':($user->conf->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$user->conf->THEME_ELDY_USE_HOVER)); |
|
| 151 | + $colorbacklinepairhover = ((!isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0') ? '' : ($user->conf->THEME_ELDY_USE_HOVER === '1' ? 'edf4fb' : $user->conf->THEME_ELDY_USE_HOVER)); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | //$colortopbordertitle1=$colorbackhmenu1; |
| 155 | 155 | |
| 156 | 156 | // Set text color to black or white |
| 157 | -$colorbackhmenu1=join(',',colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z' |
|
| 158 | -$tmppart=explode(',',$colorbackhmenu1); |
|
| 159 | -$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0); |
|
| 160 | -if ($tmpval <= 460) $colortextbackhmenu='FFFFFF'; |
|
| 161 | -else $colortextbackhmenu='000000'; |
|
| 162 | - |
|
| 163 | -$colorbackvmenu1=join(',',colorStringToArray($colorbackvmenu1)); // Normalize value to 'x,y,z' |
|
| 164 | -$tmppart=explode(',',$colorbackvmenu1); |
|
| 165 | -$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0); |
|
| 166 | -if ($tmpval <= 460) { $colortextbackvmenu='FFFFFF'; } |
|
| 167 | -else { $colortextbackvmenu='000000'; } |
|
| 168 | - |
|
| 169 | -$colorbacktitle1=join(',',colorStringToArray($colorbacktitle1)); // Normalize value to 'x,y,z' |
|
| 170 | -$tmppart=explode(',',$colorbacktitle1); |
|
| 157 | +$colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z' |
|
| 158 | +$tmppart = explode(',', $colorbackhmenu1); |
|
| 159 | +$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0); |
|
| 160 | +if ($tmpval <= 460) $colortextbackhmenu = 'FFFFFF'; |
|
| 161 | +else $colortextbackhmenu = '000000'; |
|
| 162 | + |
|
| 163 | +$colorbackvmenu1 = join(',', colorStringToArray($colorbackvmenu1)); // Normalize value to 'x,y,z' |
|
| 164 | +$tmppart = explode(',', $colorbackvmenu1); |
|
| 165 | +$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0); |
|
| 166 | +if ($tmpval <= 460) { $colortextbackvmenu = 'FFFFFF'; } |
|
| 167 | +else { $colortextbackvmenu = '000000'; } |
|
| 168 | + |
|
| 169 | +$colorbacktitle1 = join(',', colorStringToArray($colorbacktitle1)); // Normalize value to 'x,y,z' |
|
| 170 | +$tmppart = explode(',', $colorbacktitle1); |
|
| 171 | 171 | if ($colortexttitle == '') |
| 172 | 172 | { |
| 173 | - $tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0); |
|
| 174 | - if ($tmpval <= 460) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; } |
|
| 175 | - else { $colortexttitle='000000'; $colorshadowtitle='FFFFFF'; } |
|
| 173 | + $tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0); |
|
| 174 | + if ($tmpval <= 460) { $colortexttitle = 'FFFFFF'; $colorshadowtitle = '888888'; } |
|
| 175 | + else { $colortexttitle = '000000'; $colorshadowtitle = 'FFFFFF'; } |
|
| 176 | 176 | } |
| 177 | -else $colorshadowtitle='888888'; |
|
| 177 | +else $colorshadowtitle = '888888'; |
|
| 178 | 178 | |
| 179 | -$colorbacktabcard1=join(',',colorStringToArray($colorbacktabcard1)); // Normalize value to 'x,y,z' |
|
| 180 | -$tmppart=explode(',',$colorbacktabcard1); |
|
| 181 | -$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0); |
|
| 182 | -if ($tmpval <= 460) { $colortextbacktab='FFFFFF'; } |
|
| 183 | -else { $colortextbacktab='111111'; } |
|
| 179 | +$colorbacktabcard1 = join(',', colorStringToArray($colorbacktabcard1)); // Normalize value to 'x,y,z' |
|
| 180 | +$tmppart = explode(',', $colorbacktabcard1); |
|
| 181 | +$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0); |
|
| 182 | +if ($tmpval <= 460) { $colortextbacktab = 'FFFFFF'; } |
|
| 183 | +else { $colortextbacktab = '111111'; } |
|
| 184 | 184 | |
| 185 | 185 | |
| 186 | 186 | // Format color value to match expected format (may be 'FFFFFF' or '255,255,255') |
| 187 | -$colorbackhmenu1=join(',',colorStringToArray($colorbackhmenu1)); |
|
| 188 | -$colorbackvmenu1=join(',',colorStringToArray($colorbackvmenu1)); |
|
| 189 | -$colorbacktitle1=join(',',colorStringToArray($colorbacktitle1)); |
|
| 190 | -$colorbacktabcard1=join(',',colorStringToArray($colorbacktabcard1)); |
|
| 191 | -$colorbacktabactive=join(',',colorStringToArray($colorbacktabactive)); |
|
| 192 | -$colorbacklineimpair1=join(',',colorStringToArray($colorbacklineimpair1)); |
|
| 193 | -$colorbacklineimpair2=join(',',colorStringToArray($colorbacklineimpair2)); |
|
| 194 | -$colorbacklinepair1=join(',',colorStringToArray($colorbacklinepair1)); |
|
| 195 | -$colorbacklinepair2=join(',',colorStringToArray($colorbacklinepair2)); |
|
| 196 | -if ($colorbacklinepairhover != '') $colorbacklinepairhover=join(',',colorStringToArray($colorbacklinepairhover)); |
|
| 197 | -$colorbackbody=join(',',colorStringToArray($colorbackbody)); |
|
| 198 | -$colortexttitlenotab=join(',',colorStringToArray($colortexttitlenotab)); |
|
| 199 | -$colortexttitle=join(',',colorStringToArray($colortexttitle)); |
|
| 200 | -$colortext=join(',',colorStringToArray($colortext)); |
|
| 201 | -$colortextlink=join(',',colorStringToArray($colortextlink)); |
|
| 202 | - |
|
| 203 | -$nbtopmenuentries=$menumanager->showmenu('topnb'); |
|
| 187 | +$colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); |
|
| 188 | +$colorbackvmenu1 = join(',', colorStringToArray($colorbackvmenu1)); |
|
| 189 | +$colorbacktitle1 = join(',', colorStringToArray($colorbacktitle1)); |
|
| 190 | +$colorbacktabcard1 = join(',', colorStringToArray($colorbacktabcard1)); |
|
| 191 | +$colorbacktabactive = join(',', colorStringToArray($colorbacktabactive)); |
|
| 192 | +$colorbacklineimpair1 = join(',', colorStringToArray($colorbacklineimpair1)); |
|
| 193 | +$colorbacklineimpair2 = join(',', colorStringToArray($colorbacklineimpair2)); |
|
| 194 | +$colorbacklinepair1 = join(',', colorStringToArray($colorbacklinepair1)); |
|
| 195 | +$colorbacklinepair2 = join(',', colorStringToArray($colorbacklinepair2)); |
|
| 196 | +if ($colorbacklinepairhover != '') $colorbacklinepairhover = join(',', colorStringToArray($colorbacklinepairhover)); |
|
| 197 | +$colorbackbody = join(',', colorStringToArray($colorbackbody)); |
|
| 198 | +$colortexttitlenotab = join(',', colorStringToArray($colortexttitlenotab)); |
|
| 199 | +$colortexttitle = join(',', colorStringToArray($colortexttitle)); |
|
| 200 | +$colortext = join(',', colorStringToArray($colortext)); |
|
| 201 | +$colortextlink = join(',', colorStringToArray($colortextlink)); |
|
| 202 | + |
|
| 203 | +$nbtopmenuentries = $menumanager->showmenu('topnb'); |
|
| 204 | 204 | |
| 205 | 205 | print '/*'."\n"; |
| 206 | 206 | print 'colorbackbody='.$colorbackbody."\n"; |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | |
| 238 | 238 | body { |
| 239 | -<?php if (GETPOST('optioncss','aZ09') == 'print') { ?> |
|
| 239 | +<?php if (GETPOST('optioncss', 'aZ09') == 'print') { ?> |
|
| 240 | 240 | background-color: #FFFFFF; |
| 241 | 241 | <?php } else { ?> |
| 242 | 242 | background: rgb(<?php print $colorbackbody; ?>); |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | .thumbstat, a.tab { color: rgb(<?php print $colortexttitle; ?>) !important; font-weight: bold !important; } |
| 256 | -th a { font-weight: <?php echo ($useboldtitle?'bold':'normal'); ?> !important; } |
|
| 256 | +th a { font-weight: <?php echo ($useboldtitle ? 'bold' : 'normal'); ?> !important; } |
|
| 257 | 257 | a.tab { font-weight: bold !important; } |
| 258 | 258 | |
| 259 | 259 | a:link, a:visited, a:hover, a:active { font-family: <?php print $fontlist ?>; font-weight: normal; color: rgb(<?php print $colortextlink; ?>); text-decoration: none; } |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | font-family: <?php print $fontlist ?>; |
| 294 | 294 | outline: none; |
| 295 | 295 | margin: 0px 0px 0px 0px; |
| 296 | - border<?php echo empty($conf->global->THEME_HIDE_BORDER_ON_INPUT)?'-bottom':''; ?>: solid 1px rgba(0,0,0,.2); |
|
| 296 | + border<?php echo empty($conf->global->THEME_HIDE_BORDER_ON_INPUT) ? '-bottom' : ''; ?>: solid 1px rgba(0,0,0,.2); |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | input { |
@@ -366,29 +366,29 @@ discard block |
||
| 366 | 366 | box-shadow: 1px 1px 8px #bbb; |
| 367 | 367 | } |
| 368 | 368 | input.buttonpaymentcb { |
| 369 | - background-image: url(<?php echo dol_buildpath($path.'/theme/common/credit_card.png',1) ?>); |
|
| 369 | + background-image: url(<?php echo dol_buildpath($path.'/theme/common/credit_card.png', 1) ?>); |
|
| 370 | 370 | background-size: 26px; |
| 371 | 371 | background-repeat: no-repeat; |
| 372 | 372 | background-position: 5px 11px; |
| 373 | 373 | } |
| 374 | 374 | input.buttonpaymentcheque { |
| 375 | - background-image: url(<?php echo dol_buildpath($path.'/theme/common/cheque.png',1) ?>); |
|
| 375 | + background-image: url(<?php echo dol_buildpath($path.'/theme/common/cheque.png', 1) ?>); |
|
| 376 | 376 | background-size: 24px; |
| 377 | 377 | background-repeat: no-repeat; |
| 378 | 378 | background-position: 5px 8px; |
| 379 | 379 | } |
| 380 | 380 | input.buttonpaymentpaypal { |
| 381 | - background-image: url(<?php echo dol_buildpath($path.'/paypal/img/object_paypal.png',1) ?>); |
|
| 381 | + background-image: url(<?php echo dol_buildpath($path.'/paypal/img/object_paypal.png', 1) ?>); |
|
| 382 | 382 | background-repeat: no-repeat; |
| 383 | 383 | background-position: 8px 11px; |
| 384 | 384 | } |
| 385 | 385 | input.buttonpaymentpaybox { |
| 386 | - background-image: url(<?php echo dol_buildpath($path.'/paybox/img/object_paybox.png',1) ?>); |
|
| 386 | + background-image: url(<?php echo dol_buildpath($path.'/paybox/img/object_paybox.png', 1) ?>); |
|
| 387 | 387 | background-repeat: no-repeat; |
| 388 | 388 | background-position: 8px 11px; |
| 389 | 389 | } |
| 390 | 390 | input.buttonpaymentstripe { |
| 391 | - background-image: url(<?php echo dol_buildpath($path.'/stripe/img/object_stripe.png',1) ?>); |
|
| 391 | + background-image: url(<?php echo dol_buildpath($path.'/stripe/img/object_stripe.png', 1) ?>); |
|
| 392 | 392 | background-repeat: no-repeat; |
| 393 | 393 | background-position: 8px 11px; |
| 394 | 394 | } |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | text-align: justify; |
| 593 | 593 | } |
| 594 | 594 | .nowrap { |
| 595 | - white-space: <?php print ($dol_optimize_smallscreen?'normal':'nowrap'); ?>; |
|
| 595 | + white-space: <?php print ($dol_optimize_smallscreen ? 'normal' : 'nowrap'); ?>; |
|
| 596 | 596 | } |
| 597 | 597 | .liste_titre .nowrap { |
| 598 | 598 | white-space: nowrap; |
@@ -840,7 +840,7 @@ discard block |
||
| 840 | 840 | } |
| 841 | 841 | |
| 842 | 842 | .flexcontainer { |
| 843 | - <?php if (in_array($conf->browser->name, array('chrome','firefox'))) echo 'display: inline-flex;'."\n"; ?> |
|
| 843 | + <?php if (in_array($conf->browser->name, array('chrome', 'firefox'))) echo 'display: inline-flex;'."\n"; ?> |
|
| 844 | 844 | flex-flow: row wrap; |
| 845 | 845 | justify-content: flex-start; |
| 846 | 846 | } |
@@ -959,10 +959,10 @@ discard block |
||
| 959 | 959 | @media only screen and (max-width: 767px) |
| 960 | 960 | { |
| 961 | 961 | body { |
| 962 | - font-size: <?php print $fontsize+3; ?>px; |
|
| 962 | + font-size: <?php print $fontsize + 3; ?>px; |
|
| 963 | 963 | } |
| 964 | 964 | div.refidno { |
| 965 | - font-size: <?php print $fontsize+3; ?>px !important; |
|
| 965 | + font-size: <?php print $fontsize + 3; ?>px !important; |
|
| 966 | 966 | } |
| 967 | 967 | } |
| 968 | 968 | |
@@ -970,10 +970,10 @@ discard block |
||
| 970 | 970 | @media only screen and (max-width: 570px) |
| 971 | 971 | { |
| 972 | 972 | body { |
| 973 | - font-size: <?php print $fontsize+3; ?>px; |
|
| 973 | + font-size: <?php print $fontsize + 3; ?>px; |
|
| 974 | 974 | } |
| 975 | 975 | div.refidno { |
| 976 | - font-size: <?php print $fontsize+3; ?>px !important; |
|
| 976 | + font-size: <?php print $fontsize + 3; ?>px !important; |
|
| 977 | 977 | } |
| 978 | 978 | |
| 979 | 979 | .divmainbodylarge { margin-left: 20px !important; margin-right: 20px !important; } |
@@ -985,7 +985,7 @@ discard block |
||
| 985 | 985 | white-space: nowrap; |
| 986 | 986 | } |
| 987 | 987 | div.fiche { |
| 988 | - margin-top: <?php print ($dol_hide_topmenu?'12':'6'); ?>px !important; |
|
| 988 | + margin-top: <?php print ($dol_hide_topmenu ? '12' : '6'); ?>px !important; |
|
| 989 | 989 | } |
| 990 | 990 | div.titre { |
| 991 | 991 | /* margin-top: 12px; */ |
@@ -1005,7 +1005,7 @@ discard block |
||
| 1005 | 1005 | } |
| 1006 | 1006 | input, input[type=text], input[type=password], select, textarea { |
| 1007 | 1007 | min-width: 20px; |
| 1008 | - font-size: <?php print $fontsize+3; ?>px; |
|
| 1008 | + font-size: <?php print $fontsize + 3; ?>px; |
|
| 1009 | 1009 | /* min-height: 1.4em; */ |
| 1010 | 1010 | /* line-height: 1.4em; */ |
| 1011 | 1011 | /* padding: .4em .1em; */ |
@@ -1036,7 +1036,7 @@ discard block |
||
| 1036 | 1036 | |
| 1037 | 1037 | #tooltip { |
| 1038 | 1038 | position: absolute; |
| 1039 | - width: <?php print dol_size(300,'width'); ?>px; |
|
| 1039 | + width: <?php print dol_size(300, 'width'); ?>px; |
|
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | 1042 | /* intput, input[type=text], */ |
@@ -1081,7 +1081,7 @@ discard block |
||
| 1081 | 1081 | } |
| 1082 | 1082 | } |
| 1083 | 1083 | .linkobject { cursor: pointer; } |
| 1084 | -<?php if (GETPOST('optioncss','aZ09') == 'print') { ?> |
|
| 1084 | +<?php if (GETPOST('optioncss', 'aZ09') == 'print') { ?> |
|
| 1085 | 1085 | .hideonprint { display: none; } |
| 1086 | 1086 | <?php } ?> |
| 1087 | 1087 | |
@@ -1175,7 +1175,7 @@ discard block |
||
| 1175 | 1175 | */ |
| 1176 | 1176 | |
| 1177 | 1177 | /* For smartphone (testmenuhider is on) */ |
| 1178 | -<?php if ($conf->browser->layout == 'phone' && ((GETPOST('testmenuhider','int') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> |
|
| 1178 | +<?php if ($conf->browser->layout == 'phone' && ((GETPOST('testmenuhider', 'int') || !empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> |
|
| 1179 | 1179 | #id-container { |
| 1180 | 1180 | width: 100%; |
| 1181 | 1181 | } |
@@ -1217,10 +1217,10 @@ discard block |
||
| 1217 | 1217 | |
| 1218 | 1218 | |
| 1219 | 1219 | div.fiche { |
| 1220 | - margin-<?php print $left; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?6:(empty($conf->dol_optimize_smallscreen)?'25':'6')); ?>px; |
|
| 1221 | - margin-<?php print $right; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?6:(empty($conf->dol_optimize_smallscreen)?'24':'6')); ?>px; |
|
| 1222 | - <?php if (! empty($conf->dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'."\n"; ?> |
|
| 1223 | - <?php if (! empty($conf->dol_hide_leftmenu)) print 'margin-bottom: 12px;'."\n"; ?> |
|
| 1220 | + margin-<?php print $left; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print' ? 6 : (empty($conf->dol_optimize_smallscreen) ? '25' : '6')); ?>px; |
|
| 1221 | + margin-<?php print $right; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print' ? 6 : (empty($conf->dol_optimize_smallscreen) ? '24' : '6')); ?>px; |
|
| 1222 | + <?php if (!empty($conf->dol_hide_leftmenu) && !empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'."\n"; ?> |
|
| 1223 | + <?php if (!empty($conf->dol_hide_leftmenu)) print 'margin-bottom: 12px;'."\n"; ?> |
|
| 1224 | 1224 | } |
| 1225 | 1225 | body.onlinepaymentbody div.fiche { /* For online payment page */ |
| 1226 | 1226 | margin: 20px !important; |
@@ -1237,25 +1237,25 @@ discard block |
||
| 1237 | 1237 | margin-top: 8px; |
| 1238 | 1238 | } |
| 1239 | 1239 | div.fichethirdleft { |
| 1240 | - <?php if ($conf->browser->layout != 'phone') { print "float: ".$left.";\n"; } ?> |
|
| 1241 | - <?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?> |
|
| 1242 | - <?php if ($conf->browser->layout == 'phone') { print "padding-bottom: 6px;\n"; } ?> |
|
| 1240 | + <?php if ($conf->browser->layout != 'phone') { print "float: ".$left.";\n"; } ?> |
|
| 1241 | + <?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?> |
|
| 1242 | + <?php if ($conf->browser->layout == 'phone') { print "padding-bottom: 6px;\n"; } ?> |
|
| 1243 | 1243 | } |
| 1244 | 1244 | div.fichetwothirdright { |
| 1245 | - <?php if ($conf->browser->layout != 'phone') { print "float: ".$right.";\n"; } ?> |
|
| 1246 | - <?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?> |
|
| 1247 | - <?php if ($conf->browser->layout == 'phone') { print "padding-bottom: 6px\n"; } ?> |
|
| 1245 | + <?php if ($conf->browser->layout != 'phone') { print "float: ".$right.";\n"; } ?> |
|
| 1246 | + <?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?> |
|
| 1247 | + <?php if ($conf->browser->layout == 'phone') { print "padding-bottom: 6px\n"; } ?> |
|
| 1248 | 1248 | } |
| 1249 | 1249 | div.fichehalfleft { |
| 1250 | - <?php if ($conf->browser->layout != 'phone') { print "float: ".$left.";\n"; } ?> |
|
| 1251 | - <?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?> |
|
| 1250 | + <?php if ($conf->browser->layout != 'phone') { print "float: ".$left.";\n"; } ?> |
|
| 1251 | + <?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?> |
|
| 1252 | 1252 | } |
| 1253 | 1253 | div.fichehalfright { |
| 1254 | - <?php if ($conf->browser->layout != 'phone') { print "float: ".$right.";\n"; } ?> |
|
| 1255 | - <?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?> |
|
| 1254 | + <?php if ($conf->browser->layout != 'phone') { print "float: ".$right.";\n"; } ?> |
|
| 1255 | + <?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?> |
|
| 1256 | 1256 | } |
| 1257 | 1257 | div.ficheaddleft { |
| 1258 | - <?php if ($conf->browser->layout != 'phone') { print "padding-".$left.": 16px;\n"; } |
|
| 1258 | + <?php if ($conf->browser->layout != 'phone') { print "padding-".$left.": 16px;\n"; } |
|
| 1259 | 1259 | else print "margin-top: 10px;\n"; ?> |
| 1260 | 1260 | } |
| 1261 | 1261 | div.firstcolumn div.box { |
@@ -1268,9 +1268,9 @@ discard block |
||
| 1268 | 1268 | @media only screen and (max-width: 1000px) |
| 1269 | 1269 | { |
| 1270 | 1270 | div.fiche { |
| 1271 | - margin-<?php print $left; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?6:($dol_hide_leftmenu?'6':'20')); ?>px; |
|
| 1272 | - margin-<?php print $right; ?>: <?php print (GETPOST('optioncss','aZ09') == 'print'?8:6); ?>px; |
|
| 1273 | - <?php if (! empty($conf->dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'; ?> |
|
| 1271 | + margin-<?php print $left; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print' ? 6 : ($dol_hide_leftmenu ? '6' : '20')); ?>px; |
|
| 1272 | + margin-<?php print $right; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print' ? 8 : 6); ?>px; |
|
| 1273 | + <?php if (!empty($conf->dol_hide_leftmenu) && !empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'; ?> |
|
| 1274 | 1274 | } |
| 1275 | 1275 | div.fichecenter { |
| 1276 | 1276 | width: 100%; |
@@ -1452,16 +1452,16 @@ discard block |
||
| 1452 | 1452 | /* ============================================================================== */ |
| 1453 | 1453 | |
| 1454 | 1454 | <?php |
| 1455 | -$minwidthtmenu=66; /* minimum width for one top menu entry */ |
|
| 1456 | -$heightmenu=46; /* height of top menu, part with image */ |
|
| 1457 | -$heightmenu2=48; /* height of top menu, part with login */ |
|
| 1455 | +$minwidthtmenu = 66; /* minimum width for one top menu entry */ |
|
| 1456 | +$heightmenu = 46; /* height of top menu, part with image */ |
|
| 1457 | +$heightmenu2 = 48; /* height of top menu, part with login */ |
|
| 1458 | 1458 | $disableimages = 0; |
| 1459 | 1459 | $maxwidthloginblock = 130; |
| 1460 | -if (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = 180; $minwidthtmenu=0; } |
|
| 1460 | +if (!empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = 180; $minwidthtmenu = 0; } |
|
| 1461 | 1461 | ?> |
| 1462 | 1462 | |
| 1463 | 1463 | div#id-top { |
| 1464 | -<?php if (GETPOST('optioncss','aZ09') == 'print') { ?> |
|
| 1464 | +<?php if (GETPOST('optioncss', 'aZ09') == 'print') { ?> |
|
| 1465 | 1465 | display:none; |
| 1466 | 1466 | <?php } else { ?> |
| 1467 | 1467 | background: rgb(<?php echo $colorbackhmenu1 ?>); |
@@ -1469,7 +1469,7 @@ discard block |
||
| 1469 | 1469 | } |
| 1470 | 1470 | |
| 1471 | 1471 | div#tmenu_tooltip { |
| 1472 | -<?php if (GETPOST('optioncss','aZ09') == 'print') { ?> |
|
| 1472 | +<?php if (GETPOST('optioncss', 'aZ09') == 'print') { ?> |
|
| 1473 | 1473 | display:none; |
| 1474 | 1474 | <?php } else { ?> |
| 1475 | 1475 | padding-<?php echo $right; ?>: <?php echo ($maxwidthloginblock - 10); ?>px; |
@@ -1483,7 +1483,7 @@ discard block |
||
| 1483 | 1483 | } |
| 1484 | 1484 | |
| 1485 | 1485 | div.tmenudiv { |
| 1486 | -<?php if (GETPOST('optioncss','aZ09') == 'print') { ?> |
|
| 1486 | +<?php if (GETPOST('optioncss', 'aZ09') == 'print') { ?> |
|
| 1487 | 1487 | display:none; |
| 1488 | 1488 | <?php } else { ?> |
| 1489 | 1489 | position: relative; |
@@ -1538,7 +1538,7 @@ discard block |
||
| 1538 | 1538 | ul.tmenu li { /* We need this to have background color when menu entry wraps on new lines */ |
| 1539 | 1539 | } |
| 1540 | 1540 | li.tmenu, li.tmenusel { |
| 1541 | - <?php print $minwidthtmenu?'min-width: '.$minwidthtmenu.'px;':''; ?> |
|
| 1541 | + <?php print $minwidthtmenu ? 'min-width: '.$minwidthtmenu.'px;' : ''; ?> |
|
| 1542 | 1542 | text-align: center; |
| 1543 | 1543 | vertical-align: bottom; |
| 1544 | 1544 | <?php if (empty($conf->global->MAIN_MENU_INVERT)) { ?> |
@@ -1569,7 +1569,7 @@ discard block |
||
| 1569 | 1569 | margin-top: 0px; |
| 1570 | 1570 | <?php if (empty($conf->dol_optimize_smallscreen)) { ?> |
| 1571 | 1571 | width: 5px; |
| 1572 | - /* background: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menutab-r.png',1); ?>) 0 -6px no-repeat; */ |
|
| 1572 | + /* background: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menutab-r.png', 1); ?>) 0 -6px no-repeat; */ |
|
| 1573 | 1573 | <?php } ?> |
| 1574 | 1574 | <?php if ($disableimages) { ?> |
| 1575 | 1575 | height: 26px; |
@@ -1618,7 +1618,7 @@ discard block |
||
| 1618 | 1618 | position : relative; |
| 1619 | 1619 | background-repeat:no-repeat; |
| 1620 | 1620 | background-position:center top; |
| 1621 | - height: <?php echo ($heightmenu-22); ?>px; |
|
| 1621 | + height: <?php echo ($heightmenu - 22); ?>px; |
|
| 1622 | 1622 | margin-left: 0px; |
| 1623 | 1623 | min-width: 40px; |
| 1624 | 1624 | } |
@@ -1627,129 +1627,129 @@ discard block |
||
| 1627 | 1627 | <?php if (empty($dol_hide_topmenu)) { ?> |
| 1628 | 1628 | |
| 1629 | 1629 | div.mainmenu.home{ |
| 1630 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/home.png',1) ?>); |
|
| 1630 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/home.png', 1) ?>); |
|
| 1631 | 1631 | background-position-x: center; |
| 1632 | 1632 | } |
| 1633 | 1633 | |
| 1634 | 1634 | div.mainmenu.billing { |
| 1635 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/money.png',1) ?>); |
|
| 1635 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/money.png', 1) ?>); |
|
| 1636 | 1636 | } |
| 1637 | 1637 | |
| 1638 | 1638 | div.mainmenu.accountancy { |
| 1639 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/money.png',1) ?>); |
|
| 1639 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/money.png', 1) ?>); |
|
| 1640 | 1640 | } |
| 1641 | 1641 | |
| 1642 | 1642 | div.mainmenu.agenda { |
| 1643 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/agenda.png',1) ?>); |
|
| 1643 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/agenda.png', 1) ?>); |
|
| 1644 | 1644 | } |
| 1645 | 1645 | |
| 1646 | 1646 | div.mainmenu.bank { |
| 1647 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/bank.png',1) ?>); |
|
| 1647 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/bank.png', 1) ?>); |
|
| 1648 | 1648 | } |
| 1649 | 1649 | |
| 1650 | 1650 | div.mainmenu.cashdesk { |
| 1651 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/pointofsale.png',1) ?>); |
|
| 1651 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/pointofsale.png', 1) ?>); |
|
| 1652 | 1652 | } |
| 1653 | 1653 | |
| 1654 | 1654 | div.mainmenu.companies { |
| 1655 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/company.png',1) ?>); |
|
| 1655 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/company.png', 1) ?>); |
|
| 1656 | 1656 | } |
| 1657 | 1657 | |
| 1658 | 1658 | div.mainmenu.commercial { |
| 1659 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/commercial.png',1) ?>); |
|
| 1659 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/commercial.png', 1) ?>); |
|
| 1660 | 1660 | } |
| 1661 | 1661 | |
| 1662 | 1662 | div.mainmenu.ecm { |
| 1663 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/ecm.png',1) ?>); |
|
| 1663 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/ecm.png', 1) ?>); |
|
| 1664 | 1664 | } |
| 1665 | 1665 | |
| 1666 | 1666 | div.mainmenu.externalsite { |
| 1667 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/externalsite.png',1) ?>); |
|
| 1667 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/externalsite.png', 1) ?>); |
|
| 1668 | 1668 | } |
| 1669 | 1669 | |
| 1670 | 1670 | div.mainmenu.ftp { |
| 1671 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/tools.png',1) ?>); |
|
| 1671 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/tools.png', 1) ?>); |
|
| 1672 | 1672 | } |
| 1673 | 1673 | |
| 1674 | 1674 | div.mainmenu.hrm { |
| 1675 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/holiday.png',1) ?>); |
|
| 1675 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/holiday.png', 1) ?>); |
|
| 1676 | 1676 | } |
| 1677 | 1677 | |
| 1678 | 1678 | div.mainmenu.members { |
| 1679 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/members.png',1) ?>); |
|
| 1679 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/members.png', 1) ?>); |
|
| 1680 | 1680 | } |
| 1681 | 1681 | |
| 1682 | 1682 | div.mainmenu.menu { |
| 1683 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/menu.png',1) ?>); |
|
| 1683 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/menu.png', 1) ?>); |
|
| 1684 | 1684 | top: 7px; |
| 1685 | 1685 | } |
| 1686 | 1686 | |
| 1687 | 1687 | div.mainmenu.products { |
| 1688 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/products.png',1) ?>); |
|
| 1688 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/products.png', 1) ?>); |
|
| 1689 | 1689 | } |
| 1690 | 1690 | |
| 1691 | 1691 | div.mainmenu.project { |
| 1692 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/project.png',1) ?>); |
|
| 1692 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/project.png', 1) ?>); |
|
| 1693 | 1693 | } |
| 1694 | 1694 | |
| 1695 | 1695 | div.mainmenu.ticketsup { |
| 1696 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/ticketsup.png',1) ?>); |
|
| 1696 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/ticketsup.png', 1) ?>); |
|
| 1697 | 1697 | } |
| 1698 | 1698 | |
| 1699 | 1699 | div.mainmenu.tools { |
| 1700 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/tools.png',1) ?>); |
|
| 1700 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/tools.png', 1) ?>); |
|
| 1701 | 1701 | } |
| 1702 | 1702 | |
| 1703 | 1703 | div.mainmenu.website { |
| 1704 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/externalsite.png',1) ?>); |
|
| 1704 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/externalsite.png', 1) ?>); |
|
| 1705 | 1705 | } |
| 1706 | 1706 | |
| 1707 | 1707 | <?php |
| 1708 | 1708 | // Add here more div for other menu entries. moduletomainmenu=array('module name'=>'name of class for div') |
| 1709 | 1709 | |
| 1710 | -$moduletomainmenu=array( |
|
| 1711 | - 'user'=>'','syslog'=>'','societe'=>'companies','projet'=>'project','propale'=>'commercial','commande'=>'commercial', |
|
| 1712 | - 'produit'=>'products','service'=>'products','stock'=>'products', |
|
| 1713 | - 'don'=>'accountancy','tax'=>'accountancy','banque'=>'accountancy','facture'=>'accountancy','compta'=>'accountancy','accounting'=>'accountancy','adherent'=>'members','import'=>'tools','export'=>'tools','mailing'=>'tools', |
|
| 1714 | - 'contrat'=>'commercial','ficheinter'=>'commercial','ticketsup'=>'ticketsup','deplacement'=>'commercial', |
|
| 1710 | +$moduletomainmenu = array( |
|
| 1711 | + 'user'=>'', 'syslog'=>'', 'societe'=>'companies', 'projet'=>'project', 'propale'=>'commercial', 'commande'=>'commercial', |
|
| 1712 | + 'produit'=>'products', 'service'=>'products', 'stock'=>'products', |
|
| 1713 | + 'don'=>'accountancy', 'tax'=>'accountancy', 'banque'=>'accountancy', 'facture'=>'accountancy', 'compta'=>'accountancy', 'accounting'=>'accountancy', 'adherent'=>'members', 'import'=>'tools', 'export'=>'tools', 'mailing'=>'tools', |
|
| 1714 | + 'contrat'=>'commercial', 'ficheinter'=>'commercial', 'ticketsup'=>'ticketsup', 'deplacement'=>'commercial', |
|
| 1715 | 1715 | 'fournisseur'=>'companies', |
| 1716 | - 'barcode'=>'','fckeditor'=>'','categorie'=>'', |
|
| 1716 | + 'barcode'=>'', 'fckeditor'=>'', 'categorie'=>'', |
|
| 1717 | 1717 | ); |
| 1718 | -$mainmenuused='home'; |
|
| 1719 | -foreach($conf->modules as $val) |
|
| 1718 | +$mainmenuused = 'home'; |
|
| 1719 | +foreach ($conf->modules as $val) |
|
| 1720 | 1720 | { |
| 1721 | - $mainmenuused.=','.(isset($moduletomainmenu[$val])?$moduletomainmenu[$val]:$val); |
|
| 1721 | + $mainmenuused .= ','.(isset($moduletomainmenu[$val]) ? $moduletomainmenu[$val] : $val); |
|
| 1722 | 1722 | } |
| 1723 | 1723 | //var_dump($mainmenuused); |
| 1724 | -$mainmenuusedarray=array_unique(explode(',',$mainmenuused)); |
|
| 1724 | +$mainmenuusedarray = array_unique(explode(',', $mainmenuused)); |
|
| 1725 | 1725 | |
| 1726 | -$generic=1; |
|
| 1726 | +$generic = 1; |
|
| 1727 | 1727 | // Put here list of menu entries when the div.mainmenu.menuentry was previously defined |
| 1728 | -$divalreadydefined=array('home','companies','products','commercial','externalsite','accountancy','project','tools','members','agenda','ftp','holiday','hrm','bookmark','cashdesk','ecm','geoipmaxmind','gravatar','clicktodial','paypal','stripe','webservices','website'); |
|
| 1728 | +$divalreadydefined = array('home', 'companies', 'products', 'commercial', 'externalsite', 'accountancy', 'project', 'tools', 'members', 'agenda', 'ftp', 'holiday', 'hrm', 'bookmark', 'cashdesk', 'ecm', 'geoipmaxmind', 'gravatar', 'clicktodial', 'paypal', 'stripe', 'webservices', 'website'); |
|
| 1729 | 1729 | // Put here list of menu entries we are sure we don't want |
| 1730 | -$divnotrequired=array('multicurrency','salaries','ticketsup','margin','opensurvey','paybox','expensereport','incoterm','prelevement','propal','workflow','notification','supplier_proposal','cron','product','productbatch','expedition'); |
|
| 1731 | -foreach($mainmenuusedarray as $val) |
|
| 1730 | +$divnotrequired = array('multicurrency', 'salaries', 'ticketsup', 'margin', 'opensurvey', 'paybox', 'expensereport', 'incoterm', 'prelevement', 'propal', 'workflow', 'notification', 'supplier_proposal', 'cron', 'product', 'productbatch', 'expedition'); |
|
| 1731 | +foreach ($mainmenuusedarray as $val) |
|
| 1732 | 1732 | { |
| 1733 | - if (empty($val) || in_array($val,$divalreadydefined)) continue; |
|
| 1734 | - if (in_array($val,$divnotrequired)) continue; |
|
| 1733 | + if (empty($val) || in_array($val, $divalreadydefined)) continue; |
|
| 1734 | + if (in_array($val, $divnotrequired)) continue; |
|
| 1735 | 1735 | //print "XXX".$val; |
| 1736 | 1736 | |
| 1737 | 1737 | // Search img file in module dir |
| 1738 | - $found=0; $url=''; |
|
| 1739 | - foreach($conf->file->dol_document_root as $dirroot) |
|
| 1738 | + $found = 0; $url = ''; |
|
| 1739 | + foreach ($conf->file->dol_document_root as $dirroot) |
|
| 1740 | 1740 | { |
| 1741 | 1741 | if (file_exists($dirroot."/".$val."/img/".$val.".png")) |
| 1742 | 1742 | { |
| 1743 | - $url=dol_buildpath('/'.$val.'/img/'.$val.'.png', 1); |
|
| 1744 | - $found=1; |
|
| 1743 | + $url = dol_buildpath('/'.$val.'/img/'.$val.'.png', 1); |
|
| 1744 | + $found = 1; |
|
| 1745 | 1745 | break; |
| 1746 | 1746 | } |
| 1747 | 1747 | } |
| 1748 | 1748 | // Img file not found |
| 1749 | - if (! $found) |
|
| 1749 | + if (!$found) |
|
| 1750 | 1750 | { |
| 1751 | - $url=dol_buildpath($path.'/theme/'.$theme.'/img/menus/generic'.$generic.".png",1); |
|
| 1752 | - $found=1; |
|
| 1751 | + $url = dol_buildpath($path.'/theme/'.$theme.'/img/menus/generic'.$generic.".png", 1); |
|
| 1752 | + $found = 1; |
|
| 1753 | 1753 | if ($generic < 4) $generic++; |
| 1754 | 1754 | print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n"; |
| 1755 | 1755 | } |
@@ -1891,10 +1891,10 @@ discard block |
||
| 1891 | 1891 | position: absolute; |
| 1892 | 1892 | text-align: <?php print $right; ?>; |
| 1893 | 1893 | <?php print $right; ?>: 0; |
| 1894 | - top: <?php print $disableimages?'4px':'0'; ?>; |
|
| 1894 | + top: <?php print $disableimages ? '4px' : '0'; ?>; |
|
| 1895 | 1895 | font-weight: bold; |
| 1896 | 1896 | max-width: <?php echo $maxwidthloginblock; ?>px; |
| 1897 | - <?php if (GETPOST('optioncss','aZ09') == 'print') { ?> |
|
| 1897 | + <?php if (GETPOST('optioncss', 'aZ09') == 'print') { ?> |
|
| 1898 | 1898 | display: none; |
| 1899 | 1899 | <?php } ?> |
| 1900 | 1900 | } |
@@ -1980,11 +1980,11 @@ discard block |
||
| 1980 | 1980 | background-color: #FFF; |
| 1981 | 1981 | } |
| 1982 | 1982 | .span-icon-user { |
| 1983 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/object_user.png',1); ?>); |
|
| 1983 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/object_user.png', 1); ?>); |
|
| 1984 | 1984 | background-repeat: no-repeat; |
| 1985 | 1985 | } |
| 1986 | 1986 | .span-icon-password { |
| 1987 | - background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/lock.png',1); ?>); |
|
| 1987 | + background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/lock.png', 1); ?>); |
|
| 1988 | 1988 | background-repeat: no-repeat; |
| 1989 | 1989 | } |
| 1990 | 1990 | |
@@ -2005,7 +2005,7 @@ discard block |
||
| 2005 | 2005 | .vmenu { |
| 2006 | 2006 | width: 190px; |
| 2007 | 2007 | margin-left: 6px; |
| 2008 | - <?php if (GETPOST('optioncss','aZ09') == 'print') { ?> |
|
| 2008 | + <?php if (GETPOST('optioncss', 'aZ09') == 'print') { ?> |
|
| 2009 | 2009 | display: none; |
| 2010 | 2010 | <?php } ?> |
| 2011 | 2011 | } |
@@ -2314,7 +2314,7 @@ discard block |
||
| 2314 | 2314 | a.tab:hover |
| 2315 | 2315 | { |
| 2316 | 2316 | /* |
| 2317 | - background: rgba(<?php echo $colorbacktabcard1; ?>, 0.5) url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/nav-overlay3.png',1); ?>) 50% 0 repeat-x; |
|
| 2317 | + background: rgba(<?php echo $colorbacktabcard1; ?>, 0.5) url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/nav-overlay3.png', 1); ?>) 50% 0 repeat-x; |
|
| 2318 | 2318 | color: #<?php echo $colortextbacktab; ?>; |
| 2319 | 2319 | */ |
| 2320 | 2320 | text-decoration: underline; |
@@ -2366,8 +2366,8 @@ discard block |
||
| 2366 | 2366 | |
| 2367 | 2367 | .butAction, .butAction:link, .butAction:visited, .butAction:hover, .butAction:active, .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active { |
| 2368 | 2368 | text-decoration: none; |
| 2369 | - margin: 0em <?php echo ($dol_optimize_smallscreen?'0.7':'0.9'); ?>em !important; |
|
| 2370 | - padding: 0.6em <?php echo ($dol_optimize_smallscreen?'0.4':'0.7'); ?>em; |
|
| 2369 | + margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.7' : '0.9'); ?>em !important; |
|
| 2370 | + padding: 0.6em <?php echo ($dol_optimize_smallscreen ? '0.4' : '0.7'); ?>em; |
|
| 2371 | 2371 | font-family: <?php print $fontlist ?>; |
| 2372 | 2372 | font-weight: normal; |
| 2373 | 2373 | border-color: #c5c5c5; |
@@ -2405,8 +2405,8 @@ discard block |
||
| 2405 | 2405 | text-decoration: none !important; |
| 2406 | 2406 | white-space: nowrap !important; |
| 2407 | 2407 | cursor: not-allowed !important; |
| 2408 | - margin: 0em <?php echo ($dol_optimize_smallscreen?'0.7':'0.9'); ?>em; |
|
| 2409 | - padding: 0.6em <?php echo ($dol_optimize_smallscreen?'0.4':'0.7'); ?>em; |
|
| 2408 | + margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.7' : '0.9'); ?>em; |
|
| 2409 | + padding: 0.6em <?php echo ($dol_optimize_smallscreen ? '0.4' : '0.7'); ?>em; |
|
| 2410 | 2410 | font-family: <?php print $fontlist ?> !important; |
| 2411 | 2411 | font-weight: normal !important; |
| 2412 | 2412 | display: inline-block; |
@@ -2421,7 +2421,7 @@ discard block |
||
| 2421 | 2421 | background-color: transparent ! important; |
| 2422 | 2422 | } |
| 2423 | 2423 | |
| 2424 | -<?php if (! empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) && (! $user->admin)) { ?> |
|
| 2424 | +<?php if (!empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) && (!$user->admin)) { ?> |
|
| 2425 | 2425 | .butActionRefused { |
| 2426 | 2426 | display: none; |
| 2427 | 2427 | } |
@@ -2439,7 +2439,7 @@ discard block |
||
| 2439 | 2439 | |
| 2440 | 2440 | #undertopmenu { |
| 2441 | 2441 | background-repeat: repeat-x; |
| 2442 | - margin-top: <?php echo ($dol_hide_topmenu?'6':'0'); ?>px; |
|
| 2442 | + margin-top: <?php echo ($dol_hide_topmenu ? '6' : '0'); ?>px; |
|
| 2443 | 2443 | } |
| 2444 | 2444 | |
| 2445 | 2445 | |
@@ -2913,7 +2913,7 @@ discard block |
||
| 2913 | 2913 | div.liste_titre_bydiv, .liste_titre div.tagtr, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable thead tr |
| 2914 | 2914 | { |
| 2915 | 2915 | background: rgb(<?php echo $colorbacktitle1; ?>); |
| 2916 | - font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>; |
|
| 2916 | + font-weight: <?php echo $useboldtitle ? 'bold' : 'normal'; ?>; |
|
| 2917 | 2917 | /* border-bottom: 1px solid #ddd; */ |
| 2918 | 2918 | |
| 2919 | 2919 | color: rgb(<?php echo $colortexttitle; ?>); |
@@ -2931,7 +2931,7 @@ discard block |
||
| 2931 | 2931 | tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste_titre div |
| 2932 | 2932 | { |
| 2933 | 2933 | font-family: <?php print $fontlist ?>; |
| 2934 | - font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>; |
|
| 2934 | + font-weight: <?php echo $useboldtitle ? 'bold' : 'normal'; ?>; |
|
| 2935 | 2935 | vertical-align: middle; |
| 2936 | 2936 | height: 24px; |
| 2937 | 2937 | } |
@@ -3260,7 +3260,7 @@ discard block |
||
| 3260 | 3260 | background: rgb(<?php echo $colorbacktitle1; ?>) |
| 3261 | 3261 | color: rgb(<?php echo $colortexttitle; ?>); |
| 3262 | 3262 | font-family: <?php print $fontlist ?>, sans-serif; |
| 3263 | - font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>; |
|
| 3263 | + font-weight: <?php echo $useboldtitle ? 'bold' : 'normal'; ?>; |
|
| 3264 | 3264 | border-bottom: 1px solid #FDFFFF; |
| 3265 | 3265 | white-space: nowrap; |
| 3266 | 3266 | } |
@@ -3423,12 +3423,12 @@ discard block |
||
| 3423 | 3423 | |
| 3424 | 3424 | .logo_setup |
| 3425 | 3425 | { |
| 3426 | - content:url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/logo_setup.svg',1) ?>); /* content is used to best fit the container */ |
|
| 3426 | + content:url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/logo_setup.svg', 1) ?>); /* content is used to best fit the container */ |
|
| 3427 | 3427 | display: inline-block; |
| 3428 | 3428 | } |
| 3429 | 3429 | .nographyet |
| 3430 | 3430 | { |
| 3431 | - content:url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/nographyet.svg',1) ?>); |
|
| 3431 | + content:url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/nographyet.svg', 1) ?>); |
|
| 3432 | 3432 | display: inline-block; |
| 3433 | 3433 | opacity: 0.1; |
| 3434 | 3434 | background-repeat: no-repeat; |
@@ -3562,7 +3562,7 @@ discard block |
||
| 3562 | 3562 | } |
| 3563 | 3563 | |
| 3564 | 3564 | div.ui-tooltip { |
| 3565 | - max-width: <?php print dol_size(600,'width'); ?>px !important; |
|
| 3565 | + max-width: <?php print dol_size(600, 'width'); ?>px !important; |
|
| 3566 | 3566 | } |
| 3567 | 3567 | .mytooltip { |
| 3568 | 3568 | border-top: solid 1px #BBBBBB; |
@@ -3808,7 +3808,7 @@ discard block |
||
| 3808 | 3808 | |
| 3809 | 3809 | .ui-widget-content { border: solid 1px rgba(0,0,0,.3); background: #fff !important; } |
| 3810 | 3810 | |
| 3811 | -.ui-autocomplete-loading { background: white url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/working.gif',1) ?>) right center no-repeat; } |
|
| 3811 | +.ui-autocomplete-loading { background: white url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/working.gif', 1) ?>) right center no-repeat; } |
|
| 3812 | 3812 | .ui-autocomplete { |
| 3813 | 3813 | position:absolute; |
| 3814 | 3814 | width:auto; |
@@ -3839,14 +3839,14 @@ discard block |
||
| 3839 | 3839 | /* ============================================================================== */ |
| 3840 | 3840 | |
| 3841 | 3841 | .editkey_textarea, .editkey_ckeditor, .editkey_string, .editkey_email, .editkey_numeric, .editkey_select, .editkey_autocomplete { |
| 3842 | - background: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/edit.png',1) ?>) right top no-repeat; |
|
| 3842 | + background: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/edit.png', 1) ?>) right top no-repeat; |
|
| 3843 | 3843 | cursor: pointer; |
| 3844 | 3844 | margin-right: 3px; |
| 3845 | 3845 | margin-top: 3px; |
| 3846 | 3846 | } |
| 3847 | 3847 | |
| 3848 | 3848 | .editkey_datepicker { |
| 3849 | - background: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/calendar.png',1) ?>) right center no-repeat; |
|
| 3849 | + background: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/calendar.png', 1) ?>) right center no-repeat; |
|
| 3850 | 3850 | margin-right: 3px; |
| 3851 | 3851 | cursor: pointer; |
| 3852 | 3852 | margin-right: 3px; |
@@ -4025,7 +4025,7 @@ discard block |
||
| 4025 | 4025 | font-family:<?php echo $fontlist; ?>; |
| 4026 | 4026 | font-size:<?php echo $fontsize; ?>px; |
| 4027 | 4027 | } |
| 4028 | -/* .ui-button { margin-left: -2px; <?php print (preg_match('/chrome/',$conf->browser->name)?'padding-top: 1px;':''); ?> } */ |
|
| 4028 | +/* .ui-button { margin-left: -2px; <?php print (preg_match('/chrome/', $conf->browser->name) ? 'padding-top: 1px;' : ''); ?> } */ |
|
| 4029 | 4029 | .ui-button { margin-left: -2px; } |
| 4030 | 4030 | .ui-button-icon-only .ui-button-text { height: 8px; } |
| 4031 | 4031 | .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: 2px 0px 6px 0px; } |
@@ -4207,7 +4207,7 @@ discard block |
||
| 4207 | 4207 | /* ============================================================================== */ |
| 4208 | 4208 | |
| 4209 | 4209 | div.scroll2 { |
| 4210 | - width: <?php print isset($_SESSION['dol_screenwidth'])?max($_SESSION['dol_screenwidth']-830,450):'450'; ?>px !important; |
|
| 4210 | + width: <?php print isset($_SESSION['dol_screenwidth']) ?max($_SESSION['dol_screenwidth'] - 830, 450) : '450'; ?>px !important; |
|
| 4211 | 4211 | } |
| 4212 | 4212 | |
| 4213 | 4213 | .gtaskname div, .gtaskname { |
@@ -4343,9 +4343,9 @@ discard block |
||
| 4343 | 4343 | float: right; |
| 4344 | 4344 | } |
| 4345 | 4345 | |
| 4346 | -.ecmjqft LI.directory { font-weight:normal; background: url(<?php echo dol_buildpath($path.'/theme/common/treemenu/folder2.png',1); ?>) left top no-repeat; } |
|
| 4347 | -.ecmjqft LI.expanded { font-weight:normal; background: url(<?php echo dol_buildpath($path.'/theme/common/treemenu/folder2-expanded.png',1); ?>) left top no-repeat; } |
|
| 4348 | -.ecmjqft LI.wait { font-weight:normal; background: url(<?php echo dol_buildpath('/theme/'.$theme.'/img/working.gif',1); ?>) left top no-repeat; } |
|
| 4346 | +.ecmjqft LI.directory { font-weight:normal; background: url(<?php echo dol_buildpath($path.'/theme/common/treemenu/folder2.png', 1); ?>) left top no-repeat; } |
|
| 4347 | +.ecmjqft LI.expanded { font-weight:normal; background: url(<?php echo dol_buildpath($path.'/theme/common/treemenu/folder2-expanded.png', 1); ?>) left top no-repeat; } |
|
| 4348 | +.ecmjqft LI.wait { font-weight:normal; background: url(<?php echo dol_buildpath('/theme/'.$theme.'/img/working.gif', 1); ?>) left top no-repeat; } |
|
| 4349 | 4349 | |
| 4350 | 4350 | |
| 4351 | 4351 | /* ============================================================================== */ |
@@ -4354,12 +4354,12 @@ discard block |
||
| 4354 | 4354 | |
| 4355 | 4355 | .jnotify-container { |
| 4356 | 4356 | position: fixed !important; |
| 4357 | -<?php if (! empty($conf->global->MAIN_JQUERY_JNOTIFY_BOTTOM)) { ?> |
|
| 4357 | +<?php if (!empty($conf->global->MAIN_JQUERY_JNOTIFY_BOTTOM)) { ?> |
|
| 4358 | 4358 | top: auto !important; |
| 4359 | 4359 | bottom: 4px !important; |
| 4360 | 4360 | <?php } ?> |
| 4361 | 4361 | text-align: center; |
| 4362 | - min-width: <?php echo $dol_optimize_smallscreen?'200':'480'; ?>px; |
|
| 4362 | + min-width: <?php echo $dol_optimize_smallscreen ? '200' : '480'; ?>px; |
|
| 4363 | 4363 | width: auto; |
| 4364 | 4364 | max-width: 1024px; |
| 4365 | 4365 | padding-left: 10px !important; |
@@ -4413,10 +4413,10 @@ discard block |
||
| 4413 | 4413 | table.dataTable tr.odd td.sorting_1, table.dataTable tr.even td.sorting_1 { |
| 4414 | 4414 | background: none !important; |
| 4415 | 4415 | } |
| 4416 | -.sorting_asc { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_asc.png',1); ?>') no-repeat center right !important; } |
|
| 4417 | -.sorting_desc { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_desc.png',1); ?>') no-repeat center right !important; } |
|
| 4418 | -.sorting_asc_disabled { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_asc_disabled.png',1); ?>') no-repeat center right !important; } |
|
| 4419 | -.sorting_desc_disabled { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_desc_disabled.png',1); ?>') no-repeat center right !important; } |
|
| 4416 | +.sorting_asc { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_asc.png', 1); ?>') no-repeat center right !important; } |
|
| 4417 | +.sorting_desc { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_desc.png', 1); ?>') no-repeat center right !important; } |
|
| 4418 | +.sorting_asc_disabled { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_asc_disabled.png', 1); ?>') no-repeat center right !important; } |
|
| 4419 | +.sorting_desc_disabled { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_desc_disabled.png', 1); ?>') no-repeat center right !important; } |
|
| 4420 | 4420 | .dataTables_paginate { |
| 4421 | 4421 | margin-top: 8px; |
| 4422 | 4422 | } |
@@ -5062,10 +5062,10 @@ discard block |
||
| 5062 | 5062 | /* ============================================================================== */ |
| 5063 | 5063 | |
| 5064 | 5064 | .menu_choix1 a { |
| 5065 | - background: url('<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus_black/money.png',1) ?>') top left no-repeat; |
|
| 5065 | + background: url('<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus_black/money.png', 1) ?>') top left no-repeat; |
|
| 5066 | 5066 | } |
| 5067 | 5067 | .menu_choix2 a { |
| 5068 | - background: url('<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus_black/home.png',1) ?>') top left no-repeat; |
|
| 5068 | + background: url('<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus_black/home.png', 1) ?>') top left no-repeat; |
|
| 5069 | 5069 | } |
| 5070 | 5070 | .menu_choix1,.menu_choix2 { |
| 5071 | 5071 | font-size: 1.4em; |
@@ -5146,7 +5146,7 @@ discard block |
||
| 5146 | 5146 | |
| 5147 | 5147 | #tooltip { |
| 5148 | 5148 | position: absolute; |
| 5149 | - width: <?php print dol_size(350,'width'); ?>px; |
|
| 5149 | + width: <?php print dol_size(350, 'width'); ?>px; |
|
| 5150 | 5150 | } |
| 5151 | 5151 | |
| 5152 | 5152 | div.tabBar { |
@@ -5254,7 +5254,7 @@ discard block |
||
| 5254 | 5254 | <?php } ?> |
| 5255 | 5255 | } |
| 5256 | 5256 | div#tmenu_tooltip { |
| 5257 | - <?php if (GETPOST('optioncss','aZ09') == 'print') { ?> |
|
| 5257 | + <?php if (GETPOST('optioncss', 'aZ09') == 'print') { ?> |
|
| 5258 | 5258 | display:none; |
| 5259 | 5259 | <?php } else { ?> |
| 5260 | 5260 | padding-<?php echo $right; ?>: 0; |
@@ -5265,7 +5265,7 @@ discard block |
||
| 5265 | 5265 | width: 100%; |
| 5266 | 5266 | } |
| 5267 | 5267 | div.login_block { |
| 5268 | - <?php if ($conf->browser->layout == 'phone' && ((GETPOST('testmenuhider','int') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> |
|
| 5268 | + <?php if ($conf->browser->layout == 'phone' && ((GETPOST('testmenuhider', 'int') || !empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> |
|
| 5269 | 5269 | /* Style when phone layout or when using the menuhider */ |
| 5270 | 5270 | display: none; |
| 5271 | 5271 | padding-top: 20px; |
@@ -124,51 +124,51 @@ discard block |
||
| 124 | 124 | // Execute jobs |
| 125 | 125 | if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->execute) |
| 126 | 126 | { |
| 127 | - if (! empty($conf->global->CRON_KEY) && $conf->global->CRON_KEY != $securitykey) |
|
| 128 | - { |
|
| 129 | - setEventMessages('Security key '.$securitykey.' is wrong', null, 'errors'); |
|
| 130 | - $action=''; |
|
| 131 | - } |
|
| 132 | - else |
|
| 133 | - { |
|
| 134 | - $object = new Cronjob($db); |
|
| 135 | - $job = $object->fetch($id); |
|
| 136 | - |
|
| 137 | - $now = dol_now(); // Date we start |
|
| 138 | - |
|
| 139 | - $resrunjob = $object->run_jobs($user->login); // Return -1 if KO, 1 if OK |
|
| 140 | - if ($resrunjob < 0) { |
|
| 141 | - setEventMessages($object->error, $object->errors, 'errors'); |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - // Programm next run |
|
| 145 | - $res = $object->reprogram_jobs($user->login, $now); |
|
| 146 | - if ($res > 0) |
|
| 147 | - { |
|
| 148 | - if ($resrunjob >= 0) // We show the result of reprogram only if no error message already reported |
|
| 149 | - { |
|
| 150 | - if ($object->lastresult >= 0) setEventMessages($langs->trans("JobFinished"), null, 'mesgs'); |
|
| 151 | - else setEventMessages($langs->trans("JobFinished"), null, 'errors'); |
|
| 152 | - } |
|
| 153 | - $action=''; |
|
| 154 | - } |
|
| 155 | - else |
|
| 156 | - { |
|
| 157 | - setEventMessages($object->error, $object->errors, 'errors'); |
|
| 158 | - $action=''; |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - $param='&search_status='.urlencode($search_status); |
|
| 162 | - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); |
|
| 163 | - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); |
|
| 164 | - if ($search_label) $param.='&search_label='.urlencode($search_label); |
|
| 165 | - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); |
|
| 166 | - // Add $param from extra fields |
|
| 167 | - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
|
| 168 | - |
|
| 169 | - header("Location: ".DOL_URL_ROOT.'/cron/list.php?'.$param.($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'')); // Make a redirect to avoid to run twice the job when using back |
|
| 170 | - exit; |
|
| 171 | - } |
|
| 127 | + if (! empty($conf->global->CRON_KEY) && $conf->global->CRON_KEY != $securitykey) |
|
| 128 | + { |
|
| 129 | + setEventMessages('Security key '.$securitykey.' is wrong', null, 'errors'); |
|
| 130 | + $action=''; |
|
| 131 | + } |
|
| 132 | + else |
|
| 133 | + { |
|
| 134 | + $object = new Cronjob($db); |
|
| 135 | + $job = $object->fetch($id); |
|
| 136 | + |
|
| 137 | + $now = dol_now(); // Date we start |
|
| 138 | + |
|
| 139 | + $resrunjob = $object->run_jobs($user->login); // Return -1 if KO, 1 if OK |
|
| 140 | + if ($resrunjob < 0) { |
|
| 141 | + setEventMessages($object->error, $object->errors, 'errors'); |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + // Programm next run |
|
| 145 | + $res = $object->reprogram_jobs($user->login, $now); |
|
| 146 | + if ($res > 0) |
|
| 147 | + { |
|
| 148 | + if ($resrunjob >= 0) // We show the result of reprogram only if no error message already reported |
|
| 149 | + { |
|
| 150 | + if ($object->lastresult >= 0) setEventMessages($langs->trans("JobFinished"), null, 'mesgs'); |
|
| 151 | + else setEventMessages($langs->trans("JobFinished"), null, 'errors'); |
|
| 152 | + } |
|
| 153 | + $action=''; |
|
| 154 | + } |
|
| 155 | + else |
|
| 156 | + { |
|
| 157 | + setEventMessages($object->error, $object->errors, 'errors'); |
|
| 158 | + $action=''; |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + $param='&search_status='.urlencode($search_status); |
|
| 162 | + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); |
|
| 163 | + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); |
|
| 164 | + if ($search_label) $param.='&search_label='.urlencode($search_label); |
|
| 165 | + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); |
|
| 166 | + // Add $param from extra fields |
|
| 167 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
|
| 168 | + |
|
| 169 | + header("Location: ".DOL_URL_ROOT.'/cron/list.php?'.$param.($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'')); // Make a redirect to avoid to run twice the job when using back |
|
| 170 | + exit; |
|
| 171 | + } |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // Mass actions |
@@ -274,8 +274,8 @@ discard block |
||
| 274 | 274 | $nbtotalofrecords = ''; |
| 275 | 275 | if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) |
| 276 | 276 | { |
| 277 | - $result = $db->query($sql); |
|
| 278 | - $nbtotalofrecords = $db->num_rows($result); |
|
| 277 | + $result = $db->query($sql); |
|
| 278 | + $nbtotalofrecords = $db->num_rows($result); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | $sql.= $db->plimit($limit+1, $offset); |
@@ -334,11 +334,11 @@ discard block |
||
| 334 | 334 | // Line with explanation and button new job |
| 335 | 335 | if (! $user->rights->cron->create) |
| 336 | 336 | { |
| 337 | - $buttontoshow.='<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("CronCreateJob").'</a>'; |
|
| 337 | + $buttontoshow.='<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("CronCreateJob").'</a>'; |
|
| 338 | 338 | } |
| 339 | 339 | else |
| 340 | 340 | { |
| 341 | - $buttontoshow.='<a class="butAction" style="margin-right: 0px;margin-left: 0px;" href="'.DOL_URL_ROOT.'/cron/card.php?action=create">'.$langs->trans("CronCreateJob").'</a>'; |
|
| 341 | + $buttontoshow.='<a class="butAction" style="margin-right: 0px;margin-left: 0px;" href="'.DOL_URL_ROOT.'/cron/card.php?action=create">'.$langs->trans("CronCreateJob").'</a>'; |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | print_barre_liste($pagetitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_setup', 0, $buttontoshow, '', $limit); |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | print '<td>'; |
| 453 | 453 | if ($obj->jobtype=='method') |
| 454 | 454 | { |
| 455 | - $text=$langs->trans("CronClass"); |
|
| 455 | + $text=$langs->trans("CronClass"); |
|
| 456 | 456 | $texttoshow=$langs->trans('CronModule').': '.$obj->module_name.'<br>'; |
| 457 | 457 | $texttoshow.=$langs->trans('CronClass').': '. $obj->classesname.'<br>'; |
| 458 | 458 | $texttoshow.=$langs->trans('CronObject').': '. $obj->objectname.'<br>'; |
@@ -527,8 +527,8 @@ discard block |
||
| 527 | 527 | } |
| 528 | 528 | if ($user->rights->cron->execute) |
| 529 | 529 | { |
| 530 | - if (!empty($obj->status)) print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=execute'.(empty($conf->global->CRON_KEY)?'':'&securitykey='.$conf->global->CRON_KEY).($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."\" title=\"".dol_escape_htmltag($langs->trans('CronExecute'))."\">".img_picto($langs->trans('CronExecute'),"play").'</a>'; |
|
| 531 | - else print '<a href="#" class="cursordefault" title="'.dol_escape_htmltag($langs->trans('JobDisabled')).'">'.img_picto($langs->trans('JobDisabled'),"playdisabled").'</a>'; |
|
| 530 | + if (!empty($obj->status)) print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=execute'.(empty($conf->global->CRON_KEY)?'':'&securitykey='.$conf->global->CRON_KEY).($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."\" title=\"".dol_escape_htmltag($langs->trans('CronExecute'))."\">".img_picto($langs->trans('CronExecute'),"play").'</a>'; |
|
| 531 | + else print '<a href="#" class="cursordefault" title="'.dol_escape_htmltag($langs->trans('JobDisabled')).'">'.img_picto($langs->trans('JobDisabled'),"playdisabled").'</a>'; |
|
| 532 | 532 | } else { |
| 533 | 533 | print '<a href="#" class="cursornotallowed" title="'.dol_escape_htmltag($langs->trans('NotEnoughPermissions')).'">'.img_picto($langs->trans('NotEnoughPermissions'),"playdisabled").'</a>'; |
| 534 | 534 | } |
@@ -29,37 +29,37 @@ discard block |
||
| 29 | 29 | require_once DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php"; |
| 30 | 30 | require_once DOL_DOCUMENT_ROOT.'/core/lib/cron.lib.php'; |
| 31 | 31 | |
| 32 | -$langs->loadLangs(array("admin","cron","bills")); |
|
| 32 | +$langs->loadLangs(array("admin", "cron", "bills")); |
|
| 33 | 33 | |
| 34 | 34 | if (!$user->rights->cron->read) accessforbidden(); |
| 35 | 35 | |
| 36 | -$action=GETPOST('action','alpha'); |
|
| 37 | -$massaction = GETPOST('massaction','alpha'); // The bulk action (combo box choice into lists) |
|
| 38 | -$confirm=GETPOST('confirm','alpha'); |
|
| 39 | -$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list |
|
| 40 | -$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'cronjoblist'; // To manage different context of search |
|
| 36 | +$action = GETPOST('action', 'alpha'); |
|
| 37 | +$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) |
|
| 38 | +$confirm = GETPOST('confirm', 'alpha'); |
|
| 39 | +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list |
|
| 40 | +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'cronjoblist'; // To manage different context of search |
|
| 41 | 41 | |
| 42 | -$id=GETPOST('id','int'); |
|
| 42 | +$id = GETPOST('id', 'int'); |
|
| 43 | 43 | |
| 44 | -$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; |
|
| 45 | -$sortfield = GETPOST("sortfield",'alpha'); |
|
| 46 | -$sortorder = GETPOST("sortorder",'alpha'); |
|
| 47 | -$page = GETPOST("page",'int'); |
|
| 44 | +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; |
|
| 45 | +$sortfield = GETPOST("sortfield", 'alpha'); |
|
| 46 | +$sortorder = GETPOST("sortorder", 'alpha'); |
|
| 47 | +$page = GETPOST("page", 'int'); |
|
| 48 | 48 | if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 |
| 49 | 49 | $offset = $limit * $page; |
| 50 | 50 | $pageprev = $page - 1; |
| 51 | 51 | $pagenext = $page + 1; |
| 52 | -if (! $sortfield) $sortfield='t.status,t.priority'; |
|
| 53 | -if (! $sortorder) $sortorder='DESC,ASC'; |
|
| 52 | +if (!$sortfield) $sortfield = 't.status,t.priority'; |
|
| 53 | +if (!$sortorder) $sortorder = 'DESC,ASC'; |
|
| 54 | 54 | |
| 55 | -$search_status=GETPOST('search_status','int')?GETPOST('search_status','int'):GETPOST('status','int'); |
|
| 56 | -if ($search_status == '') $search_status=-2; |
|
| 55 | +$search_status = GETPOST('search_status', 'int') ?GETPOST('search_status', 'int') : GETPOST('status', 'int'); |
|
| 56 | +if ($search_status == '') $search_status = -2; |
|
| 57 | 57 | |
| 58 | 58 | //Search criteria |
| 59 | -$search_label=GETPOST("search_label",'alpha'); |
|
| 60 | -$securitykey = GETPOST('securitykey','alpha'); |
|
| 59 | +$search_label = GETPOST("search_label", 'alpha'); |
|
| 60 | +$securitykey = GETPOST('securitykey', 'alpha'); |
|
| 61 | 61 | |
| 62 | -$diroutputmassaction=$conf->cronjob->dir_output . '/temp/massgeneration/'.$user->id; |
|
| 62 | +$diroutputmassaction = $conf->cronjob->dir_output.'/temp/massgeneration/'.$user->id; |
|
| 63 | 63 | |
| 64 | 64 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
| 65 | 65 | $hookmanager->initHooks(array('cronjoblist')); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | // fetch optionals attributes and labels |
| 69 | 69 | $extralabels = $extrafields->fetch_name_optionals_label('cronjob'); |
| 70 | -$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); |
|
| 70 | +$search_array_options = $extrafields->getOptionalsFromPost($extralabels, '', 'search_'); |
|
| 71 | 71 | |
| 72 | 72 | $object = new Cronjob($db); |
| 73 | 73 | |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | * Actions |
| 77 | 77 | */ |
| 78 | 78 | |
| 79 | -if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; } |
|
| 80 | -if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } |
|
| 79 | +if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } |
|
| 80 | +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } |
|
| 81 | 81 | |
| 82 | -$parameters=array(); |
|
| 83 | -$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 82 | +$parameters = array(); |
|
| 83 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 84 | 84 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 85 | 85 | |
| 86 | 86 | if (empty($reshook)) |
@@ -89,23 +89,23 @@ discard block |
||
| 89 | 89 | include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
| 90 | 90 | |
| 91 | 91 | // Purge search criteria |
| 92 | - if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers |
|
| 92 | + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers |
|
| 93 | 93 | { |
| 94 | - $search_label=''; |
|
| 95 | - $search_status=-1; |
|
| 96 | - $toselect=''; |
|
| 97 | - $search_array_options=array(); |
|
| 94 | + $search_label = ''; |
|
| 95 | + $search_status = -1; |
|
| 96 | + $toselect = ''; |
|
| 97 | + $search_array_options = array(); |
|
| 98 | 98 | } |
| 99 | - if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha') |
|
| 100 | - || GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha')) |
|
| 99 | + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') |
|
| 100 | + || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) |
|
| 101 | 101 | { |
| 102 | - $massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation |
|
| 102 | + $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - $filter=array(); |
|
| 105 | + $filter = array(); |
|
| 106 | 106 | if (!empty($search_label)) |
| 107 | 107 | { |
| 108 | - $filter['t.label']=$search_label; |
|
| 108 | + $filter['t.label'] = $search_label; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | // Delete jobs |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | { |
| 114 | 114 | //Delete cron task |
| 115 | 115 | $object = new Cronjob($db); |
| 116 | - $object->id=$id; |
|
| 116 | + $object->id = $id; |
|
| 117 | 117 | $result = $object->delete($user); |
| 118 | 118 | |
| 119 | 119 | if ($result < 0) { |
@@ -124,19 +124,19 @@ discard block |
||
| 124 | 124 | // Execute jobs |
| 125 | 125 | if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->execute) |
| 126 | 126 | { |
| 127 | - if (! empty($conf->global->CRON_KEY) && $conf->global->CRON_KEY != $securitykey) |
|
| 127 | + if (!empty($conf->global->CRON_KEY) && $conf->global->CRON_KEY != $securitykey) |
|
| 128 | 128 | { |
| 129 | 129 | setEventMessages('Security key '.$securitykey.' is wrong', null, 'errors'); |
| 130 | - $action=''; |
|
| 130 | + $action = ''; |
|
| 131 | 131 | } |
| 132 | 132 | else |
| 133 | 133 | { |
| 134 | 134 | $object = new Cronjob($db); |
| 135 | 135 | $job = $object->fetch($id); |
| 136 | 136 | |
| 137 | - $now = dol_now(); // Date we start |
|
| 137 | + $now = dol_now(); // Date we start |
|
| 138 | 138 | |
| 139 | - $resrunjob = $object->run_jobs($user->login); // Return -1 if KO, 1 if OK |
|
| 139 | + $resrunjob = $object->run_jobs($user->login); // Return -1 if KO, 1 if OK |
|
| 140 | 140 | if ($resrunjob < 0) { |
| 141 | 141 | setEventMessages($object->error, $object->errors, 'errors'); |
| 142 | 142 | } |
@@ -150,39 +150,39 @@ discard block |
||
| 150 | 150 | if ($object->lastresult >= 0) setEventMessages($langs->trans("JobFinished"), null, 'mesgs'); |
| 151 | 151 | else setEventMessages($langs->trans("JobFinished"), null, 'errors'); |
| 152 | 152 | } |
| 153 | - $action=''; |
|
| 153 | + $action = ''; |
|
| 154 | 154 | } |
| 155 | 155 | else |
| 156 | 156 | { |
| 157 | 157 | setEventMessages($object->error, $object->errors, 'errors'); |
| 158 | - $action=''; |
|
| 158 | + $action = ''; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - $param='&search_status='.urlencode($search_status); |
|
| 162 | - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); |
|
| 163 | - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); |
|
| 164 | - if ($search_label) $param.='&search_label='.urlencode($search_label); |
|
| 165 | - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); |
|
| 161 | + $param = '&search_status='.urlencode($search_status); |
|
| 162 | + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); |
|
| 163 | + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); |
|
| 164 | + if ($search_label) $param .= '&search_label='.urlencode($search_label); |
|
| 165 | + if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); |
|
| 166 | 166 | // Add $param from extra fields |
| 167 | 167 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
| 168 | 168 | |
| 169 | - header("Location: ".DOL_URL_ROOT.'/cron/list.php?'.$param.($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'')); // Make a redirect to avoid to run twice the job when using back |
|
| 169 | + header("Location: ".DOL_URL_ROOT.'/cron/list.php?'.$param.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '')); // Make a redirect to avoid to run twice the job when using back |
|
| 170 | 170 | exit; |
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // Mass actions |
| 175 | - $objectclass='CronJob'; |
|
| 176 | - $objectlabel='CronJob'; |
|
| 175 | + $objectclass = 'CronJob'; |
|
| 176 | + $objectlabel = 'CronJob'; |
|
| 177 | 177 | $permtoread = $user->rights->cron->read; |
| 178 | - $permtocreate = $user->rights->cron->create?$user->rights->cron->create:$user->rights->cron->write; |
|
| 178 | + $permtocreate = $user->rights->cron->create ? $user->rights->cron->create : $user->rights->cron->write; |
|
| 179 | 179 | $permtodelete = $user->rights->cron->delete; |
| 180 | 180 | $uploaddir = $conf->cron->dir_output; |
| 181 | 181 | include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; |
| 182 | 182 | if ($permtocreate) |
| 183 | 183 | { |
| 184 | 184 | $tmpcron = new Cronjob($db); |
| 185 | - foreach($toselect as $id) |
|
| 185 | + foreach ($toselect as $id) |
|
| 186 | 186 | { |
| 187 | 187 | $result = $tmpcron->fetch($id); |
| 188 | 188 | if ($result) |
@@ -209,66 +209,66 @@ discard block |
||
| 209 | 209 | $form = new Form($db); |
| 210 | 210 | $cronjob = new Cronjob($db); |
| 211 | 211 | |
| 212 | -$pagetitle=$langs->trans("CronList"); |
|
| 212 | +$pagetitle = $langs->trans("CronList"); |
|
| 213 | 213 | |
| 214 | -llxHeader('',$pagetitle); |
|
| 214 | +llxHeader('', $pagetitle); |
|
| 215 | 215 | |
| 216 | 216 | |
| 217 | 217 | $sql = "SELECT"; |
| 218 | -$sql.= " t.rowid,"; |
|
| 219 | -$sql.= " t.tms,"; |
|
| 220 | -$sql.= " t.datec,"; |
|
| 221 | -$sql.= " t.jobtype,"; |
|
| 222 | -$sql.= " t.label,"; |
|
| 223 | -$sql.= " t.command,"; |
|
| 224 | -$sql.= " t.classesname,"; |
|
| 225 | -$sql.= " t.objectname,"; |
|
| 226 | -$sql.= " t.methodename,"; |
|
| 227 | -$sql.= " t.params,"; |
|
| 228 | -$sql.= " t.md5params,"; |
|
| 229 | -$sql.= " t.module_name,"; |
|
| 230 | -$sql.= " t.priority,"; |
|
| 231 | -$sql.= " t.datelastrun,"; |
|
| 232 | -$sql.= " t.datenextrun,"; |
|
| 233 | -$sql.= " t.dateend,"; |
|
| 234 | -$sql.= " t.datestart,"; |
|
| 235 | -$sql.= " t.lastresult,"; |
|
| 236 | -$sql.= " t.datelastresult,"; |
|
| 237 | -$sql.= " t.lastoutput,"; |
|
| 238 | -$sql.= " t.unitfrequency,"; |
|
| 239 | -$sql.= " t.frequency,"; |
|
| 240 | -$sql.= " t.status,"; |
|
| 241 | -$sql.= " t.fk_user_author,"; |
|
| 242 | -$sql.= " t.fk_user_mod,"; |
|
| 243 | -$sql.= " t.note,"; |
|
| 244 | -$sql.= " t.nbrun,"; |
|
| 245 | -$sql.= " t.libname,"; |
|
| 246 | -$sql.= " t.test"; |
|
| 247 | -$sql.= " FROM ".MAIN_DB_PREFIX."cronjob as t"; |
|
| 248 | -$sql.= " WHERE 1 = 1"; |
|
| 249 | -if ($search_status >= 0 && $search_status < 2) $sql.= " AND t.status = ".(empty($search_status)?'0':'1'); |
|
| 250 | -if ($search_status == 2) $sql.= " AND t.status = 2"; |
|
| 218 | +$sql .= " t.rowid,"; |
|
| 219 | +$sql .= " t.tms,"; |
|
| 220 | +$sql .= " t.datec,"; |
|
| 221 | +$sql .= " t.jobtype,"; |
|
| 222 | +$sql .= " t.label,"; |
|
| 223 | +$sql .= " t.command,"; |
|
| 224 | +$sql .= " t.classesname,"; |
|
| 225 | +$sql .= " t.objectname,"; |
|
| 226 | +$sql .= " t.methodename,"; |
|
| 227 | +$sql .= " t.params,"; |
|
| 228 | +$sql .= " t.md5params,"; |
|
| 229 | +$sql .= " t.module_name,"; |
|
| 230 | +$sql .= " t.priority,"; |
|
| 231 | +$sql .= " t.datelastrun,"; |
|
| 232 | +$sql .= " t.datenextrun,"; |
|
| 233 | +$sql .= " t.dateend,"; |
|
| 234 | +$sql .= " t.datestart,"; |
|
| 235 | +$sql .= " t.lastresult,"; |
|
| 236 | +$sql .= " t.datelastresult,"; |
|
| 237 | +$sql .= " t.lastoutput,"; |
|
| 238 | +$sql .= " t.unitfrequency,"; |
|
| 239 | +$sql .= " t.frequency,"; |
|
| 240 | +$sql .= " t.status,"; |
|
| 241 | +$sql .= " t.fk_user_author,"; |
|
| 242 | +$sql .= " t.fk_user_mod,"; |
|
| 243 | +$sql .= " t.note,"; |
|
| 244 | +$sql .= " t.nbrun,"; |
|
| 245 | +$sql .= " t.libname,"; |
|
| 246 | +$sql .= " t.test"; |
|
| 247 | +$sql .= " FROM ".MAIN_DB_PREFIX."cronjob as t"; |
|
| 248 | +$sql .= " WHERE 1 = 1"; |
|
| 249 | +if ($search_status >= 0 && $search_status < 2) $sql .= " AND t.status = ".(empty($search_status) ? '0' : '1'); |
|
| 250 | +if ($search_status == 2) $sql .= " AND t.status = 2"; |
|
| 251 | 251 | //Manage filter |
| 252 | -if (is_array($filter) && count($filter)>0) { |
|
| 253 | - foreach($filter as $key => $value) { |
|
| 254 | - $sql.= ' AND '.$key.' LIKE \'%'.$value.'%\''; |
|
| 252 | +if (is_array($filter) && count($filter) > 0) { |
|
| 253 | + foreach ($filter as $key => $value) { |
|
| 254 | + $sql .= ' AND '.$key.' LIKE \'%'.$value.'%\''; |
|
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | $sqlwhere = array(); |
| 258 | 258 | if (!empty($module_name)) { |
| 259 | - $sqlwhere[]='(t.module_name='.$module_name.')'; |
|
| 259 | + $sqlwhere[] = '(t.module_name='.$module_name.')'; |
|
| 260 | 260 | } |
| 261 | -if (count($sqlwhere)>0) { |
|
| 262 | - $sql.= " WHERE ".implode(' AND ',$sqlwhere); |
|
| 261 | +if (count($sqlwhere) > 0) { |
|
| 262 | + $sql .= " WHERE ".implode(' AND ', $sqlwhere); |
|
| 263 | 263 | } |
| 264 | 264 | // Add where from extra fields |
| 265 | 265 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; |
| 266 | 266 | // Add where from hooks |
| 267 | -$parameters=array(); |
|
| 268 | -$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook |
|
| 269 | -$sql.=$hookmanager->resPrint; |
|
| 267 | +$parameters = array(); |
|
| 268 | +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook |
|
| 269 | +$sql .= $hookmanager->resPrint; |
|
| 270 | 270 | |
| 271 | -$sql.= $db->order($sortfield,$sortorder); |
|
| 271 | +$sql .= $db->order($sortfield, $sortorder); |
|
| 272 | 272 | |
| 273 | 273 | // Count total nb of records |
| 274 | 274 | $nbtotalofrecords = ''; |
@@ -278,21 +278,21 @@ discard block |
||
| 278 | 278 | $nbtotalofrecords = $db->num_rows($result); |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | -$sql.= $db->plimit($limit+1, $offset); |
|
| 281 | +$sql .= $db->plimit($limit + 1, $offset); |
|
| 282 | 282 | |
| 283 | -$result=$db->query($sql); |
|
| 284 | -if (! $result) dol_print_error($db); |
|
| 283 | +$result = $db->query($sql); |
|
| 284 | +if (!$result) dol_print_error($db); |
|
| 285 | 285 | |
| 286 | 286 | $num = $db->num_rows($result); |
| 287 | 287 | |
| 288 | -$arrayofselected=is_array($toselect)?$toselect:array(); |
|
| 288 | +$arrayofselected = is_array($toselect) ? $toselect : array(); |
|
| 289 | 289 | |
| 290 | 290 | $param = ''; |
| 291 | -if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; |
|
| 292 | -if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; |
|
| 293 | -if ($search_status) $param.='&search_status='.$search_status; |
|
| 294 | -if ($search_label) $param.='&search_label='.$search_label; |
|
| 295 | -if ($optioncss != '') $param.='&optioncss='.$optioncss; |
|
| 291 | +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; |
|
| 292 | +if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; |
|
| 293 | +if ($search_status) $param .= '&search_status='.$search_status; |
|
| 294 | +if ($search_label) $param .= '&search_label='.$search_label; |
|
| 295 | +if ($optioncss != '') $param .= '&optioncss='.$optioncss; |
|
| 296 | 296 | // Add $param from extra fields |
| 297 | 297 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
| 298 | 298 | |
@@ -300,23 +300,23 @@ discard block |
||
| 300 | 300 | |
| 301 | 301 | if ($action == 'delete') |
| 302 | 302 | { |
| 303 | - print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.$param,$langs->trans("CronDelete"), $langs->trans("CronConfirmDelete"),"confirm_delete",'','',1); |
|
| 303 | + print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.$param, $langs->trans("CronDelete"), $langs->trans("CronConfirmDelete"), "confirm_delete", '', '', 1); |
|
| 304 | 304 | } |
| 305 | 305 | if ($action == 'execute') |
| 306 | 306 | { |
| 307 | - print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.'&securitykey='.$securitykey.$param, $langs->trans("CronExecute"),$langs->trans("CronConfirmExecute"),"confirm_execute",'','',1); |
|
| 307 | + print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.'&securitykey='.$securitykey.$param, $langs->trans("CronExecute"), $langs->trans("CronConfirmExecute"), "confirm_execute", '', '', 1); |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | // List of mass actions available |
| 311 | -$arrayofmassactions = array( |
|
| 311 | +$arrayofmassactions = array( |
|
| 312 | 312 | //'presend'=>$langs->trans("SendByMail"), |
| 313 | 313 | //'builddoc'=>$langs->trans("PDFMerge"), |
| 314 | 314 | 'enable'=>$langs->trans("Enable"), |
| 315 | 315 | 'disable'=>$langs->trans("Disable"), |
| 316 | 316 | ); |
| 317 | -if ($user->rights->mymodule->delete) $arrayofmassactions['predelete']=$langs->trans("Delete"); |
|
| 318 | -if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); |
|
| 319 | -$massactionbutton=$form->selectMassAction('', $arrayofmassactions); |
|
| 317 | +if ($user->rights->mymodule->delete) $arrayofmassactions['predelete'] = $langs->trans("Delete"); |
|
| 318 | +if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); |
|
| 319 | +$massactionbutton = $form->selectMassAction('', $arrayofmassactions); |
|
| 320 | 320 | |
| 321 | 321 | |
| 322 | 322 | print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'" name="search_form">'."\n"; |
@@ -332,13 +332,13 @@ discard block |
||
| 332 | 332 | print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">'; |
| 333 | 333 | |
| 334 | 334 | // Line with explanation and button new job |
| 335 | -if (! $user->rights->cron->create) |
|
| 335 | +if (!$user->rights->cron->create) |
|
| 336 | 336 | { |
| 337 | - $buttontoshow.='<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("CronCreateJob").'</a>'; |
|
| 337 | + $buttontoshow .= '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("CronCreateJob").'</a>'; |
|
| 338 | 338 | } |
| 339 | 339 | else |
| 340 | 340 | { |
| 341 | - $buttontoshow.='<a class="butAction" style="margin-right: 0px;margin-left: 0px;" href="'.DOL_URL_ROOT.'/cron/card.php?action=create">'.$langs->trans("CronCreateJob").'</a>'; |
|
| 341 | + $buttontoshow .= '<a class="butAction" style="margin-right: 0px;margin-left: 0px;" href="'.DOL_URL_ROOT.'/cron/card.php?action=create">'.$langs->trans("CronCreateJob").'</a>'; |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | print_barre_liste($pagetitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_setup', 0, $buttontoshow, '', $limit); |
@@ -346,15 +346,15 @@ discard block |
||
| 346 | 346 | |
| 347 | 347 | print $langs->trans('CronInfo').'<br>'; |
| 348 | 348 | |
| 349 | -$text =$langs->trans("HoursOnThisPageAreOnServerTZ").' '.$stringcurrentdate.'<br>'; |
|
| 350 | -if (! empty($conf->global->CRON_WARNING_DELAY_HOURS)) $text.=$langs->trans("WarningCronDelayed", $conf->global->CRON_WARNING_DELAY_HOURS); |
|
| 349 | +$text = $langs->trans("HoursOnThisPageAreOnServerTZ").' '.$stringcurrentdate.'<br>'; |
|
| 350 | +if (!empty($conf->global->CRON_WARNING_DELAY_HOURS)) $text .= $langs->trans("WarningCronDelayed", $conf->global->CRON_WARNING_DELAY_HOURS); |
|
| 351 | 351 | print info_admin($text); |
| 352 | 352 | print '<br>'; |
| 353 | 353 | |
| 354 | -$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; |
|
| 355 | -$selectedfields=''; |
|
| 354 | +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; |
|
| 355 | +$selectedfields = ''; |
|
| 356 | 356 | //$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields |
| 357 | -$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); |
|
| 357 | +$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); |
|
| 358 | 358 | |
| 359 | 359 | print '<div class="div-table-responsive">'; |
| 360 | 360 | print '<table class="noborder">'; |
@@ -378,44 +378,44 @@ discard block |
||
| 378 | 378 | print '<td class="liste_titre" align="center">'; |
| 379 | 379 | print $form->selectarray('search_status', array('0'=>$langs->trans("Disabled"), '1'=>$langs->trans("Enabled"), '-2'=>$langs->trans("EnabledAndDisabled"), '2'=>$langs->trans("Archived")), $search_status, 1); |
| 380 | 380 | print '</td><td class="liste_titre" align="right">'; |
| 381 | -$searchpicto=$form->showFilterButtons(); |
|
| 381 | +$searchpicto = $form->showFilterButtons(); |
|
| 382 | 382 | print $searchpicto; |
| 383 | 383 | print '</td>'; |
| 384 | 384 | print '</tr>'; |
| 385 | 385 | |
| 386 | 386 | print '<tr class="liste_titre">'; |
| 387 | -print_liste_field_titre("ID",$_SERVER["PHP_SELF"],"t.rowid","",$param,'',$sortfield,$sortorder); |
|
| 388 | -print_liste_field_titre("CronLabel",$_SERVER["PHP_SELF"],"t.label","",$param,'',$sortfield,$sortorder); |
|
| 389 | -print_liste_field_titre("Prority",$_SERVER["PHP_SELF"],"t.priority","",$param,'',$sortfield,$sortorder); |
|
| 390 | -print_liste_field_titre("CronTask",'','',"",$param,'',$sortfield,$sortorder); |
|
| 391 | -print_liste_field_titre("CronFrequency",'',"","",$param,'',$sortfield,$sortorder); |
|
| 392 | -print_liste_field_titre("CronDtStart",$_SERVER["PHP_SELF"],"t.datestart","",$param,'align="center"',$sortfield,$sortorder); |
|
| 393 | -print_liste_field_titre("CronDtEnd",$_SERVER["PHP_SELF"],"t.dateend","",$param,'align="center"',$sortfield,$sortorder); |
|
| 394 | -print_liste_field_titre("CronMaxRun",$_SERVER["PHP_SELF"],"t.maxrun","",$param,'align="right"',$sortfield,$sortorder); |
|
| 395 | -print_liste_field_titre("CronNbRun",$_SERVER["PHP_SELF"],"t.nbrun","",$param,'align="right"',$sortfield,$sortorder); |
|
| 396 | -print_liste_field_titre("CronDtLastLaunch",$_SERVER["PHP_SELF"],"t.datelastrun","",$param,'align="center"',$sortfield,$sortorder); |
|
| 397 | -print_liste_field_titre("CronLastResult",$_SERVER["PHP_SELF"],"t.lastresult","",$param,'align="center"',$sortfield,$sortorder); |
|
| 398 | -print_liste_field_titre("CronLastOutput",$_SERVER["PHP_SELF"],"t.lastoutput","",$param,'',$sortfield,$sortorder); |
|
| 399 | -print_liste_field_titre("CronDtNextLaunch",$_SERVER["PHP_SELF"],"t.datenextrun","",$param,'align="center"',$sortfield,$sortorder); |
|
| 400 | -print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"t.status,t.priority","",$param,'align="center"',$sortfield,$sortorder); |
|
| 401 | -print_liste_field_titre($selectedfields,$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder,'maxwidthsearch '); |
|
| 387 | +print_liste_field_titre("ID", $_SERVER["PHP_SELF"], "t.rowid", "", $param, '', $sortfield, $sortorder); |
|
| 388 | +print_liste_field_titre("CronLabel", $_SERVER["PHP_SELF"], "t.label", "", $param, '', $sortfield, $sortorder); |
|
| 389 | +print_liste_field_titre("Prority", $_SERVER["PHP_SELF"], "t.priority", "", $param, '', $sortfield, $sortorder); |
|
| 390 | +print_liste_field_titre("CronTask", '', '', "", $param, '', $sortfield, $sortorder); |
|
| 391 | +print_liste_field_titre("CronFrequency", '', "", "", $param, '', $sortfield, $sortorder); |
|
| 392 | +print_liste_field_titre("CronDtStart", $_SERVER["PHP_SELF"], "t.datestart", "", $param, 'align="center"', $sortfield, $sortorder); |
|
| 393 | +print_liste_field_titre("CronDtEnd", $_SERVER["PHP_SELF"], "t.dateend", "", $param, 'align="center"', $sortfield, $sortorder); |
|
| 394 | +print_liste_field_titre("CronMaxRun", $_SERVER["PHP_SELF"], "t.maxrun", "", $param, 'align="right"', $sortfield, $sortorder); |
|
| 395 | +print_liste_field_titre("CronNbRun", $_SERVER["PHP_SELF"], "t.nbrun", "", $param, 'align="right"', $sortfield, $sortorder); |
|
| 396 | +print_liste_field_titre("CronDtLastLaunch", $_SERVER["PHP_SELF"], "t.datelastrun", "", $param, 'align="center"', $sortfield, $sortorder); |
|
| 397 | +print_liste_field_titre("CronLastResult", $_SERVER["PHP_SELF"], "t.lastresult", "", $param, 'align="center"', $sortfield, $sortorder); |
|
| 398 | +print_liste_field_titre("CronLastOutput", $_SERVER["PHP_SELF"], "t.lastoutput", "", $param, '', $sortfield, $sortorder); |
|
| 399 | +print_liste_field_titre("CronDtNextLaunch", $_SERVER["PHP_SELF"], "t.datenextrun", "", $param, 'align="center"', $sortfield, $sortorder); |
|
| 400 | +print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "t.status,t.priority", "", $param, 'align="center"', $sortfield, $sortorder); |
|
| 401 | +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", "", $param, 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); |
|
| 402 | 402 | print "</tr>\n"; |
| 403 | 403 | |
| 404 | 404 | |
| 405 | 405 | if ($num > 0) |
| 406 | 406 | { |
| 407 | 407 | // Loop on each job |
| 408 | - $style='pair'; |
|
| 408 | + $style = 'pair'; |
|
| 409 | 409 | $now = dol_now(); |
| 410 | - $i=0; |
|
| 411 | - $var=true; |
|
| 412 | - $totalarray=array(); |
|
| 413 | - while ($i < min($num,$limit)) |
|
| 410 | + $i = 0; |
|
| 411 | + $var = true; |
|
| 412 | + $totalarray = array(); |
|
| 413 | + while ($i < min($num, $limit)) |
|
| 414 | 414 | { |
| 415 | 415 | $obj = $db->fetch_object($result); |
| 416 | 416 | |
| 417 | 417 | if (empty($obj)) break; |
| 418 | - if (! verifCond($obj->test)) continue; // Discard line with test = false |
|
| 418 | + if (!verifCond($obj->test)) continue; // Discard line with test = false |
|
| 419 | 419 | |
| 420 | 420 | $object->id = $obj->rowid; |
| 421 | 421 | $object->ref = $obj->rowid; |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | |
| 433 | 433 | // Label |
| 434 | 434 | print '<td>'; |
| 435 | - if (! empty($obj->label)) |
|
| 435 | + if (!empty($obj->label)) |
|
| 436 | 436 | { |
| 437 | 437 | $object->ref = $langs->trans($obj->label); |
| 438 | 438 | print $object->getNomUrl(0, '', 1); |
@@ -450,63 +450,63 @@ discard block |
||
| 450 | 450 | print '</td>'; |
| 451 | 451 | |
| 452 | 452 | print '<td>'; |
| 453 | - if ($obj->jobtype=='method') |
|
| 453 | + if ($obj->jobtype == 'method') |
|
| 454 | 454 | { |
| 455 | - $text=$langs->trans("CronClass"); |
|
| 456 | - $texttoshow=$langs->trans('CronModule').': '.$obj->module_name.'<br>'; |
|
| 457 | - $texttoshow.=$langs->trans('CronClass').': '. $obj->classesname.'<br>'; |
|
| 458 | - $texttoshow.=$langs->trans('CronObject').': '. $obj->objectname.'<br>'; |
|
| 459 | - $texttoshow.=$langs->trans('CronMethod').': '. $obj->methodename; |
|
| 460 | - $texttoshow.='<br>'.$langs->trans('CronArgs').': '. $obj->params; |
|
| 461 | - $texttoshow.='<br>'.$langs->trans('Comment').': '. $langs->trans($obj->note); |
|
| 455 | + $text = $langs->trans("CronClass"); |
|
| 456 | + $texttoshow = $langs->trans('CronModule').': '.$obj->module_name.'<br>'; |
|
| 457 | + $texttoshow .= $langs->trans('CronClass').': '.$obj->classesname.'<br>'; |
|
| 458 | + $texttoshow .= $langs->trans('CronObject').': '.$obj->objectname.'<br>'; |
|
| 459 | + $texttoshow .= $langs->trans('CronMethod').': '.$obj->methodename; |
|
| 460 | + $texttoshow .= '<br>'.$langs->trans('CronArgs').': '.$obj->params; |
|
| 461 | + $texttoshow .= '<br>'.$langs->trans('Comment').': '.$langs->trans($obj->note); |
|
| 462 | 462 | } |
| 463 | - elseif ($obj->jobtype=='command') |
|
| 463 | + elseif ($obj->jobtype == 'command') |
|
| 464 | 464 | { |
| 465 | - $text=$langs->trans('CronCommand'); |
|
| 466 | - $texttoshow=$langs->trans('CronCommand').': '.dol_trunc($obj->command); |
|
| 467 | - $texttoshow.='<br>'.$langs->trans('CronArgs').': '. $obj->params; |
|
| 468 | - $texttoshow.='<br>'.$langs->trans('Comment').': '. $langs->trans($obj->note); |
|
| 465 | + $text = $langs->trans('CronCommand'); |
|
| 466 | + $texttoshow = $langs->trans('CronCommand').': '.dol_trunc($obj->command); |
|
| 467 | + $texttoshow .= '<br>'.$langs->trans('CronArgs').': '.$obj->params; |
|
| 468 | + $texttoshow .= '<br>'.$langs->trans('Comment').': '.$langs->trans($obj->note); |
|
| 469 | 469 | } |
| 470 | 470 | print $form->textwithpicto($text, $texttoshow, 1); |
| 471 | 471 | print '</td>'; |
| 472 | 472 | |
| 473 | 473 | print '<td>'; |
| 474 | - if($obj->unitfrequency == "60") print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Minutes'); |
|
| 475 | - if($obj->unitfrequency == "3600") print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Hours'); |
|
| 476 | - if($obj->unitfrequency == "86400") print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Days'); |
|
| 477 | - if($obj->unitfrequency == "604800") print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Weeks'); |
|
| 474 | + if ($obj->unitfrequency == "60") print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Minutes'); |
|
| 475 | + if ($obj->unitfrequency == "3600") print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Hours'); |
|
| 476 | + if ($obj->unitfrequency == "86400") print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Days'); |
|
| 477 | + if ($obj->unitfrequency == "604800") print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Weeks'); |
|
| 478 | 478 | print '</td>'; |
| 479 | 479 | |
| 480 | 480 | print '<td class="center">'; |
| 481 | - if(!empty($obj->datestart)) {print dol_print_date($db->jdate($obj->datestart),'dayhour');} |
|
| 481 | + if (!empty($obj->datestart)) {print dol_print_date($db->jdate($obj->datestart), 'dayhour'); } |
|
| 482 | 482 | print '</td>'; |
| 483 | 483 | |
| 484 | 484 | print '<td class="center">'; |
| 485 | - if(!empty($obj->dateend)) {print dol_print_date($db->jdate($obj->dateend),'dayhour');} |
|
| 485 | + if (!empty($obj->dateend)) {print dol_print_date($db->jdate($obj->dateend), 'dayhour'); } |
|
| 486 | 486 | print '</td>'; |
| 487 | 487 | |
| 488 | 488 | print '<td align="right">'; |
| 489 | - if (!empty($obj->maxrun)) {print $obj->maxrun;} |
|
| 489 | + if (!empty($obj->maxrun)) {print $obj->maxrun; } |
|
| 490 | 490 | print '</td>'; |
| 491 | 491 | |
| 492 | 492 | print '<td align="right">'; |
| 493 | - if (!empty($obj->nbrun)) {print $obj->nbrun;} else {print '0';} |
|
| 493 | + if (!empty($obj->nbrun)) {print $obj->nbrun; } else {print '0'; } |
|
| 494 | 494 | print '</td>'; |
| 495 | 495 | |
| 496 | 496 | print '<td class="center">'; |
| 497 | - if(!empty($obj->datelastrun)) {print dol_print_date($db->jdate($obj->datelastrun),'dayhour');} |
|
| 497 | + if (!empty($obj->datelastrun)) {print dol_print_date($db->jdate($obj->datelastrun), 'dayhour'); } |
|
| 498 | 498 | print '</td>'; |
| 499 | 499 | |
| 500 | 500 | print '<td class="center">'; |
| 501 | - if ($obj->lastresult != '') {print dol_trunc($obj->lastresult);} |
|
| 501 | + if ($obj->lastresult != '') {print dol_trunc($obj->lastresult); } |
|
| 502 | 502 | print '</td>'; |
| 503 | 503 | |
| 504 | 504 | print '<td>'; |
| 505 | - if(!empty($obj->lastoutput)) {print dol_trunc(nl2br($obj->lastoutput),50);} |
|
| 505 | + if (!empty($obj->lastoutput)) {print dol_trunc(nl2br($obj->lastoutput), 50); } |
|
| 506 | 506 | print '</td>'; |
| 507 | 507 | |
| 508 | 508 | print '<td class="center">'; |
| 509 | - if(!empty($obj->datenextrun)) {print dol_print_date($db->jdate($obj->datenextrun),'dayhour');} |
|
| 509 | + if (!empty($obj->datenextrun)) {print dol_print_date($db->jdate($obj->datenextrun), 'dayhour'); } |
|
| 510 | 510 | print '</td>'; |
| 511 | 511 | |
| 512 | 512 | // Status |
@@ -517,26 +517,26 @@ discard block |
||
| 517 | 517 | print '<td align="right" class="nowraponall">'; |
| 518 | 518 | if ($user->rights->cron->create) |
| 519 | 519 | { |
| 520 | - print "<a href=\"".DOL_URL_ROOT."/cron/card.php?id=".$obj->rowid."&action=edit".($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."&backtourl=".urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:''))."\" title=\"".dol_escape_htmltag($langs->trans('Edit'))."\">".img_picto($langs->trans('Edit'),'edit')."</a> "; |
|
| 520 | + print "<a href=\"".DOL_URL_ROOT."/cron/card.php?id=".$obj->rowid."&action=edit".($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').$param."&backtourl=".urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : ''))."\" title=\"".dol_escape_htmltag($langs->trans('Edit'))."\">".img_picto($langs->trans('Edit'), 'edit')."</a> "; |
|
| 521 | 521 | } |
| 522 | 522 | if ($user->rights->cron->delete) |
| 523 | 523 | { |
| 524 | - print "<a href=\"".$_SERVER["PHP_SELF"]."?id=".$obj->rowid."&action=delete".($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."\" title=\"".dol_escape_htmltag($langs->trans('CronDelete'))."\">".img_picto($langs->trans('CronDelete'),'delete')."</a> "; |
|
| 524 | + print "<a href=\"".$_SERVER["PHP_SELF"]."?id=".$obj->rowid."&action=delete".($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').$param."\" title=\"".dol_escape_htmltag($langs->trans('CronDelete'))."\">".img_picto($langs->trans('CronDelete'), 'delete')."</a> "; |
|
| 525 | 525 | } else { |
| 526 | 526 | print "<a href=\"#\" title=\"".dol_escape_htmltag($langs->trans('NotEnoughPermissions'))."\">".img_picto($langs->trans('NotEnoughPermissions'), 'delete')."</a> "; |
| 527 | 527 | } |
| 528 | 528 | if ($user->rights->cron->execute) |
| 529 | 529 | { |
| 530 | - if (!empty($obj->status)) print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=execute'.(empty($conf->global->CRON_KEY)?'':'&securitykey='.$conf->global->CRON_KEY).($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."\" title=\"".dol_escape_htmltag($langs->trans('CronExecute'))."\">".img_picto($langs->trans('CronExecute'),"play").'</a>'; |
|
| 531 | - else print '<a href="#" class="cursordefault" title="'.dol_escape_htmltag($langs->trans('JobDisabled')).'">'.img_picto($langs->trans('JobDisabled'),"playdisabled").'</a>'; |
|
| 530 | + if (!empty($obj->status)) print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=execute'.(empty($conf->global->CRON_KEY) ? '' : '&securitykey='.$conf->global->CRON_KEY).($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').$param."\" title=\"".dol_escape_htmltag($langs->trans('CronExecute'))."\">".img_picto($langs->trans('CronExecute'), "play").'</a>'; |
|
| 531 | + else print '<a href="#" class="cursordefault" title="'.dol_escape_htmltag($langs->trans('JobDisabled')).'">'.img_picto($langs->trans('JobDisabled'), "playdisabled").'</a>'; |
|
| 532 | 532 | } else { |
| 533 | - print '<a href="#" class="cursornotallowed" title="'.dol_escape_htmltag($langs->trans('NotEnoughPermissions')).'">'.img_picto($langs->trans('NotEnoughPermissions'),"playdisabled").'</a>'; |
|
| 533 | + print '<a href="#" class="cursornotallowed" title="'.dol_escape_htmltag($langs->trans('NotEnoughPermissions')).'">'.img_picto($langs->trans('NotEnoughPermissions'), "playdisabled").'</a>'; |
|
| 534 | 534 | } |
| 535 | 535 | if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
| 536 | 536 | { |
| 537 | - $selected=0; |
|
| 538 | - if (in_array($obj->rowid, $arrayofselected)) $selected=1; |
|
| 539 | - print ' <input id="cb'.$obj->rowid.'" class="flat checkforselect valignmiddle" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>'; |
|
| 537 | + $selected = 0; |
|
| 538 | + if (in_array($obj->rowid, $arrayofselected)) $selected = 1; |
|
| 539 | + print ' <input id="cb'.$obj->rowid.'" class="flat checkforselect valignmiddle" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>'; |
|
| 540 | 540 | } |
| 541 | 541 | print '</td>'; |
| 542 | 542 | |
@@ -31,7 +31,9 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | $langs->loadLangs(array("admin","cron","bills")); |
| 33 | 33 | |
| 34 | -if (!$user->rights->cron->read) accessforbidden(); |
|
| 34 | +if (!$user->rights->cron->read) { |
|
| 35 | + accessforbidden(); |
|
| 36 | +} |
|
| 35 | 37 | |
| 36 | 38 | $action=GETPOST('action','alpha'); |
| 37 | 39 | $massaction = GETPOST('massaction','alpha'); // The bulk action (combo box choice into lists) |
@@ -49,11 +51,17 @@ discard block |
||
| 49 | 51 | $offset = $limit * $page; |
| 50 | 52 | $pageprev = $page - 1; |
| 51 | 53 | $pagenext = $page + 1; |
| 52 | -if (! $sortfield) $sortfield='t.status,t.priority'; |
|
| 53 | -if (! $sortorder) $sortorder='DESC,ASC'; |
|
| 54 | +if (! $sortfield) { |
|
| 55 | + $sortfield='t.status,t.priority'; |
|
| 56 | +} |
|
| 57 | +if (! $sortorder) { |
|
| 58 | + $sortorder='DESC,ASC'; |
|
| 59 | +} |
|
| 54 | 60 | |
| 55 | 61 | $search_status=GETPOST('search_status','int')?GETPOST('search_status','int'):GETPOST('status','int'); |
| 56 | -if ($search_status == '') $search_status=-2; |
|
| 62 | +if ($search_status == '') { |
|
| 63 | + $search_status=-2; |
|
| 64 | +} |
|
| 57 | 65 | |
| 58 | 66 | //Search criteria |
| 59 | 67 | $search_label=GETPOST("search_label",'alpha'); |
@@ -81,7 +89,9 @@ discard block |
||
| 81 | 89 | |
| 82 | 90 | $parameters=array(); |
| 83 | 91 | $reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
| 84 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 92 | +if ($reshook < 0) { |
|
| 93 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 94 | +} |
|
| 85 | 95 | |
| 86 | 96 | if (empty($reshook)) |
| 87 | 97 | { |
@@ -89,9 +99,11 @@ discard block |
||
| 89 | 99 | include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
| 90 | 100 | |
| 91 | 101 | // Purge search criteria |
| 92 | - if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers |
|
| 102 | + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) { |
|
| 103 | + // All tests are required to be compatible with all browsers |
|
| 93 | 104 | { |
| 94 | 105 | $search_label=''; |
| 106 | + } |
|
| 95 | 107 | $search_status=-1; |
| 96 | 108 | $toselect=''; |
| 97 | 109 | $search_array_options=array(); |
@@ -128,8 +140,7 @@ discard block |
||
| 128 | 140 | { |
| 129 | 141 | setEventMessages('Security key '.$securitykey.' is wrong', null, 'errors'); |
| 130 | 142 | $action=''; |
| 131 | - } |
|
| 132 | - else |
|
| 143 | + } else |
|
| 133 | 144 | { |
| 134 | 145 | $object = new Cronjob($db); |
| 135 | 146 | $job = $object->fetch($id); |
@@ -145,24 +156,34 @@ discard block |
||
| 145 | 156 | $res = $object->reprogram_jobs($user->login, $now); |
| 146 | 157 | if ($res > 0) |
| 147 | 158 | { |
| 148 | - if ($resrunjob >= 0) // We show the result of reprogram only if no error message already reported |
|
| 159 | + if ($resrunjob >= 0) { |
|
| 160 | + // We show the result of reprogram only if no error message already reported |
|
| 149 | 161 | { |
| 150 | 162 | if ($object->lastresult >= 0) setEventMessages($langs->trans("JobFinished"), null, 'mesgs'); |
| 151 | - else setEventMessages($langs->trans("JobFinished"), null, 'errors'); |
|
| 163 | + } else { |
|
| 164 | + setEventMessages($langs->trans("JobFinished"), null, 'errors'); |
|
| 165 | + } |
|
| 152 | 166 | } |
| 153 | 167 | $action=''; |
| 154 | - } |
|
| 155 | - else |
|
| 168 | + } else |
|
| 156 | 169 | { |
| 157 | 170 | setEventMessages($object->error, $object->errors, 'errors'); |
| 158 | 171 | $action=''; |
| 159 | 172 | } |
| 160 | 173 | |
| 161 | 174 | $param='&search_status='.urlencode($search_status); |
| 162 | - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); |
|
| 163 | - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); |
|
| 164 | - if ($search_label) $param.='&search_label='.urlencode($search_label); |
|
| 165 | - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); |
|
| 175 | + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
|
| 176 | + $param.='&contextpage='.urlencode($contextpage); |
|
| 177 | + } |
|
| 178 | + if ($limit > 0 && $limit != $conf->liste_limit) { |
|
| 179 | + $param.='&limit='.urlencode($limit); |
|
| 180 | + } |
|
| 181 | + if ($search_label) { |
|
| 182 | + $param.='&search_label='.urlencode($search_label); |
|
| 183 | + } |
|
| 184 | + if ($optioncss != '') { |
|
| 185 | + $param.='&optioncss='.urlencode($optioncss); |
|
| 186 | + } |
|
| 166 | 187 | // Add $param from extra fields |
| 167 | 188 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
| 168 | 189 | |
@@ -188,12 +209,17 @@ discard block |
||
| 188 | 209 | if ($result) |
| 189 | 210 | { |
| 190 | 211 | $result = 0; |
| 191 | - if ($massaction == 'disable') $result = $tmpcron->setStatut(Cronjob::STATUS_DISABLED); |
|
| 192 | - elseif ($massaction == 'enable') $result = $tmpcron->setStatut(Cronjob::STATUS_ENABLED); |
|
| 193 | - else dol_print_error($db, 'Bad value for massaction'); |
|
| 194 | - if ($result < 0) setEventMessages($tmpcron->error, $tmpcron->errors, 'errors'); |
|
| 195 | - } |
|
| 196 | - else |
|
| 212 | + if ($massaction == 'disable') { |
|
| 213 | + $result = $tmpcron->setStatut(Cronjob::STATUS_DISABLED); |
|
| 214 | + } elseif ($massaction == 'enable') { |
|
| 215 | + $result = $tmpcron->setStatut(Cronjob::STATUS_ENABLED); |
|
| 216 | + } else { |
|
| 217 | + dol_print_error($db, 'Bad value for massaction'); |
|
| 218 | + } |
|
| 219 | + if ($result < 0) { |
|
| 220 | + setEventMessages($tmpcron->error, $tmpcron->errors, 'errors'); |
|
| 221 | + } |
|
| 222 | + } else |
|
| 197 | 223 | { |
| 198 | 224 | $error++; |
| 199 | 225 | } |
@@ -246,8 +272,12 @@ discard block |
||
| 246 | 272 | $sql.= " t.test"; |
| 247 | 273 | $sql.= " FROM ".MAIN_DB_PREFIX."cronjob as t"; |
| 248 | 274 | $sql.= " WHERE 1 = 1"; |
| 249 | -if ($search_status >= 0 && $search_status < 2) $sql.= " AND t.status = ".(empty($search_status)?'0':'1'); |
|
| 250 | -if ($search_status == 2) $sql.= " AND t.status = 2"; |
|
| 275 | +if ($search_status >= 0 && $search_status < 2) { |
|
| 276 | + $sql.= " AND t.status = ".(empty($search_status)?'0':'1'); |
|
| 277 | +} |
|
| 278 | +if ($search_status == 2) { |
|
| 279 | + $sql.= " AND t.status = 2"; |
|
| 280 | +} |
|
| 251 | 281 | //Manage filter |
| 252 | 282 | if (is_array($filter) && count($filter)>0) { |
| 253 | 283 | foreach($filter as $key => $value) { |
@@ -281,18 +311,30 @@ discard block |
||
| 281 | 311 | $sql.= $db->plimit($limit+1, $offset); |
| 282 | 312 | |
| 283 | 313 | $result=$db->query($sql); |
| 284 | -if (! $result) dol_print_error($db); |
|
| 314 | +if (! $result) { |
|
| 315 | + dol_print_error($db); |
|
| 316 | +} |
|
| 285 | 317 | |
| 286 | 318 | $num = $db->num_rows($result); |
| 287 | 319 | |
| 288 | 320 | $arrayofselected=is_array($toselect)?$toselect:array(); |
| 289 | 321 | |
| 290 | 322 | $param = ''; |
| 291 | -if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; |
|
| 292 | -if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; |
|
| 293 | -if ($search_status) $param.='&search_status='.$search_status; |
|
| 294 | -if ($search_label) $param.='&search_label='.$search_label; |
|
| 295 | -if ($optioncss != '') $param.='&optioncss='.$optioncss; |
|
| 323 | +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
|
| 324 | + $param.='&contextpage='.$contextpage; |
|
| 325 | +} |
|
| 326 | +if ($limit > 0 && $limit != $conf->liste_limit) { |
|
| 327 | + $param.='&limit='.$limit; |
|
| 328 | +} |
|
| 329 | +if ($search_status) { |
|
| 330 | + $param.='&search_status='.$search_status; |
|
| 331 | +} |
|
| 332 | +if ($search_label) { |
|
| 333 | + $param.='&search_label='.$search_label; |
|
| 334 | +} |
|
| 335 | +if ($optioncss != '') { |
|
| 336 | + $param.='&optioncss='.$optioncss; |
|
| 337 | +} |
|
| 296 | 338 | // Add $param from extra fields |
| 297 | 339 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
| 298 | 340 | |
@@ -314,13 +356,19 @@ discard block |
||
| 314 | 356 | 'enable'=>$langs->trans("Enable"), |
| 315 | 357 | 'disable'=>$langs->trans("Disable"), |
| 316 | 358 | ); |
| 317 | -if ($user->rights->mymodule->delete) $arrayofmassactions['predelete']=$langs->trans("Delete"); |
|
| 318 | -if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); |
|
| 359 | +if ($user->rights->mymodule->delete) { |
|
| 360 | + $arrayofmassactions['predelete']=$langs->trans("Delete"); |
|
| 361 | +} |
|
| 362 | +if (in_array($massaction, array('presend','predelete'))) { |
|
| 363 | + $arrayofmassactions=array(); |
|
| 364 | +} |
|
| 319 | 365 | $massactionbutton=$form->selectMassAction('', $arrayofmassactions); |
| 320 | 366 | |
| 321 | 367 | |
| 322 | 368 | print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'" name="search_form">'."\n"; |
| 323 | -if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
| 369 | +if ($optioncss != '') { |
|
| 370 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
| 371 | +} |
|
| 324 | 372 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
| 325 | 373 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
| 326 | 374 | print '<input type="hidden" name="action" value="list">'; |
@@ -335,8 +383,7 @@ discard block |
||
| 335 | 383 | if (! $user->rights->cron->create) |
| 336 | 384 | { |
| 337 | 385 | $buttontoshow.='<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("CronCreateJob").'</a>'; |
| 338 | -} |
|
| 339 | -else |
|
| 386 | +} else |
|
| 340 | 387 | { |
| 341 | 388 | $buttontoshow.='<a class="butAction" style="margin-right: 0px;margin-left: 0px;" href="'.DOL_URL_ROOT.'/cron/card.php?action=create">'.$langs->trans("CronCreateJob").'</a>'; |
| 342 | 389 | } |
@@ -347,7 +394,9 @@ discard block |
||
| 347 | 394 | print $langs->trans('CronInfo').'<br>'; |
| 348 | 395 | |
| 349 | 396 | $text =$langs->trans("HoursOnThisPageAreOnServerTZ").' '.$stringcurrentdate.'<br>'; |
| 350 | -if (! empty($conf->global->CRON_WARNING_DELAY_HOURS)) $text.=$langs->trans("WarningCronDelayed", $conf->global->CRON_WARNING_DELAY_HOURS); |
|
| 397 | +if (! empty($conf->global->CRON_WARNING_DELAY_HOURS)) { |
|
| 398 | + $text.=$langs->trans("WarningCronDelayed", $conf->global->CRON_WARNING_DELAY_HOURS); |
|
| 399 | +} |
|
| 351 | 400 | print info_admin($text); |
| 352 | 401 | print '<br>'; |
| 353 | 402 | |
@@ -414,8 +463,13 @@ discard block |
||
| 414 | 463 | { |
| 415 | 464 | $obj = $db->fetch_object($result); |
| 416 | 465 | |
| 417 | - if (empty($obj)) break; |
|
| 418 | - if (! verifCond($obj->test)) continue; // Discard line with test = false |
|
| 466 | + if (empty($obj)) { |
|
| 467 | + break; |
|
| 468 | + } |
|
| 469 | + if (! verifCond($obj->test)) { |
|
| 470 | + continue; |
|
| 471 | + } |
|
| 472 | + // Discard line with test = false |
|
| 419 | 473 | |
| 420 | 474 | $object->id = $obj->rowid; |
| 421 | 475 | $object->ref = $obj->rowid; |
@@ -437,8 +491,7 @@ discard block |
||
| 437 | 491 | $object->ref = $langs->trans($obj->label); |
| 438 | 492 | print $object->getNomUrl(0, '', 1); |
| 439 | 493 | $object->ref = $obj->rowid; |
| 440 | - } |
|
| 441 | - else |
|
| 494 | + } else |
|
| 442 | 495 | { |
| 443 | 496 | //print $langs->trans('CronNone'); |
| 444 | 497 | } |
@@ -459,8 +512,7 @@ discard block |
||
| 459 | 512 | $texttoshow.=$langs->trans('CronMethod').': '. $obj->methodename; |
| 460 | 513 | $texttoshow.='<br>'.$langs->trans('CronArgs').': '. $obj->params; |
| 461 | 514 | $texttoshow.='<br>'.$langs->trans('Comment').': '. $langs->trans($obj->note); |
| 462 | - } |
|
| 463 | - elseif ($obj->jobtype=='command') |
|
| 515 | + } elseif ($obj->jobtype=='command') |
|
| 464 | 516 | { |
| 465 | 517 | $text=$langs->trans('CronCommand'); |
| 466 | 518 | $texttoshow=$langs->trans('CronCommand').': '.dol_trunc($obj->command); |
@@ -471,10 +523,18 @@ discard block |
||
| 471 | 523 | print '</td>'; |
| 472 | 524 | |
| 473 | 525 | print '<td>'; |
| 474 | - if($obj->unitfrequency == "60") print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Minutes'); |
|
| 475 | - if($obj->unitfrequency == "3600") print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Hours'); |
|
| 476 | - if($obj->unitfrequency == "86400") print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Days'); |
|
| 477 | - if($obj->unitfrequency == "604800") print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Weeks'); |
|
| 526 | + if($obj->unitfrequency == "60") { |
|
| 527 | + print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Minutes'); |
|
| 528 | + } |
|
| 529 | + if($obj->unitfrequency == "3600") { |
|
| 530 | + print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Hours'); |
|
| 531 | + } |
|
| 532 | + if($obj->unitfrequency == "86400") { |
|
| 533 | + print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Days'); |
|
| 534 | + } |
|
| 535 | + if($obj->unitfrequency == "604800") { |
|
| 536 | + print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Weeks'); |
|
| 537 | + } |
|
| 478 | 538 | print '</td>'; |
| 479 | 539 | |
| 480 | 540 | print '<td class="center">'; |
@@ -527,15 +587,22 @@ discard block |
||
| 527 | 587 | } |
| 528 | 588 | if ($user->rights->cron->execute) |
| 529 | 589 | { |
| 530 | - if (!empty($obj->status)) print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=execute'.(empty($conf->global->CRON_KEY)?'':'&securitykey='.$conf->global->CRON_KEY).($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."\" title=\"".dol_escape_htmltag($langs->trans('CronExecute'))."\">".img_picto($langs->trans('CronExecute'),"play").'</a>'; |
|
| 531 | - else print '<a href="#" class="cursordefault" title="'.dol_escape_htmltag($langs->trans('JobDisabled')).'">'.img_picto($langs->trans('JobDisabled'),"playdisabled").'</a>'; |
|
| 590 | + if (!empty($obj->status)) { |
|
| 591 | + print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=execute'.(empty($conf->global->CRON_KEY)?'':'&securitykey='.$conf->global->CRON_KEY).($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."\" title=\"".dol_escape_htmltag($langs->trans('CronExecute'))."\">".img_picto($langs->trans('CronExecute'),"play").'</a>'; |
|
| 592 | + } else { |
|
| 593 | + print '<a href="#" class="cursordefault" title="'.dol_escape_htmltag($langs->trans('JobDisabled')).'">'.img_picto($langs->trans('JobDisabled'),"playdisabled").'</a>'; |
|
| 594 | + } |
|
| 532 | 595 | } else { |
| 533 | 596 | print '<a href="#" class="cursornotallowed" title="'.dol_escape_htmltag($langs->trans('NotEnoughPermissions')).'">'.img_picto($langs->trans('NotEnoughPermissions'),"playdisabled").'</a>'; |
| 534 | 597 | } |
| 535 | - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
|
| 598 | + if ($massactionbutton || $massaction) { |
|
| 599 | + // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
|
| 536 | 600 | { |
| 537 | 601 | $selected=0; |
| 538 | - if (in_array($obj->rowid, $arrayofselected)) $selected=1; |
|
| 602 | + } |
|
| 603 | + if (in_array($obj->rowid, $arrayofselected)) { |
|
| 604 | + $selected=1; |
|
| 605 | + } |
|
| 539 | 606 | print ' <input id="cb'.$obj->rowid.'" class="flat checkforselect valignmiddle" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>'; |
| 540 | 607 | } |
| 541 | 608 | print '</td>'; |
@@ -544,8 +611,7 @@ discard block |
||
| 544 | 611 | |
| 545 | 612 | $i++; |
| 546 | 613 | } |
| 547 | -} |
|
| 548 | -else |
|
| 614 | +} else |
|
| 549 | 615 | { |
| 550 | 616 | print '<tr><td colspan="9" class="opacitymedium">'.$langs->trans('CronNoJobs').'</td></tr>'; |
| 551 | 617 | } |
@@ -27,13 +27,13 @@ discard block |
||
| 27 | 27 | * \brief File to offer a way to make a payment for a particular Dolibarr entity |
| 28 | 28 | */ |
| 29 | 29 | |
| 30 | -define("NOLOGIN",1); // This means this output page does not require to be logged. |
|
| 31 | -define("NOCSRFCHECK",1); // We accept to go on this page from external web site. |
|
| 30 | +define("NOLOGIN", 1); // This means this output page does not require to be logged. |
|
| 31 | +define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. |
|
| 32 | 32 | |
| 33 | 33 | // For MultiCompany module. |
| 34 | 34 | // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php |
| 35 | 35 | // TODO This should be useless. Because entity must be retreive from object ref and not from url. |
| 36 | -$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); |
|
| 36 | +$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); |
|
| 37 | 37 | if (is_numeric($entity)) define("DOLENTITY", $entity); |
| 38 | 38 | |
| 39 | 39 | require '../../main.inc.php'; |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | // Security check |
| 47 | 47 | // No check on module enabled. Done later according to $validpaymentmethod |
| 48 | 48 | |
| 49 | -$langs->loadLangs(array("main","other","dict","bills","companies","errors","paybox")); // File with generic data |
|
| 49 | +$langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", "paybox")); // File with generic data |
|
| 50 | 50 | |
| 51 | -$action=GETPOST('action','aZ09'); |
|
| 51 | +$action = GETPOST('action', 'aZ09'); |
|
| 52 | 52 | |
| 53 | 53 | // Input are: |
| 54 | 54 | // type ('invoice','order','contractline'), |
@@ -57,26 +57,26 @@ discard block |
||
| 57 | 57 | // tag (a free text, required if type is empty) |
| 58 | 58 | // currency (iso code) |
| 59 | 59 | |
| 60 | -$suffix=GETPOST("suffix",'aZ09'); |
|
| 61 | -$amount=price2num(GETPOST("amount",'alpha')); |
|
| 62 | -if (! GETPOST("currency",'alpha')) $currency=$conf->currency; |
|
| 63 | -else $currency=GETPOST("currency",'alpha'); |
|
| 64 | -$source = GETPOST("s",'alpha')?GETPOST("s",'alpha'):GETPOST("source",'alpha'); |
|
| 65 | -$download = GETPOST('d','int')?GETPOST('d','int'):GETPOST('download','int'); |
|
| 60 | +$suffix = GETPOST("suffix", 'aZ09'); |
|
| 61 | +$amount = price2num(GETPOST("amount", 'alpha')); |
|
| 62 | +if (!GETPOST("currency", 'alpha')) $currency = $conf->currency; |
|
| 63 | +else $currency = GETPOST("currency", 'alpha'); |
|
| 64 | +$source = GETPOST("s", 'alpha') ?GETPOST("s", 'alpha') : GETPOST("source", 'alpha'); |
|
| 65 | +$download = GETPOST('d', 'int') ?GETPOST('d', 'int') : GETPOST('download', 'int'); |
|
| 66 | 66 | |
| 67 | -if (! $action) |
|
| 67 | +if (!$action) |
|
| 68 | 68 | { |
| 69 | - if (! GETPOST("amount",'alpha') && ! $source) |
|
| 69 | + if (!GETPOST("amount", 'alpha') && !$source) |
|
| 70 | 70 | { |
| 71 | 71 | print $langs->trans('ErrorBadParameters')." - amount or source"; |
| 72 | 72 | exit; |
| 73 | 73 | } |
| 74 | - if (is_numeric($amount) && ! GETPOST("tag",'alpha') && ! $source) |
|
| 74 | + if (is_numeric($amount) && !GETPOST("tag", 'alpha') && !$source) |
|
| 75 | 75 | { |
| 76 | 76 | print $langs->trans('ErrorBadParameters')." - tag or source"; |
| 77 | 77 | exit; |
| 78 | 78 | } |
| 79 | - if ($source && ! GETPOST("ref",'alpha')) |
|
| 79 | + if ($source && !GETPOST("ref", 'alpha')) |
|
| 80 | 80 | { |
| 81 | 81 | print $langs->trans('ErrorBadParameters')." - ref"; |
| 82 | 82 | exit; |
@@ -84,15 +84,15 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | |
| 87 | -$paymentmethod=''; |
|
| 88 | -$validpaymentmethod=array(); |
|
| 87 | +$paymentmethod = ''; |
|
| 88 | +$validpaymentmethod = array(); |
|
| 89 | 89 | |
| 90 | 90 | // Detect $paymentmethod |
| 91 | -foreach($_POST as $key => $val) |
|
| 91 | +foreach ($_POST as $key => $val) |
|
| 92 | 92 | { |
| 93 | 93 | if (preg_match('/^dopayment_(.*)$/', $key, $reg)) |
| 94 | 94 | { |
| 95 | - $paymentmethod=$reg[1]; |
|
| 95 | + $paymentmethod = $reg[1]; |
|
| 96 | 96 | break; |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -101,61 +101,61 @@ discard block |
||
| 101 | 101 | // Define $urlwithroot |
| 102 | 102 | //$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); |
| 103 | 103 | //$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file |
| 104 | -$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost. |
|
| 104 | +$urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost. |
|
| 105 | 105 | |
| 106 | -$urlok=$urlwithroot.'/public/payment/paymentok.php?'; |
|
| 107 | -$urlko=$urlwithroot.'/public/payment/paymentko.php?'; |
|
| 106 | +$urlok = $urlwithroot.'/public/payment/paymentok.php?'; |
|
| 107 | +$urlko = $urlwithroot.'/public/payment/paymentko.php?'; |
|
| 108 | 108 | |
| 109 | 109 | // Complete urls for post treatment |
| 110 | -$ref=$REF=GETPOST('ref','alpha'); |
|
| 111 | -$TAG=GETPOST("tag",'alpha'); |
|
| 112 | -$FULLTAG=GETPOST("fulltag",'alpha'); // fulltag is tag with more informations |
|
| 113 | -$SECUREKEY=GETPOST("securekey"); // Secure key |
|
| 114 | -if ($paymentmethod && ! preg_match('/'.preg_quote('PM='.$paymentmethod,'/').'/', $FULLTAG)) $FULLTAG.=($FULLTAG?'.':'').'PM='.$paymentmethod; |
|
| 110 | +$ref = $REF = GETPOST('ref', 'alpha'); |
|
| 111 | +$TAG = GETPOST("tag", 'alpha'); |
|
| 112 | +$FULLTAG = GETPOST("fulltag", 'alpha'); // fulltag is tag with more informations |
|
| 113 | +$SECUREKEY = GETPOST("securekey"); // Secure key |
|
| 114 | +if ($paymentmethod && !preg_match('/'.preg_quote('PM='.$paymentmethod, '/').'/', $FULLTAG)) $FULLTAG .= ($FULLTAG ? '.' : '').'PM='.$paymentmethod; |
|
| 115 | 115 | |
| 116 | -if (! empty($suffix)) |
|
| 116 | +if (!empty($suffix)) |
|
| 117 | 117 | { |
| 118 | - $urlok.='suffix='.urlencode($suffix).'&'; |
|
| 119 | - $urlko.='suffix='.urlencode($suffix).'&'; |
|
| 118 | + $urlok .= 'suffix='.urlencode($suffix).'&'; |
|
| 119 | + $urlko .= 'suffix='.urlencode($suffix).'&'; |
|
| 120 | 120 | } |
| 121 | 121 | if ($source) |
| 122 | 122 | { |
| 123 | - $urlok.='s='.urlencode($source).'&'; |
|
| 124 | - $urlko.='s='.urlencode($source).'&'; |
|
| 123 | + $urlok .= 's='.urlencode($source).'&'; |
|
| 124 | + $urlko .= 's='.urlencode($source).'&'; |
|
| 125 | 125 | } |
| 126 | -if (! empty($REF)) |
|
| 126 | +if (!empty($REF)) |
|
| 127 | 127 | { |
| 128 | - $urlok.='ref='.urlencode($REF).'&'; |
|
| 129 | - $urlko.='ref='.urlencode($REF).'&'; |
|
| 128 | + $urlok .= 'ref='.urlencode($REF).'&'; |
|
| 129 | + $urlko .= 'ref='.urlencode($REF).'&'; |
|
| 130 | 130 | } |
| 131 | -if (! empty($TAG)) |
|
| 131 | +if (!empty($TAG)) |
|
| 132 | 132 | { |
| 133 | - $urlok.='tag='.urlencode($TAG).'&'; |
|
| 134 | - $urlko.='tag='.urlencode($TAG).'&'; |
|
| 133 | + $urlok .= 'tag='.urlencode($TAG).'&'; |
|
| 134 | + $urlko .= 'tag='.urlencode($TAG).'&'; |
|
| 135 | 135 | } |
| 136 | -if (! empty($FULLTAG)) |
|
| 136 | +if (!empty($FULLTAG)) |
|
| 137 | 137 | { |
| 138 | - $urlok.='fulltag='.urlencode($FULLTAG).'&'; |
|
| 139 | - $urlko.='fulltag='.urlencode($FULLTAG).'&'; |
|
| 138 | + $urlok .= 'fulltag='.urlencode($FULLTAG).'&'; |
|
| 139 | + $urlko .= 'fulltag='.urlencode($FULLTAG).'&'; |
|
| 140 | 140 | } |
| 141 | -if (! empty($SECUREKEY)) |
|
| 141 | +if (!empty($SECUREKEY)) |
|
| 142 | 142 | { |
| 143 | - $urlok.='securekey='.urlencode($SECUREKEY).'&'; |
|
| 144 | - $urlko.='securekey='.urlencode($SECUREKEY).'&'; |
|
| 143 | + $urlok .= 'securekey='.urlencode($SECUREKEY).'&'; |
|
| 144 | + $urlko .= 'securekey='.urlencode($SECUREKEY).'&'; |
|
| 145 | 145 | } |
| 146 | -if (! empty($entity)) |
|
| 146 | +if (!empty($entity)) |
|
| 147 | 147 | { |
| 148 | - $urlok.='e='.urlencode($entity).'&'; |
|
| 149 | - $urlko.='e='.urlencode($entity).'&'; |
|
| 148 | + $urlok .= 'e='.urlencode($entity).'&'; |
|
| 149 | + $urlko .= 'e='.urlencode($entity).'&'; |
|
| 150 | 150 | } |
| 151 | -$urlok=preg_replace('/&$/','',$urlok); // Remove last & |
|
| 152 | -$urlko=preg_replace('/&$/','',$urlko); // Remove last & |
|
| 151 | +$urlok = preg_replace('/&$/', '', $urlok); // Remove last & |
|
| 152 | +$urlko = preg_replace('/&$/', '', $urlko); // Remove last & |
|
| 153 | 153 | |
| 154 | 154 | |
| 155 | 155 | |
| 156 | 156 | // Find valid payment methods |
| 157 | 157 | |
| 158 | -if (! empty($conf->paypal->enabled)) |
|
| 158 | +if (!empty($conf->paypal->enabled)) |
|
| 159 | 159 | { |
| 160 | 160 | $langs->load("paypal"); |
| 161 | 161 | |
@@ -163,39 +163,39 @@ discard block |
||
| 163 | 163 | require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; |
| 164 | 164 | |
| 165 | 165 | // Check parameters |
| 166 | - $PAYPAL_API_OK=""; |
|
| 167 | - if ($urlok) $PAYPAL_API_OK=$urlok; |
|
| 168 | - $PAYPAL_API_KO=""; |
|
| 169 | - if ($urlko) $PAYPAL_API_KO=$urlko; |
|
| 166 | + $PAYPAL_API_OK = ""; |
|
| 167 | + if ($urlok) $PAYPAL_API_OK = $urlok; |
|
| 168 | + $PAYPAL_API_KO = ""; |
|
| 169 | + if ($urlko) $PAYPAL_API_KO = $urlko; |
|
| 170 | 170 | if (empty($PAYPAL_API_USER)) |
| 171 | 171 | { |
| 172 | - dol_print_error('',"Paypal setup param PAYPAL_API_USER not defined"); |
|
| 172 | + dol_print_error('', "Paypal setup param PAYPAL_API_USER not defined"); |
|
| 173 | 173 | return -1; |
| 174 | 174 | } |
| 175 | 175 | if (empty($PAYPAL_API_PASSWORD)) |
| 176 | 176 | { |
| 177 | - dol_print_error('',"Paypal setup param PAYPAL_API_PASSWORD not defined"); |
|
| 177 | + dol_print_error('', "Paypal setup param PAYPAL_API_PASSWORD not defined"); |
|
| 178 | 178 | return -1; |
| 179 | 179 | } |
| 180 | 180 | if (empty($PAYPAL_API_SIGNATURE)) |
| 181 | 181 | { |
| 182 | - dol_print_error('',"Paypal setup param PAYPAL_API_SIGNATURE not defined"); |
|
| 182 | + dol_print_error('', "Paypal setup param PAYPAL_API_SIGNATURE not defined"); |
|
| 183 | 183 | return -1; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - $validpaymentmethod['paypal']='valid'; |
|
| 186 | + $validpaymentmethod['paypal'] = 'valid'; |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | -if (! empty($conf->paybox->enabled)) |
|
| 189 | +if (!empty($conf->paybox->enabled)) |
|
| 190 | 190 | { |
| 191 | 191 | $langs->load("paybox"); |
| 192 | 192 | |
| 193 | 193 | // TODO |
| 194 | 194 | |
| 195 | - $validpaymentmethod['paybox']='valid'; |
|
| 195 | + $validpaymentmethod['paybox'] = 'valid'; |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | -if (! empty($conf->stripe->enabled)) |
|
| 198 | +if (!empty($conf->stripe->enabled)) |
|
| 199 | 199 | { |
| 200 | 200 | $langs->load("stripe"); |
| 201 | 201 | |
@@ -207,18 +207,18 @@ discard block |
||
| 207 | 207 | require_once DOL_DOCUMENT_ROOT.'/includes/stripe/init.php'; |
| 208 | 208 | */ |
| 209 | 209 | |
| 210 | - $validpaymentmethod['stripe']='valid'; |
|
| 210 | + $validpaymentmethod['stripe'] = 'valid'; |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | |
| 214 | 214 | |
| 215 | 215 | // Check security token |
| 216 | -$valid=true; |
|
| 217 | -if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
| 216 | +$valid = true; |
|
| 217 | +if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) |
|
| 218 | 218 | { |
| 219 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
| 219 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
| 220 | 220 | { |
| 221 | - if ($source && $REF) $token = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $source . $REF, 2); // Use the source in the hash to avoid duplicates if the references are identical |
|
| 221 | + if ($source && $REF) $token = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$source.$REF, 2); // Use the source in the hash to avoid duplicates if the references are identical |
|
| 222 | 222 | else $token = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); |
| 223 | 223 | } |
| 224 | 224 | else |
@@ -227,11 +227,11 @@ discard block |
||
| 227 | 227 | } |
| 228 | 228 | if ($SECUREKEY != $token) |
| 229 | 229 | { |
| 230 | - if (empty($conf->global->PAYMENT_SECURITY_ACCEPT_ANY_TOKEN)) $valid=false; // PAYMENT_SECURITY_ACCEPT_ANY_TOKEN is for backward compatibility |
|
| 230 | + if (empty($conf->global->PAYMENT_SECURITY_ACCEPT_ANY_TOKEN)) $valid = false; // PAYMENT_SECURITY_ACCEPT_ANY_TOKEN is for backward compatibility |
|
| 231 | 231 | else dol_syslog("Warning: PAYMENT_SECURITY_ACCEPT_ANY_TOKEN is on", LOG_WARNING); |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - if (! $valid) |
|
| 234 | + if (!$valid) |
|
| 235 | 235 | { |
| 236 | 236 | print '<div class="error">Bad value for key.</div>'; |
| 237 | 237 | //print 'SECUREKEY='.$SECUREKEY.' token='.$token.' valid='.$valid; |
@@ -247,11 +247,11 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | // Common variables |
| 250 | -$creditor=$mysoc->name; |
|
| 251 | -$paramcreditor='ONLINE_PAYMENT_CREDITOR'; |
|
| 252 | -$paramcreditorlong='ONLINE_PAYMENT_CREDITOR_'.$suffix; |
|
| 253 | -if (! empty($conf->global->$paramcreditorlong)) $creditor=$conf->global->$paramcreditorlong; |
|
| 254 | -else if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor; |
|
| 250 | +$creditor = $mysoc->name; |
|
| 251 | +$paramcreditor = 'ONLINE_PAYMENT_CREDITOR'; |
|
| 252 | +$paramcreditorlong = 'ONLINE_PAYMENT_CREDITOR_'.$suffix; |
|
| 253 | +if (!empty($conf->global->$paramcreditorlong)) $creditor = $conf->global->$paramcreditorlong; |
|
| 254 | +else if (!empty($conf->global->$paramcreditor)) $creditor = $conf->global->$paramcreditor; |
|
| 255 | 255 | |
| 256 | 256 | |
| 257 | 257 | |
@@ -264,34 +264,34 @@ discard block |
||
| 264 | 264 | { |
| 265 | 265 | if ($paymentmethod == 'paypal') |
| 266 | 266 | { |
| 267 | - $PAYPAL_API_PRICE=price2num(GETPOST("newamount",'alpha'),'MT'); |
|
| 268 | - $PAYPAL_PAYMENT_TYPE='Sale'; |
|
| 269 | - |
|
| 270 | - $origfulltag=GETPOST("fulltag",'alpha'); |
|
| 271 | - $shipToName=GETPOST("shipToName",'alpha'); |
|
| 272 | - $shipToStreet=GETPOST("shipToStreet",'alpha'); |
|
| 273 | - $shipToCity=GETPOST("shipToCity",'alpha'); |
|
| 274 | - $shipToState=GETPOST("shipToState",'alpha'); |
|
| 275 | - $shipToCountryCode=GETPOST("shipToCountryCode",'alpha'); |
|
| 276 | - $shipToZip=GETPOST("shipToZip",'alpha'); |
|
| 277 | - $shipToStreet2=GETPOST("shipToStreet2",'alpha'); |
|
| 278 | - $phoneNum=GETPOST("phoneNum",'alpha'); |
|
| 279 | - $email=GETPOST("email",'alpha'); |
|
| 280 | - $desc=GETPOST("desc",'alpha'); |
|
| 281 | - $thirdparty_id=GETPOST('thirdparty_id', 'int'); |
|
| 282 | - |
|
| 283 | - $mesg=''; |
|
| 284 | - if (empty($PAYPAL_API_PRICE) || ! is_numeric($PAYPAL_API_PRICE)) |
|
| 267 | + $PAYPAL_API_PRICE = price2num(GETPOST("newamount", 'alpha'), 'MT'); |
|
| 268 | + $PAYPAL_PAYMENT_TYPE = 'Sale'; |
|
| 269 | + |
|
| 270 | + $origfulltag = GETPOST("fulltag", 'alpha'); |
|
| 271 | + $shipToName = GETPOST("shipToName", 'alpha'); |
|
| 272 | + $shipToStreet = GETPOST("shipToStreet", 'alpha'); |
|
| 273 | + $shipToCity = GETPOST("shipToCity", 'alpha'); |
|
| 274 | + $shipToState = GETPOST("shipToState", 'alpha'); |
|
| 275 | + $shipToCountryCode = GETPOST("shipToCountryCode", 'alpha'); |
|
| 276 | + $shipToZip = GETPOST("shipToZip", 'alpha'); |
|
| 277 | + $shipToStreet2 = GETPOST("shipToStreet2", 'alpha'); |
|
| 278 | + $phoneNum = GETPOST("phoneNum", 'alpha'); |
|
| 279 | + $email = GETPOST("email", 'alpha'); |
|
| 280 | + $desc = GETPOST("desc", 'alpha'); |
|
| 281 | + $thirdparty_id = GETPOST('thirdparty_id', 'int'); |
|
| 282 | + |
|
| 283 | + $mesg = ''; |
|
| 284 | + if (empty($PAYPAL_API_PRICE) || !is_numeric($PAYPAL_API_PRICE)) |
|
| 285 | 285 | { |
| 286 | - $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount")); |
|
| 287 | - $action=''; |
|
| 286 | + $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")); |
|
| 287 | + $action = ''; |
|
| 288 | 288 | } |
| 289 | 289 | //elseif (empty($EMAIL)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail")); |
| 290 | 290 | //elseif (! isValidEMail($EMAIL)) $mesg=$langs->trans("ErrorBadEMail",$EMAIL); |
| 291 | - elseif (! $origfulltag) |
|
| 291 | + elseif (!$origfulltag) |
|
| 292 | 292 | { |
| 293 | - $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode")); |
|
| 294 | - $action=''; |
|
| 293 | + $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentCode")); |
|
| 294 | + $action = ''; |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | //var_dump($_POST); |
@@ -300,15 +300,15 @@ discard block |
||
| 300 | 300 | dol_syslog("newpayment.php call paypal api and do redirect", LOG_DEBUG); |
| 301 | 301 | |
| 302 | 302 | // Other |
| 303 | - $PAYPAL_API_DEVISE="USD"; |
|
| 303 | + $PAYPAL_API_DEVISE = "USD"; |
|
| 304 | 304 | //if ($currency == 'EUR') $PAYPAL_API_DEVISE="EUR"; |
| 305 | 305 | //if ($currency == 'USD') $PAYPAL_API_DEVISE="USD"; |
| 306 | - if (! empty($currency)) $PAYPAL_API_DEVISE=$currency; |
|
| 306 | + if (!empty($currency)) $PAYPAL_API_DEVISE = $currency; |
|
| 307 | 307 | |
| 308 | 308 | // Show var initialized by include fo paypal lib at begin of this file |
| 309 | 309 | dol_syslog("Submit Paypal form", LOG_DEBUG); |
| 310 | 310 | dol_syslog("PAYPAL_API_USER: $PAYPAL_API_USER", LOG_DEBUG); |
| 311 | - dol_syslog("PAYPAL_API_PASSWORD: ".preg_replace('/./', '*', $PAYPAL_API_PASSWORD), LOG_DEBUG); // No password into log files |
|
| 311 | + dol_syslog("PAYPAL_API_PASSWORD: ".preg_replace('/./', '*', $PAYPAL_API_PASSWORD), LOG_DEBUG); // No password into log files |
|
| 312 | 312 | dol_syslog("PAYPAL_API_SIGNATURE: $PAYPAL_API_SIGNATURE", LOG_DEBUG); |
| 313 | 313 | dol_syslog("PAYPAL_API_SANDBOX: $PAYPAL_API_SANDBOX", LOG_DEBUG); |
| 314 | 314 | dol_syslog("PAYPAL_API_OK: $PAYPAL_API_OK", LOG_DEBUG); |
@@ -327,13 +327,13 @@ discard block |
||
| 327 | 327 | dol_syslog("email: $email", LOG_DEBUG); |
| 328 | 328 | dol_syslog("desc: $desc", LOG_DEBUG); |
| 329 | 329 | |
| 330 | - dol_syslog("SCRIPT_URI: ".(empty($_SERVER["SCRIPT_URI"])?'':$_SERVER["SCRIPT_URI"]), LOG_DEBUG); // If defined script uri must match domain of PAYPAL_API_OK and PAYPAL_API_KO |
|
| 330 | + dol_syslog("SCRIPT_URI: ".(empty($_SERVER["SCRIPT_URI"]) ? '' : $_SERVER["SCRIPT_URI"]), LOG_DEBUG); // If defined script uri must match domain of PAYPAL_API_OK and PAYPAL_API_KO |
|
| 331 | 331 | //$_SESSION["PaymentType"]=$PAYPAL_PAYMENT_TYPE; |
| 332 | 332 | //$_SESSION["currencyCodeType"]=$PAYPAL_API_DEVISE; |
| 333 | 333 | //$_SESSION["FinalPaymentAmt"]=$PAYPAL_API_PRICE; |
| 334 | 334 | |
| 335 | 335 | // A redirect is added if API call successfull |
| 336 | - $mesg = print_paypal_redirect($PAYPAL_API_PRICE,$PAYPAL_API_DEVISE,$PAYPAL_PAYMENT_TYPE,$PAYPAL_API_OK,$PAYPAL_API_KO, $FULLTAG); |
|
| 336 | + $mesg = print_paypal_redirect($PAYPAL_API_PRICE, $PAYPAL_API_DEVISE, $PAYPAL_PAYMENT_TYPE, $PAYPAL_API_OK, $PAYPAL_API_KO, $FULLTAG); |
|
| 337 | 337 | |
| 338 | 338 | // If we are here, it means the Paypal redirect was not done, so we show error message |
| 339 | 339 | $action = ''; |
@@ -342,23 +342,23 @@ discard block |
||
| 342 | 342 | |
| 343 | 343 | if ($paymentmethod == 'paybox') |
| 344 | 344 | { |
| 345 | - $PRICE=price2num(GETPOST("newamount"),'MT'); |
|
| 346 | - $email=GETPOST("email",'alpha'); |
|
| 347 | - $thirdparty_id=GETPOST('thirdparty_id', 'int'); |
|
| 345 | + $PRICE = price2num(GETPOST("newamount"), 'MT'); |
|
| 346 | + $email = GETPOST("email", 'alpha'); |
|
| 347 | + $thirdparty_id = GETPOST('thirdparty_id', 'int'); |
|
| 348 | 348 | |
| 349 | - $origfulltag=GETPOST("fulltag",'alpha'); |
|
| 349 | + $origfulltag = GETPOST("fulltag", 'alpha'); |
|
| 350 | 350 | |
| 351 | 351 | // Securekey into back url useless for back url and we need an url lower than 150. |
| 352 | 352 | $urlok = preg_replace('/securekey=[^&]+/', '', $urlok); |
| 353 | 353 | $urlko = preg_replace('/securekey=[^&]+/', '', $urlko); |
| 354 | 354 | |
| 355 | - $mesg=''; |
|
| 356 | - if (empty($PRICE) || ! is_numeric($PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount")); |
|
| 357 | - elseif (empty($email)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail")); |
|
| 358 | - elseif (! isValidEMail($email)) $mesg=$langs->trans("ErrorBadEMail",$email); |
|
| 359 | - elseif (! $origfulltag) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode")); |
|
| 360 | - elseif (dol_strlen($urlok) > 150) $mesg='Error urlok too long '.$urlok.'( Paybox requires 150, found '.strlen($urlok).')'; |
|
| 361 | - elseif (dol_strlen($urlko) > 150) $mesg='Error urlko too long '.$urlko.'( Paybox requires 150, found '.strlen($urlok).')'; |
|
| 355 | + $mesg = ''; |
|
| 356 | + if (empty($PRICE) || !is_numeric($PRICE)) $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")); |
|
| 357 | + elseif (empty($email)) $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("YourEMail")); |
|
| 358 | + elseif (!isValidEMail($email)) $mesg = $langs->trans("ErrorBadEMail", $email); |
|
| 359 | + elseif (!$origfulltag) $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentCode")); |
|
| 360 | + elseif (dol_strlen($urlok) > 150) $mesg = 'Error urlok too long '.$urlok.'( Paybox requires 150, found '.strlen($urlok).')'; |
|
| 361 | + elseif (dol_strlen($urlko) > 150) $mesg = 'Error urlko too long '.$urlko.'( Paybox requires 150, found '.strlen($urlok).')'; |
|
| 362 | 362 | |
| 363 | 363 | if (empty($mesg)) |
| 364 | 364 | { |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | |
| 375 | 375 | if ($paymentmethod == 'stripe') |
| 376 | 376 | { |
| 377 | - if (GETPOST('newamount','alpha')) $amount = price2num(GETPOST('newamount','alpha'),'MT'); |
|
| 377 | + if (GETPOST('newamount', 'alpha')) $amount = price2num(GETPOST('newamount', 'alpha'), 'MT'); |
|
| 378 | 378 | else |
| 379 | 379 | { |
| 380 | 380 | setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors'); |
@@ -385,22 +385,22 @@ discard block |
||
| 385 | 385 | |
| 386 | 386 | |
| 387 | 387 | // Called when choosing Stripe mode, after the 'dopayment' |
| 388 | -if ($action == 'charge' && ! empty($conf->stripe->enabled)) |
|
| 388 | +if ($action == 'charge' && !empty($conf->stripe->enabled)) |
|
| 389 | 389 | { |
| 390 | 390 | $amountstripe = $amount; |
| 391 | 391 | |
| 392 | 392 | // Correct the amount according to unit of currency |
| 393 | 393 | // See https://support.stripe.com/questions/which-zero-decimal-currencies-does-stripe-support |
| 394 | - $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); |
|
| 395 | - if (! in_array($currency, $arrayzerounitcurrency)) $amountstripe=$amountstripe * 100; |
|
| 394 | + $arrayzerounitcurrency = array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); |
|
| 395 | + if (!in_array($currency, $arrayzerounitcurrency)) $amountstripe = $amountstripe * 100; |
|
| 396 | 396 | |
| 397 | 397 | dol_syslog("POST keys : ".join(',', array_keys($_POST)), LOG_DEBUG, 0, '_stripe'); |
| 398 | 398 | dol_syslog("POST values: ".join(',', $_POST), LOG_DEBUG, 0, '_stripe'); |
| 399 | 399 | |
| 400 | - $stripeToken = GETPOST("stripeToken",'alpha'); |
|
| 401 | - $email = GETPOST("email",'alpha'); |
|
| 402 | - $thirdparty_id=GETPOST('thirdparty_id', 'int'); |
|
| 403 | - $vatnumber = GETPOST('vatnumber','alpha'); |
|
| 400 | + $stripeToken = GETPOST("stripeToken", 'alpha'); |
|
| 401 | + $email = GETPOST("email", 'alpha'); |
|
| 402 | + $thirdparty_id = GETPOST('thirdparty_id', 'int'); |
|
| 403 | + $vatnumber = GETPOST('vatnumber', 'alpha'); |
|
| 404 | 404 | |
| 405 | 405 | dol_syslog("stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe'); |
| 406 | 406 | dol_syslog("email = ".$email, LOG_DEBUG, 0, '_stripe'); |
@@ -413,11 +413,11 @@ discard block |
||
| 413 | 413 | $metadata = array( |
| 414 | 414 | 'dol_version'=>DOL_VERSION, |
| 415 | 415 | 'dol_entity'=>$conf->entity, |
| 416 | - 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR']) |
|
| 416 | + 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR']) |
|
| 417 | 417 | ); |
| 418 | - if (! empty($dol_id)) $metadata["dol_id"] = $dol_id; |
|
| 419 | - if (! empty($dol_type)) $metadata["dol_type"] = $dol_type; |
|
| 420 | - if (! empty($thirdparty_id)) $metadata["dol_thirdparty_id"] = $thirdparty_id; |
|
| 418 | + if (!empty($dol_id)) $metadata["dol_id"] = $dol_id; |
|
| 419 | + if (!empty($dol_type)) $metadata["dol_type"] = $dol_type; |
|
| 420 | + if (!empty($thirdparty_id)) $metadata["dol_thirdparty_id"] = $thirdparty_id; |
|
| 421 | 421 | |
| 422 | 422 | if ($thirdparty_id > 0) |
| 423 | 423 | { |
@@ -425,12 +425,12 @@ discard block |
||
| 425 | 425 | |
| 426 | 426 | $service = 'StripeTest'; |
| 427 | 427 | $servicestatus = 0; |
| 428 | - if (! empty($conf->global->STRIPE_LIVE) && ! GETPOST('forcesandbox','alpha')) |
|
| 428 | + if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) |
|
| 429 | 429 | { |
| 430 | 430 | $service = 'StripeLive'; |
| 431 | 431 | $servicestatus = 1; |
| 432 | 432 | } |
| 433 | - $stripeacc = null; // No Oauth/connect use for public pages |
|
| 433 | + $stripeacc = null; // No Oauth/connect use for public pages |
|
| 434 | 434 | |
| 435 | 435 | $thirdparty = new Societe($db); |
| 436 | 436 | $thirdparty->fetch($thirdparty_id); |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | $error++; |
| 447 | 447 | dol_syslog('Failed to create card record', LOG_WARNING, 0, '_stripe'); |
| 448 | 448 | setEventMessages('Failed to create card record', null, 'errors'); |
| 449 | - $action=''; |
|
| 449 | + $action = ''; |
|
| 450 | 450 | } |
| 451 | 451 | else |
| 452 | 452 | { |
@@ -454,9 +454,9 @@ discard block |
||
| 454 | 454 | $charge = \Stripe\Charge::create(array( |
| 455 | 455 | 'amount' => price2num($amountstripe, 'MU'), |
| 456 | 456 | 'currency' => $currency, |
| 457 | - 'capture' => true, // Charge immediatly |
|
| 457 | + 'capture' => true, // Charge immediatly |
|
| 458 | 458 | 'description' => 'Stripe payment: '.$FULLTAG, |
| 459 | - 'metadata' => array("FULLTAG" => $FULLTAG, 'Recipient' => $mysoc->name, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])), |
|
| 459 | + 'metadata' => array("FULLTAG" => $FULLTAG, 'Recipient' => $mysoc->name, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR'])), |
|
| 460 | 460 | 'customer' => $customer->id, |
| 461 | 461 | 'source' => $card, |
| 462 | 462 | 'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | $error++; |
| 468 | 468 | dol_syslog('Failed to charge card', LOG_WARNING, 0, '_stripe'); |
| 469 | 469 | setEventMessages('Failed to charge card', null, 'errors'); |
| 470 | - $action=''; |
|
| 470 | + $action = ''; |
|
| 471 | 471 | } |
| 472 | 472 | } |
| 473 | 473 | } |
@@ -476,9 +476,9 @@ discard block |
||
| 476 | 476 | dol_syslog("Create anonymous customer card profile", LOG_DEBUG, 0, '_stripe'); |
| 477 | 477 | $customer = \Stripe\Customer::create(array( |
| 478 | 478 | 'email' => $email, |
| 479 | - 'description' => ($email?'Anonymous customer for '.$email:'Anonymous customer'), |
|
| 479 | + 'description' => ($email ? 'Anonymous customer for '.$email : 'Anonymous customer'), |
|
| 480 | 480 | 'metadata' => $metadata, |
| 481 | - 'business_vat_id' => ($vatnumber?$vatnumber:null), |
|
| 481 | + 'business_vat_id' => ($vatnumber ? $vatnumber : null), |
|
| 482 | 482 | 'source' => $stripeToken // source can be a token OR array('object'=>'card', 'exp_month'=>xx, 'exp_year'=>xxxx, 'number'=>xxxxxxx, 'cvc'=>xxx, 'name'=>'Cardholder's full name', zip ?) |
| 483 | 483 | )); |
| 484 | 484 | // Return $customer = array('id'=>'cus_XXXX', ...) |
@@ -490,9 +490,9 @@ discard block |
||
| 490 | 490 | 'customer' => $customer->id, |
| 491 | 491 | 'amount' => price2num($amountstripe, 'MU'), |
| 492 | 492 | 'currency' => $currency, |
| 493 | - 'capture' => true, // Charge immediatly |
|
| 493 | + 'capture' => true, // Charge immediatly |
|
| 494 | 494 | 'description' => 'Stripe payment: '.$FULLTAG, |
| 495 | - 'metadata' => array("FULLTAG" => $FULLTAG, 'Recipient' => $mysoc->name, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])), |
|
| 495 | + 'metadata' => array("FULLTAG" => $FULLTAG, 'Recipient' => $mysoc->name, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR'])), |
|
| 496 | 496 | 'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt |
| 497 | 497 | )); |
| 498 | 498 | // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) |
@@ -501,72 +501,72 @@ discard block |
||
| 501 | 501 | $error++; |
| 502 | 502 | dol_syslog('Failed to charge card', LOG_WARNING, 0, '_stripe'); |
| 503 | 503 | setEventMessages('Failed to charge card', null, 'errors'); |
| 504 | - $action=''; |
|
| 504 | + $action = ''; |
|
| 505 | 505 | } |
| 506 | 506 | } |
| 507 | - } catch(\Stripe\Error\Card $e) { |
|
| 507 | + } catch (\Stripe\Error\Card $e) { |
|
| 508 | 508 | // Since it's a decline, \Stripe\Error\Card will be caught |
| 509 | 509 | $body = $e->getJsonBody(); |
| 510 | 510 | $err = $body['error']; |
| 511 | 511 | |
| 512 | - print('Status is:' . $e->getHttpStatus() . "\n"); |
|
| 513 | - print('Type is:' . $err['type'] . "\n"); |
|
| 514 | - print('Code is:' . $err['code'] . "\n"); |
|
| 512 | + print('Status is:'.$e->getHttpStatus()."\n"); |
|
| 513 | + print('Type is:'.$err['type']."\n"); |
|
| 514 | + print('Code is:'.$err['code']."\n"); |
|
| 515 | 515 | // param is '' in this case |
| 516 | - print('Param is:' . $err['param'] . "\n"); |
|
| 517 | - print('Message is:' . $err['message'] . "\n"); |
|
| 516 | + print('Param is:'.$err['param']."\n"); |
|
| 517 | + print('Message is:'.$err['message']."\n"); |
|
| 518 | 518 | |
| 519 | 519 | $error++; |
| 520 | 520 | dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe'); |
| 521 | 521 | setEventMessages($e->getMessage(), null, 'errors'); |
| 522 | - $action=''; |
|
| 522 | + $action = ''; |
|
| 523 | 523 | } catch (\Stripe\Error\RateLimit $e) { |
| 524 | 524 | // Too many requests made to the API too quickly |
| 525 | 525 | $error++; |
| 526 | 526 | dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe'); |
| 527 | 527 | setEventMessages($e->getMessage(), null, 'errors'); |
| 528 | - $action=''; |
|
| 528 | + $action = ''; |
|
| 529 | 529 | } catch (\Stripe\Error\InvalidRequest $e) { |
| 530 | 530 | // Invalid parameters were supplied to Stripe's API |
| 531 | 531 | $error++; |
| 532 | 532 | dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe'); |
| 533 | 533 | setEventMessages($e->getMessage(), null, 'errors'); |
| 534 | - $action=''; |
|
| 534 | + $action = ''; |
|
| 535 | 535 | } catch (\Stripe\Error\Authentication $e) { |
| 536 | 536 | // Authentication with Stripe's API failed |
| 537 | 537 | // (maybe you changed API keys recently) |
| 538 | 538 | $error++; |
| 539 | 539 | dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe'); |
| 540 | 540 | setEventMessages($e->getMessage(), null, 'errors'); |
| 541 | - $action=''; |
|
| 541 | + $action = ''; |
|
| 542 | 542 | } catch (\Stripe\Error\ApiConnection $e) { |
| 543 | 543 | // Network communication with Stripe failed |
| 544 | 544 | $error++; |
| 545 | 545 | dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe'); |
| 546 | 546 | setEventMessages($e->getMessage(), null, 'errors'); |
| 547 | - $action=''; |
|
| 547 | + $action = ''; |
|
| 548 | 548 | } catch (\Stripe\Error\Base $e) { |
| 549 | 549 | // Display a very generic error to the user, and maybe send |
| 550 | 550 | // yourself an email |
| 551 | 551 | $error++; |
| 552 | 552 | dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe'); |
| 553 | 553 | setEventMessages($e->getMessage(), null, 'errors'); |
| 554 | - $action=''; |
|
| 554 | + $action = ''; |
|
| 555 | 555 | } catch (Exception $e) { |
| 556 | 556 | // Something else happened, completely unrelated to Stripe |
| 557 | 557 | $error++; |
| 558 | 558 | dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe'); |
| 559 | 559 | setEventMessages($e->getMessage(), null, 'errors'); |
| 560 | - $action=''; |
|
| 560 | + $action = ''; |
|
| 561 | 561 | } |
| 562 | 562 | |
| 563 | 563 | $_SESSION["onlinetoken"] = $stripeToken; |
| 564 | 564 | $_SESSION["FinalPaymentAmt"] = $amount; |
| 565 | 565 | $_SESSION["currencyCodeType"] = $currency; |
| 566 | 566 | $_SESSION["paymentType"] = ''; |
| 567 | - $_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR']; // Payer ip |
|
| 568 | - $_SESSION['payerID'] = is_object($customer)?$customer->id:''; |
|
| 569 | - $_SESSION['TRANSACTIONID'] = is_object($charge)?$charge->id:''; |
|
| 567 | + $_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR']; // Payer ip |
|
| 568 | + $_SESSION['payerID'] = is_object($customer) ? $customer->id : ''; |
|
| 569 | + $_SESSION['TRANSACTIONID'] = is_object($charge) ? $charge->id : ''; |
|
| 570 | 570 | |
| 571 | 571 | dol_syslog("Action charge stripe result=".$error." ip=".$_SESSION['ipaddress'], LOG_DEBUG, 0, '_stripe'); |
| 572 | 572 | dol_syslog("onlinetoken=".$_SESSION["onlinetoken"]." FinalPaymentAmt=".$_SESSION["FinalPaymentAmt"]." currencyCodeType=".$_SESSION["currencyCodeType"]." payerID=".$_SESSION['payerID']." TRANSACTIONID=".$_SESSION['TRANSACTIONID'], LOG_DEBUG, 0, '_stripe'); |
@@ -591,11 +591,11 @@ discard block |
||
| 591 | 591 | * View |
| 592 | 592 | */ |
| 593 | 593 | |
| 594 | -$head=''; |
|
| 595 | -if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n"; |
|
| 594 | +$head = ''; |
|
| 595 | +if (!empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head = '<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n"; |
|
| 596 | 596 | |
| 597 | -$conf->dol_hide_topmenu=1; |
|
| 598 | -$conf->dol_hide_leftmenu=1; |
|
| 597 | +$conf->dol_hide_topmenu = 1; |
|
| 598 | +$conf->dol_hide_leftmenu = 1; |
|
| 599 | 599 | |
| 600 | 600 | llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody'); |
| 601 | 601 | |
@@ -611,13 +611,13 @@ discard block |
||
| 611 | 611 | |
| 612 | 612 | |
| 613 | 613 | // Show sandbox warning |
| 614 | -if (! empty($conf->paypal->enabled) && (! empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox','alpha'))) // We can force sand box with param 'forcesandbox' |
|
| 614 | +if (!empty($conf->paypal->enabled) && (!empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox', 'alpha'))) // We can force sand box with param 'forcesandbox' |
|
| 615 | 615 | { |
| 616 | - dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode','Paypal'),'','warning'); |
|
| 616 | + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Paypal'), '', 'warning'); |
|
| 617 | 617 | } |
| 618 | -if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha'))) |
|
| 618 | +if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) |
|
| 619 | 619 | { |
| 620 | - dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode','Stripe'),'','warning'); |
|
| 620 | + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | |
@@ -626,25 +626,25 @@ discard block |
||
| 626 | 626 | print '<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n"; |
| 627 | 627 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n"; |
| 628 | 628 | print '<input type="hidden" name="action" value="dopayment">'."\n"; |
| 629 | -print '<input type="hidden" name="tag" value="'.GETPOST("tag",'alpha').'">'."\n"; |
|
| 630 | -print '<input type="hidden" name="suffix" value="'.GETPOST("suffix",'alpha').'">'."\n"; |
|
| 629 | +print '<input type="hidden" name="tag" value="'.GETPOST("tag", 'alpha').'">'."\n"; |
|
| 630 | +print '<input type="hidden" name="suffix" value="'.GETPOST("suffix", 'alpha').'">'."\n"; |
|
| 631 | 631 | print '<input type="hidden" name="securekey" value="'.$SECUREKEY.'">'."\n"; |
| 632 | 632 | print '<input type="hidden" name="e" value="'.$entity.'" />'; |
| 633 | -print '<input type="hidden" name="forcesandbox" value="'.GETPOST('forcesandbox','alpha').'" />'; |
|
| 633 | +print '<input type="hidden" name="forcesandbox" value="'.GETPOST('forcesandbox', 'alpha').'" />'; |
|
| 634 | 634 | print "\n"; |
| 635 | 635 | print '<!-- Form to send a payment -->'."\n"; |
| 636 | 636 | print '<!-- creditor = '.$creditor.' -->'."\n"; |
| 637 | 637 | // Additionnal information for each payment system |
| 638 | -if (! empty($conf->paypal->enabled)) |
|
| 638 | +if (!empty($conf->paypal->enabled)) |
|
| 639 | 639 | { |
| 640 | 640 | print '<!-- PAYPAL_API_SANDBOX = '.$conf->global->PAYPAL_API_SANDBOX.' -->'."\n"; |
| 641 | 641 | print '<!-- PAYPAL_API_INTEGRAL_OR_PAYPALONLY = '.$conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY.' -->'."\n"; |
| 642 | 642 | } |
| 643 | -if (! empty($conf->paybox->enabled)) |
|
| 643 | +if (!empty($conf->paybox->enabled)) |
|
| 644 | 644 | { |
| 645 | 645 | |
| 646 | 646 | } |
| 647 | -if (! empty($conf->stripe->enabled)) |
|
| 647 | +if (!empty($conf->stripe->enabled)) |
|
| 648 | 648 | { |
| 649 | 649 | print '<!-- STRIPE_LIVE = '.$conf->global->STRIPE_LIVE.' -->'."\n"; |
| 650 | 650 | } |
@@ -655,25 +655,25 @@ discard block |
||
| 655 | 655 | print '<table id="dolpaymenttable" summary="Payment form" class="center">'."\n"; |
| 656 | 656 | |
| 657 | 657 | // Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo) |
| 658 | -$width=0; |
|
| 658 | +$width = 0; |
|
| 659 | 659 | // Define logo and logosmall |
| 660 | -$logosmall=$mysoc->logo_small; |
|
| 661 | -$logo=$mysoc->logo; |
|
| 662 | -$paramlogo='ONLINE_PAYMENT_LOGO_'.$suffix; |
|
| 663 | -if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo; |
|
| 664 | -else if (! empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall=$conf->global->ONLINE_PAYMENT_LOGO; |
|
| 660 | +$logosmall = $mysoc->logo_small; |
|
| 661 | +$logo = $mysoc->logo; |
|
| 662 | +$paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix; |
|
| 663 | +if (!empty($conf->global->$paramlogo)) $logosmall = $conf->global->$paramlogo; |
|
| 664 | +else if (!empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall = $conf->global->ONLINE_PAYMENT_LOGO; |
|
| 665 | 665 | //print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n"; |
| 666 | 666 | // Define urllogo |
| 667 | -$urllogo=''; |
|
| 668 | -if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) |
|
| 667 | +$urllogo = ''; |
|
| 668 | +if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) |
|
| 669 | 669 | { |
| 670 | - $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('thumbs/'.$logosmall); |
|
| 671 | - $width=150; |
|
| 670 | + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('thumbs/'.$logosmall); |
|
| 671 | + $width = 150; |
|
| 672 | 672 | } |
| 673 | -elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) |
|
| 673 | +elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) |
|
| 674 | 674 | { |
| 675 | - $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode($logo); |
|
| 676 | - $width=150; |
|
| 675 | + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode($logo); |
|
| 676 | + $width = 150; |
|
| 677 | 677 | } |
| 678 | 678 | // Output html code for logo |
| 679 | 679 | if ($urllogo) |
@@ -686,18 +686,18 @@ discard block |
||
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | // Output introduction text |
| 689 | -$text=''; |
|
| 690 | -if (! empty($conf->global->PAYMENT_NEWFORM_TEXT)) |
|
| 689 | +$text = ''; |
|
| 690 | +if (!empty($conf->global->PAYMENT_NEWFORM_TEXT)) |
|
| 691 | 691 | { |
| 692 | 692 | $langs->load("members"); |
| 693 | - if (preg_match('/^\((.*)\)$/',$conf->global->PAYMENT_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n"; |
|
| 694 | - else $text.=$conf->global->PAYMENT_NEWFORM_TEXT."<br>\n"; |
|
| 695 | - $text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n"; |
|
| 693 | + if (preg_match('/^\((.*)\)$/', $conf->global->PAYMENT_NEWFORM_TEXT, $reg)) $text .= $langs->trans($reg[1])."<br>\n"; |
|
| 694 | + else $text .= $conf->global->PAYMENT_NEWFORM_TEXT."<br>\n"; |
|
| 695 | + $text = '<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n"; |
|
| 696 | 696 | } |
| 697 | 697 | if (empty($text)) |
| 698 | 698 | { |
| 699 | - $text.='<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnPaymentPage").'</strong></td></tr>'."\n"; |
|
| 700 | - $text.='<tr><td class="textpublicpayment">'.$langs->trans("ThisScreenAllowsYouToPay",$creditor).'<br><br></td></tr>'."\n"; |
|
| 699 | + $text .= '<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnPaymentPage").'</strong></td></tr>'."\n"; |
|
| 700 | + $text .= '<tr><td class="textpublicpayment">'.$langs->trans("ThisScreenAllowsYouToPay", $creditor).'<br><br></td></tr>'."\n"; |
|
| 701 | 701 | } |
| 702 | 702 | print $text; |
| 703 | 703 | |
@@ -706,34 +706,34 @@ discard block |
||
| 706 | 706 | print '<table with="100%" id="tablepublicpayment">'; |
| 707 | 707 | print '<tr><td align="left" colspan="2" class="opacitymedium">'.$langs->trans("ThisIsInformationOnPayment").' :</td></tr>'."\n"; |
| 708 | 708 | |
| 709 | -$found=false; |
|
| 710 | -$error=0; |
|
| 711 | -$var=false; |
|
| 709 | +$found = false; |
|
| 710 | +$error = 0; |
|
| 711 | +$var = false; |
|
| 712 | 712 | |
| 713 | 713 | $object = null; |
| 714 | 714 | |
| 715 | 715 | |
| 716 | 716 | // Free payment |
| 717 | -if (! $source) |
|
| 717 | +if (!$source) |
|
| 718 | 718 | { |
| 719 | - $found=true; |
|
| 720 | - $tag=GETPOST("tag"); |
|
| 721 | - $fulltag=$tag; |
|
| 719 | + $found = true; |
|
| 720 | + $tag = GETPOST("tag"); |
|
| 721 | + $fulltag = $tag; |
|
| 722 | 722 | |
| 723 | 723 | // Creditor |
| 724 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor"); |
|
| 725 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>'; |
|
| 724 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Creditor"); |
|
| 725 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b>'.$creditor.'</b>'; |
|
| 726 | 726 | print '<input type="hidden" name="creditor" value="'.$creditor.'">'; |
| 727 | 727 | print '</td></tr>'."\n"; |
| 728 | 728 | |
| 729 | 729 | // Amount |
| 730 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount"); |
|
| 730 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Amount"); |
|
| 731 | 731 | if (empty($amount)) print ' ('.$langs->trans("ToComplete").')'; |
| 732 | - print '</td><td class="CTableRow'.($var?'1':'2').'">'; |
|
| 733 | - if (empty($amount) || ! is_numeric($amount)) |
|
| 732 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'">'; |
|
| 733 | + if (empty($amount) || !is_numeric($amount)) |
|
| 734 | 734 | { |
| 735 | - print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">'; |
|
| 736 | - print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"),'MT').'">'; |
|
| 735 | + print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">'; |
|
| 736 | + print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount", "alpha"), 'MT').'">'; |
|
| 737 | 737 | } |
| 738 | 738 | else { |
| 739 | 739 | print '<b>'.price($amount).'</b>'; |
@@ -746,8 +746,8 @@ discard block |
||
| 746 | 746 | print '</td></tr>'."\n"; |
| 747 | 747 | |
| 748 | 748 | // Tag |
| 749 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("PaymentCode"); |
|
| 750 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b style="word-break: break-all;">'.$fulltag.'</b>'; |
|
| 749 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("PaymentCode"); |
|
| 750 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b style="word-break: break-all;">'.$fulltag.'</b>'; |
|
| 751 | 751 | print '<input type="hidden" name="tag" value="'.$tag.'">'; |
| 752 | 752 | print '<input type="hidden" name="fulltag" value="'.$fulltag.'">'; |
| 753 | 753 | print '</td></tr>'."\n"; |
@@ -760,71 +760,71 @@ discard block |
||
| 760 | 760 | // Payment on customer order |
| 761 | 761 | if ($source == 'order') |
| 762 | 762 | { |
| 763 | - $found=true; |
|
| 763 | + $found = true; |
|
| 764 | 764 | $langs->load("orders"); |
| 765 | 765 | |
| 766 | 766 | require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
| 767 | 767 | |
| 768 | - $order=new Commande($db); |
|
| 769 | - $result=$order->fetch('',$ref); |
|
| 768 | + $order = new Commande($db); |
|
| 769 | + $result = $order->fetch('', $ref); |
|
| 770 | 770 | if ($result <= 0) |
| 771 | 771 | { |
| 772 | - $mesg=$order->error; |
|
| 772 | + $mesg = $order->error; |
|
| 773 | 773 | $error++; |
| 774 | 774 | } |
| 775 | 775 | else |
| 776 | 776 | { |
| 777 | - $result=$order->fetch_thirdparty($order->socid); |
|
| 777 | + $result = $order->fetch_thirdparty($order->socid); |
|
| 778 | 778 | |
| 779 | 779 | $object = $order; |
| 780 | 780 | } |
| 781 | 781 | |
| 782 | 782 | if ($action != 'dopayment') // Do not change amount if we just click on first dopayment |
| 783 | 783 | { |
| 784 | - $amount=$order->total_ttc; |
|
| 785 | - if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int'); |
|
| 786 | - $amount=price2num($amount); |
|
| 784 | + $amount = $order->total_ttc; |
|
| 785 | + if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int'); |
|
| 786 | + $amount = price2num($amount); |
|
| 787 | 787 | } |
| 788 | 788 | |
| 789 | - $fulltag='ORD='.$order->ref.'.CUS='.$order->thirdparty->id; |
|
| 789 | + $fulltag = 'ORD='.$order->ref.'.CUS='.$order->thirdparty->id; |
|
| 790 | 790 | //$fulltag.='.NAM='.strtr($order->thirdparty->name,"-"," "); |
| 791 | - if (! empty($TAG)) { $tag=$TAG; $fulltag.='.TAG='.$TAG; } |
|
| 792 | - $fulltag=dol_string_unaccent($fulltag); |
|
| 791 | + if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } |
|
| 792 | + $fulltag = dol_string_unaccent($fulltag); |
|
| 793 | 793 | |
| 794 | 794 | // Creditor |
| 795 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor"); |
|
| 796 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>'; |
|
| 795 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Creditor"); |
|
| 796 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b>'.$creditor.'</b>'; |
|
| 797 | 797 | print '<input type="hidden" name="creditor" value="'.$creditor.'">'; |
| 798 | 798 | print '</td></tr>'."\n"; |
| 799 | 799 | |
| 800 | 800 | // Debitor |
| 801 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty"); |
|
| 802 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$order->thirdparty->name.'</b>'; |
|
| 801 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("ThirdParty"); |
|
| 802 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b>'.$order->thirdparty->name.'</b>'; |
|
| 803 | 803 | |
| 804 | 804 | // Object |
| 805 | - $text='<b>'.$langs->trans("PaymentOrderRef",$order->ref).'</b>'; |
|
| 806 | - if (GETPOST('desc','alpha')) $text='<b>'.$langs->trans(GETPOST('desc','alpha')).'</b>'; |
|
| 807 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation"); |
|
| 808 | - print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text; |
|
| 805 | + $text = '<b>'.$langs->trans("PaymentOrderRef", $order->ref).'</b>'; |
|
| 806 | + if (GETPOST('desc', 'alpha')) $text = '<b>'.$langs->trans(GETPOST('desc', 'alpha')).'</b>'; |
|
| 807 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Designation"); |
|
| 808 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'">'.$text; |
|
| 809 | 809 | print '<input type="hidden" name="s" value="'.dol_escape_htmltag($source).'">'; |
| 810 | 810 | print '<input type="hidden" name="ref" value="'.dol_escape_htmltag($order->ref).'">'; |
| 811 | 811 | $directdownloadlink = $order->getLastMainDocLink('commande'); |
| 812 | 812 | if ($directdownloadlink) |
| 813 | 813 | { |
| 814 | 814 | print '<br><a href="'.$directdownloadlink.'">'; |
| 815 | - print img_mime($order->last_main_doc,''); |
|
| 815 | + print img_mime($order->last_main_doc, ''); |
|
| 816 | 816 | print $langs->trans("DownloadDocument").'</a>'; |
| 817 | 817 | } |
| 818 | 818 | print '</td></tr>'."\n"; |
| 819 | 819 | |
| 820 | 820 | // Amount |
| 821 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount"); |
|
| 821 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Amount"); |
|
| 822 | 822 | if (empty($amount)) print ' ('.$langs->trans("ToComplete").')'; |
| 823 | - print '</td><td class="CTableRow'.($var?'1':'2').'">'; |
|
| 824 | - if (empty($amount) || ! is_numeric($amount)) |
|
| 823 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'">'; |
|
| 824 | + if (empty($amount) || !is_numeric($amount)) |
|
| 825 | 825 | { |
| 826 | - print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">'; |
|
| 827 | - print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"),'MT').'">'; |
|
| 826 | + print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">'; |
|
| 827 | + print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount", "alpha"), 'MT').'">'; |
|
| 828 | 828 | } |
| 829 | 829 | else { |
| 830 | 830 | print '<b>'.price($amount).'</b>'; |
@@ -837,21 +837,21 @@ discard block |
||
| 837 | 837 | print '</td></tr>'."\n"; |
| 838 | 838 | |
| 839 | 839 | // Tag |
| 840 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("PaymentCode"); |
|
| 841 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b style="word-break: break-all;">'.$fulltag.'</b>'; |
|
| 840 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("PaymentCode"); |
|
| 841 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b style="word-break: break-all;">'.$fulltag.'</b>'; |
|
| 842 | 842 | print '<input type="hidden" name="tag" value="'.$tag.'">'; |
| 843 | 843 | print '<input type="hidden" name="fulltag" value="'.$fulltag.'">'; |
| 844 | 844 | print '</td></tr>'."\n"; |
| 845 | 845 | |
| 846 | 846 | // Shipping address |
| 847 | - $shipToName=$order->thirdparty->name; |
|
| 848 | - $shipToStreet=$order->thirdparty->address; |
|
| 849 | - $shipToCity=$order->thirdparty->town; |
|
| 850 | - $shipToState=$order->thirdparty->state_code; |
|
| 851 | - $shipToCountryCode=$order->thirdparty->country_code; |
|
| 852 | - $shipToZip=$order->thirdparty->zip; |
|
| 853 | - $shipToStreet2=''; |
|
| 854 | - $phoneNum=$order->thirdparty->phone; |
|
| 847 | + $shipToName = $order->thirdparty->name; |
|
| 848 | + $shipToStreet = $order->thirdparty->address; |
|
| 849 | + $shipToCity = $order->thirdparty->town; |
|
| 850 | + $shipToState = $order->thirdparty->state_code; |
|
| 851 | + $shipToCountryCode = $order->thirdparty->country_code; |
|
| 852 | + $shipToZip = $order->thirdparty->zip; |
|
| 853 | + $shipToStreet2 = ''; |
|
| 854 | + $phoneNum = $order->thirdparty->phone; |
|
| 855 | 855 | if ($shipToName && $shipToStreet && $shipToCity && $shipToCountryCode && $shipToZip) |
| 856 | 856 | { |
| 857 | 857 | print '<input type="hidden" name="shipToName" value="'.$shipToName.'">'."\n"; |
@@ -870,8 +870,8 @@ discard block |
||
| 870 | 870 | if (is_object($order->thirdparty)) print '<input type="hidden" name="thirdparty_id" value="'.$order->thirdparty->id.'">'."\n"; |
| 871 | 871 | print '<input type="hidden" name="email" value="'.$order->thirdparty->email.'">'."\n"; |
| 872 | 872 | print '<input type="hidden" name="vatnumber" value="'.$order->thirdparty->tva_intra.'">'."\n"; |
| 873 | - $labeldesc=$langs->trans("Order").' '.$order->ref; |
|
| 874 | - if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha'); |
|
| 873 | + $labeldesc = $langs->trans("Order").' '.$order->ref; |
|
| 874 | + if (GETPOST('desc', 'alpha')) $labeldesc = GETPOST('desc', 'alpha'); |
|
| 875 | 875 | print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n"; |
| 876 | 876 | } |
| 877 | 877 | |
@@ -879,73 +879,73 @@ discard block |
||
| 879 | 879 | // Payment on customer invoice |
| 880 | 880 | if ($source == 'invoice') |
| 881 | 881 | { |
| 882 | - $found=true; |
|
| 882 | + $found = true; |
|
| 883 | 883 | $langs->load("bills"); |
| 884 | 884 | |
| 885 | 885 | require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
| 886 | 886 | |
| 887 | - $invoice=new Facture($db); |
|
| 888 | - $result=$invoice->fetch('',$ref); |
|
| 887 | + $invoice = new Facture($db); |
|
| 888 | + $result = $invoice->fetch('', $ref); |
|
| 889 | 889 | if ($result <= 0) |
| 890 | 890 | { |
| 891 | - $mesg=$invoice->error; |
|
| 891 | + $mesg = $invoice->error; |
|
| 892 | 892 | $error++; |
| 893 | 893 | } |
| 894 | 894 | else |
| 895 | 895 | { |
| 896 | - $result=$invoice->fetch_thirdparty($invoice->socid); |
|
| 896 | + $result = $invoice->fetch_thirdparty($invoice->socid); |
|
| 897 | 897 | |
| 898 | 898 | $object = $invoice; |
| 899 | 899 | } |
| 900 | 900 | |
| 901 | 901 | if ($action != 'dopayment') // Do not change amount if we just click on first dopayment |
| 902 | 902 | { |
| 903 | - $amount=price2num($invoice->total_ttc - $invoice->getSommePaiement()); |
|
| 904 | - if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int'); |
|
| 905 | - $amount=price2num($amount); |
|
| 903 | + $amount = price2num($invoice->total_ttc - $invoice->getSommePaiement()); |
|
| 904 | + if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int'); |
|
| 905 | + $amount = price2num($amount); |
|
| 906 | 906 | } |
| 907 | 907 | |
| 908 | - $fulltag='INV='.$invoice->ref.'.CUS='.$invoice->thirdparty->id; |
|
| 908 | + $fulltag = 'INV='.$invoice->ref.'.CUS='.$invoice->thirdparty->id; |
|
| 909 | 909 | //$fulltag.='.NAM='.strtr($invoice->thirdparty->name,"-"," "); |
| 910 | - if (! empty($TAG)) { $tag=$TAG; $fulltag.='.TAG='.$TAG; } |
|
| 911 | - $fulltag=dol_string_unaccent($fulltag); |
|
| 910 | + if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } |
|
| 911 | + $fulltag = dol_string_unaccent($fulltag); |
|
| 912 | 912 | |
| 913 | 913 | // Creditor |
| 914 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor"); |
|
| 915 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>'; |
|
| 914 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Creditor"); |
|
| 915 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b>'.$creditor.'</b>'; |
|
| 916 | 916 | print '<input type="hidden" name="creditor" value="'.dol_escape_htmltag($creditor).'">'; |
| 917 | 917 | print '</td></tr>'."\n"; |
| 918 | 918 | |
| 919 | 919 | // Debitor |
| 920 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty"); |
|
| 921 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$invoice->thirdparty->name.'</b>'; |
|
| 920 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("ThirdParty"); |
|
| 921 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b>'.$invoice->thirdparty->name.'</b>'; |
|
| 922 | 922 | |
| 923 | 923 | // Object |
| 924 | - $text='<b>'.$langs->trans("PaymentInvoiceRef",$invoice->ref).'</b>'; |
|
| 925 | - if (GETPOST('desc','alpha')) $text='<b>'.$langs->trans(GETPOST('desc','alpha')).'</b>'; |
|
| 926 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation"); |
|
| 927 | - print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text; |
|
| 924 | + $text = '<b>'.$langs->trans("PaymentInvoiceRef", $invoice->ref).'</b>'; |
|
| 925 | + if (GETPOST('desc', 'alpha')) $text = '<b>'.$langs->trans(GETPOST('desc', 'alpha')).'</b>'; |
|
| 926 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Designation"); |
|
| 927 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'">'.$text; |
|
| 928 | 928 | print '<input type="hidden" name="s" value="'.dol_escape_htmltag($source).'">'; |
| 929 | 929 | print '<input type="hidden" name="ref" value="'.dol_escape_htmltag($invoice->ref).'">'; |
| 930 | 930 | $directdownloadlink = $invoice->getLastMainDocLink('facture'); |
| 931 | 931 | if ($directdownloadlink) |
| 932 | 932 | { |
| 933 | 933 | print '<br><a href="'.$directdownloadlink.'">'; |
| 934 | - print img_mime($invoice->last_main_doc,''); |
|
| 934 | + print img_mime($invoice->last_main_doc, ''); |
|
| 935 | 935 | print $langs->trans("DownloadDocument").'</a>'; |
| 936 | 936 | } |
| 937 | 937 | print '</td></tr>'."\n"; |
| 938 | 938 | |
| 939 | 939 | // Amount |
| 940 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("PaymentAmount"); |
|
| 940 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("PaymentAmount"); |
|
| 941 | 941 | if (empty($amount) && empty($object->paye)) print ' ('.$langs->trans("ToComplete").')'; |
| 942 | - print '</td><td class="CTableRow'.($var?'1':'2').'">'; |
|
| 942 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'">'; |
|
| 943 | 943 | if (empty($object->paye)) |
| 944 | 944 | { |
| 945 | - if (empty($amount) || ! is_numeric($amount)) |
|
| 945 | + if (empty($amount) || !is_numeric($amount)) |
|
| 946 | 946 | { |
| 947 | - print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">'; |
|
| 948 | - print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"), 'MT').'">'; |
|
| 947 | + print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">'; |
|
| 948 | + print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount", "alpha"), 'MT').'">'; |
|
| 949 | 949 | } |
| 950 | 950 | else { |
| 951 | 951 | print '<b>'.price($amount).'</b>'; |
@@ -963,8 +963,8 @@ discard block |
||
| 963 | 963 | print '</td></tr>'."\n"; |
| 964 | 964 | |
| 965 | 965 | // Tag |
| 966 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("PaymentCode"); |
|
| 967 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b style="word-break: break-all;">'.$fulltag.'</b>'; |
|
| 966 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("PaymentCode"); |
|
| 967 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b style="word-break: break-all;">'.$fulltag.'</b>'; |
|
| 968 | 968 | print '<input type="hidden" name="tag" value="'.$tag.'">'; |
| 969 | 969 | print '<input type="hidden" name="fulltag" value="'.$fulltag.'">'; |
| 970 | 970 | print '</td></tr>'."\n"; |
@@ -972,21 +972,21 @@ discard block |
||
| 972 | 972 | // Add download link |
| 973 | 973 | if ($download > 0) |
| 974 | 974 | { |
| 975 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Document"); |
|
| 976 | - print '</td><td class="CTableRow'.($var?'1':'2').'">'; |
|
| 975 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Document"); |
|
| 976 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'">'; |
|
| 977 | 977 | print $invoice->getDirectExternalLink(1); |
| 978 | 978 | print '</td></tr>'."\n"; |
| 979 | 979 | } |
| 980 | 980 | |
| 981 | 981 | // Shipping address |
| 982 | - $shipToName=$invoice->thirdparty->name; |
|
| 983 | - $shipToStreet=$invoice->thirdparty->address; |
|
| 984 | - $shipToCity=$invoice->thirdparty->town; |
|
| 985 | - $shipToState=$invoice->thirdparty->state_code; |
|
| 986 | - $shipToCountryCode=$invoice->thirdparty->country_code; |
|
| 987 | - $shipToZip=$invoice->thirdparty->zip; |
|
| 988 | - $shipToStreet2=''; |
|
| 989 | - $phoneNum=$invoice->thirdparty->phone; |
|
| 982 | + $shipToName = $invoice->thirdparty->name; |
|
| 983 | + $shipToStreet = $invoice->thirdparty->address; |
|
| 984 | + $shipToCity = $invoice->thirdparty->town; |
|
| 985 | + $shipToState = $invoice->thirdparty->state_code; |
|
| 986 | + $shipToCountryCode = $invoice->thirdparty->country_code; |
|
| 987 | + $shipToZip = $invoice->thirdparty->zip; |
|
| 988 | + $shipToStreet2 = ''; |
|
| 989 | + $phoneNum = $invoice->thirdparty->phone; |
|
| 990 | 990 | if ($shipToName && $shipToStreet && $shipToCity && $shipToCountryCode && $shipToZip) |
| 991 | 991 | { |
| 992 | 992 | print '<input type="hidden" name="shipToName" value="'.$shipToName.'">'."\n"; |
@@ -1005,26 +1005,26 @@ discard block |
||
| 1005 | 1005 | if (is_object($invoice->thirdparty)) print '<input type="hidden" name="thirdparty_id" value="'.$invoice->thirdparty->id.'">'."\n"; |
| 1006 | 1006 | print '<input type="hidden" name="email" value="'.$invoice->thirdparty->email.'">'."\n"; |
| 1007 | 1007 | print '<input type="hidden" name="vatnumber" value="'.$invoice->thirdparty->tva_intra.'">'."\n"; |
| 1008 | - $labeldesc=$langs->trans("Invoice").' '.$invoice->ref; |
|
| 1009 | - if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha'); |
|
| 1008 | + $labeldesc = $langs->trans("Invoice").' '.$invoice->ref; |
|
| 1009 | + if (GETPOST('desc', 'alpha')) $labeldesc = GETPOST('desc', 'alpha'); |
|
| 1010 | 1010 | print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n"; |
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | 1013 | // Payment on contract line |
| 1014 | 1014 | if ($source == 'contractline') |
| 1015 | 1015 | { |
| 1016 | - $found=true; |
|
| 1016 | + $found = true; |
|
| 1017 | 1017 | $langs->load("contracts"); |
| 1018 | 1018 | |
| 1019 | 1019 | require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
| 1020 | 1020 | |
| 1021 | - $contract=new Contrat($db); |
|
| 1022 | - $contractline=new ContratLigne($db); |
|
| 1021 | + $contract = new Contrat($db); |
|
| 1022 | + $contractline = new ContratLigne($db); |
|
| 1023 | 1023 | |
| 1024 | - $result=$contractline->fetch('',$ref); |
|
| 1024 | + $result = $contractline->fetch('', $ref); |
|
| 1025 | 1025 | if ($result <= 0) |
| 1026 | 1026 | { |
| 1027 | - $mesg=$contractline->error; |
|
| 1027 | + $mesg = $contractline->error; |
|
| 1028 | 1028 | $error++; |
| 1029 | 1029 | } |
| 1030 | 1030 | else |
@@ -1033,35 +1033,35 @@ discard block |
||
| 1033 | 1033 | { |
| 1034 | 1034 | $object = $contractline; |
| 1035 | 1035 | |
| 1036 | - $result=$contract->fetch($contractline->fk_contrat); |
|
| 1036 | + $result = $contract->fetch($contractline->fk_contrat); |
|
| 1037 | 1037 | if ($result > 0) |
| 1038 | 1038 | { |
| 1039 | - $result=$contract->fetch_thirdparty($contract->socid); |
|
| 1039 | + $result = $contract->fetch_thirdparty($contract->socid); |
|
| 1040 | 1040 | } |
| 1041 | 1041 | else |
| 1042 | 1042 | { |
| 1043 | - $mesg=$contract->error; |
|
| 1043 | + $mesg = $contract->error; |
|
| 1044 | 1044 | $error++; |
| 1045 | 1045 | } |
| 1046 | 1046 | } |
| 1047 | 1047 | else |
| 1048 | 1048 | { |
| 1049 | - $mesg='ErrorRecordNotFound'; |
|
| 1049 | + $mesg = 'ErrorRecordNotFound'; |
|
| 1050 | 1050 | $error++; |
| 1051 | 1051 | } |
| 1052 | 1052 | } |
| 1053 | 1053 | |
| 1054 | 1054 | if ($action != 'dopayment') // Do not change amount if we just click on first dopayment |
| 1055 | 1055 | { |
| 1056 | - $amount=$contractline->total_ttc; |
|
| 1056 | + $amount = $contractline->total_ttc; |
|
| 1057 | 1057 | |
| 1058 | - if ($contractline->fk_product && ! empty($conf->global->PAYMENT_USE_NEW_PRICE_FOR_CONTRACTLINES)) |
|
| 1058 | + if ($contractline->fk_product && !empty($conf->global->PAYMENT_USE_NEW_PRICE_FOR_CONTRACTLINES)) |
|
| 1059 | 1059 | { |
| 1060 | - $product=new Product($db); |
|
| 1061 | - $result=$product->fetch($contractline->fk_product); |
|
| 1060 | + $product = new Product($db); |
|
| 1061 | + $result = $product->fetch($contractline->fk_product); |
|
| 1062 | 1062 | |
| 1063 | 1063 | // We define price for product (TODO Put this in a method in product class) |
| 1064 | - if (! empty($conf->global->PRODUIT_MULTIPRICES)) |
|
| 1064 | + if (!empty($conf->global->PRODUIT_MULTIPRICES)) |
|
| 1065 | 1065 | { |
| 1066 | 1066 | $pu_ht = $product->multiprices[$contract->thirdparty->price_level]; |
| 1067 | 1067 | $pu_ttc = $product->multiprices_ttc[$contract->thirdparty->price_level]; |
@@ -1074,100 +1074,100 @@ discard block |
||
| 1074 | 1074 | $price_base_type = $product->price_base_type; |
| 1075 | 1075 | } |
| 1076 | 1076 | |
| 1077 | - $amount=$pu_ttc; |
|
| 1077 | + $amount = $pu_ttc; |
|
| 1078 | 1078 | if (empty($amount)) |
| 1079 | 1079 | { |
| 1080 | - dol_print_error('','ErrorNoPriceDefinedForThisProduct'); |
|
| 1080 | + dol_print_error('', 'ErrorNoPriceDefinedForThisProduct'); |
|
| 1081 | 1081 | exit; |
| 1082 | 1082 | } |
| 1083 | 1083 | } |
| 1084 | 1084 | |
| 1085 | - if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int'); |
|
| 1086 | - $amount=price2num($amount); |
|
| 1085 | + if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int'); |
|
| 1086 | + $amount = price2num($amount); |
|
| 1087 | 1087 | } |
| 1088 | 1088 | |
| 1089 | - $fulltag='COL='.$contractline->ref.'.CON='.$contract->ref.'.CUS='.$contract->thirdparty->id.'.DAT='.dol_print_date(dol_now(),'%Y%m%d%H%M'); |
|
| 1089 | + $fulltag = 'COL='.$contractline->ref.'.CON='.$contract->ref.'.CUS='.$contract->thirdparty->id.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M'); |
|
| 1090 | 1090 | //$fulltag.='.NAM='.strtr($contract->thirdparty->name,"-"," "); |
| 1091 | - if (! empty($TAG)) { $tag=$TAG; $fulltag.='.TAG='.$TAG; } |
|
| 1092 | - $fulltag=dol_string_unaccent($fulltag); |
|
| 1091 | + if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } |
|
| 1092 | + $fulltag = dol_string_unaccent($fulltag); |
|
| 1093 | 1093 | |
| 1094 | - $qty=1; |
|
| 1095 | - if (GETPOST('qty')) $qty=GETPOST('qty'); |
|
| 1094 | + $qty = 1; |
|
| 1095 | + if (GETPOST('qty')) $qty = GETPOST('qty'); |
|
| 1096 | 1096 | |
| 1097 | 1097 | // Creditor |
| 1098 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor"); |
|
| 1099 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>'; |
|
| 1098 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Creditor"); |
|
| 1099 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b>'.$creditor.'</b>'; |
|
| 1100 | 1100 | print '<input type="hidden" name="creditor" value="'.$creditor.'">'; |
| 1101 | 1101 | print '</td></tr>'."\n"; |
| 1102 | 1102 | |
| 1103 | 1103 | // Debitor |
| 1104 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("ThirdParty"); |
|
| 1105 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$contract->thirdparty->name.'</b>'; |
|
| 1104 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("ThirdParty"); |
|
| 1105 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b>'.$contract->thirdparty->name.'</b>'; |
|
| 1106 | 1106 | |
| 1107 | 1107 | // Object |
| 1108 | - $text='<b>'.$langs->trans("PaymentRenewContractId",$contract->ref,$contractline->ref).'</b>'; |
|
| 1108 | + $text = '<b>'.$langs->trans("PaymentRenewContractId", $contract->ref, $contractline->ref).'</b>'; |
|
| 1109 | 1109 | if ($contractline->fk_product) |
| 1110 | 1110 | { |
| 1111 | - $text.='<br>'.$product->ref.($product->label?' - '.$product->label:''); |
|
| 1111 | + $text .= '<br>'.$product->ref.($product->label ? ' - '.$product->label : ''); |
|
| 1112 | 1112 | } |
| 1113 | - if ($contractline->description) $text.='<br>'.dol_htmlentitiesbr($contractline->description); |
|
| 1113 | + if ($contractline->description) $text .= '<br>'.dol_htmlentitiesbr($contractline->description); |
|
| 1114 | 1114 | //if ($contractline->date_fin_validite) { |
| 1115 | 1115 | // $text.='<br>'.$langs->trans("DateEndPlanned").': '; |
| 1116 | 1116 | // $text.=dol_print_date($contractline->date_fin_validite); |
| 1117 | 1117 | //} |
| 1118 | 1118 | if ($contractline->date_fin_validite) |
| 1119 | 1119 | { |
| 1120 | - $text.='<br>'.$langs->trans("ExpiredSince").': '.dol_print_date($contractline->date_fin_validite); |
|
| 1120 | + $text .= '<br>'.$langs->trans("ExpiredSince").': '.dol_print_date($contractline->date_fin_validite); |
|
| 1121 | 1121 | } |
| 1122 | - if (GETPOST('desc','alpha')) $text='<b>'.$langs->trans(GETPOST('desc','alpha')).'</b>'; |
|
| 1123 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation"); |
|
| 1124 | - print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text; |
|
| 1122 | + if (GETPOST('desc', 'alpha')) $text = '<b>'.$langs->trans(GETPOST('desc', 'alpha')).'</b>'; |
|
| 1123 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Designation"); |
|
| 1124 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'">'.$text; |
|
| 1125 | 1125 | print '<input type="hidden" name="source" value="'.dol_escape_htmltag($source).'">'; |
| 1126 | 1126 | print '<input type="hidden" name="ref" value="'.dol_escape_htmltag($contractline->ref).'">'; |
| 1127 | 1127 | $directdownloadlink = $contract->getLastMainDocLink('contract'); |
| 1128 | 1128 | if ($directdownloadlink) |
| 1129 | 1129 | { |
| 1130 | 1130 | print '<br><a href="'.$directdownloadlink.'">'; |
| 1131 | - print img_mime($contract->last_main_doc,''); |
|
| 1131 | + print img_mime($contract->last_main_doc, ''); |
|
| 1132 | 1132 | print $langs->trans("DownloadDocument").'</a>'; |
| 1133 | 1133 | } |
| 1134 | 1134 | print '</td></tr>'."\n"; |
| 1135 | 1135 | |
| 1136 | 1136 | // Quantity |
| 1137 | - $label=$langs->trans("Quantity"); |
|
| 1138 | - $qty=1; |
|
| 1139 | - $duration=''; |
|
| 1137 | + $label = $langs->trans("Quantity"); |
|
| 1138 | + $qty = 1; |
|
| 1139 | + $duration = ''; |
|
| 1140 | 1140 | if ($contractline->fk_product) |
| 1141 | 1141 | { |
| 1142 | 1142 | if ($product->isService() && $product->duration_value > 0) |
| 1143 | 1143 | { |
| 1144 | - $label=$langs->trans("Duration"); |
|
| 1144 | + $label = $langs->trans("Duration"); |
|
| 1145 | 1145 | |
| 1146 | 1146 | // TODO Put this in a global method |
| 1147 | 1147 | if ($product->duration_value > 1) |
| 1148 | 1148 | { |
| 1149 | - $dur=array("h"=>$langs->trans("Hours"),"d"=>$langs->trans("DurationDays"),"w"=>$langs->trans("DurationWeeks"),"m"=>$langs->trans("DurationMonths"),"y"=>$langs->trans("DurationYears")); |
|
| 1149 | + $dur = array("h"=>$langs->trans("Hours"), "d"=>$langs->trans("DurationDays"), "w"=>$langs->trans("DurationWeeks"), "m"=>$langs->trans("DurationMonths"), "y"=>$langs->trans("DurationYears")); |
|
| 1150 | 1150 | } |
| 1151 | 1151 | else |
| 1152 | 1152 | { |
| 1153 | - $dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("DurationDay"),"w"=>$langs->trans("DurationWeek"),"m"=>$langs->trans("DurationMonth"),"y"=>$langs->trans("DurationYear")); |
|
| 1153 | + $dur = array("h"=>$langs->trans("Hour"), "d"=>$langs->trans("DurationDay"), "w"=>$langs->trans("DurationWeek"), "m"=>$langs->trans("DurationMonth"), "y"=>$langs->trans("DurationYear")); |
|
| 1154 | 1154 | } |
| 1155 | - $duration=$product->duration_value.' '.$dur[$product->duration_unit]; |
|
| 1155 | + $duration = $product->duration_value.' '.$dur[$product->duration_unit]; |
|
| 1156 | 1156 | } |
| 1157 | 1157 | } |
| 1158 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$label.'</td>'; |
|
| 1159 | - print '<td class="CTableRow'.($var?'1':'2').'"><b>'.($duration?$duration:$qty).'</b>'; |
|
| 1158 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$label.'</td>'; |
|
| 1159 | + print '<td class="CTableRow'.($var ? '1' : '2').'"><b>'.($duration ? $duration : $qty).'</b>'; |
|
| 1160 | 1160 | print '<input type="hidden" name="newqty" value="'.dol_escape_htmltag($qty).'">'; |
| 1161 | 1161 | print '</b></td></tr>'."\n"; |
| 1162 | 1162 | |
| 1163 | 1163 | // Amount |
| 1164 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount"); |
|
| 1164 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Amount"); |
|
| 1165 | 1165 | if (empty($amount)) print ' ('.$langs->trans("ToComplete").')'; |
| 1166 | - print '</td><td class="CTableRow'.($var?'1':'2').'">'; |
|
| 1167 | - if (empty($amount) || ! is_numeric($amount)) |
|
| 1166 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'">'; |
|
| 1167 | + if (empty($amount) || !is_numeric($amount)) |
|
| 1168 | 1168 | { |
| 1169 | - print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">'; |
|
| 1170 | - print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"),'MT').'">'; |
|
| 1169 | + print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">'; |
|
| 1170 | + print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount", "alpha"), 'MT').'">'; |
|
| 1171 | 1171 | } |
| 1172 | 1172 | else { |
| 1173 | 1173 | print '<b>'.price($amount).'</b>'; |
@@ -1180,21 +1180,21 @@ discard block |
||
| 1180 | 1180 | print '</td></tr>'."\n"; |
| 1181 | 1181 | |
| 1182 | 1182 | // Tag |
| 1183 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("PaymentCode"); |
|
| 1184 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b style="word-break: break-all;">'.$fulltag.'</b>'; |
|
| 1183 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("PaymentCode"); |
|
| 1184 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b style="word-break: break-all;">'.$fulltag.'</b>'; |
|
| 1185 | 1185 | print '<input type="hidden" name="tag" value="'.$tag.'">'; |
| 1186 | 1186 | print '<input type="hidden" name="fulltag" value="'.$fulltag.'">'; |
| 1187 | 1187 | print '</td></tr>'."\n"; |
| 1188 | 1188 | |
| 1189 | 1189 | // Shipping address |
| 1190 | - $shipToName=$contract->thirdparty->name; |
|
| 1191 | - $shipToStreet=$contract->thirdparty->address; |
|
| 1192 | - $shipToCity=$contract->thirdparty->town; |
|
| 1193 | - $shipToState=$contract->thirdparty->state_code; |
|
| 1194 | - $shipToCountryCode=$contract->thirdparty->country_code; |
|
| 1195 | - $shipToZip=$contract->thirdparty->zip; |
|
| 1196 | - $shipToStreet2=''; |
|
| 1197 | - $phoneNum=$contract->thirdparty->phone; |
|
| 1190 | + $shipToName = $contract->thirdparty->name; |
|
| 1191 | + $shipToStreet = $contract->thirdparty->address; |
|
| 1192 | + $shipToCity = $contract->thirdparty->town; |
|
| 1193 | + $shipToState = $contract->thirdparty->state_code; |
|
| 1194 | + $shipToCountryCode = $contract->thirdparty->country_code; |
|
| 1195 | + $shipToZip = $contract->thirdparty->zip; |
|
| 1196 | + $shipToStreet2 = ''; |
|
| 1197 | + $phoneNum = $contract->thirdparty->phone; |
|
| 1198 | 1198 | if ($shipToName && $shipToStreet && $shipToCity && $shipToCountryCode && $shipToZip) |
| 1199 | 1199 | { |
| 1200 | 1200 | print '<input type="hidden" name="shipToName" value="'.$shipToName.'">'."\n"; |
@@ -1213,66 +1213,66 @@ discard block |
||
| 1213 | 1213 | if (is_object($contract->thirdparty)) print '<input type="hidden" name="thirdparty_id" value="'.$contract->thirdparty->id.'">'."\n"; |
| 1214 | 1214 | print '<input type="hidden" name="email" value="'.$contract->thirdparty->email.'">'."\n"; |
| 1215 | 1215 | print '<input type="hidden" name="vatnumber" value="'.$contract->thirdparty->tva_intra.'">'."\n"; |
| 1216 | - $labeldesc=$langs->trans("Contract").' '.$contract->ref; |
|
| 1217 | - if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha'); |
|
| 1216 | + $labeldesc = $langs->trans("Contract").' '.$contract->ref; |
|
| 1217 | + if (GETPOST('desc', 'alpha')) $labeldesc = GETPOST('desc', 'alpha'); |
|
| 1218 | 1218 | print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n"; |
| 1219 | 1219 | } |
| 1220 | 1220 | |
| 1221 | 1221 | // Payment on member subscription |
| 1222 | 1222 | if ($source == 'membersubscription') |
| 1223 | 1223 | { |
| 1224 | - $found=true; |
|
| 1224 | + $found = true; |
|
| 1225 | 1225 | $langs->load("members"); |
| 1226 | 1226 | |
| 1227 | 1227 | require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
| 1228 | 1228 | require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; |
| 1229 | 1229 | |
| 1230 | - $member=new Adherent($db); |
|
| 1231 | - $result=$member->fetch('',$ref); |
|
| 1230 | + $member = new Adherent($db); |
|
| 1231 | + $result = $member->fetch('', $ref); |
|
| 1232 | 1232 | if ($result <= 0) |
| 1233 | 1233 | { |
| 1234 | - $mesg=$member->error; |
|
| 1234 | + $mesg = $member->error; |
|
| 1235 | 1235 | $error++; |
| 1236 | 1236 | } |
| 1237 | 1237 | else |
| 1238 | 1238 | { |
| 1239 | 1239 | $member->fetch_thirdparty(); |
| 1240 | 1240 | $object = $member; |
| 1241 | - $subscription=new Subscription($db); |
|
| 1241 | + $subscription = new Subscription($db); |
|
| 1242 | 1242 | } |
| 1243 | 1243 | |
| 1244 | 1244 | if ($action != 'dopayment') // Do not change amount if we just click on first dopayment |
| 1245 | 1245 | { |
| 1246 | - $amount=$subscription->total_ttc; |
|
| 1247 | - if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int'); |
|
| 1248 | - $amount=price2num($amount); |
|
| 1246 | + $amount = $subscription->total_ttc; |
|
| 1247 | + if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int'); |
|
| 1248 | + $amount = price2num($amount); |
|
| 1249 | 1249 | } |
| 1250 | 1250 | |
| 1251 | - $fulltag='MEM='.$member->id.'.DAT='.dol_print_date(dol_now(),'%Y%m%d%H%M'); |
|
| 1252 | - if (! empty($TAG)) { $tag=$TAG; $fulltag.='.TAG='.$TAG; } |
|
| 1253 | - $fulltag=dol_string_unaccent($fulltag); |
|
| 1251 | + $fulltag = 'MEM='.$member->id.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M'); |
|
| 1252 | + if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } |
|
| 1253 | + $fulltag = dol_string_unaccent($fulltag); |
|
| 1254 | 1254 | |
| 1255 | 1255 | // Creditor |
| 1256 | 1256 | |
| 1257 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor"); |
|
| 1258 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$creditor.'</b>'; |
|
| 1257 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Creditor"); |
|
| 1258 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b>'.$creditor.'</b>'; |
|
| 1259 | 1259 | print '<input type="hidden" name="creditor" value="'.$creditor.'">'; |
| 1260 | 1260 | print '</td></tr>'."\n"; |
| 1261 | 1261 | |
| 1262 | 1262 | // Debitor |
| 1263 | 1263 | |
| 1264 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Member"); |
|
| 1265 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'; |
|
| 1266 | - if ($member->morphy == 'mor' && ! empty($member->societe)) print $member->societe; |
|
| 1264 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Member"); |
|
| 1265 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b>'; |
|
| 1266 | + if ($member->morphy == 'mor' && !empty($member->societe)) print $member->societe; |
|
| 1267 | 1267 | else print $member->getFullName($langs); |
| 1268 | 1268 | print '</b>'; |
| 1269 | 1269 | |
| 1270 | 1270 | // Object |
| 1271 | 1271 | |
| 1272 | - $text='<b>'.$langs->trans("PaymentSubscription").'</b>'; |
|
| 1273 | - if (GETPOST('desc','alpha')) $text='<b>'.$langs->trans(GETPOST('desc','alpha')).'</b>'; |
|
| 1274 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation"); |
|
| 1275 | - print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text; |
|
| 1272 | + $text = '<b>'.$langs->trans("PaymentSubscription").'</b>'; |
|
| 1273 | + if (GETPOST('desc', 'alpha')) $text = '<b>'.$langs->trans(GETPOST('desc', 'alpha')).'</b>'; |
|
| 1274 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Designation"); |
|
| 1275 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'">'.$text; |
|
| 1276 | 1276 | print '<input type="hidden" name="source" value="'.dol_escape_htmltag($source).'">'; |
| 1277 | 1277 | print '<input type="hidden" name="ref" value="'.dol_escape_htmltag($member->ref).'">'; |
| 1278 | 1278 | print '</td></tr>'."\n"; |
@@ -1281,58 +1281,58 @@ discard block |
||
| 1281 | 1281 | { |
| 1282 | 1282 | // Last subscription date |
| 1283 | 1283 | |
| 1284 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("LastSubscriptionDate"); |
|
| 1285 | - print '</td><td class="CTableRow'.($var?'1':'2').'">'.dol_print_date($member->last_subscription_date,'day'); |
|
| 1284 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("LastSubscriptionDate"); |
|
| 1285 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'">'.dol_print_date($member->last_subscription_date, 'day'); |
|
| 1286 | 1286 | print '</td></tr>'."\n"; |
| 1287 | 1287 | |
| 1288 | 1288 | // Last subscription amount |
| 1289 | 1289 | |
| 1290 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("LastSubscriptionAmount"); |
|
| 1291 | - print '</td><td class="CTableRow'.($var?'1':'2').'">'.price($member->last_subscription_amount); |
|
| 1290 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("LastSubscriptionAmount"); |
|
| 1291 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'">'.price($member->last_subscription_amount); |
|
| 1292 | 1292 | print '</td></tr>'."\n"; |
| 1293 | 1293 | |
| 1294 | - if (empty($amount) && ! GETPOST('newamount','alpha')) $_GET['newamount']=$member->last_subscription_amount; |
|
| 1294 | + if (empty($amount) && !GETPOST('newamount', 'alpha')) $_GET['newamount'] = $member->last_subscription_amount; |
|
| 1295 | 1295 | } |
| 1296 | 1296 | |
| 1297 | 1297 | // Amount |
| 1298 | 1298 | |
| 1299 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount"); |
|
| 1299 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Amount"); |
|
| 1300 | 1300 | if (empty($amount)) |
| 1301 | 1301 | { |
| 1302 | 1302 | if (empty($conf->global->MEMBER_NEWFORM_AMOUNT)) print ' ('.$langs->trans("ToComplete"); |
| 1303 | - if (! empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) print ' - <a href="'.$conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO.'" rel="external" target="_blank">'.$langs->trans("SeeHere").'</a>'; |
|
| 1303 | + if (!empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) print ' - <a href="'.$conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO.'" rel="external" target="_blank">'.$langs->trans("SeeHere").'</a>'; |
|
| 1304 | 1304 | if (empty($conf->global->MEMBER_NEWFORM_AMOUNT)) print ')'; |
| 1305 | 1305 | } |
| 1306 | - print '</td><td class="CTableRow'.($var?'1':'2').'">'; |
|
| 1307 | - $valtoshow=''; |
|
| 1308 | - if (empty($amount) || ! is_numeric($amount)) |
|
| 1306 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'">'; |
|
| 1307 | + $valtoshow = ''; |
|
| 1308 | + if (empty($amount) || !is_numeric($amount)) |
|
| 1309 | 1309 | { |
| 1310 | - $valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); |
|
| 1310 | + $valtoshow = price2num(GETPOST("newamount", 'alpha'), 'MT'); |
|
| 1311 | 1311 | // force default subscription amount to value defined into constant... |
| 1312 | 1312 | if (empty($valtoshow)) |
| 1313 | 1313 | { |
| 1314 | - if (! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { |
|
| 1315 | - if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { |
|
| 1314 | + if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { |
|
| 1315 | + if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { |
|
| 1316 | 1316 | $valtoshow = $conf->global->MEMBER_NEWFORM_AMOUNT; |
| 1317 | 1317 | } |
| 1318 | 1318 | } |
| 1319 | 1319 | else { |
| 1320 | - if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { |
|
| 1320 | + if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { |
|
| 1321 | 1321 | $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; |
| 1322 | 1322 | } |
| 1323 | 1323 | } |
| 1324 | 1324 | } |
| 1325 | 1325 | } |
| 1326 | - if (empty($amount) || ! is_numeric($amount)) |
|
| 1326 | + if (empty($amount) || !is_numeric($amount)) |
|
| 1327 | 1327 | { |
| 1328 | 1328 | //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); |
| 1329 | - if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); |
|
| 1330 | - print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">'; |
|
| 1329 | + if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); |
|
| 1330 | + print '<input type="hidden" name="amount" value="'.GETPOST("amount", 'int').'">'; |
|
| 1331 | 1331 | print '<input class="flat maxwidth75" type="text" name="newamount" value="'.$valtoshow.'">'; |
| 1332 | 1332 | } |
| 1333 | 1333 | else { |
| 1334 | - $valtoshow=$amount; |
|
| 1335 | - if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); |
|
| 1334 | + $valtoshow = $amount; |
|
| 1335 | + if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); |
|
| 1336 | 1336 | print '<b>'.price($valtoshow).'</b>'; |
| 1337 | 1337 | print '<input type="hidden" name="amount" value="'.$valtoshow.'">'; |
| 1338 | 1338 | print '<input type="hidden" name="newamount" value="'.$valtoshow.'">'; |
@@ -1344,21 +1344,21 @@ discard block |
||
| 1344 | 1344 | |
| 1345 | 1345 | // Tag |
| 1346 | 1346 | |
| 1347 | - print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("PaymentCode"); |
|
| 1348 | - print '</td><td class="CTableRow'.($var?'1':'2').'"><b style="word-break: break-all;">'.$fulltag.'</b>'; |
|
| 1347 | + print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("PaymentCode"); |
|
| 1348 | + print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b style="word-break: break-all;">'.$fulltag.'</b>'; |
|
| 1349 | 1349 | print '<input type="hidden" name="tag" value="'.$tag.'">'; |
| 1350 | 1350 | print '<input type="hidden" name="fulltag" value="'.$fulltag.'">'; |
| 1351 | 1351 | print '</td></tr>'."\n"; |
| 1352 | 1352 | |
| 1353 | 1353 | // Shipping address |
| 1354 | - $shipToName=$member->getFullName($langs); |
|
| 1355 | - $shipToStreet=$member->address; |
|
| 1356 | - $shipToCity=$member->town; |
|
| 1357 | - $shipToState=$member->state_code; |
|
| 1358 | - $shipToCountryCode=$member->country_code; |
|
| 1359 | - $shipToZip=$member->zip; |
|
| 1360 | - $shipToStreet2=''; |
|
| 1361 | - $phoneNum=$member->phone; |
|
| 1354 | + $shipToName = $member->getFullName($langs); |
|
| 1355 | + $shipToStreet = $member->address; |
|
| 1356 | + $shipToCity = $member->town; |
|
| 1357 | + $shipToState = $member->state_code; |
|
| 1358 | + $shipToCountryCode = $member->country_code; |
|
| 1359 | + $shipToZip = $member->zip; |
|
| 1360 | + $shipToStreet2 = ''; |
|
| 1361 | + $phoneNum = $member->phone; |
|
| 1362 | 1362 | if ($shipToName && $shipToStreet && $shipToCity && $shipToCountryCode && $shipToZip) |
| 1363 | 1363 | { |
| 1364 | 1364 | print '<input type="hidden" name="shipToName" value="'.$shipToName.'">'."\n"; |
@@ -1377,14 +1377,14 @@ discard block |
||
| 1377 | 1377 | if (is_object($member->thirdparty)) print '<input type="hidden" name="thirdparty_id" value="'.$member->thirdparty->id.'">'."\n"; |
| 1378 | 1378 | print '<input type="hidden" name="email" value="'.$member->email.'">'."\n"; |
| 1379 | 1379 | $labeldesc = $langs->trans("PaymentSubscription"); |
| 1380 | - if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha'); |
|
| 1380 | + if (GETPOST('desc', 'alpha')) $labeldesc = GETPOST('desc', 'alpha'); |
|
| 1381 | 1381 | print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n"; |
| 1382 | 1382 | } |
| 1383 | 1383 | |
| 1384 | 1384 | |
| 1385 | 1385 | |
| 1386 | 1386 | |
| 1387 | -if (! $found && ! $mesg) $mesg=$langs->trans("ErrorBadParameters"); |
|
| 1387 | +if (!$found && !$mesg) $mesg = $langs->trans("ErrorBadParameters"); |
|
| 1388 | 1388 | |
| 1389 | 1389 | if ($mesg) print '<tr><td align="center" colspan="2"><br><div class="warning">'.$mesg.'</div></td></tr>'."\n"; |
| 1390 | 1390 | |
@@ -1393,7 +1393,7 @@ discard block |
||
| 1393 | 1393 | |
| 1394 | 1394 | if ($action != 'dopayment') |
| 1395 | 1395 | { |
| 1396 | - if ($found && ! $error) // We are in a management option and no error |
|
| 1396 | + if ($found && !$error) // We are in a management option and no error |
|
| 1397 | 1397 | { |
| 1398 | 1398 | if ($source == 'invoice' && $object->paye) |
| 1399 | 1399 | { |
@@ -1403,21 +1403,21 @@ discard block |
||
| 1403 | 1403 | { |
| 1404 | 1404 | // Buttons for all payments registration methods |
| 1405 | 1405 | |
| 1406 | - if (! empty($conf->paybox->enabled)) |
|
| 1406 | + if (!empty($conf->paybox->enabled)) |
|
| 1407 | 1407 | { |
| 1408 | 1408 | // If STRIPE_PICTO_FOR_PAYMENT is 'cb' we show a picto of a crdit card instead of paybox |
| 1409 | - print '<br><input class="button buttonpayment buttonpayment'.(empty($conf->global->PAYBOX_PICTO_FOR_PAYMENT)?'paybox':$conf->global->PAYBOX_PICTO_FOR_PAYMENT).'" type="submit" name="dopayment_paybox" value="'.$langs->trans("PayBoxDoPayment").'">'; |
|
| 1409 | + print '<br><input class="button buttonpayment buttonpayment'.(empty($conf->global->PAYBOX_PICTO_FOR_PAYMENT) ? 'paybox' : $conf->global->PAYBOX_PICTO_FOR_PAYMENT).'" type="submit" name="dopayment_paybox" value="'.$langs->trans("PayBoxDoPayment").'">'; |
|
| 1410 | 1410 | } |
| 1411 | 1411 | |
| 1412 | - if (! empty($conf->stripe->enabled)) |
|
| 1412 | + if (!empty($conf->stripe->enabled)) |
|
| 1413 | 1413 | { |
| 1414 | 1414 | // If STRIPE_PICTO_FOR_PAYMENT is 'cb' we show a picto of a crdit card instead of stripe |
| 1415 | - print '<br><input class="button buttonpayment buttonpayment'.(empty($conf->global->STRIPE_PICTO_FOR_PAYMENT)?'stripe':$conf->global->STRIPE_PICTO_FOR_PAYMENT).'" type="submit" name="dopayment_stripe" value="'.$langs->trans("StripeDoPayment").'">'; |
|
| 1415 | + print '<br><input class="button buttonpayment buttonpayment'.(empty($conf->global->STRIPE_PICTO_FOR_PAYMENT) ? 'stripe' : $conf->global->STRIPE_PICTO_FOR_PAYMENT).'" type="submit" name="dopayment_stripe" value="'.$langs->trans("StripeDoPayment").'">'; |
|
| 1416 | 1416 | } |
| 1417 | 1417 | |
| 1418 | - if (! empty($conf->paypal->enabled)) |
|
| 1418 | + if (!empty($conf->paypal->enabled)) |
|
| 1419 | 1419 | { |
| 1420 | - if (empty($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY)) $conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY='integral'; |
|
| 1420 | + if (empty($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY)) $conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY = 'integral'; |
|
| 1421 | 1421 | |
| 1422 | 1422 | if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'integral') |
| 1423 | 1423 | { |
@@ -1451,11 +1451,11 @@ discard block |
||
| 1451 | 1451 | |
| 1452 | 1452 | |
| 1453 | 1453 | // Add more content on page for some services |
| 1454 | -if (preg_match('/^dopayment/',$action)) |
|
| 1454 | +if (preg_match('/^dopayment/', $action)) |
|
| 1455 | 1455 | { |
| 1456 | 1456 | |
| 1457 | 1457 | // Strip |
| 1458 | - if (GETPOST('dopayment_stripe','alpha')) |
|
| 1458 | + if (GETPOST('dopayment_stripe', 'alpha')) |
|
| 1459 | 1459 | { |
| 1460 | 1460 | // Simple checkout |
| 1461 | 1461 | /* |
@@ -1514,9 +1514,9 @@ discard block |
||
| 1514 | 1514 | print '<input type="hidden" name="e" value="'.$entity.'" />'; |
| 1515 | 1515 | print '<input type="hidden" name="amount" value="'.$amount.'">'."\n"; |
| 1516 | 1516 | print '<input type="hidden" name="currency" value="'.$currency.'">'."\n"; |
| 1517 | - print '<input type="hidden" name="forcesandbox" value="'.GETPOST('forcesandbox','alpha').'" />'; |
|
| 1518 | - print '<input type="hidden" name="email" value="'.GETPOST('email','alpha').'" />'; |
|
| 1519 | - print '<input type="hidden" name="thirdparty_id" value="'.GETPOST('thirdparty_id','int').'" />'; |
|
| 1517 | + print '<input type="hidden" name="forcesandbox" value="'.GETPOST('forcesandbox', 'alpha').'" />'; |
|
| 1518 | + print '<input type="hidden" name="email" value="'.GETPOST('email', 'alpha').'" />'; |
|
| 1519 | + print '<input type="hidden" name="thirdparty_id" value="'.GETPOST('thirdparty_id', 'int').'" />'; |
|
| 1520 | 1520 | |
| 1521 | 1521 | print ' |
| 1522 | 1522 | <table id="dolpaymenttable" summary="Payment form" class="center"> |
@@ -1628,7 +1628,7 @@ discard block |
||
| 1628 | 1628 | } |
| 1629 | 1629 | |
| 1630 | 1630 | |
| 1631 | -htmlPrintOnlinePaymentFooter($mysoc,$langs,1,$suffix,$object); |
|
| 1631 | +htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); |
|
| 1632 | 1632 | |
| 1633 | 1633 | llxFooter('', 'public'); |
| 1634 | 1634 | |
@@ -34,7 +34,9 @@ discard block |
||
| 34 | 34 | // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php |
| 35 | 35 | // TODO This should be useless. Because entity must be retreive from object ref and not from url. |
| 36 | 36 | $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); |
| 37 | -if (is_numeric($entity)) define("DOLENTITY", $entity); |
|
| 37 | +if (is_numeric($entity)) { |
|
| 38 | + define("DOLENTITY", $entity); |
|
| 39 | +} |
|
| 38 | 40 | |
| 39 | 41 | require '../../main.inc.php'; |
| 40 | 42 | require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
@@ -59,8 +61,11 @@ discard block |
||
| 59 | 61 | |
| 60 | 62 | $suffix=GETPOST("suffix",'aZ09'); |
| 61 | 63 | $amount=price2num(GETPOST("amount",'alpha')); |
| 62 | -if (! GETPOST("currency",'alpha')) $currency=$conf->currency; |
|
| 63 | -else $currency=GETPOST("currency",'alpha'); |
|
| 64 | +if (! GETPOST("currency",'alpha')) { |
|
| 65 | + $currency=$conf->currency; |
|
| 66 | +} else { |
|
| 67 | + $currency=GETPOST("currency",'alpha'); |
|
| 68 | +} |
|
| 64 | 69 | $source = GETPOST("s",'alpha')?GETPOST("s",'alpha'):GETPOST("source",'alpha'); |
| 65 | 70 | $download = GETPOST('d','int')?GETPOST('d','int'):GETPOST('download','int'); |
| 66 | 71 | |
@@ -111,7 +116,9 @@ discard block |
||
| 111 | 116 | $TAG=GETPOST("tag",'alpha'); |
| 112 | 117 | $FULLTAG=GETPOST("fulltag",'alpha'); // fulltag is tag with more informations |
| 113 | 118 | $SECUREKEY=GETPOST("securekey"); // Secure key |
| 114 | -if ($paymentmethod && ! preg_match('/'.preg_quote('PM='.$paymentmethod,'/').'/', $FULLTAG)) $FULLTAG.=($FULLTAG?'.':'').'PM='.$paymentmethod; |
|
| 119 | +if ($paymentmethod && ! preg_match('/'.preg_quote('PM='.$paymentmethod,'/').'/', $FULLTAG)) { |
|
| 120 | + $FULLTAG.=($FULLTAG?'.':'').'PM='.$paymentmethod; |
|
| 121 | +} |
|
| 115 | 122 | |
| 116 | 123 | if (! empty($suffix)) |
| 117 | 124 | { |
@@ -164,9 +171,13 @@ discard block |
||
| 164 | 171 | |
| 165 | 172 | // Check parameters |
| 166 | 173 | $PAYPAL_API_OK=""; |
| 167 | - if ($urlok) $PAYPAL_API_OK=$urlok; |
|
| 174 | + if ($urlok) { |
|
| 175 | + $PAYPAL_API_OK=$urlok; |
|
| 176 | + } |
|
| 168 | 177 | $PAYPAL_API_KO=""; |
| 169 | - if ($urlko) $PAYPAL_API_KO=$urlko; |
|
| 178 | + if ($urlko) { |
|
| 179 | + $PAYPAL_API_KO=$urlko; |
|
| 180 | + } |
|
| 170 | 181 | if (empty($PAYPAL_API_USER)) |
| 171 | 182 | { |
| 172 | 183 | dol_print_error('',"Paypal setup param PAYPAL_API_USER not defined"); |
@@ -218,17 +229,26 @@ discard block |
||
| 218 | 229 | { |
| 219 | 230 | if (! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
| 220 | 231 | { |
| 221 | - if ($source && $REF) $token = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $source . $REF, 2); // Use the source in the hash to avoid duplicates if the references are identical |
|
| 222 | - else $token = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); |
|
| 223 | - } |
|
| 224 | - else |
|
| 232 | + if ($source && $REF) { |
|
| 233 | + $token = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $source . $REF, 2); |
|
| 234 | + } |
|
| 235 | + // Use the source in the hash to avoid duplicates if the references are identical |
|
| 236 | + else { |
|
| 237 | + $token = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); |
|
| 238 | + } |
|
| 239 | + } else |
|
| 225 | 240 | { |
| 226 | 241 | $token = $conf->global->PAYMENT_SECURITY_TOKEN; |
| 227 | 242 | } |
| 228 | 243 | if ($SECUREKEY != $token) |
| 229 | 244 | { |
| 230 | - if (empty($conf->global->PAYMENT_SECURITY_ACCEPT_ANY_TOKEN)) $valid=false; // PAYMENT_SECURITY_ACCEPT_ANY_TOKEN is for backward compatibility |
|
| 231 | - else dol_syslog("Warning: PAYMENT_SECURITY_ACCEPT_ANY_TOKEN is on", LOG_WARNING); |
|
| 245 | + if (empty($conf->global->PAYMENT_SECURITY_ACCEPT_ANY_TOKEN)) { |
|
| 246 | + $valid=false; |
|
| 247 | + } |
|
| 248 | + // PAYMENT_SECURITY_ACCEPT_ANY_TOKEN is for backward compatibility |
|
| 249 | + else { |
|
| 250 | + dol_syslog("Warning: PAYMENT_SECURITY_ACCEPT_ANY_TOKEN is on", LOG_WARNING); |
|
| 251 | + } |
|
| 232 | 252 | } |
| 233 | 253 | |
| 234 | 254 | if (! $valid) |
@@ -250,8 +270,11 @@ discard block |
||
| 250 | 270 | $creditor=$mysoc->name; |
| 251 | 271 | $paramcreditor='ONLINE_PAYMENT_CREDITOR'; |
| 252 | 272 | $paramcreditorlong='ONLINE_PAYMENT_CREDITOR_'.$suffix; |
| 253 | -if (! empty($conf->global->$paramcreditorlong)) $creditor=$conf->global->$paramcreditorlong; |
|
| 254 | -else if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor; |
|
| 273 | +if (! empty($conf->global->$paramcreditorlong)) { |
|
| 274 | + $creditor=$conf->global->$paramcreditorlong; |
|
| 275 | +} else if (! empty($conf->global->$paramcreditor)) { |
|
| 276 | + $creditor=$conf->global->$paramcreditor; |
|
| 277 | +} |
|
| 255 | 278 | |
| 256 | 279 | |
| 257 | 280 | |
@@ -303,7 +326,9 @@ discard block |
||
| 303 | 326 | $PAYPAL_API_DEVISE="USD"; |
| 304 | 327 | //if ($currency == 'EUR') $PAYPAL_API_DEVISE="EUR"; |
| 305 | 328 | //if ($currency == 'USD') $PAYPAL_API_DEVISE="USD"; |
| 306 | - if (! empty($currency)) $PAYPAL_API_DEVISE=$currency; |
|
| 329 | + if (! empty($currency)) { |
|
| 330 | + $PAYPAL_API_DEVISE=$currency; |
|
| 331 | + } |
|
| 307 | 332 | |
| 308 | 333 | // Show var initialized by include fo paypal lib at begin of this file |
| 309 | 334 | dol_syslog("Submit Paypal form", LOG_DEBUG); |
@@ -353,12 +378,19 @@ discard block |
||
| 353 | 378 | $urlko = preg_replace('/securekey=[^&]+/', '', $urlko); |
| 354 | 379 | |
| 355 | 380 | $mesg=''; |
| 356 | - if (empty($PRICE) || ! is_numeric($PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount")); |
|
| 357 | - elseif (empty($email)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail")); |
|
| 358 | - elseif (! isValidEMail($email)) $mesg=$langs->trans("ErrorBadEMail",$email); |
|
| 359 | - elseif (! $origfulltag) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode")); |
|
| 360 | - elseif (dol_strlen($urlok) > 150) $mesg='Error urlok too long '.$urlok.'( Paybox requires 150, found '.strlen($urlok).')'; |
|
| 361 | - elseif (dol_strlen($urlko) > 150) $mesg='Error urlko too long '.$urlko.'( Paybox requires 150, found '.strlen($urlok).')'; |
|
| 381 | + if (empty($PRICE) || ! is_numeric($PRICE)) { |
|
| 382 | + $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount")); |
|
| 383 | + } elseif (empty($email)) { |
|
| 384 | + $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail")); |
|
| 385 | + } elseif (! isValidEMail($email)) { |
|
| 386 | + $mesg=$langs->trans("ErrorBadEMail",$email); |
|
| 387 | + } elseif (! $origfulltag) { |
|
| 388 | + $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode")); |
|
| 389 | + } elseif (dol_strlen($urlok) > 150) { |
|
| 390 | + $mesg='Error urlok too long '.$urlok.'( Paybox requires 150, found '.strlen($urlok).')'; |
|
| 391 | + } elseif (dol_strlen($urlko) > 150) { |
|
| 392 | + $mesg='Error urlko too long '.$urlko.'( Paybox requires 150, found '.strlen($urlok).')'; |
|
| 393 | + } |
|
| 362 | 394 | |
| 363 | 395 | if (empty($mesg)) |
| 364 | 396 | { |
@@ -374,8 +406,9 @@ discard block |
||
| 374 | 406 | |
| 375 | 407 | if ($paymentmethod == 'stripe') |
| 376 | 408 | { |
| 377 | - if (GETPOST('newamount','alpha')) $amount = price2num(GETPOST('newamount','alpha'),'MT'); |
|
| 378 | - else |
|
| 409 | + if (GETPOST('newamount','alpha')) { |
|
| 410 | + $amount = price2num(GETPOST('newamount','alpha'),'MT'); |
|
| 411 | + } else |
|
| 379 | 412 | { |
| 380 | 413 | setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors'); |
| 381 | 414 | $action = ''; |
@@ -392,7 +425,9 @@ discard block |
||
| 392 | 425 | // Correct the amount according to unit of currency |
| 393 | 426 | // See https://support.stripe.com/questions/which-zero-decimal-currencies-does-stripe-support |
| 394 | 427 | $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); |
| 395 | - if (! in_array($currency, $arrayzerounitcurrency)) $amountstripe=$amountstripe * 100; |
|
| 428 | + if (! in_array($currency, $arrayzerounitcurrency)) { |
|
| 429 | + $amountstripe=$amountstripe * 100; |
|
| 430 | + } |
|
| 396 | 431 | |
| 397 | 432 | dol_syslog("POST keys : ".join(',', array_keys($_POST)), LOG_DEBUG, 0, '_stripe'); |
| 398 | 433 | dol_syslog("POST values: ".join(',', $_POST), LOG_DEBUG, 0, '_stripe'); |
@@ -415,9 +450,15 @@ discard block |
||
| 415 | 450 | 'dol_entity'=>$conf->entity, |
| 416 | 451 | 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR']) |
| 417 | 452 | ); |
| 418 | - if (! empty($dol_id)) $metadata["dol_id"] = $dol_id; |
|
| 419 | - if (! empty($dol_type)) $metadata["dol_type"] = $dol_type; |
|
| 420 | - if (! empty($thirdparty_id)) $metadata["dol_thirdparty_id"] = $thirdparty_id; |
|
| 453 | + if (! empty($dol_id)) { |
|
| 454 | + $metadata["dol_id"] = $dol_id; |
|
| 455 | + } |
|
| 456 | + if (! empty($dol_type)) { |
|
| 457 | + $metadata["dol_type"] = $dol_type; |
|
| 458 | + } |
|
| 459 | + if (! empty($thirdparty_id)) { |
|
| 460 | + $metadata["dol_thirdparty_id"] = $thirdparty_id; |
|
| 461 | + } |
|
| 421 | 462 | |
| 422 | 463 | if ($thirdparty_id > 0) |
| 423 | 464 | { |
@@ -447,8 +488,7 @@ discard block |
||
| 447 | 488 | dol_syslog('Failed to create card record', LOG_WARNING, 0, '_stripe'); |
| 448 | 489 | setEventMessages('Failed to create card record', null, 'errors'); |
| 449 | 490 | $action=''; |
| 450 | - } |
|
| 451 | - else |
|
| 491 | + } else |
|
| 452 | 492 | { |
| 453 | 493 | dol_syslog("Create charge on card ".$card->id, LOG_DEBUG, 0, '_stripe'); |
| 454 | 494 | $charge = \Stripe\Charge::create(array( |
@@ -470,8 +510,7 @@ discard block |
||
| 470 | 510 | $action=''; |
| 471 | 511 | } |
| 472 | 512 | } |
| 473 | - } |
|
| 474 | - else |
|
| 513 | + } else |
|
| 475 | 514 | { |
| 476 | 515 | dol_syslog("Create anonymous customer card profile", LOG_DEBUG, 0, '_stripe'); |
| 477 | 516 | $customer = \Stripe\Customer::create(array( |
@@ -577,8 +616,7 @@ discard block |
||
| 577 | 616 | { |
| 578 | 617 | header("Location: ".$urlko); |
| 579 | 618 | exit; |
| 580 | - } |
|
| 581 | - else |
|
| 619 | + } else |
|
| 582 | 620 | { |
| 583 | 621 | header("Location: ".$urlok); |
| 584 | 622 | exit; |
@@ -592,7 +630,9 @@ discard block |
||
| 592 | 630 | */ |
| 593 | 631 | |
| 594 | 632 | $head=''; |
| 595 | -if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n"; |
|
| 633 | +if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) { |
|
| 634 | + $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n"; |
|
| 635 | +} |
|
| 596 | 636 | |
| 597 | 637 | $conf->dol_hide_topmenu=1; |
| 598 | 638 | $conf->dol_hide_leftmenu=1; |
@@ -611,10 +651,12 @@ discard block |
||
| 611 | 651 | |
| 612 | 652 | |
| 613 | 653 | // Show sandbox warning |
| 614 | -if (! empty($conf->paypal->enabled) && (! empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox','alpha'))) // We can force sand box with param 'forcesandbox' |
|
| 654 | +if (! empty($conf->paypal->enabled) && (! empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox','alpha'))) { |
|
| 655 | + // We can force sand box with param 'forcesandbox' |
|
| 615 | 656 | { |
| 616 | 657 | dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode','Paypal'),'','warning'); |
| 617 | 658 | } |
| 659 | +} |
|
| 618 | 660 | if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha'))) |
| 619 | 661 | { |
| 620 | 662 | dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode','Stripe'),'','warning'); |
@@ -660,8 +702,11 @@ discard block |
||
| 660 | 702 | $logosmall=$mysoc->logo_small; |
| 661 | 703 | $logo=$mysoc->logo; |
| 662 | 704 | $paramlogo='ONLINE_PAYMENT_LOGO_'.$suffix; |
| 663 | -if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo; |
|
| 664 | -else if (! empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall=$conf->global->ONLINE_PAYMENT_LOGO; |
|
| 705 | +if (! empty($conf->global->$paramlogo)) { |
|
| 706 | + $logosmall=$conf->global->$paramlogo; |
|
| 707 | +} else if (! empty($conf->global->ONLINE_PAYMENT_LOGO)) { |
|
| 708 | + $logosmall=$conf->global->ONLINE_PAYMENT_LOGO; |
|
| 709 | +} |
|
| 665 | 710 | //print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n"; |
| 666 | 711 | // Define urllogo |
| 667 | 712 | $urllogo=''; |
@@ -669,8 +714,7 @@ discard block |
||
| 669 | 714 | { |
| 670 | 715 | $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('thumbs/'.$logosmall); |
| 671 | 716 | $width=150; |
| 672 | -} |
|
| 673 | -elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) |
|
| 717 | +} elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) |
|
| 674 | 718 | { |
| 675 | 719 | $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode($logo); |
| 676 | 720 | $width=150; |
@@ -680,7 +724,9 @@ discard block |
||
| 680 | 724 | { |
| 681 | 725 | print '<tr>'; |
| 682 | 726 | print '<td align="center"><img id="dolpaymentlogo" title="'.$title.'" src="'.$urllogo.'"'; |
| 683 | - if ($width) print ' width="'.$width.'"'; |
|
| 727 | + if ($width) { |
|
| 728 | + print ' width="'.$width.'"'; |
|
| 729 | + } |
|
| 684 | 730 | print '></td>'; |
| 685 | 731 | print '</tr>'."\n"; |
| 686 | 732 | } |
@@ -690,8 +736,11 @@ discard block |
||
| 690 | 736 | if (! empty($conf->global->PAYMENT_NEWFORM_TEXT)) |
| 691 | 737 | { |
| 692 | 738 | $langs->load("members"); |
| 693 | - if (preg_match('/^\((.*)\)$/',$conf->global->PAYMENT_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n"; |
|
| 694 | - else $text.=$conf->global->PAYMENT_NEWFORM_TEXT."<br>\n"; |
|
| 739 | + if (preg_match('/^\((.*)\)$/',$conf->global->PAYMENT_NEWFORM_TEXT,$reg)) { |
|
| 740 | + $text.=$langs->trans($reg[1])."<br>\n"; |
|
| 741 | + } else { |
|
| 742 | + $text.=$conf->global->PAYMENT_NEWFORM_TEXT."<br>\n"; |
|
| 743 | + } |
|
| 695 | 744 | $text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n"; |
| 696 | 745 | } |
| 697 | 746 | if (empty($text)) |
@@ -728,14 +777,15 @@ discard block |
||
| 728 | 777 | |
| 729 | 778 | // Amount |
| 730 | 779 | print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount"); |
| 731 | - if (empty($amount)) print ' ('.$langs->trans("ToComplete").')'; |
|
| 780 | + if (empty($amount)) { |
|
| 781 | + print ' ('.$langs->trans("ToComplete").')'; |
|
| 782 | + } |
|
| 732 | 783 | print '</td><td class="CTableRow'.($var?'1':'2').'">'; |
| 733 | 784 | if (empty($amount) || ! is_numeric($amount)) |
| 734 | 785 | { |
| 735 | 786 | print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">'; |
| 736 | 787 | print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"),'MT').'">'; |
| 737 | - } |
|
| 738 | - else { |
|
| 788 | + } else { |
|
| 739 | 789 | print '<b>'.price($amount).'</b>'; |
| 740 | 790 | print '<input type="hidden" name="amount" value="'.$amount.'">'; |
| 741 | 791 | print '<input type="hidden" name="newamount" value="'.$amount.'">'; |
@@ -771,18 +821,21 @@ discard block |
||
| 771 | 821 | { |
| 772 | 822 | $mesg=$order->error; |
| 773 | 823 | $error++; |
| 774 | - } |
|
| 775 | - else |
|
| 824 | + } else |
|
| 776 | 825 | { |
| 777 | 826 | $result=$order->fetch_thirdparty($order->socid); |
| 778 | 827 | |
| 779 | 828 | $object = $order; |
| 780 | 829 | } |
| 781 | 830 | |
| 782 | - if ($action != 'dopayment') // Do not change amount if we just click on first dopayment |
|
| 831 | + if ($action != 'dopayment') { |
|
| 832 | + // Do not change amount if we just click on first dopayment |
|
| 783 | 833 | { |
| 784 | 834 | $amount=$order->total_ttc; |
| 785 | - if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int'); |
|
| 835 | + } |
|
| 836 | + if (GETPOST("amount",'int')) { |
|
| 837 | + $amount=GETPOST("amount",'int'); |
|
| 838 | + } |
|
| 786 | 839 | $amount=price2num($amount); |
| 787 | 840 | } |
| 788 | 841 | |
@@ -803,7 +856,9 @@ discard block |
||
| 803 | 856 | |
| 804 | 857 | // Object |
| 805 | 858 | $text='<b>'.$langs->trans("PaymentOrderRef",$order->ref).'</b>'; |
| 806 | - if (GETPOST('desc','alpha')) $text='<b>'.$langs->trans(GETPOST('desc','alpha')).'</b>'; |
|
| 859 | + if (GETPOST('desc','alpha')) { |
|
| 860 | + $text='<b>'.$langs->trans(GETPOST('desc','alpha')).'</b>'; |
|
| 861 | + } |
|
| 807 | 862 | print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation"); |
| 808 | 863 | print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text; |
| 809 | 864 | print '<input type="hidden" name="s" value="'.dol_escape_htmltag($source).'">'; |
@@ -819,14 +874,15 @@ discard block |
||
| 819 | 874 | |
| 820 | 875 | // Amount |
| 821 | 876 | print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount"); |
| 822 | - if (empty($amount)) print ' ('.$langs->trans("ToComplete").')'; |
|
| 877 | + if (empty($amount)) { |
|
| 878 | + print ' ('.$langs->trans("ToComplete").')'; |
|
| 879 | + } |
|
| 823 | 880 | print '</td><td class="CTableRow'.($var?'1':'2').'">'; |
| 824 | 881 | if (empty($amount) || ! is_numeric($amount)) |
| 825 | 882 | { |
| 826 | 883 | print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">'; |
| 827 | 884 | print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"),'MT').'">'; |
| 828 | - } |
|
| 829 | - else { |
|
| 885 | + } else { |
|
| 830 | 886 | print '<b>'.price($amount).'</b>'; |
| 831 | 887 | print '<input type="hidden" name="amount" value="'.$amount.'">'; |
| 832 | 888 | print '<input type="hidden" name="newamount" value="'.$amount.'">'; |
@@ -862,16 +918,19 @@ discard block |
||
| 862 | 918 | print '<input type="hidden" name="shipToZip" value="'.$shipToZip.'">'."\n"; |
| 863 | 919 | print '<input type="hidden" name="shipToStreet2" value="'.$shipToStreet2.'">'."\n"; |
| 864 | 920 | print '<input type="hidden" name="phoneNum" value="'.$phoneNum.'">'."\n"; |
| 865 | - } |
|
| 866 | - else |
|
| 921 | + } else |
|
| 867 | 922 | { |
| 868 | 923 | print '<!-- Shipping address not complete, so we don t use it -->'."\n"; |
| 869 | 924 | } |
| 870 | - if (is_object($order->thirdparty)) print '<input type="hidden" name="thirdparty_id" value="'.$order->thirdparty->id.'">'."\n"; |
|
| 925 | + if (is_object($order->thirdparty)) { |
|
| 926 | + print '<input type="hidden" name="thirdparty_id" value="'.$order->thirdparty->id.'">'."\n"; |
|
| 927 | + } |
|
| 871 | 928 | print '<input type="hidden" name="email" value="'.$order->thirdparty->email.'">'."\n"; |
| 872 | 929 | print '<input type="hidden" name="vatnumber" value="'.$order->thirdparty->tva_intra.'">'."\n"; |
| 873 | 930 | $labeldesc=$langs->trans("Order").' '.$order->ref; |
| 874 | - if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha'); |
|
| 931 | + if (GETPOST('desc','alpha')) { |
|
| 932 | + $labeldesc=GETPOST('desc','alpha'); |
|
| 933 | + } |
|
| 875 | 934 | print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n"; |
| 876 | 935 | } |
| 877 | 936 | |
@@ -890,18 +949,21 @@ discard block |
||
| 890 | 949 | { |
| 891 | 950 | $mesg=$invoice->error; |
| 892 | 951 | $error++; |
| 893 | - } |
|
| 894 | - else |
|
| 952 | + } else |
|
| 895 | 953 | { |
| 896 | 954 | $result=$invoice->fetch_thirdparty($invoice->socid); |
| 897 | 955 | |
| 898 | 956 | $object = $invoice; |
| 899 | 957 | } |
| 900 | 958 | |
| 901 | - if ($action != 'dopayment') // Do not change amount if we just click on first dopayment |
|
| 959 | + if ($action != 'dopayment') { |
|
| 960 | + // Do not change amount if we just click on first dopayment |
|
| 902 | 961 | { |
| 903 | 962 | $amount=price2num($invoice->total_ttc - $invoice->getSommePaiement()); |
| 904 | - if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int'); |
|
| 963 | + } |
|
| 964 | + if (GETPOST("amount",'int')) { |
|
| 965 | + $amount=GETPOST("amount",'int'); |
|
| 966 | + } |
|
| 905 | 967 | $amount=price2num($amount); |
| 906 | 968 | } |
| 907 | 969 | |
@@ -922,7 +984,9 @@ discard block |
||
| 922 | 984 | |
| 923 | 985 | // Object |
| 924 | 986 | $text='<b>'.$langs->trans("PaymentInvoiceRef",$invoice->ref).'</b>'; |
| 925 | - if (GETPOST('desc','alpha')) $text='<b>'.$langs->trans(GETPOST('desc','alpha')).'</b>'; |
|
| 987 | + if (GETPOST('desc','alpha')) { |
|
| 988 | + $text='<b>'.$langs->trans(GETPOST('desc','alpha')).'</b>'; |
|
| 989 | + } |
|
| 926 | 990 | print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation"); |
| 927 | 991 | print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text; |
| 928 | 992 | print '<input type="hidden" name="s" value="'.dol_escape_htmltag($source).'">'; |
@@ -938,7 +1002,9 @@ discard block |
||
| 938 | 1002 | |
| 939 | 1003 | // Amount |
| 940 | 1004 | print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("PaymentAmount"); |
| 941 | - if (empty($amount) && empty($object->paye)) print ' ('.$langs->trans("ToComplete").')'; |
|
| 1005 | + if (empty($amount) && empty($object->paye)) { |
|
| 1006 | + print ' ('.$langs->trans("ToComplete").')'; |
|
| 1007 | + } |
|
| 942 | 1008 | print '</td><td class="CTableRow'.($var?'1':'2').'">'; |
| 943 | 1009 | if (empty($object->paye)) |
| 944 | 1010 | { |
@@ -946,8 +1012,7 @@ discard block |
||
| 946 | 1012 | { |
| 947 | 1013 | print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">'; |
| 948 | 1014 | print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"), 'MT').'">'; |
| 949 | - } |
|
| 950 | - else { |
|
| 1015 | + } else { |
|
| 951 | 1016 | print '<b>'.price($amount).'</b>'; |
| 952 | 1017 | print '<input type="hidden" name="amount" value="'.$amount.'">'; |
| 953 | 1018 | print '<input type="hidden" name="newamount" value="'.$amount.'">'; |
@@ -955,8 +1020,7 @@ discard block |
||
| 955 | 1020 | // Currency |
| 956 | 1021 | print ' <b>'.$langs->trans("Currency".$currency).'</b>'; |
| 957 | 1022 | print '<input type="hidden" name="currency" value="'.$currency.'">'; |
| 958 | - } |
|
| 959 | - else |
|
| 1023 | + } else |
|
| 960 | 1024 | { |
| 961 | 1025 | print price($object->total_ttc, 1, $langs); |
| 962 | 1026 | } |
@@ -997,16 +1061,19 @@ discard block |
||
| 997 | 1061 | print '<input type="hidden" name="shipToZip" value="'.$shipToZip.'">'."\n"; |
| 998 | 1062 | print '<input type="hidden" name="shipToStreet2" value="'.$shipToStreet2.'">'."\n"; |
| 999 | 1063 | print '<input type="hidden" name="phoneNum" value="'.$phoneNum.'">'."\n"; |
| 1000 | - } |
|
| 1001 | - else |
|
| 1064 | + } else |
|
| 1002 | 1065 | { |
| 1003 | 1066 | print '<!-- Shipping address not complete, so we don t use it -->'."\n"; |
| 1004 | 1067 | } |
| 1005 | - if (is_object($invoice->thirdparty)) print '<input type="hidden" name="thirdparty_id" value="'.$invoice->thirdparty->id.'">'."\n"; |
|
| 1068 | + if (is_object($invoice->thirdparty)) { |
|
| 1069 | + print '<input type="hidden" name="thirdparty_id" value="'.$invoice->thirdparty->id.'">'."\n"; |
|
| 1070 | + } |
|
| 1006 | 1071 | print '<input type="hidden" name="email" value="'.$invoice->thirdparty->email.'">'."\n"; |
| 1007 | 1072 | print '<input type="hidden" name="vatnumber" value="'.$invoice->thirdparty->tva_intra.'">'."\n"; |
| 1008 | 1073 | $labeldesc=$langs->trans("Invoice").' '.$invoice->ref; |
| 1009 | - if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha'); |
|
| 1074 | + if (GETPOST('desc','alpha')) { |
|
| 1075 | + $labeldesc=GETPOST('desc','alpha'); |
|
| 1076 | + } |
|
| 1010 | 1077 | print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n"; |
| 1011 | 1078 | } |
| 1012 | 1079 | |
@@ -1026,8 +1093,7 @@ discard block |
||
| 1026 | 1093 | { |
| 1027 | 1094 | $mesg=$contractline->error; |
| 1028 | 1095 | $error++; |
| 1029 | - } |
|
| 1030 | - else |
|
| 1096 | + } else |
|
| 1031 | 1097 | { |
| 1032 | 1098 | if ($contractline->fk_contrat > 0) |
| 1033 | 1099 | { |
@@ -1037,23 +1103,23 @@ discard block |
||
| 1037 | 1103 | if ($result > 0) |
| 1038 | 1104 | { |
| 1039 | 1105 | $result=$contract->fetch_thirdparty($contract->socid); |
| 1040 | - } |
|
| 1041 | - else |
|
| 1106 | + } else |
|
| 1042 | 1107 | { |
| 1043 | 1108 | $mesg=$contract->error; |
| 1044 | 1109 | $error++; |
| 1045 | 1110 | } |
| 1046 | - } |
|
| 1047 | - else |
|
| 1111 | + } else |
|
| 1048 | 1112 | { |
| 1049 | 1113 | $mesg='ErrorRecordNotFound'; |
| 1050 | 1114 | $error++; |
| 1051 | 1115 | } |
| 1052 | 1116 | } |
| 1053 | 1117 | |
| 1054 | - if ($action != 'dopayment') // Do not change amount if we just click on first dopayment |
|
| 1118 | + if ($action != 'dopayment') { |
|
| 1119 | + // Do not change amount if we just click on first dopayment |
|
| 1055 | 1120 | { |
| 1056 | 1121 | $amount=$contractline->total_ttc; |
| 1122 | + } |
|
| 1057 | 1123 | |
| 1058 | 1124 | if ($contractline->fk_product && ! empty($conf->global->PAYMENT_USE_NEW_PRICE_FOR_CONTRACTLINES)) |
| 1059 | 1125 | { |
@@ -1066,8 +1132,7 @@ discard block |
||
| 1066 | 1132 | $pu_ht = $product->multiprices[$contract->thirdparty->price_level]; |
| 1067 | 1133 | $pu_ttc = $product->multiprices_ttc[$contract->thirdparty->price_level]; |
| 1068 | 1134 | $price_base_type = $product->multiprices_base_type[$contract->thirdparty->price_level]; |
| 1069 | - } |
|
| 1070 | - else |
|
| 1135 | + } else |
|
| 1071 | 1136 | { |
| 1072 | 1137 | $pu_ht = $product->price; |
| 1073 | 1138 | $pu_ttc = $product->price_ttc; |
@@ -1082,7 +1147,9 @@ discard block |
||
| 1082 | 1147 | } |
| 1083 | 1148 | } |
| 1084 | 1149 | |
| 1085 | - if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int'); |
|
| 1150 | + if (GETPOST("amount",'int')) { |
|
| 1151 | + $amount=GETPOST("amount",'int'); |
|
| 1152 | + } |
|
| 1086 | 1153 | $amount=price2num($amount); |
| 1087 | 1154 | } |
| 1088 | 1155 | |
@@ -1092,7 +1159,9 @@ discard block |
||
| 1092 | 1159 | $fulltag=dol_string_unaccent($fulltag); |
| 1093 | 1160 | |
| 1094 | 1161 | $qty=1; |
| 1095 | - if (GETPOST('qty')) $qty=GETPOST('qty'); |
|
| 1162 | + if (GETPOST('qty')) { |
|
| 1163 | + $qty=GETPOST('qty'); |
|
| 1164 | + } |
|
| 1096 | 1165 | |
| 1097 | 1166 | // Creditor |
| 1098 | 1167 | print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Creditor"); |
@@ -1110,7 +1179,9 @@ discard block |
||
| 1110 | 1179 | { |
| 1111 | 1180 | $text.='<br>'.$product->ref.($product->label?' - '.$product->label:''); |
| 1112 | 1181 | } |
| 1113 | - if ($contractline->description) $text.='<br>'.dol_htmlentitiesbr($contractline->description); |
|
| 1182 | + if ($contractline->description) { |
|
| 1183 | + $text.='<br>'.dol_htmlentitiesbr($contractline->description); |
|
| 1184 | + } |
|
| 1114 | 1185 | //if ($contractline->date_fin_validite) { |
| 1115 | 1186 | // $text.='<br>'.$langs->trans("DateEndPlanned").': '; |
| 1116 | 1187 | // $text.=dol_print_date($contractline->date_fin_validite); |
@@ -1119,7 +1190,9 @@ discard block |
||
| 1119 | 1190 | { |
| 1120 | 1191 | $text.='<br>'.$langs->trans("ExpiredSince").': '.dol_print_date($contractline->date_fin_validite); |
| 1121 | 1192 | } |
| 1122 | - if (GETPOST('desc','alpha')) $text='<b>'.$langs->trans(GETPOST('desc','alpha')).'</b>'; |
|
| 1193 | + if (GETPOST('desc','alpha')) { |
|
| 1194 | + $text='<b>'.$langs->trans(GETPOST('desc','alpha')).'</b>'; |
|
| 1195 | + } |
|
| 1123 | 1196 | print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation"); |
| 1124 | 1197 | print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text; |
| 1125 | 1198 | print '<input type="hidden" name="source" value="'.dol_escape_htmltag($source).'">'; |
@@ -1147,8 +1220,7 @@ discard block |
||
| 1147 | 1220 | if ($product->duration_value > 1) |
| 1148 | 1221 | { |
| 1149 | 1222 | $dur=array("h"=>$langs->trans("Hours"),"d"=>$langs->trans("DurationDays"),"w"=>$langs->trans("DurationWeeks"),"m"=>$langs->trans("DurationMonths"),"y"=>$langs->trans("DurationYears")); |
| 1150 | - } |
|
| 1151 | - else |
|
| 1223 | + } else |
|
| 1152 | 1224 | { |
| 1153 | 1225 | $dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("DurationDay"),"w"=>$langs->trans("DurationWeek"),"m"=>$langs->trans("DurationMonth"),"y"=>$langs->trans("DurationYear")); |
| 1154 | 1226 | } |
@@ -1162,14 +1234,15 @@ discard block |
||
| 1162 | 1234 | |
| 1163 | 1235 | // Amount |
| 1164 | 1236 | print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount"); |
| 1165 | - if (empty($amount)) print ' ('.$langs->trans("ToComplete").')'; |
|
| 1237 | + if (empty($amount)) { |
|
| 1238 | + print ' ('.$langs->trans("ToComplete").')'; |
|
| 1239 | + } |
|
| 1166 | 1240 | print '</td><td class="CTableRow'.($var?'1':'2').'">'; |
| 1167 | 1241 | if (empty($amount) || ! is_numeric($amount)) |
| 1168 | 1242 | { |
| 1169 | 1243 | print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">'; |
| 1170 | 1244 | print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount","alpha"),'MT').'">'; |
| 1171 | - } |
|
| 1172 | - else { |
|
| 1245 | + } else { |
|
| 1173 | 1246 | print '<b>'.price($amount).'</b>'; |
| 1174 | 1247 | print '<input type="hidden" name="amount" value="'.$amount.'">'; |
| 1175 | 1248 | print '<input type="hidden" name="newamount" value="'.$amount.'">'; |
@@ -1205,16 +1278,19 @@ discard block |
||
| 1205 | 1278 | print '<input type="hidden" name="shipToZip" value="'.$shipToZip.'">'."\n"; |
| 1206 | 1279 | print '<input type="hidden" name="shipToStreet2" value="'.$shipToStreet2.'">'."\n"; |
| 1207 | 1280 | print '<input type="hidden" name="phoneNum" value="'.$phoneNum.'">'."\n"; |
| 1208 | - } |
|
| 1209 | - else |
|
| 1281 | + } else |
|
| 1210 | 1282 | { |
| 1211 | 1283 | print '<!-- Shipping address not complete, so we don t use it -->'."\n"; |
| 1212 | 1284 | } |
| 1213 | - if (is_object($contract->thirdparty)) print '<input type="hidden" name="thirdparty_id" value="'.$contract->thirdparty->id.'">'."\n"; |
|
| 1285 | + if (is_object($contract->thirdparty)) { |
|
| 1286 | + print '<input type="hidden" name="thirdparty_id" value="'.$contract->thirdparty->id.'">'."\n"; |
|
| 1287 | + } |
|
| 1214 | 1288 | print '<input type="hidden" name="email" value="'.$contract->thirdparty->email.'">'."\n"; |
| 1215 | 1289 | print '<input type="hidden" name="vatnumber" value="'.$contract->thirdparty->tva_intra.'">'."\n"; |
| 1216 | 1290 | $labeldesc=$langs->trans("Contract").' '.$contract->ref; |
| 1217 | - if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha'); |
|
| 1291 | + if (GETPOST('desc','alpha')) { |
|
| 1292 | + $labeldesc=GETPOST('desc','alpha'); |
|
| 1293 | + } |
|
| 1218 | 1294 | print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n"; |
| 1219 | 1295 | } |
| 1220 | 1296 | |
@@ -1233,18 +1309,21 @@ discard block |
||
| 1233 | 1309 | { |
| 1234 | 1310 | $mesg=$member->error; |
| 1235 | 1311 | $error++; |
| 1236 | - } |
|
| 1237 | - else |
|
| 1312 | + } else |
|
| 1238 | 1313 | { |
| 1239 | 1314 | $member->fetch_thirdparty(); |
| 1240 | 1315 | $object = $member; |
| 1241 | 1316 | $subscription=new Subscription($db); |
| 1242 | 1317 | } |
| 1243 | 1318 | |
| 1244 | - if ($action != 'dopayment') // Do not change amount if we just click on first dopayment |
|
| 1319 | + if ($action != 'dopayment') { |
|
| 1320 | + // Do not change amount if we just click on first dopayment |
|
| 1245 | 1321 | { |
| 1246 | 1322 | $amount=$subscription->total_ttc; |
| 1247 | - if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int'); |
|
| 1323 | + } |
|
| 1324 | + if (GETPOST("amount",'int')) { |
|
| 1325 | + $amount=GETPOST("amount",'int'); |
|
| 1326 | + } |
|
| 1248 | 1327 | $amount=price2num($amount); |
| 1249 | 1328 | } |
| 1250 | 1329 | |
@@ -1263,14 +1342,19 @@ discard block |
||
| 1263 | 1342 | |
| 1264 | 1343 | print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Member"); |
| 1265 | 1344 | print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'; |
| 1266 | - if ($member->morphy == 'mor' && ! empty($member->societe)) print $member->societe; |
|
| 1267 | - else print $member->getFullName($langs); |
|
| 1345 | + if ($member->morphy == 'mor' && ! empty($member->societe)) { |
|
| 1346 | + print $member->societe; |
|
| 1347 | + } else { |
|
| 1348 | + print $member->getFullName($langs); |
|
| 1349 | + } |
|
| 1268 | 1350 | print '</b>'; |
| 1269 | 1351 | |
| 1270 | 1352 | // Object |
| 1271 | 1353 | |
| 1272 | 1354 | $text='<b>'.$langs->trans("PaymentSubscription").'</b>'; |
| 1273 | - if (GETPOST('desc','alpha')) $text='<b>'.$langs->trans(GETPOST('desc','alpha')).'</b>'; |
|
| 1355 | + if (GETPOST('desc','alpha')) { |
|
| 1356 | + $text='<b>'.$langs->trans(GETPOST('desc','alpha')).'</b>'; |
|
| 1357 | + } |
|
| 1274 | 1358 | print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Designation"); |
| 1275 | 1359 | print '</td><td class="CTableRow'.($var?'1':'2').'">'.$text; |
| 1276 | 1360 | print '<input type="hidden" name="source" value="'.dol_escape_htmltag($source).'">'; |
@@ -1291,7 +1375,9 @@ discard block |
||
| 1291 | 1375 | print '</td><td class="CTableRow'.($var?'1':'2').'">'.price($member->last_subscription_amount); |
| 1292 | 1376 | print '</td></tr>'."\n"; |
| 1293 | 1377 | |
| 1294 | - if (empty($amount) && ! GETPOST('newamount','alpha')) $_GET['newamount']=$member->last_subscription_amount; |
|
| 1378 | + if (empty($amount) && ! GETPOST('newamount','alpha')) { |
|
| 1379 | + $_GET['newamount']=$member->last_subscription_amount; |
|
| 1380 | + } |
|
| 1295 | 1381 | } |
| 1296 | 1382 | |
| 1297 | 1383 | // Amount |
@@ -1299,9 +1385,15 @@ discard block |
||
| 1299 | 1385 | print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount"); |
| 1300 | 1386 | if (empty($amount)) |
| 1301 | 1387 | { |
| 1302 | - if (empty($conf->global->MEMBER_NEWFORM_AMOUNT)) print ' ('.$langs->trans("ToComplete"); |
|
| 1303 | - if (! empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) print ' - <a href="'.$conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO.'" rel="external" target="_blank">'.$langs->trans("SeeHere").'</a>'; |
|
| 1304 | - if (empty($conf->global->MEMBER_NEWFORM_AMOUNT)) print ')'; |
|
| 1388 | + if (empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { |
|
| 1389 | + print ' ('.$langs->trans("ToComplete"); |
|
| 1390 | + } |
|
| 1391 | + if (! empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) { |
|
| 1392 | + print ' - <a href="'.$conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO.'" rel="external" target="_blank">'.$langs->trans("SeeHere").'</a>'; |
|
| 1393 | + } |
|
| 1394 | + if (empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { |
|
| 1395 | + print ')'; |
|
| 1396 | + } |
|
| 1305 | 1397 | } |
| 1306 | 1398 | print '</td><td class="CTableRow'.($var?'1':'2').'">'; |
| 1307 | 1399 | $valtoshow=''; |
@@ -1315,8 +1407,7 @@ discard block |
||
| 1315 | 1407 | if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { |
| 1316 | 1408 | $valtoshow = $conf->global->MEMBER_NEWFORM_AMOUNT; |
| 1317 | 1409 | } |
| 1318 | - } |
|
| 1319 | - else { |
|
| 1410 | + } else { |
|
| 1320 | 1411 | if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { |
| 1321 | 1412 | $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; |
| 1322 | 1413 | } |
@@ -1326,13 +1417,16 @@ discard block |
||
| 1326 | 1417 | if (empty($amount) || ! is_numeric($amount)) |
| 1327 | 1418 | { |
| 1328 | 1419 | //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); |
| 1329 | - if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); |
|
| 1420 | + if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) { |
|
| 1421 | + $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); |
|
| 1422 | + } |
|
| 1330 | 1423 | print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">'; |
| 1331 | 1424 | print '<input class="flat maxwidth75" type="text" name="newamount" value="'.$valtoshow.'">'; |
| 1332 | - } |
|
| 1333 | - else { |
|
| 1425 | + } else { |
|
| 1334 | 1426 | $valtoshow=$amount; |
| 1335 | - if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); |
|
| 1427 | + if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) { |
|
| 1428 | + $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); |
|
| 1429 | + } |
|
| 1336 | 1430 | print '<b>'.price($valtoshow).'</b>'; |
| 1337 | 1431 | print '<input type="hidden" name="amount" value="'.$valtoshow.'">'; |
| 1338 | 1432 | print '<input type="hidden" name="newamount" value="'.$valtoshow.'">'; |
@@ -1369,37 +1463,45 @@ discard block |
||
| 1369 | 1463 | print '<input type="hidden" name="shipToZip" value="'.$shipToZip.'">'."\n"; |
| 1370 | 1464 | print '<input type="hidden" name="shipToStreet2" value="'.$shipToStreet2.'">'."\n"; |
| 1371 | 1465 | print '<input type="hidden" name="phoneNum" value="'.$phoneNum.'">'."\n"; |
| 1372 | - } |
|
| 1373 | - else |
|
| 1466 | + } else |
|
| 1374 | 1467 | { |
| 1375 | 1468 | print '<!-- Shipping address not complete, so we don t use it -->'."\n"; |
| 1376 | 1469 | } |
| 1377 | - if (is_object($member->thirdparty)) print '<input type="hidden" name="thirdparty_id" value="'.$member->thirdparty->id.'">'."\n"; |
|
| 1470 | + if (is_object($member->thirdparty)) { |
|
| 1471 | + print '<input type="hidden" name="thirdparty_id" value="'.$member->thirdparty->id.'">'."\n"; |
|
| 1472 | + } |
|
| 1378 | 1473 | print '<input type="hidden" name="email" value="'.$member->email.'">'."\n"; |
| 1379 | 1474 | $labeldesc = $langs->trans("PaymentSubscription"); |
| 1380 | - if (GETPOST('desc','alpha')) $labeldesc=GETPOST('desc','alpha'); |
|
| 1475 | + if (GETPOST('desc','alpha')) { |
|
| 1476 | + $labeldesc=GETPOST('desc','alpha'); |
|
| 1477 | + } |
|
| 1381 | 1478 | print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n"; |
| 1382 | 1479 | } |
| 1383 | 1480 | |
| 1384 | 1481 | |
| 1385 | 1482 | |
| 1386 | 1483 | |
| 1387 | -if (! $found && ! $mesg) $mesg=$langs->trans("ErrorBadParameters"); |
|
| 1484 | +if (! $found && ! $mesg) { |
|
| 1485 | + $mesg=$langs->trans("ErrorBadParameters"); |
|
| 1486 | +} |
|
| 1388 | 1487 | |
| 1389 | -if ($mesg) print '<tr><td align="center" colspan="2"><br><div class="warning">'.$mesg.'</div></td></tr>'."\n"; |
|
| 1488 | +if ($mesg) { |
|
| 1489 | + print '<tr><td align="center" colspan="2"><br><div class="warning">'.$mesg.'</div></td></tr>'."\n"; |
|
| 1490 | +} |
|
| 1390 | 1491 | |
| 1391 | 1492 | print '</table>'."\n"; |
| 1392 | 1493 | print "\n"; |
| 1393 | 1494 | |
| 1394 | 1495 | if ($action != 'dopayment') |
| 1395 | 1496 | { |
| 1396 | - if ($found && ! $error) // We are in a management option and no error |
|
| 1497 | + if ($found && ! $error) { |
|
| 1498 | + // We are in a management option and no error |
|
| 1397 | 1499 | { |
| 1398 | 1500 | if ($source == 'invoice' && $object->paye) |
| 1399 | 1501 | { |
| 1400 | 1502 | print '<br><br>'.$langs->trans("InvoicePaid"); |
| 1401 | - } |
|
| 1402 | - else |
|
| 1503 | + } |
|
| 1504 | + } else |
|
| 1403 | 1505 | { |
| 1404 | 1506 | // Buttons for all payments registration methods |
| 1405 | 1507 | |
@@ -1417,7 +1519,9 @@ discard block |
||
| 1417 | 1519 | |
| 1418 | 1520 | if (! empty($conf->paypal->enabled)) |
| 1419 | 1521 | { |
| 1420 | - if (empty($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY)) $conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY='integral'; |
|
| 1522 | + if (empty($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY)) { |
|
| 1523 | + $conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY='integral'; |
|
| 1524 | + } |
|
| 1421 | 1525 | |
| 1422 | 1526 | if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'integral') |
| 1423 | 1527 | { |
@@ -1429,13 +1533,11 @@ discard block |
||
| 1429 | 1533 | } |
| 1430 | 1534 | } |
| 1431 | 1535 | } |
| 1432 | - } |
|
| 1433 | - else |
|
| 1536 | + } else |
|
| 1434 | 1537 | { |
| 1435 | 1538 | dol_print_error_email('ERRORNEWPAYMENT'); |
| 1436 | 1539 | } |
| 1437 | -} |
|
| 1438 | -else |
|
| 1540 | +} else |
|
| 1439 | 1541 | { |
| 1440 | 1542 | |
| 1441 | 1543 | } |
@@ -72,121 +72,121 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | $object = new Holiday($db); |
| 74 | 74 | |
| 75 | - // If no right to create a request |
|
| 76 | - if (! $cancreate) |
|
| 77 | - { |
|
| 78 | - $error++; |
|
| 79 | - setEventMessages($langs->trans('CantCreateCP'), null, 'errors'); |
|
| 80 | - $action='request'; |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - if (! $error) |
|
| 84 | - { |
|
| 85 | - $db->begin(); |
|
| 86 | - |
|
| 87 | - $date_debut = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year')); |
|
| 88 | - $date_fin = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year')); |
|
| 89 | - $date_debut_gmt = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'), 1); |
|
| 90 | - $date_fin_gmt = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'), 1); |
|
| 91 | - $starthalfday=GETPOST('starthalfday'); |
|
| 92 | - $endhalfday=GETPOST('endhalfday'); |
|
| 93 | - $type=GETPOST('type'); |
|
| 94 | - $halfday=0; |
|
| 95 | - if ($starthalfday == 'afternoon' && $endhalfday == 'morning') $halfday=2; |
|
| 96 | - else if ($starthalfday == 'afternoon') $halfday=-1; |
|
| 97 | - else if ($endhalfday == 'morning') $halfday=1; |
|
| 98 | - |
|
| 99 | - $valideur = GETPOST('valideur'); |
|
| 100 | - $description = trim(GETPOST('description')); |
|
| 101 | - |
|
| 102 | - // If no type |
|
| 103 | - if ($type <= 0) |
|
| 104 | - { |
|
| 105 | - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); |
|
| 106 | - $error++; |
|
| 107 | - $action='create'; |
|
| 108 | - } |
|
| 75 | + // If no right to create a request |
|
| 76 | + if (! $cancreate) |
|
| 77 | + { |
|
| 78 | + $error++; |
|
| 79 | + setEventMessages($langs->trans('CantCreateCP'), null, 'errors'); |
|
| 80 | + $action='request'; |
|
| 81 | + } |
|
| 109 | 82 | |
| 110 | - // If no start date |
|
| 111 | - if (empty($date_debut)) |
|
| 112 | - { |
|
| 113 | - setEventMessages($langs->trans("NoDateDebut"), null, 'errors'); |
|
| 114 | - $error++; |
|
| 115 | - $action='create'; |
|
| 116 | - } |
|
| 117 | - // If no end date |
|
| 118 | - if (empty($date_fin)) |
|
| 119 | - { |
|
| 120 | - setEventMessages($langs->trans("NoDateFin"), null, 'errors'); |
|
| 121 | - $error++; |
|
| 122 | - $action='create'; |
|
| 123 | - } |
|
| 124 | - // If start date after end date |
|
| 125 | - if ($date_debut > $date_fin) |
|
| 126 | - { |
|
| 127 | - setEventMessages($langs->trans("ErrorEndDateCP"), null, 'errors'); |
|
| 128 | - $error++; |
|
| 129 | - $action='create'; |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - // Check if there is already holiday for this period |
|
| 133 | - $verifCP = $object->verifDateHolidayCP($fuserid, $date_debut, $date_fin, $halfday); |
|
| 134 | - if (! $verifCP) |
|
| 135 | - { |
|
| 136 | - setEventMessages($langs->trans("alreadyCPexist"), null, 'errors'); |
|
| 137 | - $error++; |
|
| 138 | - $action='create'; |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - // If there is no Business Days within request |
|
| 142 | - $nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday); |
|
| 143 | - if($nbopenedday < 0.5) |
|
| 144 | - { |
|
| 145 | - setEventMessages($langs->trans("ErrorDureeCP"), null, 'errors'); |
|
| 146 | - $error++; |
|
| 147 | - $action='create'; |
|
| 148 | - } |
|
| 83 | + if (! $error) |
|
| 84 | + { |
|
| 85 | + $db->begin(); |
|
| 86 | + |
|
| 87 | + $date_debut = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year')); |
|
| 88 | + $date_fin = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year')); |
|
| 89 | + $date_debut_gmt = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'), 1); |
|
| 90 | + $date_fin_gmt = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'), 1); |
|
| 91 | + $starthalfday=GETPOST('starthalfday'); |
|
| 92 | + $endhalfday=GETPOST('endhalfday'); |
|
| 93 | + $type=GETPOST('type'); |
|
| 94 | + $halfday=0; |
|
| 95 | + if ($starthalfday == 'afternoon' && $endhalfday == 'morning') $halfday=2; |
|
| 96 | + else if ($starthalfday == 'afternoon') $halfday=-1; |
|
| 97 | + else if ($endhalfday == 'morning') $halfday=1; |
|
| 98 | + |
|
| 99 | + $valideur = GETPOST('valideur'); |
|
| 100 | + $description = trim(GETPOST('description')); |
|
| 101 | + |
|
| 102 | + // If no type |
|
| 103 | + if ($type <= 0) |
|
| 104 | + { |
|
| 105 | + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); |
|
| 106 | + $error++; |
|
| 107 | + $action='create'; |
|
| 108 | + } |
|
| 149 | 109 | |
| 150 | - // If no validator designated |
|
| 151 | - if ($valideur < 1) |
|
| 152 | - { |
|
| 153 | - setEventMessages($langs->transnoentitiesnoconv('InvalidValidatorCP'), null, 'errors'); |
|
| 154 | - $error++; |
|
| 155 | - } |
|
| 110 | + // If no start date |
|
| 111 | + if (empty($date_debut)) |
|
| 112 | + { |
|
| 113 | + setEventMessages($langs->trans("NoDateDebut"), null, 'errors'); |
|
| 114 | + $error++; |
|
| 115 | + $action='create'; |
|
| 116 | + } |
|
| 117 | + // If no end date |
|
| 118 | + if (empty($date_fin)) |
|
| 119 | + { |
|
| 120 | + setEventMessages($langs->trans("NoDateFin"), null, 'errors'); |
|
| 121 | + $error++; |
|
| 122 | + $action='create'; |
|
| 123 | + } |
|
| 124 | + // If start date after end date |
|
| 125 | + if ($date_debut > $date_fin) |
|
| 126 | + { |
|
| 127 | + setEventMessages($langs->trans("ErrorEndDateCP"), null, 'errors'); |
|
| 128 | + $error++; |
|
| 129 | + $action='create'; |
|
| 130 | + } |
|
| 156 | 131 | |
| 157 | - $result = 0; |
|
| 132 | + // Check if there is already holiday for this period |
|
| 133 | + $verifCP = $object->verifDateHolidayCP($fuserid, $date_debut, $date_fin, $halfday); |
|
| 134 | + if (! $verifCP) |
|
| 135 | + { |
|
| 136 | + setEventMessages($langs->trans("alreadyCPexist"), null, 'errors'); |
|
| 137 | + $error++; |
|
| 138 | + $action='create'; |
|
| 139 | + } |
|
| 158 | 140 | |
| 159 | - if (! $error) |
|
| 160 | - { |
|
| 161 | - $object->fk_user = $fuserid; |
|
| 162 | - $object->description = $description; |
|
| 163 | - $object->fk_validator = $valideur; |
|
| 164 | - $object->fk_type = $type; |
|
| 165 | - $object->date_debut = $date_debut; |
|
| 166 | - $object->date_fin = $date_fin; |
|
| 167 | - $object->halfday = $halfday; |
|
| 168 | - |
|
| 169 | - $result = $object->create($user); |
|
| 170 | - if ($result <= 0) |
|
| 171 | - { |
|
| 172 | - setEventMessages($object->error, $object->errors, 'errors'); |
|
| 173 | - $error++; |
|
| 174 | - } |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - // If no SQL error we redirect to the request card |
|
| 178 | - if (! $error) |
|
| 179 | - { |
|
| 141 | + // If there is no Business Days within request |
|
| 142 | + $nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday); |
|
| 143 | + if($nbopenedday < 0.5) |
|
| 144 | + { |
|
| 145 | + setEventMessages($langs->trans("ErrorDureeCP"), null, 'errors'); |
|
| 146 | + $error++; |
|
| 147 | + $action='create'; |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + // If no validator designated |
|
| 151 | + if ($valideur < 1) |
|
| 152 | + { |
|
| 153 | + setEventMessages($langs->transnoentitiesnoconv('InvalidValidatorCP'), null, 'errors'); |
|
| 154 | + $error++; |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + $result = 0; |
|
| 158 | + |
|
| 159 | + if (! $error) |
|
| 160 | + { |
|
| 161 | + $object->fk_user = $fuserid; |
|
| 162 | + $object->description = $description; |
|
| 163 | + $object->fk_validator = $valideur; |
|
| 164 | + $object->fk_type = $type; |
|
| 165 | + $object->date_debut = $date_debut; |
|
| 166 | + $object->date_fin = $date_fin; |
|
| 167 | + $object->halfday = $halfday; |
|
| 168 | + |
|
| 169 | + $result = $object->create($user); |
|
| 170 | + if ($result <= 0) |
|
| 171 | + { |
|
| 172 | + setEventMessages($object->error, $object->errors, 'errors'); |
|
| 173 | + $error++; |
|
| 174 | + } |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + // If no SQL error we redirect to the request card |
|
| 178 | + if (! $error) |
|
| 179 | + { |
|
| 180 | 180 | $db->commit(); |
| 181 | 181 | |
| 182 | - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
| 183 | - exit; |
|
| 184 | - } |
|
| 185 | - else |
|
| 182 | + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
| 183 | + exit; |
|
| 184 | + } |
|
| 185 | + else |
|
| 186 | 186 | { |
| 187 | - $db->rollback(); |
|
| 188 | - } |
|
| 189 | - } |
|
| 187 | + $db->rollback(); |
|
| 188 | + } |
|
| 189 | + } |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | if ($action == 'update') |
@@ -202,61 +202,61 @@ discard block |
||
| 202 | 202 | else if ($starthalfday == 'afternoon') $halfday=-1; |
| 203 | 203 | else if ($endhalfday == 'morning') $halfday=1; |
| 204 | 204 | |
| 205 | - // If no right to modify a request |
|
| 206 | - if (! $user->rights->holiday->write) |
|
| 207 | - { |
|
| 208 | - header('Location: '.$_SERVER["PHP_SELF"].'?action=request&error=CantUpdate'); |
|
| 209 | - exit; |
|
| 210 | - } |
|
| 205 | + // If no right to modify a request |
|
| 206 | + if (! $user->rights->holiday->write) |
|
| 207 | + { |
|
| 208 | + header('Location: '.$_SERVER["PHP_SELF"].'?action=request&error=CantUpdate'); |
|
| 209 | + exit; |
|
| 210 | + } |
|
| 211 | 211 | |
| 212 | - $object = new Holiday($db); |
|
| 213 | - $object->fetch($id); |
|
| 212 | + $object = new Holiday($db); |
|
| 213 | + $object->fetch($id); |
|
| 214 | 214 | |
| 215 | 215 | // If under validation |
| 216 | - if ($object->statut == 1) |
|
| 217 | - { |
|
| 218 | - // If this is the requestor or has read/write rights |
|
| 219 | - if ($cancreate) |
|
| 220 | - { |
|
| 221 | - $valideur = $_POST['valideur']; |
|
| 222 | - $description = trim($_POST['description']); |
|
| 223 | - |
|
| 224 | - // If no start date |
|
| 225 | - if (empty($_POST['date_debut_'])) { |
|
| 226 | - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=nodatedebut'); |
|
| 227 | - exit; |
|
| 228 | - } |
|
| 229 | - |
|
| 230 | - // If no end date |
|
| 231 | - if (empty($_POST['date_fin_'])) { |
|
| 232 | - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=nodatefin'); |
|
| 233 | - exit; |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - // If start date after end date |
|
| 237 | - if ($date_debut > $date_fin) { |
|
| 238 | - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=datefin'); |
|
| 239 | - exit; |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - // If no validator designated |
|
| 243 | - if ($valideur < 1) { |
|
| 244 | - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=Valideur'); |
|
| 245 | - exit; |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - // If there is no Business Days within request |
|
| 249 | - $nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday); |
|
| 250 | - if ($nbopenedday < 0.5) |
|
| 251 | - { |
|
| 252 | - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=DureeHoliday'); |
|
| 253 | - exit; |
|
| 254 | - } |
|
| 255 | - |
|
| 256 | - $object->description = $description; |
|
| 257 | - $object->date_debut = $date_debut; |
|
| 258 | - $object->date_fin = $date_fin; |
|
| 259 | - $object->fk_validator = $valideur; |
|
| 216 | + if ($object->statut == 1) |
|
| 217 | + { |
|
| 218 | + // If this is the requestor or has read/write rights |
|
| 219 | + if ($cancreate) |
|
| 220 | + { |
|
| 221 | + $valideur = $_POST['valideur']; |
|
| 222 | + $description = trim($_POST['description']); |
|
| 223 | + |
|
| 224 | + // If no start date |
|
| 225 | + if (empty($_POST['date_debut_'])) { |
|
| 226 | + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=nodatedebut'); |
|
| 227 | + exit; |
|
| 228 | + } |
|
| 229 | + |
|
| 230 | + // If no end date |
|
| 231 | + if (empty($_POST['date_fin_'])) { |
|
| 232 | + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=nodatefin'); |
|
| 233 | + exit; |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + // If start date after end date |
|
| 237 | + if ($date_debut > $date_fin) { |
|
| 238 | + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=datefin'); |
|
| 239 | + exit; |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + // If no validator designated |
|
| 243 | + if ($valideur < 1) { |
|
| 244 | + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=Valideur'); |
|
| 245 | + exit; |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + // If there is no Business Days within request |
|
| 249 | + $nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday); |
|
| 250 | + if ($nbopenedday < 0.5) |
|
| 251 | + { |
|
| 252 | + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=DureeHoliday'); |
|
| 253 | + exit; |
|
| 254 | + } |
|
| 255 | + |
|
| 256 | + $object->description = $description; |
|
| 257 | + $object->date_debut = $date_debut; |
|
| 258 | + $object->date_fin = $date_fin; |
|
| 259 | + $object->fk_validator = $valideur; |
|
| 260 | 260 | $object->halfday = $halfday; |
| 261 | 261 | |
| 262 | 262 | // Update |
@@ -272,18 +272,18 @@ discard block |
||
| 272 | 272 | header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
| 273 | 273 | exit; |
| 274 | 274 | } |
| 275 | - } |
|
| 276 | - else |
|
| 277 | - { |
|
| 278 | - setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors'); |
|
| 279 | - $action=''; |
|
| 280 | - } |
|
| 281 | - } |
|
| 282 | - else |
|
| 283 | - { |
|
| 284 | - setEventMessages($langs->trans("ErrorBadStatus"), null, 'errors'); |
|
| 285 | - $action=''; |
|
| 286 | - } |
|
| 275 | + } |
|
| 276 | + else |
|
| 277 | + { |
|
| 278 | + setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors'); |
|
| 279 | + $action=''; |
|
| 280 | + } |
|
| 281 | + } |
|
| 282 | + else |
|
| 283 | + { |
|
| 284 | + setEventMessages($langs->trans("ErrorBadStatus"), null, 'errors'); |
|
| 285 | + $action=''; |
|
| 286 | + } |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | // If delete of request |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | $object = new Holiday($db); |
| 297 | 297 | $object->fetch($id); |
| 298 | 298 | |
| 299 | - // If this is a rough draft, approved, canceled or refused |
|
| 299 | + // If this is a rough draft, approved, canceled or refused |
|
| 300 | 300 | if ($object->statut == 1 || $object->statut == 4 || $object->statut == 5) |
| 301 | 301 | { |
| 302 | 302 | // Si l'utilisateur à le droit de lire cette demande, il peut la supprimer |
@@ -327,276 +327,276 @@ discard block |
||
| 327 | 327 | // Si envoi de la demande |
| 328 | 328 | if ($action == 'confirm_send') |
| 329 | 329 | { |
| 330 | - $object = new Holiday($db); |
|
| 331 | - $object->fetch($id); |
|
| 332 | - |
|
| 333 | - // Si brouillon et créateur |
|
| 334 | - if($object->statut == 1 && $cancreate) |
|
| 335 | - { |
|
| 336 | - $object->statut = 2; |
|
| 337 | - |
|
| 338 | - $verif = $object->update($user); |
|
| 339 | - |
|
| 340 | - // Si pas d'erreur SQL on redirige vers la fiche de la demande |
|
| 341 | - if ($verif > 0) |
|
| 342 | - { |
|
| 343 | - // To |
|
| 344 | - $destinataire = new User($db); |
|
| 345 | - $destinataire->fetch($object->fk_validator); |
|
| 346 | - $emailTo = $destinataire->email; |
|
| 347 | - |
|
| 348 | - if (!$emailTo) |
|
| 349 | - { |
|
| 350 | - dol_syslog("Expected validator has no email, so we redirect directly to finished page without sending email"); |
|
| 351 | - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
| 352 | - exit; |
|
| 353 | - } |
|
| 354 | - |
|
| 355 | - // From |
|
| 356 | - $expediteur = new User($db); |
|
| 357 | - $expediteur->fetch($object->fk_user); |
|
| 358 | - $emailFrom = $expediteur->email; |
|
| 359 | - |
|
| 360 | - // Subject |
|
| 330 | + $object = new Holiday($db); |
|
| 331 | + $object->fetch($id); |
|
| 332 | + |
|
| 333 | + // Si brouillon et créateur |
|
| 334 | + if($object->statut == 1 && $cancreate) |
|
| 335 | + { |
|
| 336 | + $object->statut = 2; |
|
| 337 | + |
|
| 338 | + $verif = $object->update($user); |
|
| 339 | + |
|
| 340 | + // Si pas d'erreur SQL on redirige vers la fiche de la demande |
|
| 341 | + if ($verif > 0) |
|
| 342 | + { |
|
| 343 | + // To |
|
| 344 | + $destinataire = new User($db); |
|
| 345 | + $destinataire->fetch($object->fk_validator); |
|
| 346 | + $emailTo = $destinataire->email; |
|
| 347 | + |
|
| 348 | + if (!$emailTo) |
|
| 349 | + { |
|
| 350 | + dol_syslog("Expected validator has no email, so we redirect directly to finished page without sending email"); |
|
| 351 | + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
| 352 | + exit; |
|
| 353 | + } |
|
| 354 | + |
|
| 355 | + // From |
|
| 356 | + $expediteur = new User($db); |
|
| 357 | + $expediteur->fetch($object->fk_user); |
|
| 358 | + $emailFrom = $expediteur->email; |
|
| 359 | + |
|
| 360 | + // Subject |
|
| 361 | 361 | $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; |
| 362 | - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 363 | - |
|
| 364 | - $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysToValidate"); |
|
| 365 | - |
|
| 366 | - // Content |
|
| 367 | - $message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n"; |
|
| 368 | - $message.= "\n"; |
|
| 369 | - $message.= $langs->transnoentities("HolidaysToValidateBody")."\n"; |
|
| 370 | - |
|
| 371 | - $delayForRequest = $object->getConfCP('delayForRequest'); |
|
| 372 | - //$delayForRequest = $delayForRequest * (60*60*24); |
|
| 373 | - |
|
| 374 | - $nextMonth = dol_time_plus_duree($now, $delayForRequest, 'd'); |
|
| 375 | - |
|
| 376 | - // Si l'option pour avertir le valideur en cas de délai trop court |
|
| 377 | - if($object->getConfCP('AlertValidatorDelay')) |
|
| 378 | - { |
|
| 379 | - if($object->date_debut < $nextMonth) |
|
| 380 | - { |
|
| 381 | - $message.= "\n"; |
|
| 382 | - $message.= $langs->transnoentities("HolidaysToValidateDelay",$object->getConfCP('delayForRequest'))."\n"; |
|
| 383 | - } |
|
| 384 | - } |
|
| 385 | - |
|
| 386 | - // Si l'option pour avertir le valideur en cas de solde inférieur à la demande |
|
| 387 | - if ($object->getConfCP('AlertValidatorSolde')) |
|
| 388 | - { |
|
| 389 | - $nbopenedday=num_open_day($object->date_debut_gmt,$object->date_fin_gmt,0,1,$object->halfday); |
|
| 390 | - if ($nbopenedday > $object->getCPforUser($object->fk_user, $object->fk_type)) |
|
| 391 | - { |
|
| 392 | - $message.= "\n"; |
|
| 393 | - $message.= $langs->transnoentities("HolidaysToValidateAlertSolde")."\n"; |
|
| 394 | - } |
|
| 395 | - } |
|
| 396 | - |
|
| 397 | - $message.= "\n"; |
|
| 398 | - $message.= "- ".$langs->transnoentitiesnoconv("Name")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; |
|
| 399 | - $message.= "- ".$langs->transnoentitiesnoconv("Period")." : ".dol_print_date($object->date_debut,'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($object->date_fin,'day')."\n"; |
|
| 400 | - $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n"; |
|
| 401 | - $message.= "\n"; |
|
| 402 | - |
|
| 403 | - $trackid='leav'.$object->id; |
|
| 404 | - |
|
| 405 | - $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid); |
|
| 406 | - |
|
| 407 | - // Envoi du mail |
|
| 408 | - $result=$mail->sendfile(); |
|
| 409 | - |
|
| 410 | - if (!$result) |
|
| 411 | - { |
|
| 412 | - setEventMessages($mail->error, $mail->errors, 'warnings'); |
|
| 413 | - $action=''; |
|
| 414 | - } |
|
| 415 | - else |
|
| 416 | - { |
|
| 417 | - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
| 418 | - exit; |
|
| 419 | - } |
|
| 420 | - } |
|
| 421 | - else |
|
| 422 | - { |
|
| 423 | - setEventMessages($object->error, $object->errors, 'errors'); |
|
| 424 | - $action=''; |
|
| 425 | - } |
|
| 426 | - } |
|
| 362 | + if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 363 | + |
|
| 364 | + $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysToValidate"); |
|
| 365 | + |
|
| 366 | + // Content |
|
| 367 | + $message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n"; |
|
| 368 | + $message.= "\n"; |
|
| 369 | + $message.= $langs->transnoentities("HolidaysToValidateBody")."\n"; |
|
| 370 | + |
|
| 371 | + $delayForRequest = $object->getConfCP('delayForRequest'); |
|
| 372 | + //$delayForRequest = $delayForRequest * (60*60*24); |
|
| 373 | + |
|
| 374 | + $nextMonth = dol_time_plus_duree($now, $delayForRequest, 'd'); |
|
| 375 | + |
|
| 376 | + // Si l'option pour avertir le valideur en cas de délai trop court |
|
| 377 | + if($object->getConfCP('AlertValidatorDelay')) |
|
| 378 | + { |
|
| 379 | + if($object->date_debut < $nextMonth) |
|
| 380 | + { |
|
| 381 | + $message.= "\n"; |
|
| 382 | + $message.= $langs->transnoentities("HolidaysToValidateDelay",$object->getConfCP('delayForRequest'))."\n"; |
|
| 383 | + } |
|
| 384 | + } |
|
| 385 | + |
|
| 386 | + // Si l'option pour avertir le valideur en cas de solde inférieur à la demande |
|
| 387 | + if ($object->getConfCP('AlertValidatorSolde')) |
|
| 388 | + { |
|
| 389 | + $nbopenedday=num_open_day($object->date_debut_gmt,$object->date_fin_gmt,0,1,$object->halfday); |
|
| 390 | + if ($nbopenedday > $object->getCPforUser($object->fk_user, $object->fk_type)) |
|
| 391 | + { |
|
| 392 | + $message.= "\n"; |
|
| 393 | + $message.= $langs->transnoentities("HolidaysToValidateAlertSolde")."\n"; |
|
| 394 | + } |
|
| 395 | + } |
|
| 396 | + |
|
| 397 | + $message.= "\n"; |
|
| 398 | + $message.= "- ".$langs->transnoentitiesnoconv("Name")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; |
|
| 399 | + $message.= "- ".$langs->transnoentitiesnoconv("Period")." : ".dol_print_date($object->date_debut,'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($object->date_fin,'day')."\n"; |
|
| 400 | + $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n"; |
|
| 401 | + $message.= "\n"; |
|
| 402 | + |
|
| 403 | + $trackid='leav'.$object->id; |
|
| 404 | + |
|
| 405 | + $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid); |
|
| 406 | + |
|
| 407 | + // Envoi du mail |
|
| 408 | + $result=$mail->sendfile(); |
|
| 409 | + |
|
| 410 | + if (!$result) |
|
| 411 | + { |
|
| 412 | + setEventMessages($mail->error, $mail->errors, 'warnings'); |
|
| 413 | + $action=''; |
|
| 414 | + } |
|
| 415 | + else |
|
| 416 | + { |
|
| 417 | + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
| 418 | + exit; |
|
| 419 | + } |
|
| 420 | + } |
|
| 421 | + else |
|
| 422 | + { |
|
| 423 | + setEventMessages($object->error, $object->errors, 'errors'); |
|
| 424 | + $action=''; |
|
| 425 | + } |
|
| 426 | + } |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | |
| 430 | 430 | // Si Validation de la demande |
| 431 | 431 | if ($action == 'confirm_valid') |
| 432 | 432 | { |
| 433 | - $object = new Holiday($db); |
|
| 434 | - $object->fetch($id); |
|
| 435 | - |
|
| 436 | - // Si statut en attente de validation et valideur = utilisateur |
|
| 437 | - if ($object->statut == 2 && $user->id == $object->fk_validator) |
|
| 438 | - { |
|
| 439 | - $object->date_valid = dol_now(); |
|
| 440 | - $object->fk_user_valid = $user->id; |
|
| 441 | - $object->statut = 3; |
|
| 442 | - |
|
| 443 | - $verif = $object->update($user); |
|
| 444 | - |
|
| 445 | - // Si pas d'erreur SQL on redirige vers la fiche de la demande |
|
| 446 | - if ($verif > 0) |
|
| 447 | - { |
|
| 448 | - // Calculcate number of days consummed |
|
| 449 | - $nbopenedday=num_open_day($object->date_debut_gmt,$object->date_fin_gmt,0,1,$object->halfday); |
|
| 450 | - |
|
| 451 | - $soldeActuel = $object->getCpforUser($object->fk_user, $object->fk_type); |
|
| 452 | - $newSolde = $soldeActuel - ($nbopenedday * $object->getConfCP('nbHolidayDeducted')); |
|
| 453 | - |
|
| 454 | - // On ajoute la modification dans le LOG |
|
| 455 | - $object->addLogCP($user->id, $object->fk_user, $langs->transnoentitiesnoconv("Holidays"), $newSolde, $object->fk_type); |
|
| 456 | - |
|
| 457 | - // Mise à jour du solde |
|
| 458 | - $object->updateSoldeCP($object->fk_user, $newSolde, $object->fk_type); |
|
| 459 | - |
|
| 460 | - // To |
|
| 461 | - $destinataire = new User($db); |
|
| 462 | - $destinataire->fetch($object->fk_user); |
|
| 463 | - $emailTo = $destinataire->email; |
|
| 464 | - |
|
| 465 | - if (!$emailTo) |
|
| 466 | - { |
|
| 467 | - dol_syslog("User that request leave has no email, so we redirect directly to finished page without sending email"); |
|
| 468 | - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
| 469 | - exit; |
|
| 470 | - } |
|
| 471 | - |
|
| 472 | - // From |
|
| 473 | - $expediteur = new User($db); |
|
| 474 | - $expediteur->fetch($object->fk_validator); |
|
| 475 | - $emailFrom = $expediteur->email; |
|
| 476 | - |
|
| 477 | - // Subject |
|
| 433 | + $object = new Holiday($db); |
|
| 434 | + $object->fetch($id); |
|
| 435 | + |
|
| 436 | + // Si statut en attente de validation et valideur = utilisateur |
|
| 437 | + if ($object->statut == 2 && $user->id == $object->fk_validator) |
|
| 438 | + { |
|
| 439 | + $object->date_valid = dol_now(); |
|
| 440 | + $object->fk_user_valid = $user->id; |
|
| 441 | + $object->statut = 3; |
|
| 442 | + |
|
| 443 | + $verif = $object->update($user); |
|
| 444 | + |
|
| 445 | + // Si pas d'erreur SQL on redirige vers la fiche de la demande |
|
| 446 | + if ($verif > 0) |
|
| 447 | + { |
|
| 448 | + // Calculcate number of days consummed |
|
| 449 | + $nbopenedday=num_open_day($object->date_debut_gmt,$object->date_fin_gmt,0,1,$object->halfday); |
|
| 450 | + |
|
| 451 | + $soldeActuel = $object->getCpforUser($object->fk_user, $object->fk_type); |
|
| 452 | + $newSolde = $soldeActuel - ($nbopenedday * $object->getConfCP('nbHolidayDeducted')); |
|
| 453 | + |
|
| 454 | + // On ajoute la modification dans le LOG |
|
| 455 | + $object->addLogCP($user->id, $object->fk_user, $langs->transnoentitiesnoconv("Holidays"), $newSolde, $object->fk_type); |
|
| 456 | + |
|
| 457 | + // Mise à jour du solde |
|
| 458 | + $object->updateSoldeCP($object->fk_user, $newSolde, $object->fk_type); |
|
| 459 | + |
|
| 460 | + // To |
|
| 461 | + $destinataire = new User($db); |
|
| 462 | + $destinataire->fetch($object->fk_user); |
|
| 463 | + $emailTo = $destinataire->email; |
|
| 464 | + |
|
| 465 | + if (!$emailTo) |
|
| 466 | + { |
|
| 467 | + dol_syslog("User that request leave has no email, so we redirect directly to finished page without sending email"); |
|
| 468 | + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
| 469 | + exit; |
|
| 470 | + } |
|
| 471 | + |
|
| 472 | + // From |
|
| 473 | + $expediteur = new User($db); |
|
| 474 | + $expediteur->fetch($object->fk_validator); |
|
| 475 | + $emailFrom = $expediteur->email; |
|
| 476 | + |
|
| 477 | + // Subject |
|
| 478 | 478 | $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; |
| 479 | - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 480 | - |
|
| 481 | - $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysValidated"); |
|
| 482 | - |
|
| 483 | - // Content |
|
| 484 | - $message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n"; |
|
| 485 | - $message.= "\n"; |
|
| 486 | - $message.= $langs->transnoentities("HolidaysValidatedBody", dol_print_date($object->date_debut,'day'),dol_print_date($object->date_fin,'day'))."\n"; |
|
| 487 | - |
|
| 488 | - $message.= "- ".$langs->transnoentitiesnoconv("ValidatedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; |
|
| 489 | - |
|
| 490 | - $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n"; |
|
| 491 | - $message.= "\n"; |
|
| 492 | - |
|
| 493 | - $trackid='leav'.$object->id; |
|
| 494 | - |
|
| 495 | - $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid); |
|
| 496 | - |
|
| 497 | - // Envoi du mail |
|
| 498 | - $result=$mail->sendfile(); |
|
| 499 | - |
|
| 500 | - if (!$result) |
|
| 501 | - { |
|
| 502 | - setEventMessages($mail->error, $mail->errors, 'warnings'); |
|
| 503 | - $action=''; |
|
| 504 | - } |
|
| 505 | - else |
|
| 506 | - { |
|
| 507 | - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
| 508 | - exit; |
|
| 509 | - } |
|
| 510 | - } |
|
| 511 | - else |
|
| 512 | - { |
|
| 513 | - setEventMessages($object->error, $object->errors, 'errors'); |
|
| 514 | - $action=''; |
|
| 515 | - } |
|
| 516 | - } |
|
| 479 | + if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 480 | + |
|
| 481 | + $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysValidated"); |
|
| 482 | + |
|
| 483 | + // Content |
|
| 484 | + $message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n"; |
|
| 485 | + $message.= "\n"; |
|
| 486 | + $message.= $langs->transnoentities("HolidaysValidatedBody", dol_print_date($object->date_debut,'day'),dol_print_date($object->date_fin,'day'))."\n"; |
|
| 487 | + |
|
| 488 | + $message.= "- ".$langs->transnoentitiesnoconv("ValidatedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; |
|
| 489 | + |
|
| 490 | + $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n"; |
|
| 491 | + $message.= "\n"; |
|
| 492 | + |
|
| 493 | + $trackid='leav'.$object->id; |
|
| 494 | + |
|
| 495 | + $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid); |
|
| 496 | + |
|
| 497 | + // Envoi du mail |
|
| 498 | + $result=$mail->sendfile(); |
|
| 499 | + |
|
| 500 | + if (!$result) |
|
| 501 | + { |
|
| 502 | + setEventMessages($mail->error, $mail->errors, 'warnings'); |
|
| 503 | + $action=''; |
|
| 504 | + } |
|
| 505 | + else |
|
| 506 | + { |
|
| 507 | + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
| 508 | + exit; |
|
| 509 | + } |
|
| 510 | + } |
|
| 511 | + else |
|
| 512 | + { |
|
| 513 | + setEventMessages($object->error, $object->errors, 'errors'); |
|
| 514 | + $action=''; |
|
| 515 | + } |
|
| 516 | + } |
|
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | if ($action == 'confirm_refuse' && GETPOST('confirm','alpha') == 'yes') |
| 520 | 520 | { |
| 521 | 521 | if (! empty($_POST['detail_refuse'])) |
| 522 | - { |
|
| 523 | - $object = new Holiday($db); |
|
| 524 | - $object->fetch($id); |
|
| 525 | - |
|
| 526 | - // Si statut en attente de validation et valideur = utilisateur |
|
| 527 | - if ($object->statut == 2 && $user->id == $object->fk_validator) |
|
| 528 | - { |
|
| 529 | - $object->date_refuse = dol_print_date('dayhour', dol_now()); |
|
| 530 | - $object->fk_user_refuse = $user->id; |
|
| 531 | - $object->statut = 5; |
|
| 532 | - $object->detail_refuse = GETPOST('detail_refuse','alphanohtml'); |
|
| 533 | - |
|
| 534 | - $verif = $object->update($user); |
|
| 535 | - |
|
| 536 | - // Si pas d'erreur SQL on redirige vers la fiche de la demande |
|
| 537 | - if ($verif > 0) |
|
| 538 | - { |
|
| 539 | - // To |
|
| 540 | - $destinataire = new User($db); |
|
| 541 | - $destinataire->fetch($object->fk_user); |
|
| 542 | - $emailTo = $destinataire->email; |
|
| 543 | - |
|
| 544 | - if (!$emailTo) |
|
| 545 | - { |
|
| 546 | - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
| 547 | - exit; |
|
| 548 | - } |
|
| 549 | - |
|
| 550 | - // From |
|
| 551 | - $expediteur = new User($db); |
|
| 552 | - $expediteur->fetch($object->fk_validator); |
|
| 553 | - $emailFrom = $expediteur->email; |
|
| 554 | - |
|
| 555 | - // Subject |
|
| 522 | + { |
|
| 523 | + $object = new Holiday($db); |
|
| 524 | + $object->fetch($id); |
|
| 525 | + |
|
| 526 | + // Si statut en attente de validation et valideur = utilisateur |
|
| 527 | + if ($object->statut == 2 && $user->id == $object->fk_validator) |
|
| 528 | + { |
|
| 529 | + $object->date_refuse = dol_print_date('dayhour', dol_now()); |
|
| 530 | + $object->fk_user_refuse = $user->id; |
|
| 531 | + $object->statut = 5; |
|
| 532 | + $object->detail_refuse = GETPOST('detail_refuse','alphanohtml'); |
|
| 533 | + |
|
| 534 | + $verif = $object->update($user); |
|
| 535 | + |
|
| 536 | + // Si pas d'erreur SQL on redirige vers la fiche de la demande |
|
| 537 | + if ($verif > 0) |
|
| 538 | + { |
|
| 539 | + // To |
|
| 540 | + $destinataire = new User($db); |
|
| 541 | + $destinataire->fetch($object->fk_user); |
|
| 542 | + $emailTo = $destinataire->email; |
|
| 543 | + |
|
| 544 | + if (!$emailTo) |
|
| 545 | + { |
|
| 546 | + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
| 547 | + exit; |
|
| 548 | + } |
|
| 549 | + |
|
| 550 | + // From |
|
| 551 | + $expediteur = new User($db); |
|
| 552 | + $expediteur->fetch($object->fk_validator); |
|
| 553 | + $emailFrom = $expediteur->email; |
|
| 554 | + |
|
| 555 | + // Subject |
|
| 556 | 556 | $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; |
| 557 | - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 558 | - |
|
| 559 | - $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysRefused"); |
|
| 560 | - |
|
| 561 | - // Content |
|
| 562 | - $message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n"; |
|
| 563 | - $message.= "\n"; |
|
| 564 | - $message.= $langs->transnoentities("HolidaysRefusedBody", dol_print_date($object->date_debut,'day'), dol_print_date($object->date_fin,'day'))."\n"; |
|
| 565 | - $message.= GETPOST('detail_refuse','alpha')."\n\n"; |
|
| 566 | - |
|
| 567 | - $message.= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; |
|
| 568 | - |
|
| 569 | - $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n"; |
|
| 570 | - $message.= "\n"; |
|
| 571 | - |
|
| 572 | - $trackid='leav'.$object->id; |
|
| 573 | - |
|
| 574 | - $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid); |
|
| 575 | - |
|
| 576 | - // Envoi du mail |
|
| 577 | - $result=$mail->sendfile(); |
|
| 578 | - |
|
| 579 | - if (!$result) |
|
| 580 | - { |
|
| 581 | - setEventMessages($mail->error, $mail->errors, 'warnings'); |
|
| 582 | - $action=''; |
|
| 583 | - } |
|
| 584 | - else |
|
| 585 | - { |
|
| 586 | - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
| 587 | - exit; |
|
| 588 | - } |
|
| 589 | - } |
|
| 590 | - else |
|
| 591 | - { |
|
| 592 | - setEventMessages($object->error, $object->errors, 'errors'); |
|
| 593 | - $action=''; |
|
| 594 | - } |
|
| 595 | - } |
|
| 596 | - } else { |
|
| 597 | - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DetailRefusCP")), null, 'errors'); |
|
| 598 | - $action='refuse'; |
|
| 599 | - } |
|
| 557 | + if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 558 | + |
|
| 559 | + $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysRefused"); |
|
| 560 | + |
|
| 561 | + // Content |
|
| 562 | + $message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n"; |
|
| 563 | + $message.= "\n"; |
|
| 564 | + $message.= $langs->transnoentities("HolidaysRefusedBody", dol_print_date($object->date_debut,'day'), dol_print_date($object->date_fin,'day'))."\n"; |
|
| 565 | + $message.= GETPOST('detail_refuse','alpha')."\n\n"; |
|
| 566 | + |
|
| 567 | + $message.= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; |
|
| 568 | + |
|
| 569 | + $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n"; |
|
| 570 | + $message.= "\n"; |
|
| 571 | + |
|
| 572 | + $trackid='leav'.$object->id; |
|
| 573 | + |
|
| 574 | + $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid); |
|
| 575 | + |
|
| 576 | + // Envoi du mail |
|
| 577 | + $result=$mail->sendfile(); |
|
| 578 | + |
|
| 579 | + if (!$result) |
|
| 580 | + { |
|
| 581 | + setEventMessages($mail->error, $mail->errors, 'warnings'); |
|
| 582 | + $action=''; |
|
| 583 | + } |
|
| 584 | + else |
|
| 585 | + { |
|
| 586 | + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
| 587 | + exit; |
|
| 588 | + } |
|
| 589 | + } |
|
| 590 | + else |
|
| 591 | + { |
|
| 592 | + setEventMessages($object->error, $object->errors, 'errors'); |
|
| 593 | + $action=''; |
|
| 594 | + } |
|
| 595 | + } |
|
| 596 | + } else { |
|
| 597 | + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DetailRefusCP")), null, 'errors'); |
|
| 598 | + $action='refuse'; |
|
| 599 | + } |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | |
@@ -605,30 +605,30 @@ discard block |
||
| 605 | 605 | { |
| 606 | 606 | $error = 0; |
| 607 | 607 | |
| 608 | - $object = new Holiday($db); |
|
| 609 | - $object->fetch($id); |
|
| 610 | - |
|
| 611 | - $oldstatus = $object->statut; |
|
| 612 | - $object->statut = 1; |
|
| 613 | - |
|
| 614 | - $result = $object->update($user); |
|
| 615 | - if ($result < 0) |
|
| 616 | - { |
|
| 617 | - $error++; |
|
| 618 | - setEventMessages($langs->trans('ErrorBackToDraft').' '.$object->error, $object->errors, 'errors'); |
|
| 619 | - } |
|
| 620 | - |
|
| 621 | - if (! $error) |
|
| 622 | - { |
|
| 623 | - $db->commit(); |
|
| 624 | - |
|
| 625 | - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
| 626 | - exit; |
|
| 627 | - } |
|
| 628 | - else |
|
| 629 | - { |
|
| 630 | - $db->rollback(); |
|
| 631 | - } |
|
| 608 | + $object = new Holiday($db); |
|
| 609 | + $object->fetch($id); |
|
| 610 | + |
|
| 611 | + $oldstatus = $object->statut; |
|
| 612 | + $object->statut = 1; |
|
| 613 | + |
|
| 614 | + $result = $object->update($user); |
|
| 615 | + if ($result < 0) |
|
| 616 | + { |
|
| 617 | + $error++; |
|
| 618 | + setEventMessages($langs->trans('ErrorBackToDraft').' '.$object->error, $object->errors, 'errors'); |
|
| 619 | + } |
|
| 620 | + |
|
| 621 | + if (! $error) |
|
| 622 | + { |
|
| 623 | + $db->commit(); |
|
| 624 | + |
|
| 625 | + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
| 626 | + exit; |
|
| 627 | + } |
|
| 628 | + else |
|
| 629 | + { |
|
| 630 | + $db->rollback(); |
|
| 631 | + } |
|
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | // Si Validation de la demande |
@@ -636,105 +636,105 @@ discard block |
||
| 636 | 636 | { |
| 637 | 637 | $error = 0; |
| 638 | 638 | |
| 639 | - $object = new Holiday($db); |
|
| 640 | - $object->fetch($id); |
|
| 641 | - |
|
| 642 | - // Si statut en attente de validation et valideur = valideur ou utilisateur, ou droits de faire pour les autres |
|
| 643 | - if (($object->statut == 2 || $object->statut == 3) && ($user->id == $object->fk_validator || in_array($object->fk_user, $childids) || ! empty($user->rights->holiday->write_all))) |
|
| 644 | - { |
|
| 645 | - $db->begin(); |
|
| 646 | - |
|
| 647 | - $oldstatus = $object->statut; |
|
| 648 | - $object->date_cancel = dol_now(); |
|
| 649 | - $object->fk_user_cancel = $user->id; |
|
| 650 | - $object->statut = 4; |
|
| 651 | - |
|
| 652 | - $result = $object->update($user); |
|
| 653 | - |
|
| 654 | - if ($result >= 0 && $oldstatus == 3) // holiday was already validated, status 3, so we must increase back sold |
|
| 655 | - { |
|
| 656 | - // Calculcate number of days consummed |
|
| 657 | - $nbopenedday=num_open_day($object->date_debut_gmt,$object->date_fin_gmt,0,1,$object->halfday); |
|
| 658 | - |
|
| 659 | - $soldeActuel = $object->getCpforUser($object->fk_user, $object->fk_type); |
|
| 660 | - $newSolde = $soldeActuel + ($nbopenedday * $object->getConfCP('nbHolidayDeducted')); |
|
| 661 | - |
|
| 662 | - // On ajoute la modification dans le LOG |
|
| 663 | - $result1=$object->addLogCP($user->id, $object->fk_user, $langs->transnoentitiesnoconv("HolidaysCancelation"), $newSolde, $object->fk_type); |
|
| 664 | - |
|
| 665 | - // Mise à jour du solde |
|
| 666 | - $result2=$object->updateSoldeCP($object->fk_user, $newSolde, $object->fk_type); |
|
| 667 | - |
|
| 668 | - if ($result1 < 0 || $result2 < 0) |
|
| 669 | - { |
|
| 670 | - $error++; |
|
| 671 | - setEventMessages($langs->trans('ErrorCantDeleteCP').' '.$object->error, $object->errors, 'errors'); |
|
| 672 | - } |
|
| 673 | - } |
|
| 674 | - |
|
| 675 | - if (! $error) |
|
| 676 | - { |
|
| 677 | - $db->commit(); |
|
| 678 | - } |
|
| 679 | - else |
|
| 680 | - { |
|
| 681 | - $db->rollback(); |
|
| 682 | - } |
|
| 683 | - |
|
| 684 | - // Si pas d'erreur SQL on redirige vers la fiche de la demande |
|
| 685 | - if (! $error && $result > 0) |
|
| 686 | - { |
|
| 687 | - // To |
|
| 688 | - $destinataire = new User($db); |
|
| 689 | - $destinataire->fetch($object->fk_user); |
|
| 690 | - $emailTo = $destinataire->email; |
|
| 691 | - |
|
| 692 | - if (!$emailTo) |
|
| 693 | - { |
|
| 694 | - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
| 695 | - exit; |
|
| 696 | - } |
|
| 697 | - |
|
| 698 | - // From |
|
| 699 | - $expediteur = new User($db); |
|
| 700 | - $expediteur->fetch($object->fk_user_cancel); |
|
| 701 | - $emailFrom = $expediteur->email; |
|
| 702 | - |
|
| 703 | - // Subject |
|
| 639 | + $object = new Holiday($db); |
|
| 640 | + $object->fetch($id); |
|
| 641 | + |
|
| 642 | + // Si statut en attente de validation et valideur = valideur ou utilisateur, ou droits de faire pour les autres |
|
| 643 | + if (($object->statut == 2 || $object->statut == 3) && ($user->id == $object->fk_validator || in_array($object->fk_user, $childids) || ! empty($user->rights->holiday->write_all))) |
|
| 644 | + { |
|
| 645 | + $db->begin(); |
|
| 646 | + |
|
| 647 | + $oldstatus = $object->statut; |
|
| 648 | + $object->date_cancel = dol_now(); |
|
| 649 | + $object->fk_user_cancel = $user->id; |
|
| 650 | + $object->statut = 4; |
|
| 651 | + |
|
| 652 | + $result = $object->update($user); |
|
| 653 | + |
|
| 654 | + if ($result >= 0 && $oldstatus == 3) // holiday was already validated, status 3, so we must increase back sold |
|
| 655 | + { |
|
| 656 | + // Calculcate number of days consummed |
|
| 657 | + $nbopenedday=num_open_day($object->date_debut_gmt,$object->date_fin_gmt,0,1,$object->halfday); |
|
| 658 | + |
|
| 659 | + $soldeActuel = $object->getCpforUser($object->fk_user, $object->fk_type); |
|
| 660 | + $newSolde = $soldeActuel + ($nbopenedday * $object->getConfCP('nbHolidayDeducted')); |
|
| 661 | + |
|
| 662 | + // On ajoute la modification dans le LOG |
|
| 663 | + $result1=$object->addLogCP($user->id, $object->fk_user, $langs->transnoentitiesnoconv("HolidaysCancelation"), $newSolde, $object->fk_type); |
|
| 664 | + |
|
| 665 | + // Mise à jour du solde |
|
| 666 | + $result2=$object->updateSoldeCP($object->fk_user, $newSolde, $object->fk_type); |
|
| 667 | + |
|
| 668 | + if ($result1 < 0 || $result2 < 0) |
|
| 669 | + { |
|
| 670 | + $error++; |
|
| 671 | + setEventMessages($langs->trans('ErrorCantDeleteCP').' '.$object->error, $object->errors, 'errors'); |
|
| 672 | + } |
|
| 673 | + } |
|
| 674 | + |
|
| 675 | + if (! $error) |
|
| 676 | + { |
|
| 677 | + $db->commit(); |
|
| 678 | + } |
|
| 679 | + else |
|
| 680 | + { |
|
| 681 | + $db->rollback(); |
|
| 682 | + } |
|
| 683 | + |
|
| 684 | + // Si pas d'erreur SQL on redirige vers la fiche de la demande |
|
| 685 | + if (! $error && $result > 0) |
|
| 686 | + { |
|
| 687 | + // To |
|
| 688 | + $destinataire = new User($db); |
|
| 689 | + $destinataire->fetch($object->fk_user); |
|
| 690 | + $emailTo = $destinataire->email; |
|
| 691 | + |
|
| 692 | + if (!$emailTo) |
|
| 693 | + { |
|
| 694 | + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
| 695 | + exit; |
|
| 696 | + } |
|
| 697 | + |
|
| 698 | + // From |
|
| 699 | + $expediteur = new User($db); |
|
| 700 | + $expediteur->fetch($object->fk_user_cancel); |
|
| 701 | + $emailFrom = $expediteur->email; |
|
| 702 | + |
|
| 703 | + // Subject |
|
| 704 | 704 | $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; |
| 705 | - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 705 | + if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 706 | 706 | |
| 707 | - $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysCanceled"); |
|
| 707 | + $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysCanceled"); |
|
| 708 | 708 | |
| 709 | - // Content |
|
| 710 | - $message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n"; |
|
| 711 | - $message.= "\n"; |
|
| 709 | + // Content |
|
| 710 | + $message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n"; |
|
| 711 | + $message.= "\n"; |
|
| 712 | 712 | |
| 713 | - $message.= $langs->transnoentities("HolidaysCanceledBody", dol_print_date($object->date_debut,'day'), dol_print_date($object->date_fin,'day'))."\n"; |
|
| 714 | - $message.= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; |
|
| 713 | + $message.= $langs->transnoentities("HolidaysCanceledBody", dol_print_date($object->date_debut,'day'), dol_print_date($object->date_fin,'day'))."\n"; |
|
| 714 | + $message.= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; |
|
| 715 | 715 | |
| 716 | - $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n"; |
|
| 717 | - $message.= "\n"; |
|
| 716 | + $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n"; |
|
| 717 | + $message.= "\n"; |
|
| 718 | 718 | |
| 719 | - $trackid='leav'.$object->id; |
|
| 719 | + $trackid='leav'.$object->id; |
|
| 720 | 720 | |
| 721 | - $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid); |
|
| 721 | + $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid); |
|
| 722 | 722 | |
| 723 | - // Envoi du mail |
|
| 724 | - $result=$mail->sendfile(); |
|
| 723 | + // Envoi du mail |
|
| 724 | + $result=$mail->sendfile(); |
|
| 725 | 725 | |
| 726 | - if (!$result) |
|
| 727 | - { |
|
| 728 | - setEventMessages($mail->error, $mail->errors, 'warnings'); |
|
| 729 | - $action=''; |
|
| 730 | - } |
|
| 731 | - else |
|
| 732 | - { |
|
| 733 | - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
| 734 | - exit; |
|
| 735 | - } |
|
| 736 | - } |
|
| 737 | - } |
|
| 726 | + if (!$result) |
|
| 727 | + { |
|
| 728 | + setEventMessages($mail->error, $mail->errors, 'warnings'); |
|
| 729 | + $action=''; |
|
| 730 | + } |
|
| 731 | + else |
|
| 732 | + { |
|
| 733 | + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
|
| 734 | + exit; |
|
| 735 | + } |
|
| 736 | + } |
|
| 737 | + } |
|
| 738 | 738 | |
| 739 | 739 | } |
| 740 | 740 | |
@@ -753,54 +753,54 @@ discard block |
||
| 753 | 753 | |
| 754 | 754 | if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create') |
| 755 | 755 | { |
| 756 | - // Si l'utilisateur n'a pas le droit de faire une demande |
|
| 757 | - if (($fuserid == $user->id && empty($user->rights->holiday->write)) || ($fuserid != $user->id && empty($user->rights->holiday->write_all))) |
|
| 758 | - { |
|
| 759 | - $errors[]=$langs->trans('CantCreateCP'); |
|
| 760 | - } |
|
| 761 | - else |
|
| 762 | - { |
|
| 763 | - // Formulaire de demande de congés payés |
|
| 764 | - print load_fiche_titre($langs->trans('MenuAddCP'), '', 'title_hrm.png'); |
|
| 765 | - |
|
| 766 | - // Si il y a une erreur |
|
| 767 | - if (GETPOST('error')) { |
|
| 768 | - |
|
| 769 | - switch(GETPOST('error')) { |
|
| 770 | - case 'datefin' : |
|
| 771 | - $errors[] = $langs->trans('ErrorEndDateCP'); |
|
| 772 | - break; |
|
| 773 | - case 'SQL_Create' : |
|
| 774 | - $errors[] = $langs->trans('ErrorSQLCreateCP').' <b>'.htmlentities($_GET['msg']).'</b>'; |
|
| 775 | - break; |
|
| 776 | - case 'CantCreate' : |
|
| 777 | - $errors[] = $langs->trans('CantCreateCP'); |
|
| 778 | - break; |
|
| 779 | - case 'Valideur' : |
|
| 780 | - $errors[] = $langs->trans('InvalidValidatorCP'); |
|
| 781 | - break; |
|
| 782 | - case 'nodatedebut' : |
|
| 783 | - $errors[] = $langs->trans('NoDateDebut'); |
|
| 784 | - break; |
|
| 785 | - case 'nodatefin' : |
|
| 786 | - $errors[] = $langs->trans('NoDateFin'); |
|
| 787 | - break; |
|
| 788 | - case 'DureeHoliday' : |
|
| 789 | - $errors[] = $langs->trans('ErrorDureeCP'); |
|
| 790 | - break; |
|
| 791 | - case 'alreadyCP' : |
|
| 792 | - $errors[] = $langs->trans('alreadyCPexist'); |
|
| 793 | - break; |
|
| 794 | - } |
|
| 795 | - |
|
| 796 | - setEventMessages($errors, null, 'errors'); |
|
| 797 | - } |
|
| 798 | - |
|
| 799 | - |
|
| 800 | - $delayForRequest = $object->getConfCP('delayForRequest'); |
|
| 801 | - //$delayForRequest = $delayForRequest * (60*60*24); |
|
| 802 | - |
|
| 803 | - $nextMonth = dol_time_plus_duree($now, $delayForRequest, 'd'); |
|
| 756 | + // Si l'utilisateur n'a pas le droit de faire une demande |
|
| 757 | + if (($fuserid == $user->id && empty($user->rights->holiday->write)) || ($fuserid != $user->id && empty($user->rights->holiday->write_all))) |
|
| 758 | + { |
|
| 759 | + $errors[]=$langs->trans('CantCreateCP'); |
|
| 760 | + } |
|
| 761 | + else |
|
| 762 | + { |
|
| 763 | + // Formulaire de demande de congés payés |
|
| 764 | + print load_fiche_titre($langs->trans('MenuAddCP'), '', 'title_hrm.png'); |
|
| 765 | + |
|
| 766 | + // Si il y a une erreur |
|
| 767 | + if (GETPOST('error')) { |
|
| 768 | + |
|
| 769 | + switch(GETPOST('error')) { |
|
| 770 | + case 'datefin' : |
|
| 771 | + $errors[] = $langs->trans('ErrorEndDateCP'); |
|
| 772 | + break; |
|
| 773 | + case 'SQL_Create' : |
|
| 774 | + $errors[] = $langs->trans('ErrorSQLCreateCP').' <b>'.htmlentities($_GET['msg']).'</b>'; |
|
| 775 | + break; |
|
| 776 | + case 'CantCreate' : |
|
| 777 | + $errors[] = $langs->trans('CantCreateCP'); |
|
| 778 | + break; |
|
| 779 | + case 'Valideur' : |
|
| 780 | + $errors[] = $langs->trans('InvalidValidatorCP'); |
|
| 781 | + break; |
|
| 782 | + case 'nodatedebut' : |
|
| 783 | + $errors[] = $langs->trans('NoDateDebut'); |
|
| 784 | + break; |
|
| 785 | + case 'nodatefin' : |
|
| 786 | + $errors[] = $langs->trans('NoDateFin'); |
|
| 787 | + break; |
|
| 788 | + case 'DureeHoliday' : |
|
| 789 | + $errors[] = $langs->trans('ErrorDureeCP'); |
|
| 790 | + break; |
|
| 791 | + case 'alreadyCP' : |
|
| 792 | + $errors[] = $langs->trans('alreadyCPexist'); |
|
| 793 | + break; |
|
| 794 | + } |
|
| 795 | + |
|
| 796 | + setEventMessages($errors, null, 'errors'); |
|
| 797 | + } |
|
| 798 | + |
|
| 799 | + |
|
| 800 | + $delayForRequest = $object->getConfCP('delayForRequest'); |
|
| 801 | + //$delayForRequest = $delayForRequest * (60*60*24); |
|
| 802 | + |
|
| 803 | + $nextMonth = dol_time_plus_duree($now, $delayForRequest, 'd'); |
|
| 804 | 804 | |
| 805 | 805 | print '<script type="text/javascript"> |
| 806 | 806 | function valider() |
@@ -831,510 +831,510 @@ discard block |
||
| 831 | 831 | } |
| 832 | 832 | </script>'."\n"; |
| 833 | 833 | |
| 834 | - // Formulaire de demande |
|
| 835 | - print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" onsubmit="return valider()" name="demandeCP">'."\n"; |
|
| 836 | - print '<input type="hidden" name="action" value="create" />'."\n"; |
|
| 834 | + // Formulaire de demande |
|
| 835 | + print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" onsubmit="return valider()" name="demandeCP">'."\n"; |
|
| 836 | + print '<input type="hidden" name="action" value="create" />'."\n"; |
|
| 837 | 837 | |
| 838 | - if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) |
|
| 839 | - { |
|
| 840 | - dol_fiche_head('', '', '', -1); |
|
| 838 | + if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) |
|
| 839 | + { |
|
| 840 | + dol_fiche_head('', '', '', -1); |
|
| 841 | 841 | |
| 842 | - $out=''; |
|
| 843 | - $typeleaves=$object->getTypes(1,1); |
|
| 844 | - foreach($typeleaves as $key => $val) |
|
| 842 | + $out=''; |
|
| 843 | + $typeleaves=$object->getTypes(1,1); |
|
| 844 | + foreach($typeleaves as $key => $val) |
|
| 845 | 845 | { |
| 846 | 846 | $nb_type = $object->getCPforUser($user->id, $val['rowid']); |
| 847 | 847 | $nb_holiday += $nb_type; |
| 848 | 848 | $out .= ' - '.$val['label'].': <strong>'.($nb_type?price2num($nb_type):0).'</strong><br>'; |
| 849 | 849 | } |
| 850 | - print $langs->trans('SoldeCPUser', round($nb_holiday,5)).'<br>'; |
|
| 850 | + print $langs->trans('SoldeCPUser', round($nb_holiday,5)).'<br>'; |
|
| 851 | 851 | print $out; |
| 852 | 852 | |
| 853 | - dol_fiche_end(); |
|
| 854 | - } |
|
| 855 | - elseif(! is_numeric($conf->global->HOLIDAY_HIDE_BALANCE)) |
|
| 856 | - { |
|
| 857 | - print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE).'<br>'; |
|
| 858 | - } |
|
| 859 | - |
|
| 860 | - dol_fiche_head(); |
|
| 861 | - |
|
| 862 | - //print '<span>'.$langs->trans('DelayToRequestCP',$object->getConfCP('delayForRequest')).'</span><br><br>'; |
|
| 863 | - |
|
| 864 | - print '<table class="border" width="100%">'; |
|
| 865 | - print '<tbody>'; |
|
| 866 | - |
|
| 867 | - // User |
|
| 868 | - print '<tr>'; |
|
| 869 | - print '<td class="titlefield fieldrequired">'.$langs->trans("User").'</td>'; |
|
| 870 | - print '<td>'; |
|
| 871 | - if (empty($user->rights->holiday->write_all)) |
|
| 872 | - { |
|
| 873 | - print $form->select_dolusers(($fuserid?$fuserid:$user->id), 'fuserid', 0, '', 0, 'hierarchyme', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth300'); |
|
| 874 | - //print '<input type="hidden" name="fuserid" value="'.($fuserid?$fuserid:$user->id).'">'; |
|
| 875 | - } |
|
| 876 | - else print $form->select_dolusers(GETPOST('fuserid','int')?GETPOST('fuserid','int'):$user->id, 'fuserid', 0, '', 0, '', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth300'); |
|
| 877 | - print '</td>'; |
|
| 878 | - print '</tr>'; |
|
| 879 | - |
|
| 880 | - // Type |
|
| 881 | - print '<tr>'; |
|
| 882 | - print '<td class="fieldrequired">'.$langs->trans("Type").'</td>'; |
|
| 883 | - print '<td>'; |
|
| 884 | - $typeleaves=$object->getTypes(1,-1); |
|
| 885 | - $arraytypeleaves=array(); |
|
| 886 | - foreach($typeleaves as $key => $val) |
|
| 887 | - { |
|
| 888 | - $labeltoshow = ($langs->trans($val['code'])!=$val['code'] ? $langs->trans($val['code']) : $val['label']); |
|
| 889 | - $labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':''); |
|
| 853 | + dol_fiche_end(); |
|
| 854 | + } |
|
| 855 | + elseif(! is_numeric($conf->global->HOLIDAY_HIDE_BALANCE)) |
|
| 856 | + { |
|
| 857 | + print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE).'<br>'; |
|
| 858 | + } |
|
| 859 | + |
|
| 860 | + dol_fiche_head(); |
|
| 861 | + |
|
| 862 | + //print '<span>'.$langs->trans('DelayToRequestCP',$object->getConfCP('delayForRequest')).'</span><br><br>'; |
|
| 863 | + |
|
| 864 | + print '<table class="border" width="100%">'; |
|
| 865 | + print '<tbody>'; |
|
| 866 | + |
|
| 867 | + // User |
|
| 868 | + print '<tr>'; |
|
| 869 | + print '<td class="titlefield fieldrequired">'.$langs->trans("User").'</td>'; |
|
| 870 | + print '<td>'; |
|
| 871 | + if (empty($user->rights->holiday->write_all)) |
|
| 872 | + { |
|
| 873 | + print $form->select_dolusers(($fuserid?$fuserid:$user->id), 'fuserid', 0, '', 0, 'hierarchyme', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth300'); |
|
| 874 | + //print '<input type="hidden" name="fuserid" value="'.($fuserid?$fuserid:$user->id).'">'; |
|
| 875 | + } |
|
| 876 | + else print $form->select_dolusers(GETPOST('fuserid','int')?GETPOST('fuserid','int'):$user->id, 'fuserid', 0, '', 0, '', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth300'); |
|
| 877 | + print '</td>'; |
|
| 878 | + print '</tr>'; |
|
| 879 | + |
|
| 880 | + // Type |
|
| 881 | + print '<tr>'; |
|
| 882 | + print '<td class="fieldrequired">'.$langs->trans("Type").'</td>'; |
|
| 883 | + print '<td>'; |
|
| 884 | + $typeleaves=$object->getTypes(1,-1); |
|
| 885 | + $arraytypeleaves=array(); |
|
| 886 | + foreach($typeleaves as $key => $val) |
|
| 887 | + { |
|
| 888 | + $labeltoshow = ($langs->trans($val['code'])!=$val['code'] ? $langs->trans($val['code']) : $val['label']); |
|
| 889 | + $labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':''); |
|
| 890 | 890 | $arraytypeleaves[$val['rowid']]=$labeltoshow; |
| 891 | - } |
|
| 892 | - print $form->selectarray('type', $arraytypeleaves, (GETPOST('type','alpha')?GETPOST('type','alpha'):''), 1); |
|
| 893 | - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
| 894 | - print '</td>'; |
|
| 895 | - print '</tr>'; |
|
| 896 | - |
|
| 897 | - // Date start |
|
| 898 | - print '<tr>'; |
|
| 899 | - print '<td class="fieldrequired">'; |
|
| 900 | - print $langs->trans("DateDebCP"); |
|
| 901 | - print ' ('.$langs->trans("FirstDayOfHoliday").')'; |
|
| 902 | - print '</td>'; |
|
| 903 | - print '<td>'; |
|
| 904 | - // Si la demande ne vient pas de l'agenda |
|
| 905 | - if (! GETPOST('date_debut_')) { |
|
| 906 | - $form->select_date(-1, 'date_debut_', 0, 0, 0, '', 1, 1); |
|
| 907 | - } else { |
|
| 908 | - $tmpdate = dol_mktime(0, 0, 0, GETPOST('date_debut_month','int'), GETPOST('date_debut_day','int'), GETPOST('date_debut_year','int')); |
|
| 909 | - $form->select_date($tmpdate, 'date_debut_', 0, 0, 0, '', 1, 1); |
|
| 910 | - } |
|
| 911 | - print ' '; |
|
| 912 | - print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday','alpha')?GETPOST('starthalfday','alpha'):'morning')); |
|
| 913 | - print '</td>'; |
|
| 914 | - print '</tr>'; |
|
| 915 | - |
|
| 916 | - // Date end |
|
| 917 | - print '<tr>'; |
|
| 918 | - print '<td class="fieldrequired">'; |
|
| 919 | - print $langs->trans("DateFinCP"); |
|
| 920 | - print ' ('.$langs->trans("LastDayOfHoliday").')'; |
|
| 921 | - print '</td>'; |
|
| 922 | - print '<td>'; |
|
| 923 | - // Si la demande ne vient pas de l'agenda |
|
| 924 | - if (! GETPOST('date_fin_')) { |
|
| 925 | - $form->select_date(-1,'date_fin_', 0, 0, 0, '', 1, 1); |
|
| 926 | - } else { |
|
| 927 | - $tmpdate = dol_mktime(0, 0, 0, GETPOST('date_fin_month','int'), GETPOST('date_fin_day','int'), GETPOST('date_fin_year','int')); |
|
| 928 | - $form->select_date($tmpdate,'date_fin_', 0, 0, 0, '', 1, 1); |
|
| 929 | - } |
|
| 930 | - print ' '; |
|
| 931 | - print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday','alpha')?GETPOST('endhalfday','alpha'):'afternoon')); |
|
| 932 | - print '</td>'; |
|
| 933 | - print '</tr>'; |
|
| 934 | - |
|
| 935 | - // Approved by |
|
| 936 | - print '<tr>'; |
|
| 937 | - print '<td class="fieldrequired">'.$langs->trans("ReviewedByCP").'</td>'; |
|
| 938 | - print '<td>'; |
|
| 939 | - print $form->select_dolusers((GETPOST('valideur','int')>0?GETPOST('valideur','int'):$user->fk_user), "valideur", 1, ($user->admin ? '' : array($user->id)), 0, '', 0, 0, 0, 0, '', 0, '', '', 1); // By default, hierarchical parent |
|
| 940 | - print '</td>'; |
|
| 941 | - print '</tr>'; |
|
| 942 | - |
|
| 943 | - // Description |
|
| 944 | - print '<tr>'; |
|
| 945 | - print '<td>'.$langs->trans("DescCP").'</td>'; |
|
| 946 | - print '<td class="tdtop">'; |
|
| 947 | - $doleditor = new DolEditor('description', GETPOST('description','none'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); |
|
| 948 | - print $doleditor->Create(1); |
|
| 949 | - print '</td></tr>'; |
|
| 950 | - |
|
| 951 | - print '</tbody>'; |
|
| 952 | - print '</table>'; |
|
| 953 | - |
|
| 954 | - dol_fiche_end(); |
|
| 955 | - |
|
| 956 | - print '<div class="center">'; |
|
| 957 | - print '<input type="submit" value="'.$langs->trans("SendRequestCP").'" name="bouton" class="button">'; |
|
| 958 | - print ' '; |
|
| 959 | - print '<input type="button" value="'.$langs->trans("Cancel").'" class="button" onclick="history.go(-1)">'; |
|
| 960 | - print '</div>'; |
|
| 961 | - |
|
| 962 | - print '</from>'."\n"; |
|
| 963 | - } |
|
| 891 | + } |
|
| 892 | + print $form->selectarray('type', $arraytypeleaves, (GETPOST('type','alpha')?GETPOST('type','alpha'):''), 1); |
|
| 893 | + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
| 894 | + print '</td>'; |
|
| 895 | + print '</tr>'; |
|
| 896 | + |
|
| 897 | + // Date start |
|
| 898 | + print '<tr>'; |
|
| 899 | + print '<td class="fieldrequired">'; |
|
| 900 | + print $langs->trans("DateDebCP"); |
|
| 901 | + print ' ('.$langs->trans("FirstDayOfHoliday").')'; |
|
| 902 | + print '</td>'; |
|
| 903 | + print '<td>'; |
|
| 904 | + // Si la demande ne vient pas de l'agenda |
|
| 905 | + if (! GETPOST('date_debut_')) { |
|
| 906 | + $form->select_date(-1, 'date_debut_', 0, 0, 0, '', 1, 1); |
|
| 907 | + } else { |
|
| 908 | + $tmpdate = dol_mktime(0, 0, 0, GETPOST('date_debut_month','int'), GETPOST('date_debut_day','int'), GETPOST('date_debut_year','int')); |
|
| 909 | + $form->select_date($tmpdate, 'date_debut_', 0, 0, 0, '', 1, 1); |
|
| 910 | + } |
|
| 911 | + print ' '; |
|
| 912 | + print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday','alpha')?GETPOST('starthalfday','alpha'):'morning')); |
|
| 913 | + print '</td>'; |
|
| 914 | + print '</tr>'; |
|
| 915 | + |
|
| 916 | + // Date end |
|
| 917 | + print '<tr>'; |
|
| 918 | + print '<td class="fieldrequired">'; |
|
| 919 | + print $langs->trans("DateFinCP"); |
|
| 920 | + print ' ('.$langs->trans("LastDayOfHoliday").')'; |
|
| 921 | + print '</td>'; |
|
| 922 | + print '<td>'; |
|
| 923 | + // Si la demande ne vient pas de l'agenda |
|
| 924 | + if (! GETPOST('date_fin_')) { |
|
| 925 | + $form->select_date(-1,'date_fin_', 0, 0, 0, '', 1, 1); |
|
| 926 | + } else { |
|
| 927 | + $tmpdate = dol_mktime(0, 0, 0, GETPOST('date_fin_month','int'), GETPOST('date_fin_day','int'), GETPOST('date_fin_year','int')); |
|
| 928 | + $form->select_date($tmpdate,'date_fin_', 0, 0, 0, '', 1, 1); |
|
| 929 | + } |
|
| 930 | + print ' '; |
|
| 931 | + print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday','alpha')?GETPOST('endhalfday','alpha'):'afternoon')); |
|
| 932 | + print '</td>'; |
|
| 933 | + print '</tr>'; |
|
| 934 | + |
|
| 935 | + // Approved by |
|
| 936 | + print '<tr>'; |
|
| 937 | + print '<td class="fieldrequired">'.$langs->trans("ReviewedByCP").'</td>'; |
|
| 938 | + print '<td>'; |
|
| 939 | + print $form->select_dolusers((GETPOST('valideur','int')>0?GETPOST('valideur','int'):$user->fk_user), "valideur", 1, ($user->admin ? '' : array($user->id)), 0, '', 0, 0, 0, 0, '', 0, '', '', 1); // By default, hierarchical parent |
|
| 940 | + print '</td>'; |
|
| 941 | + print '</tr>'; |
|
| 942 | + |
|
| 943 | + // Description |
|
| 944 | + print '<tr>'; |
|
| 945 | + print '<td>'.$langs->trans("DescCP").'</td>'; |
|
| 946 | + print '<td class="tdtop">'; |
|
| 947 | + $doleditor = new DolEditor('description', GETPOST('description','none'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); |
|
| 948 | + print $doleditor->Create(1); |
|
| 949 | + print '</td></tr>'; |
|
| 950 | + |
|
| 951 | + print '</tbody>'; |
|
| 952 | + print '</table>'; |
|
| 953 | + |
|
| 954 | + dol_fiche_end(); |
|
| 955 | + |
|
| 956 | + print '<div class="center">'; |
|
| 957 | + print '<input type="submit" value="'.$langs->trans("SendRequestCP").'" name="bouton" class="button">'; |
|
| 958 | + print ' '; |
|
| 959 | + print '<input type="button" value="'.$langs->trans("Cancel").'" class="button" onclick="history.go(-1)">'; |
|
| 960 | + print '</div>'; |
|
| 961 | + |
|
| 962 | + print '</from>'."\n"; |
|
| 963 | + } |
|
| 964 | 964 | } |
| 965 | 965 | else |
| 966 | 966 | { |
| 967 | - if ($error) |
|
| 968 | - { |
|
| 969 | - print '<div class="tabBar">'; |
|
| 970 | - print $error; |
|
| 971 | - print '<br><br><input type="button" value="'.$langs->trans("ReturnCP").'" class="button" onclick="history.go(-1)" />'; |
|
| 972 | - print '</div>'; |
|
| 973 | - } |
|
| 974 | - else |
|
| 975 | - { |
|
| 976 | - // Affichage de la fiche d'une demande de congés payés |
|
| 977 | - if ($id > 0) |
|
| 978 | - { |
|
| 979 | - $object->fetch($id); |
|
| 980 | - |
|
| 981 | - $valideur = new User($db); |
|
| 982 | - $valideur->fetch($object->fk_validator); |
|
| 983 | - |
|
| 984 | - $userRequest = new User($db); |
|
| 985 | - $userRequest->fetch($object->fk_user); |
|
| 986 | - |
|
| 987 | - //print load_fiche_titre($langs->trans('TitreRequestCP')); |
|
| 988 | - |
|
| 989 | - // Si il y a une erreur |
|
| 990 | - if (GETPOST('error')) |
|
| 991 | - { |
|
| 992 | - switch(GETPOST('error')) |
|
| 993 | - { |
|
| 994 | - case 'datefin' : |
|
| 995 | - $errors[] = $langs->transnoentitiesnoconv('ErrorEndDateCP'); |
|
| 996 | - break; |
|
| 997 | - case 'SQL_Create' : |
|
| 998 | - $errors[] = $langs->transnoentitiesnoconv('ErrorSQLCreateCP').' '.$_GET['msg']; |
|
| 999 | - break; |
|
| 1000 | - case 'CantCreate' : |
|
| 1001 | - $errors[] = $langs->transnoentitiesnoconv('CantCreateCP'); |
|
| 1002 | - break; |
|
| 1003 | - case 'Valideur' : |
|
| 1004 | - $errors[] = $langs->transnoentitiesnoconv('InvalidValidatorCP'); |
|
| 1005 | - break; |
|
| 1006 | - case 'nodatedebut' : |
|
| 1007 | - $errors[] = $langs->transnoentitiesnoconv('NoDateDebut'); |
|
| 1008 | - break; |
|
| 1009 | - case 'nodatefin' : |
|
| 1010 | - $errors[] = $langs->transnoentitiesnoconv('NoDateFin'); |
|
| 1011 | - break; |
|
| 1012 | - case 'DureeHoliday' : |
|
| 1013 | - $errors[] = $langs->transnoentitiesnoconv('ErrorDureeCP'); |
|
| 1014 | - break; |
|
| 1015 | - case 'NoMotifRefuse' : |
|
| 1016 | - $errors[] = $langs->transnoentitiesnoconv('NoMotifRefuseCP'); |
|
| 1017 | - break; |
|
| 1018 | - case 'mail' : |
|
| 1019 | - $errors[] = $langs->transnoentitiesnoconv('ErrorMailNotSend')."\n".$_GET['error_content']; |
|
| 1020 | - break; |
|
| 1021 | - } |
|
| 1022 | - |
|
| 1023 | - setEventMessages($errors, null, 'errors'); |
|
| 1024 | - } |
|
| 1025 | - |
|
| 1026 | - // On vérifie si l'utilisateur à le droit de lire cette demande |
|
| 1027 | - if ($cancreate) |
|
| 1028 | - { |
|
| 1029 | - $head=holiday_prepare_head($object); |
|
| 1030 | - |
|
| 1031 | - if ($action == 'edit' && $object->statut == 1) |
|
| 1032 | - { |
|
| 1033 | - $edit = true; |
|
| 1034 | - print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'."\n"; |
|
| 1035 | - print '<input type="hidden" name="action" value="update"/>'."\n"; |
|
| 1036 | - print '<input type="hidden" name="id" value="'.$object->id.'" />'."\n"; |
|
| 1037 | - } |
|
| 1038 | - |
|
| 1039 | - dol_fiche_head($head, 'card', $langs->trans("CPTitreMenu"), -1, 'holiday'); |
|
| 1040 | - |
|
| 1041 | - $linkback='<a href="'.DOL_URL_ROOT.'/holiday/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
|
| 1042 | - |
|
| 1043 | - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref'); |
|
| 1044 | - |
|
| 1045 | - |
|
| 1046 | - print '<div class="fichecenter">'; |
|
| 1047 | - print '<div class="fichehalfleft">'; |
|
| 1048 | - print '<div class="underbanner clearboth"></div>'; |
|
| 1049 | - |
|
| 1050 | - print '<table class="border centpercent">'; |
|
| 1051 | - print '<tbody>'; |
|
| 1052 | - |
|
| 1053 | - // User |
|
| 1054 | - print '<tr>'; |
|
| 1055 | - print '<td class="titlefield">'.$langs->trans("User").'</td>'; |
|
| 1056 | - print '<td>'; |
|
| 1057 | - print $userRequest->getNomUrl(-1, 'leave'); |
|
| 1058 | - print '</td></tr>'; |
|
| 1059 | - |
|
| 1060 | - // Type |
|
| 1061 | - print '<tr>'; |
|
| 1062 | - print '<td>'.$langs->trans("Type").'</td>'; |
|
| 1063 | - print '<td>'; |
|
| 1064 | - $typeleaves=$object->getTypes(1,-1); |
|
| 1065 | - $labeltoshow = (($typeleaves[$object->fk_type]['code'] && $langs->trans($typeleaves[$object->fk_type]['code'])!=$typeleaves[$object->fk_type]['code']) ? $langs->trans($typeleaves[$object->fk_type]['code']) : $typeleaves[$object->fk_type]['label']); |
|
| 1066 | - print empty($labeltoshow) ? $langs->trans("TypeWasDisabledOrRemoved",$object->fk_type) : $labeltoshow; |
|
| 1067 | - print '</td>'; |
|
| 1068 | - print '</tr>'; |
|
| 1069 | - |
|
| 1070 | - $starthalfday=($object->halfday == -1 || $object->halfday == 2)?'afternoon':'morning'; |
|
| 1071 | - $endhalfday=($object->halfday == 1 || $object->halfday == 2)?'morning':'afternoon'; |
|
| 1072 | - |
|
| 1073 | - if(!$edit) |
|
| 1074 | - { |
|
| 1075 | - print '<tr>'; |
|
| 1076 | - print '<td class="nowrap">'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>'; |
|
| 1077 | - print '<td>'.dol_print_date($object->date_debut,'day'); |
|
| 1078 | - print ' '; |
|
| 1079 | - print '<span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).'</span>'; |
|
| 1080 | - print '</td>'; |
|
| 1081 | - print '</tr>'; |
|
| 1082 | - } |
|
| 1083 | - else |
|
| 1084 | - { |
|
| 1085 | - print '<tr>'; |
|
| 1086 | - print '<td class="nowrap">'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>'; |
|
| 1087 | - print '<td>'; |
|
| 1088 | - $form->select_date($object->date_debut,'date_debut_'); |
|
| 1089 | - print ' '; |
|
| 1090 | - print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday')?GETPOST('starthalfday'):$starthalfday)); |
|
| 1091 | - print '</td>'; |
|
| 1092 | - print '</tr>'; |
|
| 1093 | - } |
|
| 1094 | - |
|
| 1095 | - if (!$edit) |
|
| 1096 | - { |
|
| 1097 | - print '<tr>'; |
|
| 1098 | - print '<td class="nowrap">'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>'; |
|
| 1099 | - print '<td>'.dol_print_date($object->date_fin,'day'); |
|
| 1100 | - print ' '; |
|
| 1101 | - print '<span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).'</span>'; |
|
| 1102 | - print '</td>'; |
|
| 1103 | - print '</tr>'; |
|
| 1104 | - } |
|
| 1105 | - else |
|
| 1106 | - { |
|
| 1107 | - print '<tr>'; |
|
| 1108 | - print '<td class="nowrap">'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>'; |
|
| 1109 | - print '<td>'; |
|
| 1110 | - $form->select_date($object->date_fin,'date_fin_'); |
|
| 1111 | - print ' '; |
|
| 1112 | - print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday')?GETPOST('endhalfday'):$endhalfday)); |
|
| 1113 | - print '</td>'; |
|
| 1114 | - print '</tr>'; |
|
| 1115 | - } |
|
| 1116 | - // Nb of days |
|
| 1117 | - print '<tr>'; |
|
| 1118 | - print '<td>'.$langs->trans('NbUseDaysCP').'</td>'; |
|
| 1119 | - print '<td>'.num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday).'</td>'; |
|
| 1120 | - print '</tr>'; |
|
| 1121 | - |
|
| 1122 | - if ($object->statut == 5) |
|
| 1123 | - { |
|
| 1124 | - print '<tr>'; |
|
| 1125 | - print '<td>'.$langs->trans('DetailRefusCP').'</td>'; |
|
| 1126 | - print '<td>'.$object->detail_refuse.'</td>'; |
|
| 1127 | - print '</tr>'; |
|
| 1128 | - } |
|
| 1129 | - |
|
| 1130 | - // Description |
|
| 1131 | - if (!$edit) |
|
| 1132 | - { |
|
| 1133 | - print '<tr>'; |
|
| 1134 | - print '<td>'.$langs->trans('DescCP').'</td>'; |
|
| 1135 | - print '<td>'.nl2br($object->description).'</td>'; |
|
| 1136 | - print '</tr>'; |
|
| 1137 | - } |
|
| 1138 | - else |
|
| 1139 | - { |
|
| 1140 | - print '<tr>'; |
|
| 1141 | - print '<td>'.$langs->trans('DescCP').'</td>'; |
|
| 1142 | - print '<td class="tdtop">'; |
|
| 1143 | - $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); |
|
| 1144 | - print $doleditor->Create(1); |
|
| 1145 | - print '</td></tr>'; |
|
| 1146 | - } |
|
| 1147 | - |
|
| 1148 | - print '</tbody>'; |
|
| 1149 | - print '</table>'."\n"; |
|
| 1150 | - |
|
| 1151 | - print '</div>'; |
|
| 1152 | - print '<div class="fichehalfright">'; |
|
| 1153 | - print '<div class="ficheaddleft">'; |
|
| 1154 | - |
|
| 1155 | - print '<div class="underbanner clearboth"></div>'; |
|
| 967 | + if ($error) |
|
| 968 | + { |
|
| 969 | + print '<div class="tabBar">'; |
|
| 970 | + print $error; |
|
| 971 | + print '<br><br><input type="button" value="'.$langs->trans("ReturnCP").'" class="button" onclick="history.go(-1)" />'; |
|
| 972 | + print '</div>'; |
|
| 973 | + } |
|
| 974 | + else |
|
| 975 | + { |
|
| 976 | + // Affichage de la fiche d'une demande de congés payés |
|
| 977 | + if ($id > 0) |
|
| 978 | + { |
|
| 979 | + $object->fetch($id); |
|
| 980 | + |
|
| 981 | + $valideur = new User($db); |
|
| 982 | + $valideur->fetch($object->fk_validator); |
|
| 983 | + |
|
| 984 | + $userRequest = new User($db); |
|
| 985 | + $userRequest->fetch($object->fk_user); |
|
| 986 | + |
|
| 987 | + //print load_fiche_titre($langs->trans('TitreRequestCP')); |
|
| 988 | + |
|
| 989 | + // Si il y a une erreur |
|
| 990 | + if (GETPOST('error')) |
|
| 991 | + { |
|
| 992 | + switch(GETPOST('error')) |
|
| 993 | + { |
|
| 994 | + case 'datefin' : |
|
| 995 | + $errors[] = $langs->transnoentitiesnoconv('ErrorEndDateCP'); |
|
| 996 | + break; |
|
| 997 | + case 'SQL_Create' : |
|
| 998 | + $errors[] = $langs->transnoentitiesnoconv('ErrorSQLCreateCP').' '.$_GET['msg']; |
|
| 999 | + break; |
|
| 1000 | + case 'CantCreate' : |
|
| 1001 | + $errors[] = $langs->transnoentitiesnoconv('CantCreateCP'); |
|
| 1002 | + break; |
|
| 1003 | + case 'Valideur' : |
|
| 1004 | + $errors[] = $langs->transnoentitiesnoconv('InvalidValidatorCP'); |
|
| 1005 | + break; |
|
| 1006 | + case 'nodatedebut' : |
|
| 1007 | + $errors[] = $langs->transnoentitiesnoconv('NoDateDebut'); |
|
| 1008 | + break; |
|
| 1009 | + case 'nodatefin' : |
|
| 1010 | + $errors[] = $langs->transnoentitiesnoconv('NoDateFin'); |
|
| 1011 | + break; |
|
| 1012 | + case 'DureeHoliday' : |
|
| 1013 | + $errors[] = $langs->transnoentitiesnoconv('ErrorDureeCP'); |
|
| 1014 | + break; |
|
| 1015 | + case 'NoMotifRefuse' : |
|
| 1016 | + $errors[] = $langs->transnoentitiesnoconv('NoMotifRefuseCP'); |
|
| 1017 | + break; |
|
| 1018 | + case 'mail' : |
|
| 1019 | + $errors[] = $langs->transnoentitiesnoconv('ErrorMailNotSend')."\n".$_GET['error_content']; |
|
| 1020 | + break; |
|
| 1021 | + } |
|
| 1022 | + |
|
| 1023 | + setEventMessages($errors, null, 'errors'); |
|
| 1024 | + } |
|
| 1025 | + |
|
| 1026 | + // On vérifie si l'utilisateur à le droit de lire cette demande |
|
| 1027 | + if ($cancreate) |
|
| 1028 | + { |
|
| 1029 | + $head=holiday_prepare_head($object); |
|
| 1030 | + |
|
| 1031 | + if ($action == 'edit' && $object->statut == 1) |
|
| 1032 | + { |
|
| 1033 | + $edit = true; |
|
| 1034 | + print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'."\n"; |
|
| 1035 | + print '<input type="hidden" name="action" value="update"/>'."\n"; |
|
| 1036 | + print '<input type="hidden" name="id" value="'.$object->id.'" />'."\n"; |
|
| 1037 | + } |
|
| 1038 | + |
|
| 1039 | + dol_fiche_head($head, 'card', $langs->trans("CPTitreMenu"), -1, 'holiday'); |
|
| 1040 | + |
|
| 1041 | + $linkback='<a href="'.DOL_URL_ROOT.'/holiday/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
|
| 1042 | + |
|
| 1043 | + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref'); |
|
| 1044 | + |
|
| 1045 | + |
|
| 1046 | + print '<div class="fichecenter">'; |
|
| 1047 | + print '<div class="fichehalfleft">'; |
|
| 1048 | + print '<div class="underbanner clearboth"></div>'; |
|
| 1049 | + |
|
| 1050 | + print '<table class="border centpercent">'; |
|
| 1051 | + print '<tbody>'; |
|
| 1052 | + |
|
| 1053 | + // User |
|
| 1054 | + print '<tr>'; |
|
| 1055 | + print '<td class="titlefield">'.$langs->trans("User").'</td>'; |
|
| 1056 | + print '<td>'; |
|
| 1057 | + print $userRequest->getNomUrl(-1, 'leave'); |
|
| 1058 | + print '</td></tr>'; |
|
| 1059 | + |
|
| 1060 | + // Type |
|
| 1061 | + print '<tr>'; |
|
| 1062 | + print '<td>'.$langs->trans("Type").'</td>'; |
|
| 1063 | + print '<td>'; |
|
| 1064 | + $typeleaves=$object->getTypes(1,-1); |
|
| 1065 | + $labeltoshow = (($typeleaves[$object->fk_type]['code'] && $langs->trans($typeleaves[$object->fk_type]['code'])!=$typeleaves[$object->fk_type]['code']) ? $langs->trans($typeleaves[$object->fk_type]['code']) : $typeleaves[$object->fk_type]['label']); |
|
| 1066 | + print empty($labeltoshow) ? $langs->trans("TypeWasDisabledOrRemoved",$object->fk_type) : $labeltoshow; |
|
| 1067 | + print '</td>'; |
|
| 1068 | + print '</tr>'; |
|
| 1069 | + |
|
| 1070 | + $starthalfday=($object->halfday == -1 || $object->halfday == 2)?'afternoon':'morning'; |
|
| 1071 | + $endhalfday=($object->halfday == 1 || $object->halfday == 2)?'morning':'afternoon'; |
|
| 1072 | + |
|
| 1073 | + if(!$edit) |
|
| 1074 | + { |
|
| 1075 | + print '<tr>'; |
|
| 1076 | + print '<td class="nowrap">'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>'; |
|
| 1077 | + print '<td>'.dol_print_date($object->date_debut,'day'); |
|
| 1078 | + print ' '; |
|
| 1079 | + print '<span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).'</span>'; |
|
| 1080 | + print '</td>'; |
|
| 1081 | + print '</tr>'; |
|
| 1082 | + } |
|
| 1083 | + else |
|
| 1084 | + { |
|
| 1085 | + print '<tr>'; |
|
| 1086 | + print '<td class="nowrap">'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>'; |
|
| 1087 | + print '<td>'; |
|
| 1088 | + $form->select_date($object->date_debut,'date_debut_'); |
|
| 1089 | + print ' '; |
|
| 1090 | + print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday')?GETPOST('starthalfday'):$starthalfday)); |
|
| 1091 | + print '</td>'; |
|
| 1092 | + print '</tr>'; |
|
| 1093 | + } |
|
| 1094 | + |
|
| 1095 | + if (!$edit) |
|
| 1096 | + { |
|
| 1097 | + print '<tr>'; |
|
| 1098 | + print '<td class="nowrap">'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>'; |
|
| 1099 | + print '<td>'.dol_print_date($object->date_fin,'day'); |
|
| 1100 | + print ' '; |
|
| 1101 | + print '<span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).'</span>'; |
|
| 1102 | + print '</td>'; |
|
| 1103 | + print '</tr>'; |
|
| 1104 | + } |
|
| 1105 | + else |
|
| 1106 | + { |
|
| 1107 | + print '<tr>'; |
|
| 1108 | + print '<td class="nowrap">'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>'; |
|
| 1109 | + print '<td>'; |
|
| 1110 | + $form->select_date($object->date_fin,'date_fin_'); |
|
| 1111 | + print ' '; |
|
| 1112 | + print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday')?GETPOST('endhalfday'):$endhalfday)); |
|
| 1113 | + print '</td>'; |
|
| 1114 | + print '</tr>'; |
|
| 1115 | + } |
|
| 1116 | + // Nb of days |
|
| 1117 | + print '<tr>'; |
|
| 1118 | + print '<td>'.$langs->trans('NbUseDaysCP').'</td>'; |
|
| 1119 | + print '<td>'.num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday).'</td>'; |
|
| 1120 | + print '</tr>'; |
|
| 1121 | + |
|
| 1122 | + if ($object->statut == 5) |
|
| 1123 | + { |
|
| 1124 | + print '<tr>'; |
|
| 1125 | + print '<td>'.$langs->trans('DetailRefusCP').'</td>'; |
|
| 1126 | + print '<td>'.$object->detail_refuse.'</td>'; |
|
| 1127 | + print '</tr>'; |
|
| 1128 | + } |
|
| 1129 | + |
|
| 1130 | + // Description |
|
| 1131 | + if (!$edit) |
|
| 1132 | + { |
|
| 1133 | + print '<tr>'; |
|
| 1134 | + print '<td>'.$langs->trans('DescCP').'</td>'; |
|
| 1135 | + print '<td>'.nl2br($object->description).'</td>'; |
|
| 1136 | + print '</tr>'; |
|
| 1137 | + } |
|
| 1138 | + else |
|
| 1139 | + { |
|
| 1140 | + print '<tr>'; |
|
| 1141 | + print '<td>'.$langs->trans('DescCP').'</td>'; |
|
| 1142 | + print '<td class="tdtop">'; |
|
| 1143 | + $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); |
|
| 1144 | + print $doleditor->Create(1); |
|
| 1145 | + print '</td></tr>'; |
|
| 1146 | + } |
|
| 1147 | + |
|
| 1148 | + print '</tbody>'; |
|
| 1149 | + print '</table>'."\n"; |
|
| 1150 | + |
|
| 1151 | + print '</div>'; |
|
| 1152 | + print '<div class="fichehalfright">'; |
|
| 1153 | + print '<div class="ficheaddleft">'; |
|
| 1154 | + |
|
| 1155 | + print '<div class="underbanner clearboth"></div>'; |
|
| 1156 | 1156 | |
| 1157 | 1157 | // Info workflow |
| 1158 | - print '<table class="border centpercent">'."\n"; |
|
| 1159 | - print '<tbody>'; |
|
| 1160 | - |
|
| 1161 | - if (! empty($object->fk_user_create)) |
|
| 1162 | - { |
|
| 1163 | - $userCreate=new User($db); |
|
| 1164 | - $userCreate->fetch($object->fk_user_create); |
|
| 1165 | - print '<tr>'; |
|
| 1166 | - print '<td class="titlefield">'.$langs->trans('RequestByCP').'</td>'; |
|
| 1167 | - print '<td>'.$userCreate->getNomUrl(-1).'</td>'; |
|
| 1168 | - print '</tr>'; |
|
| 1169 | - } |
|
| 1170 | - |
|
| 1171 | - // Validator |
|
| 1172 | - if (!$edit) { |
|
| 1173 | - print '<tr>'; |
|
| 1174 | - print '<td class="titlefield">'; |
|
| 1175 | - if ($object->statut == 3 || $object->statut == 4) print $langs->trans('ApprovedBy'); |
|
| 1176 | - else print $langs->trans('ReviewedByCP'); |
|
| 1177 | - print '</td>'; |
|
| 1178 | - print '<td>'.$valideur->getNomUrl(-1).'</td>'; |
|
| 1179 | - print '</tr>'; |
|
| 1180 | - } else { |
|
| 1181 | - print '<tr>'; |
|
| 1182 | - print '<td class="titlefield">'.$langs->trans('ReviewedByCP').'</td>'; |
|
| 1183 | - print '<td>'; |
|
| 1184 | - print $form->select_dolusers($object->fk_validator, "valideur", 1, ($user->admin ? '' : array($user->id))); // By default, hierarchical parent |
|
| 1185 | - print '</td>'; |
|
| 1186 | - print '</tr>'; |
|
| 1187 | - } |
|
| 1188 | - |
|
| 1189 | - print '<tr>'; |
|
| 1190 | - print '<td>'.$langs->trans('DateCreateCP').'</td>'; |
|
| 1191 | - print '<td>'.dol_print_date($object->date_create,'dayhour').'</td>'; |
|
| 1192 | - print '</tr>'; |
|
| 1193 | - if ($object->statut == 3 || $object->statut == 4) { |
|
| 1194 | - print '<tr>'; |
|
| 1195 | - print '<td>'.$langs->trans('DateValidCP').'</td>'; |
|
| 1196 | - print '<td>'.dol_print_date($object->date_valid,'dayhour').'</td>'; // warning: date_valid is approval date on holiday module |
|
| 1197 | - print '</tr>'; |
|
| 1198 | - } |
|
| 1199 | - if ($object->statut == 4) { |
|
| 1200 | - print '<tr>'; |
|
| 1201 | - print '<td>'.$langs->trans('DateCancelCP').'</td>'; |
|
| 1202 | - print '<td>'.dol_print_date($object->date_cancel,'dayhour').'</td>'; |
|
| 1203 | - print '</tr>'; |
|
| 1204 | - } |
|
| 1205 | - if ($object->statut == 5) { |
|
| 1206 | - print '<tr>'; |
|
| 1207 | - print '<td>'.$langs->trans('DateRefusCP').'</td>'; |
|
| 1208 | - print '<td>'.dol_print_date($object->date_refuse,'dayhour').'</td>'; |
|
| 1209 | - print '</tr>'; |
|
| 1210 | - } |
|
| 1211 | - print '</tbody>'; |
|
| 1212 | - print '</table>'; |
|
| 1213 | - |
|
| 1214 | - print '</div>'; |
|
| 1215 | - print '</div>'; |
|
| 1216 | - print '</div>'; |
|
| 1217 | - |
|
| 1218 | - print '<div class="clearboth"></div>'; |
|
| 1219 | - |
|
| 1220 | - dol_fiche_end(); |
|
| 1221 | - |
|
| 1222 | - |
|
| 1223 | - // Confirmation messages |
|
| 1224 | - if ($action == 'delete') |
|
| 1225 | - { |
|
| 1226 | - if ($user->rights->holiday->delete) |
|
| 1227 | - { |
|
| 1228 | - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("TitleDeleteCP"),$langs->trans("ConfirmDeleteCP"),"confirm_delete", '', 0, 1); |
|
| 1229 | - } |
|
| 1230 | - } |
|
| 1231 | - |
|
| 1232 | - // Si envoi en validation |
|
| 1233 | - if ($action == 'sendToValidate' && $object->statut == 1) |
|
| 1234 | - { |
|
| 1235 | - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("TitleToValidCP"),$langs->trans("ConfirmToValidCP"),"confirm_send", '', 1, 1); |
|
| 1236 | - } |
|
| 1237 | - |
|
| 1238 | - // Si validation de la demande |
|
| 1239 | - if ($action == 'valid') |
|
| 1240 | - { |
|
| 1241 | - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("TitleValidCP"),$langs->trans("ConfirmValidCP"),"confirm_valid", '', 1, 1); |
|
| 1242 | - } |
|
| 1243 | - |
|
| 1244 | - // Si refus de la demande |
|
| 1245 | - if ($action == 'refuse') |
|
| 1246 | - { |
|
| 1247 | - $array_input = array(array('type'=>"text",'label'=> $langs->trans('DetailRefusCP'),'name'=>"detail_refuse",'size'=>"50",'value'=>"")); |
|
| 1248 | - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&action=confirm_refuse", $langs->trans("TitleRefuseCP"), $langs->trans('ConfirmRefuseCP'), "confirm_refuse", $array_input, 1, 0); |
|
| 1249 | - } |
|
| 1250 | - |
|
| 1251 | - // Si annulation de la demande |
|
| 1252 | - if ($action == 'cancel') |
|
| 1253 | - { |
|
| 1254 | - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("TitleCancelCP"),$langs->trans("ConfirmCancelCP"),"confirm_cancel", '', 1, 1); |
|
| 1255 | - } |
|
| 1256 | - |
|
| 1257 | - // Si back to draft |
|
| 1258 | - if ($action == 'backtodraft') |
|
| 1259 | - { |
|
| 1260 | - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("TitleSetToDraft"),$langs->trans("ConfirmSetToDraft"),"confirm_draft", '', 1, 1); |
|
| 1261 | - } |
|
| 1262 | - |
|
| 1263 | - |
|
| 1264 | - if ($action == 'edit' && $object->statut == 1) |
|
| 1265 | - { |
|
| 1266 | - print '<div align="center">'; |
|
| 1267 | - if ($cancreate && $object->statut == 1) |
|
| 1268 | - { |
|
| 1269 | - print '<input type="submit" value="'.$langs->trans("Save").'" class="button">'; |
|
| 1270 | - } |
|
| 1271 | - print '</div>'; |
|
| 1272 | - |
|
| 1273 | - print '</form>'; |
|
| 1274 | - } |
|
| 1275 | - |
|
| 1276 | - |
|
| 1277 | - if (! $edit) |
|
| 1278 | - { |
|
| 1279 | - print '<div class="tabsAction">'; |
|
| 1280 | - |
|
| 1281 | - // Boutons d'actions |
|
| 1282 | - if ($cancreate && $object->statut == 1) |
|
| 1283 | - { |
|
| 1284 | - print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit" class="butAction">'.$langs->trans("EditCP").'</a>'; |
|
| 1285 | - } |
|
| 1286 | - if ($cancreate && $object->statut == 1) // If draft |
|
| 1287 | - { |
|
| 1288 | - print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=sendToValidate" class="butAction">'.$langs->trans("Validate").'</a>'; |
|
| 1289 | - } |
|
| 1290 | - if ($user->rights->holiday->delete && ($object->statut == 1 || $object->statut == 4 || $object->statut == 5)) // If draft or canceled or refused |
|
| 1291 | - { |
|
| 1292 | - print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete" class="butActionDelete">'.$langs->trans("DeleteCP").'</a>'; |
|
| 1293 | - } |
|
| 1294 | - |
|
| 1295 | - if ($object->statut == 2) // If validated |
|
| 1296 | - { |
|
| 1297 | - if ($user->id == $object->fk_validator) |
|
| 1298 | - { |
|
| 1299 | - print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid" class="butAction">'.$langs->trans("Approve").'</a>'; |
|
| 1300 | - print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=refuse" class="butAction">'.$langs->trans("ActionRefuseCP").'</a>'; |
|
| 1301 | - } |
|
| 1302 | - else |
|
| 1303 | - { |
|
| 1304 | - print '<a href="#" class="butActionRefused" title="'.$langs->trans("NotTheAssignedApprover").'">'.$langs->trans("Approve").'</a>'; |
|
| 1305 | - print '<a href="#" class="butActionRefused" title="'.$langs->trans("NotTheAssignedApprover").'">'.$langs->trans("ActionRefuseCP").'</a>'; |
|
| 1306 | - } |
|
| 1307 | - } |
|
| 1308 | - |
|
| 1309 | - if (($user->id == $object->fk_validator || in_array($object->fk_user, $childids) || ! empty($user->rights->holiday->write_all)) && ($object->statut == 2 || $object->statut == 3)) // Status validated or approved |
|
| 1310 | - { |
|
| 1311 | - if (($object->date_debut > dol_now()) || $user->admin) print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel" class="butAction">'.$langs->trans("ActionCancelCP").'</a>'; |
|
| 1312 | - else print '<a href="#" class="butActionRefused" title="'.$langs->trans("HolidayStarted").'">'.$langs->trans("ActionCancelCP").'</a>'; |
|
| 1313 | - } |
|
| 1314 | - |
|
| 1315 | - if ($cancreate && $object->statut == 4) |
|
| 1316 | - { |
|
| 1317 | - print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=backtodraft" class="butAction">'.$langs->trans("SetToDraft").'</a>'; |
|
| 1318 | - } |
|
| 1319 | - |
|
| 1320 | - print '</div>'; |
|
| 1321 | - } |
|
| 1322 | - |
|
| 1323 | - } else { |
|
| 1324 | - print '<div class="tabBar">'; |
|
| 1325 | - print $langs->trans('ErrorUserViewCP'); |
|
| 1326 | - print '<br><br><input type="button" value="'.$langs->trans("ReturnCP").'" class="button" onclick="history.go(-1)" />'; |
|
| 1327 | - print '</div>'; |
|
| 1328 | - } |
|
| 1329 | - |
|
| 1330 | - } else { |
|
| 1331 | - print '<div class="tabBar">'; |
|
| 1332 | - print $langs->trans('ErrorIDFicheCP'); |
|
| 1333 | - print '<br><br><input type="button" value="'.$langs->trans("ReturnCP").'" class="button" onclick="history.go(-1)" />'; |
|
| 1334 | - print '</div>'; |
|
| 1335 | - } |
|
| 1336 | - |
|
| 1337 | - } |
|
| 1158 | + print '<table class="border centpercent">'."\n"; |
|
| 1159 | + print '<tbody>'; |
|
| 1160 | + |
|
| 1161 | + if (! empty($object->fk_user_create)) |
|
| 1162 | + { |
|
| 1163 | + $userCreate=new User($db); |
|
| 1164 | + $userCreate->fetch($object->fk_user_create); |
|
| 1165 | + print '<tr>'; |
|
| 1166 | + print '<td class="titlefield">'.$langs->trans('RequestByCP').'</td>'; |
|
| 1167 | + print '<td>'.$userCreate->getNomUrl(-1).'</td>'; |
|
| 1168 | + print '</tr>'; |
|
| 1169 | + } |
|
| 1170 | + |
|
| 1171 | + // Validator |
|
| 1172 | + if (!$edit) { |
|
| 1173 | + print '<tr>'; |
|
| 1174 | + print '<td class="titlefield">'; |
|
| 1175 | + if ($object->statut == 3 || $object->statut == 4) print $langs->trans('ApprovedBy'); |
|
| 1176 | + else print $langs->trans('ReviewedByCP'); |
|
| 1177 | + print '</td>'; |
|
| 1178 | + print '<td>'.$valideur->getNomUrl(-1).'</td>'; |
|
| 1179 | + print '</tr>'; |
|
| 1180 | + } else { |
|
| 1181 | + print '<tr>'; |
|
| 1182 | + print '<td class="titlefield">'.$langs->trans('ReviewedByCP').'</td>'; |
|
| 1183 | + print '<td>'; |
|
| 1184 | + print $form->select_dolusers($object->fk_validator, "valideur", 1, ($user->admin ? '' : array($user->id))); // By default, hierarchical parent |
|
| 1185 | + print '</td>'; |
|
| 1186 | + print '</tr>'; |
|
| 1187 | + } |
|
| 1188 | + |
|
| 1189 | + print '<tr>'; |
|
| 1190 | + print '<td>'.$langs->trans('DateCreateCP').'</td>'; |
|
| 1191 | + print '<td>'.dol_print_date($object->date_create,'dayhour').'</td>'; |
|
| 1192 | + print '</tr>'; |
|
| 1193 | + if ($object->statut == 3 || $object->statut == 4) { |
|
| 1194 | + print '<tr>'; |
|
| 1195 | + print '<td>'.$langs->trans('DateValidCP').'</td>'; |
|
| 1196 | + print '<td>'.dol_print_date($object->date_valid,'dayhour').'</td>'; // warning: date_valid is approval date on holiday module |
|
| 1197 | + print '</tr>'; |
|
| 1198 | + } |
|
| 1199 | + if ($object->statut == 4) { |
|
| 1200 | + print '<tr>'; |
|
| 1201 | + print '<td>'.$langs->trans('DateCancelCP').'</td>'; |
|
| 1202 | + print '<td>'.dol_print_date($object->date_cancel,'dayhour').'</td>'; |
|
| 1203 | + print '</tr>'; |
|
| 1204 | + } |
|
| 1205 | + if ($object->statut == 5) { |
|
| 1206 | + print '<tr>'; |
|
| 1207 | + print '<td>'.$langs->trans('DateRefusCP').'</td>'; |
|
| 1208 | + print '<td>'.dol_print_date($object->date_refuse,'dayhour').'</td>'; |
|
| 1209 | + print '</tr>'; |
|
| 1210 | + } |
|
| 1211 | + print '</tbody>'; |
|
| 1212 | + print '</table>'; |
|
| 1213 | + |
|
| 1214 | + print '</div>'; |
|
| 1215 | + print '</div>'; |
|
| 1216 | + print '</div>'; |
|
| 1217 | + |
|
| 1218 | + print '<div class="clearboth"></div>'; |
|
| 1219 | + |
|
| 1220 | + dol_fiche_end(); |
|
| 1221 | + |
|
| 1222 | + |
|
| 1223 | + // Confirmation messages |
|
| 1224 | + if ($action == 'delete') |
|
| 1225 | + { |
|
| 1226 | + if ($user->rights->holiday->delete) |
|
| 1227 | + { |
|
| 1228 | + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("TitleDeleteCP"),$langs->trans("ConfirmDeleteCP"),"confirm_delete", '', 0, 1); |
|
| 1229 | + } |
|
| 1230 | + } |
|
| 1231 | + |
|
| 1232 | + // Si envoi en validation |
|
| 1233 | + if ($action == 'sendToValidate' && $object->statut == 1) |
|
| 1234 | + { |
|
| 1235 | + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("TitleToValidCP"),$langs->trans("ConfirmToValidCP"),"confirm_send", '', 1, 1); |
|
| 1236 | + } |
|
| 1237 | + |
|
| 1238 | + // Si validation de la demande |
|
| 1239 | + if ($action == 'valid') |
|
| 1240 | + { |
|
| 1241 | + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("TitleValidCP"),$langs->trans("ConfirmValidCP"),"confirm_valid", '', 1, 1); |
|
| 1242 | + } |
|
| 1243 | + |
|
| 1244 | + // Si refus de la demande |
|
| 1245 | + if ($action == 'refuse') |
|
| 1246 | + { |
|
| 1247 | + $array_input = array(array('type'=>"text",'label'=> $langs->trans('DetailRefusCP'),'name'=>"detail_refuse",'size'=>"50",'value'=>"")); |
|
| 1248 | + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&action=confirm_refuse", $langs->trans("TitleRefuseCP"), $langs->trans('ConfirmRefuseCP'), "confirm_refuse", $array_input, 1, 0); |
|
| 1249 | + } |
|
| 1250 | + |
|
| 1251 | + // Si annulation de la demande |
|
| 1252 | + if ($action == 'cancel') |
|
| 1253 | + { |
|
| 1254 | + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("TitleCancelCP"),$langs->trans("ConfirmCancelCP"),"confirm_cancel", '', 1, 1); |
|
| 1255 | + } |
|
| 1256 | + |
|
| 1257 | + // Si back to draft |
|
| 1258 | + if ($action == 'backtodraft') |
|
| 1259 | + { |
|
| 1260 | + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("TitleSetToDraft"),$langs->trans("ConfirmSetToDraft"),"confirm_draft", '', 1, 1); |
|
| 1261 | + } |
|
| 1262 | + |
|
| 1263 | + |
|
| 1264 | + if ($action == 'edit' && $object->statut == 1) |
|
| 1265 | + { |
|
| 1266 | + print '<div align="center">'; |
|
| 1267 | + if ($cancreate && $object->statut == 1) |
|
| 1268 | + { |
|
| 1269 | + print '<input type="submit" value="'.$langs->trans("Save").'" class="button">'; |
|
| 1270 | + } |
|
| 1271 | + print '</div>'; |
|
| 1272 | + |
|
| 1273 | + print '</form>'; |
|
| 1274 | + } |
|
| 1275 | + |
|
| 1276 | + |
|
| 1277 | + if (! $edit) |
|
| 1278 | + { |
|
| 1279 | + print '<div class="tabsAction">'; |
|
| 1280 | + |
|
| 1281 | + // Boutons d'actions |
|
| 1282 | + if ($cancreate && $object->statut == 1) |
|
| 1283 | + { |
|
| 1284 | + print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit" class="butAction">'.$langs->trans("EditCP").'</a>'; |
|
| 1285 | + } |
|
| 1286 | + if ($cancreate && $object->statut == 1) // If draft |
|
| 1287 | + { |
|
| 1288 | + print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=sendToValidate" class="butAction">'.$langs->trans("Validate").'</a>'; |
|
| 1289 | + } |
|
| 1290 | + if ($user->rights->holiday->delete && ($object->statut == 1 || $object->statut == 4 || $object->statut == 5)) // If draft or canceled or refused |
|
| 1291 | + { |
|
| 1292 | + print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete" class="butActionDelete">'.$langs->trans("DeleteCP").'</a>'; |
|
| 1293 | + } |
|
| 1294 | + |
|
| 1295 | + if ($object->statut == 2) // If validated |
|
| 1296 | + { |
|
| 1297 | + if ($user->id == $object->fk_validator) |
|
| 1298 | + { |
|
| 1299 | + print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid" class="butAction">'.$langs->trans("Approve").'</a>'; |
|
| 1300 | + print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=refuse" class="butAction">'.$langs->trans("ActionRefuseCP").'</a>'; |
|
| 1301 | + } |
|
| 1302 | + else |
|
| 1303 | + { |
|
| 1304 | + print '<a href="#" class="butActionRefused" title="'.$langs->trans("NotTheAssignedApprover").'">'.$langs->trans("Approve").'</a>'; |
|
| 1305 | + print '<a href="#" class="butActionRefused" title="'.$langs->trans("NotTheAssignedApprover").'">'.$langs->trans("ActionRefuseCP").'</a>'; |
|
| 1306 | + } |
|
| 1307 | + } |
|
| 1308 | + |
|
| 1309 | + if (($user->id == $object->fk_validator || in_array($object->fk_user, $childids) || ! empty($user->rights->holiday->write_all)) && ($object->statut == 2 || $object->statut == 3)) // Status validated or approved |
|
| 1310 | + { |
|
| 1311 | + if (($object->date_debut > dol_now()) || $user->admin) print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel" class="butAction">'.$langs->trans("ActionCancelCP").'</a>'; |
|
| 1312 | + else print '<a href="#" class="butActionRefused" title="'.$langs->trans("HolidayStarted").'">'.$langs->trans("ActionCancelCP").'</a>'; |
|
| 1313 | + } |
|
| 1314 | + |
|
| 1315 | + if ($cancreate && $object->statut == 4) |
|
| 1316 | + { |
|
| 1317 | + print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=backtodraft" class="butAction">'.$langs->trans("SetToDraft").'</a>'; |
|
| 1318 | + } |
|
| 1319 | + |
|
| 1320 | + print '</div>'; |
|
| 1321 | + } |
|
| 1322 | + |
|
| 1323 | + } else { |
|
| 1324 | + print '<div class="tabBar">'; |
|
| 1325 | + print $langs->trans('ErrorUserViewCP'); |
|
| 1326 | + print '<br><br><input type="button" value="'.$langs->trans("ReturnCP").'" class="button" onclick="history.go(-1)" />'; |
|
| 1327 | + print '</div>'; |
|
| 1328 | + } |
|
| 1329 | + |
|
| 1330 | + } else { |
|
| 1331 | + print '<div class="tabBar">'; |
|
| 1332 | + print $langs->trans('ErrorIDFicheCP'); |
|
| 1333 | + print '<br><br><input type="button" value="'.$langs->trans("ReturnCP").'" class="button" onclick="history.go(-1)" />'; |
|
| 1334 | + print '</div>'; |
|
| 1335 | + } |
|
| 1336 | + |
|
| 1337 | + } |
|
| 1338 | 1338 | |
| 1339 | 1339 | } |
| 1340 | 1340 | |
@@ -39,28 +39,28 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | // Get parameters |
| 41 | 41 | $myparam = GETPOST("myparam"); |
| 42 | -$action=GETPOST('action', 'alpha'); |
|
| 43 | -$id=GETPOST('id', 'int'); |
|
| 44 | -$fuserid = (GETPOST('fuserid','int')?GETPOST('fuserid','int'):$user->id); |
|
| 42 | +$action = GETPOST('action', 'alpha'); |
|
| 43 | +$id = GETPOST('id', 'int'); |
|
| 44 | +$fuserid = (GETPOST('fuserid', 'int') ?GETPOST('fuserid', 'int') : $user->id); |
|
| 45 | 45 | |
| 46 | 46 | // Protection if external user |
| 47 | 47 | if ($user->societe_id > 0) accessforbidden(); |
| 48 | 48 | |
| 49 | -$now=dol_now(); |
|
| 49 | +$now = dol_now(); |
|
| 50 | 50 | |
| 51 | 51 | $langs->load("holiday"); |
| 52 | 52 | |
| 53 | 53 | $childids = $user->getAllChildIds(1); |
| 54 | 54 | |
| 55 | 55 | $cancreate = 0; |
| 56 | -if (! empty($user->rights->holiday->write_all)) $cancreate=1; |
|
| 57 | -if (! empty($user->rights->holiday->write) && in_array($fuserid, $childids)) $cancreate=1; |
|
| 56 | +if (!empty($user->rights->holiday->write_all)) $cancreate = 1; |
|
| 57 | +if (!empty($user->rights->holiday->write) && in_array($fuserid, $childids)) $cancreate = 1; |
|
| 58 | 58 | |
| 59 | 59 | $candelete = 0; |
| 60 | -if (! empty($user->rights->holiday->delete)) $candelete=1; |
|
| 60 | +if (!empty($user->rights->holiday->delete)) $candelete = 1; |
|
| 61 | 61 | |
| 62 | 62 | $morefilter = 'AND employee = 1'; |
| 63 | -if (! empty($conf->global->HOLIDAY_FOR_NON_SALARIES_TOO)) $morefilter = ''; |
|
| 63 | +if (!empty($conf->global->HOLIDAY_FOR_NON_SALARIES_TOO)) $morefilter = ''; |
|
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | /* |
@@ -73,14 +73,14 @@ discard block |
||
| 73 | 73 | $object = new Holiday($db); |
| 74 | 74 | |
| 75 | 75 | // If no right to create a request |
| 76 | - if (! $cancreate) |
|
| 76 | + if (!$cancreate) |
|
| 77 | 77 | { |
| 78 | 78 | $error++; |
| 79 | 79 | setEventMessages($langs->trans('CantCreateCP'), null, 'errors'); |
| 80 | - $action='request'; |
|
| 80 | + $action = 'request'; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if (! $error) |
|
| 83 | + if (!$error) |
|
| 84 | 84 | { |
| 85 | 85 | $db->begin(); |
| 86 | 86 | |
@@ -88,13 +88,13 @@ discard block |
||
| 88 | 88 | $date_fin = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year')); |
| 89 | 89 | $date_debut_gmt = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'), 1); |
| 90 | 90 | $date_fin_gmt = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'), 1); |
| 91 | - $starthalfday=GETPOST('starthalfday'); |
|
| 92 | - $endhalfday=GETPOST('endhalfday'); |
|
| 93 | - $type=GETPOST('type'); |
|
| 94 | - $halfday=0; |
|
| 95 | - if ($starthalfday == 'afternoon' && $endhalfday == 'morning') $halfday=2; |
|
| 96 | - else if ($starthalfday == 'afternoon') $halfday=-1; |
|
| 97 | - else if ($endhalfday == 'morning') $halfday=1; |
|
| 91 | + $starthalfday = GETPOST('starthalfday'); |
|
| 92 | + $endhalfday = GETPOST('endhalfday'); |
|
| 93 | + $type = GETPOST('type'); |
|
| 94 | + $halfday = 0; |
|
| 95 | + if ($starthalfday == 'afternoon' && $endhalfday == 'morning') $halfday = 2; |
|
| 96 | + else if ($starthalfday == 'afternoon') $halfday = -1; |
|
| 97 | + else if ($endhalfday == 'morning') $halfday = 1; |
|
| 98 | 98 | |
| 99 | 99 | $valideur = GETPOST('valideur'); |
| 100 | 100 | $description = trim(GETPOST('description')); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); |
| 106 | 106 | $error++; |
| 107 | - $action='create'; |
|
| 107 | + $action = 'create'; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | // If no start date |
@@ -112,39 +112,39 @@ discard block |
||
| 112 | 112 | { |
| 113 | 113 | setEventMessages($langs->trans("NoDateDebut"), null, 'errors'); |
| 114 | 114 | $error++; |
| 115 | - $action='create'; |
|
| 115 | + $action = 'create'; |
|
| 116 | 116 | } |
| 117 | 117 | // If no end date |
| 118 | 118 | if (empty($date_fin)) |
| 119 | 119 | { |
| 120 | 120 | setEventMessages($langs->trans("NoDateFin"), null, 'errors'); |
| 121 | 121 | $error++; |
| 122 | - $action='create'; |
|
| 122 | + $action = 'create'; |
|
| 123 | 123 | } |
| 124 | 124 | // If start date after end date |
| 125 | 125 | if ($date_debut > $date_fin) |
| 126 | 126 | { |
| 127 | 127 | setEventMessages($langs->trans("ErrorEndDateCP"), null, 'errors'); |
| 128 | 128 | $error++; |
| 129 | - $action='create'; |
|
| 129 | + $action = 'create'; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | // Check if there is already holiday for this period |
| 133 | 133 | $verifCP = $object->verifDateHolidayCP($fuserid, $date_debut, $date_fin, $halfday); |
| 134 | - if (! $verifCP) |
|
| 134 | + if (!$verifCP) |
|
| 135 | 135 | { |
| 136 | 136 | setEventMessages($langs->trans("alreadyCPexist"), null, 'errors'); |
| 137 | 137 | $error++; |
| 138 | - $action='create'; |
|
| 138 | + $action = 'create'; |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | // If there is no Business Days within request |
| 142 | - $nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday); |
|
| 143 | - if($nbopenedday < 0.5) |
|
| 142 | + $nbopenedday = num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday); |
|
| 143 | + if ($nbopenedday < 0.5) |
|
| 144 | 144 | { |
| 145 | 145 | setEventMessages($langs->trans("ErrorDureeCP"), null, 'errors'); |
| 146 | 146 | $error++; |
| 147 | - $action='create'; |
|
| 147 | + $action = 'create'; |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | // If no validator designated |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | $result = 0; |
| 158 | 158 | |
| 159 | - if (! $error) |
|
| 159 | + if (!$error) |
|
| 160 | 160 | { |
| 161 | 161 | $object->fk_user = $fuserid; |
| 162 | 162 | $object->description = $description; |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | // If no SQL error we redirect to the request card |
| 178 | - if (! $error) |
|
| 178 | + if (!$error) |
|
| 179 | 179 | { |
| 180 | 180 | $db->commit(); |
| 181 | 181 | |
@@ -195,15 +195,15 @@ discard block |
||
| 195 | 195 | $date_fin = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year')); |
| 196 | 196 | $date_debut_gmt = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'), 1); |
| 197 | 197 | $date_fin_gmt = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'), 1); |
| 198 | - $starthalfday=GETPOST('starthalfday'); |
|
| 199 | - $endhalfday=GETPOST('endhalfday'); |
|
| 200 | - $halfday=0; |
|
| 201 | - if ($starthalfday == 'afternoon' && $endhalfday == 'morning') $halfday=2; |
|
| 202 | - else if ($starthalfday == 'afternoon') $halfday=-1; |
|
| 203 | - else if ($endhalfday == 'morning') $halfday=1; |
|
| 198 | + $starthalfday = GETPOST('starthalfday'); |
|
| 199 | + $endhalfday = GETPOST('endhalfday'); |
|
| 200 | + $halfday = 0; |
|
| 201 | + if ($starthalfday == 'afternoon' && $endhalfday == 'morning') $halfday = 2; |
|
| 202 | + else if ($starthalfday == 'afternoon') $halfday = -1; |
|
| 203 | + else if ($endhalfday == 'morning') $halfday = 1; |
|
| 204 | 204 | |
| 205 | 205 | // If no right to modify a request |
| 206 | - if (! $user->rights->holiday->write) |
|
| 206 | + if (!$user->rights->holiday->write) |
|
| 207 | 207 | { |
| 208 | 208 | header('Location: '.$_SERVER["PHP_SELF"].'?action=request&error=CantUpdate'); |
| 209 | 209 | exit; |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | // If there is no Business Days within request |
| 249 | - $nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday); |
|
| 249 | + $nbopenedday = num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday); |
|
| 250 | 250 | if ($nbopenedday < 0.5) |
| 251 | 251 | { |
| 252 | 252 | header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=DureeHoliday'); |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | if ($verif <= 0) |
| 266 | 266 | { |
| 267 | 267 | setEventMessages($object->error, $object->errors, 'warnings'); |
| 268 | - $action='edit'; |
|
| 268 | + $action = 'edit'; |
|
| 269 | 269 | } |
| 270 | 270 | else |
| 271 | 271 | { |
@@ -276,20 +276,20 @@ discard block |
||
| 276 | 276 | else |
| 277 | 277 | { |
| 278 | 278 | setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors'); |
| 279 | - $action=''; |
|
| 279 | + $action = ''; |
|
| 280 | 280 | } |
| 281 | 281 | } |
| 282 | 282 | else |
| 283 | 283 | { |
| 284 | 284 | setEventMessages($langs->trans("ErrorBadStatus"), null, 'errors'); |
| 285 | - $action=''; |
|
| 285 | + $action = ''; |
|
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | // If delete of request |
| 290 | 290 | if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes' && $user->rights->holiday->delete) |
| 291 | 291 | { |
| 292 | - $error=0; |
|
| 292 | + $error = 0; |
|
| 293 | 293 | |
| 294 | 294 | $db->begin(); |
| 295 | 295 | |
@@ -302,17 +302,17 @@ discard block |
||
| 302 | 302 | // Si l'utilisateur à le droit de lire cette demande, il peut la supprimer |
| 303 | 303 | if ($candelete) |
| 304 | 304 | { |
| 305 | - $result=$object->delete($user); |
|
| 305 | + $result = $object->delete($user); |
|
| 306 | 306 | } |
| 307 | 307 | else |
| 308 | 308 | { |
| 309 | 309 | $error++; |
| 310 | 310 | setEventMessages($langs->trans('ErrorCantDeleteCP'), null, 'errors'); |
| 311 | - $action=''; |
|
| 311 | + $action = ''; |
|
| 312 | 312 | } |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | - if (! $error) |
|
| 315 | + if (!$error) |
|
| 316 | 316 | { |
| 317 | 317 | $db->commit(); |
| 318 | 318 | header('Location: list.php?restore_lastsearch_values=1'); |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | $object->fetch($id); |
| 332 | 332 | |
| 333 | 333 | // Si brouillon et créateur |
| 334 | - if($object->statut == 1 && $cancreate) |
|
| 334 | + if ($object->statut == 1 && $cancreate) |
|
| 335 | 335 | { |
| 336 | 336 | $object->statut = 2; |
| 337 | 337 | |
@@ -359,14 +359,14 @@ discard block |
||
| 359 | 359 | |
| 360 | 360 | // Subject |
| 361 | 361 | $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; |
| 362 | - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 362 | + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 363 | 363 | |
| 364 | 364 | $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysToValidate"); |
| 365 | 365 | |
| 366 | 366 | // Content |
| 367 | 367 | $message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n"; |
| 368 | - $message.= "\n"; |
|
| 369 | - $message.= $langs->transnoentities("HolidaysToValidateBody")."\n"; |
|
| 368 | + $message .= "\n"; |
|
| 369 | + $message .= $langs->transnoentities("HolidaysToValidateBody")."\n"; |
|
| 370 | 370 | |
| 371 | 371 | $delayForRequest = $object->getConfCP('delayForRequest'); |
| 372 | 372 | //$delayForRequest = $delayForRequest * (60*60*24); |
@@ -374,43 +374,43 @@ discard block |
||
| 374 | 374 | $nextMonth = dol_time_plus_duree($now, $delayForRequest, 'd'); |
| 375 | 375 | |
| 376 | 376 | // Si l'option pour avertir le valideur en cas de délai trop court |
| 377 | - if($object->getConfCP('AlertValidatorDelay')) |
|
| 377 | + if ($object->getConfCP('AlertValidatorDelay')) |
|
| 378 | 378 | { |
| 379 | - if($object->date_debut < $nextMonth) |
|
| 379 | + if ($object->date_debut < $nextMonth) |
|
| 380 | 380 | { |
| 381 | - $message.= "\n"; |
|
| 382 | - $message.= $langs->transnoentities("HolidaysToValidateDelay",$object->getConfCP('delayForRequest'))."\n"; |
|
| 381 | + $message .= "\n"; |
|
| 382 | + $message .= $langs->transnoentities("HolidaysToValidateDelay", $object->getConfCP('delayForRequest'))."\n"; |
|
| 383 | 383 | } |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | // Si l'option pour avertir le valideur en cas de solde inférieur à la demande |
| 387 | 387 | if ($object->getConfCP('AlertValidatorSolde')) |
| 388 | 388 | { |
| 389 | - $nbopenedday=num_open_day($object->date_debut_gmt,$object->date_fin_gmt,0,1,$object->halfday); |
|
| 389 | + $nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday); |
|
| 390 | 390 | if ($nbopenedday > $object->getCPforUser($object->fk_user, $object->fk_type)) |
| 391 | 391 | { |
| 392 | - $message.= "\n"; |
|
| 393 | - $message.= $langs->transnoentities("HolidaysToValidateAlertSolde")."\n"; |
|
| 392 | + $message .= "\n"; |
|
| 393 | + $message .= $langs->transnoentities("HolidaysToValidateAlertSolde")."\n"; |
|
| 394 | 394 | } |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - $message.= "\n"; |
|
| 398 | - $message.= "- ".$langs->transnoentitiesnoconv("Name")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; |
|
| 399 | - $message.= "- ".$langs->transnoentitiesnoconv("Period")." : ".dol_print_date($object->date_debut,'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($object->date_fin,'day')."\n"; |
|
| 400 | - $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n"; |
|
| 401 | - $message.= "\n"; |
|
| 397 | + $message .= "\n"; |
|
| 398 | + $message .= "- ".$langs->transnoentitiesnoconv("Name")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; |
|
| 399 | + $message .= "- ".$langs->transnoentitiesnoconv("Period")." : ".dol_print_date($object->date_debut, 'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($object->date_fin, 'day')."\n"; |
|
| 400 | + $message .= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n"; |
|
| 401 | + $message .= "\n"; |
|
| 402 | 402 | |
| 403 | - $trackid='leav'.$object->id; |
|
| 403 | + $trackid = 'leav'.$object->id; |
|
| 404 | 404 | |
| 405 | 405 | $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid); |
| 406 | 406 | |
| 407 | 407 | // Envoi du mail |
| 408 | - $result=$mail->sendfile(); |
|
| 408 | + $result = $mail->sendfile(); |
|
| 409 | 409 | |
| 410 | 410 | if (!$result) |
| 411 | 411 | { |
| 412 | 412 | setEventMessages($mail->error, $mail->errors, 'warnings'); |
| 413 | - $action=''; |
|
| 413 | + $action = ''; |
|
| 414 | 414 | } |
| 415 | 415 | else |
| 416 | 416 | { |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | else |
| 422 | 422 | { |
| 423 | 423 | setEventMessages($object->error, $object->errors, 'errors'); |
| 424 | - $action=''; |
|
| 424 | + $action = ''; |
|
| 425 | 425 | } |
| 426 | 426 | } |
| 427 | 427 | } |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | if ($verif > 0) |
| 447 | 447 | { |
| 448 | 448 | // Calculcate number of days consummed |
| 449 | - $nbopenedday=num_open_day($object->date_debut_gmt,$object->date_fin_gmt,0,1,$object->halfday); |
|
| 449 | + $nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday); |
|
| 450 | 450 | |
| 451 | 451 | $soldeActuel = $object->getCpforUser($object->fk_user, $object->fk_type); |
| 452 | 452 | $newSolde = $soldeActuel - ($nbopenedday * $object->getConfCP('nbHolidayDeducted')); |
@@ -476,31 +476,31 @@ discard block |
||
| 476 | 476 | |
| 477 | 477 | // Subject |
| 478 | 478 | $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; |
| 479 | - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 479 | + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 480 | 480 | |
| 481 | 481 | $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysValidated"); |
| 482 | 482 | |
| 483 | 483 | // Content |
| 484 | 484 | $message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n"; |
| 485 | - $message.= "\n"; |
|
| 486 | - $message.= $langs->transnoentities("HolidaysValidatedBody", dol_print_date($object->date_debut,'day'),dol_print_date($object->date_fin,'day'))."\n"; |
|
| 485 | + $message .= "\n"; |
|
| 486 | + $message .= $langs->transnoentities("HolidaysValidatedBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."\n"; |
|
| 487 | 487 | |
| 488 | - $message.= "- ".$langs->transnoentitiesnoconv("ValidatedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; |
|
| 488 | + $message .= "- ".$langs->transnoentitiesnoconv("ValidatedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; |
|
| 489 | 489 | |
| 490 | - $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n"; |
|
| 491 | - $message.= "\n"; |
|
| 490 | + $message .= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n"; |
|
| 491 | + $message .= "\n"; |
|
| 492 | 492 | |
| 493 | - $trackid='leav'.$object->id; |
|
| 493 | + $trackid = 'leav'.$object->id; |
|
| 494 | 494 | |
| 495 | 495 | $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid); |
| 496 | 496 | |
| 497 | 497 | // Envoi du mail |
| 498 | - $result=$mail->sendfile(); |
|
| 498 | + $result = $mail->sendfile(); |
|
| 499 | 499 | |
| 500 | 500 | if (!$result) |
| 501 | 501 | { |
| 502 | 502 | setEventMessages($mail->error, $mail->errors, 'warnings'); |
| 503 | - $action=''; |
|
| 503 | + $action = ''; |
|
| 504 | 504 | } |
| 505 | 505 | else |
| 506 | 506 | { |
@@ -511,14 +511,14 @@ discard block |
||
| 511 | 511 | else |
| 512 | 512 | { |
| 513 | 513 | setEventMessages($object->error, $object->errors, 'errors'); |
| 514 | - $action=''; |
|
| 514 | + $action = ''; |
|
| 515 | 515 | } |
| 516 | 516 | } |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | -if ($action == 'confirm_refuse' && GETPOST('confirm','alpha') == 'yes') |
|
| 519 | +if ($action == 'confirm_refuse' && GETPOST('confirm', 'alpha') == 'yes') |
|
| 520 | 520 | { |
| 521 | - if (! empty($_POST['detail_refuse'])) |
|
| 521 | + if (!empty($_POST['detail_refuse'])) |
|
| 522 | 522 | { |
| 523 | 523 | $object = new Holiday($db); |
| 524 | 524 | $object->fetch($id); |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | $object->date_refuse = dol_print_date('dayhour', dol_now()); |
| 530 | 530 | $object->fk_user_refuse = $user->id; |
| 531 | 531 | $object->statut = 5; |
| 532 | - $object->detail_refuse = GETPOST('detail_refuse','alphanohtml'); |
|
| 532 | + $object->detail_refuse = GETPOST('detail_refuse', 'alphanohtml'); |
|
| 533 | 533 | |
| 534 | 534 | $verif = $object->update($user); |
| 535 | 535 | |
@@ -554,32 +554,32 @@ discard block |
||
| 554 | 554 | |
| 555 | 555 | // Subject |
| 556 | 556 | $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; |
| 557 | - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 557 | + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 558 | 558 | |
| 559 | 559 | $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysRefused"); |
| 560 | 560 | |
| 561 | 561 | // Content |
| 562 | 562 | $message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n"; |
| 563 | - $message.= "\n"; |
|
| 564 | - $message.= $langs->transnoentities("HolidaysRefusedBody", dol_print_date($object->date_debut,'day'), dol_print_date($object->date_fin,'day'))."\n"; |
|
| 565 | - $message.= GETPOST('detail_refuse','alpha')."\n\n"; |
|
| 563 | + $message .= "\n"; |
|
| 564 | + $message .= $langs->transnoentities("HolidaysRefusedBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."\n"; |
|
| 565 | + $message .= GETPOST('detail_refuse', 'alpha')."\n\n"; |
|
| 566 | 566 | |
| 567 | - $message.= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; |
|
| 567 | + $message .= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; |
|
| 568 | 568 | |
| 569 | - $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n"; |
|
| 570 | - $message.= "\n"; |
|
| 569 | + $message .= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n"; |
|
| 570 | + $message .= "\n"; |
|
| 571 | 571 | |
| 572 | - $trackid='leav'.$object->id; |
|
| 572 | + $trackid = 'leav'.$object->id; |
|
| 573 | 573 | |
| 574 | 574 | $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid); |
| 575 | 575 | |
| 576 | 576 | // Envoi du mail |
| 577 | - $result=$mail->sendfile(); |
|
| 577 | + $result = $mail->sendfile(); |
|
| 578 | 578 | |
| 579 | 579 | if (!$result) |
| 580 | 580 | { |
| 581 | 581 | setEventMessages($mail->error, $mail->errors, 'warnings'); |
| 582 | - $action=''; |
|
| 582 | + $action = ''; |
|
| 583 | 583 | } |
| 584 | 584 | else |
| 585 | 585 | { |
@@ -590,12 +590,12 @@ discard block |
||
| 590 | 590 | else |
| 591 | 591 | { |
| 592 | 592 | setEventMessages($object->error, $object->errors, 'errors'); |
| 593 | - $action=''; |
|
| 593 | + $action = ''; |
|
| 594 | 594 | } |
| 595 | 595 | } |
| 596 | 596 | } else { |
| 597 | 597 | setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DetailRefusCP")), null, 'errors'); |
| 598 | - $action='refuse'; |
|
| 598 | + $action = 'refuse'; |
|
| 599 | 599 | } |
| 600 | 600 | } |
| 601 | 601 | |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | setEventMessages($langs->trans('ErrorBackToDraft').' '.$object->error, $object->errors, 'errors'); |
| 619 | 619 | } |
| 620 | 620 | |
| 621 | - if (! $error) |
|
| 621 | + if (!$error) |
|
| 622 | 622 | { |
| 623 | 623 | $db->commit(); |
| 624 | 624 | |
@@ -640,7 +640,7 @@ discard block |
||
| 640 | 640 | $object->fetch($id); |
| 641 | 641 | |
| 642 | 642 | // Si statut en attente de validation et valideur = valideur ou utilisateur, ou droits de faire pour les autres |
| 643 | - if (($object->statut == 2 || $object->statut == 3) && ($user->id == $object->fk_validator || in_array($object->fk_user, $childids) || ! empty($user->rights->holiday->write_all))) |
|
| 643 | + if (($object->statut == 2 || $object->statut == 3) && ($user->id == $object->fk_validator || in_array($object->fk_user, $childids) || !empty($user->rights->holiday->write_all))) |
|
| 644 | 644 | { |
| 645 | 645 | $db->begin(); |
| 646 | 646 | |
@@ -654,16 +654,16 @@ discard block |
||
| 654 | 654 | if ($result >= 0 && $oldstatus == 3) // holiday was already validated, status 3, so we must increase back sold |
| 655 | 655 | { |
| 656 | 656 | // Calculcate number of days consummed |
| 657 | - $nbopenedday=num_open_day($object->date_debut_gmt,$object->date_fin_gmt,0,1,$object->halfday); |
|
| 657 | + $nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday); |
|
| 658 | 658 | |
| 659 | 659 | $soldeActuel = $object->getCpforUser($object->fk_user, $object->fk_type); |
| 660 | 660 | $newSolde = $soldeActuel + ($nbopenedday * $object->getConfCP('nbHolidayDeducted')); |
| 661 | 661 | |
| 662 | 662 | // On ajoute la modification dans le LOG |
| 663 | - $result1=$object->addLogCP($user->id, $object->fk_user, $langs->transnoentitiesnoconv("HolidaysCancelation"), $newSolde, $object->fk_type); |
|
| 663 | + $result1 = $object->addLogCP($user->id, $object->fk_user, $langs->transnoentitiesnoconv("HolidaysCancelation"), $newSolde, $object->fk_type); |
|
| 664 | 664 | |
| 665 | 665 | // Mise à jour du solde |
| 666 | - $result2=$object->updateSoldeCP($object->fk_user, $newSolde, $object->fk_type); |
|
| 666 | + $result2 = $object->updateSoldeCP($object->fk_user, $newSolde, $object->fk_type); |
|
| 667 | 667 | |
| 668 | 668 | if ($result1 < 0 || $result2 < 0) |
| 669 | 669 | { |
@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | } |
| 673 | 673 | } |
| 674 | 674 | |
| 675 | - if (! $error) |
|
| 675 | + if (!$error) |
|
| 676 | 676 | { |
| 677 | 677 | $db->commit(); |
| 678 | 678 | } |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | // Si pas d'erreur SQL on redirige vers la fiche de la demande |
| 685 | - if (! $error && $result > 0) |
|
| 685 | + if (!$error && $result > 0) |
|
| 686 | 686 | { |
| 687 | 687 | // To |
| 688 | 688 | $destinataire = new User($db); |
@@ -702,31 +702,31 @@ discard block |
||
| 702 | 702 | |
| 703 | 703 | // Subject |
| 704 | 704 | $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; |
| 705 | - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 705 | + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 706 | 706 | |
| 707 | 707 | $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysCanceled"); |
| 708 | 708 | |
| 709 | 709 | // Content |
| 710 | 710 | $message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n"; |
| 711 | - $message.= "\n"; |
|
| 711 | + $message .= "\n"; |
|
| 712 | 712 | |
| 713 | - $message.= $langs->transnoentities("HolidaysCanceledBody", dol_print_date($object->date_debut,'day'), dol_print_date($object->date_fin,'day'))."\n"; |
|
| 714 | - $message.= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; |
|
| 713 | + $message .= $langs->transnoentities("HolidaysCanceledBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."\n"; |
|
| 714 | + $message .= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; |
|
| 715 | 715 | |
| 716 | - $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n"; |
|
| 717 | - $message.= "\n"; |
|
| 716 | + $message .= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n"; |
|
| 717 | + $message .= "\n"; |
|
| 718 | 718 | |
| 719 | - $trackid='leav'.$object->id; |
|
| 719 | + $trackid = 'leav'.$object->id; |
|
| 720 | 720 | |
| 721 | 721 | $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid); |
| 722 | 722 | |
| 723 | 723 | // Envoi du mail |
| 724 | - $result=$mail->sendfile(); |
|
| 724 | + $result = $mail->sendfile(); |
|
| 725 | 725 | |
| 726 | 726 | if (!$result) |
| 727 | 727 | { |
| 728 | 728 | setEventMessages($mail->error, $mail->errors, 'warnings'); |
| 729 | - $action=''; |
|
| 729 | + $action = ''; |
|
| 730 | 730 | } |
| 731 | 731 | else |
| 732 | 732 | { |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | $form = new Form($db); |
| 748 | 748 | $object = new Holiday($db); |
| 749 | 749 | |
| 750 | -$listhalfday=array('morning'=>$langs->trans("Morning"),"afternoon"=>$langs->trans("Afternoon")); |
|
| 750 | +$listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->trans("Afternoon")); |
|
| 751 | 751 | |
| 752 | 752 | llxHeader('', $langs->trans('CPTitreMenu')); |
| 753 | 753 | |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | // Si l'utilisateur n'a pas le droit de faire une demande |
| 757 | 757 | if (($fuserid == $user->id && empty($user->rights->holiday->write)) || ($fuserid != $user->id && empty($user->rights->holiday->write_all))) |
| 758 | 758 | { |
| 759 | - $errors[]=$langs->trans('CantCreateCP'); |
|
| 759 | + $errors[] = $langs->trans('CantCreateCP'); |
|
| 760 | 760 | } |
| 761 | 761 | else |
| 762 | 762 | { |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | // Si il y a une erreur |
| 767 | 767 | if (GETPOST('error')) { |
| 768 | 768 | |
| 769 | - switch(GETPOST('error')) { |
|
| 769 | + switch (GETPOST('error')) { |
|
| 770 | 770 | case 'datefin' : |
| 771 | 771 | $errors[] = $langs->trans('ErrorEndDateCP'); |
| 772 | 772 | break; |
@@ -839,20 +839,20 @@ discard block |
||
| 839 | 839 | { |
| 840 | 840 | dol_fiche_head('', '', '', -1); |
| 841 | 841 | |
| 842 | - $out=''; |
|
| 843 | - $typeleaves=$object->getTypes(1,1); |
|
| 844 | - foreach($typeleaves as $key => $val) |
|
| 842 | + $out = ''; |
|
| 843 | + $typeleaves = $object->getTypes(1, 1); |
|
| 844 | + foreach ($typeleaves as $key => $val) |
|
| 845 | 845 | { |
| 846 | 846 | $nb_type = $object->getCPforUser($user->id, $val['rowid']); |
| 847 | 847 | $nb_holiday += $nb_type; |
| 848 | - $out .= ' - '.$val['label'].': <strong>'.($nb_type?price2num($nb_type):0).'</strong><br>'; |
|
| 848 | + $out .= ' - '.$val['label'].': <strong>'.($nb_type ?price2num($nb_type) : 0).'</strong><br>'; |
|
| 849 | 849 | } |
| 850 | - print $langs->trans('SoldeCPUser', round($nb_holiday,5)).'<br>'; |
|
| 850 | + print $langs->trans('SoldeCPUser', round($nb_holiday, 5)).'<br>'; |
|
| 851 | 851 | print $out; |
| 852 | 852 | |
| 853 | 853 | dol_fiche_end(); |
| 854 | 854 | } |
| 855 | - elseif(! is_numeric($conf->global->HOLIDAY_HIDE_BALANCE)) |
|
| 855 | + elseif (!is_numeric($conf->global->HOLIDAY_HIDE_BALANCE)) |
|
| 856 | 856 | { |
| 857 | 857 | print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE).'<br>'; |
| 858 | 858 | } |
@@ -870,10 +870,10 @@ discard block |
||
| 870 | 870 | print '<td>'; |
| 871 | 871 | if (empty($user->rights->holiday->write_all)) |
| 872 | 872 | { |
| 873 | - print $form->select_dolusers(($fuserid?$fuserid:$user->id), 'fuserid', 0, '', 0, 'hierarchyme', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth300'); |
|
| 873 | + print $form->select_dolusers(($fuserid ? $fuserid : $user->id), 'fuserid', 0, '', 0, 'hierarchyme', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth300'); |
|
| 874 | 874 | //print '<input type="hidden" name="fuserid" value="'.($fuserid?$fuserid:$user->id).'">'; |
| 875 | 875 | } |
| 876 | - else print $form->select_dolusers(GETPOST('fuserid','int')?GETPOST('fuserid','int'):$user->id, 'fuserid', 0, '', 0, '', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth300'); |
|
| 876 | + else print $form->select_dolusers(GETPOST('fuserid', 'int') ?GETPOST('fuserid', 'int') : $user->id, 'fuserid', 0, '', 0, '', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth300'); |
|
| 877 | 877 | print '</td>'; |
| 878 | 878 | print '</tr>'; |
| 879 | 879 | |
@@ -881,16 +881,16 @@ discard block |
||
| 881 | 881 | print '<tr>'; |
| 882 | 882 | print '<td class="fieldrequired">'.$langs->trans("Type").'</td>'; |
| 883 | 883 | print '<td>'; |
| 884 | - $typeleaves=$object->getTypes(1,-1); |
|
| 885 | - $arraytypeleaves=array(); |
|
| 886 | - foreach($typeleaves as $key => $val) |
|
| 884 | + $typeleaves = $object->getTypes(1, -1); |
|
| 885 | + $arraytypeleaves = array(); |
|
| 886 | + foreach ($typeleaves as $key => $val) |
|
| 887 | 887 | { |
| 888 | - $labeltoshow = ($langs->trans($val['code'])!=$val['code'] ? $langs->trans($val['code']) : $val['label']); |
|
| 889 | - $labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':''); |
|
| 890 | - $arraytypeleaves[$val['rowid']]=$labeltoshow; |
|
| 888 | + $labeltoshow = ($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']); |
|
| 889 | + $labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')' : ''); |
|
| 890 | + $arraytypeleaves[$val['rowid']] = $labeltoshow; |
|
| 891 | 891 | } |
| 892 | - print $form->selectarray('type', $arraytypeleaves, (GETPOST('type','alpha')?GETPOST('type','alpha'):''), 1); |
|
| 893 | - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
| 892 | + print $form->selectarray('type', $arraytypeleaves, (GETPOST('type', 'alpha') ?GETPOST('type', 'alpha') : ''), 1); |
|
| 893 | + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
| 894 | 894 | print '</td>'; |
| 895 | 895 | print '</tr>'; |
| 896 | 896 | |
@@ -902,14 +902,14 @@ discard block |
||
| 902 | 902 | print '</td>'; |
| 903 | 903 | print '<td>'; |
| 904 | 904 | // Si la demande ne vient pas de l'agenda |
| 905 | - if (! GETPOST('date_debut_')) { |
|
| 905 | + if (!GETPOST('date_debut_')) { |
|
| 906 | 906 | $form->select_date(-1, 'date_debut_', 0, 0, 0, '', 1, 1); |
| 907 | 907 | } else { |
| 908 | - $tmpdate = dol_mktime(0, 0, 0, GETPOST('date_debut_month','int'), GETPOST('date_debut_day','int'), GETPOST('date_debut_year','int')); |
|
| 908 | + $tmpdate = dol_mktime(0, 0, 0, GETPOST('date_debut_month', 'int'), GETPOST('date_debut_day', 'int'), GETPOST('date_debut_year', 'int')); |
|
| 909 | 909 | $form->select_date($tmpdate, 'date_debut_', 0, 0, 0, '', 1, 1); |
| 910 | 910 | } |
| 911 | 911 | print ' '; |
| 912 | - print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday','alpha')?GETPOST('starthalfday','alpha'):'morning')); |
|
| 912 | + print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday', 'alpha') ?GETPOST('starthalfday', 'alpha') : 'morning')); |
|
| 913 | 913 | print '</td>'; |
| 914 | 914 | print '</tr>'; |
| 915 | 915 | |
@@ -921,14 +921,14 @@ discard block |
||
| 921 | 921 | print '</td>'; |
| 922 | 922 | print '<td>'; |
| 923 | 923 | // Si la demande ne vient pas de l'agenda |
| 924 | - if (! GETPOST('date_fin_')) { |
|
| 925 | - $form->select_date(-1,'date_fin_', 0, 0, 0, '', 1, 1); |
|
| 924 | + if (!GETPOST('date_fin_')) { |
|
| 925 | + $form->select_date(-1, 'date_fin_', 0, 0, 0, '', 1, 1); |
|
| 926 | 926 | } else { |
| 927 | - $tmpdate = dol_mktime(0, 0, 0, GETPOST('date_fin_month','int'), GETPOST('date_fin_day','int'), GETPOST('date_fin_year','int')); |
|
| 928 | - $form->select_date($tmpdate,'date_fin_', 0, 0, 0, '', 1, 1); |
|
| 927 | + $tmpdate = dol_mktime(0, 0, 0, GETPOST('date_fin_month', 'int'), GETPOST('date_fin_day', 'int'), GETPOST('date_fin_year', 'int')); |
|
| 928 | + $form->select_date($tmpdate, 'date_fin_', 0, 0, 0, '', 1, 1); |
|
| 929 | 929 | } |
| 930 | 930 | print ' '; |
| 931 | - print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday','alpha')?GETPOST('endhalfday','alpha'):'afternoon')); |
|
| 931 | + print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday', 'alpha') ?GETPOST('endhalfday', 'alpha') : 'afternoon')); |
|
| 932 | 932 | print '</td>'; |
| 933 | 933 | print '</tr>'; |
| 934 | 934 | |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | print '<tr>'; |
| 937 | 937 | print '<td class="fieldrequired">'.$langs->trans("ReviewedByCP").'</td>'; |
| 938 | 938 | print '<td>'; |
| 939 | - print $form->select_dolusers((GETPOST('valideur','int')>0?GETPOST('valideur','int'):$user->fk_user), "valideur", 1, ($user->admin ? '' : array($user->id)), 0, '', 0, 0, 0, 0, '', 0, '', '', 1); // By default, hierarchical parent |
|
| 939 | + print $form->select_dolusers((GETPOST('valideur', 'int') > 0 ?GETPOST('valideur', 'int') : $user->fk_user), "valideur", 1, ($user->admin ? '' : array($user->id)), 0, '', 0, 0, 0, 0, '', 0, '', '', 1); // By default, hierarchical parent |
|
| 940 | 940 | print '</td>'; |
| 941 | 941 | print '</tr>'; |
| 942 | 942 | |
@@ -944,7 +944,7 @@ discard block |
||
| 944 | 944 | print '<tr>'; |
| 945 | 945 | print '<td>'.$langs->trans("DescCP").'</td>'; |
| 946 | 946 | print '<td class="tdtop">'; |
| 947 | - $doleditor = new DolEditor('description', GETPOST('description','none'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); |
|
| 947 | + $doleditor = new DolEditor('description', GETPOST('description', 'none'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); |
|
| 948 | 948 | print $doleditor->Create(1); |
| 949 | 949 | print '</td></tr>'; |
| 950 | 950 | |
@@ -989,7 +989,7 @@ discard block |
||
| 989 | 989 | // Si il y a une erreur |
| 990 | 990 | if (GETPOST('error')) |
| 991 | 991 | { |
| 992 | - switch(GETPOST('error')) |
|
| 992 | + switch (GETPOST('error')) |
|
| 993 | 993 | { |
| 994 | 994 | case 'datefin' : |
| 995 | 995 | $errors[] = $langs->transnoentitiesnoconv('ErrorEndDateCP'); |
@@ -1026,7 +1026,7 @@ discard block |
||
| 1026 | 1026 | // On vérifie si l'utilisateur à le droit de lire cette demande |
| 1027 | 1027 | if ($cancreate) |
| 1028 | 1028 | { |
| 1029 | - $head=holiday_prepare_head($object); |
|
| 1029 | + $head = holiday_prepare_head($object); |
|
| 1030 | 1030 | |
| 1031 | 1031 | if ($action == 'edit' && $object->statut == 1) |
| 1032 | 1032 | { |
@@ -1038,7 +1038,7 @@ discard block |
||
| 1038 | 1038 | |
| 1039 | 1039 | dol_fiche_head($head, 'card', $langs->trans("CPTitreMenu"), -1, 'holiday'); |
| 1040 | 1040 | |
| 1041 | - $linkback='<a href="'.DOL_URL_ROOT.'/holiday/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
|
| 1041 | + $linkback = '<a href="'.DOL_URL_ROOT.'/holiday/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
|
| 1042 | 1042 | |
| 1043 | 1043 | dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref'); |
| 1044 | 1044 | |
@@ -1061,20 +1061,20 @@ discard block |
||
| 1061 | 1061 | print '<tr>'; |
| 1062 | 1062 | print '<td>'.$langs->trans("Type").'</td>'; |
| 1063 | 1063 | print '<td>'; |
| 1064 | - $typeleaves=$object->getTypes(1,-1); |
|
| 1065 | - $labeltoshow = (($typeleaves[$object->fk_type]['code'] && $langs->trans($typeleaves[$object->fk_type]['code'])!=$typeleaves[$object->fk_type]['code']) ? $langs->trans($typeleaves[$object->fk_type]['code']) : $typeleaves[$object->fk_type]['label']); |
|
| 1066 | - print empty($labeltoshow) ? $langs->trans("TypeWasDisabledOrRemoved",$object->fk_type) : $labeltoshow; |
|
| 1064 | + $typeleaves = $object->getTypes(1, -1); |
|
| 1065 | + $labeltoshow = (($typeleaves[$object->fk_type]['code'] && $langs->trans($typeleaves[$object->fk_type]['code']) != $typeleaves[$object->fk_type]['code']) ? $langs->trans($typeleaves[$object->fk_type]['code']) : $typeleaves[$object->fk_type]['label']); |
|
| 1066 | + print empty($labeltoshow) ? $langs->trans("TypeWasDisabledOrRemoved", $object->fk_type) : $labeltoshow; |
|
| 1067 | 1067 | print '</td>'; |
| 1068 | 1068 | print '</tr>'; |
| 1069 | 1069 | |
| 1070 | - $starthalfday=($object->halfday == -1 || $object->halfday == 2)?'afternoon':'morning'; |
|
| 1071 | - $endhalfday=($object->halfday == 1 || $object->halfday == 2)?'morning':'afternoon'; |
|
| 1070 | + $starthalfday = ($object->halfday == -1 || $object->halfday == 2) ? 'afternoon' : 'morning'; |
|
| 1071 | + $endhalfday = ($object->halfday == 1 || $object->halfday == 2) ? 'morning' : 'afternoon'; |
|
| 1072 | 1072 | |
| 1073 | - if(!$edit) |
|
| 1073 | + if (!$edit) |
|
| 1074 | 1074 | { |
| 1075 | 1075 | print '<tr>'; |
| 1076 | 1076 | print '<td class="nowrap">'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>'; |
| 1077 | - print '<td>'.dol_print_date($object->date_debut,'day'); |
|
| 1077 | + print '<td>'.dol_print_date($object->date_debut, 'day'); |
|
| 1078 | 1078 | print ' '; |
| 1079 | 1079 | print '<span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).'</span>'; |
| 1080 | 1080 | print '</td>'; |
@@ -1085,9 +1085,9 @@ discard block |
||
| 1085 | 1085 | print '<tr>'; |
| 1086 | 1086 | print '<td class="nowrap">'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>'; |
| 1087 | 1087 | print '<td>'; |
| 1088 | - $form->select_date($object->date_debut,'date_debut_'); |
|
| 1088 | + $form->select_date($object->date_debut, 'date_debut_'); |
|
| 1089 | 1089 | print ' '; |
| 1090 | - print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday')?GETPOST('starthalfday'):$starthalfday)); |
|
| 1090 | + print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday') ?GETPOST('starthalfday') : $starthalfday)); |
|
| 1091 | 1091 | print '</td>'; |
| 1092 | 1092 | print '</tr>'; |
| 1093 | 1093 | } |
@@ -1096,7 +1096,7 @@ discard block |
||
| 1096 | 1096 | { |
| 1097 | 1097 | print '<tr>'; |
| 1098 | 1098 | print '<td class="nowrap">'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>'; |
| 1099 | - print '<td>'.dol_print_date($object->date_fin,'day'); |
|
| 1099 | + print '<td>'.dol_print_date($object->date_fin, 'day'); |
|
| 1100 | 1100 | print ' '; |
| 1101 | 1101 | print '<span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).'</span>'; |
| 1102 | 1102 | print '</td>'; |
@@ -1107,9 +1107,9 @@ discard block |
||
| 1107 | 1107 | print '<tr>'; |
| 1108 | 1108 | print '<td class="nowrap">'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>'; |
| 1109 | 1109 | print '<td>'; |
| 1110 | - $form->select_date($object->date_fin,'date_fin_'); |
|
| 1110 | + $form->select_date($object->date_fin, 'date_fin_'); |
|
| 1111 | 1111 | print ' '; |
| 1112 | - print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday')?GETPOST('endhalfday'):$endhalfday)); |
|
| 1112 | + print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday') ?GETPOST('endhalfday') : $endhalfday)); |
|
| 1113 | 1113 | print '</td>'; |
| 1114 | 1114 | print '</tr>'; |
| 1115 | 1115 | } |
@@ -1158,9 +1158,9 @@ discard block |
||
| 1158 | 1158 | print '<table class="border centpercent">'."\n"; |
| 1159 | 1159 | print '<tbody>'; |
| 1160 | 1160 | |
| 1161 | - if (! empty($object->fk_user_create)) |
|
| 1161 | + if (!empty($object->fk_user_create)) |
|
| 1162 | 1162 | { |
| 1163 | - $userCreate=new User($db); |
|
| 1163 | + $userCreate = new User($db); |
|
| 1164 | 1164 | $userCreate->fetch($object->fk_user_create); |
| 1165 | 1165 | print '<tr>'; |
| 1166 | 1166 | print '<td class="titlefield">'.$langs->trans('RequestByCP').'</td>'; |
@@ -1181,31 +1181,31 @@ discard block |
||
| 1181 | 1181 | print '<tr>'; |
| 1182 | 1182 | print '<td class="titlefield">'.$langs->trans('ReviewedByCP').'</td>'; |
| 1183 | 1183 | print '<td>'; |
| 1184 | - print $form->select_dolusers($object->fk_validator, "valideur", 1, ($user->admin ? '' : array($user->id))); // By default, hierarchical parent |
|
| 1184 | + print $form->select_dolusers($object->fk_validator, "valideur", 1, ($user->admin ? '' : array($user->id))); // By default, hierarchical parent |
|
| 1185 | 1185 | print '</td>'; |
| 1186 | 1186 | print '</tr>'; |
| 1187 | 1187 | } |
| 1188 | 1188 | |
| 1189 | 1189 | print '<tr>'; |
| 1190 | 1190 | print '<td>'.$langs->trans('DateCreateCP').'</td>'; |
| 1191 | - print '<td>'.dol_print_date($object->date_create,'dayhour').'</td>'; |
|
| 1191 | + print '<td>'.dol_print_date($object->date_create, 'dayhour').'</td>'; |
|
| 1192 | 1192 | print '</tr>'; |
| 1193 | 1193 | if ($object->statut == 3 || $object->statut == 4) { |
| 1194 | 1194 | print '<tr>'; |
| 1195 | 1195 | print '<td>'.$langs->trans('DateValidCP').'</td>'; |
| 1196 | - print '<td>'.dol_print_date($object->date_valid,'dayhour').'</td>'; // warning: date_valid is approval date on holiday module |
|
| 1196 | + print '<td>'.dol_print_date($object->date_valid, 'dayhour').'</td>'; // warning: date_valid is approval date on holiday module |
|
| 1197 | 1197 | print '</tr>'; |
| 1198 | 1198 | } |
| 1199 | 1199 | if ($object->statut == 4) { |
| 1200 | 1200 | print '<tr>'; |
| 1201 | 1201 | print '<td>'.$langs->trans('DateCancelCP').'</td>'; |
| 1202 | - print '<td>'.dol_print_date($object->date_cancel,'dayhour').'</td>'; |
|
| 1202 | + print '<td>'.dol_print_date($object->date_cancel, 'dayhour').'</td>'; |
|
| 1203 | 1203 | print '</tr>'; |
| 1204 | 1204 | } |
| 1205 | 1205 | if ($object->statut == 5) { |
| 1206 | 1206 | print '<tr>'; |
| 1207 | 1207 | print '<td>'.$langs->trans('DateRefusCP').'</td>'; |
| 1208 | - print '<td>'.dol_print_date($object->date_refuse,'dayhour').'</td>'; |
|
| 1208 | + print '<td>'.dol_print_date($object->date_refuse, 'dayhour').'</td>'; |
|
| 1209 | 1209 | print '</tr>'; |
| 1210 | 1210 | } |
| 1211 | 1211 | print '</tbody>'; |
@@ -1225,39 +1225,39 @@ discard block |
||
| 1225 | 1225 | { |
| 1226 | 1226 | if ($user->rights->holiday->delete) |
| 1227 | 1227 | { |
| 1228 | - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("TitleDeleteCP"),$langs->trans("ConfirmDeleteCP"),"confirm_delete", '', 0, 1); |
|
| 1228 | + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("TitleDeleteCP"), $langs->trans("ConfirmDeleteCP"), "confirm_delete", '', 0, 1); |
|
| 1229 | 1229 | } |
| 1230 | 1230 | } |
| 1231 | 1231 | |
| 1232 | 1232 | // Si envoi en validation |
| 1233 | 1233 | if ($action == 'sendToValidate' && $object->statut == 1) |
| 1234 | 1234 | { |
| 1235 | - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("TitleToValidCP"),$langs->trans("ConfirmToValidCP"),"confirm_send", '', 1, 1); |
|
| 1235 | + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("TitleToValidCP"), $langs->trans("ConfirmToValidCP"), "confirm_send", '', 1, 1); |
|
| 1236 | 1236 | } |
| 1237 | 1237 | |
| 1238 | 1238 | // Si validation de la demande |
| 1239 | 1239 | if ($action == 'valid') |
| 1240 | 1240 | { |
| 1241 | - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("TitleValidCP"),$langs->trans("ConfirmValidCP"),"confirm_valid", '', 1, 1); |
|
| 1241 | + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("TitleValidCP"), $langs->trans("ConfirmValidCP"), "confirm_valid", '', 1, 1); |
|
| 1242 | 1242 | } |
| 1243 | 1243 | |
| 1244 | 1244 | // Si refus de la demande |
| 1245 | 1245 | if ($action == 'refuse') |
| 1246 | 1246 | { |
| 1247 | - $array_input = array(array('type'=>"text",'label'=> $langs->trans('DetailRefusCP'),'name'=>"detail_refuse",'size'=>"50",'value'=>"")); |
|
| 1247 | + $array_input = array(array('type'=>"text", 'label'=> $langs->trans('DetailRefusCP'), 'name'=>"detail_refuse", 'size'=>"50", 'value'=>"")); |
|
| 1248 | 1248 | print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&action=confirm_refuse", $langs->trans("TitleRefuseCP"), $langs->trans('ConfirmRefuseCP'), "confirm_refuse", $array_input, 1, 0); |
| 1249 | 1249 | } |
| 1250 | 1250 | |
| 1251 | 1251 | // Si annulation de la demande |
| 1252 | 1252 | if ($action == 'cancel') |
| 1253 | 1253 | { |
| 1254 | - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("TitleCancelCP"),$langs->trans("ConfirmCancelCP"),"confirm_cancel", '', 1, 1); |
|
| 1254 | + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("TitleCancelCP"), $langs->trans("ConfirmCancelCP"), "confirm_cancel", '', 1, 1); |
|
| 1255 | 1255 | } |
| 1256 | 1256 | |
| 1257 | 1257 | // Si back to draft |
| 1258 | 1258 | if ($action == 'backtodraft') |
| 1259 | 1259 | { |
| 1260 | - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("TitleSetToDraft"),$langs->trans("ConfirmSetToDraft"),"confirm_draft", '', 1, 1); |
|
| 1260 | + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("TitleSetToDraft"), $langs->trans("ConfirmSetToDraft"), "confirm_draft", '', 1, 1); |
|
| 1261 | 1261 | } |
| 1262 | 1262 | |
| 1263 | 1263 | |
@@ -1274,7 +1274,7 @@ discard block |
||
| 1274 | 1274 | } |
| 1275 | 1275 | |
| 1276 | 1276 | |
| 1277 | - if (! $edit) |
|
| 1277 | + if (!$edit) |
|
| 1278 | 1278 | { |
| 1279 | 1279 | print '<div class="tabsAction">'; |
| 1280 | 1280 | |
@@ -1306,7 +1306,7 @@ discard block |
||
| 1306 | 1306 | } |
| 1307 | 1307 | } |
| 1308 | 1308 | |
| 1309 | - if (($user->id == $object->fk_validator || in_array($object->fk_user, $childids) || ! empty($user->rights->holiday->write_all)) && ($object->statut == 2 || $object->statut == 3)) // Status validated or approved |
|
| 1309 | + if (($user->id == $object->fk_validator || in_array($object->fk_user, $childids) || !empty($user->rights->holiday->write_all)) && ($object->statut == 2 || $object->statut == 3)) // Status validated or approved |
|
| 1310 | 1310 | { |
| 1311 | 1311 | if (($object->date_debut > dol_now()) || $user->admin) print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel" class="butAction">'.$langs->trans("ActionCancelCP").'</a>'; |
| 1312 | 1312 | else print '<a href="#" class="butActionRefused" title="'.$langs->trans("HolidayStarted").'">'.$langs->trans("ActionCancelCP").'</a>'; |
@@ -44,7 +44,9 @@ discard block |
||
| 44 | 44 | $fuserid = (GETPOST('fuserid','int')?GETPOST('fuserid','int'):$user->id); |
| 45 | 45 | |
| 46 | 46 | // Protection if external user |
| 47 | -if ($user->societe_id > 0) accessforbidden(); |
|
| 47 | +if ($user->societe_id > 0) { |
|
| 48 | + accessforbidden(); |
|
| 49 | +} |
|
| 48 | 50 | |
| 49 | 51 | $now=dol_now(); |
| 50 | 52 | |
@@ -53,14 +55,22 @@ discard block |
||
| 53 | 55 | $childids = $user->getAllChildIds(1); |
| 54 | 56 | |
| 55 | 57 | $cancreate = 0; |
| 56 | -if (! empty($user->rights->holiday->write_all)) $cancreate=1; |
|
| 57 | -if (! empty($user->rights->holiday->write) && in_array($fuserid, $childids)) $cancreate=1; |
|
| 58 | +if (! empty($user->rights->holiday->write_all)) { |
|
| 59 | + $cancreate=1; |
|
| 60 | +} |
|
| 61 | +if (! empty($user->rights->holiday->write) && in_array($fuserid, $childids)) { |
|
| 62 | + $cancreate=1; |
|
| 63 | +} |
|
| 58 | 64 | |
| 59 | 65 | $candelete = 0; |
| 60 | -if (! empty($user->rights->holiday->delete)) $candelete=1; |
|
| 66 | +if (! empty($user->rights->holiday->delete)) { |
|
| 67 | + $candelete=1; |
|
| 68 | +} |
|
| 61 | 69 | |
| 62 | 70 | $morefilter = 'AND employee = 1'; |
| 63 | -if (! empty($conf->global->HOLIDAY_FOR_NON_SALARIES_TOO)) $morefilter = ''; |
|
| 71 | +if (! empty($conf->global->HOLIDAY_FOR_NON_SALARIES_TOO)) { |
|
| 72 | + $morefilter = ''; |
|
| 73 | +} |
|
| 64 | 74 | |
| 65 | 75 | |
| 66 | 76 | /* |
@@ -92,9 +102,13 @@ discard block |
||
| 92 | 102 | $endhalfday=GETPOST('endhalfday'); |
| 93 | 103 | $type=GETPOST('type'); |
| 94 | 104 | $halfday=0; |
| 95 | - if ($starthalfday == 'afternoon' && $endhalfday == 'morning') $halfday=2; |
|
| 96 | - else if ($starthalfday == 'afternoon') $halfday=-1; |
|
| 97 | - else if ($endhalfday == 'morning') $halfday=1; |
|
| 105 | + if ($starthalfday == 'afternoon' && $endhalfday == 'morning') { |
|
| 106 | + $halfday=2; |
|
| 107 | + } else if ($starthalfday == 'afternoon') { |
|
| 108 | + $halfday=-1; |
|
| 109 | + } else if ($endhalfday == 'morning') { |
|
| 110 | + $halfday=1; |
|
| 111 | + } |
|
| 98 | 112 | |
| 99 | 113 | $valideur = GETPOST('valideur'); |
| 100 | 114 | $description = trim(GETPOST('description')); |
@@ -181,8 +195,7 @@ discard block |
||
| 181 | 195 | |
| 182 | 196 | header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
| 183 | 197 | exit; |
| 184 | - } |
|
| 185 | - else |
|
| 198 | + } else |
|
| 186 | 199 | { |
| 187 | 200 | $db->rollback(); |
| 188 | 201 | } |
@@ -198,9 +211,13 @@ discard block |
||
| 198 | 211 | $starthalfday=GETPOST('starthalfday'); |
| 199 | 212 | $endhalfday=GETPOST('endhalfday'); |
| 200 | 213 | $halfday=0; |
| 201 | - if ($starthalfday == 'afternoon' && $endhalfday == 'morning') $halfday=2; |
|
| 202 | - else if ($starthalfday == 'afternoon') $halfday=-1; |
|
| 203 | - else if ($endhalfday == 'morning') $halfday=1; |
|
| 214 | + if ($starthalfday == 'afternoon' && $endhalfday == 'morning') { |
|
| 215 | + $halfday=2; |
|
| 216 | + } else if ($starthalfday == 'afternoon') { |
|
| 217 | + $halfday=-1; |
|
| 218 | + } else if ($endhalfday == 'morning') { |
|
| 219 | + $halfday=1; |
|
| 220 | + } |
|
| 204 | 221 | |
| 205 | 222 | // If no right to modify a request |
| 206 | 223 | if (! $user->rights->holiday->write) |
@@ -266,20 +283,17 @@ discard block |
||
| 266 | 283 | { |
| 267 | 284 | setEventMessages($object->error, $object->errors, 'warnings'); |
| 268 | 285 | $action='edit'; |
| 269 | - } |
|
| 270 | - else |
|
| 286 | + } else |
|
| 271 | 287 | { |
| 272 | 288 | header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
| 273 | 289 | exit; |
| 274 | 290 | } |
| 275 | - } |
|
| 276 | - else |
|
| 291 | + } else |
|
| 277 | 292 | { |
| 278 | 293 | setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors'); |
| 279 | 294 | $action=''; |
| 280 | 295 | } |
| 281 | - } |
|
| 282 | - else |
|
| 296 | + } else |
|
| 283 | 297 | { |
| 284 | 298 | setEventMessages($langs->trans("ErrorBadStatus"), null, 'errors'); |
| 285 | 299 | $action=''; |
@@ -303,8 +317,7 @@ discard block |
||
| 303 | 317 | if ($candelete) |
| 304 | 318 | { |
| 305 | 319 | $result=$object->delete($user); |
| 306 | - } |
|
| 307 | - else |
|
| 320 | + } else |
|
| 308 | 321 | { |
| 309 | 322 | $error++; |
| 310 | 323 | setEventMessages($langs->trans('ErrorCantDeleteCP'), null, 'errors'); |
@@ -317,8 +330,7 @@ discard block |
||
| 317 | 330 | $db->commit(); |
| 318 | 331 | header('Location: list.php?restore_lastsearch_values=1'); |
| 319 | 332 | exit; |
| 320 | - } |
|
| 321 | - else |
|
| 333 | + } else |
|
| 322 | 334 | { |
| 323 | 335 | $db->rollback(); |
| 324 | 336 | } |
@@ -359,7 +371,9 @@ discard block |
||
| 359 | 371 | |
| 360 | 372 | // Subject |
| 361 | 373 | $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; |
| 362 | - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 374 | + if (! empty($conf->global->MAIN_APPLICATION_TITLE)) { |
|
| 375 | + $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 376 | + } |
|
| 363 | 377 | |
| 364 | 378 | $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysToValidate"); |
| 365 | 379 | |
@@ -411,14 +425,12 @@ discard block |
||
| 411 | 425 | { |
| 412 | 426 | setEventMessages($mail->error, $mail->errors, 'warnings'); |
| 413 | 427 | $action=''; |
| 414 | - } |
|
| 415 | - else |
|
| 428 | + } else |
|
| 416 | 429 | { |
| 417 | 430 | header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
| 418 | 431 | exit; |
| 419 | 432 | } |
| 420 | - } |
|
| 421 | - else |
|
| 433 | + } else |
|
| 422 | 434 | { |
| 423 | 435 | setEventMessages($object->error, $object->errors, 'errors'); |
| 424 | 436 | $action=''; |
@@ -476,7 +488,9 @@ discard block |
||
| 476 | 488 | |
| 477 | 489 | // Subject |
| 478 | 490 | $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; |
| 479 | - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 491 | + if (! empty($conf->global->MAIN_APPLICATION_TITLE)) { |
|
| 492 | + $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 493 | + } |
|
| 480 | 494 | |
| 481 | 495 | $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysValidated"); |
| 482 | 496 | |
@@ -501,14 +515,12 @@ discard block |
||
| 501 | 515 | { |
| 502 | 516 | setEventMessages($mail->error, $mail->errors, 'warnings'); |
| 503 | 517 | $action=''; |
| 504 | - } |
|
| 505 | - else |
|
| 518 | + } else |
|
| 506 | 519 | { |
| 507 | 520 | header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
| 508 | 521 | exit; |
| 509 | 522 | } |
| 510 | - } |
|
| 511 | - else |
|
| 523 | + } else |
|
| 512 | 524 | { |
| 513 | 525 | setEventMessages($object->error, $object->errors, 'errors'); |
| 514 | 526 | $action=''; |
@@ -554,7 +566,9 @@ discard block |
||
| 554 | 566 | |
| 555 | 567 | // Subject |
| 556 | 568 | $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; |
| 557 | - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 569 | + if (! empty($conf->global->MAIN_APPLICATION_TITLE)) { |
|
| 570 | + $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 571 | + } |
|
| 558 | 572 | |
| 559 | 573 | $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysRefused"); |
| 560 | 574 | |
@@ -580,14 +594,12 @@ discard block |
||
| 580 | 594 | { |
| 581 | 595 | setEventMessages($mail->error, $mail->errors, 'warnings'); |
| 582 | 596 | $action=''; |
| 583 | - } |
|
| 584 | - else |
|
| 597 | + } else |
|
| 585 | 598 | { |
| 586 | 599 | header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
| 587 | 600 | exit; |
| 588 | 601 | } |
| 589 | - } |
|
| 590 | - else |
|
| 602 | + } else |
|
| 591 | 603 | { |
| 592 | 604 | setEventMessages($object->error, $object->errors, 'errors'); |
| 593 | 605 | $action=''; |
@@ -624,8 +636,7 @@ discard block |
||
| 624 | 636 | |
| 625 | 637 | header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
| 626 | 638 | exit; |
| 627 | - } |
|
| 628 | - else |
|
| 639 | + } else |
|
| 629 | 640 | { |
| 630 | 641 | $db->rollback(); |
| 631 | 642 | } |
@@ -651,10 +662,12 @@ discard block |
||
| 651 | 662 | |
| 652 | 663 | $result = $object->update($user); |
| 653 | 664 | |
| 654 | - if ($result >= 0 && $oldstatus == 3) // holiday was already validated, status 3, so we must increase back sold |
|
| 665 | + if ($result >= 0 && $oldstatus == 3) { |
|
| 666 | + // holiday was already validated, status 3, so we must increase back sold |
|
| 655 | 667 | { |
| 656 | 668 | // Calculcate number of days consummed |
| 657 | 669 | $nbopenedday=num_open_day($object->date_debut_gmt,$object->date_fin_gmt,0,1,$object->halfday); |
| 670 | + } |
|
| 658 | 671 | |
| 659 | 672 | $soldeActuel = $object->getCpforUser($object->fk_user, $object->fk_type); |
| 660 | 673 | $newSolde = $soldeActuel + ($nbopenedday * $object->getConfCP('nbHolidayDeducted')); |
@@ -675,8 +688,7 @@ discard block |
||
| 675 | 688 | if (! $error) |
| 676 | 689 | { |
| 677 | 690 | $db->commit(); |
| 678 | - } |
|
| 679 | - else |
|
| 691 | + } else |
|
| 680 | 692 | { |
| 681 | 693 | $db->rollback(); |
| 682 | 694 | } |
@@ -702,7 +714,9 @@ discard block |
||
| 702 | 714 | |
| 703 | 715 | // Subject |
| 704 | 716 | $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; |
| 705 | - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 717 | + if (! empty($conf->global->MAIN_APPLICATION_TITLE)) { |
|
| 718 | + $societeName = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 719 | + } |
|
| 706 | 720 | |
| 707 | 721 | $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysCanceled"); |
| 708 | 722 | |
@@ -727,8 +741,7 @@ discard block |
||
| 727 | 741 | { |
| 728 | 742 | setEventMessages($mail->error, $mail->errors, 'warnings'); |
| 729 | 743 | $action=''; |
| 730 | - } |
|
| 731 | - else |
|
| 744 | + } else |
|
| 732 | 745 | { |
| 733 | 746 | header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); |
| 734 | 747 | exit; |
@@ -757,8 +770,7 @@ discard block |
||
| 757 | 770 | if (($fuserid == $user->id && empty($user->rights->holiday->write)) || ($fuserid != $user->id && empty($user->rights->holiday->write_all))) |
| 758 | 771 | { |
| 759 | 772 | $errors[]=$langs->trans('CantCreateCP'); |
| 760 | - } |
|
| 761 | - else |
|
| 773 | + } else |
|
| 762 | 774 | { |
| 763 | 775 | // Formulaire de demande de congés payés |
| 764 | 776 | print load_fiche_titre($langs->trans('MenuAddCP'), '', 'title_hrm.png'); |
@@ -851,8 +863,7 @@ discard block |
||
| 851 | 863 | print $out; |
| 852 | 864 | |
| 853 | 865 | dol_fiche_end(); |
| 854 | - } |
|
| 855 | - elseif(! is_numeric($conf->global->HOLIDAY_HIDE_BALANCE)) |
|
| 866 | + } elseif(! is_numeric($conf->global->HOLIDAY_HIDE_BALANCE)) |
|
| 856 | 867 | { |
| 857 | 868 | print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE).'<br>'; |
| 858 | 869 | } |
@@ -872,8 +883,9 @@ discard block |
||
| 872 | 883 | { |
| 873 | 884 | print $form->select_dolusers(($fuserid?$fuserid:$user->id), 'fuserid', 0, '', 0, 'hierarchyme', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth300'); |
| 874 | 885 | //print '<input type="hidden" name="fuserid" value="'.($fuserid?$fuserid:$user->id).'">'; |
| 886 | + } else { |
|
| 887 | + print $form->select_dolusers(GETPOST('fuserid','int')?GETPOST('fuserid','int'):$user->id, 'fuserid', 0, '', 0, '', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth300'); |
|
| 875 | 888 | } |
| 876 | - else print $form->select_dolusers(GETPOST('fuserid','int')?GETPOST('fuserid','int'):$user->id, 'fuserid', 0, '', 0, '', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth300'); |
|
| 877 | 889 | print '</td>'; |
| 878 | 890 | print '</tr>'; |
| 879 | 891 | |
@@ -890,7 +902,9 @@ discard block |
||
| 890 | 902 | $arraytypeleaves[$val['rowid']]=$labeltoshow; |
| 891 | 903 | } |
| 892 | 904 | print $form->selectarray('type', $arraytypeleaves, (GETPOST('type','alpha')?GETPOST('type','alpha'):''), 1); |
| 893 | - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
| 905 | + if ($user->admin) { |
|
| 906 | + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
| 907 | + } |
|
| 894 | 908 | print '</td>'; |
| 895 | 909 | print '</tr>'; |
| 896 | 910 | |
@@ -961,8 +975,7 @@ discard block |
||
| 961 | 975 | |
| 962 | 976 | print '</from>'."\n"; |
| 963 | 977 | } |
| 964 | -} |
|
| 965 | -else |
|
| 978 | +} else |
|
| 966 | 979 | { |
| 967 | 980 | if ($error) |
| 968 | 981 | { |
@@ -970,8 +983,7 @@ discard block |
||
| 970 | 983 | print $error; |
| 971 | 984 | print '<br><br><input type="button" value="'.$langs->trans("ReturnCP").'" class="button" onclick="history.go(-1)" />'; |
| 972 | 985 | print '</div>'; |
| 973 | - } |
|
| 974 | - else |
|
| 986 | + } else |
|
| 975 | 987 | { |
| 976 | 988 | // Affichage de la fiche d'une demande de congés payés |
| 977 | 989 | if ($id > 0) |
@@ -1079,8 +1091,7 @@ discard block |
||
| 1079 | 1091 | print '<span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).'</span>'; |
| 1080 | 1092 | print '</td>'; |
| 1081 | 1093 | print '</tr>'; |
| 1082 | - } |
|
| 1083 | - else |
|
| 1094 | + } else |
|
| 1084 | 1095 | { |
| 1085 | 1096 | print '<tr>'; |
| 1086 | 1097 | print '<td class="nowrap">'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>'; |
@@ -1101,8 +1112,7 @@ discard block |
||
| 1101 | 1112 | print '<span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).'</span>'; |
| 1102 | 1113 | print '</td>'; |
| 1103 | 1114 | print '</tr>'; |
| 1104 | - } |
|
| 1105 | - else |
|
| 1115 | + } else |
|
| 1106 | 1116 | { |
| 1107 | 1117 | print '<tr>'; |
| 1108 | 1118 | print '<td class="nowrap">'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>'; |
@@ -1134,8 +1144,7 @@ discard block |
||
| 1134 | 1144 | print '<td>'.$langs->trans('DescCP').'</td>'; |
| 1135 | 1145 | print '<td>'.nl2br($object->description).'</td>'; |
| 1136 | 1146 | print '</tr>'; |
| 1137 | - } |
|
| 1138 | - else |
|
| 1147 | + } else |
|
| 1139 | 1148 | { |
| 1140 | 1149 | print '<tr>'; |
| 1141 | 1150 | print '<td>'.$langs->trans('DescCP').'</td>'; |
@@ -1172,8 +1181,11 @@ discard block |
||
| 1172 | 1181 | if (!$edit) { |
| 1173 | 1182 | print '<tr>'; |
| 1174 | 1183 | print '<td class="titlefield">'; |
| 1175 | - if ($object->statut == 3 || $object->statut == 4) print $langs->trans('ApprovedBy'); |
|
| 1176 | - else print $langs->trans('ReviewedByCP'); |
|
| 1184 | + if ($object->statut == 3 || $object->statut == 4) { |
|
| 1185 | + print $langs->trans('ApprovedBy'); |
|
| 1186 | + } else { |
|
| 1187 | + print $langs->trans('ReviewedByCP'); |
|
| 1188 | + } |
|
| 1177 | 1189 | print '</td>'; |
| 1178 | 1190 | print '<td>'.$valideur->getNomUrl(-1).'</td>'; |
| 1179 | 1191 | print '</tr>'; |
@@ -1283,33 +1295,41 @@ discard block |
||
| 1283 | 1295 | { |
| 1284 | 1296 | print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit" class="butAction">'.$langs->trans("EditCP").'</a>'; |
| 1285 | 1297 | } |
| 1286 | - if ($cancreate && $object->statut == 1) // If draft |
|
| 1298 | + if ($cancreate && $object->statut == 1) { |
|
| 1299 | + // If draft |
|
| 1287 | 1300 | { |
| 1288 | 1301 | print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=sendToValidate" class="butAction">'.$langs->trans("Validate").'</a>'; |
| 1289 | 1302 | } |
| 1290 | - if ($user->rights->holiday->delete && ($object->statut == 1 || $object->statut == 4 || $object->statut == 5)) // If draft or canceled or refused |
|
| 1303 | + } |
|
| 1304 | + if ($user->rights->holiday->delete && ($object->statut == 1 || $object->statut == 4 || $object->statut == 5)) { |
|
| 1305 | + // If draft or canceled or refused |
|
| 1291 | 1306 | { |
| 1292 | 1307 | print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete" class="butActionDelete">'.$langs->trans("DeleteCP").'</a>'; |
| 1293 | 1308 | } |
| 1309 | + } |
|
| 1294 | 1310 | |
| 1295 | - if ($object->statut == 2) // If validated |
|
| 1311 | + if ($object->statut == 2) { |
|
| 1312 | + // If validated |
|
| 1296 | 1313 | { |
| 1297 | 1314 | if ($user->id == $object->fk_validator) |
| 1298 | 1315 | { |
| 1299 | 1316 | print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid" class="butAction">'.$langs->trans("Approve").'</a>'; |
| 1317 | + } |
|
| 1300 | 1318 | print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=refuse" class="butAction">'.$langs->trans("ActionRefuseCP").'</a>'; |
| 1301 | - } |
|
| 1302 | - else |
|
| 1319 | + } else |
|
| 1303 | 1320 | { |
| 1304 | 1321 | print '<a href="#" class="butActionRefused" title="'.$langs->trans("NotTheAssignedApprover").'">'.$langs->trans("Approve").'</a>'; |
| 1305 | 1322 | print '<a href="#" class="butActionRefused" title="'.$langs->trans("NotTheAssignedApprover").'">'.$langs->trans("ActionRefuseCP").'</a>'; |
| 1306 | 1323 | } |
| 1307 | 1324 | } |
| 1308 | 1325 | |
| 1309 | - if (($user->id == $object->fk_validator || in_array($object->fk_user, $childids) || ! empty($user->rights->holiday->write_all)) && ($object->statut == 2 || $object->statut == 3)) // Status validated or approved |
|
| 1326 | + if (($user->id == $object->fk_validator || in_array($object->fk_user, $childids) || ! empty($user->rights->holiday->write_all)) && ($object->statut == 2 || $object->statut == 3)) { |
|
| 1327 | + // Status validated or approved |
|
| 1310 | 1328 | { |
| 1311 | 1329 | if (($object->date_debut > dol_now()) || $user->admin) print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel" class="butAction">'.$langs->trans("ActionCancelCP").'</a>'; |
| 1312 | - else print '<a href="#" class="butActionRefused" title="'.$langs->trans("HolidayStarted").'">'.$langs->trans("ActionCancelCP").'</a>'; |
|
| 1330 | + } else { |
|
| 1331 | + print '<a href="#" class="butActionRefused" title="'.$langs->trans("HolidayStarted").'">'.$langs->trans("ActionCancelCP").'</a>'; |
|
| 1332 | + } |
|
| 1313 | 1333 | } |
| 1314 | 1334 | |
| 1315 | 1335 | if ($cancreate && $object->statut == 4) |
@@ -1341,4 +1361,6 @@ discard block |
||
| 1341 | 1361 | // End of page |
| 1342 | 1362 | llxFooter(); |
| 1343 | 1363 | |
| 1344 | -if (is_object($db)) $db->close(); |
|
| 1364 | +if (is_object($db)) { |
|
| 1365 | + $db->close(); |
|
| 1366 | +} |
|
@@ -36,12 +36,12 @@ discard block |
||
| 36 | 36 | $langs->load("admin"); |
| 37 | 37 | $langs->load("members"); |
| 38 | 38 | |
| 39 | -if (! $user->admin) accessforbidden(); |
|
| 39 | +if (!$user->admin) accessforbidden(); |
|
| 40 | 40 | |
| 41 | 41 | |
| 42 | -$type=array('yesno','texte','chaine'); |
|
| 42 | +$type = array('yesno', 'texte', 'chaine'); |
|
| 43 | 43 | |
| 44 | -$action = GETPOST('action','alpha'); |
|
| 44 | +$action = GETPOST('action', 'alpha'); |
|
| 45 | 45 | |
| 46 | 46 | |
| 47 | 47 | /* |
@@ -52,19 +52,19 @@ discard block |
||
| 52 | 52 | if ($action == 'updateall') |
| 53 | 53 | { |
| 54 | 54 | $db->begin(); |
| 55 | - $res1=$res2=$res3=$res4=$res5=$res6=0; |
|
| 56 | - $res1=dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity); |
|
| 57 | - $res2=dolibarr_set_const($db, 'ADHERENT_MAIL_REQUIRED', GETPOST('ADHERENT_MAIL_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity); |
|
| 58 | - $res3=dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity); |
|
| 59 | - $res4=dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity); |
|
| 55 | + $res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0; |
|
| 56 | + $res1 = dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity); |
|
| 57 | + $res2 = dolibarr_set_const($db, 'ADHERENT_MAIL_REQUIRED', GETPOST('ADHERENT_MAIL_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity); |
|
| 58 | + $res3 = dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity); |
|
| 59 | + $res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity); |
|
| 60 | 60 | // Use vat for invoice creation |
| 61 | 61 | if ($conf->facture->enabled) |
| 62 | 62 | { |
| 63 | - $res4=dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); |
|
| 64 | - $res5=dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); |
|
| 65 | - if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) |
|
| 63 | + $res4 = dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); |
|
| 64 | + $res5 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); |
|
| 65 | + if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) |
|
| 66 | 66 | { |
| 67 | - $res6=dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); |
|
| 67 | + $res6 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0) |
@@ -82,23 +82,23 @@ discard block |
||
| 82 | 82 | // Action mise a jour ou ajout d'une constante |
| 83 | 83 | if ($action == 'update' || $action == 'add') |
| 84 | 84 | { |
| 85 | - $constname=GETPOST('constname','alpha'); |
|
| 86 | - $constvalue=(GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue')); |
|
| 85 | + $constname = GETPOST('constname', 'alpha'); |
|
| 86 | + $constvalue = (GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue')); |
|
| 87 | 87 | |
| 88 | - if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE' || $constname=='ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) $constvalue=''; |
|
| 89 | - if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice |
|
| 88 | + if (($constname == 'ADHERENT_CARD_TYPE' || $constname == 'ADHERENT_ETIQUETTE_TYPE' || $constname == 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) $constvalue = ''; |
|
| 89 | + if ($constname == 'ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice |
|
| 90 | 90 | { |
| 91 | - if ($constvalue) $constvalue=0; |
|
| 92 | - else $constvalue=1; |
|
| 91 | + if ($constvalue) $constvalue = 0; |
|
| 92 | + else $constvalue = 1; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - $consttype=GETPOST('consttype','alpha'); |
|
| 96 | - $constnote=GETPOST('constnote'); |
|
| 97 | - $res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity); |
|
| 95 | + $consttype = GETPOST('consttype', 'alpha'); |
|
| 96 | + $constnote = GETPOST('constnote'); |
|
| 97 | + $res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity); |
|
| 98 | 98 | |
| 99 | - if (! $res > 0) $error++; |
|
| 99 | + if (!$res > 0) $error++; |
|
| 100 | 100 | |
| 101 | - if (! $error) |
|
| 101 | + if (!$error) |
|
| 102 | 102 | { |
| 103 | 103 | setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
| 104 | 104 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | // Action activation d'un sous module du module adherent |
| 112 | 112 | if ($action == 'set') |
| 113 | 113 | { |
| 114 | - $result=dolibarr_set_const($db, GETPOST('name','alpha'),GETPOST('value'),'',0,'',$conf->entity); |
|
| 114 | + $result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity); |
|
| 115 | 115 | if ($result < 0) |
| 116 | 116 | { |
| 117 | 117 | print $db->error(); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | // Action desactivation d'un sous module du module adherent |
| 122 | 122 | if ($action == 'unset') |
| 123 | 123 | { |
| 124 | - $result=dolibarr_del_const($db,GETPOST('name','alpha'),$conf->entity); |
|
| 124 | + $result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity); |
|
| 125 | 125 | if ($result < 0) |
| 126 | 126 | { |
| 127 | 127 | print $db->error(); |
@@ -136,13 +136,13 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | $form = new Form($db); |
| 138 | 138 | |
| 139 | -$help_url='EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'; |
|
| 139 | +$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'; |
|
| 140 | 140 | |
| 141 | -llxHeader('',$langs->trans("MembersSetup"),$help_url); |
|
| 141 | +llxHeader('', $langs->trans("MembersSetup"), $help_url); |
|
| 142 | 142 | |
| 143 | 143 | |
| 144 | -$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; |
|
| 145 | -print load_fiche_titre($langs->trans("MembersSetup"),$linkback,'title_setup'); |
|
| 144 | +$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; |
|
| 145 | +print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup'); |
|
| 146 | 146 | |
| 147 | 147 | |
| 148 | 148 | $head = member_admin_prepare_head(); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | /* |
| 157 | 157 | * Editing global variables not related to a specific theme |
| 158 | 158 | */ |
| 159 | -$constantes=array( |
|
| 159 | +$constantes = array( |
|
| 160 | 160 | 'ADHERENT_MAIL_FROM', |
| 161 | 161 | 'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT', |
| 162 | 162 | 'ADHERENT_AUTOREGISTER_NOTIF_MAIL', |
@@ -170,14 +170,14 @@ discard block |
||
| 170 | 170 | 'ADHERENT_MAIL_RESIL', |
| 171 | 171 | ); |
| 172 | 172 | |
| 173 | -$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>'; |
|
| 174 | -$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, '; |
|
| 175 | -$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, '; |
|
| 176 | -$helptext.='__YEAR__, __MONTH__, __DAY__'; |
|
| 173 | +$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>'; |
|
| 174 | +$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, '; |
|
| 175 | +$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, '; |
|
| 176 | +$helptext .= '__YEAR__, __MONTH__, __DAY__'; |
|
| 177 | 177 | |
| 178 | -$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>'; |
|
| 179 | -$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, '; |
|
| 180 | -$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, '; |
|
| 178 | +$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>'; |
|
| 179 | +$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, '; |
|
| 180 | +$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, '; |
|
| 181 | 181 | //$helptext.='__YEAR__, __MONTH__, __DAY__'; // Not supported |
| 182 | 182 | |
| 183 | 183 | form_constantes($constantes, 0, $helptext); |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | class Adherent extends CommonObject |
| 43 | 43 | { |
| 44 | - public $element='member'; |
|
| 45 | - public $table_element='adherent'; |
|
| 46 | - public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe |
|
| 44 | + public $element = 'member'; |
|
| 45 | + public $table_element = 'adherent'; |
|
| 46 | + public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe |
|
| 47 | 47 | |
| 48 | 48 | var $mesgs; |
| 49 | 49 | |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | var $zip; |
| 63 | 63 | var $town; |
| 64 | 64 | |
| 65 | - var $state_id; // Id of department |
|
| 66 | - var $state_code; // Code of department |
|
| 67 | - var $state; // Label of department |
|
| 65 | + var $state_id; // Id of department |
|
| 66 | + var $state_code; // Code of department |
|
| 67 | + var $state; // Label of department |
|
| 68 | 68 | |
| 69 | 69 | var $email; |
| 70 | 70 | var $skype; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | var $morphy; |
| 76 | 76 | var $public; |
| 77 | - var $statut; // -1:brouillon, 0:resilie, >=1:valide,paye |
|
| 77 | + var $statut; // -1:brouillon, 0:resilie, >=1:valide,paye |
|
| 78 | 78 | var $photo; |
| 79 | 79 | |
| 80 | 80 | var $datec; |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | var $note_public; |
| 87 | 87 | var $note_private; |
| 88 | 88 | |
| 89 | - var $typeid; // Id type adherent |
|
| 90 | - var $type; // Libelle type adherent |
|
| 89 | + var $typeid; // Id type adherent |
|
| 90 | + var $type; // Libelle type adherent |
|
| 91 | 91 | var $need_subscription; |
| 92 | 92 | |
| 93 | 93 | var $user_id; |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | var $last_subscription_date_start; |
| 103 | 103 | var $last_subscription_date_end; |
| 104 | 104 | var $last_subscription_amount; |
| 105 | - var $subscriptions=array(); |
|
| 105 | + var $subscriptions = array(); |
|
| 106 | 106 | |
| 107 | - var $oldcopy; // To contains a clone of this when we need to save old properties of object |
|
| 107 | + var $oldcopy; // To contains a clone of this when we need to save old properties of object |
|
| 108 | 108 | |
| 109 | 109 | public $entity; |
| 110 | 110 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | // l'adherent n'est pas public par defaut |
| 121 | 121 | $this->public = 0; |
| 122 | 122 | // les champs optionnels sont vides |
| 123 | - $this->array_options=array(); |
|
| 123 | + $this->array_options = array(); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | |
@@ -139,24 +139,24 @@ discard block |
||
| 139 | 139 | * @param string $errors_to erros to |
| 140 | 140 | * @return int <0 if KO, >0 if OK |
| 141 | 141 | */ |
| 142 | - function send_an_email($text, $subject, $filename_list=array(), $mimetype_list=array(), $mimefilename_list=array(), $addr_cc="", $addr_bcc="", $deliveryreceipt=0, $msgishtml=-1, $errors_to='') |
|
| 142 | + function send_an_email($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '') |
|
| 143 | 143 | { |
| 144 | - global $conf,$langs; |
|
| 144 | + global $conf, $langs; |
|
| 145 | 145 | |
| 146 | 146 | // Detect if message is HTML |
| 147 | 147 | if ($msgishtml == -1) |
| 148 | 148 | { |
| 149 | 149 | $msgishtml = 0; |
| 150 | - if (dol_textishtml($text,1)) $msgishtml = 1; |
|
| 150 | + if (dol_textishtml($text, 1)) $msgishtml = 1; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - $texttosend=$this->makeSubstitution($text); |
|
| 154 | - $subjecttosend=$this->makeSubstitution($subject); |
|
| 155 | - if ($msgishtml) $texttosend=dol_htmlentitiesbr($texttosend); |
|
| 153 | + $texttosend = $this->makeSubstitution($text); |
|
| 154 | + $subjecttosend = $this->makeSubstitution($subject); |
|
| 155 | + if ($msgishtml) $texttosend = dol_htmlentitiesbr($texttosend); |
|
| 156 | 156 | |
| 157 | 157 | // Envoi mail confirmation |
| 158 | - $from=$conf->email_from; |
|
| 159 | - if (! empty($conf->global->ADHERENT_MAIL_FROM)) $from=$conf->global->ADHERENT_MAIL_FROM; |
|
| 158 | + $from = $conf->email_from; |
|
| 159 | + if (!empty($conf->global->ADHERENT_MAIL_FROM)) $from = $conf->global->ADHERENT_MAIL_FROM; |
|
| 160 | 160 | |
| 161 | 161 | // Send email (substitutionarray must be done just before this) |
| 162 | 162 | include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | else |
| 169 | 169 | { |
| 170 | - $this->error=$langs->trans("ErrorFailedToSendMail",$from,$this->email).'. '.$mailfile->error; |
|
| 170 | + $this->error = $langs->trans("ErrorFailedToSendMail", $from, $this->email).'. '.$mailfile->error; |
|
| 171 | 171 | return -1; |
| 172 | 172 | } |
| 173 | 173 | } |
@@ -181,55 +181,55 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | function makeSubstitution($text) |
| 183 | 183 | { |
| 184 | - global $conf,$langs; |
|
| 184 | + global $conf, $langs; |
|
| 185 | 185 | |
| 186 | - $birthday = dol_print_date($this->birth,'day'); |
|
| 186 | + $birthday = dol_print_date($this->birth, 'day'); |
|
| 187 | 187 | |
| 188 | 188 | $msgishtml = 0; |
| 189 | - if (dol_textishtml($text,1)) $msgishtml = 1; |
|
| 190 | - |
|
| 191 | - $infos=''; |
|
| 192 | - if ($this->civility_id) $infos.= $langs->transnoentities("UserTitle").": ".$this->getCivilityLabel()."\n"; |
|
| 193 | - $infos.= $langs->transnoentities("id").": ".$this->id."\n"; |
|
| 194 | - $infos.= $langs->transnoentities("Lastname").": ".$this->lastname."\n"; |
|
| 195 | - $infos.= $langs->transnoentities("Firstname").": ".$this->firstname."\n"; |
|
| 196 | - $infos.= $langs->transnoentities("Company").": ".$this->societe."\n"; |
|
| 197 | - $infos.= $langs->transnoentities("Address").": ".$this->address."\n"; |
|
| 198 | - $infos.= $langs->transnoentities("Zip").": ".$this->zip."\n"; |
|
| 199 | - $infos.= $langs->transnoentities("Town").": ".$this->town."\n"; |
|
| 200 | - $infos.= $langs->transnoentities("Country").": ".$this->country."\n"; |
|
| 201 | - $infos.= $langs->transnoentities("EMail").": ".$this->email."\n"; |
|
| 202 | - $infos.= $langs->transnoentities("PhonePro").": ".$this->phone."\n"; |
|
| 203 | - $infos.= $langs->transnoentities("PhonePerso").": ".$this->phone_perso."\n"; |
|
| 204 | - $infos.= $langs->transnoentities("PhoneMobile").": ".$this->phone_mobile."\n"; |
|
| 189 | + if (dol_textishtml($text, 1)) $msgishtml = 1; |
|
| 190 | + |
|
| 191 | + $infos = ''; |
|
| 192 | + if ($this->civility_id) $infos .= $langs->transnoentities("UserTitle").": ".$this->getCivilityLabel()."\n"; |
|
| 193 | + $infos .= $langs->transnoentities("id").": ".$this->id."\n"; |
|
| 194 | + $infos .= $langs->transnoentities("Lastname").": ".$this->lastname."\n"; |
|
| 195 | + $infos .= $langs->transnoentities("Firstname").": ".$this->firstname."\n"; |
|
| 196 | + $infos .= $langs->transnoentities("Company").": ".$this->societe."\n"; |
|
| 197 | + $infos .= $langs->transnoentities("Address").": ".$this->address."\n"; |
|
| 198 | + $infos .= $langs->transnoentities("Zip").": ".$this->zip."\n"; |
|
| 199 | + $infos .= $langs->transnoentities("Town").": ".$this->town."\n"; |
|
| 200 | + $infos .= $langs->transnoentities("Country").": ".$this->country."\n"; |
|
| 201 | + $infos .= $langs->transnoentities("EMail").": ".$this->email."\n"; |
|
| 202 | + $infos .= $langs->transnoentities("PhonePro").": ".$this->phone."\n"; |
|
| 203 | + $infos .= $langs->transnoentities("PhonePerso").": ".$this->phone_perso."\n"; |
|
| 204 | + $infos .= $langs->transnoentities("PhoneMobile").": ".$this->phone_mobile."\n"; |
|
| 205 | 205 | if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) |
| 206 | 206 | { |
| 207 | - $infos.= $langs->transnoentities("Login").": ".$this->login."\n"; |
|
| 208 | - $infos.= $langs->transnoentities("Password").": ".$this->pass."\n"; |
|
| 207 | + $infos .= $langs->transnoentities("Login").": ".$this->login."\n"; |
|
| 208 | + $infos .= $langs->transnoentities("Password").": ".$this->pass."\n"; |
|
| 209 | 209 | } |
| 210 | - $infos.= $langs->transnoentities("Birthday").": ".$birthday."\n"; |
|
| 211 | - $infos.= $langs->transnoentities("Photo").": ".$this->photo."\n"; |
|
| 212 | - $infos.= $langs->transnoentities("Public").": ".yn($this->public); |
|
| 210 | + $infos .= $langs->transnoentities("Birthday").": ".$birthday."\n"; |
|
| 211 | + $infos .= $langs->transnoentities("Photo").": ".$this->photo."\n"; |
|
| 212 | + $infos .= $langs->transnoentities("Public").": ".yn($this->public); |
|
| 213 | 213 | |
| 214 | 214 | // Substitutions |
| 215 | - $substitutionarray=array( |
|
| 215 | + $substitutionarray = array( |
|
| 216 | 216 | '__CIVILITY__'=>$this->getCivilityLabel(), |
| 217 | - '__FIRSTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname, |
|
| 218 | - '__LASTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->lastname):$this->lastname, |
|
| 219 | - '__FULLNAME__'=>$msgishtml?dol_htmlentitiesbr($this->getFullName($langs)):$this->getFullName($langs), |
|
| 220 | - '__COMPANY__'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe, |
|
| 221 | - '__ADDRESS__'=>$msgishtml?dol_htmlentitiesbr($this->address):$this->address, |
|
| 222 | - '__ZIP__'=>$msgishtml?dol_htmlentitiesbr($this->zip):$this->zip, |
|
| 223 | - '__TOWN__'=>$msgishtml?dol_htmlentitiesbr($this->town):$this->town, |
|
| 224 | - '__COUNTRY__'=>$msgishtml?dol_htmlentitiesbr($this->country):$this->country, |
|
| 225 | - '__EMAIL__'=>$msgishtml?dol_htmlentitiesbr($this->email):$this->email, |
|
| 226 | - '__BIRTH__'=>$msgishtml?dol_htmlentitiesbr($birthday):$birthday, |
|
| 227 | - '__PHOTO__'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo, |
|
| 228 | - '__LOGIN__'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login, |
|
| 229 | - '__PASSWORD__'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass, |
|
| 230 | - '__PHONE__'=>$msgishtml?dol_htmlentitiesbr($this->phone):$this->phone, |
|
| 231 | - '__PHONEPRO__'=>$msgishtml?dol_htmlentitiesbr($this->phone_perso):$this->phone_perso, |
|
| 232 | - '__PHONEMOBILE__'=>$msgishtml?dol_htmlentitiesbr($this->phone_mobile):$this->phone_mobile, |
|
| 217 | + '__FIRSTNAME__'=>$msgishtml ?dol_htmlentitiesbr($this->firstname) : $this->firstname, |
|
| 218 | + '__LASTNAME__'=>$msgishtml ?dol_htmlentitiesbr($this->lastname) : $this->lastname, |
|
| 219 | + '__FULLNAME__'=>$msgishtml ?dol_htmlentitiesbr($this->getFullName($langs)) : $this->getFullName($langs), |
|
| 220 | + '__COMPANY__'=>$msgishtml ?dol_htmlentitiesbr($this->societe) : $this->societe, |
|
| 221 | + '__ADDRESS__'=>$msgishtml ?dol_htmlentitiesbr($this->address) : $this->address, |
|
| 222 | + '__ZIP__'=>$msgishtml ?dol_htmlentitiesbr($this->zip) : $this->zip, |
|
| 223 | + '__TOWN__'=>$msgishtml ?dol_htmlentitiesbr($this->town) : $this->town, |
|
| 224 | + '__COUNTRY__'=>$msgishtml ?dol_htmlentitiesbr($this->country) : $this->country, |
|
| 225 | + '__EMAIL__'=>$msgishtml ?dol_htmlentitiesbr($this->email) : $this->email, |
|
| 226 | + '__BIRTH__'=>$msgishtml ?dol_htmlentitiesbr($birthday) : $birthday, |
|
| 227 | + '__PHOTO__'=>$msgishtml ?dol_htmlentitiesbr($this->photo) : $this->photo, |
|
| 228 | + '__LOGIN__'=>$msgishtml ?dol_htmlentitiesbr($this->login) : $this->login, |
|
| 229 | + '__PASSWORD__'=>$msgishtml ?dol_htmlentitiesbr($this->pass) : $this->pass, |
|
| 230 | + '__PHONE__'=>$msgishtml ?dol_htmlentitiesbr($this->phone) : $this->phone, |
|
| 231 | + '__PHONEPRO__'=>$msgishtml ?dol_htmlentitiesbr($this->phone_perso) : $this->phone_perso, |
|
| 232 | + '__PHONEMOBILE__'=>$msgishtml ?dol_htmlentitiesbr($this->phone_mobile) : $this->phone_mobile, |
|
| 233 | 233 | ); |
| 234 | 234 | |
| 235 | 235 | complete_substitutions_array($substitutionarray, $langs, $this); |
@@ -244,10 +244,10 @@ discard block |
||
| 244 | 244 | * @param string $morphy Nature of the adherent (physical or moral) |
| 245 | 245 | * @return string Label |
| 246 | 246 | */ |
| 247 | - function getmorphylib($morphy='') |
|
| 247 | + function getmorphylib($morphy = '') |
|
| 248 | 248 | { |
| 249 | 249 | global $langs; |
| 250 | - if (! $morphy) { $morphy=$this->morphy; } |
|
| 250 | + if (!$morphy) { $morphy = $this->morphy; } |
|
| 251 | 251 | if ($morphy == 'phy') { return $langs->trans("Physical"); } |
| 252 | 252 | if ($morphy == 'mor') { return $langs->trans("Moral"); } |
| 253 | 253 | return $morphy; |
@@ -260,30 +260,30 @@ discard block |
||
| 260 | 260 | * @param int $notrigger 1 ne declenche pas les triggers, 0 sinon |
| 261 | 261 | * @return int <0 if KO, >0 if OK |
| 262 | 262 | */ |
| 263 | - function create($user,$notrigger=0) |
|
| 263 | + function create($user, $notrigger = 0) |
|
| 264 | 264 | { |
| 265 | - global $conf,$langs; |
|
| 265 | + global $conf, $langs; |
|
| 266 | 266 | |
| 267 | - $error=0; |
|
| 267 | + $error = 0; |
|
| 268 | 268 | |
| 269 | - $now=dol_now(); |
|
| 269 | + $now = dol_now(); |
|
| 270 | 270 | |
| 271 | 271 | // Clean parameters |
| 272 | 272 | $this->import_key = trim($this->import_key); |
| 273 | 273 | |
| 274 | 274 | // Check parameters |
| 275 | - if (! empty($conf->global->ADHERENT_MAIL_REQUIRED) && ! isValidEMail($this->email)) |
|
| 275 | + if (!empty($conf->global->ADHERENT_MAIL_REQUIRED) && !isValidEMail($this->email)) |
|
| 276 | 276 | { |
| 277 | 277 | $langs->load("errors"); |
| 278 | - $this->error = $langs->trans("ErrorBadEMail",$this->email); |
|
| 278 | + $this->error = $langs->trans("ErrorBadEMail", $this->email); |
|
| 279 | 279 | return -1; |
| 280 | 280 | } |
| 281 | - if (! $this->datec) $this->datec=$now; |
|
| 281 | + if (!$this->datec) $this->datec = $now; |
|
| 282 | 282 | if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) |
| 283 | 283 | { |
| 284 | 284 | if (empty($this->login)) |
| 285 | 285 | { |
| 286 | - $this->error = $langs->trans("ErrorWrongValueForParameterX","Login"); |
|
| 286 | + $this->error = $langs->trans("ErrorWrongValueForParameterX", "Login"); |
|
| 287 | 287 | return -1; |
| 288 | 288 | } |
| 289 | 289 | } |
@@ -292,16 +292,16 @@ discard block |
||
| 292 | 292 | |
| 293 | 293 | // Insert member |
| 294 | 294 | $sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent"; |
| 295 | - $sql.= " (datec,login,fk_user_author,fk_user_mod,fk_user_valid,morphy,fk_adherent_type,entity,import_key)"; |
|
| 296 | - $sql.= " VALUES ("; |
|
| 297 | - $sql.= " '".$this->db->idate($this->datec)."'"; |
|
| 298 | - $sql.= ", ".($this->login?"'".$this->db->escape($this->login)."'":"null"); |
|
| 299 | - $sql.= ", ".($user->id>0?$user->id:"null"); // Can be null because member can be created by a guest or a script |
|
| 300 | - $sql.= ", null, null, '".$this->db->escape($this->morphy)."'"; |
|
| 301 | - $sql.= ", ".$this->typeid; |
|
| 302 | - $sql.= ", ".$conf->entity; |
|
| 303 | - $sql.= ", ".(! empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'":"null"); |
|
| 304 | - $sql.= ")"; |
|
| 295 | + $sql .= " (datec,login,fk_user_author,fk_user_mod,fk_user_valid,morphy,fk_adherent_type,entity,import_key)"; |
|
| 296 | + $sql .= " VALUES ("; |
|
| 297 | + $sql .= " '".$this->db->idate($this->datec)."'"; |
|
| 298 | + $sql .= ", ".($this->login ? "'".$this->db->escape($this->login)."'" : "null"); |
|
| 299 | + $sql .= ", ".($user->id > 0 ? $user->id : "null"); // Can be null because member can be created by a guest or a script |
|
| 300 | + $sql .= ", null, null, '".$this->db->escape($this->morphy)."'"; |
|
| 301 | + $sql .= ", ".$this->typeid; |
|
| 302 | + $sql .= ", ".$conf->entity; |
|
| 303 | + $sql .= ", ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); |
|
| 304 | + $sql .= ")"; |
|
| 305 | 305 | |
| 306 | 306 | dol_syslog(get_class($this)."::create", LOG_DEBUG); |
| 307 | 307 | $result = $this->db->query($sql); |
@@ -310,11 +310,11 @@ discard block |
||
| 310 | 310 | $id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent"); |
| 311 | 311 | if ($id > 0) |
| 312 | 312 | { |
| 313 | - $this->id=$id; |
|
| 314 | - $this->ref=(string) $id; |
|
| 313 | + $this->id = $id; |
|
| 314 | + $this->ref = (string) $id; |
|
| 315 | 315 | |
| 316 | 316 | // Update minor fields |
| 317 | - $result=$this->update($user,1,1,0,0,'add'); // nosync is 1 to avoid update data of user |
|
| 317 | + $result = $this->update($user, 1, 1, 0, 0, 'add'); // nosync is 1 to avoid update data of user |
|
| 318 | 318 | if ($result < 0) |
| 319 | 319 | { |
| 320 | 320 | $this->db->rollback(); |
@@ -326,29 +326,29 @@ discard block |
||
| 326 | 326 | { |
| 327 | 327 | // Add link to user |
| 328 | 328 | $sql = "UPDATE ".MAIN_DB_PREFIX."user SET"; |
| 329 | - $sql.= " fk_member = ".$this->id; |
|
| 330 | - $sql.= " WHERE rowid = ".$this->user_id; |
|
| 329 | + $sql .= " fk_member = ".$this->id; |
|
| 330 | + $sql .= " WHERE rowid = ".$this->user_id; |
|
| 331 | 331 | dol_syslog(get_class($this)."::create", LOG_DEBUG); |
| 332 | 332 | $resql = $this->db->query($sql); |
| 333 | - if (! $resql) |
|
| 333 | + if (!$resql) |
|
| 334 | 334 | { |
| 335 | - $this->error='Failed to update user to make link with member'; |
|
| 335 | + $this->error = 'Failed to update user to make link with member'; |
|
| 336 | 336 | $this->db->rollback(); |
| 337 | 337 | return -4; |
| 338 | 338 | } |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | - if (! $notrigger) |
|
| 341 | + if (!$notrigger) |
|
| 342 | 342 | { |
| 343 | 343 | // Call trigger |
| 344 | - $result=$this->call_trigger('MEMBER_CREATE',$user); |
|
| 344 | + $result = $this->call_trigger('MEMBER_CREATE', $user); |
|
| 345 | 345 | if ($result < 0) { $error++; } |
| 346 | 346 | // End call triggers |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | if (count($this->errors)) |
| 350 | 350 | { |
| 351 | - dol_syslog(get_class($this)."::create ".implode(',',$this->errors), LOG_ERR); |
|
| 351 | + dol_syslog(get_class($this)."::create ".implode(',', $this->errors), LOG_ERR); |
|
| 352 | 352 | $this->db->rollback(); |
| 353 | 353 | return -3; |
| 354 | 354 | } |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | } |
| 361 | 361 | else |
| 362 | 362 | { |
| 363 | - $this->error='Failed to get last insert id'; |
|
| 363 | + $this->error = 'Failed to get last insert id'; |
|
| 364 | 364 | dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); |
| 365 | 365 | $this->db->rollback(); |
| 366 | 366 | return -2; |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | } |
| 369 | 369 | else |
| 370 | 370 | { |
| 371 | - $this->error=$this->db->error(); |
|
| 371 | + $this->error = $this->db->error(); |
|
| 372 | 372 | $this->db->rollback(); |
| 373 | 373 | return -1; |
| 374 | 374 | } |
@@ -386,67 +386,67 @@ discard block |
||
| 386 | 386 | * @param string $action Current action for hookmanager |
| 387 | 387 | * @return int <0 if KO, >0 if OK |
| 388 | 388 | */ |
| 389 | - function update($user,$notrigger=0,$nosyncuser=0,$nosyncuserpass=0,$nosyncthirdparty=0,$action='update') |
|
| 389 | + function update($user, $notrigger = 0, $nosyncuser = 0, $nosyncuserpass = 0, $nosyncthirdparty = 0, $action = 'update') |
|
| 390 | 390 | { |
| 391 | 391 | global $conf, $langs, $hookmanager; |
| 392 | 392 | |
| 393 | - $nbrowsaffected=0; |
|
| 394 | - $error=0; |
|
| 393 | + $nbrowsaffected = 0; |
|
| 394 | + $error = 0; |
|
| 395 | 395 | |
| 396 | 396 | dol_syslog(get_class($this)."::update notrigger=".$notrigger.", nosyncuser=".$nosyncuser.", nosyncuserpass=".$nosyncuserpass." nosyncthirdparty=".$nosyncthirdparty.", email=".$this->email); |
| 397 | 397 | |
| 398 | 398 | // Clean parameters |
| 399 | - $this->lastname=trim($this->lastname)?trim($this->lastname):trim($this->lastname); |
|
| 400 | - $this->firstname=trim($this->firstname)?trim($this->firstname):trim($this->firstname); |
|
| 401 | - $this->address=($this->address?$this->address:$this->address); |
|
| 402 | - $this->zip=($this->zip?$this->zip:$this->zip); |
|
| 403 | - $this->town=($this->town?$this->town:$this->town); |
|
| 404 | - $this->country_id=($this->country_id > 0?$this->country_id:$this->country_id); |
|
| 405 | - $this->state_id=($this->state_id > 0?$this->state_id:$this->state_id); |
|
| 406 | - if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname=ucwords(trim($this->lastname)); |
|
| 407 | - if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname=ucwords(trim($this->firstname)); |
|
| 408 | - $this->note_public=($this->note_public?$this->note_public:$this->note_public); |
|
| 409 | - $this->note_private=($this->note_private?$this->note_private:$this->note_private); |
|
| 399 | + $this->lastname = trim($this->lastname) ?trim($this->lastname) : trim($this->lastname); |
|
| 400 | + $this->firstname = trim($this->firstname) ?trim($this->firstname) : trim($this->firstname); |
|
| 401 | + $this->address = ($this->address ? $this->address : $this->address); |
|
| 402 | + $this->zip = ($this->zip ? $this->zip : $this->zip); |
|
| 403 | + $this->town = ($this->town ? $this->town : $this->town); |
|
| 404 | + $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); |
|
| 405 | + $this->state_id = ($this->state_id > 0 ? $this->state_id : $this->state_id); |
|
| 406 | + if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = ucwords(trim($this->lastname)); |
|
| 407 | + if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = ucwords(trim($this->firstname)); |
|
| 408 | + $this->note_public = ($this->note_public ? $this->note_public : $this->note_public); |
|
| 409 | + $this->note_private = ($this->note_private ? $this->note_private : $this->note_private); |
|
| 410 | 410 | |
| 411 | 411 | // Check parameters |
| 412 | - if (! empty($conf->global->ADHERENT_MAIL_REQUIRED) && ! isValidEMail($this->email)) |
|
| 412 | + if (!empty($conf->global->ADHERENT_MAIL_REQUIRED) && !isValidEMail($this->email)) |
|
| 413 | 413 | { |
| 414 | 414 | $langs->load("errors"); |
| 415 | - $this->error = $langs->trans("ErrorBadEMail",$this->email); |
|
| 415 | + $this->error = $langs->trans("ErrorBadEMail", $this->email); |
|
| 416 | 416 | return -1; |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | $this->db->begin(); |
| 420 | 420 | |
| 421 | 421 | $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; |
| 422 | - $sql.= " civility = ".($this->civility_id?"'".$this->db->escape($this->civility_id)."'":"null"); |
|
| 423 | - $sql.= ", firstname = ".($this->firstname?"'".$this->db->escape($this->firstname)."'":"null"); |
|
| 424 | - $sql.= ", lastname = ".($this->lastname?"'".$this->db->escape($this->lastname)."'":"null"); |
|
| 425 | - $sql.= ", login = ".($this->login?"'".$this->db->escape($this->login)."'":"null"); |
|
| 426 | - $sql.= ", societe = ".($this->societe?"'".$this->db->escape($this->societe)."'":"null"); |
|
| 427 | - $sql.= ", fk_soc = ".($this->fk_soc > 0?$this->db->escape($this->fk_soc):"null"); |
|
| 428 | - $sql.= ", address = ".($this->address?"'".$this->db->escape($this->address)."'":"null"); |
|
| 429 | - $sql.= ", zip = ".($this->zip?"'".$this->db->escape($this->zip)."'":"null"); |
|
| 430 | - $sql.= ", town = ".($this->town?"'".$this->db->escape($this->town)."'":"null"); |
|
| 431 | - $sql.= ", country = ".($this->country_id>0?$this->db->escape($this->country_id):"null"); |
|
| 432 | - $sql.= ", state_id = ".($this->state_id>0?$this->db->escape($this->state_id):"null"); |
|
| 433 | - $sql.= ", email = '".$this->db->escape($this->email)."'"; |
|
| 434 | - $sql.= ", skype = '".$this->db->escape($this->skype)."'"; |
|
| 435 | - $sql.= ", phone = ".($this->phone?"'".$this->db->escape($this->phone)."'":"null"); |
|
| 436 | - $sql.= ", phone_perso = ".($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null"); |
|
| 437 | - $sql.= ", phone_mobile = ".($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null"); |
|
| 438 | - $sql.= ", note_private = ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null"); |
|
| 439 | - $sql.= ", note_public = ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null"); |
|
| 440 | - $sql.= ", photo = ".($this->photo?"'".$this->db->escape($this->photo)."'":"null"); |
|
| 441 | - $sql.= ", public = '".$this->db->escape($this->public)."'"; |
|
| 442 | - $sql.= ", statut = ".$this->db->escape($this->statut); |
|
| 443 | - $sql.= ", fk_adherent_type = ".$this->db->escape($this->typeid); |
|
| 444 | - $sql.= ", morphy = '".$this->db->escape($this->morphy)."'"; |
|
| 445 | - $sql.= ", birth = ".($this->birth?"'".$this->db->idate($this->birth)."'":"null"); |
|
| 446 | - if ($this->datefin) $sql.= ", datefin = '".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription |
|
| 447 | - if ($this->datevalid) $sql.= ", datevalid = '".$this->db->idate($this->datevalid)."'"; // Must be modified only when validating a member |
|
| 448 | - $sql.= ", fk_user_mod = ".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest |
|
| 449 | - $sql.= " WHERE rowid = ".$this->id; |
|
| 422 | + $sql .= " civility = ".($this->civility_id ? "'".$this->db->escape($this->civility_id)."'" : "null"); |
|
| 423 | + $sql .= ", firstname = ".($this->firstname ? "'".$this->db->escape($this->firstname)."'" : "null"); |
|
| 424 | + $sql .= ", lastname = ".($this->lastname ? "'".$this->db->escape($this->lastname)."'" : "null"); |
|
| 425 | + $sql .= ", login = ".($this->login ? "'".$this->db->escape($this->login)."'" : "null"); |
|
| 426 | + $sql .= ", societe = ".($this->societe ? "'".$this->db->escape($this->societe)."'" : "null"); |
|
| 427 | + $sql .= ", fk_soc = ".($this->fk_soc > 0 ? $this->db->escape($this->fk_soc) : "null"); |
|
| 428 | + $sql .= ", address = ".($this->address ? "'".$this->db->escape($this->address)."'" : "null"); |
|
| 429 | + $sql .= ", zip = ".($this->zip ? "'".$this->db->escape($this->zip)."'" : "null"); |
|
| 430 | + $sql .= ", town = ".($this->town ? "'".$this->db->escape($this->town)."'" : "null"); |
|
| 431 | + $sql .= ", country = ".($this->country_id > 0 ? $this->db->escape($this->country_id) : "null"); |
|
| 432 | + $sql .= ", state_id = ".($this->state_id > 0 ? $this->db->escape($this->state_id) : "null"); |
|
| 433 | + $sql .= ", email = '".$this->db->escape($this->email)."'"; |
|
| 434 | + $sql .= ", skype = '".$this->db->escape($this->skype)."'"; |
|
| 435 | + $sql .= ", phone = ".($this->phone ? "'".$this->db->escape($this->phone)."'" : "null"); |
|
| 436 | + $sql .= ", phone_perso = ".($this->phone_perso ? "'".$this->db->escape($this->phone_perso)."'" : "null"); |
|
| 437 | + $sql .= ", phone_mobile = ".($this->phone_mobile ? "'".$this->db->escape($this->phone_mobile)."'" : "null"); |
|
| 438 | + $sql .= ", note_private = ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "null"); |
|
| 439 | + $sql .= ", note_public = ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : "null"); |
|
| 440 | + $sql .= ", photo = ".($this->photo ? "'".$this->db->escape($this->photo)."'" : "null"); |
|
| 441 | + $sql .= ", public = '".$this->db->escape($this->public)."'"; |
|
| 442 | + $sql .= ", statut = ".$this->db->escape($this->statut); |
|
| 443 | + $sql .= ", fk_adherent_type = ".$this->db->escape($this->typeid); |
|
| 444 | + $sql .= ", morphy = '".$this->db->escape($this->morphy)."'"; |
|
| 445 | + $sql .= ", birth = ".($this->birth ? "'".$this->db->idate($this->birth)."'" : "null"); |
|
| 446 | + if ($this->datefin) $sql .= ", datefin = '".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription |
|
| 447 | + if ($this->datevalid) $sql .= ", datevalid = '".$this->db->idate($this->datevalid)."'"; // Must be modified only when validating a member |
|
| 448 | + $sql .= ", fk_user_mod = ".($user->id > 0 ? $user->id : 'null'); // Can be null because member can be create by a guest |
|
| 449 | + $sql .= " WHERE rowid = ".$this->id; |
|
| 450 | 450 | |
| 451 | 451 | dol_syslog(get_class($this)."::update update member", LOG_DEBUG); |
| 452 | 452 | $resql = $this->db->query($sql); |
@@ -457,21 +457,21 @@ discard block |
||
| 457 | 457 | unset($this->state_code); |
| 458 | 458 | unset($this->state); |
| 459 | 459 | |
| 460 | - $nbrowsaffected+=$this->db->affected_rows($resql); |
|
| 460 | + $nbrowsaffected += $this->db->affected_rows($resql); |
|
| 461 | 461 | |
| 462 | - $action='update'; |
|
| 462 | + $action = 'update'; |
|
| 463 | 463 | |
| 464 | 464 | // Actions on extra fields (by external module) |
| 465 | 465 | // TODO le hook fait double emploi avec le trigger !! |
| 466 | 466 | $hookmanager->initHooks(array('memberdao')); |
| 467 | - $parameters=array('id'=>$this->id); |
|
| 468 | - $action=''; |
|
| 469 | - $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
| 467 | + $parameters = array('id'=>$this->id); |
|
| 468 | + $action = ''; |
|
| 469 | + $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
| 470 | 470 | if (empty($reshook)) |
| 471 | 471 | { |
| 472 | 472 | if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used |
| 473 | 473 | { |
| 474 | - $result=$this->insertExtraFields(); |
|
| 474 | + $result = $this->insertExtraFields(); |
|
| 475 | 475 | if ($result < 0) |
| 476 | 476 | { |
| 477 | 477 | $error++; |
@@ -481,48 +481,48 @@ discard block |
||
| 481 | 481 | else if ($reshook < 0) $error++; |
| 482 | 482 | |
| 483 | 483 | // Update password |
| 484 | - if (! $error && $this->pass) |
|
| 484 | + if (!$error && $this->pass) |
|
| 485 | 485 | { |
| 486 | 486 | dol_syslog(get_class($this)."::update update password"); |
| 487 | 487 | if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted) |
| 488 | 488 | { |
| 489 | - $isencrypted = empty($conf->global->DATABASE_PWD_ENCRYPTED)?0:1; |
|
| 489 | + $isencrypted = empty($conf->global->DATABASE_PWD_ENCRYPTED) ? 0 : 1; |
|
| 490 | 490 | |
| 491 | 491 | // If password to set differs from the one found into database |
| 492 | - $result=$this->setPassword($user,$this->pass,$isencrypted,$notrigger,$nosyncuserpass); |
|
| 493 | - if (! $nbrowsaffected) $nbrowsaffected++; |
|
| 492 | + $result = $this->setPassword($user, $this->pass, $isencrypted, $notrigger, $nosyncuserpass); |
|
| 493 | + if (!$nbrowsaffected) $nbrowsaffected++; |
|
| 494 | 494 | } |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | // Remove links to user and replace with new one |
| 498 | - if (! $error) |
|
| 498 | + if (!$error) |
|
| 499 | 499 | { |
| 500 | 500 | dol_syslog(get_class($this)."::update update link to user"); |
| 501 | 501 | $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL WHERE fk_member = ".$this->id; |
| 502 | 502 | dol_syslog(get_class($this)."::update", LOG_DEBUG); |
| 503 | 503 | $resql = $this->db->query($sql); |
| 504 | - if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -5; } |
|
| 504 | + if (!$resql) { $this->error = $this->db->error(); $this->db->rollback(); return -5; } |
|
| 505 | 505 | // If there is a user linked to this member |
| 506 | 506 | if ($this->user_id > 0) |
| 507 | 507 | { |
| 508 | 508 | $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = ".$this->id." WHERE rowid = ".$this->user_id; |
| 509 | 509 | dol_syslog(get_class($this)."::update", LOG_DEBUG); |
| 510 | 510 | $resql = $this->db->query($sql); |
| 511 | - if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -5; } |
|
| 511 | + if (!$resql) { $this->error = $this->db->error(); $this->db->rollback(); return -5; } |
|
| 512 | 512 | } |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | - if (! $error && $nbrowsaffected) // If something has change in main data |
|
| 515 | + if (!$error && $nbrowsaffected) // If something has change in main data |
|
| 516 | 516 | { |
| 517 | 517 | // Update information on linked user if it is an update |
| 518 | - if (! $error && $this->user_id > 0 && ! $nosyncuser) |
|
| 518 | + if (!$error && $this->user_id > 0 && !$nosyncuser) |
|
| 519 | 519 | { |
| 520 | 520 | require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; |
| 521 | 521 | |
| 522 | 522 | dol_syslog(get_class($this)."::update update linked user"); |
| 523 | 523 | |
| 524 | - $luser=new User($this->db); |
|
| 525 | - $result=$luser->fetch($this->user_id); |
|
| 524 | + $luser = new User($this->db); |
|
| 525 | + $result = $luser->fetch($this->user_id); |
|
| 526 | 526 | |
| 527 | 527 | if ($result >= 0) |
| 528 | 528 | { |
@@ -530,38 +530,38 @@ discard block |
||
| 530 | 530 | //var_dump($this->login);exit; |
| 531 | 531 | |
| 532 | 532 | // If option ADHERENT_LOGIN_NOT_REQUIRED is on, there is no login of member, so we do not overwrite user login to keep existing one. |
| 533 | - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $luser->login=$this->login; |
|
| 533 | + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $luser->login = $this->login; |
|
| 534 | 534 | |
| 535 | - $luser->civility_id=$this->civility_id; |
|
| 536 | - $luser->firstname=$this->firstname; |
|
| 537 | - $luser->lastname=$this->lastname; |
|
| 538 | - $luser->pass=$this->pass; |
|
| 539 | - $luser->societe_id=$this->societe; |
|
| 535 | + $luser->civility_id = $this->civility_id; |
|
| 536 | + $luser->firstname = $this->firstname; |
|
| 537 | + $luser->lastname = $this->lastname; |
|
| 538 | + $luser->pass = $this->pass; |
|
| 539 | + $luser->societe_id = $this->societe; |
|
| 540 | 540 | |
| 541 | - $luser->email=$this->email; |
|
| 542 | - $luser->skype=$this->skype; |
|
| 543 | - $luser->office_phone=$this->phone; |
|
| 544 | - $luser->user_mobile=$this->phone_mobile; |
|
| 541 | + $luser->email = $this->email; |
|
| 542 | + $luser->skype = $this->skype; |
|
| 543 | + $luser->office_phone = $this->phone; |
|
| 544 | + $luser->user_mobile = $this->phone_mobile; |
|
| 545 | 545 | |
| 546 | - $luser->fk_member=$this->id; |
|
| 546 | + $luser->fk_member = $this->id; |
|
| 547 | 547 | |
| 548 | - $result=$luser->update($user,0,1,1); // Use nosync to 1 to avoid cyclic updates |
|
| 548 | + $result = $luser->update($user, 0, 1, 1); // Use nosync to 1 to avoid cyclic updates |
|
| 549 | 549 | if ($result < 0) |
| 550 | 550 | { |
| 551 | - $this->error=$luser->error; |
|
| 552 | - dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR); |
|
| 551 | + $this->error = $luser->error; |
|
| 552 | + dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR); |
|
| 553 | 553 | $error++; |
| 554 | 554 | } |
| 555 | 555 | } |
| 556 | 556 | else |
| 557 | 557 | { |
| 558 | - $this->error=$luser->error; |
|
| 558 | + $this->error = $luser->error; |
|
| 559 | 559 | $error++; |
| 560 | 560 | } |
| 561 | 561 | } |
| 562 | 562 | |
| 563 | 563 | // Update information on linked thirdparty if it is an update |
| 564 | - if (! $error && $this->fk_soc > 0 && ! $nosyncthirdparty) |
|
| 564 | + if (!$error && $this->fk_soc > 0 && !$nosyncthirdparty) |
|
| 565 | 565 | { |
| 566 | 566 | require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
| 567 | 567 | |
@@ -569,47 +569,47 @@ discard block |
||
| 569 | 569 | |
| 570 | 570 | // This member is linked with a thirdparty, so we also update thirdparty informations |
| 571 | 571 | // if this is an update. |
| 572 | - $lthirdparty=new Societe($this->db); |
|
| 573 | - $result=$lthirdparty->fetch($this->fk_soc); |
|
| 572 | + $lthirdparty = new Societe($this->db); |
|
| 573 | + $result = $lthirdparty->fetch($this->fk_soc); |
|
| 574 | 574 | |
| 575 | 575 | if ($result >= 0) |
| 576 | 576 | { |
| 577 | - $lthirdparty->address=$this->address; |
|
| 578 | - $lthirdparty->zip=$this->zip; |
|
| 579 | - $lthirdparty->town=$this->town; |
|
| 580 | - $lthirdparty->email=$this->email; |
|
| 581 | - $lthirdparty->skype=$this->skype; |
|
| 582 | - $lthirdparty->phone=$this->phone; |
|
| 583 | - $lthirdparty->state_id=$this->state_id; |
|
| 584 | - $lthirdparty->country_id=$this->country_id; |
|
| 585 | - $lthirdparty->country_id=$this->country_id; |
|
| 577 | + $lthirdparty->address = $this->address; |
|
| 578 | + $lthirdparty->zip = $this->zip; |
|
| 579 | + $lthirdparty->town = $this->town; |
|
| 580 | + $lthirdparty->email = $this->email; |
|
| 581 | + $lthirdparty->skype = $this->skype; |
|
| 582 | + $lthirdparty->phone = $this->phone; |
|
| 583 | + $lthirdparty->state_id = $this->state_id; |
|
| 584 | + $lthirdparty->country_id = $this->country_id; |
|
| 585 | + $lthirdparty->country_id = $this->country_id; |
|
| 586 | 586 | //$lthirdparty->phone_mobile=$this->phone_mobile; |
| 587 | 587 | |
| 588 | - $result=$lthirdparty->update($this->fk_soc,$user,0,1,1,'update'); // Use sync to 0 to avoid cyclic updates |
|
| 588 | + $result = $lthirdparty->update($this->fk_soc, $user, 0, 1, 1, 'update'); // Use sync to 0 to avoid cyclic updates |
|
| 589 | 589 | if ($result < 0) |
| 590 | 590 | { |
| 591 | - $this->error=$lthirdparty->error; |
|
| 592 | - dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR); |
|
| 591 | + $this->error = $lthirdparty->error; |
|
| 592 | + dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR); |
|
| 593 | 593 | $error++; |
| 594 | 594 | } |
| 595 | 595 | } |
| 596 | 596 | else |
| 597 | 597 | { |
| 598 | - $this->error=$lthirdparty->error; |
|
| 598 | + $this->error = $lthirdparty->error; |
|
| 599 | 599 | $error++; |
| 600 | 600 | } |
| 601 | 601 | } |
| 602 | 602 | |
| 603 | - if (! $error && ! $notrigger) |
|
| 603 | + if (!$error && !$notrigger) |
|
| 604 | 604 | { |
| 605 | 605 | // Call trigger |
| 606 | - $result=$this->call_trigger('MEMBER_MODIFY',$user); |
|
| 606 | + $result = $this->call_trigger('MEMBER_MODIFY', $user); |
|
| 607 | 607 | if ($result < 0) { $error++; } |
| 608 | 608 | // End call triggers |
| 609 | 609 | } |
| 610 | 610 | } |
| 611 | 611 | |
| 612 | - if (! $error) |
|
| 612 | + if (!$error) |
|
| 613 | 613 | { |
| 614 | 614 | $this->db->commit(); |
| 615 | 615 | return $nbrowsaffected; |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | else |
| 624 | 624 | { |
| 625 | 625 | $this->db->rollback(); |
| 626 | - $this->error=$this->db->lasterror(); |
|
| 626 | + $this->error = $this->db->lasterror(); |
|
| 627 | 627 | return -2; |
| 628 | 628 | } |
| 629 | 629 | } |
@@ -642,31 +642,31 @@ discard block |
||
| 642 | 642 | |
| 643 | 643 | // Search for last subscription id and end date |
| 644 | 644 | $sql = "SELECT rowid, datec as dateop, dateadh as datedeb, datef as datefin"; |
| 645 | - $sql.= " FROM ".MAIN_DB_PREFIX."subscription"; |
|
| 646 | - $sql.= " WHERE fk_adherent=".$this->id; |
|
| 647 | - $sql.= " ORDER by dateadh DESC"; // Sort by start subscription date |
|
| 645 | + $sql .= " FROM ".MAIN_DB_PREFIX."subscription"; |
|
| 646 | + $sql .= " WHERE fk_adherent=".$this->id; |
|
| 647 | + $sql .= " ORDER by dateadh DESC"; // Sort by start subscription date |
|
| 648 | 648 | |
| 649 | 649 | dol_syslog(get_class($this)."::update_end_date", LOG_DEBUG); |
| 650 | - $resql=$this->db->query($sql); |
|
| 650 | + $resql = $this->db->query($sql); |
|
| 651 | 651 | if ($resql) |
| 652 | 652 | { |
| 653 | - $obj=$this->db->fetch_object($resql); |
|
| 654 | - $dateop=$this->db->jdate($obj->dateop); |
|
| 655 | - $datedeb=$this->db->jdate($obj->datedeb); |
|
| 656 | - $datefin=$this->db->jdate($obj->datefin); |
|
| 653 | + $obj = $this->db->fetch_object($resql); |
|
| 654 | + $dateop = $this->db->jdate($obj->dateop); |
|
| 655 | + $datedeb = $this->db->jdate($obj->datedeb); |
|
| 656 | + $datefin = $this->db->jdate($obj->datefin); |
|
| 657 | 657 | |
| 658 | 658 | $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; |
| 659 | - $sql.= " datefin=".($datefin != '' ? "'".$this->db->idate($datefin)."'" : "null"); |
|
| 660 | - $sql.= " WHERE rowid = ".$this->id; |
|
| 659 | + $sql .= " datefin=".($datefin != '' ? "'".$this->db->idate($datefin)."'" : "null"); |
|
| 660 | + $sql .= " WHERE rowid = ".$this->id; |
|
| 661 | 661 | |
| 662 | 662 | dol_syslog(get_class($this)."::update_end_date", LOG_DEBUG); |
| 663 | - $resql=$this->db->query($sql); |
|
| 663 | + $resql = $this->db->query($sql); |
|
| 664 | 664 | if ($resql) |
| 665 | 665 | { |
| 666 | - $this->last_subscription_date=$dateop; |
|
| 667 | - $this->last_subscription_date_start=$datedeb; |
|
| 668 | - $this->last_subscription_date_end=$datefin; |
|
| 669 | - $this->datefin=$datefin; |
|
| 666 | + $this->last_subscription_date = $dateop; |
|
| 667 | + $this->last_subscription_date_start = $datedeb; |
|
| 668 | + $this->last_subscription_date_end = $datefin; |
|
| 669 | + $this->datefin = $datefin; |
|
| 670 | 670 | $this->db->commit(); |
| 671 | 671 | return 1; |
| 672 | 672 | } |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | } |
| 679 | 679 | else |
| 680 | 680 | { |
| 681 | - $this->error=$this->db->lasterror(); |
|
| 681 | + $this->error = $this->db->lasterror(); |
|
| 682 | 682 | $this->db->rollback(); |
| 683 | 683 | return -1; |
| 684 | 684 | } |
@@ -693,23 +693,23 @@ discard block |
||
| 693 | 693 | * @param int $notrigger 1=Does not execute triggers, 0= execute triggers |
| 694 | 694 | * @return int <0 if KO, 0=nothing to do, >0 if OK |
| 695 | 695 | */ |
| 696 | - function delete($rowid, $user, $notrigger=0) |
|
| 696 | + function delete($rowid, $user, $notrigger = 0) |
|
| 697 | 697 | { |
| 698 | 698 | global $conf, $langs; |
| 699 | 699 | |
| 700 | 700 | $result = 0; |
| 701 | - $error=0; |
|
| 702 | - $errorflag=0; |
|
| 701 | + $error = 0; |
|
| 702 | + $errorflag = 0; |
|
| 703 | 703 | |
| 704 | 704 | // Check parameters |
| 705 | - if (empty($rowid)) $rowid=$this->id; |
|
| 705 | + if (empty($rowid)) $rowid = $this->id; |
|
| 706 | 706 | |
| 707 | 707 | $this->db->begin(); |
| 708 | 708 | |
| 709 | - if (! $error && ! $notrigger) |
|
| 709 | + if (!$error && !$notrigger) |
|
| 710 | 710 | { |
| 711 | 711 | // Call trigger |
| 712 | - $result=$this->call_trigger('MEMBER_DELETE',$user); |
|
| 712 | + $result = $this->call_trigger('MEMBER_DELETE', $user); |
|
| 713 | 713 | if ($result < 0) $error++; |
| 714 | 714 | // End call triggers |
| 715 | 715 | } |
@@ -717,70 +717,70 @@ discard block |
||
| 717 | 717 | // Remove category |
| 718 | 718 | $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_member WHERE fk_member = ".$rowid; |
| 719 | 719 | dol_syslog(get_class($this)."::delete", LOG_DEBUG); |
| 720 | - $resql=$this->db->query($sql); |
|
| 721 | - if (! $resql) |
|
| 720 | + $resql = $this->db->query($sql); |
|
| 721 | + if (!$resql) |
|
| 722 | 722 | { |
| 723 | 723 | $error++; |
| 724 | 724 | $this->error .= $this->db->lasterror(); |
| 725 | - $errorflag=-1; |
|
| 725 | + $errorflag = -1; |
|
| 726 | 726 | } |
| 727 | 727 | |
| 728 | 728 | // Remove subscription |
| 729 | - if (! $error) |
|
| 729 | + if (!$error) |
|
| 730 | 730 | { |
| 731 | 731 | $sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE fk_adherent = ".$rowid; |
| 732 | 732 | dol_syslog(get_class($this)."::delete", LOG_DEBUG); |
| 733 | - $resql=$this->db->query($sql); |
|
| 734 | - if (! $resql) |
|
| 733 | + $resql = $this->db->query($sql); |
|
| 734 | + if (!$resql) |
|
| 735 | 735 | { |
| 736 | 736 | $error++; |
| 737 | 737 | $this->error .= $this->db->lasterror(); |
| 738 | - $errorflag=-2; |
|
| 738 | + $errorflag = -2; |
|
| 739 | 739 | } |
| 740 | 740 | } |
| 741 | 741 | |
| 742 | 742 | // Remove linked user |
| 743 | - if (! $error) |
|
| 743 | + if (!$error) |
|
| 744 | 744 | { |
| 745 | - $ret=$this->setUserId(0); |
|
| 745 | + $ret = $this->setUserId(0); |
|
| 746 | 746 | if ($ret < 0) |
| 747 | 747 | { |
| 748 | 748 | $error++; |
| 749 | 749 | $this->error .= $this->db->lasterror(); |
| 750 | - $errorflag=-3; |
|
| 750 | + $errorflag = -3; |
|
| 751 | 751 | } |
| 752 | 752 | } |
| 753 | 753 | |
| 754 | 754 | // Removed extrafields |
| 755 | - if (! $error) |
|
| 755 | + if (!$error) |
|
| 756 | 756 | { |
| 757 | 757 | if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used |
| 758 | 758 | { |
| 759 | - $result=$this->deleteExtraFields(); |
|
| 759 | + $result = $this->deleteExtraFields(); |
|
| 760 | 760 | if ($result < 0) |
| 761 | 761 | { |
| 762 | 762 | $error++; |
| 763 | - $errorflag=-4; |
|
| 763 | + $errorflag = -4; |
|
| 764 | 764 | dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); |
| 765 | 765 | } |
| 766 | 766 | } |
| 767 | 767 | } |
| 768 | 768 | |
| 769 | 769 | // Remove adherent |
| 770 | - if (! $error) |
|
| 770 | + if (!$error) |
|
| 771 | 771 | { |
| 772 | 772 | $sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent WHERE rowid = ".$rowid; |
| 773 | 773 | dol_syslog(get_class($this)."::delete", LOG_DEBUG); |
| 774 | - $resql=$this->db->query($sql); |
|
| 775 | - if (! $resql) |
|
| 774 | + $resql = $this->db->query($sql); |
|
| 775 | + if (!$resql) |
|
| 776 | 776 | { |
| 777 | 777 | $error++; |
| 778 | 778 | $this->error .= $this->db->lasterror(); |
| 779 | - $errorflag=-5; |
|
| 779 | + $errorflag = -5; |
|
| 780 | 780 | } |
| 781 | 781 | } |
| 782 | 782 | |
| 783 | - if (! $error) |
|
| 783 | + if (!$error) |
|
| 784 | 784 | { |
| 785 | 785 | $this->db->commit(); |
| 786 | 786 | return 1; |
@@ -803,26 +803,26 @@ discard block |
||
| 803 | 803 | * @param int $nosyncuser Do not synchronize linked user |
| 804 | 804 | * @return string If OK return clear password, 0 if no change, < 0 if error |
| 805 | 805 | */ |
| 806 | - function setPassword($user, $password='', $isencrypted=0, $notrigger=0, $nosyncuser=0) |
|
| 806 | + function setPassword($user, $password = '', $isencrypted = 0, $notrigger = 0, $nosyncuser = 0) |
|
| 807 | 807 | { |
| 808 | 808 | global $conf, $langs; |
| 809 | 809 | |
| 810 | - $error=0; |
|
| 810 | + $error = 0; |
|
| 811 | 811 | |
| 812 | - dol_syslog(get_class($this)."::setPassword user=".$user->id." password=".preg_replace('/./i','*',$password)." isencrypted=".$isencrypted); |
|
| 812 | + dol_syslog(get_class($this)."::setPassword user=".$user->id." password=".preg_replace('/./i', '*', $password)." isencrypted=".$isencrypted); |
|
| 813 | 813 | |
| 814 | 814 | // If new password not provided, we generate one |
| 815 | - if (! $password) |
|
| 815 | + if (!$password) |
|
| 816 | 816 | { |
| 817 | 817 | require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; |
| 818 | - $password=getRandomPassword(false); |
|
| 818 | + $password = getRandomPassword(false); |
|
| 819 | 819 | } |
| 820 | 820 | |
| 821 | 821 | // Crypt password |
| 822 | 822 | $password_crypted = dol_hash($password); |
| 823 | 823 | |
| 824 | 824 | $password_indatabase = ''; |
| 825 | - if (! $isencrypted) |
|
| 825 | + if (!$isencrypted) |
|
| 826 | 826 | { |
| 827 | 827 | $password_indatabase = $password; |
| 828 | 828 | } |
@@ -831,61 +831,61 @@ discard block |
||
| 831 | 831 | |
| 832 | 832 | // Mise a jour |
| 833 | 833 | $sql = "UPDATE ".MAIN_DB_PREFIX."adherent"; |
| 834 | - $sql.= " SET pass_crypted = '".$this->db->escape($password_crypted)."'"; |
|
| 834 | + $sql .= " SET pass_crypted = '".$this->db->escape($password_crypted)."'"; |
|
| 835 | 835 | //if (! empty($conf->global->DATABASE_PWD_ENCRYPTED)) |
| 836 | 836 | if ($isencrypted) |
| 837 | 837 | { |
| 838 | - $sql.= ", pass = null"; |
|
| 838 | + $sql .= ", pass = null"; |
|
| 839 | 839 | } |
| 840 | 840 | else |
| 841 | 841 | { |
| 842 | - $sql.= ", pass = '".$this->db->escape($password_indatabase)."'"; |
|
| 842 | + $sql .= ", pass = '".$this->db->escape($password_indatabase)."'"; |
|
| 843 | 843 | } |
| 844 | - $sql.= " WHERE rowid = ".$this->id; |
|
| 844 | + $sql .= " WHERE rowid = ".$this->id; |
|
| 845 | 845 | |
| 846 | 846 | //dol_syslog("Adherent::Password sql=hidden"); |
| 847 | 847 | dol_syslog(get_class($this)."::setPassword", LOG_DEBUG); |
| 848 | 848 | $result = $this->db->query($sql); |
| 849 | 849 | if ($result) |
| 850 | 850 | { |
| 851 | - $nbaffectedrows=$this->db->affected_rows($result); |
|
| 851 | + $nbaffectedrows = $this->db->affected_rows($result); |
|
| 852 | 852 | |
| 853 | 853 | if ($nbaffectedrows) |
| 854 | 854 | { |
| 855 | - $this->pass=$password; |
|
| 856 | - $this->pass_indatabase=$password_indatabase; |
|
| 857 | - $this->pass_indatabase_crypted=$password_crypted; |
|
| 855 | + $this->pass = $password; |
|
| 856 | + $this->pass_indatabase = $password_indatabase; |
|
| 857 | + $this->pass_indatabase_crypted = $password_crypted; |
|
| 858 | 858 | |
| 859 | - if ($this->user_id && ! $nosyncuser) |
|
| 859 | + if ($this->user_id && !$nosyncuser) |
|
| 860 | 860 | { |
| 861 | 861 | require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; |
| 862 | 862 | |
| 863 | 863 | // This member is linked with a user, so we also update users informations |
| 864 | 864 | // if this is an update. |
| 865 | - $luser=new User($this->db); |
|
| 866 | - $result=$luser->fetch($this->user_id); |
|
| 865 | + $luser = new User($this->db); |
|
| 866 | + $result = $luser->fetch($this->user_id); |
|
| 867 | 867 | |
| 868 | 868 | if ($result >= 0) |
| 869 | 869 | { |
| 870 | - $result=$luser->setPassword($user,$this->pass,0,0,1); |
|
| 870 | + $result = $luser->setPassword($user, $this->pass, 0, 0, 1); |
|
| 871 | 871 | if ($result < 0) |
| 872 | 872 | { |
| 873 | - $this->error=$luser->error; |
|
| 874 | - dol_syslog(get_class($this)."::setPassword ".$this->error,LOG_ERR); |
|
| 873 | + $this->error = $luser->error; |
|
| 874 | + dol_syslog(get_class($this)."::setPassword ".$this->error, LOG_ERR); |
|
| 875 | 875 | $error++; |
| 876 | 876 | } |
| 877 | 877 | } |
| 878 | 878 | else |
| 879 | 879 | { |
| 880 | - $this->error=$luser->error; |
|
| 880 | + $this->error = $luser->error; |
|
| 881 | 881 | $error++; |
| 882 | 882 | } |
| 883 | 883 | } |
| 884 | 884 | |
| 885 | - if (! $error && ! $notrigger) |
|
| 885 | + if (!$error && !$notrigger) |
|
| 886 | 886 | { |
| 887 | 887 | // Call trigger |
| 888 | - $result=$this->call_trigger('MEMBER_NEW_PASSWORD',$user); |
|
| 888 | + $result = $this->call_trigger('MEMBER_NEW_PASSWORD', $user); |
|
| 889 | 889 | if ($result < 0) { $error++; $this->db->rollback(); return -1; } |
| 890 | 890 | // End call triggers |
| 891 | 891 | } |
@@ -924,16 +924,16 @@ discard block |
||
| 924 | 924 | $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL WHERE fk_member = ".$this->id; |
| 925 | 925 | dol_syslog(get_class($this)."::setUserId", LOG_DEBUG); |
| 926 | 926 | $resql = $this->db->query($sql); |
| 927 | - if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -1; } |
|
| 927 | + if (!$resql) { $this->error = $this->db->error(); $this->db->rollback(); return -1; } |
|
| 928 | 928 | |
| 929 | 929 | // Set link to user |
| 930 | 930 | if ($userid > 0) |
| 931 | 931 | { |
| 932 | 932 | $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = ".$this->id; |
| 933 | - $sql.= " WHERE rowid = ".$userid; |
|
| 933 | + $sql .= " WHERE rowid = ".$userid; |
|
| 934 | 934 | dol_syslog(get_class($this)."::setUserId", LOG_DEBUG); |
| 935 | 935 | $resql = $this->db->query($sql); |
| 936 | - if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -2; } |
|
| 936 | + if (!$resql) { $this->error = $this->db->error(); $this->db->rollback(); return -2; } |
|
| 937 | 937 | } |
| 938 | 938 | |
| 939 | 939 | $this->db->commit(); |
@@ -958,15 +958,15 @@ discard block |
||
| 958 | 958 | if ($thirdpartyid > 0) |
| 959 | 959 | { |
| 960 | 960 | $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET fk_soc = null"; |
| 961 | - $sql.= " WHERE fk_soc = '".$thirdpartyid."'"; |
|
| 962 | - $sql.= " AND entity = ".$conf->entity; |
|
| 961 | + $sql .= " WHERE fk_soc = '".$thirdpartyid."'"; |
|
| 962 | + $sql .= " AND entity = ".$conf->entity; |
|
| 963 | 963 | dol_syslog(get_class($this)."::setThirdPartyId", LOG_DEBUG); |
| 964 | 964 | $resql = $this->db->query($sql); |
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | // Add link to third party for current member |
| 968 | - $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET fk_soc = ".($thirdpartyid>0 ? $thirdpartyid : 'null'); |
|
| 969 | - $sql.= " WHERE rowid = ".$this->id; |
|
| 968 | + $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET fk_soc = ".($thirdpartyid > 0 ? $thirdpartyid : 'null'); |
|
| 969 | + $sql .= " WHERE rowid = ".$this->id; |
|
| 970 | 970 | |
| 971 | 971 | dol_syslog(get_class($this)."::setThirdPartyId", LOG_DEBUG); |
| 972 | 972 | $resql = $this->db->query($sql); |
@@ -977,7 +977,7 @@ discard block |
||
| 977 | 977 | } |
| 978 | 978 | else |
| 979 | 979 | { |
| 980 | - $this->error=$this->db->error(); |
|
| 980 | + $this->error = $this->db->error(); |
|
| 981 | 981 | $this->db->rollback(); |
| 982 | 982 | return -1; |
| 983 | 983 | } |
@@ -995,10 +995,10 @@ discard block |
||
| 995 | 995 | global $conf; |
| 996 | 996 | |
| 997 | 997 | $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent"; |
| 998 | - $sql.= " WHERE login='".$this->db->escape($login)."'"; |
|
| 999 | - $sql.= " AND entity = ".$conf->entity; |
|
| 998 | + $sql .= " WHERE login='".$this->db->escape($login)."'"; |
|
| 999 | + $sql .= " AND entity = ".$conf->entity; |
|
| 1000 | 1000 | |
| 1001 | - $resql=$this->db->query($sql); |
|
| 1001 | + $resql = $this->db->query($sql); |
|
| 1002 | 1002 | if ($resql) |
| 1003 | 1003 | { |
| 1004 | 1004 | if ($this->db->num_rows($resql)) |
@@ -1020,16 +1020,16 @@ discard block |
||
| 1020 | 1020 | * @param string $lastname Lastname |
| 1021 | 1021 | * @return void |
| 1022 | 1022 | */ |
| 1023 | - function fetch_name($firstname,$lastname) |
|
| 1023 | + function fetch_name($firstname, $lastname) |
|
| 1024 | 1024 | { |
| 1025 | 1025 | global $conf; |
| 1026 | 1026 | |
| 1027 | 1027 | $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent"; |
| 1028 | - $sql.= " WHERE firstname='".$this->db->escape($firstname)."'"; |
|
| 1029 | - $sql.= " AND lastname='".$this->db->escape($lastname)."'"; |
|
| 1030 | - $sql.= " AND entity = ".$conf->entity; |
|
| 1028 | + $sql .= " WHERE firstname='".$this->db->escape($firstname)."'"; |
|
| 1029 | + $sql .= " AND lastname='".$this->db->escape($lastname)."'"; |
|
| 1030 | + $sql .= " AND entity = ".$conf->entity; |
|
| 1031 | 1031 | |
| 1032 | - $resql=$this->db->query($sql); |
|
| 1032 | + $resql = $this->db->query($sql); |
|
| 1033 | 1033 | if ($resql) |
| 1034 | 1034 | { |
| 1035 | 1035 | if ($this->db->num_rows($resql)) |
@@ -1053,83 +1053,83 @@ discard block |
||
| 1053 | 1053 | * @param string $ref_ext External reference |
| 1054 | 1054 | * @return int >0 if OK, 0 if not found, <0 if KO |
| 1055 | 1055 | */ |
| 1056 | - function fetch($rowid,$ref='',$fk_soc='',$ref_ext='') |
|
| 1056 | + function fetch($rowid, $ref = '', $fk_soc = '', $ref_ext = '') |
|
| 1057 | 1057 | { |
| 1058 | 1058 | global $langs; |
| 1059 | 1059 | |
| 1060 | 1060 | $sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,"; |
| 1061 | - $sql.= " d.note_public,"; |
|
| 1062 | - $sql.= " d.email, d.skype, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,"; |
|
| 1063 | - $sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,"; |
|
| 1064 | - $sql.= " d.datec as datec,"; |
|
| 1065 | - $sql.= " d.tms as datem,"; |
|
| 1066 | - $sql.= " d.datefin as datefin,"; |
|
| 1067 | - $sql.= " d.birth as birthday,"; |
|
| 1068 | - $sql.= " d.datevalid as datev,"; |
|
| 1069 | - $sql.= " d.country,"; |
|
| 1070 | - $sql.= " d.state_id,"; |
|
| 1071 | - $sql.= " d.model_pdf,"; |
|
| 1072 | - $sql.= " c.rowid as country_id, c.code as country_code, c.label as country,"; |
|
| 1073 | - $sql.= " dep.nom as state, dep.code_departement as state_code,"; |
|
| 1074 | - $sql.= " t.libelle as type, t.subscription as subscription,"; |
|
| 1075 | - $sql.= " u.rowid as user_id, u.login as user_login"; |
|
| 1076 | - $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d"; |
|
| 1077 | - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid"; |
|
| 1078 | - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as dep ON d.state_id = dep.rowid"; |
|
| 1079 | - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON d.rowid = u.fk_member"; |
|
| 1080 | - $sql.= " WHERE d.fk_adherent_type = t.rowid"; |
|
| 1081 | - if ($rowid) $sql.= " AND d.rowid=".$rowid; |
|
| 1061 | + $sql .= " d.note_public,"; |
|
| 1062 | + $sql .= " d.email, d.skype, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,"; |
|
| 1063 | + $sql .= " d.photo, d.fk_adherent_type, d.morphy, d.entity,"; |
|
| 1064 | + $sql .= " d.datec as datec,"; |
|
| 1065 | + $sql .= " d.tms as datem,"; |
|
| 1066 | + $sql .= " d.datefin as datefin,"; |
|
| 1067 | + $sql .= " d.birth as birthday,"; |
|
| 1068 | + $sql .= " d.datevalid as datev,"; |
|
| 1069 | + $sql .= " d.country,"; |
|
| 1070 | + $sql .= " d.state_id,"; |
|
| 1071 | + $sql .= " d.model_pdf,"; |
|
| 1072 | + $sql .= " c.rowid as country_id, c.code as country_code, c.label as country,"; |
|
| 1073 | + $sql .= " dep.nom as state, dep.code_departement as state_code,"; |
|
| 1074 | + $sql .= " t.libelle as type, t.subscription as subscription,"; |
|
| 1075 | + $sql .= " u.rowid as user_id, u.login as user_login"; |
|
| 1076 | + $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d"; |
|
| 1077 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid"; |
|
| 1078 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as dep ON d.state_id = dep.rowid"; |
|
| 1079 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON d.rowid = u.fk_member"; |
|
| 1080 | + $sql .= " WHERE d.fk_adherent_type = t.rowid"; |
|
| 1081 | + if ($rowid) $sql .= " AND d.rowid=".$rowid; |
|
| 1082 | 1082 | elseif ($ref || $fk_soc) { |
| 1083 | - $sql.= " AND d.entity IN (".getEntity('adherent').")"; |
|
| 1084 | - if ($ref) $sql.= " AND d.rowid='".$this->db->escape($ref)."'"; |
|
| 1085 | - elseif ($fk_soc > 0) $sql.= " AND d.fk_soc=".$fk_soc; |
|
| 1083 | + $sql .= " AND d.entity IN (".getEntity('adherent').")"; |
|
| 1084 | + if ($ref) $sql .= " AND d.rowid='".$this->db->escape($ref)."'"; |
|
| 1085 | + elseif ($fk_soc > 0) $sql .= " AND d.fk_soc=".$fk_soc; |
|
| 1086 | 1086 | } |
| 1087 | 1087 | elseif ($ref_ext) |
| 1088 | 1088 | { |
| 1089 | - $sql.= " AND d.ref_ext='".$this->db->escape($ref_ext)."'"; |
|
| 1089 | + $sql .= " AND d.ref_ext='".$this->db->escape($ref_ext)."'"; |
|
| 1090 | 1090 | } |
| 1091 | 1091 | |
| 1092 | 1092 | dol_syslog(get_class($this)."::fetch", LOG_DEBUG); |
| 1093 | - $resql=$this->db->query($sql); |
|
| 1093 | + $resql = $this->db->query($sql); |
|
| 1094 | 1094 | if ($resql) |
| 1095 | 1095 | { |
| 1096 | 1096 | if ($this->db->num_rows($resql)) |
| 1097 | 1097 | { |
| 1098 | 1098 | $obj = $this->db->fetch_object($resql); |
| 1099 | 1099 | |
| 1100 | - $this->entity = $obj->entity; |
|
| 1101 | - $this->ref = $obj->rowid; |
|
| 1102 | - $this->id = $obj->rowid; |
|
| 1103 | - $this->ref_ext = $obj->ref_ext; |
|
| 1104 | - $this->civility_id = $obj->civility_id; |
|
| 1100 | + $this->entity = $obj->entity; |
|
| 1101 | + $this->ref = $obj->rowid; |
|
| 1102 | + $this->id = $obj->rowid; |
|
| 1103 | + $this->ref_ext = $obj->ref_ext; |
|
| 1104 | + $this->civility_id = $obj->civility_id; |
|
| 1105 | 1105 | $this->firstname = $obj->firstname; |
| 1106 | 1106 | $this->lastname = $obj->lastname; |
| 1107 | - $this->login = $obj->login; |
|
| 1107 | + $this->login = $obj->login; |
|
| 1108 | 1108 | $this->societe = $obj->company; |
| 1109 | 1109 | $this->company = $obj->company; |
| 1110 | - $this->fk_soc = $obj->fk_soc; |
|
| 1110 | + $this->fk_soc = $obj->fk_soc; |
|
| 1111 | 1111 | $this->address = $obj->address; |
| 1112 | - $this->zip = $obj->zip; |
|
| 1112 | + $this->zip = $obj->zip; |
|
| 1113 | 1113 | $this->town = $obj->town; |
| 1114 | 1114 | |
| 1115 | 1115 | $this->pass = $obj->pass; |
| 1116 | - $this->pass_indatabase = $obj->pass; |
|
| 1116 | + $this->pass_indatabase = $obj->pass; |
|
| 1117 | 1117 | $this->pass_indatabase_crypted = $obj->pass_crypted; |
| 1118 | 1118 | |
| 1119 | - $this->state_id = $obj->state_id; |
|
| 1120 | - $this->state_code = $obj->state_id?$obj->state_code:''; |
|
| 1121 | - $this->state = $obj->state_id?$obj->state:''; |
|
| 1119 | + $this->state_id = $obj->state_id; |
|
| 1120 | + $this->state_code = $obj->state_id ? $obj->state_code : ''; |
|
| 1121 | + $this->state = $obj->state_id ? $obj->state : ''; |
|
| 1122 | 1122 | |
| 1123 | 1123 | $this->country_id = $obj->country_id; |
| 1124 | - $this->country_code = $obj->country_code; |
|
| 1124 | + $this->country_code = $obj->country_code; |
|
| 1125 | 1125 | if ($langs->trans("Country".$obj->country_code) != "Country".$obj->country_code) |
| 1126 | 1126 | $this->country = $langs->transnoentitiesnoconv("Country".$obj->country_code); |
| 1127 | 1127 | else |
| 1128 | - $this->country=$obj->country; |
|
| 1128 | + $this->country = $obj->country; |
|
| 1129 | 1129 | |
| 1130 | 1130 | $this->phone = $obj->phone; |
| 1131 | - $this->phone_perso = $obj->phone_perso; |
|
| 1132 | - $this->phone_mobile = $obj->phone_mobile; |
|
| 1131 | + $this->phone_perso = $obj->phone_perso; |
|
| 1132 | + $this->phone_mobile = $obj->phone_mobile; |
|
| 1133 | 1133 | $this->email = $obj->email; |
| 1134 | 1134 | $this->skype = $obj->skype; |
| 1135 | 1135 | |
@@ -1139,29 +1139,29 @@ discard block |
||
| 1139 | 1139 | |
| 1140 | 1140 | $this->datec = $this->db->jdate($obj->datec); |
| 1141 | 1141 | $this->datem = $this->db->jdate($obj->datem); |
| 1142 | - $this->datefin = $this->db->jdate($obj->datefin); |
|
| 1143 | - $this->datevalid = $this->db->jdate($obj->datev); |
|
| 1142 | + $this->datefin = $this->db->jdate($obj->datefin); |
|
| 1143 | + $this->datevalid = $this->db->jdate($obj->datev); |
|
| 1144 | 1144 | $this->birth = $this->db->jdate($obj->birthday); |
| 1145 | 1145 | |
| 1146 | - $this->note_private = $obj->note_private; |
|
| 1147 | - $this->note_public = $obj->note_public; |
|
| 1146 | + $this->note_private = $obj->note_private; |
|
| 1147 | + $this->note_public = $obj->note_public; |
|
| 1148 | 1148 | $this->morphy = $obj->morphy; |
| 1149 | 1149 | |
| 1150 | 1150 | $this->typeid = $obj->fk_adherent_type; |
| 1151 | - $this->type = $obj->type; |
|
| 1152 | - $this->need_subscription = $obj->subscription; |
|
| 1151 | + $this->type = $obj->type; |
|
| 1152 | + $this->need_subscription = $obj->subscription; |
|
| 1153 | 1153 | |
| 1154 | - $this->user_id = $obj->user_id; |
|
| 1155 | - $this->user_login = $obj->user_login; |
|
| 1154 | + $this->user_id = $obj->user_id; |
|
| 1155 | + $this->user_login = $obj->user_login; |
|
| 1156 | 1156 | |
| 1157 | - $this->model_pdf = $obj->model_pdf; |
|
| 1157 | + $this->model_pdf = $obj->model_pdf; |
|
| 1158 | 1158 | |
| 1159 | 1159 | // Retreive all extrafield |
| 1160 | 1160 | // fetch optionals attributes and labels |
| 1161 | 1161 | $this->fetch_optionals(); |
| 1162 | 1162 | |
| 1163 | 1163 | // Load other properties |
| 1164 | - $result=$this->fetch_subscriptions(); |
|
| 1164 | + $result = $this->fetch_subscriptions(); |
|
| 1165 | 1165 | |
| 1166 | 1166 | return $this->id; |
| 1167 | 1167 | } |
@@ -1172,7 +1172,7 @@ discard block |
||
| 1172 | 1172 | } |
| 1173 | 1173 | else |
| 1174 | 1174 | { |
| 1175 | - $this->error=$this->db->lasterror(); |
|
| 1175 | + $this->error = $this->db->lasterror(); |
|
| 1176 | 1176 | return -1; |
| 1177 | 1177 | } |
| 1178 | 1178 | } |
@@ -1194,43 +1194,43 @@ discard block |
||
| 1194 | 1194 | require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; |
| 1195 | 1195 | |
| 1196 | 1196 | $sql = "SELECT c.rowid, c.fk_adherent, c.subscription, c.note, c.fk_bank,"; |
| 1197 | - $sql.= " c.tms as datem,"; |
|
| 1198 | - $sql.= " c.datec as datec,"; |
|
| 1199 | - $sql.= " c.dateadh as dateh,"; |
|
| 1200 | - $sql.= " c.datef as datef"; |
|
| 1201 | - $sql.= " FROM ".MAIN_DB_PREFIX."subscription as c"; |
|
| 1202 | - $sql.= " WHERE c.fk_adherent = ".$this->id; |
|
| 1203 | - $sql.= " ORDER BY c.dateadh"; |
|
| 1197 | + $sql .= " c.tms as datem,"; |
|
| 1198 | + $sql .= " c.datec as datec,"; |
|
| 1199 | + $sql .= " c.dateadh as dateh,"; |
|
| 1200 | + $sql .= " c.datef as datef"; |
|
| 1201 | + $sql .= " FROM ".MAIN_DB_PREFIX."subscription as c"; |
|
| 1202 | + $sql .= " WHERE c.fk_adherent = ".$this->id; |
|
| 1203 | + $sql .= " ORDER BY c.dateadh"; |
|
| 1204 | 1204 | dol_syslog(get_class($this)."::fetch_subscriptions", LOG_DEBUG); |
| 1205 | 1205 | |
| 1206 | - $resql=$this->db->query($sql); |
|
| 1206 | + $resql = $this->db->query($sql); |
|
| 1207 | 1207 | if ($resql) |
| 1208 | 1208 | { |
| 1209 | - $this->subscriptions=array(); |
|
| 1209 | + $this->subscriptions = array(); |
|
| 1210 | 1210 | |
| 1211 | - $i=0; |
|
| 1211 | + $i = 0; |
|
| 1212 | 1212 | while ($obj = $this->db->fetch_object($resql)) |
| 1213 | 1213 | { |
| 1214 | - if ($i==0) |
|
| 1214 | + if ($i == 0) |
|
| 1215 | 1215 | { |
| 1216 | - $this->first_subscription_date=$obj->dateh; |
|
| 1217 | - $this->first_subscription_amount=$obj->subscription; |
|
| 1216 | + $this->first_subscription_date = $obj->dateh; |
|
| 1217 | + $this->first_subscription_amount = $obj->subscription; |
|
| 1218 | 1218 | } |
| 1219 | - $this->last_subscription_date=$obj->dateh; |
|
| 1220 | - $this->last_subscription_amount=$obj->subscription; |
|
| 1221 | - |
|
| 1222 | - $subscription=new Subscription($this->db); |
|
| 1223 | - $subscription->id=$obj->rowid; |
|
| 1224 | - $subscription->fk_adherent=$obj->fk_adherent; |
|
| 1225 | - $subscription->amount=$obj->subscription; |
|
| 1226 | - $subscription->note=$obj->note; |
|
| 1227 | - $subscription->fk_bank=$obj->fk_bank; |
|
| 1228 | - $subscription->datem=$this->db->jdate($obj->datem); |
|
| 1229 | - $subscription->datec=$this->db->jdate($obj->datec); |
|
| 1230 | - $subscription->dateh=$this->db->jdate($obj->dateh); |
|
| 1231 | - $subscription->datef=$this->db->jdate($obj->datef); |
|
| 1232 | - |
|
| 1233 | - $this->subscriptions[]=$subscription; |
|
| 1219 | + $this->last_subscription_date = $obj->dateh; |
|
| 1220 | + $this->last_subscription_amount = $obj->subscription; |
|
| 1221 | + |
|
| 1222 | + $subscription = new Subscription($this->db); |
|
| 1223 | + $subscription->id = $obj->rowid; |
|
| 1224 | + $subscription->fk_adherent = $obj->fk_adherent; |
|
| 1225 | + $subscription->amount = $obj->subscription; |
|
| 1226 | + $subscription->note = $obj->note; |
|
| 1227 | + $subscription->fk_bank = $obj->fk_bank; |
|
| 1228 | + $subscription->datem = $this->db->jdate($obj->datem); |
|
| 1229 | + $subscription->datec = $this->db->jdate($obj->datec); |
|
| 1230 | + $subscription->dateh = $this->db->jdate($obj->dateh); |
|
| 1231 | + $subscription->datef = $this->db->jdate($obj->datef); |
|
| 1232 | + |
|
| 1233 | + $this->subscriptions[] = $subscription; |
|
| 1234 | 1234 | |
| 1235 | 1235 | $i++; |
| 1236 | 1236 | } |
@@ -1238,7 +1238,7 @@ discard block |
||
| 1238 | 1238 | } |
| 1239 | 1239 | else |
| 1240 | 1240 | { |
| 1241 | - $this->error=$this->db->error().' sql='.$sql; |
|
| 1241 | + $this->error = $this->db->error().' sql='.$sql; |
|
| 1242 | 1242 | return -1; |
| 1243 | 1243 | } |
| 1244 | 1244 | } |
@@ -1258,55 +1258,55 @@ discard block |
||
| 1258 | 1258 | * @param int $datesubend Date end subscription |
| 1259 | 1259 | * @return int rowid of record added, <0 if KO |
| 1260 | 1260 | */ |
| 1261 | - function subscription($date, $amount, $accountid=0, $operation='', $label='', $num_chq='', $emetteur_nom='', $emetteur_banque='', $datesubend=0) |
|
| 1261 | + function subscription($date, $amount, $accountid = 0, $operation = '', $label = '', $num_chq = '', $emetteur_nom = '', $emetteur_banque = '', $datesubend = 0) |
|
| 1262 | 1262 | { |
| 1263 | - global $conf,$langs,$user; |
|
| 1263 | + global $conf, $langs, $user; |
|
| 1264 | 1264 | |
| 1265 | 1265 | require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; |
| 1266 | 1266 | |
| 1267 | - $error=0; |
|
| 1267 | + $error = 0; |
|
| 1268 | 1268 | |
| 1269 | 1269 | // Clean parameters |
| 1270 | - if (! $amount) $amount=0; |
|
| 1270 | + if (!$amount) $amount = 0; |
|
| 1271 | 1271 | |
| 1272 | 1272 | $this->db->begin(); |
| 1273 | 1273 | |
| 1274 | 1274 | if ($datesubend) |
| 1275 | 1275 | { |
| 1276 | - $datefin=$datesubend; |
|
| 1276 | + $datefin = $datesubend; |
|
| 1277 | 1277 | } |
| 1278 | 1278 | else |
| 1279 | 1279 | { |
| 1280 | 1280 | // If no end date, end date = date + 1 year - 1 day |
| 1281 | - $datefin = dol_time_plus_duree($date,1,'y'); |
|
| 1282 | - $datefin = dol_time_plus_duree($datefin,-1,'d'); |
|
| 1281 | + $datefin = dol_time_plus_duree($date, 1, 'y'); |
|
| 1282 | + $datefin = dol_time_plus_duree($datefin, -1, 'd'); |
|
| 1283 | 1283 | } |
| 1284 | 1284 | |
| 1285 | 1285 | // Create subscription |
| 1286 | - $subscription=new Subscription($this->db); |
|
| 1287 | - $subscription->fk_adherent=$this->id; |
|
| 1288 | - $subscription->dateh=$date; // Date of new subscription |
|
| 1289 | - $subscription->datef=$datefin; // End data of new subscription |
|
| 1290 | - $subscription->amount=$amount; |
|
| 1291 | - $subscription->note=$label; // deprecated |
|
| 1292 | - $subscription->note_public=$label; |
|
| 1293 | - |
|
| 1294 | - $rowid=$subscription->create($user); |
|
| 1286 | + $subscription = new Subscription($this->db); |
|
| 1287 | + $subscription->fk_adherent = $this->id; |
|
| 1288 | + $subscription->dateh = $date; // Date of new subscription |
|
| 1289 | + $subscription->datef = $datefin; // End data of new subscription |
|
| 1290 | + $subscription->amount = $amount; |
|
| 1291 | + $subscription->note = $label; // deprecated |
|
| 1292 | + $subscription->note_public = $label; |
|
| 1293 | + |
|
| 1294 | + $rowid = $subscription->create($user); |
|
| 1295 | 1295 | if ($rowid > 0) |
| 1296 | 1296 | { |
| 1297 | 1297 | // Update denormalized subscription end date (read database subscription to find values) |
| 1298 | 1298 | // This will also update this->datefin |
| 1299 | - $result=$this->update_end_date($user); |
|
| 1299 | + $result = $this->update_end_date($user); |
|
| 1300 | 1300 | if ($result > 0) |
| 1301 | 1301 | { |
| 1302 | 1302 | // Change properties of object (used by triggers) |
| 1303 | - $this->last_subscription_date=dol_now(); |
|
| 1304 | - $this->last_subscription_amount=$amount; |
|
| 1305 | - $this->last_subscription_date_start=$date; |
|
| 1306 | - $this->last_subscription_date_end=$datefin; |
|
| 1303 | + $this->last_subscription_date = dol_now(); |
|
| 1304 | + $this->last_subscription_amount = $amount; |
|
| 1305 | + $this->last_subscription_date_start = $date; |
|
| 1306 | + $this->last_subscription_date_end = $datefin; |
|
| 1307 | 1307 | } |
| 1308 | 1308 | |
| 1309 | - if (! $error) |
|
| 1309 | + if (!$error) |
|
| 1310 | 1310 | { |
| 1311 | 1311 | $this->db->commit(); |
| 1312 | 1312 | return $rowid; |
@@ -1319,8 +1319,8 @@ discard block |
||
| 1319 | 1319 | } |
| 1320 | 1320 | else |
| 1321 | 1321 | { |
| 1322 | - $this->error=$subscription->error; |
|
| 1323 | - $this->errors=$subscription->errors; |
|
| 1322 | + $this->error = $subscription->error; |
|
| 1323 | + $this->errors = $subscription->errors; |
|
| 1324 | 1324 | $this->db->rollback(); |
| 1325 | 1325 | return -1; |
| 1326 | 1326 | } |
@@ -1344,55 +1344,55 @@ discard block |
||
| 1344 | 1344 | * @param string $autocreatethirdparty Auto create new thirdparty if member not linked to a thirdparty. |
| 1345 | 1345 | * @return int <0 if KO, >0 if OK |
| 1346 | 1346 | */ |
| 1347 | - function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom='', $emetteur_banque='', $autocreatethirdparty=0) |
|
| 1347 | + function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom = '', $emetteur_banque = '', $autocreatethirdparty = 0) |
|
| 1348 | 1348 | { |
| 1349 | 1349 | global $conf, $langs, $user, $mysoc; |
| 1350 | 1350 | |
| 1351 | 1351 | $error = 0; |
| 1352 | 1352 | |
| 1353 | - $this->invoice = null; // This will contains invoice if an invoice is created |
|
| 1353 | + $this->invoice = null; // This will contains invoice if an invoice is created |
|
| 1354 | 1354 | |
| 1355 | 1355 | // Insert into bank account directlty (if option choosed for) + link to llx_subscription if option is 'bankdirect' |
| 1356 | 1356 | if ($option == 'bankdirect' && $accountid) |
| 1357 | 1357 | { |
| 1358 | 1358 | require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; |
| 1359 | 1359 | |
| 1360 | - $acct=new Account($this->db); |
|
| 1361 | - $result=$acct->fetch($accountid); |
|
| 1360 | + $acct = new Account($this->db); |
|
| 1361 | + $result = $acct->fetch($accountid); |
|
| 1362 | 1362 | |
| 1363 | - $dateop=$paymentdate; |
|
| 1363 | + $dateop = $paymentdate; |
|
| 1364 | 1364 | |
| 1365 | - $insertid=$acct->addline($dateop, $operation, $label, $amount, $num_chq, '', $user, $emetteur_nom, $emetteur_banque); |
|
| 1365 | + $insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, '', $user, $emetteur_nom, $emetteur_banque); |
|
| 1366 | 1366 | if ($insertid > 0) |
| 1367 | 1367 | { |
| 1368 | - $inserturlid=$acct->add_url_line($insertid, $this->id, DOL_URL_ROOT.'/adherents/card.php?rowid=', $this->getFullname($langs), 'member'); |
|
| 1368 | + $inserturlid = $acct->add_url_line($insertid, $this->id, DOL_URL_ROOT.'/adherents/card.php?rowid=', $this->getFullname($langs), 'member'); |
|
| 1369 | 1369 | if ($inserturlid > 0) |
| 1370 | 1370 | { |
| 1371 | 1371 | // Update table subscription |
| 1372 | - $sql ="UPDATE ".MAIN_DB_PREFIX."subscription SET fk_bank=".$insertid; |
|
| 1373 | - $sql.=" WHERE rowid=".$subscriptionid; |
|
| 1372 | + $sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET fk_bank=".$insertid; |
|
| 1373 | + $sql .= " WHERE rowid=".$subscriptionid; |
|
| 1374 | 1374 | |
| 1375 | 1375 | dol_syslog("subscription::subscription", LOG_DEBUG); |
| 1376 | 1376 | $resql = $this->db->query($sql); |
| 1377 | - if (! $resql) |
|
| 1377 | + if (!$resql) |
|
| 1378 | 1378 | { |
| 1379 | 1379 | $error++; |
| 1380 | - $this->error=$this->db->lasterror(); |
|
| 1381 | - $this->errors[]=$this->error; |
|
| 1380 | + $this->error = $this->db->lasterror(); |
|
| 1381 | + $this->errors[] = $this->error; |
|
| 1382 | 1382 | } |
| 1383 | 1383 | } |
| 1384 | 1384 | else |
| 1385 | 1385 | { |
| 1386 | 1386 | $error++; |
| 1387 | - $this->error=$acct->error; |
|
| 1388 | - $this->errors=$acct->errors; |
|
| 1387 | + $this->error = $acct->error; |
|
| 1388 | + $this->errors = $acct->errors; |
|
| 1389 | 1389 | } |
| 1390 | 1390 | } |
| 1391 | 1391 | else |
| 1392 | 1392 | { |
| 1393 | 1393 | $error++; |
| 1394 | - $this->error=$acct->error; |
|
| 1395 | - $this->errors=$acct->errors; |
|
| 1394 | + $this->error = $acct->error; |
|
| 1395 | + $this->errors = $acct->errors; |
|
| 1396 | 1396 | } |
| 1397 | 1397 | } |
| 1398 | 1398 | |
@@ -1402,31 +1402,31 @@ discard block |
||
| 1402 | 1402 | require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
| 1403 | 1403 | require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php'; |
| 1404 | 1404 | |
| 1405 | - $invoice=new Facture($this->db); |
|
| 1406 | - $customer=new Societe($this->db); |
|
| 1405 | + $invoice = new Facture($this->db); |
|
| 1406 | + $customer = new Societe($this->db); |
|
| 1407 | 1407 | |
| 1408 | - if (! $error) |
|
| 1408 | + if (!$error) |
|
| 1409 | 1409 | { |
| 1410 | - if (! ($this->fk_soc > 0)) |
|
| 1410 | + if (!($this->fk_soc > 0)) |
|
| 1411 | 1411 | { |
| 1412 | 1412 | if ($autocreatethirdparty) |
| 1413 | 1413 | { |
| 1414 | 1414 | // Create a linked thirdparty to member |
| 1415 | - $companyalias=''; |
|
| 1415 | + $companyalias = ''; |
|
| 1416 | 1416 | $fullname = $this->getFullName($langs); |
| 1417 | 1417 | |
| 1418 | 1418 | if ($this->morphy == 'mor') |
| 1419 | 1419 | { |
| 1420 | - $companyname=$this->societe; |
|
| 1421 | - if (! empty($fullname)) $companyalias=$fullname; |
|
| 1420 | + $companyname = $this->societe; |
|
| 1421 | + if (!empty($fullname)) $companyalias = $fullname; |
|
| 1422 | 1422 | } |
| 1423 | 1423 | else |
| 1424 | 1424 | { |
| 1425 | - $companyname=$fullname; |
|
| 1426 | - if (! empty($this->societe)) $companyalias=$this->societe; |
|
| 1425 | + $companyname = $fullname; |
|
| 1426 | + if (!empty($this->societe)) $companyalias = $this->societe; |
|
| 1427 | 1427 | } |
| 1428 | 1428 | |
| 1429 | - $result=$customer->create_from_member($this, $companyname, $companyalias); |
|
| 1429 | + $result = $customer->create_from_member($this, $companyname, $companyalias); |
|
| 1430 | 1430 | if ($result < 0) |
| 1431 | 1431 | { |
| 1432 | 1432 | $this->error = $customer->error; |
@@ -1441,54 +1441,54 @@ discard block |
||
| 1441 | 1441 | else |
| 1442 | 1442 | { |
| 1443 | 1443 | $langs->load("errors"); |
| 1444 | - $this->error=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst"); |
|
| 1445 | - $this->errors[]=$this->error; |
|
| 1444 | + $this->error = $langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst"); |
|
| 1445 | + $this->errors[] = $this->error; |
|
| 1446 | 1446 | $error++; |
| 1447 | 1447 | } |
| 1448 | 1448 | } |
| 1449 | 1449 | } |
| 1450 | - if (! $error) |
|
| 1450 | + if (!$error) |
|
| 1451 | 1451 | { |
| 1452 | - $result=$customer->fetch($this->fk_soc); |
|
| 1452 | + $result = $customer->fetch($this->fk_soc); |
|
| 1453 | 1453 | if ($result <= 0) |
| 1454 | 1454 | { |
| 1455 | - $this->error=$customer->error; |
|
| 1456 | - $this->errors=$customer->errors; |
|
| 1455 | + $this->error = $customer->error; |
|
| 1456 | + $this->errors = $customer->errors; |
|
| 1457 | 1457 | $error++; |
| 1458 | 1458 | } |
| 1459 | 1459 | } |
| 1460 | 1460 | |
| 1461 | - if (! $error) |
|
| 1461 | + if (!$error) |
|
| 1462 | 1462 | { |
| 1463 | 1463 | // Create draft invoice |
| 1464 | - $invoice->type=Facture::TYPE_STANDARD; |
|
| 1465 | - $invoice->cond_reglement_id=$customer->cond_reglement_id; |
|
| 1464 | + $invoice->type = Facture::TYPE_STANDARD; |
|
| 1465 | + $invoice->cond_reglement_id = $customer->cond_reglement_id; |
|
| 1466 | 1466 | if (empty($invoice->cond_reglement_id)) |
| 1467 | 1467 | { |
| 1468 | - $paymenttermstatic=new PaymentTerm($this->db); |
|
| 1469 | - $invoice->cond_reglement_id=$paymenttermstatic->getDefaultId(); |
|
| 1468 | + $paymenttermstatic = new PaymentTerm($this->db); |
|
| 1469 | + $invoice->cond_reglement_id = $paymenttermstatic->getDefaultId(); |
|
| 1470 | 1470 | if (empty($invoice->cond_reglement_id)) |
| 1471 | 1471 | { |
| 1472 | 1472 | $error++; |
| 1473 | - $this->error='ErrorNoPaymentTermRECEPFound'; |
|
| 1474 | - $this->errors[]=$this->error; |
|
| 1473 | + $this->error = 'ErrorNoPaymentTermRECEPFound'; |
|
| 1474 | + $this->errors[] = $this->error; |
|
| 1475 | 1475 | } |
| 1476 | 1476 | } |
| 1477 | - $invoice->socid=$this->fk_soc; |
|
| 1478 | - $invoice->date=$datesubscription; |
|
| 1477 | + $invoice->socid = $this->fk_soc; |
|
| 1478 | + $invoice->date = $datesubscription; |
|
| 1479 | 1479 | |
| 1480 | 1480 | // Possibility to add external linked objects with hooks |
| 1481 | 1481 | $invoice->linked_objects['subscription'] = $subscriptionid; |
| 1482 | - if (! empty($_POST['other_linked_objects']) && is_array($_POST['other_linked_objects'])) |
|
| 1482 | + if (!empty($_POST['other_linked_objects']) && is_array($_POST['other_linked_objects'])) |
|
| 1483 | 1483 | { |
| 1484 | 1484 | $invoice->linked_objects = array_merge($invoice->linked_objects, $_POST['other_linked_objects']); |
| 1485 | 1485 | } |
| 1486 | 1486 | |
| 1487 | - $result=$invoice->create($user); |
|
| 1487 | + $result = $invoice->create($user); |
|
| 1488 | 1488 | if ($result <= 0) |
| 1489 | 1489 | { |
| 1490 | - $this->error=$invoice->error; |
|
| 1491 | - $this->errors=$invoice->errors; |
|
| 1490 | + $this->error = $invoice->error; |
|
| 1491 | + $this->errors = $invoice->errors; |
|
| 1492 | 1492 | $error++; |
| 1493 | 1493 | } |
| 1494 | 1494 | else |
@@ -1497,46 +1497,46 @@ discard block |
||
| 1497 | 1497 | } |
| 1498 | 1498 | } |
| 1499 | 1499 | |
| 1500 | - if (! $error) |
|
| 1500 | + if (!$error) |
|
| 1501 | 1501 | { |
| 1502 | 1502 | // Add line to draft invoice |
| 1503 | - $idprodsubscription=0; |
|
| 1504 | - if (! empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) $idprodsubscription = $conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS; |
|
| 1503 | + $idprodsubscription = 0; |
|
| 1504 | + if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) $idprodsubscription = $conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS; |
|
| 1505 | 1505 | |
| 1506 | - $vattouse=0; |
|
| 1506 | + $vattouse = 0; |
|
| 1507 | 1507 | if (isset($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) && $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS == 'defaultforfoundationcountry') |
| 1508 | 1508 | { |
| 1509 | - $vattouse=get_default_tva($mysoc, $mysoc, $idprodsubscription); |
|
| 1509 | + $vattouse = get_default_tva($mysoc, $mysoc, $idprodsubscription); |
|
| 1510 | 1510 | } |
| 1511 | 1511 | //print xx".$vattouse." - ".$mysoc." - ".$customer;exit; |
| 1512 | - $result=$invoice->addline($label,0,1,$vattouse,0,0,$idprodsubscription,0,$datesubscription,'',0,0,'','TTC',$amount,1); |
|
| 1512 | + $result = $invoice->addline($label, 0, 1, $vattouse, 0, 0, $idprodsubscription, 0, $datesubscription, '', 0, 0, '', 'TTC', $amount, 1); |
|
| 1513 | 1513 | if ($result <= 0) |
| 1514 | 1514 | { |
| 1515 | - $this->error=$invoice->error; |
|
| 1516 | - $this->errors=$invoice->errors; |
|
| 1515 | + $this->error = $invoice->error; |
|
| 1516 | + $this->errors = $invoice->errors; |
|
| 1517 | 1517 | $error++; |
| 1518 | 1518 | } |
| 1519 | 1519 | } |
| 1520 | 1520 | |
| 1521 | - if (! $error) |
|
| 1521 | + if (!$error) |
|
| 1522 | 1522 | { |
| 1523 | 1523 | // Validate invoice |
| 1524 | - $result=$invoice->validate($user); |
|
| 1524 | + $result = $invoice->validate($user); |
|
| 1525 | 1525 | if ($result <= 0) |
| 1526 | 1526 | { |
| 1527 | - $this->error=$invoice->error; |
|
| 1528 | - $this->errors=$invoice->errors; |
|
| 1527 | + $this->error = $invoice->error; |
|
| 1528 | + $this->errors = $invoice->errors; |
|
| 1529 | 1529 | $error++; |
| 1530 | 1530 | } |
| 1531 | 1531 | } |
| 1532 | 1532 | |
| 1533 | - if (! $error) |
|
| 1533 | + if (!$error) |
|
| 1534 | 1534 | { |
| 1535 | 1535 | // TODO Link invoice with subscription ? |
| 1536 | 1536 | } |
| 1537 | 1537 | |
| 1538 | 1538 | // Add payment onto invoice |
| 1539 | - if (! $error && $option == 'bankviainvoice' && $accountid) |
|
| 1539 | + if (!$error && $option == 'bankviainvoice' && $accountid) |
|
| 1540 | 1540 | { |
| 1541 | 1541 | require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; |
| 1542 | 1542 | require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; |
@@ -1548,66 +1548,66 @@ discard block |
||
| 1548 | 1548 | $paiement = new Paiement($this->db); |
| 1549 | 1549 | $paiement->datepaye = $paymentdate; |
| 1550 | 1550 | $paiement->amounts = $amounts; |
| 1551 | - $paiement->paiementid = dol_getIdFromCode($this->db,$operation,'c_paiement','code','id',1); |
|
| 1551 | + $paiement->paiementid = dol_getIdFromCode($this->db, $operation, 'c_paiement', 'code', 'id', 1); |
|
| 1552 | 1552 | $paiement->num_paiement = $num_chq; |
| 1553 | 1553 | $paiement->note = $label; |
| 1554 | 1554 | $paiement->note_public = $label; |
| 1555 | 1555 | |
| 1556 | - if (! $error) |
|
| 1556 | + if (!$error) |
|
| 1557 | 1557 | { |
| 1558 | 1558 | // Create payment line for invoice |
| 1559 | 1559 | $paiement_id = $paiement->create($user); |
| 1560 | - if (! $paiement_id > 0) |
|
| 1560 | + if (!$paiement_id > 0) |
|
| 1561 | 1561 | { |
| 1562 | - $this->error=$paiement->error; |
|
| 1563 | - $this->errors=$paiement->errors; |
|
| 1562 | + $this->error = $paiement->error; |
|
| 1563 | + $this->errors = $paiement->errors; |
|
| 1564 | 1564 | $error++; |
| 1565 | 1565 | } |
| 1566 | 1566 | } |
| 1567 | 1567 | |
| 1568 | - if (! $error) |
|
| 1568 | + if (!$error) |
|
| 1569 | 1569 | { |
| 1570 | 1570 | // Add transaction into bank account |
| 1571 | - $bank_line_id=$paiement->addPaymentToBank($user,'payment','(SubscriptionPayment)',$accountid,$emetteur_nom,$emetteur_banque); |
|
| 1572 | - if (! ($bank_line_id > 0)) |
|
| 1571 | + $bank_line_id = $paiement->addPaymentToBank($user, 'payment', '(SubscriptionPayment)', $accountid, $emetteur_nom, $emetteur_banque); |
|
| 1572 | + if (!($bank_line_id > 0)) |
|
| 1573 | 1573 | { |
| 1574 | - $this->error=$paiement->error; |
|
| 1575 | - $this->errors=$paiement->errors; |
|
| 1574 | + $this->error = $paiement->error; |
|
| 1575 | + $this->errors = $paiement->errors; |
|
| 1576 | 1576 | $error++; |
| 1577 | 1577 | } |
| 1578 | 1578 | } |
| 1579 | 1579 | |
| 1580 | - if (! $error && !empty($bank_line_id)) |
|
| 1580 | + if (!$error && !empty($bank_line_id)) |
|
| 1581 | 1581 | { |
| 1582 | 1582 | // Update fk_bank into subscription table |
| 1583 | 1583 | $sql = 'UPDATE '.MAIN_DB_PREFIX.'subscription SET fk_bank='.$bank_line_id; |
| 1584 | - $sql.= ' WHERE rowid='.$subscriptionid; |
|
| 1584 | + $sql .= ' WHERE rowid='.$subscriptionid; |
|
| 1585 | 1585 | |
| 1586 | 1586 | $result = $this->db->query($sql); |
| 1587 | - if (! $result) |
|
| 1587 | + if (!$result) |
|
| 1588 | 1588 | { |
| 1589 | 1589 | $error++; |
| 1590 | 1590 | } |
| 1591 | 1591 | } |
| 1592 | 1592 | |
| 1593 | - if (! $error) |
|
| 1593 | + if (!$error) |
|
| 1594 | 1594 | { |
| 1595 | 1595 | // Set invoice as paid |
| 1596 | 1596 | $invoice->set_paid($user); |
| 1597 | 1597 | } |
| 1598 | 1598 | } |
| 1599 | 1599 | |
| 1600 | - if (! $error) |
|
| 1600 | + if (!$error) |
|
| 1601 | 1601 | { |
| 1602 | 1602 | // Define output language |
| 1603 | 1603 | $outputlangs = $langs; |
| 1604 | 1604 | $newlang = ''; |
| 1605 | - $lang_id=GETPOST('lang_id'); |
|
| 1606 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($lang_id)) |
|
| 1605 | + $lang_id = GETPOST('lang_id'); |
|
| 1606 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($lang_id)) |
|
| 1607 | 1607 | $newlang = $lang_id; |
| 1608 | 1608 | if ($conf->global->MAIN_MULTILANGS && empty($newlang)) |
| 1609 | 1609 | $newlang = $customer->default_lang; |
| 1610 | - if (! empty($newlang)) { |
|
| 1610 | + if (!empty($newlang)) { |
|
| 1611 | 1611 | $outputlangs = new Translate("", $conf); |
| 1612 | 1612 | $outputlangs->setDefaultLang($newlang); |
| 1613 | 1613 | } |
@@ -1637,10 +1637,10 @@ discard block |
||
| 1637 | 1637 | */ |
| 1638 | 1638 | function validate($user) |
| 1639 | 1639 | { |
| 1640 | - global $langs,$conf; |
|
| 1640 | + global $langs, $conf; |
|
| 1641 | 1641 | |
| 1642 | - $error=0; |
|
| 1643 | - $now=dol_now(); |
|
| 1642 | + $error = 0; |
|
| 1643 | + $now = dol_now(); |
|
| 1644 | 1644 | |
| 1645 | 1645 | // Check parameters |
| 1646 | 1646 | if ($this->statut == 1) |
@@ -1652,19 +1652,19 @@ discard block |
||
| 1652 | 1652 | $this->db->begin(); |
| 1653 | 1653 | |
| 1654 | 1654 | $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; |
| 1655 | - $sql.= " statut = 1"; |
|
| 1656 | - $sql.= ", datevalid = '".$this->db->idate($now)."'"; |
|
| 1657 | - $sql.= ", fk_user_valid=".$user->id; |
|
| 1658 | - $sql.= " WHERE rowid = ".$this->id; |
|
| 1655 | + $sql .= " statut = 1"; |
|
| 1656 | + $sql .= ", datevalid = '".$this->db->idate($now)."'"; |
|
| 1657 | + $sql .= ", fk_user_valid=".$user->id; |
|
| 1658 | + $sql .= " WHERE rowid = ".$this->id; |
|
| 1659 | 1659 | |
| 1660 | 1660 | dol_syslog(get_class($this)."::validate", LOG_DEBUG); |
| 1661 | 1661 | $result = $this->db->query($sql); |
| 1662 | 1662 | if ($result) |
| 1663 | 1663 | { |
| 1664 | - $this->statut=1; |
|
| 1664 | + $this->statut = 1; |
|
| 1665 | 1665 | |
| 1666 | 1666 | // Call trigger |
| 1667 | - $result=$this->call_trigger('MEMBER_VALIDATE',$user); |
|
| 1667 | + $result = $this->call_trigger('MEMBER_VALIDATE', $user); |
|
| 1668 | 1668 | if ($result < 0) { $error++; $this->db->rollback(); return -1; } |
| 1669 | 1669 | // End call triggers |
| 1670 | 1670 | |
@@ -1673,7 +1673,7 @@ discard block |
||
| 1673 | 1673 | } |
| 1674 | 1674 | else |
| 1675 | 1675 | { |
| 1676 | - $this->error=$this->db->error(); |
|
| 1676 | + $this->error = $this->db->error(); |
|
| 1677 | 1677 | $this->db->rollback(); |
| 1678 | 1678 | return -1; |
| 1679 | 1679 | } |
@@ -1688,9 +1688,9 @@ discard block |
||
| 1688 | 1688 | */ |
| 1689 | 1689 | function resiliate($user) |
| 1690 | 1690 | { |
| 1691 | - global $langs,$conf; |
|
| 1691 | + global $langs, $conf; |
|
| 1692 | 1692 | |
| 1693 | - $error=0; |
|
| 1693 | + $error = 0; |
|
| 1694 | 1694 | |
| 1695 | 1695 | // Check paramaters |
| 1696 | 1696 | if ($this->statut == 0) |
@@ -1702,17 +1702,17 @@ discard block |
||
| 1702 | 1702 | $this->db->begin(); |
| 1703 | 1703 | |
| 1704 | 1704 | $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; |
| 1705 | - $sql.= " statut = 0"; |
|
| 1706 | - $sql.= ", fk_user_valid=".$user->id; |
|
| 1707 | - $sql.= " WHERE rowid = ".$this->id; |
|
| 1705 | + $sql .= " statut = 0"; |
|
| 1706 | + $sql .= ", fk_user_valid=".$user->id; |
|
| 1707 | + $sql .= " WHERE rowid = ".$this->id; |
|
| 1708 | 1708 | |
| 1709 | 1709 | $result = $this->db->query($sql); |
| 1710 | 1710 | if ($result) |
| 1711 | 1711 | { |
| 1712 | - $this->statut=0; |
|
| 1712 | + $this->statut = 0; |
|
| 1713 | 1713 | |
| 1714 | 1714 | // Call trigger |
| 1715 | - $result=$this->call_trigger('MEMBER_RESILIATE',$user); |
|
| 1715 | + $result = $this->call_trigger('MEMBER_RESILIATE', $user); |
|
| 1716 | 1716 | if ($result < 0) { $error++; $this->db->rollback(); return -1; } |
| 1717 | 1717 | // End call triggers |
| 1718 | 1718 | |
@@ -1721,7 +1721,7 @@ discard block |
||
| 1721 | 1721 | } |
| 1722 | 1722 | else |
| 1723 | 1723 | { |
| 1724 | - $this->error=$this->db->error(); |
|
| 1724 | + $this->error = $this->db->error(); |
|
| 1725 | 1725 | $this->db->rollback(); |
| 1726 | 1726 | return -1; |
| 1727 | 1727 | } |
@@ -1735,43 +1735,43 @@ discard block |
||
| 1735 | 1735 | */ |
| 1736 | 1736 | function add_to_abo() |
| 1737 | 1737 | { |
| 1738 | - global $conf,$langs; |
|
| 1738 | + global $conf, $langs; |
|
| 1739 | 1739 | |
| 1740 | 1740 | include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; |
| 1741 | - $mailmanspip=new MailmanSpip($this->db); |
|
| 1741 | + $mailmanspip = new MailmanSpip($this->db); |
|
| 1742 | 1742 | |
| 1743 | - $err=0; |
|
| 1743 | + $err = 0; |
|
| 1744 | 1744 | |
| 1745 | 1745 | // mailman |
| 1746 | - if (! empty($conf->global->ADHERENT_USE_MAILMAN) && ! empty($conf->mailmanspip->enabled)) |
|
| 1746 | + if (!empty($conf->global->ADHERENT_USE_MAILMAN) && !empty($conf->mailmanspip->enabled)) |
|
| 1747 | 1747 | { |
| 1748 | - $result=$mailmanspip->add_to_mailman($this); |
|
| 1748 | + $result = $mailmanspip->add_to_mailman($this); |
|
| 1749 | 1749 | |
| 1750 | 1750 | if ($result < 0) |
| 1751 | 1751 | { |
| 1752 | - if (! empty($mailmanspip->error)) $this->errors[]=$mailmanspip->error; |
|
| 1753 | - $err+=1; |
|
| 1752 | + if (!empty($mailmanspip->error)) $this->errors[] = $mailmanspip->error; |
|
| 1753 | + $err += 1; |
|
| 1754 | 1754 | } |
| 1755 | 1755 | foreach ($mailmanspip->mladded_ko as $tmplist => $tmpemail) |
| 1756 | 1756 | { |
| 1757 | 1757 | $langs->load("errors"); |
| 1758 | - $this->errors[]=$langs->trans("ErrorFailedToAddToMailmanList",$tmpemail,$tmplist); |
|
| 1758 | + $this->errors[] = $langs->trans("ErrorFailedToAddToMailmanList", $tmpemail, $tmplist); |
|
| 1759 | 1759 | } |
| 1760 | 1760 | foreach ($mailmanspip->mladded_ok as $tmplist => $tmpemail) |
| 1761 | 1761 | { |
| 1762 | 1762 | $langs->load("mailmanspip"); |
| 1763 | - $this->mesgs[]=$langs->trans("SuccessToAddToMailmanList",$tmpemail,$tmplist); |
|
| 1763 | + $this->mesgs[] = $langs->trans("SuccessToAddToMailmanList", $tmpemail, $tmplist); |
|
| 1764 | 1764 | } |
| 1765 | 1765 | } |
| 1766 | 1766 | |
| 1767 | 1767 | // spip |
| 1768 | - if (! empty($conf->global->ADHERENT_USE_SPIP) && ! empty($conf->mailmanspip->enabled)) |
|
| 1768 | + if (!empty($conf->global->ADHERENT_USE_SPIP) && !empty($conf->mailmanspip->enabled)) |
|
| 1769 | 1769 | { |
| 1770 | - $result=$mailmanspip->add_to_spip($this); |
|
| 1770 | + $result = $mailmanspip->add_to_spip($this); |
|
| 1771 | 1771 | if ($result < 0) |
| 1772 | 1772 | { |
| 1773 | - $this->errors[]=$mailmanspip->error; |
|
| 1774 | - $err+=1; |
|
| 1773 | + $this->errors[] = $mailmanspip->error; |
|
| 1774 | + $err += 1; |
|
| 1775 | 1775 | } |
| 1776 | 1776 | } |
| 1777 | 1777 | if ($err) |
@@ -1792,42 +1792,42 @@ discard block |
||
| 1792 | 1792 | */ |
| 1793 | 1793 | function del_to_abo() |
| 1794 | 1794 | { |
| 1795 | - global $conf,$langs; |
|
| 1795 | + global $conf, $langs; |
|
| 1796 | 1796 | |
| 1797 | 1797 | include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; |
| 1798 | - $mailmanspip=new MailmanSpip($this->db); |
|
| 1798 | + $mailmanspip = new MailmanSpip($this->db); |
|
| 1799 | 1799 | |
| 1800 | - $err=0; |
|
| 1800 | + $err = 0; |
|
| 1801 | 1801 | |
| 1802 | 1802 | // mailman |
| 1803 | - if (! empty($conf->global->ADHERENT_USE_MAILMAN)) |
|
| 1803 | + if (!empty($conf->global->ADHERENT_USE_MAILMAN)) |
|
| 1804 | 1804 | { |
| 1805 | - $result=$mailmanspip->del_to_mailman($this); |
|
| 1805 | + $result = $mailmanspip->del_to_mailman($this); |
|
| 1806 | 1806 | if ($result < 0) |
| 1807 | 1807 | { |
| 1808 | - if (! empty($mailmanspip->error)) $this->errors[]=$mailmanspip->error; |
|
| 1809 | - $err+=1; |
|
| 1808 | + if (!empty($mailmanspip->error)) $this->errors[] = $mailmanspip->error; |
|
| 1809 | + $err += 1; |
|
| 1810 | 1810 | } |
| 1811 | 1811 | |
| 1812 | 1812 | foreach ($mailmanspip->mlremoved_ko as $tmplist => $tmpemail) |
| 1813 | 1813 | { |
| 1814 | 1814 | $langs->load("errors"); |
| 1815 | - $this->errors[]=$langs->trans("ErrorFailedToRemoveToMailmanList",$tmpemail,$tmplist); |
|
| 1815 | + $this->errors[] = $langs->trans("ErrorFailedToRemoveToMailmanList", $tmpemail, $tmplist); |
|
| 1816 | 1816 | } |
| 1817 | 1817 | foreach ($mailmanspip->mlremoved_ok as $tmplist => $tmpemail) |
| 1818 | 1818 | { |
| 1819 | 1819 | $langs->load("mailmanspip"); |
| 1820 | - $this->mesgs[]=$langs->trans("SuccessToRemoveToMailmanList",$tmpemail,$tmplist); |
|
| 1820 | + $this->mesgs[] = $langs->trans("SuccessToRemoveToMailmanList", $tmpemail, $tmplist); |
|
| 1821 | 1821 | } |
| 1822 | 1822 | } |
| 1823 | 1823 | |
| 1824 | - if ($conf->global->ADHERENT_USE_SPIP && ! empty($conf->mailmanspip->enabled)) |
|
| 1824 | + if ($conf->global->ADHERENT_USE_SPIP && !empty($conf->mailmanspip->enabled)) |
|
| 1825 | 1825 | { |
| 1826 | - $result=$mailmanspip->del_to_spip($this); |
|
| 1826 | + $result = $mailmanspip->del_to_spip($this); |
|
| 1827 | 1827 | if ($result < 0) |
| 1828 | 1828 | { |
| 1829 | - $this->errors[]=$mailmanspip->error; |
|
| 1830 | - $err+=1; |
|
| 1829 | + $this->errors[] = $mailmanspip->error; |
|
| 1830 | + $err += 1; |
|
| 1831 | 1831 | } |
| 1832 | 1832 | } |
| 1833 | 1833 | if ($err) |
@@ -1852,7 +1852,7 @@ discard block |
||
| 1852 | 1852 | global $langs; |
| 1853 | 1853 | $langs->load("dict"); |
| 1854 | 1854 | |
| 1855 | - $code=(empty($this->civility_id)?'':$this->civility_id); |
|
| 1855 | + $code = (empty($this->civility_id) ? '' : $this->civility_id); |
|
| 1856 | 1856 | if (empty($code)) return ''; |
| 1857 | 1857 | return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civility", "code", "label", $code); |
| 1858 | 1858 | } |
@@ -1868,31 +1868,31 @@ discard block |
||
| 1868 | 1868 | * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking |
| 1869 | 1869 | * @return string Chaine avec URL |
| 1870 | 1870 | */ |
| 1871 | - function getNomUrl($withpictoimg=0, $maxlen=0, $option='card', $mode='', $morecss='', $save_lastsearch_value=-1) |
|
| 1871 | + function getNomUrl($withpictoimg = 0, $maxlen = 0, $option = 'card', $mode = '', $morecss = '', $save_lastsearch_value = -1) |
|
| 1872 | 1872 | { |
| 1873 | 1873 | global $conf, $langs; |
| 1874 | 1874 | |
| 1875 | - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0; |
|
| 1875 | + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg = 0; |
|
| 1876 | 1876 | |
| 1877 | - $notooltip=0; |
|
| 1877 | + $notooltip = 0; |
|
| 1878 | 1878 | |
| 1879 | - $result=''; $label=''; |
|
| 1880 | - $link=''; $linkstart=''; $linkend=''; |
|
| 1879 | + $result = ''; $label = ''; |
|
| 1880 | + $link = ''; $linkstart = ''; $linkend = ''; |
|
| 1881 | 1881 | |
| 1882 | - if (! empty($this->photo)) |
|
| 1882 | + if (!empty($this->photo)) |
|
| 1883 | 1883 | { |
| 1884 | - $label.= '<div class="photointooltip">'; |
|
| 1885 | - $label.= Form::showphoto('memberphoto', $this, 80, 0, 0, 'photowithmargin photologintooltip', 'small', 0, 1); |
|
| 1886 | - $label.= '</div><div style="clear: both;"></div>'; |
|
| 1884 | + $label .= '<div class="photointooltip">'; |
|
| 1885 | + $label .= Form::showphoto('memberphoto', $this, 80, 0, 0, 'photowithmargin photologintooltip', 'small', 0, 1); |
|
| 1886 | + $label .= '</div><div style="clear: both;"></div>'; |
|
| 1887 | 1887 | } |
| 1888 | 1888 | |
| 1889 | - $label.= '<div class="centpercent">'; |
|
| 1890 | - $label.= '<u>' . $langs->trans("Member") . '</u>'; |
|
| 1891 | - if (! empty($this->ref)) |
|
| 1892 | - $label.= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; |
|
| 1893 | - if (! empty($this->firstname) || ! empty($this->lastname)) |
|
| 1894 | - $label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs); |
|
| 1895 | - $label.='</div>'; |
|
| 1889 | + $label .= '<div class="centpercent">'; |
|
| 1890 | + $label .= '<u>'.$langs->trans("Member").'</u>'; |
|
| 1891 | + if (!empty($this->ref)) |
|
| 1892 | + $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; |
|
| 1893 | + if (!empty($this->firstname) || !empty($this->lastname)) |
|
| 1894 | + $label .= '<br><b>'.$langs->trans('Name').':</b> '.$this->getFullName($langs); |
|
| 1895 | + $label .= '</div>'; |
|
| 1896 | 1896 | |
| 1897 | 1897 | $url = DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id; |
| 1898 | 1898 | if ($option == 'subscription') |
@@ -1903,49 +1903,49 @@ discard block |
||
| 1903 | 1903 | if ($option != 'nolink') |
| 1904 | 1904 | { |
| 1905 | 1905 | // Add param to save lastsearch_values or not |
| 1906 | - $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); |
|
| 1907 | - if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; |
|
| 1908 | - if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; |
|
| 1906 | + $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); |
|
| 1907 | + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; |
|
| 1908 | + if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; |
|
| 1909 | 1909 | } |
| 1910 | 1910 | |
| 1911 | 1911 | $link = '<a href="'.$url.'"'; |
| 1912 | - $linkclose=""; |
|
| 1912 | + $linkclose = ""; |
|
| 1913 | 1913 | if (empty($notooltip)) |
| 1914 | 1914 | { |
| 1915 | - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) |
|
| 1915 | + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) |
|
| 1916 | 1916 | { |
| 1917 | 1917 | $langs->load("users"); |
| 1918 | - $label=$langs->trans("ShowUser"); |
|
| 1919 | - $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; |
|
| 1918 | + $label = $langs->trans("ShowUser"); |
|
| 1919 | + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
|
| 1920 | 1920 | } |
| 1921 | - $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; |
|
| 1922 | - $linkclose.= ' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; |
|
| 1921 | + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; |
|
| 1922 | + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; |
|
| 1923 | 1923 | } |
| 1924 | 1924 | |
| 1925 | - $link.=$linkclose.'>'; |
|
| 1926 | - $linkend='</a>'; |
|
| 1925 | + $link .= $linkclose.'>'; |
|
| 1926 | + $linkend = '</a>'; |
|
| 1927 | 1927 | |
| 1928 | 1928 | //if ($withpictoimg == -1) $result.='<div class="nowrap">'; |
| 1929 | - $result.=$link; |
|
| 1929 | + $result .= $link; |
|
| 1930 | 1930 | if ($withpictoimg) |
| 1931 | 1931 | { |
| 1932 | - $paddafterimage=''; |
|
| 1933 | - if (abs($withpictoimg) == 1) $paddafterimage='style="margin-right: 3px;"'; |
|
| 1932 | + $paddafterimage = ''; |
|
| 1933 | + if (abs($withpictoimg) == 1) $paddafterimage = 'style="margin-right: 3px;"'; |
|
| 1934 | 1934 | // Only picto |
| 1935 | - if ($withpictoimg > 0) $picto='<div class="inline-block nopadding valignmiddle'.($morecss?' userimg'.$morecss:'').'">'.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).'</div>'; |
|
| 1935 | + if ($withpictoimg > 0) $picto = '<div class="inline-block nopadding valignmiddle'.($morecss ? ' userimg'.$morecss : '').'">'.img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : 'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1).'</div>'; |
|
| 1936 | 1936 | // Picto must be a photo |
| 1937 | - else $picto='<div class="inline-block nopadding valignmiddle'.($morecss?' userimg'.$morecss:'').'"'.($paddafterimage?' '.$paddafterimage:'').'>'.Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg==-3?'small':''), 'mini', 0, 1).'</div>'; |
|
| 1938 | - $result.=$picto; |
|
| 1937 | + else $picto = '<div class="inline-block nopadding valignmiddle'.($morecss ? ' userimg'.$morecss : '').'"'.($paddafterimage ? ' '.$paddafterimage : '').'>'.Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg == -3 ? 'small' : ''), 'mini', 0, 1).'</div>'; |
|
| 1938 | + $result .= $picto; |
|
| 1939 | 1939 | } |
| 1940 | 1940 | if ($withpictoimg > -2 && $withpictoimg != 2) |
| 1941 | 1941 | { |
| 1942 | - if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='<div class="inline-block nopadding valignmiddle'.((! isset($this->statut) || $this->statut)?'':' strikefordisabled').($morecss?' usertext'.$morecss:'').'">'; |
|
| 1943 | - if ($mode == 'login') $result.=dol_trunc($this->login, $maxlen); |
|
| 1944 | - elseif ($mode == 'ref') $result.=$this->id; |
|
| 1945 | - else $result.=$this->getFullName($langs,'',($mode == 'firstname' ? 2 : -1),$maxlen); |
|
| 1946 | - if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='</div>'; |
|
| 1942 | + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result .= '<div class="inline-block nopadding valignmiddle'.((!isset($this->statut) || $this->statut) ? '' : ' strikefordisabled').($morecss ? ' usertext'.$morecss : '').'">'; |
|
| 1943 | + if ($mode == 'login') $result .= dol_trunc($this->login, $maxlen); |
|
| 1944 | + elseif ($mode == 'ref') $result .= $this->id; |
|
| 1945 | + else $result .= $this->getFullName($langs, '', ($mode == 'firstname' ? 2 : -1), $maxlen); |
|
| 1946 | + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result .= '</div>'; |
|
| 1947 | 1947 | } |
| 1948 | - $result.=$linkend; |
|
| 1948 | + $result .= $linkend; |
|
| 1949 | 1949 | //if ($withpictoimg == -1) $result.='</div>'; |
| 1950 | 1950 | |
| 1951 | 1951 | return $result; |
@@ -1957,9 +1957,9 @@ discard block |
||
| 1957 | 1957 | * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto |
| 1958 | 1958 | * @return string Label |
| 1959 | 1959 | */ |
| 1960 | - function getLibStatut($mode=0) |
|
| 1960 | + function getLibStatut($mode = 0) |
|
| 1961 | 1961 | { |
| 1962 | - return $this->LibStatut($this->statut,$this->need_subscription,$this->datefin,$mode); |
|
| 1962 | + return $this->LibStatut($this->statut, $this->need_subscription, $this->datefin, $mode); |
|
| 1963 | 1963 | } |
| 1964 | 1964 | |
| 1965 | 1965 | /** |
@@ -1971,7 +1971,7 @@ discard block |
||
| 1971 | 1971 | * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto |
| 1972 | 1972 | * @return string Label |
| 1973 | 1973 | */ |
| 1974 | - function LibStatut($statut,$need_subscription,$date_end_subscription,$mode=0) |
|
| 1974 | + function LibStatut($statut, $need_subscription, $date_end_subscription, $mode = 0) |
|
| 1975 | 1975 | { |
| 1976 | 1976 | global $langs; |
| 1977 | 1977 | $langs->load("members"); |
@@ -1980,7 +1980,7 @@ discard block |
||
| 1980 | 1980 | if ($statut == -1) return $langs->trans("MemberStatusDraft"); |
| 1981 | 1981 | if ($statut >= 1) |
| 1982 | 1982 | { |
| 1983 | - if (! $date_end_subscription) return $langs->trans("MemberStatusActive"); |
|
| 1983 | + if (!$date_end_subscription) return $langs->trans("MemberStatusActive"); |
|
| 1984 | 1984 | elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLate"); |
| 1985 | 1985 | else return $langs->trans("MemberStatusPaid"); |
| 1986 | 1986 | } |
@@ -1991,7 +1991,7 @@ discard block |
||
| 1991 | 1991 | if ($statut == -1) return $langs->trans("MemberStatusDraftShort"); |
| 1992 | 1992 | if ($statut >= 1) |
| 1993 | 1993 | { |
| 1994 | - if (! $date_end_subscription) return $langs->trans("MemberStatusActiveShort"); |
|
| 1994 | + if (!$date_end_subscription) return $langs->trans("MemberStatusActiveShort"); |
|
| 1995 | 1995 | elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLateShort"); |
| 1996 | 1996 | else return $langs->trans("MemberStatusPaidShort"); |
| 1997 | 1997 | } |
@@ -1999,58 +1999,58 @@ discard block |
||
| 1999 | 1999 | } |
| 2000 | 2000 | if ($mode == 2) |
| 2001 | 2001 | { |
| 2002 | - if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraftShort"); |
|
| 2002 | + if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'), 'statut0').' '.$langs->trans("MemberStatusDraftShort"); |
|
| 2003 | 2003 | if ($statut >= 1) |
| 2004 | 2004 | { |
| 2005 | - if (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'),'statut1').' '.$langs->trans("MemberStatusActiveShort"); |
|
| 2006 | - elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'),'statut3').' '.$langs->trans("MemberStatusActiveLateShort"); |
|
| 2007 | - else return img_picto($langs->trans('MemberStatusPaid'),'statut4').' '.$langs->trans("MemberStatusPaidShort"); |
|
| 2005 | + if (!$date_end_subscription) return img_picto($langs->trans('MemberStatusActive'), 'statut1').' '.$langs->trans("MemberStatusActiveShort"); |
|
| 2006 | + elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'), 'statut3').' '.$langs->trans("MemberStatusActiveLateShort"); |
|
| 2007 | + else return img_picto($langs->trans('MemberStatusPaid'), 'statut4').' '.$langs->trans("MemberStatusPaidShort"); |
|
| 2008 | 2008 | } |
| 2009 | - if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5').' '.$langs->trans("MemberStatusResiliatedShort"); |
|
| 2009 | + if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'), 'statut5').' '.$langs->trans("MemberStatusResiliatedShort"); |
|
| 2010 | 2010 | } |
| 2011 | 2011 | if ($mode == 3) |
| 2012 | 2012 | { |
| 2013 | - if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0'); |
|
| 2013 | + if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'), 'statut0'); |
|
| 2014 | 2014 | if ($statut >= 1) |
| 2015 | 2015 | { |
| 2016 | - if (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'),'statut1'); |
|
| 2017 | - elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'),'statut3'); |
|
| 2018 | - else return img_picto($langs->trans('MemberStatusPaid'),'statut4'); |
|
| 2016 | + if (!$date_end_subscription) return img_picto($langs->trans('MemberStatusActive'), 'statut1'); |
|
| 2017 | + elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'), 'statut3'); |
|
| 2018 | + else return img_picto($langs->trans('MemberStatusPaid'), 'statut4'); |
|
| 2019 | 2019 | } |
| 2020 | - if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5'); |
|
| 2020 | + if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'), 'statut5'); |
|
| 2021 | 2021 | } |
| 2022 | 2022 | if ($mode == 4) |
| 2023 | 2023 | { |
| 2024 | - if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraft"); |
|
| 2024 | + if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'), 'statut0').' '.$langs->trans("MemberStatusDraft"); |
|
| 2025 | 2025 | if ($statut >= 1) |
| 2026 | 2026 | { |
| 2027 | - if (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'),'statut1').' '.$langs->trans("MemberStatusActive"); |
|
| 2028 | - elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'),'statut3').' '.$langs->trans("MemberStatusActiveLate"); |
|
| 2029 | - else return img_picto($langs->trans('MemberStatusPaid'),'statut4').' '.$langs->trans("MemberStatusPaid"); |
|
| 2027 | + if (!$date_end_subscription) return img_picto($langs->trans('MemberStatusActive'), 'statut1').' '.$langs->trans("MemberStatusActive"); |
|
| 2028 | + elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'), 'statut3').' '.$langs->trans("MemberStatusActiveLate"); |
|
| 2029 | + else return img_picto($langs->trans('MemberStatusPaid'), 'statut4').' '.$langs->trans("MemberStatusPaid"); |
|
| 2030 | 2030 | } |
| 2031 | - if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5').' '.$langs->trans("MemberStatusResiliated"); |
|
| 2031 | + if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'), 'statut5').' '.$langs->trans("MemberStatusResiliated"); |
|
| 2032 | 2032 | } |
| 2033 | 2033 | if ($mode == 5) |
| 2034 | 2034 | { |
| 2035 | - if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'),'statut0'); |
|
| 2035 | + if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'), 'statut0'); |
|
| 2036 | 2036 | if ($statut >= 1) |
| 2037 | 2037 | { |
| 2038 | - if (! $date_end_subscription) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveShort").' </span>'.img_picto($langs->trans('MemberStatusActive'),'statut1'); |
|
| 2039 | - elseif ($date_end_subscription < time()) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveLateShort").' </span>'.img_picto($langs->trans('MemberStatusActiveLate'),'statut3'); |
|
| 2040 | - else return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusPaidShort").' </span>'.img_picto($langs->trans('MemberStatusPaid'),'statut4'); |
|
| 2038 | + if (!$date_end_subscription) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveShort").' </span>'.img_picto($langs->trans('MemberStatusActive'), 'statut1'); |
|
| 2039 | + elseif ($date_end_subscription < time()) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveLateShort").' </span>'.img_picto($langs->trans('MemberStatusActiveLate'), 'statut3'); |
|
| 2040 | + else return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusPaidShort").' </span>'.img_picto($langs->trans('MemberStatusPaid'), 'statut4'); |
|
| 2041 | 2041 | } |
| 2042 | - if ($statut == 0) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusResiliated").' </span>'.img_picto($langs->trans('MemberStatusResiliated'),'statut5'); |
|
| 2042 | + if ($statut == 0) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusResiliated").' </span>'.img_picto($langs->trans('MemberStatusResiliated'), 'statut5'); |
|
| 2043 | 2043 | } |
| 2044 | 2044 | if ($mode == 6) |
| 2045 | 2045 | { |
| 2046 | - if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'),'statut0'); |
|
| 2046 | + if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'), 'statut0'); |
|
| 2047 | 2047 | if ($statut >= 1) |
| 2048 | 2048 | { |
| 2049 | - if (! $date_end_subscription) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActive").' </span>'.img_picto($langs->trans('MemberStatusActive'),'statut1'); |
|
| 2050 | - elseif ($date_end_subscription < time()) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveLate").' </span>'.img_picto($langs->trans('MemberStatusActiveLate'),'statut3'); |
|
| 2051 | - else return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusPaid").' </span>'.img_picto($langs->trans('MemberStatusPaid'),'statut4'); |
|
| 2049 | + if (!$date_end_subscription) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActive").' </span>'.img_picto($langs->trans('MemberStatusActive'), 'statut1'); |
|
| 2050 | + elseif ($date_end_subscription < time()) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveLate").' </span>'.img_picto($langs->trans('MemberStatusActiveLate'), 'statut3'); |
|
| 2051 | + else return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusPaid").' </span>'.img_picto($langs->trans('MemberStatusPaid'), 'statut4'); |
|
| 2052 | 2052 | } |
| 2053 | - if ($statut == 0) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusResiliated").' </span>'.img_picto($langs->trans('MemberStatusResiliated'),'statut5'); |
|
| 2053 | + if ($statut == 0) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusResiliated").' </span>'.img_picto($langs->trans('MemberStatusResiliated'), 'statut5'); |
|
| 2054 | 2054 | } |
| 2055 | 2055 | } |
| 2056 | 2056 | |
@@ -2064,19 +2064,19 @@ discard block |
||
| 2064 | 2064 | { |
| 2065 | 2065 | global $conf; |
| 2066 | 2066 | |
| 2067 | - $this->nb=array(); |
|
| 2067 | + $this->nb = array(); |
|
| 2068 | 2068 | |
| 2069 | 2069 | $sql = "SELECT count(a.rowid) as nb"; |
| 2070 | - $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a"; |
|
| 2071 | - $sql.= " WHERE a.statut > 0"; |
|
| 2072 | - $sql.= " AND a.entity IN (".getEntity('adherent').")"; |
|
| 2070 | + $sql .= " FROM ".MAIN_DB_PREFIX."adherent as a"; |
|
| 2071 | + $sql .= " WHERE a.statut > 0"; |
|
| 2072 | + $sql .= " AND a.entity IN (".getEntity('adherent').")"; |
|
| 2073 | 2073 | |
| 2074 | - $resql=$this->db->query($sql); |
|
| 2074 | + $resql = $this->db->query($sql); |
|
| 2075 | 2075 | if ($resql) |
| 2076 | 2076 | { |
| 2077 | - while ($obj=$this->db->fetch_object($resql)) |
|
| 2077 | + while ($obj = $this->db->fetch_object($resql)) |
|
| 2078 | 2078 | { |
| 2079 | - $this->nb["members"]=$obj->nb; |
|
| 2079 | + $this->nb["members"] = $obj->nb; |
|
| 2080 | 2080 | } |
| 2081 | 2081 | $this->db->free($resql); |
| 2082 | 2082 | return 1; |
@@ -2084,7 +2084,7 @@ discard block |
||
| 2084 | 2084 | else |
| 2085 | 2085 | { |
| 2086 | 2086 | dol_print_error($this->db); |
| 2087 | - $this->error=$this->db->error(); |
|
| 2087 | + $this->error = $this->db->error(); |
|
| 2088 | 2088 | return -1; |
| 2089 | 2089 | } |
| 2090 | 2090 | |
@@ -2100,30 +2100,30 @@ discard block |
||
| 2100 | 2100 | { |
| 2101 | 2101 | global $conf, $langs; |
| 2102 | 2102 | |
| 2103 | - if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe |
|
| 2103 | + if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe |
|
| 2104 | 2104 | |
| 2105 | - $now=dol_now(); |
|
| 2105 | + $now = dol_now(); |
|
| 2106 | 2106 | |
| 2107 | 2107 | $sql = "SELECT a.rowid, a.datefin, a.statut"; |
| 2108 | - $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a"; |
|
| 2109 | - $sql.= " WHERE a.statut = 1"; |
|
| 2110 | - $sql.= " AND a.entity IN (".getEntity('adherent').")"; |
|
| 2111 | - $sql.= " AND (a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."')"; |
|
| 2108 | + $sql .= " FROM ".MAIN_DB_PREFIX."adherent as a"; |
|
| 2109 | + $sql .= " WHERE a.statut = 1"; |
|
| 2110 | + $sql .= " AND a.entity IN (".getEntity('adherent').")"; |
|
| 2111 | + $sql .= " AND (a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."')"; |
|
| 2112 | 2112 | |
| 2113 | - $resql=$this->db->query($sql); |
|
| 2113 | + $resql = $this->db->query($sql); |
|
| 2114 | 2114 | if ($resql) |
| 2115 | 2115 | { |
| 2116 | 2116 | $langs->load("members"); |
| 2117 | 2117 | |
| 2118 | 2118 | $response = new WorkboardResponse(); |
| 2119 | - $response->warning_delay=$conf->adherent->subscription->warning_delay/60/60/24; |
|
| 2120 | - $response->label=$langs->trans("MembersWithSubscriptionToReceive"); |
|
| 2121 | - $response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate'; |
|
| 2122 | - $response->img=img_object('',"user"); |
|
| 2119 | + $response->warning_delay = $conf->adherent->subscription->warning_delay / 60 / 60 / 24; |
|
| 2120 | + $response->label = $langs->trans("MembersWithSubscriptionToReceive"); |
|
| 2121 | + $response->url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate'; |
|
| 2122 | + $response->img = img_object('', "user"); |
|
| 2123 | 2123 | |
| 2124 | 2124 | $adherentstatic = new Adherent($this->db); |
| 2125 | 2125 | |
| 2126 | - while ($obj=$this->db->fetch_object($resql)) |
|
| 2126 | + while ($obj = $this->db->fetch_object($resql)) |
|
| 2127 | 2127 | { |
| 2128 | 2128 | $response->nbtodo++; |
| 2129 | 2129 | |
@@ -2140,7 +2140,7 @@ discard block |
||
| 2140 | 2140 | else |
| 2141 | 2141 | { |
| 2142 | 2142 | dol_print_error($this->db); |
| 2143 | - $this->error=$this->db->error(); |
|
| 2143 | + $this->error = $this->db->error(); |
|
| 2144 | 2144 | return -1; |
| 2145 | 2145 | } |
| 2146 | 2146 | } |
@@ -2156,19 +2156,19 @@ discard block |
||
| 2156 | 2156 | * @param int $hideref Hide ref |
| 2157 | 2157 | * @return int 0 if KO, 1 if OK |
| 2158 | 2158 | */ |
| 2159 | - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) |
|
| 2159 | + public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) |
|
| 2160 | 2160 | { |
| 2161 | - global $conf,$langs; |
|
| 2161 | + global $conf, $langs; |
|
| 2162 | 2162 | |
| 2163 | 2163 | $langs->load("orders"); |
| 2164 | 2164 | |
| 2165 | - if (! dol_strlen($modele)) { |
|
| 2165 | + if (!dol_strlen($modele)) { |
|
| 2166 | 2166 | |
| 2167 | 2167 | $modele = 'standard'; |
| 2168 | 2168 | |
| 2169 | 2169 | if ($this->modelpdf) { |
| 2170 | 2170 | $modele = $this->modelpdf; |
| 2171 | - } elseif (! empty($conf->global->ADHERENT_ADDON_PDF)) { |
|
| 2171 | + } elseif (!empty($conf->global->ADHERENT_ADDON_PDF)) { |
|
| 2172 | 2172 | $modele = $conf->global->ADHERENT_ADDON_PDF; |
| 2173 | 2173 | } |
| 2174 | 2174 | } |
@@ -2188,16 +2188,16 @@ discard block |
||
| 2188 | 2188 | */ |
| 2189 | 2189 | function initAsSpecimen() |
| 2190 | 2190 | { |
| 2191 | - global $user,$langs; |
|
| 2191 | + global $user, $langs; |
|
| 2192 | 2192 | |
| 2193 | 2193 | // Initialise parametres |
| 2194 | - $this->id=0; |
|
| 2195 | - $this->specimen=1; |
|
| 2194 | + $this->id = 0; |
|
| 2195 | + $this->specimen = 1; |
|
| 2196 | 2196 | $this->civility_id = 0; |
| 2197 | 2197 | $this->lastname = 'DOLIBARR'; |
| 2198 | 2198 | $this->firstname = 'SPECIMEN'; |
| 2199 | - $this->login='dolibspec'; |
|
| 2200 | - $this->pass='dolibspec'; |
|
| 2199 | + $this->login = 'dolibspec'; |
|
| 2200 | + $this->pass = 'dolibspec'; |
|
| 2201 | 2201 | $this->societe = 'Societe ABC'; |
| 2202 | 2202 | $this->address = '61 jump street'; |
| 2203 | 2203 | $this->zip = '75000'; |
@@ -2211,23 +2211,23 @@ discard block |
||
| 2211 | 2211 | $this->phone = '0999999999'; |
| 2212 | 2212 | $this->phone_perso = '0999999998'; |
| 2213 | 2213 | $this->phone_mobile = '0999999997'; |
| 2214 | - $this->note_private='No comment'; |
|
| 2215 | - $this->birth=time(); |
|
| 2216 | - $this->photo=''; |
|
| 2217 | - $this->public=1; |
|
| 2218 | - $this->statut=0; |
|
| 2219 | - |
|
| 2220 | - $this->datefin=time(); |
|
| 2221 | - $this->datevalid=time(); |
|
| 2222 | - |
|
| 2223 | - $this->typeid=1; // Id type adherent |
|
| 2224 | - $this->type='Type adherent'; // Libelle type adherent |
|
| 2225 | - $this->need_subscription=0; |
|
| 2226 | - |
|
| 2227 | - $this->first_subscription_date=time(); |
|
| 2228 | - $this->first_subscription_amount=10; |
|
| 2229 | - $this->last_subscription_date=time(); |
|
| 2230 | - $this->last_subscription_amount=10; |
|
| 2214 | + $this->note_private = 'No comment'; |
|
| 2215 | + $this->birth = time(); |
|
| 2216 | + $this->photo = ''; |
|
| 2217 | + $this->public = 1; |
|
| 2218 | + $this->statut = 0; |
|
| 2219 | + |
|
| 2220 | + $this->datefin = time(); |
|
| 2221 | + $this->datevalid = time(); |
|
| 2222 | + |
|
| 2223 | + $this->typeid = 1; // Id type adherent |
|
| 2224 | + $this->type = 'Type adherent'; // Libelle type adherent |
|
| 2225 | + $this->need_subscription = 0; |
|
| 2226 | + |
|
| 2227 | + $this->first_subscription_date = time(); |
|
| 2228 | + $this->first_subscription_amount = 10; |
|
| 2229 | + $this->last_subscription_date = time(); |
|
| 2230 | + $this->last_subscription_amount = 10; |
|
| 2231 | 2231 | } |
| 2232 | 2232 | |
| 2233 | 2233 | |
@@ -2240,13 +2240,13 @@ discard block |
||
| 2240 | 2240 | * 2=Return key only (uid=qqq) |
| 2241 | 2241 | * @return string DN |
| 2242 | 2242 | */ |
| 2243 | - function _load_ldap_dn($info,$mode=0) |
|
| 2243 | + function _load_ldap_dn($info, $mode = 0) |
|
| 2244 | 2244 | { |
| 2245 | 2245 | global $conf; |
| 2246 | - $dn=''; |
|
| 2247 | - if ($mode==0) $dn=$conf->global->LDAP_KEY_MEMBERS."=".$info[$conf->global->LDAP_KEY_MEMBERS].",".$conf->global->LDAP_MEMBER_DN; |
|
| 2248 | - if ($mode==1) $dn=$conf->global->LDAP_MEMBER_DN; |
|
| 2249 | - if ($mode==2) $dn=$conf->global->LDAP_KEY_MEMBERS."=".$info[$conf->global->LDAP_KEY_MEMBERS]; |
|
| 2246 | + $dn = ''; |
|
| 2247 | + if ($mode == 0) $dn = $conf->global->LDAP_KEY_MEMBERS."=".$info[$conf->global->LDAP_KEY_MEMBERS].",".$conf->global->LDAP_MEMBER_DN; |
|
| 2248 | + if ($mode == 1) $dn = $conf->global->LDAP_MEMBER_DN; |
|
| 2249 | + if ($mode == 2) $dn = $conf->global->LDAP_KEY_MEMBERS."=".$info[$conf->global->LDAP_KEY_MEMBERS]; |
|
| 2250 | 2250 | return $dn; |
| 2251 | 2251 | } |
| 2252 | 2252 | |
@@ -2258,15 +2258,15 @@ discard block |
||
| 2258 | 2258 | */ |
| 2259 | 2259 | function _load_ldap_info() |
| 2260 | 2260 | { |
| 2261 | - global $conf,$langs; |
|
| 2261 | + global $conf, $langs; |
|
| 2262 | 2262 | |
| 2263 | - $info=array(); |
|
| 2264 | - $keymodified=false; |
|
| 2263 | + $info = array(); |
|
| 2264 | + $keymodified = false; |
|
| 2265 | 2265 | |
| 2266 | 2266 | // Object classes |
| 2267 | - $info["objectclass"]=explode(',',$conf->global->LDAP_MEMBER_OBJECT_CLASS); |
|
| 2267 | + $info["objectclass"] = explode(',', $conf->global->LDAP_MEMBER_OBJECT_CLASS); |
|
| 2268 | 2268 | |
| 2269 | - $this->fullname=$this->getFullName($langs); |
|
| 2269 | + $this->fullname = $this->getFullName($langs); |
|
| 2270 | 2270 | |
| 2271 | 2271 | // For avoid ldap error when firstname and lastname are empty |
| 2272 | 2272 | if ($this->morphy == 'mor' && (empty($this->fullname) || $this->fullname == $this->societe)) { |
@@ -2286,50 +2286,50 @@ discard block |
||
| 2286 | 2286 | // Member |
| 2287 | 2287 | foreach ($ldapkey as $constname => $varname) |
| 2288 | 2288 | { |
| 2289 | - if (! empty($this->$varname) && ! empty($conf->global->$constname)) |
|
| 2289 | + if (!empty($this->$varname) && !empty($conf->global->$constname)) |
|
| 2290 | 2290 | { |
| 2291 | 2291 | $info[$conf->global->$constname] = $this->$varname; |
| 2292 | 2292 | |
| 2293 | 2293 | // Check if it is the LDAP key and if its value has been changed |
| 2294 | - if (! empty($conf->global->LDAP_KEY_MEMBERS) && $conf->global->LDAP_KEY_MEMBERS == $conf->global->$constname) |
|
| 2294 | + if (!empty($conf->global->LDAP_KEY_MEMBERS) && $conf->global->LDAP_KEY_MEMBERS == $conf->global->$constname) |
|
| 2295 | 2295 | { |
| 2296 | - if (! empty($this->oldcopy) && $this->$varname != $this->oldcopy->$varname) $keymodified=true; // For check if LDAP key has been modified |
|
| 2296 | + if (!empty($this->oldcopy) && $this->$varname != $this->oldcopy->$varname) $keymodified = true; // For check if LDAP key has been modified |
|
| 2297 | 2297 | } |
| 2298 | 2298 | } |
| 2299 | 2299 | } |
| 2300 | - if ($this->firstname && ! empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname; |
|
| 2301 | - if ($this->poste && ! empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste; |
|
| 2302 | - if ($this->societe && ! empty($conf->global->LDAP_MEMBER_FIELD_COMPANY)) $info[$conf->global->LDAP_MEMBER_FIELD_COMPANY] = $this->societe; |
|
| 2303 | - if ($this->address && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address; |
|
| 2304 | - if ($this->zip && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip; |
|
| 2305 | - if ($this->town && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town; |
|
| 2306 | - if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code; |
|
| 2307 | - if ($this->skype && ! empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype; |
|
| 2308 | - if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone; |
|
| 2309 | - if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso; |
|
| 2310 | - if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile; |
|
| 2311 | - if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax; |
|
| 2312 | - if ($this->note_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private; |
|
| 2313 | - if ($this->note_public && ! empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = $this->note_public; |
|
| 2314 | - if ($this->birth && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth,'dayhourldap'); |
|
| 2315 | - if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut; |
|
| 2316 | - if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap'); |
|
| 2300 | + if ($this->firstname && !empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname; |
|
| 2301 | + if ($this->poste && !empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste; |
|
| 2302 | + if ($this->societe && !empty($conf->global->LDAP_MEMBER_FIELD_COMPANY)) $info[$conf->global->LDAP_MEMBER_FIELD_COMPANY] = $this->societe; |
|
| 2303 | + if ($this->address && !empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address; |
|
| 2304 | + if ($this->zip && !empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip; |
|
| 2305 | + if ($this->town && !empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town; |
|
| 2306 | + if ($this->country_code && !empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code; |
|
| 2307 | + if ($this->skype && !empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype; |
|
| 2308 | + if ($this->phone && !empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone; |
|
| 2309 | + if ($this->phone_perso && !empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso; |
|
| 2310 | + if ($this->phone_mobile && !empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile; |
|
| 2311 | + if ($this->fax && !empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax; |
|
| 2312 | + if ($this->note_private && !empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private; |
|
| 2313 | + if ($this->note_public && !empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = $this->note_public; |
|
| 2314 | + if ($this->birth && !empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth, 'dayhourldap'); |
|
| 2315 | + if (isset($this->statut) && !empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut; |
|
| 2316 | + if ($this->datefin && !empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin, 'dayhourldap'); |
|
| 2317 | 2317 | |
| 2318 | 2318 | // When password is modified |
| 2319 | - if (! empty($this->pass)) |
|
| 2319 | + if (!empty($this->pass)) |
|
| 2320 | 2320 | { |
| 2321 | - if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte |
|
| 2322 | - if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption) |
|
| 2321 | + if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte |
|
| 2322 | + if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption) |
|
| 2323 | 2323 | } |
| 2324 | 2324 | // Set LDAP password if possible |
| 2325 | 2325 | else if ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password |
| 2326 | 2326 | { |
| 2327 | - if (! empty($conf->global->DATABASE_PWD_ENCRYPTED)) |
|
| 2327 | + if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) |
|
| 2328 | 2328 | { |
| 2329 | 2329 | // Just for the default MD5 ! |
| 2330 | 2330 | if (empty($conf->global->MAIN_SECURITY_HASH_ALGO)) |
| 2331 | 2331 | { |
| 2332 | - if ($this->pass_indatabase_crypted && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) { |
|
| 2332 | + if ($this->pass_indatabase_crypted && !empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) { |
|
| 2333 | 2333 | // Create OpenLDAP MD5 password from Dolibarr MD5 password |
| 2334 | 2334 | // Note: This suppose that "pass_indatabase_crypted" is a md5 (guaranted by the previous test if "(empty($conf->global->MAIN_SECURITY_HASH_ALGO))" |
| 2335 | 2335 | $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = '{md5}'.base64_encode(hex2bin($this->pass_indatabase_crypted)); |
@@ -2337,18 +2337,18 @@ discard block |
||
| 2337 | 2337 | } |
| 2338 | 2338 | } |
| 2339 | 2339 | // Use $this->pass_indatabase value if exists |
| 2340 | - else if (! empty($this->pass_indatabase)) |
|
| 2340 | + else if (!empty($this->pass_indatabase)) |
|
| 2341 | 2341 | { |
| 2342 | - if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte |
|
| 2343 | - if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 4); // md5 for OpenLdap TODO add type of encryption |
|
| 2342 | + if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte |
|
| 2343 | + if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 4); // md5 for OpenLdap TODO add type of encryption |
|
| 2344 | 2344 | } |
| 2345 | 2345 | } |
| 2346 | 2346 | |
| 2347 | 2347 | // Subscriptions |
| 2348 | - if ($this->first_subscription_date && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE] = dol_print_date($this->first_subscription_date,'dayhourldap'); |
|
| 2349 | - if (isset($this->first_subscription_amount) && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT] = $this->first_subscription_amount; |
|
| 2350 | - if ($this->last_subscription_date && ! empty($conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE)) $info[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE] = dol_print_date($this->last_subscription_date,'dayhourldap'); |
|
| 2351 | - if (isset($this->last_subscription_amount) && ! empty($conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT)) $info[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT] = $this->last_subscription_amount; |
|
| 2348 | + if ($this->first_subscription_date && !empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE] = dol_print_date($this->first_subscription_date, 'dayhourldap'); |
|
| 2349 | + if (isset($this->first_subscription_amount) && !empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT] = $this->first_subscription_amount; |
|
| 2350 | + if ($this->last_subscription_date && !empty($conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE)) $info[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE] = dol_print_date($this->last_subscription_date, 'dayhourldap'); |
|
| 2351 | + if (isset($this->last_subscription_amount) && !empty($conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT)) $info[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT] = $this->last_subscription_amount; |
|
| 2352 | 2352 | |
| 2353 | 2353 | return $info; |
| 2354 | 2354 | } |
@@ -2363,14 +2363,14 @@ discard block |
||
| 2363 | 2363 | function info($id) |
| 2364 | 2364 | { |
| 2365 | 2365 | $sql = 'SELECT a.rowid, a.datec as datec,'; |
| 2366 | - $sql.= ' a.datevalid as datev,'; |
|
| 2367 | - $sql.= ' a.tms as datem,'; |
|
| 2368 | - $sql.= ' a.fk_user_author, a.fk_user_valid, a.fk_user_mod'; |
|
| 2369 | - $sql.= ' FROM '.MAIN_DB_PREFIX.'adherent as a'; |
|
| 2370 | - $sql.= ' WHERE a.rowid = '.$id; |
|
| 2366 | + $sql .= ' a.datevalid as datev,'; |
|
| 2367 | + $sql .= ' a.tms as datem,'; |
|
| 2368 | + $sql .= ' a.fk_user_author, a.fk_user_valid, a.fk_user_mod'; |
|
| 2369 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'adherent as a'; |
|
| 2370 | + $sql .= ' WHERE a.rowid = '.$id; |
|
| 2371 | 2371 | |
| 2372 | 2372 | dol_syslog(get_class($this)."::info", LOG_DEBUG); |
| 2373 | - $result=$this->db->query($sql); |
|
| 2373 | + $result = $this->db->query($sql); |
|
| 2374 | 2374 | if ($result) |
| 2375 | 2375 | { |
| 2376 | 2376 | if ($this->db->num_rows($result)) |
@@ -2381,7 +2381,7 @@ discard block |
||
| 2381 | 2381 | { |
| 2382 | 2382 | $cuser = new User($this->db); |
| 2383 | 2383 | $cuser->fetch($obj->fk_user_author); |
| 2384 | - $this->user_creation = $cuser; |
|
| 2384 | + $this->user_creation = $cuser; |
|
| 2385 | 2385 | } |
| 2386 | 2386 | |
| 2387 | 2387 | if ($obj->fk_user_valid) |
@@ -2429,7 +2429,7 @@ discard block |
||
| 2429 | 2429 | } |
| 2430 | 2430 | |
| 2431 | 2431 | // Get current categories |
| 2432 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 2432 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 2433 | 2433 | $c = new Categorie($this->db); |
| 2434 | 2434 | $existing = $c->containing($this->id, Categorie::TYPE_MEMBER, 'id'); |
| 2435 | 2435 | |
@@ -2485,7 +2485,7 @@ discard block |
||
| 2485 | 2485 | |
| 2486 | 2486 | //Only valid members |
| 2487 | 2487 | if ($this->statut <= 0) return false; |
| 2488 | - if (! $this->datefin) return false; |
|
| 2488 | + if (!$this->datefin) return false; |
|
| 2489 | 2489 | |
| 2490 | 2490 | $now = dol_now(); |
| 2491 | 2491 | |
@@ -2502,12 +2502,12 @@ discard block |
||
| 2502 | 2502 | * @param int $daysbeforeend Nb of days before end of subscription (negative number = after subscription) |
| 2503 | 2503 | * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) |
| 2504 | 2504 | */ |
| 2505 | - public function sendReminderForExpiredSubscription($daysbeforeend=10) |
|
| 2505 | + public function sendReminderForExpiredSubscription($daysbeforeend = 10) |
|
| 2506 | 2506 | { |
| 2507 | 2507 | global $conf, $langs, $mysoc, $user; |
| 2508 | 2508 | |
| 2509 | 2509 | $this->output = ''; |
| 2510 | - $this->error=''; |
|
| 2510 | + $this->error = ''; |
|
| 2511 | 2511 | |
| 2512 | 2512 | $blockingerrormsg = ''; |
| 2513 | 2513 | |
@@ -2522,11 +2522,11 @@ discard block |
||
| 2522 | 2522 | |
| 2523 | 2523 | dol_syslog(__METHOD__, LOG_DEBUG); |
| 2524 | 2524 | |
| 2525 | - $tmp=dol_getdate($now); |
|
| 2525 | + $tmp = dol_getdate($now); |
|
| 2526 | 2526 | $datetosearchfor = dol_time_plus_duree(dol_mktime(0, 0, 0, $tmp['mon'], $tmp['mday'], $tmp['year']), -1 * $daysbeforeend, 'd'); |
| 2527 | 2527 | |
| 2528 | 2528 | $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'adherent'; |
| 2529 | - $sql.= " WHERE datefin = '".$this->db->idate($datetosearchfor)."'"; |
|
| 2529 | + $sql .= " WHERE datefin = '".$this->db->idate($datetosearchfor)."'"; |
|
| 2530 | 2530 | |
| 2531 | 2531 | $resql = $this->db->query($sql); |
| 2532 | 2532 | if ($resql) |
@@ -2535,9 +2535,9 @@ discard block |
||
| 2535 | 2535 | |
| 2536 | 2536 | include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
| 2537 | 2537 | $adherent = new Adherent($this->db); |
| 2538 | - $formmail=new FormMail($db); |
|
| 2538 | + $formmail = new FormMail($db); |
|
| 2539 | 2539 | |
| 2540 | - $i=0; |
|
| 2540 | + $i = 0; |
|
| 2541 | 2541 | $nbok = 0; |
| 2542 | 2542 | $nbko = 0; |
| 2543 | 2543 | while ($i < $num_rows) |
@@ -2562,11 +2562,11 @@ discard block |
||
| 2562 | 2562 | $outputlangs->setDefaultLang(empty($adherent->thirdparty->default_lang) ? $mysoc->default_lang : $adherent->thirdparty->default_lang); |
| 2563 | 2563 | $outputlangs->loadLangs(array("main", "members")); |
| 2564 | 2564 | |
| 2565 | - $arraydefaultmessage=$formmail->getEMailTemplate($this->db, 'member', $user, $outputlangs, 0, 1, '(SendReminderForExpiredSubscriptionTitle)'); |
|
| 2565 | + $arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'member', $user, $outputlangs, 0, 1, '(SendReminderForExpiredSubscriptionTitle)'); |
|
| 2566 | 2566 | |
| 2567 | 2567 | if (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) |
| 2568 | 2568 | { |
| 2569 | - $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $adherent); |
|
| 2569 | + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $adherent); |
|
| 2570 | 2570 | //if (is_array($adherent->thirdparty)) $substitutionarraycomp = ... |
| 2571 | 2571 | complete_substitutions_array($substitutionarray, $outputlangs, $adherent); |
| 2572 | 2572 | |
@@ -2577,7 +2577,7 @@ discard block |
||
| 2577 | 2577 | |
| 2578 | 2578 | $cmail = new CMailFile($subject, $to, $from, $msg, array(), array(), array(), '', '', 0, 1); |
| 2579 | 2579 | $result = $cmail->sendfile(); |
| 2580 | - if (! $result) |
|
| 2580 | + if (!$result) |
|
| 2581 | 2581 | { |
| 2582 | 2582 | $error++; |
| 2583 | 2583 | $this->error = $cmail->error; |
@@ -2591,7 +2591,7 @@ discard block |
||
| 2591 | 2591 | } |
| 2592 | 2592 | else |
| 2593 | 2593 | { |
| 2594 | - $blockingerrormsg="Can't find email template '(SendReminderForExpiredSubscriptionTitle)'"; |
|
| 2594 | + $blockingerrormsg = "Can't find email template '(SendReminderForExpiredSubscriptionTitle)'"; |
|
| 2595 | 2595 | $nbko++; |
| 2596 | 2596 | break; |
| 2597 | 2597 | } |
@@ -2614,8 +2614,8 @@ discard block |
||
| 2614 | 2614 | else |
| 2615 | 2615 | { |
| 2616 | 2616 | $this->output = 'Found '.($nbok + $nbko).' members to send reminder to.'; |
| 2617 | - $this->output.= ' Send successfull to '.$nbok.' members'; |
|
| 2618 | - if ($nbko) $this->output.= ' - Canceled for '.$nbko.' member (no email or email sending error)'; |
|
| 2617 | + $this->output .= ' Send successfull to '.$nbok.' members'; |
|
| 2618 | + if ($nbko) $this->output .= ' - Canceled for '.$nbko.' member (no email or email sending error)'; |
|
| 2619 | 2619 | } |
| 2620 | 2620 | |
| 2621 | 2621 | return 0; |
@@ -147,16 +147,22 @@ discard block |
||
| 147 | 147 | if ($msgishtml == -1) |
| 148 | 148 | { |
| 149 | 149 | $msgishtml = 0; |
| 150 | - if (dol_textishtml($text,1)) $msgishtml = 1; |
|
| 150 | + if (dol_textishtml($text,1)) { |
|
| 151 | + $msgishtml = 1; |
|
| 152 | + } |
|
| 151 | 153 | } |
| 152 | 154 | |
| 153 | 155 | $texttosend=$this->makeSubstitution($text); |
| 154 | 156 | $subjecttosend=$this->makeSubstitution($subject); |
| 155 | - if ($msgishtml) $texttosend=dol_htmlentitiesbr($texttosend); |
|
| 157 | + if ($msgishtml) { |
|
| 158 | + $texttosend=dol_htmlentitiesbr($texttosend); |
|
| 159 | + } |
|
| 156 | 160 | |
| 157 | 161 | // Envoi mail confirmation |
| 158 | 162 | $from=$conf->email_from; |
| 159 | - if (! empty($conf->global->ADHERENT_MAIL_FROM)) $from=$conf->global->ADHERENT_MAIL_FROM; |
|
| 163 | + if (! empty($conf->global->ADHERENT_MAIL_FROM)) { |
|
| 164 | + $from=$conf->global->ADHERENT_MAIL_FROM; |
|
| 165 | + } |
|
| 160 | 166 | |
| 161 | 167 | // Send email (substitutionarray must be done just before this) |
| 162 | 168 | include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; |
@@ -164,8 +170,7 @@ discard block |
||
| 164 | 170 | if ($mailfile->sendfile()) |
| 165 | 171 | { |
| 166 | 172 | return 1; |
| 167 | - } |
|
| 168 | - else |
|
| 173 | + } else |
|
| 169 | 174 | { |
| 170 | 175 | $this->error=$langs->trans("ErrorFailedToSendMail",$from,$this->email).'. '.$mailfile->error; |
| 171 | 176 | return -1; |
@@ -186,10 +191,14 @@ discard block |
||
| 186 | 191 | $birthday = dol_print_date($this->birth,'day'); |
| 187 | 192 | |
| 188 | 193 | $msgishtml = 0; |
| 189 | - if (dol_textishtml($text,1)) $msgishtml = 1; |
|
| 194 | + if (dol_textishtml($text,1)) { |
|
| 195 | + $msgishtml = 1; |
|
| 196 | + } |
|
| 190 | 197 | |
| 191 | 198 | $infos=''; |
| 192 | - if ($this->civility_id) $infos.= $langs->transnoentities("UserTitle").": ".$this->getCivilityLabel()."\n"; |
|
| 199 | + if ($this->civility_id) { |
|
| 200 | + $infos.= $langs->transnoentities("UserTitle").": ".$this->getCivilityLabel()."\n"; |
|
| 201 | + } |
|
| 193 | 202 | $infos.= $langs->transnoentities("id").": ".$this->id."\n"; |
| 194 | 203 | $infos.= $langs->transnoentities("Lastname").": ".$this->lastname."\n"; |
| 195 | 204 | $infos.= $langs->transnoentities("Firstname").": ".$this->firstname."\n"; |
@@ -278,7 +287,9 @@ discard block |
||
| 278 | 287 | $this->error = $langs->trans("ErrorBadEMail",$this->email); |
| 279 | 288 | return -1; |
| 280 | 289 | } |
| 281 | - if (! $this->datec) $this->datec=$now; |
|
| 290 | + if (! $this->datec) { |
|
| 291 | + $this->datec=$now; |
|
| 292 | + } |
|
| 282 | 293 | if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) |
| 283 | 294 | { |
| 284 | 295 | if (empty($this->login)) |
@@ -351,22 +362,19 @@ discard block |
||
| 351 | 362 | dol_syslog(get_class($this)."::create ".implode(',',$this->errors), LOG_ERR); |
| 352 | 363 | $this->db->rollback(); |
| 353 | 364 | return -3; |
| 354 | - } |
|
| 355 | - else |
|
| 365 | + } else |
|
| 356 | 366 | { |
| 357 | 367 | $this->db->commit(); |
| 358 | 368 | return $this->id; |
| 359 | 369 | } |
| 360 | - } |
|
| 361 | - else |
|
| 370 | + } else |
|
| 362 | 371 | { |
| 363 | 372 | $this->error='Failed to get last insert id'; |
| 364 | 373 | dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); |
| 365 | 374 | $this->db->rollback(); |
| 366 | 375 | return -2; |
| 367 | 376 | } |
| 368 | - } |
|
| 369 | - else |
|
| 377 | + } else |
|
| 370 | 378 | { |
| 371 | 379 | $this->error=$this->db->error(); |
| 372 | 380 | $this->db->rollback(); |
@@ -403,8 +411,12 @@ discard block |
||
| 403 | 411 | $this->town=($this->town?$this->town:$this->town); |
| 404 | 412 | $this->country_id=($this->country_id > 0?$this->country_id:$this->country_id); |
| 405 | 413 | $this->state_id=($this->state_id > 0?$this->state_id:$this->state_id); |
| 406 | - if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname=ucwords(trim($this->lastname)); |
|
| 407 | - if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname=ucwords(trim($this->firstname)); |
|
| 414 | + if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) { |
|
| 415 | + $this->lastname=ucwords(trim($this->lastname)); |
|
| 416 | + } |
|
| 417 | + if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) { |
|
| 418 | + $this->firstname=ucwords(trim($this->firstname)); |
|
| 419 | + } |
|
| 408 | 420 | $this->note_public=($this->note_public?$this->note_public:$this->note_public); |
| 409 | 421 | $this->note_private=($this->note_private?$this->note_private:$this->note_private); |
| 410 | 422 | |
@@ -443,8 +455,14 @@ discard block |
||
| 443 | 455 | $sql.= ", fk_adherent_type = ".$this->db->escape($this->typeid); |
| 444 | 456 | $sql.= ", morphy = '".$this->db->escape($this->morphy)."'"; |
| 445 | 457 | $sql.= ", birth = ".($this->birth?"'".$this->db->idate($this->birth)."'":"null"); |
| 446 | - if ($this->datefin) $sql.= ", datefin = '".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription |
|
| 447 | - if ($this->datevalid) $sql.= ", datevalid = '".$this->db->idate($this->datevalid)."'"; // Must be modified only when validating a member |
|
| 458 | + if ($this->datefin) { |
|
| 459 | + $sql.= ", datefin = '".$this->db->idate($this->datefin)."'"; |
|
| 460 | + } |
|
| 461 | + // Must be modified only when deleting a subscription |
|
| 462 | + if ($this->datevalid) { |
|
| 463 | + $sql.= ", datevalid = '".$this->db->idate($this->datevalid)."'"; |
|
| 464 | + } |
|
| 465 | + // Must be modified only when validating a member |
|
| 448 | 466 | $sql.= ", fk_user_mod = ".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest |
| 449 | 467 | $sql.= " WHERE rowid = ".$this->id; |
| 450 | 468 | |
@@ -469,16 +487,19 @@ discard block |
||
| 469 | 487 | $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
| 470 | 488 | if (empty($reshook)) |
| 471 | 489 | { |
| 472 | - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used |
|
| 490 | + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { |
|
| 491 | + // For avoid conflicts if trigger used |
|
| 473 | 492 | { |
| 474 | 493 | $result=$this->insertExtraFields(); |
| 494 | + } |
|
| 475 | 495 | if ($result < 0) |
| 476 | 496 | { |
| 477 | 497 | $error++; |
| 478 | 498 | } |
| 479 | 499 | } |
| 500 | + } else if ($reshook < 0) { |
|
| 501 | + $error++; |
|
| 480 | 502 | } |
| 481 | - else if ($reshook < 0) $error++; |
|
| 482 | 503 | |
| 483 | 504 | // Update password |
| 484 | 505 | if (! $error && $this->pass) |
@@ -490,7 +511,9 @@ discard block |
||
| 490 | 511 | |
| 491 | 512 | // If password to set differs from the one found into database |
| 492 | 513 | $result=$this->setPassword($user,$this->pass,$isencrypted,$notrigger,$nosyncuserpass); |
| 493 | - if (! $nbrowsaffected) $nbrowsaffected++; |
|
| 514 | + if (! $nbrowsaffected) { |
|
| 515 | + $nbrowsaffected++; |
|
| 516 | + } |
|
| 494 | 517 | } |
| 495 | 518 | } |
| 496 | 519 | |
@@ -512,12 +535,14 @@ discard block |
||
| 512 | 535 | } |
| 513 | 536 | } |
| 514 | 537 | |
| 515 | - if (! $error && $nbrowsaffected) // If something has change in main data |
|
| 538 | + if (! $error && $nbrowsaffected) { |
|
| 539 | + // If something has change in main data |
|
| 516 | 540 | { |
| 517 | 541 | // Update information on linked user if it is an update |
| 518 | 542 | if (! $error && $this->user_id > 0 && ! $nosyncuser) |
| 519 | 543 | { |
| 520 | 544 | require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; |
| 545 | + } |
|
| 521 | 546 | |
| 522 | 547 | dol_syslog(get_class($this)."::update update linked user"); |
| 523 | 548 | |
@@ -530,7 +555,9 @@ discard block |
||
| 530 | 555 | //var_dump($this->login);exit; |
| 531 | 556 | |
| 532 | 557 | // If option ADHERENT_LOGIN_NOT_REQUIRED is on, there is no login of member, so we do not overwrite user login to keep existing one. |
| 533 | - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $luser->login=$this->login; |
|
| 558 | + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { |
|
| 559 | + $luser->login=$this->login; |
|
| 560 | + } |
|
| 534 | 561 | |
| 535 | 562 | $luser->civility_id=$this->civility_id; |
| 536 | 563 | $luser->firstname=$this->firstname; |
@@ -552,8 +579,7 @@ discard block |
||
| 552 | 579 | dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR); |
| 553 | 580 | $error++; |
| 554 | 581 | } |
| 555 | - } |
|
| 556 | - else |
|
| 582 | + } else |
|
| 557 | 583 | { |
| 558 | 584 | $this->error=$luser->error; |
| 559 | 585 | $error++; |
@@ -592,8 +618,7 @@ discard block |
||
| 592 | 618 | dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR); |
| 593 | 619 | $error++; |
| 594 | 620 | } |
| 595 | - } |
|
| 596 | - else |
|
| 621 | + } else |
|
| 597 | 622 | { |
| 598 | 623 | $this->error=$lthirdparty->error; |
| 599 | 624 | $error++; |
@@ -613,14 +638,12 @@ discard block |
||
| 613 | 638 | { |
| 614 | 639 | $this->db->commit(); |
| 615 | 640 | return $nbrowsaffected; |
| 616 | - } |
|
| 617 | - else |
|
| 641 | + } else |
|
| 618 | 642 | { |
| 619 | 643 | $this->db->rollback(); |
| 620 | 644 | return -1; |
| 621 | 645 | } |
| 622 | - } |
|
| 623 | - else |
|
| 646 | + } else |
|
| 624 | 647 | { |
| 625 | 648 | $this->db->rollback(); |
| 626 | 649 | $this->error=$this->db->lasterror(); |
@@ -669,14 +692,12 @@ discard block |
||
| 669 | 692 | $this->datefin=$datefin; |
| 670 | 693 | $this->db->commit(); |
| 671 | 694 | return 1; |
| 672 | - } |
|
| 673 | - else |
|
| 695 | + } else |
|
| 674 | 696 | { |
| 675 | 697 | $this->db->rollback(); |
| 676 | 698 | return -1; |
| 677 | 699 | } |
| 678 | - } |
|
| 679 | - else |
|
| 700 | + } else |
|
| 680 | 701 | { |
| 681 | 702 | $this->error=$this->db->lasterror(); |
| 682 | 703 | $this->db->rollback(); |
@@ -702,7 +723,9 @@ discard block |
||
| 702 | 723 | $errorflag=0; |
| 703 | 724 | |
| 704 | 725 | // Check parameters |
| 705 | - if (empty($rowid)) $rowid=$this->id; |
|
| 726 | + if (empty($rowid)) { |
|
| 727 | + $rowid=$this->id; |
|
| 728 | + } |
|
| 706 | 729 | |
| 707 | 730 | $this->db->begin(); |
| 708 | 731 | |
@@ -710,7 +733,9 @@ discard block |
||
| 710 | 733 | { |
| 711 | 734 | // Call trigger |
| 712 | 735 | $result=$this->call_trigger('MEMBER_DELETE',$user); |
| 713 | - if ($result < 0) $error++; |
|
| 736 | + if ($result < 0) { |
|
| 737 | + $error++; |
|
| 738 | + } |
|
| 714 | 739 | // End call triggers |
| 715 | 740 | } |
| 716 | 741 | |
@@ -754,9 +779,11 @@ discard block |
||
| 754 | 779 | // Removed extrafields |
| 755 | 780 | if (! $error) |
| 756 | 781 | { |
| 757 | - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used |
|
| 782 | + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { |
|
| 783 | + // For avoid conflicts if trigger used |
|
| 758 | 784 | { |
| 759 | 785 | $result=$this->deleteExtraFields(); |
| 786 | + } |
|
| 760 | 787 | if ($result < 0) |
| 761 | 788 | { |
| 762 | 789 | $error++; |
@@ -784,8 +811,7 @@ discard block |
||
| 784 | 811 | { |
| 785 | 812 | $this->db->commit(); |
| 786 | 813 | return 1; |
| 787 | - } |
|
| 788 | - else |
|
| 814 | + } else |
|
| 789 | 815 | { |
| 790 | 816 | $this->db->rollback(); |
| 791 | 817 | return $errorflag; |
@@ -836,8 +862,7 @@ discard block |
||
| 836 | 862 | if ($isencrypted) |
| 837 | 863 | { |
| 838 | 864 | $sql.= ", pass = null"; |
| 839 | - } |
|
| 840 | - else |
|
| 865 | + } else |
|
| 841 | 866 | { |
| 842 | 867 | $sql.= ", pass = '".$this->db->escape($password_indatabase)."'"; |
| 843 | 868 | } |
@@ -874,8 +899,7 @@ discard block |
||
| 874 | 899 | dol_syslog(get_class($this)."::setPassword ".$this->error,LOG_ERR); |
| 875 | 900 | $error++; |
| 876 | 901 | } |
| 877 | - } |
|
| 878 | - else |
|
| 902 | + } else |
|
| 879 | 903 | { |
| 880 | 904 | $this->error=$luser->error; |
| 881 | 905 | $error++; |
@@ -892,14 +916,12 @@ discard block |
||
| 892 | 916 | |
| 893 | 917 | $this->db->commit(); |
| 894 | 918 | return $this->pass; |
| 895 | - } |
|
| 896 | - else |
|
| 919 | + } else |
|
| 897 | 920 | { |
| 898 | 921 | $this->db->rollback(); |
| 899 | 922 | return 0; |
| 900 | 923 | } |
| 901 | - } |
|
| 902 | - else |
|
| 924 | + } else |
|
| 903 | 925 | { |
| 904 | 926 | $this->db->rollback(); |
| 905 | 927 | dol_print_error($this->db); |
@@ -974,8 +996,7 @@ discard block |
||
| 974 | 996 | { |
| 975 | 997 | $this->db->commit(); |
| 976 | 998 | return 1; |
| 977 | - } |
|
| 978 | - else |
|
| 999 | + } else |
|
| 979 | 1000 | { |
| 980 | 1001 | $this->error=$this->db->error(); |
| 981 | 1002 | $this->db->rollback(); |
@@ -1006,8 +1027,7 @@ discard block |
||
| 1006 | 1027 | $obj = $this->db->fetch_object($resql); |
| 1007 | 1028 | $this->fetch($obj->rowid); |
| 1008 | 1029 | } |
| 1009 | - } |
|
| 1010 | - else |
|
| 1030 | + } else |
|
| 1011 | 1031 | { |
| 1012 | 1032 | dol_print_error($this->db); |
| 1013 | 1033 | } |
@@ -1037,8 +1057,7 @@ discard block |
||
| 1037 | 1057 | $obj = $this->db->fetch_object($resql); |
| 1038 | 1058 | $this->fetch($obj->rowid); |
| 1039 | 1059 | } |
| 1040 | - } |
|
| 1041 | - else |
|
| 1060 | + } else |
|
| 1042 | 1061 | { |
| 1043 | 1062 | dol_print_error($this->db); |
| 1044 | 1063 | } |
@@ -1078,13 +1097,16 @@ discard block |
||
| 1078 | 1097 | $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as dep ON d.state_id = dep.rowid"; |
| 1079 | 1098 | $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON d.rowid = u.fk_member"; |
| 1080 | 1099 | $sql.= " WHERE d.fk_adherent_type = t.rowid"; |
| 1081 | - if ($rowid) $sql.= " AND d.rowid=".$rowid; |
|
| 1082 | - elseif ($ref || $fk_soc) { |
|
| 1100 | + if ($rowid) { |
|
| 1101 | + $sql.= " AND d.rowid=".$rowid; |
|
| 1102 | + } elseif ($ref || $fk_soc) { |
|
| 1083 | 1103 | $sql.= " AND d.entity IN (".getEntity('adherent').")"; |
| 1084 | - if ($ref) $sql.= " AND d.rowid='".$this->db->escape($ref)."'"; |
|
| 1085 | - elseif ($fk_soc > 0) $sql.= " AND d.fk_soc=".$fk_soc; |
|
| 1086 | - } |
|
| 1087 | - elseif ($ref_ext) |
|
| 1104 | + if ($ref) { |
|
| 1105 | + $sql.= " AND d.rowid='".$this->db->escape($ref)."'"; |
|
| 1106 | + } elseif ($fk_soc > 0) { |
|
| 1107 | + $sql.= " AND d.fk_soc=".$fk_soc; |
|
| 1108 | + } |
|
| 1109 | + } elseif ($ref_ext) |
|
| 1088 | 1110 | { |
| 1089 | 1111 | $sql.= " AND d.ref_ext='".$this->db->escape($ref_ext)."'"; |
| 1090 | 1112 | } |
@@ -1122,10 +1144,11 @@ discard block |
||
| 1122 | 1144 | |
| 1123 | 1145 | $this->country_id = $obj->country_id; |
| 1124 | 1146 | $this->country_code = $obj->country_code; |
| 1125 | - if ($langs->trans("Country".$obj->country_code) != "Country".$obj->country_code) |
|
| 1126 | - $this->country = $langs->transnoentitiesnoconv("Country".$obj->country_code); |
|
| 1127 | - else |
|
| 1128 | - $this->country=$obj->country; |
|
| 1147 | + if ($langs->trans("Country".$obj->country_code) != "Country".$obj->country_code) { |
|
| 1148 | + $this->country = $langs->transnoentitiesnoconv("Country".$obj->country_code); |
|
| 1149 | + } else { |
|
| 1150 | + $this->country=$obj->country; |
|
| 1151 | + } |
|
| 1129 | 1152 | |
| 1130 | 1153 | $this->phone = $obj->phone; |
| 1131 | 1154 | $this->phone_perso = $obj->phone_perso; |
@@ -1164,13 +1187,11 @@ discard block |
||
| 1164 | 1187 | $result=$this->fetch_subscriptions(); |
| 1165 | 1188 | |
| 1166 | 1189 | return $this->id; |
| 1167 | - } |
|
| 1168 | - else |
|
| 1190 | + } else |
|
| 1169 | 1191 | { |
| 1170 | 1192 | return 0; |
| 1171 | 1193 | } |
| 1172 | - } |
|
| 1173 | - else |
|
| 1194 | + } else |
|
| 1174 | 1195 | { |
| 1175 | 1196 | $this->error=$this->db->lasterror(); |
| 1176 | 1197 | return -1; |
@@ -1235,8 +1256,7 @@ discard block |
||
| 1235 | 1256 | $i++; |
| 1236 | 1257 | } |
| 1237 | 1258 | return 1; |
| 1238 | - } |
|
| 1239 | - else |
|
| 1259 | + } else |
|
| 1240 | 1260 | { |
| 1241 | 1261 | $this->error=$this->db->error().' sql='.$sql; |
| 1242 | 1262 | return -1; |
@@ -1267,15 +1287,16 @@ discard block |
||
| 1267 | 1287 | $error=0; |
| 1268 | 1288 | |
| 1269 | 1289 | // Clean parameters |
| 1270 | - if (! $amount) $amount=0; |
|
| 1290 | + if (! $amount) { |
|
| 1291 | + $amount=0; |
|
| 1292 | + } |
|
| 1271 | 1293 | |
| 1272 | 1294 | $this->db->begin(); |
| 1273 | 1295 | |
| 1274 | 1296 | if ($datesubend) |
| 1275 | 1297 | { |
| 1276 | 1298 | $datefin=$datesubend; |
| 1277 | - } |
|
| 1278 | - else |
|
| 1299 | + } else |
|
| 1279 | 1300 | { |
| 1280 | 1301 | // If no end date, end date = date + 1 year - 1 day |
| 1281 | 1302 | $datefin = dol_time_plus_duree($date,1,'y'); |
@@ -1310,14 +1331,12 @@ discard block |
||
| 1310 | 1331 | { |
| 1311 | 1332 | $this->db->commit(); |
| 1312 | 1333 | return $rowid; |
| 1313 | - } |
|
| 1314 | - else |
|
| 1334 | + } else |
|
| 1315 | 1335 | { |
| 1316 | 1336 | $this->db->rollback(); |
| 1317 | 1337 | return -2; |
| 1318 | 1338 | } |
| 1319 | - } |
|
| 1320 | - else |
|
| 1339 | + } else |
|
| 1321 | 1340 | { |
| 1322 | 1341 | $this->error=$subscription->error; |
| 1323 | 1342 | $this->errors=$subscription->errors; |
@@ -1380,15 +1399,13 @@ discard block |
||
| 1380 | 1399 | $this->error=$this->db->lasterror(); |
| 1381 | 1400 | $this->errors[]=$this->error; |
| 1382 | 1401 | } |
| 1383 | - } |
|
| 1384 | - else |
|
| 1402 | + } else |
|
| 1385 | 1403 | { |
| 1386 | 1404 | $error++; |
| 1387 | 1405 | $this->error=$acct->error; |
| 1388 | 1406 | $this->errors=$acct->errors; |
| 1389 | 1407 | } |
| 1390 | - } |
|
| 1391 | - else |
|
| 1408 | + } else |
|
| 1392 | 1409 | { |
| 1393 | 1410 | $error++; |
| 1394 | 1411 | $this->error=$acct->error; |
@@ -1418,12 +1435,15 @@ discard block |
||
| 1418 | 1435 | if ($this->morphy == 'mor') |
| 1419 | 1436 | { |
| 1420 | 1437 | $companyname=$this->societe; |
| 1421 | - if (! empty($fullname)) $companyalias=$fullname; |
|
| 1422 | - } |
|
| 1423 | - else |
|
| 1438 | + if (! empty($fullname)) { |
|
| 1439 | + $companyalias=$fullname; |
|
| 1440 | + } |
|
| 1441 | + } else |
|
| 1424 | 1442 | { |
| 1425 | 1443 | $companyname=$fullname; |
| 1426 | - if (! empty($this->societe)) $companyalias=$this->societe; |
|
| 1444 | + if (! empty($this->societe)) { |
|
| 1445 | + $companyalias=$this->societe; |
|
| 1446 | + } |
|
| 1427 | 1447 | } |
| 1428 | 1448 | |
| 1429 | 1449 | $result=$customer->create_from_member($this, $companyname, $companyalias); |
@@ -1432,13 +1452,11 @@ discard block |
||
| 1432 | 1452 | $this->error = $customer->error; |
| 1433 | 1453 | $this->errors = $customer->errors; |
| 1434 | 1454 | $error++; |
| 1435 | - } |
|
| 1436 | - else |
|
| 1455 | + } else |
|
| 1437 | 1456 | { |
| 1438 | 1457 | $this->fk_soc = $result; |
| 1439 | 1458 | } |
| 1440 | - } |
|
| 1441 | - else |
|
| 1459 | + } else |
|
| 1442 | 1460 | { |
| 1443 | 1461 | $langs->load("errors"); |
| 1444 | 1462 | $this->error=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst"); |
@@ -1490,8 +1508,7 @@ discard block |
||
| 1490 | 1508 | $this->error=$invoice->error; |
| 1491 | 1509 | $this->errors=$invoice->errors; |
| 1492 | 1510 | $error++; |
| 1493 | - } |
|
| 1494 | - else |
|
| 1511 | + } else |
|
| 1495 | 1512 | { |
| 1496 | 1513 | $this->invoice = $invoice; |
| 1497 | 1514 | } |
@@ -1501,7 +1518,9 @@ discard block |
||
| 1501 | 1518 | { |
| 1502 | 1519 | // Add line to draft invoice |
| 1503 | 1520 | $idprodsubscription=0; |
| 1504 | - if (! empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) $idprodsubscription = $conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS; |
|
| 1521 | + if (! empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) { |
|
| 1522 | + $idprodsubscription = $conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS; |
|
| 1523 | + } |
|
| 1505 | 1524 | |
| 1506 | 1525 | $vattouse=0; |
| 1507 | 1526 | if (isset($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) && $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS == 'defaultforfoundationcountry') |
@@ -1603,10 +1622,12 @@ discard block |
||
| 1603 | 1622 | $outputlangs = $langs; |
| 1604 | 1623 | $newlang = ''; |
| 1605 | 1624 | $lang_id=GETPOST('lang_id'); |
| 1606 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($lang_id)) |
|
| 1607 | - $newlang = $lang_id; |
|
| 1608 | - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) |
|
| 1609 | - $newlang = $customer->default_lang; |
|
| 1625 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($lang_id)) { |
|
| 1626 | + $newlang = $lang_id; |
|
| 1627 | + } |
|
| 1628 | + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { |
|
| 1629 | + $newlang = $customer->default_lang; |
|
| 1630 | + } |
|
| 1610 | 1631 | if (! empty($newlang)) { |
| 1611 | 1632 | $outputlangs = new Translate("", $conf); |
| 1612 | 1633 | $outputlangs->setDefaultLang($newlang); |
@@ -1621,8 +1642,7 @@ discard block |
||
| 1621 | 1642 | if ($error) |
| 1622 | 1643 | { |
| 1623 | 1644 | return -1; |
| 1624 | - } |
|
| 1625 | - else |
|
| 1645 | + } else |
|
| 1626 | 1646 | { |
| 1627 | 1647 | return 1; |
| 1628 | 1648 | } |
@@ -1670,8 +1690,7 @@ discard block |
||
| 1670 | 1690 | |
| 1671 | 1691 | $this->db->commit(); |
| 1672 | 1692 | return 1; |
| 1673 | - } |
|
| 1674 | - else |
|
| 1693 | + } else |
|
| 1675 | 1694 | { |
| 1676 | 1695 | $this->error=$this->db->error(); |
| 1677 | 1696 | $this->db->rollback(); |
@@ -1718,8 +1737,7 @@ discard block |
||
| 1718 | 1737 | |
| 1719 | 1738 | $this->db->commit(); |
| 1720 | 1739 | return 1; |
| 1721 | - } |
|
| 1722 | - else |
|
| 1740 | + } else |
|
| 1723 | 1741 | { |
| 1724 | 1742 | $this->error=$this->db->error(); |
| 1725 | 1743 | $this->db->rollback(); |
@@ -1749,7 +1767,9 @@ discard block |
||
| 1749 | 1767 | |
| 1750 | 1768 | if ($result < 0) |
| 1751 | 1769 | { |
| 1752 | - if (! empty($mailmanspip->error)) $this->errors[]=$mailmanspip->error; |
|
| 1770 | + if (! empty($mailmanspip->error)) { |
|
| 1771 | + $this->errors[]=$mailmanspip->error; |
|
| 1772 | + } |
|
| 1753 | 1773 | $err+=1; |
| 1754 | 1774 | } |
| 1755 | 1775 | foreach ($mailmanspip->mladded_ko as $tmplist => $tmpemail) |
@@ -1777,8 +1797,7 @@ discard block |
||
| 1777 | 1797 | if ($err) |
| 1778 | 1798 | { |
| 1779 | 1799 | return -$err; |
| 1780 | - } |
|
| 1781 | - else |
|
| 1800 | + } else |
|
| 1782 | 1801 | { |
| 1783 | 1802 | return 1; |
| 1784 | 1803 | } |
@@ -1805,7 +1824,9 @@ discard block |
||
| 1805 | 1824 | $result=$mailmanspip->del_to_mailman($this); |
| 1806 | 1825 | if ($result < 0) |
| 1807 | 1826 | { |
| 1808 | - if (! empty($mailmanspip->error)) $this->errors[]=$mailmanspip->error; |
|
| 1827 | + if (! empty($mailmanspip->error)) { |
|
| 1828 | + $this->errors[]=$mailmanspip->error; |
|
| 1829 | + } |
|
| 1809 | 1830 | $err+=1; |
| 1810 | 1831 | } |
| 1811 | 1832 | |
@@ -1834,8 +1855,7 @@ discard block |
||
| 1834 | 1855 | { |
| 1835 | 1856 | // error |
| 1836 | 1857 | return -$err; |
| 1837 | - } |
|
| 1838 | - else |
|
| 1858 | + } else |
|
| 1839 | 1859 | { |
| 1840 | 1860 | return 1; |
| 1841 | 1861 | } |
@@ -1853,7 +1873,9 @@ discard block |
||
| 1853 | 1873 | $langs->load("dict"); |
| 1854 | 1874 | |
| 1855 | 1875 | $code=(empty($this->civility_id)?'':$this->civility_id); |
| 1856 | - if (empty($code)) return ''; |
|
| 1876 | + if (empty($code)) { |
|
| 1877 | + return ''; |
|
| 1878 | + } |
|
| 1857 | 1879 | return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civility", "code", "label", $code); |
| 1858 | 1880 | } |
| 1859 | 1881 | |
@@ -1872,7 +1894,9 @@ discard block |
||
| 1872 | 1894 | { |
| 1873 | 1895 | global $conf, $langs; |
| 1874 | 1896 | |
| 1875 | - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0; |
|
| 1897 | + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) { |
|
| 1898 | + $withpictoimg=0; |
|
| 1899 | + } |
|
| 1876 | 1900 | |
| 1877 | 1901 | $notooltip=0; |
| 1878 | 1902 | |
@@ -1888,10 +1912,12 @@ discard block |
||
| 1888 | 1912 | |
| 1889 | 1913 | $label.= '<div class="centpercent">'; |
| 1890 | 1914 | $label.= '<u>' . $langs->trans("Member") . '</u>'; |
| 1891 | - if (! empty($this->ref)) |
|
| 1892 | - $label.= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; |
|
| 1893 | - if (! empty($this->firstname) || ! empty($this->lastname)) |
|
| 1894 | - $label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs); |
|
| 1915 | + if (! empty($this->ref)) { |
|
| 1916 | + $label.= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; |
|
| 1917 | + } |
|
| 1918 | + if (! empty($this->firstname) || ! empty($this->lastname)) { |
|
| 1919 | + $label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs); |
|
| 1920 | + } |
|
| 1895 | 1921 | $label.='</div>'; |
| 1896 | 1922 | |
| 1897 | 1923 | $url = DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id; |
@@ -1904,8 +1930,12 @@ discard block |
||
| 1904 | 1930 | { |
| 1905 | 1931 | // Add param to save lastsearch_values or not |
| 1906 | 1932 | $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); |
| 1907 | - if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; |
|
| 1908 | - if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; |
|
| 1933 | + if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) { |
|
| 1934 | + $add_save_lastsearch_values=1; |
|
| 1935 | + } |
|
| 1936 | + if ($add_save_lastsearch_values) { |
|
| 1937 | + $url.='&save_lastsearch_values=1'; |
|
| 1938 | + } |
|
| 1909 | 1939 | } |
| 1910 | 1940 | |
| 1911 | 1941 | $link = '<a href="'.$url.'"'; |
@@ -1930,20 +1960,34 @@ discard block |
||
| 1930 | 1960 | if ($withpictoimg) |
| 1931 | 1961 | { |
| 1932 | 1962 | $paddafterimage=''; |
| 1933 | - if (abs($withpictoimg) == 1) $paddafterimage='style="margin-right: 3px;"'; |
|
| 1963 | + if (abs($withpictoimg) == 1) { |
|
| 1964 | + $paddafterimage='style="margin-right: 3px;"'; |
|
| 1965 | + } |
|
| 1934 | 1966 | // Only picto |
| 1935 | - if ($withpictoimg > 0) $picto='<div class="inline-block nopadding valignmiddle'.($morecss?' userimg'.$morecss:'').'">'.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).'</div>'; |
|
| 1967 | + if ($withpictoimg > 0) { |
|
| 1968 | + $picto='<div class="inline-block nopadding valignmiddle'.($morecss?' userimg'.$morecss:'').'">'.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).'</div>'; |
|
| 1969 | + } |
|
| 1936 | 1970 | // Picto must be a photo |
| 1937 | - else $picto='<div class="inline-block nopadding valignmiddle'.($morecss?' userimg'.$morecss:'').'"'.($paddafterimage?' '.$paddafterimage:'').'>'.Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg==-3?'small':''), 'mini', 0, 1).'</div>'; |
|
| 1971 | + else { |
|
| 1972 | + $picto='<div class="inline-block nopadding valignmiddle'.($morecss?' userimg'.$morecss:'').'"'.($paddafterimage?' '.$paddafterimage:'').'>'.Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg==-3?'small':''), 'mini', 0, 1).'</div>'; |
|
| 1973 | + } |
|
| 1938 | 1974 | $result.=$picto; |
| 1939 | 1975 | } |
| 1940 | 1976 | if ($withpictoimg > -2 && $withpictoimg != 2) |
| 1941 | 1977 | { |
| 1942 | - if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='<div class="inline-block nopadding valignmiddle'.((! isset($this->statut) || $this->statut)?'':' strikefordisabled').($morecss?' usertext'.$morecss:'').'">'; |
|
| 1943 | - if ($mode == 'login') $result.=dol_trunc($this->login, $maxlen); |
|
| 1944 | - elseif ($mode == 'ref') $result.=$this->id; |
|
| 1945 | - else $result.=$this->getFullName($langs,'',($mode == 'firstname' ? 2 : -1),$maxlen); |
|
| 1946 | - if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='</div>'; |
|
| 1978 | + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
|
| 1979 | + $result.='<div class="inline-block nopadding valignmiddle'.((! isset($this->statut) || $this->statut)?'':' strikefordisabled').($morecss?' usertext'.$morecss:'').'">'; |
|
| 1980 | + } |
|
| 1981 | + if ($mode == 'login') { |
|
| 1982 | + $result.=dol_trunc($this->login, $maxlen); |
|
| 1983 | + } elseif ($mode == 'ref') { |
|
| 1984 | + $result.=$this->id; |
|
| 1985 | + } else { |
|
| 1986 | + $result.=$this->getFullName($langs,'',($mode == 'firstname' ? 2 : -1),$maxlen); |
|
| 1987 | + } |
|
| 1988 | + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
|
| 1989 | + $result.='</div>'; |
|
| 1990 | + } |
|
| 1947 | 1991 | } |
| 1948 | 1992 | $result.=$linkend; |
| 1949 | 1993 | //if ($withpictoimg == -1) $result.='</div>'; |
@@ -1977,80 +2021,136 @@ discard block |
||
| 1977 | 2021 | $langs->load("members"); |
| 1978 | 2022 | if ($mode == 0) |
| 1979 | 2023 | { |
| 1980 | - if ($statut == -1) return $langs->trans("MemberStatusDraft"); |
|
| 2024 | + if ($statut == -1) { |
|
| 2025 | + return $langs->trans("MemberStatusDraft"); |
|
| 2026 | + } |
|
| 1981 | 2027 | if ($statut >= 1) |
| 1982 | 2028 | { |
| 1983 | - if (! $date_end_subscription) return $langs->trans("MemberStatusActive"); |
|
| 1984 | - elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLate"); |
|
| 1985 | - else return $langs->trans("MemberStatusPaid"); |
|
| 2029 | + if (! $date_end_subscription) { |
|
| 2030 | + return $langs->trans("MemberStatusActive"); |
|
| 2031 | + } elseif ($date_end_subscription < time()) { |
|
| 2032 | + return $langs->trans("MemberStatusActiveLate"); |
|
| 2033 | + } else { |
|
| 2034 | + return $langs->trans("MemberStatusPaid"); |
|
| 2035 | + } |
|
| 2036 | + } |
|
| 2037 | + if ($statut == 0) { |
|
| 2038 | + return $langs->trans("MemberStatusResiliated"); |
|
| 1986 | 2039 | } |
| 1987 | - if ($statut == 0) return $langs->trans("MemberStatusResiliated"); |
|
| 1988 | 2040 | } |
| 1989 | 2041 | if ($mode == 1) |
| 1990 | 2042 | { |
| 1991 | - if ($statut == -1) return $langs->trans("MemberStatusDraftShort"); |
|
| 2043 | + if ($statut == -1) { |
|
| 2044 | + return $langs->trans("MemberStatusDraftShort"); |
|
| 2045 | + } |
|
| 1992 | 2046 | if ($statut >= 1) |
| 1993 | 2047 | { |
| 1994 | - if (! $date_end_subscription) return $langs->trans("MemberStatusActiveShort"); |
|
| 1995 | - elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLateShort"); |
|
| 1996 | - else return $langs->trans("MemberStatusPaidShort"); |
|
| 2048 | + if (! $date_end_subscription) { |
|
| 2049 | + return $langs->trans("MemberStatusActiveShort"); |
|
| 2050 | + } elseif ($date_end_subscription < time()) { |
|
| 2051 | + return $langs->trans("MemberStatusActiveLateShort"); |
|
| 2052 | + } else { |
|
| 2053 | + return $langs->trans("MemberStatusPaidShort"); |
|
| 2054 | + } |
|
| 2055 | + } |
|
| 2056 | + if ($statut == 0) { |
|
| 2057 | + return $langs->trans("MemberStatusResiliatedShort"); |
|
| 1997 | 2058 | } |
| 1998 | - if ($statut == 0) return $langs->trans("MemberStatusResiliatedShort"); |
|
| 1999 | 2059 | } |
| 2000 | 2060 | if ($mode == 2) |
| 2001 | 2061 | { |
| 2002 | - if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraftShort"); |
|
| 2062 | + if ($statut == -1) { |
|
| 2063 | + return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraftShort"); |
|
| 2064 | + } |
|
| 2003 | 2065 | if ($statut >= 1) |
| 2004 | 2066 | { |
| 2005 | - if (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'),'statut1').' '.$langs->trans("MemberStatusActiveShort"); |
|
| 2006 | - elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'),'statut3').' '.$langs->trans("MemberStatusActiveLateShort"); |
|
| 2007 | - else return img_picto($langs->trans('MemberStatusPaid'),'statut4').' '.$langs->trans("MemberStatusPaidShort"); |
|
| 2067 | + if (! $date_end_subscription) { |
|
| 2068 | + return img_picto($langs->trans('MemberStatusActive'),'statut1').' '.$langs->trans("MemberStatusActiveShort"); |
|
| 2069 | + } elseif ($date_end_subscription < time()) { |
|
| 2070 | + return img_picto($langs->trans('MemberStatusActiveLate'),'statut3').' '.$langs->trans("MemberStatusActiveLateShort"); |
|
| 2071 | + } else { |
|
| 2072 | + return img_picto($langs->trans('MemberStatusPaid'),'statut4').' '.$langs->trans("MemberStatusPaidShort"); |
|
| 2073 | + } |
|
| 2074 | + } |
|
| 2075 | + if ($statut == 0) { |
|
| 2076 | + return img_picto($langs->trans('MemberStatusResiliated'),'statut5').' '.$langs->trans("MemberStatusResiliatedShort"); |
|
| 2008 | 2077 | } |
| 2009 | - if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5').' '.$langs->trans("MemberStatusResiliatedShort"); |
|
| 2010 | 2078 | } |
| 2011 | 2079 | if ($mode == 3) |
| 2012 | 2080 | { |
| 2013 | - if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0'); |
|
| 2081 | + if ($statut == -1) { |
|
| 2082 | + return img_picto($langs->trans('MemberStatusDraft'),'statut0'); |
|
| 2083 | + } |
|
| 2014 | 2084 | if ($statut >= 1) |
| 2015 | 2085 | { |
| 2016 | - if (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'),'statut1'); |
|
| 2017 | - elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'),'statut3'); |
|
| 2018 | - else return img_picto($langs->trans('MemberStatusPaid'),'statut4'); |
|
| 2086 | + if (! $date_end_subscription) { |
|
| 2087 | + return img_picto($langs->trans('MemberStatusActive'),'statut1'); |
|
| 2088 | + } elseif ($date_end_subscription < time()) { |
|
| 2089 | + return img_picto($langs->trans('MemberStatusActiveLate'),'statut3'); |
|
| 2090 | + } else { |
|
| 2091 | + return img_picto($langs->trans('MemberStatusPaid'),'statut4'); |
|
| 2092 | + } |
|
| 2093 | + } |
|
| 2094 | + if ($statut == 0) { |
|
| 2095 | + return img_picto($langs->trans('MemberStatusResiliated'),'statut5'); |
|
| 2019 | 2096 | } |
| 2020 | - if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5'); |
|
| 2021 | 2097 | } |
| 2022 | 2098 | if ($mode == 4) |
| 2023 | 2099 | { |
| 2024 | - if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraft"); |
|
| 2100 | + if ($statut == -1) { |
|
| 2101 | + return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraft"); |
|
| 2102 | + } |
|
| 2025 | 2103 | if ($statut >= 1) |
| 2026 | 2104 | { |
| 2027 | - if (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'),'statut1').' '.$langs->trans("MemberStatusActive"); |
|
| 2028 | - elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'),'statut3').' '.$langs->trans("MemberStatusActiveLate"); |
|
| 2029 | - else return img_picto($langs->trans('MemberStatusPaid'),'statut4').' '.$langs->trans("MemberStatusPaid"); |
|
| 2105 | + if (! $date_end_subscription) { |
|
| 2106 | + return img_picto($langs->trans('MemberStatusActive'),'statut1').' '.$langs->trans("MemberStatusActive"); |
|
| 2107 | + } elseif ($date_end_subscription < time()) { |
|
| 2108 | + return img_picto($langs->trans('MemberStatusActiveLate'),'statut3').' '.$langs->trans("MemberStatusActiveLate"); |
|
| 2109 | + } else { |
|
| 2110 | + return img_picto($langs->trans('MemberStatusPaid'),'statut4').' '.$langs->trans("MemberStatusPaid"); |
|
| 2111 | + } |
|
| 2112 | + } |
|
| 2113 | + if ($statut == 0) { |
|
| 2114 | + return img_picto($langs->trans('MemberStatusResiliated'),'statut5').' '.$langs->trans("MemberStatusResiliated"); |
|
| 2030 | 2115 | } |
| 2031 | - if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5').' '.$langs->trans("MemberStatusResiliated"); |
|
| 2032 | 2116 | } |
| 2033 | 2117 | if ($mode == 5) |
| 2034 | 2118 | { |
| 2035 | - if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'),'statut0'); |
|
| 2119 | + if ($statut == -1) { |
|
| 2120 | + return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'),'statut0'); |
|
| 2121 | + } |
|
| 2036 | 2122 | if ($statut >= 1) |
| 2037 | 2123 | { |
| 2038 | - if (! $date_end_subscription) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveShort").' </span>'.img_picto($langs->trans('MemberStatusActive'),'statut1'); |
|
| 2039 | - elseif ($date_end_subscription < time()) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveLateShort").' </span>'.img_picto($langs->trans('MemberStatusActiveLate'),'statut3'); |
|
| 2040 | - else return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusPaidShort").' </span>'.img_picto($langs->trans('MemberStatusPaid'),'statut4'); |
|
| 2124 | + if (! $date_end_subscription) { |
|
| 2125 | + return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveShort").' </span>'.img_picto($langs->trans('MemberStatusActive'),'statut1'); |
|
| 2126 | + } elseif ($date_end_subscription < time()) { |
|
| 2127 | + return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveLateShort").' </span>'.img_picto($langs->trans('MemberStatusActiveLate'),'statut3'); |
|
| 2128 | + } else { |
|
| 2129 | + return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusPaidShort").' </span>'.img_picto($langs->trans('MemberStatusPaid'),'statut4'); |
|
| 2130 | + } |
|
| 2131 | + } |
|
| 2132 | + if ($statut == 0) { |
|
| 2133 | + return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusResiliated").' </span>'.img_picto($langs->trans('MemberStatusResiliated'),'statut5'); |
|
| 2041 | 2134 | } |
| 2042 | - if ($statut == 0) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusResiliated").' </span>'.img_picto($langs->trans('MemberStatusResiliated'),'statut5'); |
|
| 2043 | 2135 | } |
| 2044 | 2136 | if ($mode == 6) |
| 2045 | 2137 | { |
| 2046 | - if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'),'statut0'); |
|
| 2138 | + if ($statut == -1) { |
|
| 2139 | + return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'),'statut0'); |
|
| 2140 | + } |
|
| 2047 | 2141 | if ($statut >= 1) |
| 2048 | 2142 | { |
| 2049 | - if (! $date_end_subscription) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActive").' </span>'.img_picto($langs->trans('MemberStatusActive'),'statut1'); |
|
| 2050 | - elseif ($date_end_subscription < time()) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveLate").' </span>'.img_picto($langs->trans('MemberStatusActiveLate'),'statut3'); |
|
| 2051 | - else return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusPaid").' </span>'.img_picto($langs->trans('MemberStatusPaid'),'statut4'); |
|
| 2143 | + if (! $date_end_subscription) { |
|
| 2144 | + return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActive").' </span>'.img_picto($langs->trans('MemberStatusActive'),'statut1'); |
|
| 2145 | + } elseif ($date_end_subscription < time()) { |
|
| 2146 | + return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveLate").' </span>'.img_picto($langs->trans('MemberStatusActiveLate'),'statut3'); |
|
| 2147 | + } else { |
|
| 2148 | + return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusPaid").' </span>'.img_picto($langs->trans('MemberStatusPaid'),'statut4'); |
|
| 2149 | + } |
|
| 2150 | + } |
|
| 2151 | + if ($statut == 0) { |
|
| 2152 | + return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusResiliated").' </span>'.img_picto($langs->trans('MemberStatusResiliated'),'statut5'); |
|
| 2052 | 2153 | } |
| 2053 | - if ($statut == 0) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusResiliated").' </span>'.img_picto($langs->trans('MemberStatusResiliated'),'statut5'); |
|
| 2054 | 2154 | } |
| 2055 | 2155 | } |
| 2056 | 2156 | |
@@ -2080,8 +2180,7 @@ discard block |
||
| 2080 | 2180 | } |
| 2081 | 2181 | $this->db->free($resql); |
| 2082 | 2182 | return 1; |
| 2083 | - } |
|
| 2084 | - else |
|
| 2183 | + } else |
|
| 2085 | 2184 | { |
| 2086 | 2185 | dol_print_error($this->db); |
| 2087 | 2186 | $this->error=$this->db->error(); |
@@ -2100,7 +2199,10 @@ discard block |
||
| 2100 | 2199 | { |
| 2101 | 2200 | global $conf, $langs; |
| 2102 | 2201 | |
| 2103 | - if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe |
|
| 2202 | + if ($user->societe_id) { |
|
| 2203 | + return -1; |
|
| 2204 | + } |
|
| 2205 | + // protection pour eviter appel par utilisateur externe |
|
| 2104 | 2206 | |
| 2105 | 2207 | $now=dol_now(); |
| 2106 | 2208 | |
@@ -2136,8 +2238,7 @@ discard block |
||
| 2136 | 2238 | } |
| 2137 | 2239 | |
| 2138 | 2240 | return $response; |
| 2139 | - } |
|
| 2140 | - else |
|
| 2241 | + } else |
|
| 2141 | 2242 | { |
| 2142 | 2243 | dol_print_error($this->db); |
| 2143 | 2244 | $this->error=$this->db->error(); |
@@ -2244,9 +2345,15 @@ discard block |
||
| 2244 | 2345 | { |
| 2245 | 2346 | global $conf; |
| 2246 | 2347 | $dn=''; |
| 2247 | - if ($mode==0) $dn=$conf->global->LDAP_KEY_MEMBERS."=".$info[$conf->global->LDAP_KEY_MEMBERS].",".$conf->global->LDAP_MEMBER_DN; |
|
| 2248 | - if ($mode==1) $dn=$conf->global->LDAP_MEMBER_DN; |
|
| 2249 | - if ($mode==2) $dn=$conf->global->LDAP_KEY_MEMBERS."=".$info[$conf->global->LDAP_KEY_MEMBERS]; |
|
| 2348 | + if ($mode==0) { |
|
| 2349 | + $dn=$conf->global->LDAP_KEY_MEMBERS."=".$info[$conf->global->LDAP_KEY_MEMBERS].",".$conf->global->LDAP_MEMBER_DN; |
|
| 2350 | + } |
|
| 2351 | + if ($mode==1) { |
|
| 2352 | + $dn=$conf->global->LDAP_MEMBER_DN; |
|
| 2353 | + } |
|
| 2354 | + if ($mode==2) { |
|
| 2355 | + $dn=$conf->global->LDAP_KEY_MEMBERS."=".$info[$conf->global->LDAP_KEY_MEMBERS]; |
|
| 2356 | + } |
|
| 2250 | 2357 | return $dn; |
| 2251 | 2358 | } |
| 2252 | 2359 | |
@@ -2293,36 +2400,80 @@ discard block |
||
| 2293 | 2400 | // Check if it is the LDAP key and if its value has been changed |
| 2294 | 2401 | if (! empty($conf->global->LDAP_KEY_MEMBERS) && $conf->global->LDAP_KEY_MEMBERS == $conf->global->$constname) |
| 2295 | 2402 | { |
| 2296 | - if (! empty($this->oldcopy) && $this->$varname != $this->oldcopy->$varname) $keymodified=true; // For check if LDAP key has been modified |
|
| 2403 | + if (! empty($this->oldcopy) && $this->$varname != $this->oldcopy->$varname) { |
|
| 2404 | + $keymodified=true; |
|
| 2405 | + } |
|
| 2406 | + // For check if LDAP key has been modified |
|
| 2297 | 2407 | } |
| 2298 | 2408 | } |
| 2299 | 2409 | } |
| 2300 | - if ($this->firstname && ! empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname; |
|
| 2301 | - if ($this->poste && ! empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste; |
|
| 2302 | - if ($this->societe && ! empty($conf->global->LDAP_MEMBER_FIELD_COMPANY)) $info[$conf->global->LDAP_MEMBER_FIELD_COMPANY] = $this->societe; |
|
| 2303 | - if ($this->address && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address; |
|
| 2304 | - if ($this->zip && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip; |
|
| 2305 | - if ($this->town && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town; |
|
| 2306 | - if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code; |
|
| 2307 | - if ($this->skype && ! empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype; |
|
| 2308 | - if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone; |
|
| 2309 | - if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso; |
|
| 2310 | - if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile; |
|
| 2311 | - if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax; |
|
| 2312 | - if ($this->note_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private; |
|
| 2313 | - if ($this->note_public && ! empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = $this->note_public; |
|
| 2314 | - if ($this->birth && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth,'dayhourldap'); |
|
| 2315 | - if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut; |
|
| 2316 | - if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap'); |
|
| 2410 | + if ($this->firstname && ! empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) { |
|
| 2411 | + $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname; |
|
| 2412 | + } |
|
| 2413 | + if ($this->poste && ! empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) { |
|
| 2414 | + $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste; |
|
| 2415 | + } |
|
| 2416 | + if ($this->societe && ! empty($conf->global->LDAP_MEMBER_FIELD_COMPANY)) { |
|
| 2417 | + $info[$conf->global->LDAP_MEMBER_FIELD_COMPANY] = $this->societe; |
|
| 2418 | + } |
|
| 2419 | + if ($this->address && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) { |
|
| 2420 | + $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address; |
|
| 2421 | + } |
|
| 2422 | + if ($this->zip && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) { |
|
| 2423 | + $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip; |
|
| 2424 | + } |
|
| 2425 | + if ($this->town && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) { |
|
| 2426 | + $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town; |
|
| 2427 | + } |
|
| 2428 | + if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) { |
|
| 2429 | + $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code; |
|
| 2430 | + } |
|
| 2431 | + if ($this->skype && ! empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) { |
|
| 2432 | + $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype; |
|
| 2433 | + } |
|
| 2434 | + if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) { |
|
| 2435 | + $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone; |
|
| 2436 | + } |
|
| 2437 | + if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) { |
|
| 2438 | + $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso; |
|
| 2439 | + } |
|
| 2440 | + if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) { |
|
| 2441 | + $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile; |
|
| 2442 | + } |
|
| 2443 | + if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) { |
|
| 2444 | + $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax; |
|
| 2445 | + } |
|
| 2446 | + if ($this->note_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) { |
|
| 2447 | + $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private; |
|
| 2448 | + } |
|
| 2449 | + if ($this->note_public && ! empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) { |
|
| 2450 | + $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = $this->note_public; |
|
| 2451 | + } |
|
| 2452 | + if ($this->birth && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) { |
|
| 2453 | + $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth,'dayhourldap'); |
|
| 2454 | + } |
|
| 2455 | + if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) { |
|
| 2456 | + $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut; |
|
| 2457 | + } |
|
| 2458 | + if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) { |
|
| 2459 | + $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap'); |
|
| 2460 | + } |
|
| 2317 | 2461 | |
| 2318 | 2462 | // When password is modified |
| 2319 | 2463 | if (! empty($this->pass)) |
| 2320 | 2464 | { |
| 2321 | - if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte |
|
| 2322 | - if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption) |
|
| 2465 | + if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) { |
|
| 2466 | + $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; |
|
| 2467 | + } |
|
| 2468 | + // this->pass = mot de passe non crypte |
|
| 2469 | + if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) { |
|
| 2470 | + $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); |
|
| 2471 | + } |
|
| 2472 | + // Create OpenLDAP MD5 password (TODO add type of encryption) |
|
| 2323 | 2473 | } |
| 2324 | 2474 | // Set LDAP password if possible |
| 2325 | - else if ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password |
|
| 2475 | + else if ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') { |
|
| 2476 | + // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password |
|
| 2326 | 2477 | { |
| 2327 | 2478 | if (! empty($conf->global->DATABASE_PWD_ENCRYPTED)) |
| 2328 | 2479 | { |
@@ -2333,22 +2484,37 @@ discard block |
||
| 2333 | 2484 | // Create OpenLDAP MD5 password from Dolibarr MD5 password |
| 2334 | 2485 | // Note: This suppose that "pass_indatabase_crypted" is a md5 (guaranted by the previous test if "(empty($conf->global->MAIN_SECURITY_HASH_ALGO))" |
| 2335 | 2486 | $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = '{md5}'.base64_encode(hex2bin($this->pass_indatabase_crypted)); |
| 2487 | + } |
|
| 2336 | 2488 | } |
| 2337 | 2489 | } |
| 2338 | 2490 | } |
| 2339 | 2491 | // Use $this->pass_indatabase value if exists |
| 2340 | 2492 | else if (! empty($this->pass_indatabase)) |
| 2341 | 2493 | { |
| 2342 | - if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte |
|
| 2343 | - if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 4); // md5 for OpenLdap TODO add type of encryption |
|
| 2494 | + if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) { |
|
| 2495 | + $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass_indatabase; |
|
| 2496 | + } |
|
| 2497 | + // $this->pass_indatabase = mot de passe non crypte |
|
| 2498 | + if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) { |
|
| 2499 | + $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 4); |
|
| 2500 | + } |
|
| 2501 | + // md5 for OpenLdap TODO add type of encryption |
|
| 2344 | 2502 | } |
| 2345 | 2503 | } |
| 2346 | 2504 | |
| 2347 | 2505 | // Subscriptions |
| 2348 | - if ($this->first_subscription_date && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE] = dol_print_date($this->first_subscription_date,'dayhourldap'); |
|
| 2349 | - if (isset($this->first_subscription_amount) && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT] = $this->first_subscription_amount; |
|
| 2350 | - if ($this->last_subscription_date && ! empty($conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE)) $info[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE] = dol_print_date($this->last_subscription_date,'dayhourldap'); |
|
| 2351 | - if (isset($this->last_subscription_amount) && ! empty($conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT)) $info[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT] = $this->last_subscription_amount; |
|
| 2506 | + if ($this->first_subscription_date && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE)) { |
|
| 2507 | + $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE] = dol_print_date($this->first_subscription_date,'dayhourldap'); |
|
| 2508 | + } |
|
| 2509 | + if (isset($this->first_subscription_amount) && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT)) { |
|
| 2510 | + $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT] = $this->first_subscription_amount; |
|
| 2511 | + } |
|
| 2512 | + if ($this->last_subscription_date && ! empty($conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE)) { |
|
| 2513 | + $info[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE] = dol_print_date($this->last_subscription_date,'dayhourldap'); |
|
| 2514 | + } |
|
| 2515 | + if (isset($this->last_subscription_amount) && ! empty($conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT)) { |
|
| 2516 | + $info[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT] = $this->last_subscription_amount; |
|
| 2517 | + } |
|
| 2352 | 2518 | |
| 2353 | 2519 | return $info; |
| 2354 | 2520 | } |
@@ -2405,8 +2571,7 @@ discard block |
||
| 2405 | 2571 | |
| 2406 | 2572 | $this->db->free($result); |
| 2407 | 2573 | |
| 2408 | - } |
|
| 2409 | - else |
|
| 2574 | + } else |
|
| 2410 | 2575 | { |
| 2411 | 2576 | dol_print_error($this->db); |
| 2412 | 2577 | } |
@@ -2484,8 +2649,12 @@ discard block |
||
| 2484 | 2649 | global $conf; |
| 2485 | 2650 | |
| 2486 | 2651 | //Only valid members |
| 2487 | - if ($this->statut <= 0) return false; |
|
| 2488 | - if (! $this->datefin) return false; |
|
| 2652 | + if ($this->statut <= 0) { |
|
| 2653 | + return false; |
|
| 2654 | + } |
|
| 2655 | + if (! $this->datefin) { |
|
| 2656 | + return false; |
|
| 2657 | + } |
|
| 2489 | 2658 | |
| 2490 | 2659 | $now = dol_now(); |
| 2491 | 2660 | |
@@ -2549,8 +2718,7 @@ discard block |
||
| 2549 | 2718 | if (empty($adherent->email)) |
| 2550 | 2719 | { |
| 2551 | 2720 | $nbko++; |
| 2552 | - } |
|
| 2553 | - else |
|
| 2721 | + } else |
|
| 2554 | 2722 | { |
| 2555 | 2723 | $adherent->fetch_thirdparty(); |
| 2556 | 2724 | |
@@ -2583,13 +2751,11 @@ discard block |
||
| 2583 | 2751 | $this->error = $cmail->error; |
| 2584 | 2752 | $this->errors += $cmail->errors; |
| 2585 | 2753 | $nbko++; |
| 2586 | - } |
|
| 2587 | - else |
|
| 2754 | + } else |
|
| 2588 | 2755 | { |
| 2589 | 2756 | $nbok++; |
| 2590 | 2757 | } |
| 2591 | - } |
|
| 2592 | - else |
|
| 2758 | + } else |
|
| 2593 | 2759 | { |
| 2594 | 2760 | $blockingerrormsg="Can't find email template '(SendReminderForExpiredSubscriptionTitle)'"; |
| 2595 | 2761 | $nbko++; |
@@ -2599,8 +2765,7 @@ discard block |
||
| 2599 | 2765 | |
| 2600 | 2766 | $i++; |
| 2601 | 2767 | } |
| 2602 | - } |
|
| 2603 | - else |
|
| 2768 | + } else |
|
| 2604 | 2769 | { |
| 2605 | 2770 | $this->error = $this->db->lasterror(); |
| 2606 | 2771 | return 1; |
@@ -2610,12 +2775,13 @@ discard block |
||
| 2610 | 2775 | { |
| 2611 | 2776 | $this->error = $blockingerrormsg; |
| 2612 | 2777 | return 1; |
| 2613 | - } |
|
| 2614 | - else |
|
| 2778 | + } else |
|
| 2615 | 2779 | { |
| 2616 | 2780 | $this->output = 'Found '.($nbok + $nbko).' members to send reminder to.'; |
| 2617 | 2781 | $this->output.= ' Send successfull to '.$nbok.' members'; |
| 2618 | - if ($nbko) $this->output.= ' - Canceled for '.$nbko.' member (no email or email sending error)'; |
|
| 2782 | + if ($nbko) { |
|
| 2783 | + $this->output.= ' - Canceled for '.$nbko.' member (no email or email sending error)'; |
|
| 2784 | + } |
|
| 2619 | 2785 | } |
| 2620 | 2786 | |
| 2621 | 2787 | return 0; |