@@ -36,25 +36,25 @@ discard block |
||
| 36 | 36 | * \file htdocs/user/card.php |
| 37 | 37 | * \brief Tab of user card |
| 38 | 38 | */ |
| 39 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
| 40 | - |
|
| 41 | -require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; |
|
| 42 | -require_once DOL_DOCUMENT_ROOT . '/user/class/usergroup.class.php'; |
|
| 43 | -require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
| 44 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; |
|
| 45 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php'; |
|
| 46 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/usergroups.lib.php'; |
|
| 47 | -require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
| 48 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php'; |
|
| 49 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; |
|
| 39 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
| 40 | + |
|
| 41 | +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; |
|
| 42 | +require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; |
|
| 43 | +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
|
| 44 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
|
| 45 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; |
|
| 46 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; |
|
| 47 | +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
| 48 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; |
|
| 49 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; |
|
| 50 | 50 | if (!empty($conf->ldap->enabled)) { |
| 51 | - require_once DOL_DOCUMENT_ROOT . '/core/class/ldap.class.php'; |
|
| 51 | + require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; |
|
| 52 | 52 | } |
| 53 | 53 | if (!empty($conf->adherent->enabled)) { |
| 54 | - require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
|
| 54 | + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
|
| 55 | 55 | } |
| 56 | 56 | if (!empty($conf->categorie->enabled)) { |
| 57 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 57 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | $id = GETPOST('id', 'int'); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $subaction = GETPOST('subaction', 'alpha'); |
| 65 | 65 | $group = GETPOST("group", "int", 3); |
| 66 | 66 | $cancel = GETPOST('cancel', 'alpha'); |
| 67 | -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'useracard'; // To manage different context of search |
|
| 67 | +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'useracard'; // To manage different context of search |
|
| 68 | 68 | // Define value to know what current user can do on users |
| 69 | 69 | $canadduser = (!empty($user->admin) || $user->rights->user->user->creer); |
| 70 | 70 | $canreaduser = (!empty($user->admin) || $user->rights->user->user->lire); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * Actions |
| 118 | 118 | */ |
| 119 | 119 | $parameters = array('id' => $id, 'socid' => $socid, 'group' => $group, 'caneditgroup' => $caneditgroup); |
| 120 | -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 120 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 121 | 121 | if ($reshook < 0) { |
| 122 | 122 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 123 | 123 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | if ($id <> $user->id) { |
| 129 | 129 | $object->fetch($id); |
| 130 | 130 | $object->setstatus(0); |
| 131 | - header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $id); |
|
| 131 | + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); |
|
| 132 | 132 | exit; |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -141,14 +141,14 @@ discard block |
||
| 141 | 141 | if (!empty($conf->file->main_limit_users)) { |
| 142 | 142 | $nb = $object->getNbOfUsers("active"); |
| 143 | 143 | if ($nb >= $conf->file->main_limit_users) { |
| 144 | - $error ++; |
|
| 144 | + $error++; |
|
| 145 | 145 | setEventMessages($langs->trans("YourQuotaOfUsersIsReached"), null, 'errors'); |
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if (!$error) { |
| 150 | 150 | $object->setstatus(1); |
| 151 | - header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $id); |
|
| 151 | + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); |
|
| 152 | 152 | exit; |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $langs->load("errors"); |
| 164 | 164 | setEventMessages($langs->trans("ErrorUserCannotBeDelete"), null, 'errors'); |
| 165 | 165 | } else { |
| 166 | - header("Location: " . BASE_URI . "?controller=user&method=list&restore_lastsearch_values=1"); |
|
| 166 | + header("Location: ".BASE_URI."?controller=user&method=list&restore_lastsearch_values=1"); |
|
| 167 | 167 | exit; |
| 168 | 168 | } |
| 169 | 169 | } |
@@ -174,22 +174,22 @@ discard block |
||
| 174 | 174 | $error = 0; |
| 175 | 175 | |
| 176 | 176 | if (!$_POST["lastname"]) { |
| 177 | - $error ++; |
|
| 177 | + $error++; |
|
| 178 | 178 | setEventMessages($langs->trans("NameNotDefined"), null, 'errors'); |
| 179 | - $action = "create"; // Go back to create page |
|
| 179 | + $action = "create"; // Go back to create page |
|
| 180 | 180 | } |
| 181 | 181 | if (!$_POST["login"]) { |
| 182 | - $error ++; |
|
| 182 | + $error++; |
|
| 183 | 183 | setEventMessages($langs->trans("LoginNotDefined"), null, 'errors'); |
| 184 | - $action = "create"; // Go back to create page |
|
| 184 | + $action = "create"; // Go back to create page |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | if (!empty($conf->file->main_limit_users)) { // If option to limit users is set |
| 188 | 188 | $nb = $object->getNbOfUsers("active"); |
| 189 | 189 | if ($nb >= $conf->file->main_limit_users) { |
| 190 | - $error ++; |
|
| 190 | + $error++; |
|
| 191 | 191 | setEventMessages($langs->trans("YourQuotaOfUsersIsReached"), null, 'errors'); |
| 192 | - $action = "create"; // Go back to create page |
|
| 192 | + $action = "create"; // Go back to create page |
|
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | // Fill array 'array_options' with data from add form |
| 239 | 239 | $ret = $extrafields->setOptionalsFromPost($extralabels, $object); |
| 240 | 240 | if ($ret < 0) { |
| 241 | - $error ++; |
|
| 241 | + $error++; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | // Set entity property |
@@ -274,13 +274,13 @@ discard block |
||
| 274 | 274 | } |
| 275 | 275 | $db->commit(); |
| 276 | 276 | |
| 277 | - header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $id); |
|
| 277 | + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); |
|
| 278 | 278 | exit; |
| 279 | 279 | } else { |
| 280 | 280 | $langs->load("errors"); |
| 281 | 281 | $db->rollback(); |
| 282 | 282 | setEventMessages($object->error, $object->errors, 'errors'); |
| 283 | - $action = "create"; // Go back to create page |
|
| 283 | + $action = "create"; // Go back to create page |
|
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | } |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | if ($result > 0) { |
| 304 | - header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $id); |
|
| 304 | + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); |
|
| 305 | 305 | exit; |
| 306 | 306 | } else { |
| 307 | 307 | setEventMessages($object->error, $object->errors, 'errors'); |
@@ -310,20 +310,20 @@ discard block |
||
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | if ($action == 'update' && !$cancel) { |
| 313 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
| 313 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
| 314 | 314 | |
| 315 | 315 | if ($caneditfield) { // Case we can edit all field |
| 316 | 316 | $error = 0; |
| 317 | 317 | |
| 318 | 318 | if (!$_POST["lastname"]) { |
| 319 | 319 | setEventMessages($langs->trans("NameNotDefined"), null, 'errors'); |
| 320 | - $action = "edit"; // Go back to create page |
|
| 321 | - $error ++; |
|
| 320 | + $action = "edit"; // Go back to create page |
|
| 321 | + $error++; |
|
| 322 | 322 | } |
| 323 | 323 | if (!$_POST["login"]) { |
| 324 | 324 | setEventMessages($langs->trans("LoginNotDefined"), null, 'errors'); |
| 325 | - $action = "edit"; // Go back to create page |
|
| 326 | - $error ++; |
|
| 325 | + $action = "edit"; // Go back to create page |
|
| 326 | + $error++; |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | if (!$error) { |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | $object->pass = GETPOST("password", 'none'); |
| 343 | 343 | $object->api_key = (GETPOST("api_key", 'alpha')) ? GETPOST("api_key", 'alpha') : $object->api_key; |
| 344 | 344 | if (!empty($user->admin)) { |
| 345 | - $object->admin = GETPOST("admin"); // admin flag can only be set/unset by an admin user. A test is also done later when forging sql request |
|
| 345 | + $object->admin = GETPOST("admin"); // admin flag can only be set/unset by an admin user. A test is also done later when forging sql request |
|
| 346 | 346 | } |
| 347 | 347 | $object->address = GETPOST('address', 'alphanohtml'); |
| 348 | 348 | $object->zip = GETPOST('zipcode', 'alpha'); |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | // Fill array 'array_options' with data from add form |
| 391 | 391 | $ret = $extrafields->setOptionalsFromPost($extralabels, $object); |
| 392 | 392 | if ($ret < 0) { |
| 393 | - $error ++; |
|
| 393 | + $error++; |
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | if (GETPOST('deletephoto')) { |
@@ -420,40 +420,40 @@ discard block |
||
| 420 | 420 | $contact = new Contact($db); |
| 421 | 421 | $contact->fetch($contactid); |
| 422 | 422 | |
| 423 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user"; |
|
| 424 | - $sql .= " SET fk_socpeople=" . $db->escape($contactid); |
|
| 423 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; |
|
| 424 | + $sql .= " SET fk_socpeople=".$db->escape($contactid); |
|
| 425 | 425 | if (!empty($contact->socid)) { |
| 426 | - $sql .= ", fk_soc=" . $db->escape($contact->socid); |
|
| 426 | + $sql .= ", fk_soc=".$db->escape($contact->socid); |
|
| 427 | 427 | } |
| 428 | - $sql .= " WHERE rowid=" . $object->id; |
|
| 428 | + $sql .= " WHERE rowid=".$object->id; |
|
| 429 | 429 | } else { |
| 430 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user"; |
|
| 430 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; |
|
| 431 | 431 | $sql .= " SET fk_socpeople=NULL, fk_soc=NULL"; |
| 432 | - $sql .= " WHERE rowid=" . $object->id; |
|
| 432 | + $sql .= " WHERE rowid=".$object->id; |
|
| 433 | 433 | } |
| 434 | 434 | dol_syslog("usercard::update", LOG_DEBUG); |
| 435 | 435 | $resql = $db->query($sql); |
| 436 | 436 | if (!$resql) { |
| 437 | - $error ++; |
|
| 437 | + $error++; |
|
| 438 | 438 | setEventMessages($db->lasterror(), null, 'errors'); |
| 439 | 439 | } |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | if (!$error && !count($object->errors)) { |
| 443 | 443 | if (GETPOST('deletephoto') && $object->photo) { |
| 444 | - $fileimg = $conf->user->dir_output . '/' . get_exdir(0, 0, 0, 0, $object, 'user') . '/' . $object->id . '/logos/' . $object->photo; |
|
| 445 | - $dirthumbs = $conf->user->dir_output . '/' . get_exdir(0, 0, 0, 0, $object, 'user') . '/' . $object->id . '/logos/thumbs'; |
|
| 444 | + $fileimg = $conf->user->dir_output.'/'.get_exdir(0, 0, 0, 0, $object, 'user').'/'.$object->id.'/logos/'.$object->photo; |
|
| 445 | + $dirthumbs = $conf->user->dir_output.'/'.get_exdir(0, 0, 0, 0, $object, 'user').'/'.$object->id.'/logos/thumbs'; |
|
| 446 | 446 | dol_delete_file($fileimg); |
| 447 | 447 | dol_delete_dir_recursive($dirthumbs); |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | if (isset($_FILES['photo']['tmp_name']) && trim($_FILES['photo']['tmp_name'])) { |
| 451 | - $dir = $conf->user->dir_output . '/' . get_exdir(0, 0, 0, 0, $object, 'user') . '/' . $object->id; |
|
| 451 | + $dir = $conf->user->dir_output.'/'.get_exdir(0, 0, 0, 0, $object, 'user').'/'.$object->id; |
|
| 452 | 452 | |
| 453 | 453 | dol_mkdir($dir); |
| 454 | 454 | |
| 455 | 455 | if (@is_dir($dir)) { |
| 456 | - $newfile = $dir . '/' . dol_sanitizeFileName($_FILES['photo']['name']); |
|
| 456 | + $newfile = $dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); |
|
| 457 | 457 | $result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']); |
| 458 | 458 | |
| 459 | 459 | if (!$result > 0) { |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | $object->addThumbs($newfile); |
| 464 | 464 | } |
| 465 | 465 | } else { |
| 466 | - $error ++; |
|
| 466 | + $error++; |
|
| 467 | 467 | $langs->load("errors"); |
| 468 | 468 | setEventMessages($langs->trans("ErrorFailedToCreateDir", $dir), $mesgs, 'errors'); |
| 469 | 469 | } |
@@ -585,15 +585,15 @@ discard block |
||
| 585 | 585 | |
| 586 | 586 | // Actions to send emails |
| 587 | 587 | $trigger_name = 'USER_SENTBYMAIL'; |
| 588 | - $paramname = 'id'; // Name of param key to open the card |
|
| 588 | + $paramname = 'id'; // Name of param key to open the card |
|
| 589 | 589 | $mode = 'emailfromuser'; |
| 590 | - $trackid = 'use' . $id; |
|
| 591 | - include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php'; |
|
| 590 | + $trackid = 'use'.$id; |
|
| 591 | + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; |
|
| 592 | 592 | |
| 593 | 593 | // Actions to build doc |
| 594 | 594 | $upload_dir = $conf->user->dir_output; |
| 595 | 595 | $permissioncreate = $user->rights->user->user->creer; |
| 596 | - include DOL_DOCUMENT_ROOT . '/core/actions_builddoc.inc.php'; |
|
| 596 | + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; |
|
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | |
| 618 | 618 | print load_fiche_titre($langs->trans("NewUser")); |
| 619 | 619 | |
| 620 | - print $langs->trans("CreateInternalUserDesc") . "<br>\n"; |
|
| 620 | + print $langs->trans("CreateInternalUserDesc")."<br>\n"; |
|
| 621 | 621 | print "<br>"; |
| 622 | 622 | |
| 623 | 623 | |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | $label = ''; |
| 663 | 663 | foreach ($required_fields as $value) { |
| 664 | 664 | if ($value) { |
| 665 | - $label .= $value . "=" . $ldapuser[$value] . " "; |
|
| 665 | + $label .= $value."=".$ldapuser[$value]." "; |
|
| 666 | 666 | } |
| 667 | 667 | } |
| 668 | 668 | $liste[$key] = $label; |
@@ -678,8 +678,8 @@ discard block |
||
| 678 | 678 | print "\n\n<!-- Form liste LDAP debut -->\n"; |
| 679 | 679 | |
| 680 | 680 | // print '<form name="add_user_ldap" action="' . $_SERVER["PHP_SELF"] . '" method="post">'; |
| 681 | - print '<form name="add_user_ldap" href="' . BASE_URI . '?controller=user&method=card" method="post">'; |
|
| 682 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
| 681 | + print '<form name="add_user_ldap" href="'.BASE_URI.'?controller=user&method=card" method="post">'; |
|
| 682 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 683 | 683 | print '<table width="100%" class="border"><tr>'; |
| 684 | 684 | print '<td width="160">'; |
| 685 | 685 | print $langs->trans("LDAPUsers"); |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | print ajax_combobox('users'); |
| 692 | 692 | } |
| 693 | 693 | print '</td><td align="center">'; |
| 694 | - print '<input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Get')) . '"' . (count($liste) ? '' : ' disabled') . '>'; |
|
| 694 | + print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans('Get')).'"'.(count($liste) ? '' : ' disabled').'>'; |
|
| 695 | 695 | print '</td></tr></table>'; |
| 696 | 696 | print '</form>'; |
| 697 | 697 | |
@@ -701,13 +701,13 @@ discard block |
||
| 701 | 701 | |
| 702 | 702 | |
| 703 | 703 | // print '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST" name="createuser">'; |
| 704 | - print '<form href="' . BASE_URI . '?controller=user&method=card" method="POST" name="createuser">'; |
|
| 705 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
| 704 | + print '<form href="'.BASE_URI.'?controller=user&method=card" method="POST" name="createuser">'; |
|
| 705 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 706 | 706 | print '<input type="hidden" name="action" value="add">'; |
| 707 | 707 | if (!empty($ldap_sid)) { |
| 708 | - print '<input type="hidden" name="ldap_sid" value="' . dol_escape_htmltag($ldap_sid) . '">'; |
|
| 708 | + print '<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).'">'; |
|
| 709 | 709 | } |
| 710 | - print '<input type="hidden" name="entity" value="' . $conf->entity . '">'; |
|
| 710 | + print '<input type="hidden" name="entity" value="'.$conf->entity.'">'; |
|
| 711 | 711 | |
| 712 | 712 | dol_fiche_head('', '', '', 0, ''); |
| 713 | 713 | |
@@ -717,75 +717,75 @@ discard block |
||
| 717 | 717 | |
| 718 | 718 | // Lastname |
| 719 | 719 | print '<tr>'; |
| 720 | - print '<td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("Lastname") . '</span></td>'; |
|
| 720 | + print '<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("Lastname").'</span></td>'; |
|
| 721 | 721 | print '<td>'; |
| 722 | 722 | if (!empty($ldap_lastname)) { |
| 723 | - print '<input type="hidden" id="lastname" name="lastname" value="' . $ldap_lastname . '">'; |
|
| 723 | + print '<input type="hidden" id="lastname" name="lastname" value="'.$ldap_lastname.'">'; |
|
| 724 | 724 | print $ldap_lastname; |
| 725 | 725 | } else { |
| 726 | - print '<input class="minwidth100" type="text" id="lastname" name="lastname" value="' . GETPOST('lastname') . '">'; |
|
| 726 | + print '<input class="minwidth100" type="text" id="lastname" name="lastname" value="'.GETPOST('lastname').'">'; |
|
| 727 | 727 | } |
| 728 | 728 | print '</td></tr>'; |
| 729 | 729 | |
| 730 | 730 | // Firstname |
| 731 | - print '<tr><td>' . $langs->trans("Firstname") . '</td>'; |
|
| 731 | + print '<tr><td>'.$langs->trans("Firstname").'</td>'; |
|
| 732 | 732 | print '<td>'; |
| 733 | 733 | if (!empty($ldap_firstname)) { |
| 734 | - print '<input type="hidden" name="firstname" value="' . $ldap_firstname . '">'; |
|
| 734 | + print '<input type="hidden" name="firstname" value="'.$ldap_firstname.'">'; |
|
| 735 | 735 | print $ldap_firstname; |
| 736 | 736 | } else { |
| 737 | - print '<input class="minwidth100" type="text" name="firstname" value="' . GETPOST('firstname') . '">'; |
|
| 737 | + print '<input class="minwidth100" type="text" name="firstname" value="'.GETPOST('firstname').'">'; |
|
| 738 | 738 | } |
| 739 | 739 | print '</td></tr>'; |
| 740 | 740 | |
| 741 | 741 | // Login |
| 742 | - print '<tr><td><span class="fieldrequired">' . $langs->trans("Login") . '</span></td>'; |
|
| 742 | + print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").'</span></td>'; |
|
| 743 | 743 | print '<td>'; |
| 744 | 744 | if (!empty($ldap_login)) { |
| 745 | - print '<input type="hidden" name="login" value="' . $ldap_login . '">'; |
|
| 745 | + print '<input type="hidden" name="login" value="'.$ldap_login.'">'; |
|
| 746 | 746 | print $ldap_login; |
| 747 | 747 | } elseif (!empty($ldap_loginsmb)) { |
| 748 | - print '<input type="hidden" name="login" value="' . $ldap_loginsmb . '">'; |
|
| 748 | + print '<input type="hidden" name="login" value="'.$ldap_loginsmb.'">'; |
|
| 749 | 749 | print $ldap_loginsmb; |
| 750 | 750 | } else { |
| 751 | - print '<input class="maxwidth200" maxsize="24" type="text" name="login" value="' . dol_escape_htmltag(GETPOST('login', 'alpha')) . '">'; |
|
| 751 | + print '<input class="maxwidth200" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(GETPOST('login', 'alpha')).'">'; |
|
| 752 | 752 | } |
| 753 | 753 | print '</td></tr>'; |
| 754 | 754 | |
| 755 | 755 | $generated_password = ''; |
| 756 | 756 | if (empty($ldap_sid)) { // ldap_sid is for activedirectory |
| 757 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php'; |
|
| 757 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; |
|
| 758 | 758 | $generated_password = getRandomPassword(false); |
| 759 | 759 | } |
| 760 | 760 | $password = $generated_password; |
| 761 | 761 | |
| 762 | 762 | // Password |
| 763 | - print '<tr><td class="fieldrequired">' . $langs->trans("Password") . '</td>'; |
|
| 763 | + print '<tr><td class="fieldrequired">'.$langs->trans("Password").'</td>'; |
|
| 764 | 764 | print '<td>'; |
| 765 | 765 | $valuetoshow = ''; |
| 766 | 766 | if (preg_match('/ldap/', $dolibarr_main_authentication)) { |
| 767 | - $valuetoshow .= ($valuetoshow ? ', ' : '') . $langs->trans("PasswordOfUserInLDAP"); |
|
| 767 | + $valuetoshow .= ($valuetoshow ? ', ' : '').$langs->trans("PasswordOfUserInLDAP"); |
|
| 768 | 768 | } |
| 769 | 769 | if (preg_match('/http/', $dolibarr_main_authentication)) { |
| 770 | - $valuetoshow .= ($valuetoshow ? ', ' : '') . $langs->trans("HTTPBasicPassword"); |
|
| 770 | + $valuetoshow .= ($valuetoshow ? ', ' : '').$langs->trans("HTTPBasicPassword"); |
|
| 771 | 771 | } |
| 772 | 772 | if (preg_match('/dolibarr/', $dolibarr_main_authentication)) { |
| 773 | 773 | if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read |
| 774 | - $valuetoshow .= ($valuetoshow ? ', ' : '') . '<input type="hidden" name="password" value="' . $ldap_pass . '">'; // Dolibarr password is preffiled with LDAP known password |
|
| 774 | + $valuetoshow .= ($valuetoshow ? ', ' : '').'<input type="hidden" name="password" value="'.$ldap_pass.'">'; // Dolibarr password is preffiled with LDAP known password |
|
| 775 | 775 | $valuetoshow .= preg_replace('/./i', '*', $ldap_pass); |
| 776 | 776 | } else { |
| 777 | 777 | // We do not use a field password but a field text to show new password to use. |
| 778 | - $valuetoshow .= ($valuetoshow ? ', ' : '') . '<input size="30" maxsize="32" type="text" name="password" value="' . $password . '" autocomplete="new-password">'; |
|
| 778 | + $valuetoshow .= ($valuetoshow ? ', ' : '').'<input size="30" maxsize="32" type="text" name="password" value="'.$password.'" autocomplete="new-password">'; |
|
| 779 | 779 | } |
| 780 | 780 | } |
| 781 | 781 | |
| 782 | 782 | // Other form for user password |
| 783 | 783 | $parameters = array('valuetoshow' => $valuetoshow, 'password' => $password); |
| 784 | - $reshook = $hookmanager->executeHooks('printUserPasswordField', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 784 | + $reshook = $hookmanager->executeHooks('printUserPasswordField', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 785 | 785 | if ($reshook > 0) { |
| 786 | 786 | $valuetoshow = $hookmanager->resPrint; // to replace |
| 787 | 787 | } else { |
| 788 | - $valuetoshow .= $hookmanager->resPrint; // to add |
|
| 788 | + $valuetoshow .= $hookmanager->resPrint; // to add |
|
| 789 | 789 | } |
| 790 | 790 | print $valuetoshow; |
| 791 | 791 | print '</td></tr>'; |
@@ -793,25 +793,25 @@ discard block |
||
| 793 | 793 | if (!empty($conf->api->enabled)) { |
| 794 | 794 | // API key |
| 795 | 795 | $generated_api_key = ''; |
| 796 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php'; |
|
| 796 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; |
|
| 797 | 797 | $generated_password = getRandomPassword(false); |
| 798 | - print '<tr><td>' . $langs->trans("ApiKey") . '</td>'; |
|
| 798 | + print '<tr><td>'.$langs->trans("ApiKey").'</td>'; |
|
| 799 | 799 | print '<td>'; |
| 800 | - print '<input size="30" maxsize="32" type="text" id="api_key" name="api_key" value="' . $api_key . '" autocomplete="off">'; |
|
| 800 | + print '<input size="30" maxsize="32" type="text" id="api_key" name="api_key" value="'.$api_key.'" autocomplete="off">'; |
|
| 801 | 801 | if (!empty($conf->use_javascript_ajax)) { |
| 802 | - print ' ' . img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject"'); |
|
| 802 | + print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject"'); |
|
| 803 | 803 | } |
| 804 | 804 | print '</td></tr>'; |
| 805 | 805 | } else { |
| 806 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php'; |
|
| 806 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; |
|
| 807 | 807 | // PARTIAL WORKAROUND |
| 808 | 808 | $generated_fake_api_key = getRandomPassword(false); |
| 809 | - print '<input type="hidden" name="api_key" value="' . $generated_fake_api_key . '">'; |
|
| 809 | + print '<input type="hidden" name="api_key" value="'.$generated_fake_api_key.'">'; |
|
| 810 | 810 | } |
| 811 | 811 | |
| 812 | 812 | // Administrator |
| 813 | 813 | if (!empty($user->admin)) { |
| 814 | - print '<tr><td>' . $langs->trans("Administrator") . '</td>'; |
|
| 814 | + print '<tr><td>'.$langs->trans("Administrator").'</td>'; |
|
| 815 | 815 | print '<td>'; |
| 816 | 816 | print $form->selectyesno('admin', GETPOST('admin'), 1); |
| 817 | 817 | |
@@ -845,19 +845,19 @@ discard block |
||
| 845 | 845 | } |
| 846 | 846 | $checked = (GETPOST('superadmin', 'int') ? ' checked' : ''); |
| 847 | 847 | $disabled = (GETPOST('superadmin', 'int') ? '' : ' disabled'); |
| 848 | - print '<input type="checkbox" name="superadmin" value="1"' . $checked . $disabled . ' /> ' . $langs->trans("SuperAdministrator"); |
|
| 848 | + print '<input type="checkbox" name="superadmin" value="1"'.$checked.$disabled.' /> '.$langs->trans("SuperAdministrator"); |
|
| 849 | 849 | } |
| 850 | 850 | print "</td></tr>\n"; |
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | // Type |
| 854 | - print '<tr><td>' . $langs->trans("Type") . '</td>'; |
|
| 854 | + print '<tr><td>'.$langs->trans("Type").'</td>'; |
|
| 855 | 855 | print '<td>'; |
| 856 | 856 | print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help', '', 0, 2); |
| 857 | 857 | print '</td></tr>'; |
| 858 | 858 | |
| 859 | 859 | // Gender |
| 860 | - print '<tr><td>' . $langs->trans("Gender") . '</td>'; |
|
| 860 | + print '<tr><td>'.$langs->trans("Gender").'</td>'; |
|
| 861 | 861 | print '<td>'; |
| 862 | 862 | $arraygender = array('man' => $langs->trans("Genderman"), 'woman' => $langs->trans("Genderwoman")); |
| 863 | 863 | print $form->selectarray('gender', $arraygender, GETPOST('gender'), 1); |
@@ -866,12 +866,12 @@ discard block |
||
| 866 | 866 | // Employee |
| 867 | 867 | $defaultemployee = 1; |
| 868 | 868 | print '<tr>'; |
| 869 | - print '<td>' . $langs->trans('Employee') . '</td><td>'; |
|
| 869 | + print '<td>'.$langs->trans('Employee').'</td><td>'; |
|
| 870 | 870 | print $form->selectyesno("employee", (GETPOST('employee') != '' ? GETPOST('employee') : $defaultemployee), 1); |
| 871 | 871 | print '</td></tr>'; |
| 872 | 872 | |
| 873 | 873 | // Hierarchy |
| 874 | - print '<tr><td class="titlefieldcreate">' . $langs->trans("HierarchicalResponsible") . '</td>'; |
|
| 874 | + print '<tr><td class="titlefieldcreate">'.$langs->trans("HierarchicalResponsible").'</td>'; |
|
| 875 | 875 | print '<td>'; |
| 876 | 876 | print $form->select_dolusers($object->fk_user, 'fk_user', 1, array($object->id), 0, '', 0, $conf->entity, 0, 0, '', 0, '', 'maxwidth300'); |
| 877 | 877 | print '</td>'; |
@@ -882,23 +882,23 @@ discard block |
||
| 882 | 882 | |
| 883 | 883 | |
| 884 | 884 | // Address |
| 885 | - print '<tr><td class="tdtop titlefieldcreate">' . $form->editfieldkey('Address', 'address', '', $object, 0) . '</td>'; |
|
| 885 | + print '<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey('Address', 'address', '', $object, 0).'</td>'; |
|
| 886 | 886 | print '<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">'; |
| 887 | 887 | print $object->address; |
| 888 | 888 | print '</textarea></td></tr>'; |
| 889 | 889 | |
| 890 | 890 | // Zip |
| 891 | - print '<tr><td>' . $form->editfieldkey('Zip', 'zipcode', '', $object, 0) . '</td><td>'; |
|
| 891 | + print '<tr><td>'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).'</td><td>'; |
|
| 892 | 892 | print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); |
| 893 | 893 | print '</td></tr>'; |
| 894 | 894 | |
| 895 | 895 | // Town |
| 896 | - print '<tr><td>' . $form->editfieldkey('Town', 'town', '', $object, 0) . '</td><td>'; |
|
| 896 | + print '<tr><td>'.$form->editfieldkey('Town', 'town', '', $object, 0).'</td><td>'; |
|
| 897 | 897 | print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id')); |
| 898 | 898 | print '</td></tr>'; |
| 899 | 899 | |
| 900 | 900 | // Country |
| 901 | - print '<tr><td>' . $form->editfieldkey('Country', 'selectcountry_id', '', $object, 0) . '</td><td class="maxwidthonsmartphone">'; |
|
| 901 | + print '<tr><td>'.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).'</td><td class="maxwidthonsmartphone">'; |
|
| 902 | 902 | print $form->select_country((GETPOST('country_id') != '' ? GETPOST('country_id') : $object->country_id)); |
| 903 | 903 | if ($user->admin) { |
| 904 | 904 | print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
@@ -907,105 +907,105 @@ discard block |
||
| 907 | 907 | |
| 908 | 908 | // State |
| 909 | 909 | if (empty($conf->global->USER_DISABLE_STATE)) { |
| 910 | - print '<tr><td>' . $form->editfieldkey('State', 'state_id', '', $object, 0) . '</td><td class="maxwidthonsmartphone">'; |
|
| 910 | + print '<tr><td>'.$form->editfieldkey('State', 'state_id', '', $object, 0).'</td><td class="maxwidthonsmartphone">'; |
|
| 911 | 911 | print $formcompany->select_state($object->state_id, $object->country_code, 'state_id'); |
| 912 | 912 | print '</td></tr>'; |
| 913 | 913 | } |
| 914 | 914 | |
| 915 | 915 | // Tel |
| 916 | - print '<tr><td>' . $langs->trans("PhonePro") . '</td>'; |
|
| 916 | + print '<tr><td>'.$langs->trans("PhonePro").'</td>'; |
|
| 917 | 917 | print '<td>'; |
| 918 | 918 | if (!empty($ldap_phone)) { |
| 919 | - print '<input type="hidden" name="office_phone" value="' . $ldap_phone . '">'; |
|
| 919 | + print '<input type="hidden" name="office_phone" value="'.$ldap_phone.'">'; |
|
| 920 | 920 | print $ldap_phone; |
| 921 | 921 | } else { |
| 922 | - print '<input size="20" type="text" name="office_phone" value="' . GETPOST('office_phone') . '">'; |
|
| 922 | + print '<input size="20" type="text" name="office_phone" value="'.GETPOST('office_phone').'">'; |
|
| 923 | 923 | } |
| 924 | 924 | print '</td></tr>'; |
| 925 | 925 | |
| 926 | 926 | // Tel portable |
| 927 | - print '<tr><td>' . $langs->trans("PhoneMobile") . '</td>'; |
|
| 927 | + print '<tr><td>'.$langs->trans("PhoneMobile").'</td>'; |
|
| 928 | 928 | print '<td>'; |
| 929 | 929 | if (!empty($ldap_mobile)) { |
| 930 | - print '<input type="hidden" name="user_mobile" value="' . $ldap_mobile . '">'; |
|
| 930 | + print '<input type="hidden" name="user_mobile" value="'.$ldap_mobile.'">'; |
|
| 931 | 931 | print $ldap_mobile; |
| 932 | 932 | } else { |
| 933 | - print '<input size="20" type="text" name="user_mobile" value="' . GETPOST('user_mobile') . '">'; |
|
| 933 | + print '<input size="20" type="text" name="user_mobile" value="'.GETPOST('user_mobile').'">'; |
|
| 934 | 934 | } |
| 935 | 935 | print '</td></tr>'; |
| 936 | 936 | |
| 937 | 937 | // Fax |
| 938 | - print '<tr><td>' . $langs->trans("Fax") . '</td>'; |
|
| 938 | + print '<tr><td>'.$langs->trans("Fax").'</td>'; |
|
| 939 | 939 | print '<td>'; |
| 940 | 940 | if (!empty($ldap_fax)) { |
| 941 | - print '<input type="hidden" name="office_fax" value="' . $ldap_fax . '">'; |
|
| 941 | + print '<input type="hidden" name="office_fax" value="'.$ldap_fax.'">'; |
|
| 942 | 942 | print $ldap_fax; |
| 943 | 943 | } else { |
| 944 | - print '<input size="20" type="text" name="office_fax" value="' . GETPOST('office_fax') . '">'; |
|
| 944 | + print '<input size="20" type="text" name="office_fax" value="'.GETPOST('office_fax').'">'; |
|
| 945 | 945 | } |
| 946 | 946 | print '</td></tr>'; |
| 947 | 947 | |
| 948 | 948 | // Skype |
| 949 | 949 | if (!empty($conf->socialnetworks->enabled)) { |
| 950 | - print '<tr><td>' . $langs->trans("Skype") . '</td>'; |
|
| 950 | + print '<tr><td>'.$langs->trans("Skype").'</td>'; |
|
| 951 | 951 | print '<td>'; |
| 952 | 952 | if (!empty($ldap_skype)) { |
| 953 | - print '<input type="hidden" name="skype" value="' . $ldap_skype . '">'; |
|
| 953 | + print '<input type="hidden" name="skype" value="'.$ldap_skype.'">'; |
|
| 954 | 954 | print $ldap_skype; |
| 955 | 955 | } else { |
| 956 | - print '<input class="maxwidth200" type="text" name="skype" value="' . GETPOST('skype', 'alpha') . '">'; |
|
| 956 | + print '<input class="maxwidth200" type="text" name="skype" value="'.GETPOST('skype', 'alpha').'">'; |
|
| 957 | 957 | } |
| 958 | 958 | print '</td></tr>'; |
| 959 | 959 | } |
| 960 | 960 | |
| 961 | 961 | |
| 962 | 962 | if (!empty($conf->socialnetworks->enabled)) { |
| 963 | - print '<tr><td>' . $langs->trans("Twitter") . '</td>'; |
|
| 963 | + print '<tr><td>'.$langs->trans("Twitter").'</td>'; |
|
| 964 | 964 | print '<td>'; |
| 965 | 965 | if (!empty($ldap_twitter)) { |
| 966 | - print '<input type="hidden" name="twitter" value="' . $ldap_twitter . '">'; |
|
| 966 | + print '<input type="hidden" name="twitter" value="'.$ldap_twitter.'">'; |
|
| 967 | 967 | print $ldap_twitter; |
| 968 | 968 | } else { |
| 969 | - print '<input class="maxwidth200" type="text" name="twitter" value="' . GETPOST('twitter', 'alpha') . '">'; |
|
| 969 | + print '<input class="maxwidth200" type="text" name="twitter" value="'.GETPOST('twitter', 'alpha').'">'; |
|
| 970 | 970 | } |
| 971 | 971 | print '</td></tr>'; |
| 972 | 972 | } |
| 973 | 973 | |
| 974 | 974 | |
| 975 | 975 | if (!empty($conf->socialnetworks->enabled)) { |
| 976 | - print '<tr><td>' . $langs->trans("Facebook") . '</td>'; |
|
| 976 | + print '<tr><td>'.$langs->trans("Facebook").'</td>'; |
|
| 977 | 977 | print '<td>'; |
| 978 | 978 | if (!empty($ldap_facebook)) { |
| 979 | - print '<input type="hidden" name="facebook" value="' . $ldap_facebook . '">'; |
|
| 979 | + print '<input type="hidden" name="facebook" value="'.$ldap_facebook.'">'; |
|
| 980 | 980 | print $ldap_facebook; |
| 981 | 981 | } else { |
| 982 | - print '<input class="maxwidth200" type="text" name="facebook" value="' . GETPOST('facebook', 'alpha') . '">'; |
|
| 982 | + print '<input class="maxwidth200" type="text" name="facebook" value="'.GETPOST('facebook', 'alpha').'">'; |
|
| 983 | 983 | } |
| 984 | 984 | print '</td></tr>'; |
| 985 | 985 | } |
| 986 | 986 | |
| 987 | 987 | |
| 988 | - print '<tr><td' . (!empty($conf->global->USER_MAIL_REQUIRED) ? ' class="fieldrequired"' : '') . '>' . $langs->trans("EMail") . '</td>'; |
|
| 988 | + print '<tr><td'.(!empty($conf->global->USER_MAIL_REQUIRED) ? ' class="fieldrequired"' : '').'>'.$langs->trans("EMail").'</td>'; |
|
| 989 | 989 | print '<td>'; |
| 990 | 990 | if (!empty($ldap_mail)) { |
| 991 | - print '<input type="hidden" name="email" value="' . $ldap_mail . '">'; |
|
| 991 | + print '<input type="hidden" name="email" value="'.$ldap_mail.'">'; |
|
| 992 | 992 | print $ldap_mail; |
| 993 | 993 | } else { |
| 994 | - print '<input size="40" type="text" name="email" value="' . GETPOST('email') . '">'; |
|
| 994 | + print '<input size="40" type="text" name="email" value="'.GETPOST('email').'">'; |
|
| 995 | 995 | } |
| 996 | 996 | print '</td></tr>'; |
| 997 | 997 | |
| 998 | 998 | // Accountancy code |
| 999 | 999 | if ($conf->accounting->enabled) { |
| 1000 | - print '<tr><td>' . $langs->trans("AccountancyCode") . '</td>'; |
|
| 1000 | + print '<tr><td>'.$langs->trans("AccountancyCode").'</td>'; |
|
| 1001 | 1001 | print '<td>'; |
| 1002 | - print '<input size="30" type="text" name="accountancy_code" value="' . GETPOST('accountancy_code') . '">'; |
|
| 1002 | + print '<input size="30" type="text" name="accountancy_code" value="'.GETPOST('accountancy_code').'">'; |
|
| 1003 | 1003 | print '</td></tr>'; |
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | 1006 | // User color |
| 1007 | 1007 | if (!empty($conf->agenda->enabled)) { |
| 1008 | - print '<tr><td>' . $langs->trans("ColorUser") . '</td>'; |
|
| 1008 | + print '<tr><td>'.$langs->trans("ColorUser").'</td>'; |
|
| 1009 | 1009 | print '<td>'; |
| 1010 | 1010 | print $formother->selectColor(GETPOST('color') ? GETPOST('color') : $object->color, 'color', null, 1, '', 'hideifnotset'); |
| 1011 | 1011 | print '</td></tr>'; |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | |
| 1014 | 1014 | // Categories |
| 1015 | 1015 | if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { |
| 1016 | - print '<tr><td>' . $form->editfieldkey('Categories', 'usercats', '', $object, 0) . '</td><td colspan="3">'; |
|
| 1016 | + print '<tr><td>'.$form->editfieldkey('Categories', 'usercats', '', $object, 0).'</td><td colspan="3">'; |
|
| 1017 | 1017 | $cate_arbo = $form->select_all_categories('user', null, 'parent', null, null, 1); |
| 1018 | 1018 | print $form->multiselectarray('usercats', $cate_arbo, GETPOST('usercats', 'array'), null, null, null, null, '90%'); |
| 1019 | 1019 | print "</td></tr>"; |
@@ -1024,18 +1024,18 @@ discard block |
||
| 1024 | 1024 | // This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module |
| 1025 | 1025 | if (!method_exists($mc, 'formObjectOptions')) { |
| 1026 | 1026 | if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) { // condition must be same for create and edit mode |
| 1027 | - print "<tr>" . '<td>' . $langs->trans("Entity") . '</td>'; |
|
| 1028 | - print "<td>" . $mc->select_entities($conf->entity); |
|
| 1027 | + print "<tr>".'<td>'.$langs->trans("Entity").'</td>'; |
|
| 1028 | + print "<td>".$mc->select_entities($conf->entity); |
|
| 1029 | 1029 | print "</td></tr>\n"; |
| 1030 | 1030 | } else { |
| 1031 | - print '<input type="hidden" name="entity" value="' . $conf->entity . '" />'; |
|
| 1031 | + print '<input type="hidden" name="entity" value="'.$conf->entity.'" />'; |
|
| 1032 | 1032 | } |
| 1033 | 1033 | } |
| 1034 | 1034 | } |
| 1035 | 1035 | |
| 1036 | 1036 | // Other attributes |
| 1037 | 1037 | $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"'); |
| 1038 | - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 1038 | + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 1039 | 1039 | print $hookmanager->resPrint; |
| 1040 | 1040 | if (empty($reshook)) { |
| 1041 | 1041 | print $object->showOptionals($extrafields, 'edit'); |
@@ -1045,15 +1045,15 @@ discard block |
||
| 1045 | 1045 | print '<tr><td class="tdtop">'; |
| 1046 | 1046 | print $langs->trans("Note"); |
| 1047 | 1047 | print '</td><td>'; |
| 1048 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
| 1048 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
| 1049 | 1049 | $doleditor = new DolEditor('note', '', '', 120, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_3, '90%'); |
| 1050 | 1050 | $doleditor->Create(); |
| 1051 | 1051 | print "</td></tr>\n"; |
| 1052 | 1052 | |
| 1053 | 1053 | // Signature |
| 1054 | - print '<tr><td class="tdtop">' . $langs->trans("Signature") . '</td>'; |
|
| 1054 | + print '<tr><td class="tdtop">'.$langs->trans("Signature").'</td>'; |
|
| 1055 | 1055 | print '<td>'; |
| 1056 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
| 1056 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
| 1057 | 1057 | $doleditor = new DolEditor('signature', GETPOST('signature'), '', 138, 'dolibarr_notes', 'In', true, true, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4, '90%'); |
| 1058 | 1058 | print $doleditor->Create(1); |
| 1059 | 1059 | print '</td></tr>'; |
@@ -1064,9 +1064,9 @@ discard block |
||
| 1064 | 1064 | |
| 1065 | 1065 | // TODO Move this into tab RH (HierarchicalResponsible must be on both tab) |
| 1066 | 1066 | // Position/Job |
| 1067 | - print '<tr><td class="titlefieldcreate">' . $langs->trans("PostOrFunction") . '</td>'; |
|
| 1067 | + print '<tr><td class="titlefieldcreate">'.$langs->trans("PostOrFunction").'</td>'; |
|
| 1068 | 1068 | print '<td>'; |
| 1069 | - print '<input class="maxwidth200" type="text" name="job" value="' . GETPOST('job') . '">'; |
|
| 1069 | + print '<input class="maxwidth200" type="text" name="job" value="'.GETPOST('job').'">'; |
|
| 1070 | 1070 | print '</td></tr>'; |
| 1071 | 1071 | |
| 1072 | 1072 | |
@@ -1079,7 +1079,7 @@ discard block |
||
| 1079 | 1079 | print $form->textwithpicto($text, $langs->trans("THMDescription"), 1, 'help', 'classthm'); |
| 1080 | 1080 | print '</td>'; |
| 1081 | 1081 | print '<td>'; |
| 1082 | - print '<input size="8" type="text" name="thm" value="' . GETPOST('thm') . '">'; |
|
| 1082 | + print '<input size="8" type="text" name="thm" value="'.GETPOST('thm').'">'; |
|
| 1083 | 1083 | print '</td>'; |
| 1084 | 1084 | print "</tr>\n"; |
| 1085 | 1085 | |
@@ -1089,41 +1089,41 @@ discard block |
||
| 1089 | 1089 | print $form->textwithpicto($text, $langs->trans("TJMDescription"), 1, 'help', 'classtjm'); |
| 1090 | 1090 | print '</td>'; |
| 1091 | 1091 | print '<td>'; |
| 1092 | - print '<input size="8" type="text" name="tjm" value="' . GETPOST('tjm') . '">'; |
|
| 1092 | + print '<input size="8" type="text" name="tjm" value="'.GETPOST('tjm').'">'; |
|
| 1093 | 1093 | print '</td>'; |
| 1094 | 1094 | print "</tr>\n"; |
| 1095 | 1095 | |
| 1096 | 1096 | // Salary |
| 1097 | - print '<tr><td>' . $langs->trans("Salary") . '</td>'; |
|
| 1097 | + print '<tr><td>'.$langs->trans("Salary").'</td>'; |
|
| 1098 | 1098 | print '<td>'; |
| 1099 | - print '<input size="8" type="text" name="salary" value="' . GETPOST('salary') . '">'; |
|
| 1099 | + print '<input size="8" type="text" name="salary" value="'.GETPOST('salary').'">'; |
|
| 1100 | 1100 | print '</td>'; |
| 1101 | 1101 | print "</tr>\n"; |
| 1102 | 1102 | } |
| 1103 | 1103 | |
| 1104 | 1104 | // Weeklyhours |
| 1105 | - print '<tr><td>' . $langs->trans("WeeklyHours") . '</td>'; |
|
| 1105 | + print '<tr><td>'.$langs->trans("WeeklyHours").'</td>'; |
|
| 1106 | 1106 | print '<td>'; |
| 1107 | - print '<input size="8" type="text" name="weeklyhours" value="' . GETPOST('weeklyhours') . '">'; |
|
| 1107 | + print '<input size="8" type="text" name="weeklyhours" value="'.GETPOST('weeklyhours').'">'; |
|
| 1108 | 1108 | print '</td>'; |
| 1109 | 1109 | print "</tr>\n"; |
| 1110 | 1110 | |
| 1111 | 1111 | // Date employment |
| 1112 | - print '<tr><td>' . $langs->trans("DateEmployment") . '</td>'; |
|
| 1112 | + print '<tr><td>'.$langs->trans("DateEmployment").'</td>'; |
|
| 1113 | 1113 | print '<td>'; |
| 1114 | 1114 | print $form->selectDate(GETPOST('dateemployment'), 'dateemployment', 0, 0, 1, 'formdateemployment', 1, 0); |
| 1115 | 1115 | print '</td>'; |
| 1116 | 1116 | print "</tr>\n"; |
| 1117 | 1117 | |
| 1118 | 1118 | // Date employment END |
| 1119 | - print '<tr><td>' . $langs->trans("DateEmploymentEnd") . '</td>'; |
|
| 1119 | + print '<tr><td>'.$langs->trans("DateEmploymentEnd").'</td>'; |
|
| 1120 | 1120 | print '<td>'; |
| 1121 | 1121 | print $form->selectDate(GETPOST('dateemploymentend'), 'dateemploymentend', 0, 0, 1, 'formdateemploymentend', 1, 0); |
| 1122 | 1122 | print '</td>'; |
| 1123 | 1123 | print "</tr>\n"; |
| 1124 | 1124 | |
| 1125 | 1125 | // Date birth |
| 1126 | - print '<tr><td>' . $langs->trans("DateToBirth") . '</td>'; |
|
| 1126 | + print '<tr><td>'.$langs->trans("DateToBirth").'</td>'; |
|
| 1127 | 1127 | print '<td>'; |
| 1128 | 1128 | print $form->selectDate(GETPOST('birth'), 'birth', 0, 0, 1, 'createuser', 1, 0); |
| 1129 | 1129 | print '</td>'; |
@@ -1134,7 +1134,7 @@ discard block |
||
| 1134 | 1134 | dol_fiche_end(); |
| 1135 | 1135 | |
| 1136 | 1136 | print '<div align="center">'; |
| 1137 | - print '<input class="button" value="' . $langs->trans("CreateUser") . '" name="create" type="submit">'; |
|
| 1137 | + print '<input class="button" value="'.$langs->trans("CreateUser").'" name="create" type="submit">'; |
|
| 1138 | 1138 | //print ' '; |
| 1139 | 1139 | //print '<input value="'.$langs->trans("Cancel").'" class="button" type="submit" name="cancel">'; |
| 1140 | 1140 | print '</div>'; |
@@ -1169,7 +1169,7 @@ discard block |
||
| 1169 | 1169 | $ldap = new Ldap(); |
| 1170 | 1170 | $result = $ldap->connect_bind(); |
| 1171 | 1171 | if ($result > 0) { |
| 1172 | - $userSearchFilter = '(' . $conf->global->LDAP_FILTER_CONNECTION . '(' . $ldap->getUserIdentifier() . '=' . $object->login . '))'; |
|
| 1172 | + $userSearchFilter = '('.$conf->global->LDAP_FILTER_CONNECTION.'('.$ldap->getUserIdentifier().'='.$object->login.'))'; |
|
| 1173 | 1173 | $entries = $ldap->fetch($object->login, $userSearchFilter); |
| 1174 | 1174 | if (!$entries) { |
| 1175 | 1175 | setEventMessages($ldap->error, $ldap->errors, 'errors'); |
@@ -1202,13 +1202,13 @@ discard block |
||
| 1202 | 1202 | // Show tabs |
| 1203 | 1203 | if ($mode == 'employee') { // For HRM module development |
| 1204 | 1204 | $title = $langs->trans("Employee"); |
| 1205 | - $linkback = '<a href="' . BASE_URI . '?controller=hrm/employee&method=list&restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>'; |
|
| 1205 | + $linkback = '<a href="'.BASE_URI.'?controller=hrm/employee&method=list&restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
|
| 1206 | 1206 | } else { |
| 1207 | 1207 | $title = $langs->trans("User"); |
| 1208 | 1208 | $linkback = ''; |
| 1209 | 1209 | |
| 1210 | 1210 | if ($user->rights->user->user->lire || $user->admin) { |
| 1211 | - $linkback = '<a href="' . BASE_URI . '?controller=user&method=list&restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>'; |
|
| 1211 | + $linkback = '<a href="'.BASE_URI.'?controller=user&method=list&restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
|
| 1212 | 1212 | } |
| 1213 | 1213 | } |
| 1214 | 1214 | |
@@ -1218,35 +1218,35 @@ discard block |
||
| 1218 | 1218 | * Confirmation reinitialisation mot de passe |
| 1219 | 1219 | */ |
| 1220 | 1220 | if ($action == 'password') { |
| 1221 | - print $form->formconfirm($_SERVER['PHP_SELF'] . "?id=$object->id", $langs->trans("ReinitPassword"), $langs->trans("ConfirmReinitPassword", $object->login), "confirm_password", '', 0, 1); |
|
| 1221 | + print $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id", $langs->trans("ReinitPassword"), $langs->trans("ConfirmReinitPassword", $object->login), "confirm_password", '', 0, 1); |
|
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | 1224 | /* |
| 1225 | 1225 | * Confirmation envoi mot de passe |
| 1226 | 1226 | */ |
| 1227 | 1227 | if ($action == 'passwordsend') { |
| 1228 | - print $form->formconfirm($_SERVER['PHP_SELF'] . "?id=$object->id", $langs->trans("SendNewPassword"), $langs->trans("ConfirmSendNewPassword", $object->login), "confirm_passwordsend", '', 0, 1); |
|
| 1228 | + print $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id", $langs->trans("SendNewPassword"), $langs->trans("ConfirmSendNewPassword", $object->login), "confirm_passwordsend", '', 0, 1); |
|
| 1229 | 1229 | } |
| 1230 | 1230 | |
| 1231 | 1231 | /* |
| 1232 | 1232 | * Confirm deactivation |
| 1233 | 1233 | */ |
| 1234 | 1234 | if ($action == 'disable') { |
| 1235 | - print $form->formconfirm($_SERVER['PHP_SELF'] . "?id=$object->id", $langs->trans("DisableAUser"), $langs->trans("ConfirmDisableUser", $object->login), "confirm_disable", '', 0, 1); |
|
| 1235 | + print $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id", $langs->trans("DisableAUser"), $langs->trans("ConfirmDisableUser", $object->login), "confirm_disable", '', 0, 1); |
|
| 1236 | 1236 | } |
| 1237 | 1237 | |
| 1238 | 1238 | /* |
| 1239 | 1239 | * Confirm activation |
| 1240 | 1240 | */ |
| 1241 | 1241 | if ($action == 'enable') { |
| 1242 | - print $form->formconfirm($_SERVER['PHP_SELF'] . "?id=$object->id", $langs->trans("EnableAUser"), $langs->trans("ConfirmEnableUser", $object->login), "confirm_enable", '', 0, 1); |
|
| 1242 | + print $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id", $langs->trans("EnableAUser"), $langs->trans("ConfirmEnableUser", $object->login), "confirm_enable", '', 0, 1); |
|
| 1243 | 1243 | } |
| 1244 | 1244 | |
| 1245 | 1245 | /* |
| 1246 | 1246 | * Confirmation suppression |
| 1247 | 1247 | */ |
| 1248 | 1248 | if ($action == 'delete') { |
| 1249 | - print $form->formconfirm($_SERVER['PHP_SELF'] . "?id=$object->id", $langs->trans("DeleteAUser"), $langs->trans("ConfirmDeleteUser", $object->login), "confirm_delete", '', 0, 1); |
|
| 1249 | + print $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id", $langs->trans("DeleteAUser"), $langs->trans("ConfirmDeleteUser", $object->login), "confirm_delete", '', 0, 1); |
|
| 1250 | 1250 | } |
| 1251 | 1251 | |
| 1252 | 1252 | /* |
@@ -1264,64 +1264,64 @@ discard block |
||
| 1264 | 1264 | print '<table class="border tableforfield" width="100%">'; |
| 1265 | 1265 | |
| 1266 | 1266 | // Login |
| 1267 | - print '<tr><td class="titlefield">' . $langs->trans("Login") . '</td>'; |
|
| 1267 | + print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>'; |
|
| 1268 | 1268 | if (!empty($object->ldap_sid) && $object->statut == 0) { |
| 1269 | - print '<td class="error">' . $langs->trans("LoginAccountDisableInDolibarr") . '</td>'; |
|
| 1269 | + print '<td class="error">'.$langs->trans("LoginAccountDisableInDolibarr").'</td>'; |
|
| 1270 | 1270 | } else { |
| 1271 | - print '<td>' . $object->login . '</td>'; |
|
| 1271 | + print '<td>'.$object->login.'</td>'; |
|
| 1272 | 1272 | } |
| 1273 | - print '</tr>' . "\n"; |
|
| 1273 | + print '</tr>'."\n"; |
|
| 1274 | 1274 | |
| 1275 | 1275 | // Password |
| 1276 | - print '<tr><td>' . $langs->trans("Password") . '</td>'; |
|
| 1276 | + print '<tr><td>'.$langs->trans("Password").'</td>'; |
|
| 1277 | 1277 | |
| 1278 | 1278 | print '<td class="wordbreak">'; |
| 1279 | 1279 | $valuetoshow = ''; |
| 1280 | 1280 | if (preg_match('/ldap/', $dolibarr_main_authentication)) { |
| 1281 | 1281 | if (!empty($object->ldap_sid)) { |
| 1282 | 1282 | if ($passDoNotExpire) { |
| 1283 | - $valuetoshow .= ($valuetoshow ? (' ' . $langs->trans("or") . ' ') : '') . $langs->trans("LdapUacf_" . $statutUACF); |
|
| 1283 | + $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("LdapUacf_".$statutUACF); |
|
| 1284 | 1284 | } else if ($userChangePassNextLogon) { |
| 1285 | - $valuetoshow .= ($valuetoshow ? (' ' . $langs->trans("or") . ' ') : '') . '<span class="warning">' . $langs->trans("UserMustChangePassNextLogon", $ldap->domainFQDN) . '</span>'; |
|
| 1285 | + $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').'<span class="warning">'.$langs->trans("UserMustChangePassNextLogon", $ldap->domainFQDN).'</span>'; |
|
| 1286 | 1286 | } else if ($userDisabled) { |
| 1287 | - $valuetoshow .= ($valuetoshow ? (' ' . $langs->trans("or") . ' ') : '') . '<span class="warning">' . $langs->trans("LdapUacf_" . $statutUACF, $ldap->domainFQDN) . '</span>'; |
|
| 1287 | + $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').'<span class="warning">'.$langs->trans("LdapUacf_".$statutUACF, $ldap->domainFQDN).'</span>'; |
|
| 1288 | 1288 | } else { |
| 1289 | - $valuetoshow .= ($valuetoshow ? (' ' . $langs->trans("or") . ' ') : '') . $langs->trans("PasswordOfUserInLDAP"); |
|
| 1289 | + $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("PasswordOfUserInLDAP"); |
|
| 1290 | 1290 | } |
| 1291 | 1291 | } else { |
| 1292 | - $valuetoshow .= ($valuetoshow ? (' ' . $langs->trans("or") . ' ') : '') . $langs->trans("PasswordOfUserInLDAP"); |
|
| 1292 | + $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("PasswordOfUserInLDAP"); |
|
| 1293 | 1293 | } |
| 1294 | 1294 | } |
| 1295 | 1295 | if (preg_match('/http/', $dolibarr_main_authentication)) { |
| 1296 | - $valuetoshow .= ($valuetoshow ? (' ' . $langs->trans("or") . ' ') : '') . $langs->trans("HTTPBasicPassword"); |
|
| 1296 | + $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("HTTPBasicPassword"); |
|
| 1297 | 1297 | } |
| 1298 | 1298 | if (preg_match('/dolibarr/', $dolibarr_main_authentication)) { |
| 1299 | 1299 | if ($object->pass) { |
| 1300 | - $valuetoshow .= ($valuetoshow ? (' ' . $langs->trans("or") . ' ') : '') . preg_replace('/./i', '*', $object->pass); |
|
| 1300 | + $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').preg_replace('/./i', '*', $object->pass); |
|
| 1301 | 1301 | } else { |
| 1302 | 1302 | if ($user->admin) { |
| 1303 | - $valuetoshow .= ($valuetoshow ? (' ' . $langs->trans("or") . ' ') : '') . $langs->trans("Crypted") . ': ' . $object->pass_indatabase_crypted; |
|
| 1303 | + $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("Crypted").': '.$object->pass_indatabase_crypted; |
|
| 1304 | 1304 | } else { |
| 1305 | - $valuetoshow .= ($valuetoshow ? (' ' . $langs->trans("or") . ' ') : '') . $langs->trans("Hidden"); |
|
| 1305 | + $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("Hidden"); |
|
| 1306 | 1306 | } |
| 1307 | 1307 | } |
| 1308 | 1308 | } |
| 1309 | 1309 | |
| 1310 | 1310 | // Other form for user password |
| 1311 | 1311 | $parameters = array('valuetoshow' => $valuetoshow); |
| 1312 | - $reshook = $hookmanager->executeHooks('printUserPasswordField', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 1312 | + $reshook = $hookmanager->executeHooks('printUserPasswordField', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 1313 | 1313 | if ($reshook > 0) { |
| 1314 | 1314 | $valuetoshow = $hookmanager->resPrint; // to replace |
| 1315 | 1315 | } else { |
| 1316 | - $valuetoshow .= $hookmanager->resPrint; // to add |
|
| 1316 | + $valuetoshow .= $hookmanager->resPrint; // to add |
|
| 1317 | 1317 | } |
| 1318 | 1318 | print $valuetoshow; |
| 1319 | 1319 | print "</td>"; |
| 1320 | - print '</tr>' . "\n"; |
|
| 1320 | + print '</tr>'."\n"; |
|
| 1321 | 1321 | |
| 1322 | 1322 | // API key |
| 1323 | 1323 | if (!empty($conf->api->enabled) && $user->admin) { |
| 1324 | - print '<tr><td>' . $langs->trans("ApiKey") . '</td>'; |
|
| 1324 | + print '<tr><td>'.$langs->trans("ApiKey").'</td>'; |
|
| 1325 | 1325 | print '<td>'; |
| 1326 | 1326 | if (!empty($object->api_key)) { |
| 1327 | 1327 | print preg_replace('/./', '*', $object->api_key); |
@@ -1330,7 +1330,7 @@ discard block |
||
| 1330 | 1330 | } |
| 1331 | 1331 | |
| 1332 | 1332 | // Administrator |
| 1333 | - print '<tr><td>' . $langs->trans("Administrator") . '</td><td>'; |
|
| 1333 | + print '<tr><td>'.$langs->trans("Administrator").'</td><td>'; |
|
| 1334 | 1334 | if (!empty($conf->multicompany->enabled) && $object->admin && !$object->entity) { |
| 1335 | 1335 | print $form->textwithpicto(yn($object->admin), $langs->trans("SuperAdministratorDesc"), 1, "superadmin"); |
| 1336 | 1336 | } else if ($object->admin) { |
@@ -1338,7 +1338,7 @@ discard block |
||
| 1338 | 1338 | } else { |
| 1339 | 1339 | print yn($object->admin); |
| 1340 | 1340 | } |
| 1341 | - print '</td></tr>' . "\n"; |
|
| 1341 | + print '</td></tr>'."\n"; |
|
| 1342 | 1342 | |
| 1343 | 1343 | // Type |
| 1344 | 1344 | print '<tr><td>'; |
@@ -1351,33 +1351,33 @@ discard block |
||
| 1351 | 1351 | } |
| 1352 | 1352 | print $type; |
| 1353 | 1353 | if ($object->ldap_sid) { |
| 1354 | - print ' (' . $langs->trans("DomainUser") . ')'; |
|
| 1354 | + print ' ('.$langs->trans("DomainUser").')'; |
|
| 1355 | 1355 | } |
| 1356 | - print '</td></tr>' . "\n"; |
|
| 1356 | + print '</td></tr>'."\n"; |
|
| 1357 | 1357 | |
| 1358 | 1358 | // Ldap sid |
| 1359 | 1359 | if ($object->ldap_sid) { |
| 1360 | - print '<tr><td>' . $langs->trans("Type") . '</td><td>'; |
|
| 1360 | + print '<tr><td>'.$langs->trans("Type").'</td><td>'; |
|
| 1361 | 1361 | print $langs->trans("DomainUser", $ldap->domainFQDN); |
| 1362 | - print '</td></tr>' . "\n"; |
|
| 1362 | + print '</td></tr>'."\n"; |
|
| 1363 | 1363 | } |
| 1364 | 1364 | |
| 1365 | 1365 | // Gender |
| 1366 | - print '<tr><td>' . $langs->trans("Gender") . '</td>'; |
|
| 1366 | + print '<tr><td>'.$langs->trans("Gender").'</td>'; |
|
| 1367 | 1367 | print '<td>'; |
| 1368 | 1368 | if ($object->gender) { |
| 1369 | - print $langs->trans("Gender" . $object->gender); |
|
| 1369 | + print $langs->trans("Gender".$object->gender); |
|
| 1370 | 1370 | } |
| 1371 | 1371 | print '</td></tr>'; |
| 1372 | 1372 | |
| 1373 | 1373 | // Employee |
| 1374 | - print '<tr><td>' . $langs->trans("Employee") . '</td><td colspan="2">'; |
|
| 1374 | + print '<tr><td>'.$langs->trans("Employee").'</td><td colspan="2">'; |
|
| 1375 | 1375 | print yn($object->employee); |
| 1376 | - print '</td></tr>' . "\n"; |
|
| 1376 | + print '</td></tr>'."\n"; |
|
| 1377 | 1377 | |
| 1378 | 1378 | // TODO Move this into tab RH, visible when salarie or RH is visible (HierarchicalResponsible must be on both tab) |
| 1379 | 1379 | // Hierarchy |
| 1380 | - print '<tr><td>' . $langs->trans("HierarchicalResponsible") . '</td>'; |
|
| 1380 | + print '<tr><td>'.$langs->trans("HierarchicalResponsible").'</td>'; |
|
| 1381 | 1381 | print '<td>'; |
| 1382 | 1382 | if (empty($object->fk_user)) { |
| 1383 | 1383 | print $langs->trans("None"); |
@@ -1390,9 +1390,9 @@ discard block |
||
| 1390 | 1390 | print "</tr>\n"; |
| 1391 | 1391 | |
| 1392 | 1392 | // Position/Job |
| 1393 | - print '<tr><td>' . $langs->trans("PostOrFunction") . '</td>'; |
|
| 1394 | - print '<td>' . $object->job . '</td>'; |
|
| 1395 | - print '</tr>' . "\n"; |
|
| 1393 | + print '<tr><td>'.$langs->trans("PostOrFunction").'</td>'; |
|
| 1394 | + print '<td>'.$object->job.'</td>'; |
|
| 1395 | + print '</tr>'."\n"; |
|
| 1396 | 1396 | |
| 1397 | 1397 | //$childids = $user->getAllChildIds(1); |
| 1398 | 1398 | |
@@ -1422,7 +1422,7 @@ discard block |
||
| 1422 | 1422 | print "</tr>\n"; |
| 1423 | 1423 | |
| 1424 | 1424 | // Salary |
| 1425 | - print '<tr><td>' . $langs->trans("Salary") . '</td>'; |
|
| 1425 | + print '<tr><td>'.$langs->trans("Salary").'</td>'; |
|
| 1426 | 1426 | print '<td>'; |
| 1427 | 1427 | print ($object->salary != '' ? price($object->salary, '', $langs, 1, -1, -1, $conf->currency) : ''); |
| 1428 | 1428 | print '</td>'; |
@@ -1430,28 +1430,28 @@ discard block |
||
| 1430 | 1430 | } |
| 1431 | 1431 | |
| 1432 | 1432 | // Weeklyhours |
| 1433 | - print '<tr><td>' . $langs->trans("WeeklyHours") . '</td>'; |
|
| 1433 | + print '<tr><td>'.$langs->trans("WeeklyHours").'</td>'; |
|
| 1434 | 1434 | print '<td>'; |
| 1435 | 1435 | print price2num($object->weeklyhours); |
| 1436 | 1436 | print '</td>'; |
| 1437 | 1437 | print "</tr>\n"; |
| 1438 | 1438 | |
| 1439 | 1439 | // Date employment |
| 1440 | - print '<tr><td>' . $langs->trans("DateEmployment") . '</td>'; |
|
| 1440 | + print '<tr><td>'.$langs->trans("DateEmployment").'</td>'; |
|
| 1441 | 1441 | print '<td>'; |
| 1442 | 1442 | print dol_print_date($object->dateemployment, 'day'); |
| 1443 | 1443 | print '</td>'; |
| 1444 | 1444 | print "</tr>\n"; |
| 1445 | 1445 | |
| 1446 | 1446 | // Date employment |
| 1447 | - print '<tr><td>' . $langs->trans("DateEmploymentEnd") . '</td>'; |
|
| 1447 | + print '<tr><td>'.$langs->trans("DateEmploymentEnd").'</td>'; |
|
| 1448 | 1448 | print '<td>'; |
| 1449 | 1449 | print dol_print_date($object->dateemploymentend); |
| 1450 | 1450 | print '</td>'; |
| 1451 | 1451 | print "</tr>\n"; |
| 1452 | 1452 | |
| 1453 | 1453 | // Date of birth |
| 1454 | - print '<tr><td>' . $langs->trans("DateToBirth") . '</td>'; |
|
| 1454 | + print '<tr><td>'.$langs->trans("DateToBirth").'</td>'; |
|
| 1455 | 1455 | print '<td>'; |
| 1456 | 1456 | print dol_print_date($object->birth, 'day'); |
| 1457 | 1457 | print '</td>'; |
@@ -1459,8 +1459,8 @@ discard block |
||
| 1459 | 1459 | |
| 1460 | 1460 | // Accountancy code |
| 1461 | 1461 | if ($conf->accounting->enabled) { |
| 1462 | - print '<tr><td>' . $langs->trans("AccountancyCode") . '</td>'; |
|
| 1463 | - print '<td>' . $object->accountancy_code . '</td></tr>'; |
|
| 1462 | + print '<tr><td>'.$langs->trans("AccountancyCode").'</td>'; |
|
| 1463 | + print '<td>'.$object->accountancy_code.'</td></tr>'; |
|
| 1464 | 1464 | } |
| 1465 | 1465 | |
| 1466 | 1466 | print '</table>'; |
@@ -1473,7 +1473,7 @@ discard block |
||
| 1473 | 1473 | |
| 1474 | 1474 | // Color user |
| 1475 | 1475 | if (!empty($conf->agenda->enabled)) { |
| 1476 | - print '<tr><td>' . $langs->trans("ColorUser") . '</td>'; |
|
| 1476 | + print '<tr><td>'.$langs->trans("ColorUser").'</td>'; |
|
| 1477 | 1477 | print '<td>'; |
| 1478 | 1478 | print $formother->showColor($object->color, ''); |
| 1479 | 1479 | print '</td>'; |
@@ -1482,24 +1482,24 @@ discard block |
||
| 1482 | 1482 | |
| 1483 | 1483 | // Categories |
| 1484 | 1484 | if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { |
| 1485 | - print '<tr><td>' . $langs->trans("Categories") . '</td>'; |
|
| 1485 | + print '<tr><td>'.$langs->trans("Categories").'</td>'; |
|
| 1486 | 1486 | print '<td colspan="3">'; |
| 1487 | 1487 | print $form->showCategories($object->id, 'user', 1); |
| 1488 | 1488 | print '</td></tr>'; |
| 1489 | 1489 | } |
| 1490 | 1490 | |
| 1491 | 1491 | if (isset($conf->file->main_authentication) && preg_match('/openid/', $conf->file->main_authentication) && !empty($conf->global->MAIN_OPENIDURL_PERUSER)) { |
| 1492 | - print '<tr><td>' . $langs->trans("OpenIDURL") . '</td>'; |
|
| 1493 | - print '<td>' . $object->openid . '</td>'; |
|
| 1492 | + print '<tr><td>'.$langs->trans("OpenIDURL").'</td>'; |
|
| 1493 | + print '<td>'.$object->openid.'</td>'; |
|
| 1494 | 1494 | print "</tr>\n"; |
| 1495 | 1495 | } |
| 1496 | 1496 | |
| 1497 | - print '<tr><td class="titlefield">' . $langs->trans("LastConnexion") . '</td>'; |
|
| 1498 | - print '<td>' . dol_print_date($object->datelastlogin, "dayhour") . '</td>'; |
|
| 1497 | + print '<tr><td class="titlefield">'.$langs->trans("LastConnexion").'</td>'; |
|
| 1498 | + print '<td>'.dol_print_date($object->datelastlogin, "dayhour").'</td>'; |
|
| 1499 | 1499 | print "</tr>\n"; |
| 1500 | 1500 | |
| 1501 | - print '<tr><td>' . $langs->trans("PreviousConnexion") . '</td>'; |
|
| 1502 | - print '<td>' . dol_print_date($object->datepreviouslogin, "dayhour") . '</td>'; |
|
| 1501 | + print '<tr><td>'.$langs->trans("PreviousConnexion").'</td>'; |
|
| 1502 | + print '<td>'.dol_print_date($object->datepreviouslogin, "dayhour").'</td>'; |
|
| 1503 | 1503 | print "</tr>\n"; |
| 1504 | 1504 | |
| 1505 | 1505 | // Multicompany |
@@ -1507,7 +1507,7 @@ discard block |
||
| 1507 | 1507 | // This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module |
| 1508 | 1508 | if (!method_exists($mc, 'formObjectOptions')) { |
| 1509 | 1509 | if (!empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) { |
| 1510 | - print '<tr><td>' . $langs->trans("Entity") . '</td><td>'; |
|
| 1510 | + print '<tr><td>'.$langs->trans("Entity").'</td><td>'; |
|
| 1511 | 1511 | if (empty($object->entity)) { |
| 1512 | 1512 | print $langs->trans("AllEntities"); |
| 1513 | 1513 | } else { |
@@ -1520,11 +1520,11 @@ discard block |
||
| 1520 | 1520 | } |
| 1521 | 1521 | |
| 1522 | 1522 | // Other attributes |
| 1523 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; |
|
| 1523 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; |
|
| 1524 | 1524 | |
| 1525 | 1525 | // Company / Contact |
| 1526 | 1526 | if (!empty($conf->societe->enabled)) { |
| 1527 | - print '<tr><td>' . $langs->trans("LinkToCompanyContact") . '</td>'; |
|
| 1527 | + print '<tr><td>'.$langs->trans("LinkToCompanyContact").'</td>'; |
|
| 1528 | 1528 | print '<td>'; |
| 1529 | 1529 | if (isset($object->socid) && $object->socid > 0) { |
| 1530 | 1530 | $societe = new Societe($db); |
@@ -1541,16 +1541,16 @@ discard block |
||
| 1541 | 1541 | } else { |
| 1542 | 1542 | print '<br>'; |
| 1543 | 1543 | } |
| 1544 | - print '<a href="' . BASE_URI . '?controller=contact&method=card&id=' . $object->contactid . '">' . img_object($langs->trans("ShowContact"), 'contact') . ' ' . dol_trunc($contact->getFullName($langs), 32) . '</a>'; |
|
| 1544 | + print '<a href="'.BASE_URI.'?controller=contact&method=card&id='.$object->contactid.'">'.img_object($langs->trans("ShowContact"), 'contact').' '.dol_trunc($contact->getFullName($langs), 32).'</a>'; |
|
| 1545 | 1545 | } |
| 1546 | 1546 | print '</td>'; |
| 1547 | - print '</tr>' . "\n"; |
|
| 1547 | + print '</tr>'."\n"; |
|
| 1548 | 1548 | } |
| 1549 | 1549 | |
| 1550 | 1550 | // Module Adherent |
| 1551 | 1551 | if (!empty($conf->adherent->enabled)) { |
| 1552 | 1552 | $langs->load("members"); |
| 1553 | - print '<tr><td>' . $langs->trans("LinkedToDolibarrMember") . '</td>'; |
|
| 1553 | + print '<tr><td>'.$langs->trans("LinkedToDolibarrMember").'</td>'; |
|
| 1554 | 1554 | print '<td>'; |
| 1555 | 1555 | if ($object->fk_member) { |
| 1556 | 1556 | $adh = new Adherent($db); |
@@ -1561,11 +1561,11 @@ discard block |
||
| 1561 | 1561 | print $langs->trans("UserNotLinkedToMember"); |
| 1562 | 1562 | } |
| 1563 | 1563 | print '</td>'; |
| 1564 | - print '</tr>' . "\n"; |
|
| 1564 | + print '</tr>'."\n"; |
|
| 1565 | 1565 | } |
| 1566 | 1566 | |
| 1567 | 1567 | // Signature |
| 1568 | - print '<tr><td class="tdtop">' . $langs->trans('Signature') . '</td><td>'; |
|
| 1568 | + print '<tr><td class="tdtop">'.$langs->trans('Signature').'</td><td>'; |
|
| 1569 | 1569 | print dol_htmlentitiesbr($object->signature); |
| 1570 | 1570 | print "</td></tr>\n"; |
| 1571 | 1571 | |
@@ -1586,49 +1586,49 @@ discard block |
||
| 1586 | 1586 | print '<div class="tabsAction">'; |
| 1587 | 1587 | |
| 1588 | 1588 | $parameters = array(); |
| 1589 | - $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 1589 | + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 1590 | 1590 | if (empty($reshook)) { |
| 1591 | 1591 | if (!empty($object->email)) { |
| 1592 | 1592 | $langs->load("mails"); |
| 1593 | 1593 | // print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=presend&mode=init#presend">' . $langs->trans('SendMail') . '</a></div>'; |
| 1594 | - print '<div class="inline-block divButAction"><a class="butAction" href="' . BASE_URI . '?controller=user&method=card&id=' . $object->id . '&action=presend&mode=init#presend">' . $langs->trans('SendMail') . '</a></div>'; |
|
| 1594 | + print '<div class="inline-block divButAction"><a class="butAction" href="'.BASE_URI.'?controller=user&method=card&id='.$object->id.'&action=presend&mode=init#presend">'.$langs->trans('SendMail').'</a></div>'; |
|
| 1595 | 1595 | } else { |
| 1596 | 1596 | $langs->load("mails"); |
| 1597 | - print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("NoEMail")) . '">' . $langs->trans('SendMail') . '</a></div>'; |
|
| 1597 | + print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans('SendMail').'</a></div>'; |
|
| 1598 | 1598 | } |
| 1599 | 1599 | |
| 1600 | 1600 | if ($caneditfield && (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { |
| 1601 | 1601 | if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) { |
| 1602 | - print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("DisabledInMonoUserMode")) . '">' . $langs->trans("Modify") . '</a></div>'; |
|
| 1602 | + print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("DisabledInMonoUserMode")).'">'.$langs->trans("Modify").'</a></div>'; |
|
| 1603 | 1603 | } else { |
| 1604 | 1604 | // print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=edit">' . $langs->trans("Modify") . '</a></div>'; |
| 1605 | - print '<div class="inline-block divButAction"><a class="butAction" href="' . BASE_URI . '?controller=user&method=card&id=' . $object->id . '&action=edit">' . $langs->trans("Modify") . '</a></div>'; |
|
| 1605 | + print '<div class="inline-block divButAction"><a class="butAction" href="'.BASE_URI.'?controller=user&method=card&id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a></div>'; |
|
| 1606 | 1606 | } |
| 1607 | 1607 | } elseif ($caneditpassword && !$object->ldap_sid && |
| 1608 | 1608 | (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { |
| 1609 | 1609 | // print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=edit">' . $langs->trans("EditPassword") . '</a></div>'; |
| 1610 | - print '<div class="inline-block divButAction"><a class="butAction" href="' . BASE_URI . '?controller=user&method=card&id=' . $object->id . '&action=edit">' . $langs->trans("EditPassword") . '</a></div>'; |
|
| 1610 | + print '<div class="inline-block divButAction"><a class="butAction" href="'.BASE_URI.'?controller=user&method=card&id='.$object->id.'&action=edit">'.$langs->trans("EditPassword").'</a></div>'; |
|
| 1611 | 1611 | } |
| 1612 | 1612 | |
| 1613 | 1613 | // Si on a un gestionnaire de generation de mot de passe actif |
| 1614 | 1614 | if ($conf->global->USER_PASSWORD_GENERATED != 'none') { |
| 1615 | 1615 | if ($object->statut == 0) { |
| 1616 | - print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("UserDisabled")) . '">' . $langs->trans("ReinitPassword") . '</a></div>'; |
|
| 1616 | + print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("UserDisabled")).'">'.$langs->trans("ReinitPassword").'</a></div>'; |
|
| 1617 | 1617 | } elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && |
| 1618 | 1618 | ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { |
| 1619 | 1619 | // print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=password">' . $langs->trans("ReinitPassword") . '</a></div>'; |
| 1620 | - print '<div class="inline-block divButAction"><a class="butAction" href="' . BASE_URI . '?controller=user&method=card&id=' . $object->id . '&action=password">' . $langs->trans("ReinitPassword") . '</a></div>'; |
|
| 1620 | + print '<div class="inline-block divButAction"><a class="butAction" href="'.BASE_URI.'?controller=user&method=card&id='.$object->id.'&action=password">'.$langs->trans("ReinitPassword").'</a></div>'; |
|
| 1621 | 1621 | } |
| 1622 | 1622 | |
| 1623 | 1623 | if ($object->statut == 0) { |
| 1624 | - print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("UserDisabled")) . '">' . $langs->trans("SendNewPassword") . '</a></div>'; |
|
| 1624 | + print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("UserDisabled")).'">'.$langs->trans("SendNewPassword").'</a></div>'; |
|
| 1625 | 1625 | } else if (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && |
| 1626 | 1626 | ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { |
| 1627 | 1627 | if ($object->email) { |
| 1628 | 1628 | // print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=passwordsend">' . $langs->trans("SendNewPassword") . '</a></div>'; |
| 1629 | - print '<div class="inline-block divButAction"><a class="butAction" href="' . BASE_URI . '?controller=user&method=card&id=' . $object->id . '&action=passwordsend">' . $langs->trans("SendNewPassword") . '</a></div>'; |
|
| 1629 | + print '<div class="inline-block divButAction"><a class="butAction" href="'.BASE_URI.'?controller=user&method=card&id='.$object->id.'&action=passwordsend">'.$langs->trans("SendNewPassword").'</a></div>'; |
|
| 1630 | 1630 | } else { |
| 1631 | - print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("NoEMail")) . '">' . $langs->trans("SendNewPassword") . '</a></div>'; |
|
| 1631 | + print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans("SendNewPassword").'</a></div>'; |
|
| 1632 | 1632 | } |
| 1633 | 1633 | } |
| 1634 | 1634 | } |
@@ -1637,22 +1637,22 @@ discard block |
||
| 1637 | 1637 | if ($user->id <> $id && $candisableuser && $object->statut == 0 && |
| 1638 | 1638 | ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { |
| 1639 | 1639 | // print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=enable">' . $langs->trans("Reactivate") . '</a></div>'; |
| 1640 | - print '<div class="inline-block divButAction"><a class="butAction" href="' . BASE_URI . '?controller=user&method=card&id=' . $object->id . '&action=enable">' . $langs->trans("Reactivate") . '</a></div>'; |
|
| 1640 | + print '<div class="inline-block divButAction"><a class="butAction" href="'.BASE_URI.'?controller=user&method=card&id='.$object->id.'&action=enable">'.$langs->trans("Reactivate").'</a></div>'; |
|
| 1641 | 1641 | } |
| 1642 | 1642 | // Desactiver |
| 1643 | 1643 | if ($user->id <> $id && $candisableuser && $object->statut == 1 && |
| 1644 | 1644 | ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { |
| 1645 | 1645 | // print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?action=disable&id=' . $object->id . '">' . $langs->trans("DisableUser") . '</a></div>'; |
| 1646 | - print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . BASE_URI . '?controller=user&method=card&action=disable&id=' . $object->id . '">' . $langs->trans("DisableUser") . '</a></div>'; |
|
| 1646 | + print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.BASE_URI.'?controller=user&method=card&action=disable&id='.$object->id.'">'.$langs->trans("DisableUser").'</a></div>'; |
|
| 1647 | 1647 | } |
| 1648 | 1648 | // Delete |
| 1649 | 1649 | if ($user->id <> $id && $candisableuser && |
| 1650 | 1650 | ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { |
| 1651 | 1651 | if ($user->admin || !$object->admin) { // If user edited is admin, delete is possible on for an admin |
| 1652 | 1652 | // print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?action=delete&id=' . $object->id . '">' . $langs->trans("DeleteUser") . '</a></div>'; |
| 1653 | - print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . BASE_URI . '?controller=user&method=card&action=delete&id=' . $object->id . '">' . $langs->trans("DeleteUser") . '</a></div>'; |
|
| 1653 | + print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.BASE_URI.'?controller=user&method=card&action=delete&id='.$object->id.'">'.$langs->trans("DeleteUser").'</a></div>'; |
|
| 1654 | 1654 | } else { |
| 1655 | - print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("MustBeAdminToDeleteOtherAdmin")) . '">' . $langs->trans("DeleteUser") . '</a></div>'; |
|
| 1655 | + print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("MustBeAdminToDeleteOtherAdmin")).'">'.$langs->trans("DeleteUser").'</a></div>'; |
|
| 1656 | 1656 | } |
| 1657 | 1657 | } |
| 1658 | 1658 | } |
@@ -1670,9 +1670,9 @@ discard block |
||
| 1670 | 1670 | $modelmail = 'user'; |
| 1671 | 1671 | $defaulttopic = 'Information'; |
| 1672 | 1672 | $diroutput = $conf->user->dir_output; |
| 1673 | - $trackid = 'use' . $object->id; |
|
| 1673 | + $trackid = 'use'.$object->id; |
|
| 1674 | 1674 | |
| 1675 | - include DOL_DOCUMENT_ROOT . '/core/tpl/card_presend.tpl.php'; |
|
| 1675 | + include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; |
|
| 1676 | 1676 | |
| 1677 | 1677 | if ($action != 'presend' && $action != 'send') { |
| 1678 | 1678 | /* |
@@ -1696,28 +1696,28 @@ discard block |
||
| 1696 | 1696 | |
| 1697 | 1697 | if ($caneditgroup) { |
| 1698 | 1698 | // print '<form action="' . $_SERVER['PHP_SELF'] . '?id=' . $id . '" method="POST">' . "\n"; |
| 1699 | - print '<form href="' . BASE_URI . '?controller=user&method=card&id=' . $id . '" method="POST">' . "\n"; |
|
| 1700 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '" />'; |
|
| 1699 | + print '<form href="'.BASE_URI.'?controller=user&method=card&id='.$id.'" method="POST">'."\n"; |
|
| 1700 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />'; |
|
| 1701 | 1701 | print '<input type="hidden" name="action" value="addgroup" />'; |
| 1702 | 1702 | } |
| 1703 | 1703 | |
| 1704 | - print '<table class="noborder" width="100%">' . "\n"; |
|
| 1704 | + print '<table class="noborder" width="100%">'."\n"; |
|
| 1705 | 1705 | |
| 1706 | 1706 | // Other form for add user to group |
| 1707 | 1707 | $parameters = array('caneditgroup' => $caneditgroup, 'groupslist' => $groupslist, 'exclude' => $exclude); |
| 1708 | - $reshook = $hookmanager->executeHooks('formAddUserToGroup', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 1708 | + $reshook = $hookmanager->executeHooks('formAddUserToGroup', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 1709 | 1709 | print $hookmanager->resPrint; |
| 1710 | 1710 | |
| 1711 | 1711 | if (empty($reshook)) { |
| 1712 | - print '<tr class="liste_titre"><th class="liste_titre">' . $langs->trans("Groups") . '</th>' . "\n"; |
|
| 1712 | + print '<tr class="liste_titre"><th class="liste_titre">'.$langs->trans("Groups").'</th>'."\n"; |
|
| 1713 | 1713 | print '<th class="liste_titre" align="right">'; |
| 1714 | 1714 | if ($caneditgroup) { |
| 1715 | 1715 | print $form->select_dolgroups('', 'group', 1, $exclude, 0, '', '', $object->entity); |
| 1716 | 1716 | print ' '; |
| 1717 | - print '<input type="hidden" name="entity" value="' . $conf->entity . '" />'; |
|
| 1718 | - print '<input type="submit" class="button" value="' . $langs->trans("Add") . '" />'; |
|
| 1717 | + print '<input type="hidden" name="entity" value="'.$conf->entity.'" />'; |
|
| 1718 | + print '<input type="submit" class="button" value="'.$langs->trans("Add").'" />'; |
|
| 1719 | 1719 | } |
| 1720 | - print '</th></tr>' . "\n"; |
|
| 1720 | + print '</th></tr>'."\n"; |
|
| 1721 | 1721 | |
| 1722 | 1722 | /* |
| 1723 | 1723 | * Groups assigned to user |
@@ -1727,14 +1727,14 @@ discard block |
||
| 1727 | 1727 | print '<tr class="oddeven">'; |
| 1728 | 1728 | print '<td>'; |
| 1729 | 1729 | if ($caneditgroup) { |
| 1730 | - print '<a href="' . BASE_URI . '?controller=user&method=card&id=' . $group->id . '">' . img_object($langs->trans("ShowGroup"), "group") . ' ' . $group->name . '</a>'; |
|
| 1730 | + print '<a href="'.BASE_URI.'?controller=user&method=card&id='.$group->id.'">'.img_object($langs->trans("ShowGroup"), "group").' '.$group->name.'</a>'; |
|
| 1731 | 1731 | } else { |
| 1732 | - print img_object($langs->trans("ShowGroup"), "group") . ' ' . $group->name; |
|
| 1732 | + print img_object($langs->trans("ShowGroup"), "group").' '.$group->name; |
|
| 1733 | 1733 | } |
| 1734 | 1734 | print '</td>'; |
| 1735 | 1735 | print '<td align="right">'; |
| 1736 | 1736 | if ($caneditgroup) { |
| 1737 | - print '<a href="' . BASE_URI . '?controller=user&method=card&id=' . $object->id . '&action=removegroup&group=' . $group->id . '">'; |
|
| 1737 | + print '<a href="'.BASE_URI.'?controller=user&method=card&id='.$object->id.'&action=removegroup&group='.$group->id.'">'; |
|
| 1738 | 1738 | print img_picto($langs->trans("RemoveFromGroup"), 'unlink'); |
| 1739 | 1739 | print '</a>'; |
| 1740 | 1740 | } else { |
@@ -1743,7 +1743,7 @@ discard block |
||
| 1743 | 1743 | print "</td></tr>\n"; |
| 1744 | 1744 | } |
| 1745 | 1745 | } else { |
| 1746 | - print '<tr class="oddeven"><td colspan="3" class="opacitymedium">' . $langs->trans("None") . '</td></tr>'; |
|
| 1746 | + print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>'; |
|
| 1747 | 1747 | } |
| 1748 | 1748 | } |
| 1749 | 1749 | |
@@ -1762,10 +1762,10 @@ discard block |
||
| 1762 | 1762 | */ |
| 1763 | 1763 | if ($action == 'edit' && ($canedituser || $caneditfield || $caneditpassword || ($user->id == $object->id))) { |
| 1764 | 1764 | // print '<form action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '" method="POST" name="updateuser" enctype="multipart/form-data">'; |
| 1765 | - print '<form href="' . BASE_URI . '?controller=user&method=card&id=' . $object->id . '" method="POST" name="updateuser" enctype="multipart/form-data">'; |
|
| 1766 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
| 1765 | + print '<form href="'.BASE_URI.'?controller=user&method=card&id='.$object->id.'" method="POST" name="updateuser" enctype="multipart/form-data">'; |
|
| 1766 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 1767 | 1767 | print '<input type="hidden" name="action" value="update">'; |
| 1768 | - print '<input type="hidden" name="entity" value="' . $object->entity . '">'; |
|
| 1768 | + print '<input type="hidden" name="entity" value="'.$object->entity.'">'; |
|
| 1769 | 1769 | |
| 1770 | 1770 | dol_fiche_head($head, 'user', $title, 0, 'user'); |
| 1771 | 1771 | |
@@ -1773,7 +1773,7 @@ discard block |
||
| 1773 | 1773 | |
| 1774 | 1774 | // Ref/ID |
| 1775 | 1775 | if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { |
| 1776 | - print '<tr><td class="titlefield">' . $langs->trans("Ref") . '</td>'; |
|
| 1776 | + print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>'; |
|
| 1777 | 1777 | print '<td>'; |
| 1778 | 1778 | print $object->id; |
| 1779 | 1779 | print '</td>'; |
@@ -1782,87 +1782,87 @@ discard block |
||
| 1782 | 1782 | |
| 1783 | 1783 | // Lastname |
| 1784 | 1784 | print "<tr>"; |
| 1785 | - print '<td class="titlefield fieldrequired">' . $langs->trans("Lastname") . '</td>'; |
|
| 1785 | + print '<td class="titlefield fieldrequired">'.$langs->trans("Lastname").'</td>'; |
|
| 1786 | 1786 | print '<td>'; |
| 1787 | 1787 | if ($caneditfield && !$object->ldap_sid) { |
| 1788 | - print '<input class="minwidth100" type="text" class="flat" name="lastname" value="' . $object->lastname . '">'; |
|
| 1788 | + print '<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.'">'; |
|
| 1789 | 1789 | } else { |
| 1790 | - print '<input type="hidden" name="lastname" value="' . $object->lastname . '">'; |
|
| 1790 | + print '<input type="hidden" name="lastname" value="'.$object->lastname.'">'; |
|
| 1791 | 1791 | print $object->lastname; |
| 1792 | 1792 | } |
| 1793 | 1793 | print '</td>'; |
| 1794 | 1794 | print '</tr>'; |
| 1795 | 1795 | |
| 1796 | 1796 | // Firstname |
| 1797 | - print "<tr>" . '<td>' . $langs->trans("Firstname") . '</td>'; |
|
| 1797 | + print "<tr>".'<td>'.$langs->trans("Firstname").'</td>'; |
|
| 1798 | 1798 | print '<td>'; |
| 1799 | 1799 | if ($caneditfield && !$object->ldap_sid) { |
| 1800 | - print '<input class="minwidth100" type="text" class="flat" name="firstname" value="' . $object->firstname . '">'; |
|
| 1800 | + print '<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.'">'; |
|
| 1801 | 1801 | } else { |
| 1802 | - print '<input type="hidden" name="firstname" value="' . $object->firstname . '">'; |
|
| 1802 | + print '<input type="hidden" name="firstname" value="'.$object->firstname.'">'; |
|
| 1803 | 1803 | print $object->firstname; |
| 1804 | 1804 | } |
| 1805 | 1805 | print '</td></tr>'; |
| 1806 | 1806 | |
| 1807 | 1807 | // Login |
| 1808 | - print "<tr>" . '<td><span class="fieldrequired">' . $langs->trans("Login") . '</span></td>'; |
|
| 1808 | + print "<tr>".'<td><span class="fieldrequired">'.$langs->trans("Login").'</span></td>'; |
|
| 1809 | 1809 | print '<td>'; |
| 1810 | 1810 | if ($user->admin && !$object->ldap_sid) { |
| 1811 | - print '<input size="12" maxlength="24" type="text" class="flat" name="login" value="' . $object->login . '">'; |
|
| 1811 | + print '<input size="12" maxlength="24" type="text" class="flat" name="login" value="'.$object->login.'">'; |
|
| 1812 | 1812 | } else { |
| 1813 | - print '<input type="hidden" name="login" value="' . $object->login . '">'; |
|
| 1813 | + print '<input type="hidden" name="login" value="'.$object->login.'">'; |
|
| 1814 | 1814 | print $object->login; |
| 1815 | 1815 | } |
| 1816 | 1816 | print '</td>'; |
| 1817 | 1817 | print '</tr>'; |
| 1818 | 1818 | |
| 1819 | 1819 | // Pass |
| 1820 | - print '<tr><td>' . $langs->trans("Password") . '</td>'; |
|
| 1820 | + print '<tr><td>'.$langs->trans("Password").'</td>'; |
|
| 1821 | 1821 | print '<td>'; |
| 1822 | 1822 | $valuetoshow = ''; |
| 1823 | 1823 | if (preg_match('/ldap/', $dolibarr_main_authentication)) { |
| 1824 | - $valuetoshow .= ($valuetoshow ? (' ' . $langs->trans("or") . ' ') : '') . $langs->trans("PasswordOfUserInLDAP"); |
|
| 1824 | + $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("PasswordOfUserInLDAP"); |
|
| 1825 | 1825 | } |
| 1826 | 1826 | if (preg_match('/http/', $dolibarr_main_authentication)) { |
| 1827 | - $valuetoshow .= ($valuetoshow ? (' ' . $langs->trans("or") . ' ') : '') . $form->textwithpicto($text, $langs->trans("DolibarrInHttpAuthenticationSoPasswordUseless", $dolibarr_main_authentication), 1, 'warning'); |
|
| 1827 | + $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$form->textwithpicto($text, $langs->trans("DolibarrInHttpAuthenticationSoPasswordUseless", $dolibarr_main_authentication), 1, 'warning'); |
|
| 1828 | 1828 | } |
| 1829 | 1829 | if (preg_match('/dolibarr/', $dolibarr_main_authentication)) { |
| 1830 | 1830 | if ($caneditpassword) { |
| 1831 | - $valuetoshow .= ($valuetoshow ? (' ' . $langs->trans("or") . ' ') : '') . '<input size="12" maxlength="32" type="password" class="flat" name="password" value="' . $object->pass . '" autocomplete="new-password">'; |
|
| 1831 | + $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').'<input size="12" maxlength="32" type="password" class="flat" name="password" value="'.$object->pass.'" autocomplete="new-password">'; |
|
| 1832 | 1832 | } else { |
| 1833 | - $valuetoshow .= ($valuetoshow ? (' ' . $langs->trans("or") . ' ') : '') . preg_replace('/./i', '*', $object->pass); |
|
| 1833 | + $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').preg_replace('/./i', '*', $object->pass); |
|
| 1834 | 1834 | } |
| 1835 | 1835 | } |
| 1836 | 1836 | |
| 1837 | 1837 | // Other form for user password |
| 1838 | 1838 | $parameters = array('valuetoshow' => $valuetoshow, 'caneditpassword' => $caneditpassword); |
| 1839 | - $reshook = $hookmanager->executeHooks('printUserPasswordField', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 1839 | + $reshook = $hookmanager->executeHooks('printUserPasswordField', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 1840 | 1840 | if ($reshook > 0) { |
| 1841 | 1841 | $valuetoshow = $hookmanager->resPrint; // to replace |
| 1842 | 1842 | } else { |
| 1843 | - $valuetoshow .= $hookmanager->resPrint; // to add |
|
| 1843 | + $valuetoshow .= $hookmanager->resPrint; // to add |
|
| 1844 | 1844 | } |
| 1845 | 1845 | print $valuetoshow; |
| 1846 | 1846 | print "</td></tr>\n"; |
| 1847 | 1847 | |
| 1848 | 1848 | // API key |
| 1849 | 1849 | if (!empty($conf->api->enabled) && $user->admin) { |
| 1850 | - print '<tr><td>' . $langs->trans("ApiKey") . '</td>'; |
|
| 1850 | + print '<tr><td>'.$langs->trans("ApiKey").'</td>'; |
|
| 1851 | 1851 | print '<td>'; |
| 1852 | - print '<input class="minwidth300" maxsize="32" type="text" id="api_key" name="api_key" value="' . $object->api_key . '" autocomplete="off">'; |
|
| 1852 | + print '<input class="minwidth300" maxsize="32" type="text" id="api_key" name="api_key" value="'.$object->api_key.'" autocomplete="off">'; |
|
| 1853 | 1853 | if (!empty($conf->use_javascript_ajax)) { |
| 1854 | - print ' ' . img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject"'); |
|
| 1854 | + print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject"'); |
|
| 1855 | 1855 | } |
| 1856 | 1856 | print '</td></tr>'; |
| 1857 | 1857 | } |
| 1858 | 1858 | |
| 1859 | 1859 | // Administrator |
| 1860 | - print '<tr><td>' . $langs->trans("Administrator") . '</td>'; |
|
| 1860 | + print '<tr><td>'.$langs->trans("Administrator").'</td>'; |
|
| 1861 | 1861 | if ($object->socid > 0) { |
| 1862 | 1862 | $langs->load("admin"); |
| 1863 | 1863 | print '<td>'; |
| 1864 | - print '<input type="hidden" name="admin" value="' . $object->admin . '">' . yn($object->admin); |
|
| 1865 | - print ' (' . $langs->trans("ExternalUser") . ')'; |
|
| 1864 | + print '<input type="hidden" name="admin" value="'.$object->admin.'">'.yn($object->admin); |
|
| 1865 | + print ' ('.$langs->trans("ExternalUser").')'; |
|
| 1866 | 1866 | print '</td></tr>'; |
| 1867 | 1867 | } else { |
| 1868 | 1868 | print '<td>'; |
@@ -1918,12 +1918,12 @@ discard block |
||
| 1918 | 1918 | } |
| 1919 | 1919 | |
| 1920 | 1920 | $checked = (($object->admin && !$object->entity) ? ' checked' : ''); |
| 1921 | - print '<input type="checkbox" name="superadmin" value="1"' . $checked . ' /> ' . $langs->trans("SuperAdministrator"); |
|
| 1921 | + print '<input type="checkbox" name="superadmin" value="1"'.$checked.' /> '.$langs->trans("SuperAdministrator"); |
|
| 1922 | 1922 | } |
| 1923 | 1923 | } else { |
| 1924 | 1924 | $yn = yn($object->admin); |
| 1925 | - print '<input type="hidden" name="admin" value="' . $object->admin . '">'; |
|
| 1926 | - print '<input type="hidden" name="superadmin" value="' . (empty($object->entity) ? 1 : 0) . '">'; |
|
| 1925 | + print '<input type="hidden" name="admin" value="'.$object->admin.'">'; |
|
| 1926 | + print '<input type="hidden" name="superadmin" value="'.(empty($object->entity) ? 1 : 0).'">'; |
|
| 1927 | 1927 | if (!empty($conf->multicompany->enabled) && empty($object->entity)) { |
| 1928 | 1928 | print $form->textwithpicto($yn, $langs->trans("DontDowngradeSuperAdmin"), 1, 'warning'); |
| 1929 | 1929 | } else { |
@@ -1934,7 +1934,7 @@ discard block |
||
| 1934 | 1934 | } |
| 1935 | 1935 | |
| 1936 | 1936 | // Type |
| 1937 | - print '<tr><td>' . $langs->trans("Type") . '</td>'; |
|
| 1937 | + print '<tr><td>'.$langs->trans("Type").'</td>'; |
|
| 1938 | 1938 | print '<td>'; |
| 1939 | 1939 | if ($user->id == $object->id || !$user->admin) { |
| 1940 | 1940 | $type = $langs->trans("Internal"); |
@@ -1943,7 +1943,7 @@ discard block |
||
| 1943 | 1943 | } |
| 1944 | 1944 | print $form->textwithpicto($type, $langs->trans("InternalExternalDesc")); |
| 1945 | 1945 | if ($object->ldap_sid) { |
| 1946 | - print ' (' . $langs->trans("DomainUser") . ')'; |
|
| 1946 | + print ' ('.$langs->trans("DomainUser").')'; |
|
| 1947 | 1947 | } |
| 1948 | 1948 | } else { |
| 1949 | 1949 | $type = 0; |
@@ -1952,13 +1952,13 @@ discard block |
||
| 1952 | 1952 | } |
| 1953 | 1953 | print $form->selectcontacts(0, $type, 'contactid', 2, '', '', 1, '', false, 1); |
| 1954 | 1954 | if ($object->ldap_sid) { |
| 1955 | - print ' (' . $langs->trans("DomainUser") . ')'; |
|
| 1955 | + print ' ('.$langs->trans("DomainUser").')'; |
|
| 1956 | 1956 | } |
| 1957 | 1957 | } |
| 1958 | 1958 | print '</td></tr>'; |
| 1959 | 1959 | |
| 1960 | 1960 | // Gender |
| 1961 | - print '<tr><td>' . $langs->trans("Gender") . '</td>'; |
|
| 1961 | + print '<tr><td>'.$langs->trans("Gender").'</td>'; |
|
| 1962 | 1962 | print '<td>'; |
| 1963 | 1963 | $arraygender = array('man' => $langs->trans("Genderman"), 'woman' => $langs->trans("Genderwoman")); |
| 1964 | 1964 | print $form->selectarray('gender', $arraygender, GETPOST('gender') ? GETPOST('gender') : $object->gender, 1); |
@@ -1966,7 +1966,7 @@ discard block |
||
| 1966 | 1966 | |
| 1967 | 1967 | // Employee |
| 1968 | 1968 | print '<tr>'; |
| 1969 | - print '<td>' . $form->editfieldkey('Employee', 'employee', '', $object, 0) . '</td><td>'; |
|
| 1969 | + print '<td>'.$form->editfieldkey('Employee', 'employee', '', $object, 0).'</td><td>'; |
|
| 1970 | 1970 | if ($caneditfield) { |
| 1971 | 1971 | print $form->selectyesno("employee", $object->employee, 1); |
| 1972 | 1972 | } else { |
@@ -1979,12 +1979,12 @@ discard block |
||
| 1979 | 1979 | print '</td></tr>'; |
| 1980 | 1980 | |
| 1981 | 1981 | // Hierarchy |
| 1982 | - print '<tr><td class="titlefield">' . $langs->trans("HierarchicalResponsible") . '</td>'; |
|
| 1982 | + print '<tr><td class="titlefield">'.$langs->trans("HierarchicalResponsible").'</td>'; |
|
| 1983 | 1983 | print '<td>'; |
| 1984 | 1984 | if ($caneditfield) { |
| 1985 | 1985 | print $form->select_dolusers($object->fk_user, 'fk_user', 1, array($object->id), 0, '', 0, $object->entity, 0, 0, '', 0, '', 'maxwidth300'); |
| 1986 | 1986 | } else { |
| 1987 | - print '<input type="hidden" name="fk_user" value="' . $object->fk_user . '">'; |
|
| 1987 | + print '<input type="hidden" name="fk_user" value="'.$object->fk_user.'">'; |
|
| 1988 | 1988 | $huser = new User($db); |
| 1989 | 1989 | $huser->fetch($object->fk_user); |
| 1990 | 1990 | print $huser->getNomUrl(1); |
@@ -1997,23 +1997,23 @@ discard block |
||
| 1997 | 1997 | |
| 1998 | 1998 | |
| 1999 | 1999 | // Address |
| 2000 | - print '<tr><td class="tdtop titlefield">' . $form->editfieldkey('Address', 'address', '', $object, 0) . '</td>'; |
|
| 2000 | + print '<tr><td class="tdtop titlefield">'.$form->editfieldkey('Address', 'address', '', $object, 0).'</td>'; |
|
| 2001 | 2001 | print '<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">'; |
| 2002 | 2002 | print $object->address; |
| 2003 | 2003 | print '</textarea></td></tr>'; |
| 2004 | 2004 | |
| 2005 | 2005 | // Zip |
| 2006 | - print '<tr><td>' . $form->editfieldkey('Zip', 'zipcode', '', $object, 0) . '</td><td>'; |
|
| 2006 | + print '<tr><td>'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).'</td><td>'; |
|
| 2007 | 2007 | print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); |
| 2008 | 2008 | print '</td></tr>'; |
| 2009 | 2009 | |
| 2010 | 2010 | // Town |
| 2011 | - print '<tr><td>' . $form->editfieldkey('Town', 'town', '', $object, 0) . '</td><td>'; |
|
| 2011 | + print '<tr><td>'.$form->editfieldkey('Town', 'town', '', $object, 0).'</td><td>'; |
|
| 2012 | 2012 | print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id')); |
| 2013 | 2013 | print '</td></tr>'; |
| 2014 | 2014 | |
| 2015 | 2015 | // Country |
| 2016 | - print '<tr><td>' . $form->editfieldkey('Country', 'selectcounty_id', '', $object, 0) . '</td><td>'; |
|
| 2016 | + print '<tr><td>'.$form->editfieldkey('Country', 'selectcounty_id', '', $object, 0).'</td><td>'; |
|
| 2017 | 2017 | print $form->select_country((GETPOST('country_id') != '' ? GETPOST('country_id') : $object->country_id), 'country_id'); |
| 2018 | 2018 | if ($user->admin) { |
| 2019 | 2019 | print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
@@ -2022,52 +2022,52 @@ discard block |
||
| 2022 | 2022 | |
| 2023 | 2023 | // State |
| 2024 | 2024 | if (empty($conf->global->USER_DISABLE_STATE)) { |
| 2025 | - print '<tr><td class="tdoverflow">' . $form->editfieldkey('State', 'state_id', '', $object, 0) . '</td><td>'; |
|
| 2025 | + print '<tr><td class="tdoverflow">'.$form->editfieldkey('State', 'state_id', '', $object, 0).'</td><td>'; |
|
| 2026 | 2026 | print $formcompany->select_state($object->state_id, $object->country_code, 'state_id'); |
| 2027 | 2027 | print '</td></tr>'; |
| 2028 | 2028 | } |
| 2029 | 2029 | |
| 2030 | 2030 | // Tel pro |
| 2031 | - print "<tr>" . '<td>' . $langs->trans("PhonePro") . '</td>'; |
|
| 2031 | + print "<tr>".'<td>'.$langs->trans("PhonePro").'</td>'; |
|
| 2032 | 2032 | print '<td>'; |
| 2033 | 2033 | if ($caneditfield && empty($object->ldap_sid)) { |
| 2034 | - print '<input size="20" type="text" name="office_phone" class="flat" value="' . $object->office_phone . '">'; |
|
| 2034 | + print '<input size="20" type="text" name="office_phone" class="flat" value="'.$object->office_phone.'">'; |
|
| 2035 | 2035 | } else { |
| 2036 | - print '<input type="hidden" name="office_phone" value="' . $object->office_phone . '">'; |
|
| 2036 | + print '<input type="hidden" name="office_phone" value="'.$object->office_phone.'">'; |
|
| 2037 | 2037 | print $object->office_phone; |
| 2038 | 2038 | } |
| 2039 | 2039 | print '</td></tr>'; |
| 2040 | 2040 | |
| 2041 | 2041 | // Tel mobile |
| 2042 | - print "<tr>" . '<td>' . $langs->trans("PhoneMobile") . '</td>'; |
|
| 2042 | + print "<tr>".'<td>'.$langs->trans("PhoneMobile").'</td>'; |
|
| 2043 | 2043 | print '<td>'; |
| 2044 | 2044 | if ($caneditfield && empty($object->ldap_sid)) { |
| 2045 | - print '<input size="20" type="text" name="user_mobile" class="flat" value="' . $object->user_mobile . '">'; |
|
| 2045 | + print '<input size="20" type="text" name="user_mobile" class="flat" value="'.$object->user_mobile.'">'; |
|
| 2046 | 2046 | } else { |
| 2047 | - print '<input type="hidden" name="user_mobile" value="' . $object->user_mobile . '">'; |
|
| 2047 | + print '<input type="hidden" name="user_mobile" value="'.$object->user_mobile.'">'; |
|
| 2048 | 2048 | print $object->user_mobile; |
| 2049 | 2049 | } |
| 2050 | 2050 | print '</td></tr>'; |
| 2051 | 2051 | |
| 2052 | 2052 | // Fax |
| 2053 | - print "<tr>" . '<td>' . $langs->trans("Fax") . '</td>'; |
|
| 2053 | + print "<tr>".'<td>'.$langs->trans("Fax").'</td>'; |
|
| 2054 | 2054 | print '<td>'; |
| 2055 | 2055 | if ($caneditfield && empty($object->ldap_sid)) { |
| 2056 | - print '<input size="20" type="text" name="office_fax" class="flat" value="' . $object->office_fax . '">'; |
|
| 2056 | + print '<input size="20" type="text" name="office_fax" class="flat" value="'.$object->office_fax.'">'; |
|
| 2057 | 2057 | } else { |
| 2058 | - print '<input type="hidden" name="office_fax" value="' . $object->office_fax . '">'; |
|
| 2058 | + print '<input type="hidden" name="office_fax" value="'.$object->office_fax.'">'; |
|
| 2059 | 2059 | print $object->office_fax; |
| 2060 | 2060 | } |
| 2061 | 2061 | print '</td></tr>'; |
| 2062 | 2062 | |
| 2063 | 2063 | // Skype |
| 2064 | 2064 | if (!empty($conf->socialnetworks->enabled)) { |
| 2065 | - print '<tr><td>' . $langs->trans("Skype") . '</td>'; |
|
| 2065 | + print '<tr><td>'.$langs->trans("Skype").'</td>'; |
|
| 2066 | 2066 | print '<td>'; |
| 2067 | 2067 | if ($caneditfield && empty($object->ldap_sid)) { |
| 2068 | - print '<input size="40" type="text" name="skype" class="flat" value="' . $object->skype . '">'; |
|
| 2068 | + print '<input size="40" type="text" name="skype" class="flat" value="'.$object->skype.'">'; |
|
| 2069 | 2069 | } else { |
| 2070 | - print '<input type="hidden" name="skype" value="' . $object->skype . '">'; |
|
| 2070 | + print '<input type="hidden" name="skype" value="'.$object->skype.'">'; |
|
| 2071 | 2071 | print $object->skype; |
| 2072 | 2072 | } |
| 2073 | 2073 | print '</td></tr>'; |
@@ -2075,12 +2075,12 @@ discard block |
||
| 2075 | 2075 | |
| 2076 | 2076 | |
| 2077 | 2077 | if (!empty($conf->socialnetworks->enabled)) { |
| 2078 | - print '<tr><td>' . $langs->trans("Twitter") . '</td>'; |
|
| 2078 | + print '<tr><td>'.$langs->trans("Twitter").'</td>'; |
|
| 2079 | 2079 | print '<td>'; |
| 2080 | 2080 | if ($caneditfield && empty($object->ldap_sid)) { |
| 2081 | - print '<input size="40" type="text" name="twitter" class="flat" value="' . $object->twitter . '">'; |
|
| 2081 | + print '<input size="40" type="text" name="twitter" class="flat" value="'.$object->twitter.'">'; |
|
| 2082 | 2082 | } else { |
| 2083 | - print '<input type="hidden" name="twitter" value="' . $object->twitter . '">'; |
|
| 2083 | + print '<input type="hidden" name="twitter" value="'.$object->twitter.'">'; |
|
| 2084 | 2084 | print $object->twitter; |
| 2085 | 2085 | } |
| 2086 | 2086 | print '</td></tr>'; |
@@ -2088,36 +2088,36 @@ discard block |
||
| 2088 | 2088 | |
| 2089 | 2089 | // Skype |
| 2090 | 2090 | if (!empty($conf->socialnetworks->enabled)) { |
| 2091 | - print '<tr><td>' . $langs->trans("Facebook") . '</td>'; |
|
| 2091 | + print '<tr><td>'.$langs->trans("Facebook").'</td>'; |
|
| 2092 | 2092 | print '<td>'; |
| 2093 | 2093 | if ($caneditfield && empty($object->ldap_sid)) { |
| 2094 | - print '<input size="40" type="text" name="facebook" class="flat" value="' . $object->facebook . '">'; |
|
| 2094 | + print '<input size="40" type="text" name="facebook" class="flat" value="'.$object->facebook.'">'; |
|
| 2095 | 2095 | } else { |
| 2096 | - print '<input type="hidden" name="facebook" value="' . $object->facebook . '">'; |
|
| 2096 | + print '<input type="hidden" name="facebook" value="'.$object->facebook.'">'; |
|
| 2097 | 2097 | print $object->facebook; |
| 2098 | 2098 | } |
| 2099 | 2099 | print '</td></tr>'; |
| 2100 | 2100 | } |
| 2101 | 2101 | |
| 2102 | 2102 | |
| 2103 | - print "<tr>" . '<td' . (!empty($conf->global->USER_MAIL_REQUIRED) ? ' class="fieldrequired"' : '') . '>' . $langs->trans("EMail") . '</td>'; |
|
| 2103 | + print "<tr>".'<td'.(!empty($conf->global->USER_MAIL_REQUIRED) ? ' class="fieldrequired"' : '').'>'.$langs->trans("EMail").'</td>'; |
|
| 2104 | 2104 | print '<td>'; |
| 2105 | 2105 | if ($caneditfield && empty($object->ldap_sid)) { |
| 2106 | - print '<input class="minwidth100" type="text" name="email" class="flat" value="' . $object->email . '">'; |
|
| 2106 | + print '<input class="minwidth100" type="text" name="email" class="flat" value="'.$object->email.'">'; |
|
| 2107 | 2107 | } else { |
| 2108 | - print '<input type="hidden" name="email" value="' . $object->email . '">'; |
|
| 2108 | + print '<input type="hidden" name="email" value="'.$object->email.'">'; |
|
| 2109 | 2109 | print $object->email; |
| 2110 | 2110 | } |
| 2111 | 2111 | print '</td></tr>'; |
| 2112 | 2112 | |
| 2113 | 2113 | // OpenID url |
| 2114 | 2114 | if (isset($conf->file->main_authentication) && preg_match('/openid/', $conf->file->main_authentication) && !empty($conf->global->MAIN_OPENIDURL_PERUSER)) { |
| 2115 | - print "<tr>" . '<td>' . $langs->trans("OpenIDURL") . '</td>'; |
|
| 2115 | + print "<tr>".'<td>'.$langs->trans("OpenIDURL").'</td>'; |
|
| 2116 | 2116 | print '<td>'; |
| 2117 | 2117 | if ($caneditfield) { |
| 2118 | - print '<input class="minwidth100" type="url" name="openid" class="flat" value="' . $object->openid . '">'; |
|
| 2118 | + print '<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.'">'; |
|
| 2119 | 2119 | } else { |
| 2120 | - print '<input type="hidden" name="openid" value="' . $object->openid . '">'; |
|
| 2120 | + print '<input type="hidden" name="openid" value="'.$object->openid.'">'; |
|
| 2121 | 2121 | print $object->openid; |
| 2122 | 2122 | } |
| 2123 | 2123 | print '</td></tr>'; |
@@ -2128,12 +2128,12 @@ discard block |
||
| 2128 | 2128 | // Accountancy code |
| 2129 | 2129 | if ($conf->accounting->enabled) { |
| 2130 | 2130 | print "<tr>"; |
| 2131 | - print '<td>' . $langs->trans("AccountancyCode") . '</td>'; |
|
| 2131 | + print '<td>'.$langs->trans("AccountancyCode").'</td>'; |
|
| 2132 | 2132 | print '<td>'; |
| 2133 | 2133 | if ($caneditfield) { |
| 2134 | - print '<input size="30" type="text" class="flat" name="accountancy_code" value="' . $object->accountancy_code . '">'; |
|
| 2134 | + print '<input size="30" type="text" class="flat" name="accountancy_code" value="'.$object->accountancy_code.'">'; |
|
| 2135 | 2135 | } else { |
| 2136 | - print '<input type="hidden" name="accountancy_code" value="' . $object->accountancy_code . '">'; |
|
| 2136 | + print '<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.'">'; |
|
| 2137 | 2137 | print $object->accountancy_code; |
| 2138 | 2138 | } |
| 2139 | 2139 | print '</td>'; |
@@ -2142,7 +2142,7 @@ discard block |
||
| 2142 | 2142 | |
| 2143 | 2143 | // User color |
| 2144 | 2144 | if (!empty($conf->agenda->enabled)) { |
| 2145 | - print '<tr><td>' . $langs->trans("ColorUser") . '</td>'; |
|
| 2145 | + print '<tr><td>'.$langs->trans("ColorUser").'</td>'; |
|
| 2146 | 2146 | print '<td>'; |
| 2147 | 2147 | if ($caneditfield) { |
| 2148 | 2148 | print $formother->selectColor(GETPOST('color') ? GETPOST('color') : $object->color, 'color', null, 1, '', 'hideifnotset'); |
@@ -2154,7 +2154,7 @@ discard block |
||
| 2154 | 2154 | |
| 2155 | 2155 | // Photo |
| 2156 | 2156 | print '<tr>'; |
| 2157 | - print '<td>' . $langs->trans("Photo") . '</td>'; |
|
| 2157 | + print '<td>'.$langs->trans("Photo").'</td>'; |
|
| 2158 | 2158 | print '<td>'; |
| 2159 | 2159 | print $form->showphoto('userphoto', $object, 60, 0, $caneditfield, 'photowithmargin', 'small'); |
| 2160 | 2160 | print '</td>'; |
@@ -2162,7 +2162,7 @@ discard block |
||
| 2162 | 2162 | |
| 2163 | 2163 | // Categories |
| 2164 | 2164 | if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { |
| 2165 | - print '<tr><td>' . $form->editfieldkey('Categories', 'usercats', '', $object, 0) . '</td>'; |
|
| 2165 | + print '<tr><td>'.$form->editfieldkey('Categories', 'usercats', '', $object, 0).'</td>'; |
|
| 2166 | 2166 | print '<td>'; |
| 2167 | 2167 | $cate_arbo = $form->select_all_categories(Categorie::TYPE_USER, null, null, null, null, 1); |
| 2168 | 2168 | $c = new Categorie($db); |
@@ -2179,14 +2179,14 @@ discard block |
||
| 2179 | 2179 | } |
| 2180 | 2180 | |
| 2181 | 2181 | // Status |
| 2182 | - print '<tr><td>' . $langs->trans("Status") . '</td>'; |
|
| 2182 | + print '<tr><td>'.$langs->trans("Status").'</td>'; |
|
| 2183 | 2183 | print '<td>'; |
| 2184 | 2184 | print $object->getLibStatut(4); |
| 2185 | 2185 | print '</td></tr>'; |
| 2186 | 2186 | |
| 2187 | 2187 | // Company / Contact |
| 2188 | 2188 | if (!empty($conf->societe->enabled)) { |
| 2189 | - print '<tr><td width="25%">' . $langs->trans("LinkToCompanyContact") . '</td>'; |
|
| 2189 | + print '<tr><td width="25%">'.$langs->trans("LinkToCompanyContact").'</td>'; |
|
| 2190 | 2190 | print '<td>'; |
| 2191 | 2191 | if ($object->socid > 0) { |
| 2192 | 2192 | $societe = new Societe($db); |
@@ -2195,12 +2195,12 @@ discard block |
||
| 2195 | 2195 | if ($object->contactid) { |
| 2196 | 2196 | $contact = new Contact($db); |
| 2197 | 2197 | $contact->fetch($object->contactid); |
| 2198 | - print ' / <a href="' . BASE_URI . '?controller=contact&method=card&id=' . $object->contactid . '">' . img_object($langs->trans("ShowContact"), 'contact') . ' ' . dol_trunc($contact->getFullName($langs), 32) . '</a>'; |
|
| 2198 | + print ' / <a href="'.BASE_URI.'?controller=contact&method=card&id='.$object->contactid.'">'.img_object($langs->trans("ShowContact"), 'contact').' '.dol_trunc($contact->getFullName($langs), 32).'</a>'; |
|
| 2199 | 2199 | } |
| 2200 | 2200 | } else { |
| 2201 | 2201 | print $langs->trans("ThisUserIsNot"); |
| 2202 | 2202 | } |
| 2203 | - print ' (' . $langs->trans("UseTypeFieldToChange") . ')'; |
|
| 2203 | + print ' ('.$langs->trans("UseTypeFieldToChange").')'; |
|
| 2204 | 2204 | print '</td>'; |
| 2205 | 2205 | print "</tr>\n"; |
| 2206 | 2206 | } |
@@ -2208,7 +2208,7 @@ discard block |
||
| 2208 | 2208 | // Module Adherent |
| 2209 | 2209 | if (!empty($conf->adherent->enabled)) { |
| 2210 | 2210 | $langs->load("members"); |
| 2211 | - print '<tr><td width="25%">' . $langs->trans("LinkedToDolibarrMember") . '</td>'; |
|
| 2211 | + print '<tr><td width="25%">'.$langs->trans("LinkedToDolibarrMember").'</td>'; |
|
| 2212 | 2212 | print '<td>'; |
| 2213 | 2213 | if ($object->fk_member) { |
| 2214 | 2214 | $adh = new Adherent($db); |
@@ -2228,18 +2228,18 @@ discard block |
||
| 2228 | 2228 | // This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module |
| 2229 | 2229 | if (!method_exists($mc, 'formObjectOptions')) { |
| 2230 | 2230 | if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && !$user->entity) { |
| 2231 | - print "<tr>" . '<td>' . $langs->trans("Entity") . '</td>'; |
|
| 2232 | - print "<td>" . $mc->select_entities($object->entity, 'entity', '', 0, 1); // last parameter 1 means, show also a choice 0=>'all entities' |
|
| 2231 | + print "<tr>".'<td>'.$langs->trans("Entity").'</td>'; |
|
| 2232 | + print "<td>".$mc->select_entities($object->entity, 'entity', '', 0, 1); // last parameter 1 means, show also a choice 0=>'all entities' |
|
| 2233 | 2233 | print "</td></tr>\n"; |
| 2234 | 2234 | } else { |
| 2235 | - print '<input type="hidden" name="entity" value="' . $conf->entity . '" />'; |
|
| 2235 | + print '<input type="hidden" name="entity" value="'.$conf->entity.'" />'; |
|
| 2236 | 2236 | } |
| 2237 | 2237 | } |
| 2238 | 2238 | } |
| 2239 | 2239 | |
| 2240 | 2240 | // Other attributes |
| 2241 | 2241 | $parameters = array('colspan' => ' colspan="2"'); |
| 2242 | - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 2242 | + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 2243 | 2243 | print $hookmanager->resPrint; |
| 2244 | 2244 | if (empty($reshook)) { |
| 2245 | 2245 | if ($caneditfield) { |
@@ -2250,10 +2250,10 @@ discard block |
||
| 2250 | 2250 | } |
| 2251 | 2251 | |
| 2252 | 2252 | // Signature |
| 2253 | - print "<tr>" . '<td class="tdtop">' . $langs->trans("Signature") . '</td>'; |
|
| 2253 | + print "<tr>".'<td class="tdtop">'.$langs->trans("Signature").'</td>'; |
|
| 2254 | 2254 | print '<td>'; |
| 2255 | 2255 | if ($caneditfield) { |
| 2256 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
| 2256 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
| 2257 | 2257 | $doleditor = new DolEditor('signature', $object->signature, '', 138, 'dolibarr_notes', 'In', false, true, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4, '90%'); |
| 2258 | 2258 | print $doleditor->Create(1); |
| 2259 | 2259 | } else { |
@@ -2267,12 +2267,12 @@ discard block |
||
| 2267 | 2267 | |
| 2268 | 2268 | // TODO Move this into tab RH (HierarchicalResponsible must be on both tab) |
| 2269 | 2269 | // Position/Job |
| 2270 | - print '<tr><td class="titlefield">' . $langs->trans("PostOrFunction") . '</td>'; |
|
| 2270 | + print '<tr><td class="titlefield">'.$langs->trans("PostOrFunction").'</td>'; |
|
| 2271 | 2271 | print '<td>'; |
| 2272 | 2272 | if ($caneditfield) { |
| 2273 | - print '<input size="30" type="text" name="job" value="' . $object->job . '">'; |
|
| 2273 | + print '<input size="30" type="text" name="job" value="'.$object->job.'">'; |
|
| 2274 | 2274 | } else { |
| 2275 | - print '<input type="hidden" name="job" value="' . $object->job . '">'; |
|
| 2275 | + print '<input type="hidden" name="job" value="'.$object->job.'">'; |
|
| 2276 | 2276 | print $object->job; |
| 2277 | 2277 | } |
| 2278 | 2278 | print '</td></tr>'; |
@@ -2287,7 +2287,7 @@ discard block |
||
| 2287 | 2287 | print '</td>'; |
| 2288 | 2288 | print '<td>'; |
| 2289 | 2289 | if ($caneditfield) { |
| 2290 | - print '<input size="8" type="text" name="thm" value="' . price2num(GETPOST('thm') ? GETPOST('thm') : $object->thm) . '">'; |
|
| 2290 | + print '<input size="8" type="text" name="thm" value="'.price2num(GETPOST('thm') ? GETPOST('thm') : $object->thm).'">'; |
|
| 2291 | 2291 | } else { |
| 2292 | 2292 | print ($object->thm != '' ? price($object->thm, '', $langs, 1, -1, -1, $conf->currency) : ''); |
| 2293 | 2293 | } |
@@ -2301,7 +2301,7 @@ discard block |
||
| 2301 | 2301 | print '</td>'; |
| 2302 | 2302 | print '<td>'; |
| 2303 | 2303 | if ($caneditfield) { |
| 2304 | - print '<input size="8" type="text" name="tjm" value="' . price2num(GETPOST('tjm') ? GETPOST('tjm') : $object->tjm) . '">'; |
|
| 2304 | + print '<input size="8" type="text" name="tjm" value="'.price2num(GETPOST('tjm') ? GETPOST('tjm') : $object->tjm).'">'; |
|
| 2305 | 2305 | } else { |
| 2306 | 2306 | print ($object->tjm != '' ? price($object->tjm, '', $langs, 1, -1, -1, $conf->currency) : ''); |
| 2307 | 2307 | } |
@@ -2309,18 +2309,18 @@ discard block |
||
| 2309 | 2309 | print "</tr>\n"; |
| 2310 | 2310 | |
| 2311 | 2311 | // Salary |
| 2312 | - print '<tr><td>' . $langs->trans("Salary") . '</td>'; |
|
| 2312 | + print '<tr><td>'.$langs->trans("Salary").'</td>'; |
|
| 2313 | 2313 | print '<td>'; |
| 2314 | - print '<input size="8" type="text" name="salary" value="' . price2num(GETPOST('salary') ? GETPOST('salary') : $object->salary) . '">'; |
|
| 2314 | + print '<input size="8" type="text" name="salary" value="'.price2num(GETPOST('salary') ? GETPOST('salary') : $object->salary).'">'; |
|
| 2315 | 2315 | print '</td>'; |
| 2316 | 2316 | print "</tr>\n"; |
| 2317 | 2317 | } |
| 2318 | 2318 | |
| 2319 | 2319 | // Weeklyhours |
| 2320 | - print '<tr><td>' . $langs->trans("WeeklyHours") . '</td>'; |
|
| 2320 | + print '<tr><td>'.$langs->trans("WeeklyHours").'</td>'; |
|
| 2321 | 2321 | print '<td>'; |
| 2322 | 2322 | if ($caneditfield) { |
| 2323 | - print '<input size="8" type="text" name="weeklyhours" value="' . price2num(GETPOST('weeklyhours') ? GETPOST('weeklyhours') : $object->weeklyhours) . '">'; |
|
| 2323 | + print '<input size="8" type="text" name="weeklyhours" value="'.price2num(GETPOST('weeklyhours') ? GETPOST('weeklyhours') : $object->weeklyhours).'">'; |
|
| 2324 | 2324 | } else { |
| 2325 | 2325 | print price2num($object->weeklyhours); |
| 2326 | 2326 | } |
@@ -2328,7 +2328,7 @@ discard block |
||
| 2328 | 2328 | print "</tr>\n"; |
| 2329 | 2329 | |
| 2330 | 2330 | // Date employment |
| 2331 | - print '<tr><td>' . $langs->trans("DateEmployment") . '</td>'; |
|
| 2331 | + print '<tr><td>'.$langs->trans("DateEmployment").'</td>'; |
|
| 2332 | 2332 | print '<td>'; |
| 2333 | 2333 | if ($caneditfield) { |
| 2334 | 2334 | print $form->selectDate(GETPOST('dateemployment') ? GETPOST('dateemployment') : $object->dateemployment, 'dateemployment', 0, 0, 1, 'formdateemployment', 1, 0); |
@@ -2339,7 +2339,7 @@ discard block |
||
| 2339 | 2339 | print "</tr>\n"; |
| 2340 | 2340 | |
| 2341 | 2341 | // Date employmentEnd |
| 2342 | - print '<tr><td>' . $langs->trans("DateEmploymentEnd") . '</td>'; |
|
| 2342 | + print '<tr><td>'.$langs->trans("DateEmploymentEnd").'</td>'; |
|
| 2343 | 2343 | print '<td>'; |
| 2344 | 2344 | if ($caneditfield) { |
| 2345 | 2345 | print $form->selectDate(GETPOST('dateemploymentend') ? GETPOST('dateemploymentend') : $object->dateemploymentend, 'dateemploymentend', 0, 0, 1, 'formdateemploymentend', 1, 0); |
@@ -2351,7 +2351,7 @@ discard block |
||
| 2351 | 2351 | |
| 2352 | 2352 | |
| 2353 | 2353 | // Date birth |
| 2354 | - print '<tr><td>' . $langs->trans("DateToBirth") . '</td>'; |
|
| 2354 | + print '<tr><td>'.$langs->trans("DateToBirth").'</td>'; |
|
| 2355 | 2355 | print '<td>'; |
| 2356 | 2356 | if ($caneditfield) { |
| 2357 | 2357 | echo $form->selectDate(GETPOST('birth') ? GETPOST('birth') : $object->birth, 'birth', 0, 0, 1, 'updateuser', 1, 0); |
@@ -2366,9 +2366,9 @@ discard block |
||
| 2366 | 2366 | dol_fiche_end(); |
| 2367 | 2367 | |
| 2368 | 2368 | print '<div align="center">'; |
| 2369 | - print '<input value="' . $langs->trans("Save") . '" class="button" type="submit" name="save">'; |
|
| 2369 | + print '<input value="'.$langs->trans("Save").'" class="button" type="submit" name="save">'; |
|
| 2370 | 2370 | print ' '; |
| 2371 | - print '<input value="' . $langs->trans("Cancel") . '" class="button" type="submit" name="cancel">'; |
|
| 2371 | + print '<input value="'.$langs->trans("Cancel").'" class="button" type="submit" name="cancel">'; |
|
| 2372 | 2372 | print '</div>'; |
| 2373 | 2373 | |
| 2374 | 2374 | print '</form>'; |
@@ -2380,8 +2380,8 @@ discard block |
||
| 2380 | 2380 | * Documents generes |
| 2381 | 2381 | */ |
| 2382 | 2382 | $filename = dol_sanitizeFileName($object->ref); |
| 2383 | - $filedir = $conf->user->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
| 2384 | - $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; |
|
| 2383 | + $filedir = $conf->user->dir_output."/".dol_sanitizeFileName($object->ref); |
|
| 2384 | + $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; |
|
| 2385 | 2385 | $genallowed = $user->rights->user->user->lire; |
| 2386 | 2386 | $delallowed = $user->rights->user->user->creer; |
| 2387 | 2387 | |
@@ -2395,7 +2395,7 @@ discard block |
||
| 2395 | 2395 | print '</div><div class="fichehalfright"><div class="ficheaddleft">'; |
| 2396 | 2396 | |
| 2397 | 2397 | // List of actions on element |
| 2398 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; |
|
| 2398 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; |
|
| 2399 | 2399 | $formactions = new FormActions($db); |
| 2400 | 2400 | $somethingshown = $formactions->showactions($object, 'user', $socid, 1); |
| 2401 | 2401 | |
@@ -2410,10 +2410,10 @@ discard block |
||
| 2410 | 2410 | } |
| 2411 | 2411 | |
| 2412 | 2412 | if (!empty($conf->api->enabled) && !empty($conf->use_javascript_ajax)) { |
| 2413 | - print "\n" . '<script type="text/javascript">'; |
|
| 2413 | + print "\n".'<script type="text/javascript">'; |
|
| 2414 | 2414 | print '$(document).ready(function () { |
| 2415 | 2415 | $("#generate_api_key").click(function() { |
| 2416 | - $.get( "' . BASE_URI . '?controller=core/ajax&method=security", { |
|
| 2416 | + $.get( "' . BASE_URI.'?controller=core/ajax&method=security", { |
|
| 2417 | 2417 | action: \'getrandompassword\', |
| 2418 | 2418 | generic: true |
| 2419 | 2419 | }, |
@@ -26,11 +26,11 @@ discard block |
||
| 26 | 26 | * \file htdocs/user/perms.php |
| 27 | 27 | * \brief Onglet user et permissions de la fiche utilisateur |
| 28 | 28 | */ |
| 29 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
| 29 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
| 30 | 30 | |
| 31 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/usergroups.lib.php'; |
|
| 32 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; |
|
| 33 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; |
|
| 31 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; |
|
| 32 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
| 33 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; |
|
| 34 | 34 | |
| 35 | 35 | // Load translation files required by page |
| 36 | 36 | $langs->loadLangs(array('users', 'admin')); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $confirm = GETPOST('confirm', 'alpha'); |
| 41 | 41 | $module = GETPOST('module', 'alpha'); |
| 42 | 42 | $rights = GETPOST('rights', 'int'); |
| 43 | -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'userperms'; // To manage different context of search |
|
| 43 | +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'userperms'; // To manage different context of search |
|
| 44 | 44 | |
| 45 | 45 | if (!isset($id) || empty($id)) { |
| 46 | 46 | accessforbidden(); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * Actions |
| 88 | 88 | */ |
| 89 | 89 | $parameters = array('id' => $socid); |
| 90 | -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 90 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 91 | 91 | if ($reshook < 0) { |
| 92 | 92 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 93 | 93 | } |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | $handle = @opendir(dol_osencode($dir)); |
| 145 | 145 | if (is_resource($handle)) { |
| 146 | 146 | while (($file = readdir($handle)) !== false) { |
| 147 | - if (is_readable($dir . $file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') { |
|
| 147 | + if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') { |
|
| 148 | 148 | $modName = substr($file, 0, dol_strlen($file) - 10); |
| 149 | 149 | |
| 150 | 150 | if ($modName) { |
| 151 | - include_once $dir . $file; |
|
| 151 | + include_once $dir.$file; |
|
| 152 | 152 | $objMod = new $modName($db); |
| 153 | 153 | |
| 154 | 154 | // Load all lang files of module |
@@ -175,9 +175,9 @@ discard block |
||
| 175 | 175 | $permsuser = array(); |
| 176 | 176 | |
| 177 | 177 | $sql = "SELECT DISTINCT ur.fk_id"; |
| 178 | -$sql .= " FROM " . MAIN_DB_PREFIX . "user_rights as ur"; |
|
| 179 | -$sql .= " WHERE ur.entity = " . $entity; |
|
| 180 | -$sql .= " AND ur.fk_user = " . $object->id; |
|
| 178 | +$sql .= " FROM ".MAIN_DB_PREFIX."user_rights as ur"; |
|
| 179 | +$sql .= " WHERE ur.entity = ".$entity; |
|
| 180 | +$sql .= " AND ur.fk_user = ".$object->id; |
|
| 181 | 181 | |
| 182 | 182 | dol_syslog("get user perms", LOG_DEBUG); |
| 183 | 183 | $result = $db->query($sql); |
@@ -198,11 +198,11 @@ discard block |
||
| 198 | 198 | $permsgroupbyentity = array(); |
| 199 | 199 | |
| 200 | 200 | $sql = "SELECT DISTINCT gr.fk_id, gu.entity"; |
| 201 | -$sql .= " FROM " . MAIN_DB_PREFIX . "usergroup_rights as gr,"; |
|
| 202 | -$sql .= " " . MAIN_DB_PREFIX . "usergroup_user as gu"; |
|
| 203 | -$sql .= " WHERE gr.entity = " . $entity; |
|
| 201 | +$sql .= " FROM ".MAIN_DB_PREFIX."usergroup_rights as gr,"; |
|
| 202 | +$sql .= " ".MAIN_DB_PREFIX."usergroup_user as gu"; |
|
| 203 | +$sql .= " WHERE gr.entity = ".$entity; |
|
| 204 | 204 | $sql .= " AND gr.fk_usergroup = gu.fk_usergroup"; |
| 205 | -$sql .= " AND gu.fk_user = " . $object->id; |
|
| 205 | +$sql .= " AND gu.fk_user = ".$object->id; |
|
| 206 | 206 | |
| 207 | 207 | dol_syslog("get user perms", LOG_DEBUG); |
| 208 | 208 | $result = $db->query($sql); |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | $linkback = ''; |
| 231 | 231 | |
| 232 | 232 | if ($user->rights->user->user->lire || $user->admin) { |
| 233 | - $linkback = '<a href="' . BASE_URI . '?controller=user&method=list&restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>'; |
|
| 233 | + $linkback = '<a href="'.BASE_URI.'?controller=user&method=list&restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin); |
@@ -242,11 +242,11 @@ discard block |
||
| 242 | 242 | } |
| 243 | 243 | // Show warning about external users |
| 244 | 244 | if (empty($user->societe_id)) { |
| 245 | - print info_admin(showModulesExludedForExternal($modules)) . "\n"; |
|
| 245 | + print info_admin(showModulesExludedForExternal($modules))."\n"; |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | $parameters = array('permsgroupbyentity' => $permsgroupbyentity); |
| 249 | -$reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 249 | +$reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 250 | 250 | if ($reshook < 0) { |
| 251 | 251 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 252 | 252 | } |
@@ -256,27 +256,27 @@ discard block |
||
| 256 | 256 | print '<div class="div-table-responsive">'; |
| 257 | 257 | print '<table width="100%" class="noborder">'; |
| 258 | 258 | print '<tr class="liste_titre">'; |
| 259 | -print '<td>' . $langs->trans("Module") . '</td>'; |
|
| 259 | +print '<td>'.$langs->trans("Module").'</td>'; |
|
| 260 | 260 | if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->admin)) { |
| 261 | 261 | if ($caneditperms) { |
| 262 | 262 | print '<td align="center" class="nowrap">'; |
| 263 | - print '<a class="reposition" title="' . dol_escape_htmltag($langs->trans("All")) . '" alt="' . dol_escape_htmltag($langs->trans("All")) . '" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=addrights&entity=' . $entity . '&module=allmodules">' . $langs->trans("All") . "</a>"; |
|
| 263 | + print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&entity='.$entity.'&module=allmodules">'.$langs->trans("All")."</a>"; |
|
| 264 | 264 | print '/'; |
| 265 | - print '<a class="reposition" title="' . dol_escape_htmltag($langs->trans("None")) . '" alt="' . dol_escape_htmltag($langs->trans("None")) . '" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delrights&entity=' . $entity . '&module=allmodules">' . $langs->trans("None") . "</a>"; |
|
| 265 | + print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&entity='.$entity.'&module=allmodules">'.$langs->trans("None")."</a>"; |
|
| 266 | 266 | print '</td>'; |
| 267 | 267 | } |
| 268 | 268 | print '<td align="center" width="24"> </td>'; |
| 269 | 269 | } |
| 270 | -print '<td>' . $langs->trans("Permissions") . '</td>'; |
|
| 271 | -print '</tr>' . "\n"; |
|
| 270 | +print '<td>'.$langs->trans("Permissions").'</td>'; |
|
| 271 | +print '</tr>'."\n"; |
|
| 272 | 272 | |
| 273 | 273 | //print "xx".$conf->global->MAIN_USE_ADVANCED_PERMS; |
| 274 | 274 | $sql = "SELECT r.id, r.libelle, r.module"; |
| 275 | -$sql .= " FROM " . MAIN_DB_PREFIX . "rights_def as r"; |
|
| 276 | -$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" |
|
| 277 | -$sql .= " AND r.entity = " . $entity; |
|
| 275 | +$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r"; |
|
| 276 | +$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" |
|
| 277 | +$sql .= " AND r.entity = ".$entity; |
|
| 278 | 278 | if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { |
| 279 | - $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is disable |
|
| 279 | + $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is disable |
|
| 280 | 280 | } |
| 281 | 281 | $sql .= " ORDER BY r.module, r.id"; |
| 282 | 282 | |
@@ -303,14 +303,14 @@ discard block |
||
| 303 | 303 | |
| 304 | 304 | // Show break line |
| 305 | 305 | print '<tr class="oddeven trforbreak">'; |
| 306 | - print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">' . img_object('', $picto, 'class="pictoobjectwidth"') . ' ' . $objMod->getName(); |
|
| 307 | - print '<a name="' . $objMod->getName() . '"></a></td>'; |
|
| 306 | + print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">'.img_object('', $picto, 'class="pictoobjectwidth"').' '.$objMod->getName(); |
|
| 307 | + print '<a name="'.$objMod->getName().'"></a></td>'; |
|
| 308 | 308 | if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->admin)) { |
| 309 | 309 | if ($caneditperms) { |
| 310 | 310 | print '<td align="center" class="nowrap">'; |
| 311 | - print '<a class="reposition" title="' . dol_escape_htmltag($langs->trans("All")) . '" alt="' . dol_escape_htmltag($langs->trans("All")) . '" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=addrights&entity=' . $entity . '&module=' . $obj->module . '">' . $langs->trans("All") . "</a>"; |
|
| 311 | + print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&entity='.$entity.'&module='.$obj->module.'">'.$langs->trans("All")."</a>"; |
|
| 312 | 312 | print '/'; |
| 313 | - print '<a class="reposition" title="' . dol_escape_htmltag($langs->trans("None")) . '" alt="' . dol_escape_htmltag($langs->trans("None")) . '" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delrights&entity=' . $entity . '&module=' . $obj->module . '">' . $langs->trans("None") . "</a>"; |
|
| 313 | + print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&entity='.$entity.'&module='.$obj->module.'">'.$langs->trans("None")."</a>"; |
|
| 314 | 314 | print '</td>'; |
| 315 | 315 | } |
| 316 | 316 | } else { |
@@ -319,25 +319,25 @@ discard block |
||
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | print '<td colspan="2"> </td>'; |
| 322 | - print '</tr>' . "\n"; |
|
| 322 | + print '</tr>'."\n"; |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | print '<tr class="oddeven">'; |
| 326 | 326 | |
| 327 | 327 | // Picto and label of module |
| 328 | - print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">' . img_object('', $picto, 'class="pictoobjectwidth"') . ' ' . $objMod->getName() . '</td>'; |
|
| 328 | + print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">'.img_object('', $picto, 'class="pictoobjectwidth"').' '.$objMod->getName().'</td>'; |
|
| 329 | 329 | |
| 330 | 330 | // Permission and tick |
| 331 | 331 | if (!empty($object->admin) && !empty($objMod->rights_admin_allowed)) { // Permission granted because admin |
| 332 | 332 | if ($caneditperms) { |
| 333 | - print '<td align="center">' . img_picto($langs->trans("Administrator"), 'star') . '</td>'; |
|
| 333 | + print '<td align="center">'.img_picto($langs->trans("Administrator"), 'star').'</td>'; |
|
| 334 | 334 | } |
| 335 | 335 | print '<td align="center" class="nowrap">'; |
| 336 | 336 | print img_picto($langs->trans("Active"), 'tick'); |
| 337 | 337 | print '</td>'; |
| 338 | 338 | } else if (in_array($obj->id, $permsuser)) { // Permission granted by user |
| 339 | 339 | if ($caneditperms) { |
| 340 | - print '<td align="center"><a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delrights&entity=' . $entity . '&rights=' . $obj->id . '">' . img_edit_remove($langs->trans("Remove")) . '</a></td>'; |
|
| 340 | + print '<td align="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&entity='.$entity.'&rights='.$obj->id.'">'.img_edit_remove($langs->trans("Remove")).'</a></td>'; |
|
| 341 | 341 | } |
| 342 | 342 | print '<td align="center" class="nowrap">'; |
| 343 | 343 | print img_picto($langs->trans("Active"), 'tick'); |
@@ -355,23 +355,23 @@ discard block |
||
| 355 | 355 | } else { |
| 356 | 356 | // Do not own permission |
| 357 | 357 | if ($caneditperms) { |
| 358 | - print '<td align="center"><a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=addrights&entity=' . $entity . '&rights=' . $obj->id . '">' . img_edit_add($langs->trans("Add")) . '</a></td>'; |
|
| 358 | + print '<td align="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&entity='.$entity.'&rights='.$obj->id.'">'.img_edit_add($langs->trans("Add")).'</a></td>'; |
|
| 359 | 359 | } |
| 360 | 360 | print '<td> </td>'; |
| 361 | 361 | } |
| 362 | 362 | } else { |
| 363 | 363 | // Do not own permission |
| 364 | 364 | if ($caneditperms) { |
| 365 | - print '<td align="center"><a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=addrights&entity=' . $entity . '&rights=' . $obj->id . '">' . img_edit_add($langs->trans("Add")) . '</a></td>'; |
|
| 365 | + print '<td align="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&entity='.$entity.'&rights='.$obj->id.'">'.img_edit_add($langs->trans("Add")).'</a></td>'; |
|
| 366 | 366 | } |
| 367 | 367 | print '<td> </td>'; |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | // Label |
| 371 | - $permlabel = ($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced" . $obj->id) != ("PermissionAdvanced" . $obj->id)) ? $langs->trans("PermissionAdvanced" . $obj->id) : (($langs->trans("Permission" . $obj->id) != ("Permission" . $obj->id)) ? $langs->trans("Permission" . $obj->id) : $langs->trans($obj->libelle))); |
|
| 372 | - print '<td class="maxwidthonsmartphone">' . $permlabel . '</td>'; |
|
| 371 | + $permlabel = ($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $langs->trans($obj->libelle))); |
|
| 372 | + print '<td class="maxwidthonsmartphone">'.$permlabel.'</td>'; |
|
| 373 | 373 | |
| 374 | - print '</tr>' . "\n"; |
|
| 374 | + print '</tr>'."\n"; |
|
| 375 | 375 | |
| 376 | 376 | $i++; |
| 377 | 377 | } |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | print '</div>'; |
| 383 | 383 | |
| 384 | 384 | $parameters = array(); |
| 385 | -$reshook = $hookmanager->executeHooks('insertExtraFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 385 | +$reshook = $hookmanager->executeHooks('insertExtraFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 386 | 386 | if ($reshook < 0) { |
| 387 | 387 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 388 | 388 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $h = 0; |
| 36 | 36 | $head = array(); |
| 37 | 37 | |
| 38 | - $head[$h][0] = DOL_URL_ROOT . "/margin/admin/margin.php"; |
|
| 38 | + $head[$h][0] = DOL_URL_ROOT."/margin/admin/margin.php"; |
|
| 39 | 39 | $head[$h][1] = $langs->trans("Parameters"); |
| 40 | 40 | $head[$h][2] = 'parameters'; |
| 41 | 41 | $h++; |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | $head = array(); |
| 66 | 66 | |
| 67 | 67 | if ($user->rights->produit->lire) { |
| 68 | - $head[$h][0] = BASE_URI . '?controller=margin&method=productMargins'; |
|
| 68 | + $head[$h][0] = BASE_URI.'?controller=margin&method=productMargins'; |
|
| 69 | 69 | $head[$h][1] = $langs->trans("ProductMargins"); |
| 70 | 70 | $head[$h][2] = 'productMargins'; |
| 71 | 71 | $h++; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | if ($user->rights->societe->lire) { |
| 75 | - $head[$h][0] = BASE_URI . '?controller=margin&method=customerMargins'; |
|
| 75 | + $head[$h][0] = BASE_URI.'?controller=margin&method=customerMargins'; |
|
| 76 | 76 | $head[$h][1] = $langs->trans("CustomerMargins"); |
| 77 | 77 | $head[$h][2] = 'customerMargins'; |
| 78 | 78 | $h++; |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | //$head[$h][0] = DOL_URL_ROOT."/margin/agentMargins.php"; |
| 88 | - $head[$h][0] = BASE_URI . '?controller=margin&method=agentMargins'; |
|
| 88 | + $head[$h][0] = BASE_URI.'?controller=margin&method=agentMargins'; |
|
| 89 | 89 | $head[$h][1] = $langs->trans($title); |
| 90 | 90 | $head[$h][2] = 'agentMargins'; |
| 91 | 91 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | if ($user->rights->margins->creer) { |
| 94 | 94 | $h++; |
| 95 | 95 | //$head[$h][0] = DOL_URL_ROOT."/margin/checkMargins.php"; |
| 96 | - $head[$h][0] = BASE_URI . '?controller=margin&method=checkMargins'; |
|
| 96 | + $head[$h][0] = BASE_URI.'?controller=margin&method=checkMargins'; |
|
| 97 | 97 | $head[$h][1] = $langs->trans('CheckMargins'); |
| 98 | 98 | $head[$h][2] = 'checkMargins'; |
| 99 | 99 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $marque_tx_ret = ''; |
| 122 | 122 | |
| 123 | 123 | if ($fk_pa > 0 && empty($paht)) { |
| 124 | - require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php'; |
|
| 124 | + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; |
|
| 125 | 125 | $product = new ProductFournisseur($db); |
| 126 | 126 | if ($product->fetch_product_fournisseur_price($fk_pa)) { |
| 127 | 127 | $paht_ret = $product->fourn_unitprice * (1 - $product->fourn_remise_percent / 100); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * This script reads the conf file, init $lang, $db and and empty $user |
| 33 | 33 | */ |
| 34 | 34 | |
| 35 | -require_once 'filefunc.inc.php'; // May have been already require by main.inc.php. But may not by scripts. |
|
| 35 | +require_once 'filefunc.inc.php'; // May have been already require by main.inc.php. But may not by scripts. |
|
| 36 | 36 | |
| 37 | 37 | /* |
| 38 | 38 | * Create $conf object |
@@ -49,35 +49,35 @@ discard block |
||
| 49 | 49 | $conf->db->user = $dolibarr_main_db_user; |
| 50 | 50 | $conf->db->pass = $dolibarr_main_db_pass; |
| 51 | 51 | $conf->db->type = $dolibarr_main_db_type; |
| 52 | -$conf->db->prefix = $dolibarr_main_db_prefix; |
|
| 53 | -$conf->db->character_set = $dolibarr_main_db_character_set; |
|
| 54 | -$conf->db->dolibarr_main_db_collation = $dolibarr_main_db_collation; |
|
| 55 | -$conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption; |
|
| 56 | -$conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey; |
|
| 57 | -if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type=constant('TEST_DB_FORCE_TYPE'); // Force db type (for test purpose, by PHP unit for example) |
|
| 52 | +$conf->db->prefix = $dolibarr_main_db_prefix; |
|
| 53 | +$conf->db->character_set = $dolibarr_main_db_character_set; |
|
| 54 | +$conf->db->dolibarr_main_db_collation = $dolibarr_main_db_collation; |
|
| 55 | +$conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption; |
|
| 56 | +$conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey; |
|
| 57 | +if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type = constant('TEST_DB_FORCE_TYPE'); // Force db type (for test purpose, by PHP unit for example) |
|
| 58 | 58 | |
| 59 | 59 | // Set properties specific to conf file |
| 60 | -$conf->file->main_limit_users = $dolibarr_main_limit_users; |
|
| 60 | +$conf->file->main_limit_users = $dolibarr_main_limit_users; |
|
| 61 | 61 | $conf->file->mailing_limit_sendbyweb = $dolibarr_mailing_limit_sendbyweb; |
| 62 | 62 | $conf->file->mailing_limit_sendbycli = $dolibarr_mailing_limit_sendbycli; |
| 63 | -$conf->file->main_authentication = empty($dolibarr_main_authentication)?'':$dolibarr_main_authentication; // Identification mode |
|
| 64 | -$conf->file->main_force_https = empty($dolibarr_main_force_https)?'':$dolibarr_main_force_https; // Force https |
|
| 65 | -$conf->file->strict_mode = empty($dolibarr_strict_mode)?'':$dolibarr_strict_mode; // Force php strict mode (for debug) |
|
| 66 | -$conf->file->cookie_cryptkey = empty($dolibarr_main_cookie_cryptkey)?'':$dolibarr_main_cookie_cryptkey; // Cookie cryptkey |
|
| 67 | -$conf->file->dol_document_root = array('main' => (string) DOL_DOCUMENT_ROOT); // Define array of document root directories ('/home/htdocs') |
|
| 68 | -$conf->file->dol_url_root = array('main' => (string) DOL_URL_ROOT); // Define array of url root path ('' or '/dolibarr') |
|
| 69 | -if (! empty($dolibarr_main_document_root_alt)) |
|
| 63 | +$conf->file->main_authentication = empty($dolibarr_main_authentication) ? '' : $dolibarr_main_authentication; // Identification mode |
|
| 64 | +$conf->file->main_force_https = empty($dolibarr_main_force_https) ? '' : $dolibarr_main_force_https; // Force https |
|
| 65 | +$conf->file->strict_mode = empty($dolibarr_strict_mode) ? '' : $dolibarr_strict_mode; // Force php strict mode (for debug) |
|
| 66 | +$conf->file->cookie_cryptkey = empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey; // Cookie cryptkey |
|
| 67 | +$conf->file->dol_document_root = array('main' => (string) DOL_DOCUMENT_ROOT); // Define array of document root directories ('/home/htdocs') |
|
| 68 | +$conf->file->dol_url_root = array('main' => (string) DOL_URL_ROOT); // Define array of url root path ('' or '/dolibarr') |
|
| 69 | +if (!empty($dolibarr_main_document_root_alt)) |
|
| 70 | 70 | { |
| 71 | 71 | // dolibarr_main_document_root_alt can contains several directories |
| 72 | - $values=preg_split('/[;,]/',$dolibarr_main_document_root_alt); |
|
| 73 | - $i=0; |
|
| 72 | + $values = preg_split('/[;,]/', $dolibarr_main_document_root_alt); |
|
| 73 | + $i = 0; |
|
| 74 | 74 | foreach ($values as $value) |
| 75 | - $conf->file->dol_document_root['alt' . ($i++)] = (string)$value; |
|
| 76 | - $values=preg_split('/[;,]/',$dolibarr_main_url_root_alt); |
|
| 77 | - $i=0; |
|
| 78 | - foreach($values as $value) |
|
| 75 | + $conf->file->dol_document_root['alt'.($i++)] = (string) $value; |
|
| 76 | + $values = preg_split('/[;,]/', $dolibarr_main_url_root_alt); |
|
| 77 | + $i = 0; |
|
| 78 | + foreach ($values as $value) |
|
| 79 | 79 | { |
| 80 | - if (preg_match('/^http(s)?:/',$value)) |
|
| 80 | + if (preg_match('/^http(s)?:/', $value)) |
|
| 81 | 81 | { |
| 82 | 82 | // Show error message |
| 83 | 83 | $correct_value = str_replace($dolibarr_main_url_root, '', $value); |
@@ -93,46 +93,46 @@ discard block |
||
| 93 | 93 | print "\"/custom\"<br>\n"; |
| 94 | 94 | exit; |
| 95 | 95 | } |
| 96 | - $conf->file->dol_url_root['alt'.($i++)]=(string) $value; |
|
| 96 | + $conf->file->dol_url_root['alt'.($i++)] = (string) $value; |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // Chargement des includes principaux de librairies communes |
| 101 | -if (! defined('NOREQUIREUSER')) require_once DOL_DOCUMENT_ROOT .'/user/class/user.class.php'; // Need 500ko memory |
|
| 102 | -if (! defined('NOREQUIRETRAN')) require_once DOL_DOCUMENT_ROOT .'/core/class/translate.class.php'; |
|
| 103 | -if (! defined('NOREQUIRESOC')) require_once DOL_DOCUMENT_ROOT .'/societe/class/societe.class.php'; |
|
| 101 | +if (!defined('NOREQUIREUSER')) require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; // Need 500ko memory |
|
| 102 | +if (!defined('NOREQUIRETRAN')) require_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; |
|
| 103 | +if (!defined('NOREQUIRESOC')) require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
|
| 104 | 104 | |
| 105 | 105 | |
| 106 | 106 | /* |
| 107 | 107 | * Creation objet $langs (must be before all other code) |
| 108 | 108 | */ |
| 109 | -if (! defined('NOREQUIRETRAN')) |
|
| 109 | +if (!defined('NOREQUIRETRAN')) |
|
| 110 | 110 | { |
| 111 | - $langs = new Translate('',$conf); // Must be after reading conf |
|
| 111 | + $langs = new Translate('', $conf); // Must be after reading conf |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /* |
| 115 | 115 | * Object $db |
| 116 | 116 | */ |
| 117 | -if (! defined('NOREQUIREDB')) |
|
| 117 | +if (!defined('NOREQUIREDB')) |
|
| 118 | 118 | { |
| 119 | - $db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port); |
|
| 119 | + $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port); |
|
| 120 | 120 | |
| 121 | 121 | if ($db->error) |
| 122 | 122 | { |
| 123 | - dol_print_error($db,"host=".$conf->db->host.", port=".$conf->db->port.", user=".$conf->db->user.", databasename=".$conf->db->name.", ".$db->error); |
|
| 123 | + dol_print_error($db, "host=".$conf->db->host.", port=".$conf->db->port.", user=".$conf->db->user.", databasename=".$conf->db->name.", ".$db->error); |
|
| 124 | 124 | exit; |
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | // Now database connexion is known, so we can forget password |
| 129 | 129 | //unset($dolibarr_main_db_pass); // We comment this because this constant is used in a lot of pages |
| 130 | -unset($conf->db->pass); // This is to avoid password to be shown in memory/swap dump |
|
| 130 | +unset($conf->db->pass); // This is to avoid password to be shown in memory/swap dump |
|
| 131 | 131 | |
| 132 | 132 | /* |
| 133 | 133 | * Object $user |
| 134 | 134 | */ |
| 135 | -if (! defined('NOREQUIREUSER')) |
|
| 135 | +if (!defined('NOREQUIREUSER')) |
|
| 136 | 136 | { |
| 137 | 137 | $user = new User($db); |
| 138 | 138 | } |
@@ -143,17 +143,17 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | |
| 145 | 145 | // By default conf->entity is 1, but we change this if we ask another value. |
| 146 | -if (session_id() && ! empty($_SESSION["dol_entity"])) // Entity inside an opened session |
|
| 146 | +if (session_id() && !empty($_SESSION["dol_entity"])) // Entity inside an opened session |
|
| 147 | 147 | { |
| 148 | 148 | $conf->entity = $_SESSION["dol_entity"]; |
| 149 | 149 | } |
| 150 | -else if (! empty($_ENV["dol_entity"])) // Entity inside a CLI script |
|
| 150 | +else if (!empty($_ENV["dol_entity"])) // Entity inside a CLI script |
|
| 151 | 151 | { |
| 152 | 152 | $conf->entity = $_ENV["dol_entity"]; |
| 153 | 153 | } |
| 154 | -else if (isset($_POST["loginfunction"]) && GETPOST("entity",'int')) // Just after a login page |
|
| 154 | +else if (isset($_POST["loginfunction"]) && GETPOST("entity", 'int')) // Just after a login page |
|
| 155 | 155 | { |
| 156 | - $conf->entity = GETPOST("entity",'int'); |
|
| 156 | + $conf->entity = GETPOST("entity", 'int'); |
|
| 157 | 157 | } |
| 158 | 158 | else if (defined('DOLENTITY') && is_numeric(DOLENTITY)) // For public page with MultiCompany module |
| 159 | 159 | { |
@@ -161,9 +161,9 @@ discard block |
||
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | // Sanitize entity |
| 164 | -if (! is_numeric($conf->entity)) $conf->entity=1; |
|
| 164 | +if (!is_numeric($conf->entity)) $conf->entity = 1; |
|
| 165 | 165 | |
| 166 | -if (! defined('NOREQUIREDB')) |
|
| 166 | +if (!defined('NOREQUIREDB')) |
|
| 167 | 167 | { |
| 168 | 168 | //print "Will work with data into entity instance number '".$conf->entity."'"; |
| 169 | 169 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // Overwrite database value |
| 175 | -if (! empty($conf->file->mailing_limit_sendbyweb)) |
|
| 175 | +if (!empty($conf->file->mailing_limit_sendbyweb)) |
|
| 176 | 176 | { |
| 177 | 177 | $conf->global->MAILING_LIMIT_SENDBYWEB = $conf->file->mailing_limit_sendbyweb; |
| 178 | 178 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | { |
| 181 | 181 | $conf->global->MAILING_LIMIT_SENDBYWEB = 25; |
| 182 | 182 | } |
| 183 | -if (! empty($conf->file->mailing_limit_sendbycli)) |
|
| 183 | +if (!empty($conf->file->mailing_limit_sendbycli)) |
|
| 184 | 184 | { |
| 185 | 185 | $conf->global->MAILING_LIMIT_SENDBYCLI = $conf->file->mailing_limit_sendbycli; |
| 186 | 186 | } |
@@ -190,27 +190,27 @@ discard block |
||
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | // If software has been locked. Only login $conf->global->MAIN_ONLY_LOGIN_ALLOWED is allowed. |
| 193 | -if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) |
|
| 194 | -{ |
|
| 195 | - $ok=0; |
|
| 196 | - if ((! session_id() || ! isset($_SESSION["dol_login"])) && ! isset($_POST["username"]) && ! empty($_SERVER["GATEWAY_INTERFACE"])) $ok=1; // We let working pages if not logged and inside a web browser (login form, to allow login by admin) |
|
| 197 | - elseif (isset($_POST["username"]) && $_POST["username"] == $conf->global->MAIN_ONLY_LOGIN_ALLOWED) $ok=1; // We let working pages that is a login submission (login submit, to allow login by admin) |
|
| 198 | - elseif (defined('NOREQUIREDB')) $ok=1; // We let working pages that don't need database access (xxx.css.php) |
|
| 199 | - elseif (defined('EVEN_IF_ONLY_LOGIN_ALLOWED')) $ok=1; // We let working pages that ask to work even if only login enabled (logout.php) |
|
| 200 | - elseif (session_id() && isset($_SESSION["dol_login"]) && $_SESSION["dol_login"] == $conf->global->MAIN_ONLY_LOGIN_ALLOWED) $ok=1; // We let working if user is allowed admin |
|
| 201 | - if (! $ok) |
|
| 193 | +if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) |
|
| 194 | +{ |
|
| 195 | + $ok = 0; |
|
| 196 | + if ((!session_id() || !isset($_SESSION["dol_login"])) && !isset($_POST["username"]) && !empty($_SERVER["GATEWAY_INTERFACE"])) $ok = 1; // We let working pages if not logged and inside a web browser (login form, to allow login by admin) |
|
| 197 | + elseif (isset($_POST["username"]) && $_POST["username"] == $conf->global->MAIN_ONLY_LOGIN_ALLOWED) $ok = 1; // We let working pages that is a login submission (login submit, to allow login by admin) |
|
| 198 | + elseif (defined('NOREQUIREDB')) $ok = 1; // We let working pages that don't need database access (xxx.css.php) |
|
| 199 | + elseif (defined('EVEN_IF_ONLY_LOGIN_ALLOWED')) $ok = 1; // We let working pages that ask to work even if only login enabled (logout.php) |
|
| 200 | + elseif (session_id() && isset($_SESSION["dol_login"]) && $_SESSION["dol_login"] == $conf->global->MAIN_ONLY_LOGIN_ALLOWED) $ok = 1; // We let working if user is allowed admin |
|
| 201 | + if (!$ok) |
|
| 202 | 202 | { |
| 203 | 203 | if (session_id() && isset($_SESSION["dol_login"]) && $_SESSION["dol_login"] != $conf->global->MAIN_ONLY_LOGIN_ALLOWED) |
| 204 | 204 | { |
| 205 | 205 | print 'Sorry, your application is offline.'."\n"; |
| 206 | 206 | print 'You are logged with user "'.$_SESSION["dol_login"].'" and only administrator user "'.$conf->global->MAIN_ONLY_LOGIN_ALLOWED.'" is allowed to connect for the moment.'."\n"; |
| 207 | - $nexturl = BASE_URI . '?controller=user&method=logout'; |
|
| 207 | + $nexturl = BASE_URI.'?controller=user&method=logout'; |
|
| 208 | 208 | print 'Please try later or <a href="'.$nexturl.'">click here to disconnect and change login user</a>...'."\n"; |
| 209 | 209 | } |
| 210 | 210 | else |
| 211 | 211 | { |
| 212 | 212 | print 'Sorry, your application is offline. Only administrator user "'.$conf->global->MAIN_ONLY_LOGIN_ALLOWED.'" is allowed to connect for the moment.'."\n"; |
| 213 | - $nexturl = BASE_URI . '/'; |
|
| 213 | + $nexturl = BASE_URI.'/'; |
|
| 214 | 214 | print 'Please try later or <a href="'.$nexturl.'">click here to change login user</a>...'."\n"; |
| 215 | 215 | } |
| 216 | 216 | exit; |
@@ -218,31 +218,31 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | // Create object $mysoc (A thirdparty object that contains properties of companies managed by Dolibarr. |
| 221 | -if (! defined('NOREQUIREDB') && ! defined('NOREQUIRESOC')) |
|
| 221 | +if (!defined('NOREQUIREDB') && !defined('NOREQUIRESOC')) |
|
| 222 | 222 | { |
| 223 | - require_once DOL_DOCUMENT_ROOT .'/societe/class/societe.class.php'; |
|
| 223 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
|
| 224 | 224 | |
| 225 | - $mysoc=new Societe($db); |
|
| 225 | + $mysoc = new Societe($db); |
|
| 226 | 226 | $mysoc->setMysoc($conf); |
| 227 | 227 | |
| 228 | 228 | // For some countries, we need to invert our address with customer address |
| 229 | - if ($mysoc->country_code == 'DE' && ! isset($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $conf->global->MAIN_INVERT_SENDER_RECIPIENT=1; |
|
| 229 | + if ($mysoc->country_code == 'DE' && !isset($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $conf->global->MAIN_INVERT_SENDER_RECIPIENT = 1; |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | |
| 233 | 233 | // Set default language (must be after the setValues setting global $conf->global->MAIN_LANG_DEFAULT. Page main.inc.php will overwrite langs->defaultlang with user value later) |
| 234 | -if (! defined('NOREQUIRETRAN')) |
|
| 234 | +if (!defined('NOREQUIRETRAN')) |
|
| 235 | 235 | { |
| 236 | - $langcode=(GETPOST('lang','aZ09')?GETPOST('lang','aZ09',1):(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT)); |
|
| 237 | - if (defined('MAIN_LANG_DEFAULT')) $langcode=constant('MAIN_LANG_DEFAULT'); |
|
| 236 | + $langcode = (GETPOST('lang', 'aZ09') ?GETPOST('lang', 'aZ09', 1) : (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT)); |
|
| 237 | + if (defined('MAIN_LANG_DEFAULT')) $langcode = constant('MAIN_LANG_DEFAULT'); |
|
| 238 | 238 | $langs->setDefaultLang($langcode); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | |
| 242 | 242 | // Create the global $hookmanager object |
| 243 | 243 | include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
| 244 | -$hookmanager=new HookManager($db); |
|
| 244 | +$hookmanager = new HookManager($db); |
|
| 245 | 245 | |
| 246 | 246 | |
| 247 | -if (! defined('MAIN_LABEL_MENTION_NPR') ) define('MAIN_LABEL_MENTION_NPR','NPR'); |
|
| 247 | +if (!defined('MAIN_LABEL_MENTION_NPR')) define('MAIN_LABEL_MENTION_NPR', 'NPR'); |
|
| 248 | 248 | |
@@ -40,26 +40,26 @@ discard block |
||
| 40 | 40 | $h = 0; |
| 41 | 41 | $head = array(); |
| 42 | 42 | |
| 43 | - $head[$h][0] = BASE_URI . "?controller=product&method=card&id=" . $object->id; |
|
| 43 | + $head[$h][0] = BASE_URI."?controller=product&method=card&id=".$object->id; |
|
| 44 | 44 | $head[$h][1] = $langs->trans("Card"); |
| 45 | 45 | $head[$h][2] = 'card'; |
| 46 | 46 | $h++; |
| 47 | 47 | |
| 48 | - if (! empty($object->status)) |
|
| 48 | + if (!empty($object->status)) |
|
| 49 | 49 | { |
| 50 | - $head[$h][0] = BASE_URI . "?controller=product&method=price&id=" . $object->id; |
|
| 50 | + $head[$h][0] = BASE_URI."?controller=product&method=price&id=".$object->id; |
|
| 51 | 51 | $head[$h][1] = $langs->trans("SellingPrices"); |
| 52 | 52 | $head[$h][2] = 'price'; |
| 53 | 53 | $h++; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if (! empty($object->status_buy) || (! empty($conf->margin->enabled) && ! empty($object->status))) // If margin is on and product on sell, we may need the cost price even if product os not on purchase |
|
| 56 | + if (!empty($object->status_buy) || (!empty($conf->margin->enabled) && !empty($object->status))) // If margin is on and product on sell, we may need the cost price even if product os not on purchase |
|
| 57 | 57 | { |
| 58 | - if ((! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) |
|
| 59 | - || (! empty($conf->margin->enabled) && $user->rights->margin->liretous) |
|
| 58 | + if ((!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) |
|
| 59 | + || (!empty($conf->margin->enabled) && $user->rights->margin->liretous) |
|
| 60 | 60 | ) |
| 61 | 61 | { |
| 62 | - $head[$h][0] = BASE_URI . "?controller=product&method=fournisseurs&id=" . $object->id; |
|
| 62 | + $head[$h][0] = BASE_URI."?controller=product&method=fournisseurs&id=".$object->id; |
|
| 63 | 63 | $head[$h][1] = $langs->trans("BuyingPrices"); |
| 64 | 64 | $head[$h][2] = 'suppliers'; |
| 65 | 65 | $h++; |
@@ -67,32 +67,32 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | // Multilangs |
| 70 | - if (! empty($conf->global->MAIN_MULTILANGS)) |
|
| 70 | + if (!empty($conf->global->MAIN_MULTILANGS)) |
|
| 71 | 71 | { |
| 72 | - $head[$h][0] = BASE_URI . "?controller=product&method=traduction&id=" . $object->id; |
|
| 72 | + $head[$h][0] = BASE_URI."?controller=product&method=traduction&id=".$object->id; |
|
| 73 | 73 | $head[$h][1] = $langs->trans("Translation"); |
| 74 | 74 | $head[$h][2] = 'translation'; |
| 75 | 75 | $h++; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | // Sub products |
| 79 | - if (! empty($conf->global->PRODUIT_SOUSPRODUITS)) |
|
| 79 | + if (!empty($conf->global->PRODUIT_SOUSPRODUITS)) |
|
| 80 | 80 | { |
| 81 | - $head[$h][0] = BASE_URI . "?controller=product/composition&method=card&id=" . $object->id; |
|
| 81 | + $head[$h][0] = BASE_URI."?controller=product/composition&method=card&id=".$object->id; |
|
| 82 | 82 | $head[$h][1] = $langs->trans('AssociatedProducts'); |
| 83 | 83 | |
| 84 | 84 | $nbFatherAndChild = $object->hasFatherOrChild(); |
| 85 | - if ($nbFatherAndChild > 0) $head[$h][1].= ' <span class="badge">'.$nbFatherAndChild.'</span>'; |
|
| 85 | + if ($nbFatherAndChild > 0) $head[$h][1] .= ' <span class="badge">'.$nbFatherAndChild.'</span>'; |
|
| 86 | 86 | $head[$h][2] = 'subproduct'; |
| 87 | 87 | $h++; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - $head[$h][0] = BASE_URI . "?controller=product/stats&method=card&id=" . $object->id; |
|
| 90 | + $head[$h][0] = BASE_URI."?controller=product/stats&method=card&id=".$object->id; |
|
| 91 | 91 | $head[$h][1] = $langs->trans('Statistics'); |
| 92 | 92 | $head[$h][2] = 'stats'; |
| 93 | 93 | $h++; |
| 94 | 94 | |
| 95 | - $head[$h][0] = BASE_URI . "?controller=product/stats&method=facture&showmessage=1&id=" . $object->id; |
|
| 95 | + $head[$h][0] = BASE_URI."?controller=product/stats&method=facture&showmessage=1&id=".$object->id; |
|
| 96 | 96 | $head[$h][1] = $langs->trans('Referers'); |
| 97 | 97 | $head[$h][2] = 'referers'; |
| 98 | 98 | $h++; |
@@ -107,21 +107,21 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | if ($prodcomb->fetchByFkProductChild($object->id) == -1) |
| 109 | 109 | { |
| 110 | - $head[$h][0] = BASE_URI . "?controller=variants&method=combinations&id=" . $object->id; |
|
| 110 | + $head[$h][0] = BASE_URI."?controller=variants&method=combinations&id=".$object->id; |
|
| 111 | 111 | $head[$h][1] = $langs->trans('ProductCombinations'); |
| 112 | 112 | $head[$h][2] = 'combinations'; |
| 113 | 113 | $nbVariant = $prodcomb->countNbOfCombinationForFkProductParent($object->id); |
| 114 | - if ($nbVariant > 0) $head[$h][1].= ' <span class="badge">'.$nbVariant.'</span>'; |
|
| 114 | + if ($nbVariant > 0) $head[$h][1] .= ' <span class="badge">'.$nbVariant.'</span>'; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | $h++; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if ($object->isProduct() || ($object->isService() && ! empty($conf->global->STOCK_SUPPORTS_SERVICES))) // If physical product we can stock (or service with option) |
|
| 120 | + if ($object->isProduct() || ($object->isService() && !empty($conf->global->STOCK_SUPPORTS_SERVICES))) // If physical product we can stock (or service with option) |
|
| 121 | 121 | { |
| 122 | - if (! empty($conf->stock->enabled) && $user->rights->stock->lire) |
|
| 122 | + if (!empty($conf->stock->enabled) && $user->rights->stock->lire) |
|
| 123 | 123 | { |
| 124 | - $head[$h][0] = BASE_URI . "?controller=product/stock&method=product&id=" . $object->id; |
|
| 124 | + $head[$h][0] = BASE_URI."?controller=product/stock&method=product&id=".$object->id; |
|
| 125 | 125 | $head[$h][1] = $langs->trans("Stock"); |
| 126 | 126 | $head[$h][2] = 'stock'; |
| 127 | 127 | $h++; |
@@ -132,17 +132,17 @@ discard block |
||
| 132 | 132 | // Entries must be declared in modules descriptor with line |
| 133 | 133 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
| 134 | 134 | // $this->tabs = array('entity:-tabname); to remove a tab |
| 135 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'product'); |
|
| 135 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'product'); |
|
| 136 | 136 | |
| 137 | 137 | // Notes |
| 138 | 138 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
| 139 | 139 | { |
| 140 | 140 | $nbNote = 0; |
| 141 | - if(!empty($object->note_private)) $nbNote++; |
|
| 142 | - if(!empty($object->note_public)) $nbNote++; |
|
| 143 | - $head[$h][0] = BASE_URI . '?controller=product&method=note&id=' . $object->id; |
|
| 141 | + if (!empty($object->note_private)) $nbNote++; |
|
| 142 | + if (!empty($object->note_public)) $nbNote++; |
|
| 143 | + $head[$h][0] = BASE_URI.'?controller=product&method=note&id='.$object->id; |
|
| 144 | 144 | $head[$h][1] = $langs->trans('Notes'); |
| 145 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
| 145 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
| 146 | 146 | $head[$h][2] = 'note'; |
| 147 | 147 | $h++; |
| 148 | 148 | } |
@@ -150,30 +150,30 @@ discard block |
||
| 150 | 150 | // Attachments |
| 151 | 151 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
| 152 | 152 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
| 153 | - if (! empty($conf->product->enabled) && ($object->type==Product::TYPE_PRODUCT)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); |
|
| 154 | - if (! empty($conf->service->enabled) && ($object->type==Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); |
|
| 155 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
| 156 | - if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { |
|
| 157 | - if (! empty($conf->product->enabled) && ($object->type==Product::TYPE_PRODUCT)) $upload_dir = $conf->produit->multidir_output[$object->entity].'/'.get_exdir($object->id,2,0,0,$object,'product').$object->id.'/photos'; |
|
| 158 | - if (! empty($conf->service->enabled) && ($object->type==Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir($object->id,2,0,0,$object,'product').$object->id.'/photos'; |
|
| 159 | - $nbFiles += count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
| 153 | + if (!empty($conf->product->enabled) && ($object->type == Product::TYPE_PRODUCT)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); |
|
| 154 | + if (!empty($conf->service->enabled) && ($object->type == Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); |
|
| 155 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
| 156 | + if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { |
|
| 157 | + if (!empty($conf->product->enabled) && ($object->type == Product::TYPE_PRODUCT)) $upload_dir = $conf->produit->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id.'/photos'; |
|
| 158 | + if (!empty($conf->service->enabled) && ($object->type == Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id.'/photos'; |
|
| 159 | + $nbFiles += count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
| 160 | 160 | } |
| 161 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
| 162 | - $head[$h][0] = BASE_URI . '?controller=product&method=document&id=' . $object->id; |
|
| 161 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
| 162 | + $head[$h][0] = BASE_URI.'?controller=product&method=document&id='.$object->id; |
|
| 163 | 163 | $head[$h][1] = $langs->trans('Documents'); |
| 164 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
| 164 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
| 165 | 165 | $head[$h][2] = 'documents'; |
| 166 | 166 | $h++; |
| 167 | 167 | |
| 168 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'product', 'remove'); |
|
| 168 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'product', 'remove'); |
|
| 169 | 169 | |
| 170 | 170 | // Log |
| 171 | - $head[$h][0] = BASE_URI . '?controller=product&method=agenda&id=' . $object->id; |
|
| 171 | + $head[$h][0] = BASE_URI.'?controller=product&method=agenda&id='.$object->id; |
|
| 172 | 172 | $head[$h][1] = $langs->trans("Events"); |
| 173 | - if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) |
|
| 173 | + if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) |
|
| 174 | 174 | { |
| 175 | - $head[$h][1].= '/'; |
|
| 176 | - $head[$h][1].= $langs->trans("Agenda"); |
|
| 175 | + $head[$h][1] .= '/'; |
|
| 176 | + $head[$h][1] .= $langs->trans("Agenda"); |
|
| 177 | 177 | } |
| 178 | 178 | $head[$h][2] = 'agenda'; |
| 179 | 179 | $h++; |
@@ -192,12 +192,12 @@ discard block |
||
| 192 | 192 | global $db, $langs, $conf, $user; |
| 193 | 193 | |
| 194 | 194 | // Load translation files required by the page |
| 195 | - $langs->loadLangs(array("products","productbatch")); |
|
| 195 | + $langs->loadLangs(array("products", "productbatch")); |
|
| 196 | 196 | |
| 197 | 197 | $h = 0; |
| 198 | 198 | $head = array(); |
| 199 | 199 | |
| 200 | - $head[$h][0] = BASE_URI . "?controller=product/stock&method=productlot_card&id=" . $object->id; |
|
| 200 | + $head[$h][0] = BASE_URI."?controller=product/stock&method=productlot_card&id=".$object->id; |
|
| 201 | 201 | $head[$h][1] = $langs->trans("Card"); |
| 202 | 202 | $head[$h][2] = 'card'; |
| 203 | 203 | $h++; |
@@ -206,11 +206,11 @@ discard block |
||
| 206 | 206 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
| 207 | 207 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
| 208 | 208 | $upload_dir = $conf->productbatch->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); |
| 209 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
| 210 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
| 211 | - $head[$h][0] = BASE_URI . "?controller=product/stock&method=productlot_document&id=" . $object->id; |
|
| 209 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
| 210 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
| 211 | + $head[$h][0] = BASE_URI."?controller=product/stock&method=productlot_document&id=".$object->id; |
|
| 212 | 212 | $head[$h][1] = $langs->trans("Documents"); |
| 213 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
| 213 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
| 214 | 214 | $head[$h][2] = 'documents'; |
| 215 | 215 | $h++; |
| 216 | 216 | |
@@ -218,9 +218,9 @@ discard block |
||
| 218 | 218 | // Entries must be declared in modules descriptor with line |
| 219 | 219 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
| 220 | 220 | // $this->tabs = array('entity:-tabname); to remove a tab |
| 221 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'productlot'); |
|
| 221 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'productlot'); |
|
| 222 | 222 | |
| 223 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'productlot', 'remove'); |
|
| 223 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'productlot', 'remove'); |
|
| 224 | 224 | |
| 225 | 225 | // Log |
| 226 | 226 | /* |
@@ -247,15 +247,15 @@ discard block |
||
| 247 | 247 | $h = 0; |
| 248 | 248 | $head = array(); |
| 249 | 249 | |
| 250 | - $head[$h][0] = BASE_URI . "?controller=product/admin&method=product"; |
|
| 250 | + $head[$h][0] = BASE_URI."?controller=product/admin&method=product"; |
|
| 251 | 251 | $head[$h][1] = $langs->trans('Parameters'); |
| 252 | 252 | $head[$h][2] = 'general'; |
| 253 | 253 | $h++; |
| 254 | 254 | |
| 255 | - if (!empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($conf->global->PRODUIT_MULTIPRICES_ALLOW_AUTOCALC_PRICELEVEL)) |
|
| 255 | + if (!empty($conf->global->PRODUIT_MULTIPRICES) && !empty($conf->global->PRODUIT_MULTIPRICES_ALLOW_AUTOCALC_PRICELEVEL)) |
|
| 256 | 256 | { |
| 257 | 257 | $head[$h] = array( |
| 258 | - 0 => BASE_URI . "?controller=product/admin&method=price_rules", |
|
| 258 | + 0 => BASE_URI."?controller=product/admin&method=price_rules", |
|
| 259 | 259 | 1 => $langs->trans('MultipriceRules'), |
| 260 | 260 | 2 => 'generator' |
| 261 | 261 | ); |
@@ -266,14 +266,14 @@ discard block |
||
| 266 | 266 | // Entries must be declared in modules descriptor with line |
| 267 | 267 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
| 268 | 268 | // $this->tabs = array('entity:-tabname); to remove a tab |
| 269 | - complete_head_from_modules($conf,$langs,null,$head,$h,'product_admin'); |
|
| 269 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'product_admin'); |
|
| 270 | 270 | |
| 271 | - $head[$h][0] = BASE_URI . '?controller=product/admin&method=product_extrafields'; |
|
| 271 | + $head[$h][0] = BASE_URI.'?controller=product/admin&method=product_extrafields'; |
|
| 272 | 272 | $head[$h][1] = $langs->trans("ExtraFields"); |
| 273 | 273 | $head[$h][2] = 'attributes'; |
| 274 | 274 | $h++; |
| 275 | 275 | |
| 276 | - complete_head_from_modules($conf,$langs,null,$head,$h,'product_admin','remove'); |
|
| 276 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'product_admin', 'remove'); |
|
| 277 | 277 | |
| 278 | 278 | return $head; |
| 279 | 279 | } |
@@ -296,14 +296,14 @@ discard block |
||
| 296 | 296 | // Entries must be declared in modules descriptor with line |
| 297 | 297 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
| 298 | 298 | // $this->tabs = array('entity:-tabname); to remove a tab |
| 299 | - complete_head_from_modules($conf,$langs,null,$head,$h,'product_lot_admin'); |
|
| 299 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'product_lot_admin'); |
|
| 300 | 300 | |
| 301 | - $head[$h][0] = BASE_URI . '?controller=product/admin&method=product_lot_extrafields'; |
|
| 301 | + $head[$h][0] = BASE_URI.'?controller=product/admin&method=product_lot_extrafields'; |
|
| 302 | 302 | $head[$h][1] = $langs->trans("ExtraFields"); |
| 303 | 303 | $head[$h][2] = 'attributes'; |
| 304 | 304 | $h++; |
| 305 | 305 | |
| 306 | - complete_head_from_modules($conf,$langs,null,$head,$h,'product_lot_admin','remove'); |
|
| 306 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'product_lot_admin', 'remove'); |
|
| 307 | 307 | |
| 308 | 308 | return $head; |
| 309 | 309 | } |
@@ -317,9 +317,9 @@ discard block |
||
| 317 | 317 | * @param int $socid Thirdparty id |
| 318 | 318 | * @return integer NB of lines shown into array |
| 319 | 319 | */ |
| 320 | -function show_stats_for_company($product,$socid) |
|
| 320 | +function show_stats_for_company($product, $socid) |
|
| 321 | 321 | { |
| 322 | - global $conf,$langs,$user,$db; |
|
| 322 | + global $conf, $langs, $user, $db; |
|
| 323 | 323 | |
| 324 | 324 | $nblines = 0; |
| 325 | 325 | |
@@ -331,14 +331,14 @@ discard block |
||
| 331 | 331 | print '</tr>'; |
| 332 | 332 | |
| 333 | 333 | // Customer proposals |
| 334 | - if (! empty($conf->propal->enabled) && $user->rights->propale->lire) |
|
| 334 | + if (!empty($conf->propal->enabled) && $user->rights->propale->lire) |
|
| 335 | 335 | { |
| 336 | 336 | $nblines++; |
| 337 | - $ret=$product->load_stats_propale($socid); |
|
| 337 | + $ret = $product->load_stats_propale($socid); |
|
| 338 | 338 | if ($ret < 0) dol_print_error($db); |
| 339 | 339 | $langs->load("propal"); |
| 340 | 340 | print '<tr><td>'; |
| 341 | - print '<a href="propal.php?id='.$product->id.'">'.img_object('','propal').' '.$langs->trans("Proposals").'</a>'; |
|
| 341 | + print '<a href="propal.php?id='.$product->id.'">'.img_object('', 'propal').' '.$langs->trans("Proposals").'</a>'; |
|
| 342 | 342 | print '</td><td align="right">'; |
| 343 | 343 | print $product->stats_propale['customers']; |
| 344 | 344 | print '</td><td align="right">'; |
@@ -349,14 +349,14 @@ discard block |
||
| 349 | 349 | print '</tr>'; |
| 350 | 350 | } |
| 351 | 351 | // Supplier proposals |
| 352 | - if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) |
|
| 352 | + if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) |
|
| 353 | 353 | { |
| 354 | 354 | $nblines++; |
| 355 | - $ret=$product->load_stats_proposal_supplier($socid); |
|
| 355 | + $ret = $product->load_stats_proposal_supplier($socid); |
|
| 356 | 356 | if ($ret < 0) dol_print_error($db); |
| 357 | 357 | $langs->load("propal"); |
| 358 | 358 | print '<tr><td>'; |
| 359 | - print '<a href="supplier_proposal.php?id='.$product->id.'">'.img_object('','propal').' '.$langs->trans("SupplierProposals").'</a>'; |
|
| 359 | + print '<a href="supplier_proposal.php?id='.$product->id.'">'.img_object('', 'propal').' '.$langs->trans("SupplierProposals").'</a>'; |
|
| 360 | 360 | print '</td><td align="right">'; |
| 361 | 361 | print $product->stats_proposal_supplier['suppliers']; |
| 362 | 362 | print '</td><td align="right">'; |
@@ -367,14 +367,14 @@ discard block |
||
| 367 | 367 | print '</tr>'; |
| 368 | 368 | } |
| 369 | 369 | // Customer orders |
| 370 | - if (! empty($conf->commande->enabled) && $user->rights->commande->lire) |
|
| 370 | + if (!empty($conf->commande->enabled) && $user->rights->commande->lire) |
|
| 371 | 371 | { |
| 372 | 372 | $nblines++; |
| 373 | - $ret=$product->load_stats_commande($socid); |
|
| 373 | + $ret = $product->load_stats_commande($socid); |
|
| 374 | 374 | if ($ret < 0) dol_print_error($db); |
| 375 | 375 | $langs->load("orders"); |
| 376 | 376 | print '<tr><td>'; |
| 377 | - print '<a href="commande.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("CustomersOrders").'</a>'; |
|
| 377 | + print '<a href="commande.php?id='.$product->id.'">'.img_object('', 'order').' '.$langs->trans("CustomersOrders").'</a>'; |
|
| 378 | 378 | print '</td><td align="right">'; |
| 379 | 379 | print $product->stats_commande['customers']; |
| 380 | 380 | print '</td><td align="right">'; |
@@ -385,14 +385,14 @@ discard block |
||
| 385 | 385 | print '</tr>'; |
| 386 | 386 | } |
| 387 | 387 | // Supplier orders |
| 388 | - if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire) |
|
| 388 | + if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire) |
|
| 389 | 389 | { |
| 390 | 390 | $nblines++; |
| 391 | - $ret=$product->load_stats_commande_fournisseur($socid); |
|
| 391 | + $ret = $product->load_stats_commande_fournisseur($socid); |
|
| 392 | 392 | if ($ret < 0) dol_print_error($db); |
| 393 | 393 | $langs->load("orders"); |
| 394 | 394 | print '<tr><td>'; |
| 395 | - print '<a href="commande_fournisseur.php?id='.$product->id.'">'.img_object('','order').' '.$langs->trans("SuppliersOrders").'</a>'; |
|
| 395 | + print '<a href="commande_fournisseur.php?id='.$product->id.'">'.img_object('', 'order').' '.$langs->trans("SuppliersOrders").'</a>'; |
|
| 396 | 396 | print '</td><td align="right">'; |
| 397 | 397 | print $product->stats_commande_fournisseur['suppliers']; |
| 398 | 398 | print '</td><td align="right">'; |
@@ -403,14 +403,14 @@ discard block |
||
| 403 | 403 | print '</tr>'; |
| 404 | 404 | } |
| 405 | 405 | // Customer invoices |
| 406 | - if (! empty($conf->facture->enabled) && $user->rights->facture->lire) |
|
| 406 | + if (!empty($conf->facture->enabled) && $user->rights->facture->lire) |
|
| 407 | 407 | { |
| 408 | 408 | $nblines++; |
| 409 | - $ret=$product->load_stats_facture($socid); |
|
| 409 | + $ret = $product->load_stats_facture($socid); |
|
| 410 | 410 | if ($ret < 0) dol_print_error($db); |
| 411 | 411 | $langs->load("bills"); |
| 412 | 412 | print '<tr><td>'; |
| 413 | - print '<a href="facture.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("CustomersInvoices").'</a>'; |
|
| 413 | + print '<a href="facture.php?id='.$product->id.'">'.img_object('', 'bill').' '.$langs->trans("CustomersInvoices").'</a>'; |
|
| 414 | 414 | print '</td><td align="right">'; |
| 415 | 415 | print $product->stats_facture['customers']; |
| 416 | 416 | print '</td><td align="right">'; |
@@ -421,14 +421,14 @@ discard block |
||
| 421 | 421 | print '</tr>'; |
| 422 | 422 | } |
| 423 | 423 | // Supplier invoices |
| 424 | - if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) |
|
| 424 | + if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) |
|
| 425 | 425 | { |
| 426 | 426 | $nblines++; |
| 427 | - $ret=$product->load_stats_facture_fournisseur($socid); |
|
| 427 | + $ret = $product->load_stats_facture_fournisseur($socid); |
|
| 428 | 428 | if ($ret < 0) dol_print_error($db); |
| 429 | 429 | $langs->load("bills"); |
| 430 | 430 | print '<tr><td>'; |
| 431 | - print '<a href="facture_fournisseur.php?id='.$product->id.'">'.img_object('','bill').' '.$langs->trans("SuppliersInvoices").'</a>'; |
|
| 431 | + print '<a href="facture_fournisseur.php?id='.$product->id.'">'.img_object('', 'bill').' '.$langs->trans("SuppliersInvoices").'</a>'; |
|
| 432 | 432 | print '</td><td align="right">'; |
| 433 | 433 | print $product->stats_facture_fournisseur['suppliers']; |
| 434 | 434 | print '</td><td align="right">'; |
@@ -440,14 +440,14 @@ discard block |
||
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | // Contracts |
| 443 | - if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) |
|
| 443 | + if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) |
|
| 444 | 444 | { |
| 445 | 445 | $nblines++; |
| 446 | - $ret=$product->load_stats_contrat($socid); |
|
| 446 | + $ret = $product->load_stats_contrat($socid); |
|
| 447 | 447 | if ($ret < 0) dol_print_error($db); |
| 448 | 448 | $langs->load("contracts"); |
| 449 | 449 | print '<tr><td>'; |
| 450 | - print '<a href="contrat.php?id='.$product->id.'">'.img_object('','contract').' '.$langs->trans("Contracts").'</a>'; |
|
| 450 | + print '<a href="contrat.php?id='.$product->id.'">'.img_object('', 'contract').' '.$langs->trans("Contracts").'</a>'; |
|
| 451 | 451 | print '</td><td align="right">'; |
| 452 | 452 | print $product->stats_contrat['customers']; |
| 453 | 453 | print '</td><td align="right">'; |
@@ -470,11 +470,11 @@ discard block |
||
| 470 | 470 | * @return string Unit string |
| 471 | 471 | * @see formproduct->load_measuring_units |
| 472 | 472 | */ |
| 473 | -function measuring_units_string($unit,$measuring_style='') |
|
| 473 | +function measuring_units_string($unit, $measuring_style = '') |
|
| 474 | 474 | { |
| 475 | 475 | global $langs; |
| 476 | 476 | |
| 477 | - $measuring_units=array(); |
|
| 477 | + $measuring_units = array(); |
|
| 478 | 478 | if ($measuring_style == 'weight') |
| 479 | 479 | { |
| 480 | 480 | $measuring_units[3] = $langs->transnoentitiesnoconv("WeightUnitton"); |
@@ -527,8 +527,8 @@ discard block |
||
| 527 | 527 | */ |
| 528 | 528 | function measuring_units_squared($unit) |
| 529 | 529 | { |
| 530 | - $measuring_units=array(); |
|
| 531 | - $measuring_units[0] = 0; // m -> m3 |
|
| 530 | + $measuring_units = array(); |
|
| 531 | + $measuring_units[0] = 0; // m -> m3 |
|
| 532 | 532 | $measuring_units[-1] = -2; // dm-> dm2 |
| 533 | 533 | $measuring_units[-2] = -4; // cm -> cm2 |
| 534 | 534 | $measuring_units[-3] = -6; // mm -> mm2 |
@@ -547,8 +547,8 @@ discard block |
||
| 547 | 547 | */ |
| 548 | 548 | function measuring_units_cubed($unit) |
| 549 | 549 | { |
| 550 | - $measuring_units=array(); |
|
| 551 | - $measuring_units[0] = 0; // m -> m2 |
|
| 550 | + $measuring_units = array(); |
|
| 551 | + $measuring_units[0] = 0; // m -> m2 |
|
| 552 | 552 | $measuring_units[-1] = -3; // dm-> dm3 |
| 553 | 553 | $measuring_units[-2] = -6; // cm -> cm3 |
| 554 | 554 | $measuring_units[-3] = -9; // mm -> mm3 |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * \ingroup margin |
| 23 | 23 | * \brief Description and activation file for module Margin |
| 24 | 24 | */ |
| 25 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
| 25 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $this->family = "financial"; |
| 51 | 51 | $this->module_position = '55'; |
| 52 | 52 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
| 53 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
| 53 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
| 54 | 54 | // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) |
| 55 | 55 | $this->description = "Margin management"; |
| 56 | 56 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
| 60 | 60 | // Name of png file (without png) used for this module. |
| 61 | 61 | // Png file must be in theme/yourtheme/img directory under name object_pictovalue.png. |
| 62 | - $this->picto='margin'; |
|
| 62 | + $this->picto = 'margin'; |
|
| 63 | 63 | |
| 64 | 64 | // Data directories to create when module is enabled. |
| 65 | 65 | $this->dirs = array('/margin/temp'); |
@@ -68,12 +68,12 @@ discard block |
||
| 68 | 68 | $this->config_page_url = array("margin.php@margin"); |
| 69 | 69 | |
| 70 | 70 | // Dependencies |
| 71 | - $this->hidden = false; // A condition to hide module |
|
| 72 | - $this->depends = array("modPropale", "modProduct"); // List of module class names as string that must be enabled if this module is enabled |
|
| 73 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
| 74 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
| 75 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
| 76 | - $this->need_dolibarr_version = array(3,2); // Minimum version of Dolibarr required by module |
|
| 71 | + $this->hidden = false; // A condition to hide module |
|
| 72 | + $this->depends = array("modPropale", "modProduct"); // List of module class names as string that must be enabled if this module is enabled |
|
| 73 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
| 74 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
| 75 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
| 76 | + $this->need_dolibarr_version = array(3, 2); // Minimum version of Dolibarr required by module |
|
| 77 | 77 | $this->langfiles = array("margins"); |
| 78 | 78 | |
| 79 | 79 | // Constants |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), |
| 82 | 82 | // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) |
| 83 | 83 | // ); |
| 84 | - $this->const = array(0=>array('MARGIN_TYPE','chaine','costprice','Rule for margin calculation by default',0,'current',0)); // List of particular constants to add when module is enabled |
|
| 84 | + $this->const = array(0=>array('MARGIN_TYPE', 'chaine', 'costprice', 'Rule for margin calculation by default', 0, 'current', 0)); // List of particular constants to add when module is enabled |
|
| 85 | 85 | |
| 86 | 86 | // New pages on tabs |
| 87 | 87 | $this->tabs = array( |
@@ -91,36 +91,36 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | |
| 93 | 93 | // Boxes |
| 94 | - $this->boxes = array(); // List of boxes |
|
| 95 | - $r=0; |
|
| 94 | + $this->boxes = array(); // List of boxes |
|
| 95 | + $r = 0; |
|
| 96 | 96 | |
| 97 | 97 | // Permissions |
| 98 | - $this->rights = array(); // Permission array used by this module |
|
| 99 | - $r=0; |
|
| 98 | + $this->rights = array(); // Permission array used by this module |
|
| 99 | + $r = 0; |
|
| 100 | 100 | |
| 101 | 101 | // Main menu entries |
| 102 | - $this->menu = array(); // List of menus to add |
|
| 102 | + $this->menu = array(); // List of menus to add |
|
| 103 | 103 | $r = 0; |
| 104 | 104 | |
| 105 | 105 | // left menu entry |
| 106 | - $this->menu[$r]=array( |
|
| 107 | - 'fk_menu'=>'fk_mainmenu=billing', // Put 0 if this is a top menu |
|
| 108 | - 'type'=>'left', // This is a Top menu entry |
|
| 106 | + $this->menu[$r] = array( |
|
| 107 | + 'fk_menu'=>'fk_mainmenu=billing', // Put 0 if this is a top menu |
|
| 108 | + 'type'=>'left', // This is a Top menu entry |
|
| 109 | 109 | 'titre'=>'Margins', |
| 110 | 110 | 'mainmenu'=>'billing', |
| 111 | 111 | 'leftmenu'=>'margins', |
| 112 | 112 | 'url' => '?controller=margin&method=index', |
| 113 | - 'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
| 113 | + 'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
| 114 | 114 | 'position'=>100, |
| 115 | - 'enabled'=>'$conf->margin->enabled', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled. |
|
| 116 | - 'perms'=>'$user->rights->margins->liretous', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules |
|
| 115 | + 'enabled'=>'$conf->margin->enabled', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled. |
|
| 116 | + 'perms'=>'$user->rights->margins->liretous', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules |
|
| 117 | 117 | 'target'=>'', |
| 118 | - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
| 118 | + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
| 119 | 119 | $r++; |
| 120 | 120 | |
| 121 | 121 | // Permissions |
| 122 | 122 | $this->rights = array(); |
| 123 | - $r=0; |
|
| 123 | + $r = 0; |
|
| 124 | 124 | |
| 125 | 125 | $r++; |
| 126 | 126 | $this->rights[$r][0] = 59001; // id de la permission |
@@ -30,19 +30,19 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
| 32 | 32 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
| 33 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
| 34 | - |
|
| 35 | -require_once DOL_DOCUMENT_ROOT . '/core/modules/dons/modules_don.php'; |
|
| 36 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/donation.lib.php'; |
|
| 37 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; |
|
| 38 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php'; |
|
| 39 | -require_once DOL_DOCUMENT_ROOT . '/don/class/don.class.php'; |
|
| 40 | -require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; |
|
| 41 | -require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
| 42 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; |
|
| 43 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formmargin.class.php'; |
|
| 44 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; |
|
| 45 | -if (! empty($conf->projet->enabled)) { |
|
| 33 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
| 34 | + |
|
| 35 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/dons/modules_don.php'; |
|
| 36 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php'; |
|
| 37 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
|
| 38 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; |
|
| 39 | +require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; |
|
| 40 | +require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; |
|
| 41 | +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
| 42 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; |
|
| 43 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php'; |
|
| 44 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
| 45 | +if (!empty($conf->projet->enabled)) { |
|
| 46 | 46 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
| 47 | 47 | require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
| 48 | 48 | } |
@@ -50,11 +50,11 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | $langs->loadLangs(array("bills", "companies", "donations")); |
| 52 | 52 | |
| 53 | -$id=GETPOST('rowid')?GETPOST('rowid','int'):GETPOST('id','int'); |
|
| 54 | -$action=GETPOST('action','alpha'); |
|
| 55 | -$cancel=GETPOST('cancel','alpha'); |
|
| 56 | -$amount=GETPOST('amount'); |
|
| 57 | -$donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); |
|
| 53 | +$id = GETPOST('rowid') ?GETPOST('rowid', 'int') : GETPOST('id', 'int'); |
|
| 54 | +$action = GETPOST('action', 'alpha'); |
|
| 55 | +$cancel = GETPOST('cancel', 'alpha'); |
|
| 56 | +$amount = GETPOST('amount'); |
|
| 57 | +$donation_date = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); |
|
| 58 | 58 | $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); |
| 59 | 59 | |
| 60 | 60 | $object = new Don($db); |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | $result = restrictedArea($user, 'don', $id); |
| 65 | 65 | |
| 66 | 66 | // fetch optionals attributes and labels |
| 67 | -$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); |
|
| 67 | +$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); |
|
| 68 | 68 | |
| 69 | 69 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
| 70 | -$hookmanager->initHooks(array('doncard','globalcard')); |
|
| 70 | +$hookmanager->initHooks(array('doncard', 'globalcard')); |
|
| 71 | 71 | |
| 72 | 72 | /* |
| 73 | 73 | * Actions |
@@ -78,13 +78,13 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | if ($action == 'update') |
| 80 | 80 | { |
| 81 | - if (! empty($cancel)) |
|
| 81 | + if (!empty($cancel)) |
|
| 82 | 82 | { |
| 83 | - header("Location: " . $_SERVER['PHP_SELF'] . "&id=" . $id); |
|
| 83 | + header("Location: ".$_SERVER['PHP_SELF']."&id=".$id); |
|
| 84 | 84 | exit; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - $error=0; |
|
| 87 | + $error = 0; |
|
| 88 | 88 | |
| 89 | 89 | if (empty($donation_date)) |
| 90 | 90 | { |
@@ -100,33 +100,33 @@ discard block |
||
| 100 | 100 | $error++; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - if (! $error) |
|
| 103 | + if (!$error) |
|
| 104 | 104 | { |
| 105 | 105 | $object->fetch($id); |
| 106 | 106 | |
| 107 | - $object->firstname = GETPOST("firstname",'alpha'); |
|
| 108 | - $object->lastname = GETPOST("lastname",'alpha'); |
|
| 109 | - $object->societe = GETPOST("societe",'alpha'); |
|
| 110 | - $object->address = GETPOST("address",'alpha'); |
|
| 111 | - $object->amount = price2num(GETPOST("amount",'alpha')); |
|
| 112 | - $object->town = GETPOST("town",'alpha'); |
|
| 113 | - $object->zip = GETPOST("zipcode",'alpha'); |
|
| 107 | + $object->firstname = GETPOST("firstname", 'alpha'); |
|
| 108 | + $object->lastname = GETPOST("lastname", 'alpha'); |
|
| 109 | + $object->societe = GETPOST("societe", 'alpha'); |
|
| 110 | + $object->address = GETPOST("address", 'alpha'); |
|
| 111 | + $object->amount = price2num(GETPOST("amount", 'alpha')); |
|
| 112 | + $object->town = GETPOST("town", 'alpha'); |
|
| 113 | + $object->zip = GETPOST("zipcode", 'alpha'); |
|
| 114 | 114 | $object->country_id = GETPOST('country_id', 'int'); |
| 115 | - $object->email = GETPOST("email",'alpha'); |
|
| 115 | + $object->email = GETPOST("email", 'alpha'); |
|
| 116 | 116 | $object->date = $donation_date; |
| 117 | - $object->public = GETPOST("public",'alpha'); |
|
| 118 | - $object->fk_project = GETPOST("fk_project",'alpha'); |
|
| 119 | - $object->note_private= GETPOST("note_private",'none'); |
|
| 120 | - $object->note_public = GETPOST("note_public",'none'); |
|
| 121 | - $object->modepaymentid = GETPOST('modepayment','int'); |
|
| 117 | + $object->public = GETPOST("public", 'alpha'); |
|
| 118 | + $object->fk_project = GETPOST("fk_project", 'alpha'); |
|
| 119 | + $object->note_private = GETPOST("note_private", 'none'); |
|
| 120 | + $object->note_public = GETPOST("note_public", 'none'); |
|
| 121 | + $object->modepaymentid = GETPOST('modepayment', 'int'); |
|
| 122 | 122 | |
| 123 | 123 | // Fill array 'array_options' with data from add form |
| 124 | - $ret = $extrafields->setOptionalsFromPost($extralabels,$object); |
|
| 124 | + $ret = $extrafields->setOptionalsFromPost($extralabels, $object); |
|
| 125 | 125 | if ($ret < 0) $error++; |
| 126 | 126 | |
| 127 | 127 | if ($object->update($user) > 0) |
| 128 | 128 | { |
| 129 | - header("Location: " . $_SERVER['PHP_SELF'] . "&id=" . $object->id); |
|
| 129 | + header("Location: ".$_SERVER['PHP_SELF']."&id=".$object->id); |
|
| 130 | 130 | exit; |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -134,13 +134,13 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | if ($action == 'add') |
| 136 | 136 | { |
| 137 | - if (! empty($cancel)) |
|
| 137 | + if (!empty($cancel)) |
|
| 138 | 138 | { |
| 139 | 139 | header("Location: index.php"); |
| 140 | 140 | exit; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - $error=0; |
|
| 143 | + $error = 0; |
|
| 144 | 144 | |
| 145 | 145 | if (empty($donation_date)) |
| 146 | 146 | { |
@@ -156,32 +156,32 @@ discard block |
||
| 156 | 156 | $error++; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - if (! $error) |
|
| 159 | + if (!$error) |
|
| 160 | 160 | { |
| 161 | - $object->firstname = GETPOST("firstname",'alpha'); |
|
| 162 | - $object->lastname = GETPOST("lastname",'alpha'); |
|
| 163 | - $object->societe = GETPOST("societe",'alpha'); |
|
| 164 | - $object->address = GETPOST("address",'alpha'); |
|
| 165 | - $object->amount = price2num(GETPOST("amount",'alpha')); |
|
| 166 | - $object->zip = GETPOST("zipcode",'alpha'); |
|
| 167 | - $object->town = GETPOST("town",'alpha'); |
|
| 161 | + $object->firstname = GETPOST("firstname", 'alpha'); |
|
| 162 | + $object->lastname = GETPOST("lastname", 'alpha'); |
|
| 163 | + $object->societe = GETPOST("societe", 'alpha'); |
|
| 164 | + $object->address = GETPOST("address", 'alpha'); |
|
| 165 | + $object->amount = price2num(GETPOST("amount", 'alpha')); |
|
| 166 | + $object->zip = GETPOST("zipcode", 'alpha'); |
|
| 167 | + $object->town = GETPOST("town", 'alpha'); |
|
| 168 | 168 | $object->country_id = GETPOST('country_id', 'int'); |
| 169 | - $object->email = GETPOST("email",'alpha'); |
|
| 169 | + $object->email = GETPOST("email", 'alpha'); |
|
| 170 | 170 | $object->date = $donation_date; |
| 171 | - $object->note_private= GETPOST("note_private",'none'); |
|
| 172 | - $object->note_public = GETPOST("note_public",'none'); |
|
| 173 | - $object->public = GETPOST("public",'alpha'); |
|
| 174 | - $object->fk_project = GETPOST("fk_project",'alpha'); |
|
| 175 | - $object->modepaymentid = GETPOST('modepayment','int'); |
|
| 171 | + $object->note_private = GETPOST("note_private", 'none'); |
|
| 172 | + $object->note_public = GETPOST("note_public", 'none'); |
|
| 173 | + $object->public = GETPOST("public", 'alpha'); |
|
| 174 | + $object->fk_project = GETPOST("fk_project", 'alpha'); |
|
| 175 | + $object->modepaymentid = GETPOST('modepayment', 'int'); |
|
| 176 | 176 | |
| 177 | 177 | // Fill array 'array_options' with data from add form |
| 178 | - $ret = $extrafields->setOptionalsFromPost($extralabels,$object); |
|
| 178 | + $ret = $extrafields->setOptionalsFromPost($extralabels, $object); |
|
| 179 | 179 | if ($ret < 0) $error++; |
| 180 | 180 | |
| 181 | 181 | $res = $object->create($user); |
| 182 | 182 | if ($res > 0) |
| 183 | 183 | { |
| 184 | - header("Location: " . $_SERVER['PHP_SELF'] . '&id=' . $res); |
|
| 184 | + header("Location: ".$_SERVER['PHP_SELF'].'&id='.$res); |
|
| 185 | 185 | exit; |
| 186 | 186 | } |
| 187 | 187 | else |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->don->supprimer) |
| 194 | 194 | { |
| 195 | 195 | $object->fetch($id); |
| 196 | - $result=$object->delete($user); |
|
| 196 | + $result = $object->delete($user); |
|
| 197 | 197 | if ($result > 0) |
| 198 | 198 | { |
| 199 | 199 | header("Location: index.php"); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | else |
| 203 | 203 | { |
| 204 | - dol_syslog($object->error,LOG_DEBUG); |
|
| 204 | + dol_syslog($object->error, LOG_DEBUG); |
|
| 205 | 205 | setEventMessages($object->error, $object->errors, 'errors'); |
| 206 | 206 | } |
| 207 | 207 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | { |
| 213 | 213 | setEventMessages($langs->trans("DonationValidated", $object->ref), null); |
| 214 | 214 | |
| 215 | - header("Location: " . $_SERVER['PHP_SELF'] . "&id=" . $id); |
|
| 215 | + header("Location: ".$_SERVER['PHP_SELF']."&id=".$id); |
|
| 216 | 216 | exit; |
| 217 | 217 | } |
| 218 | 218 | else { |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $object->fetch($id); |
| 225 | 225 | if ($object->set_cancel($id) >= 0) |
| 226 | 226 | { |
| 227 | - header("Location: " . $_SERVER['PHP_SELF'] . "&id=" . $id); |
|
| 227 | + header("Location: ".$_SERVER['PHP_SELF']."&id=".$id); |
|
| 228 | 228 | exit; |
| 229 | 229 | } |
| 230 | 230 | else { |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $object->fetch($id); |
| 237 | 237 | if ($object->set_paid($id, $modepayment) >= 0) |
| 238 | 238 | { |
| 239 | - header("Location: " . $_SERVER['PHP_SELF'] . "&id=" . $id); |
|
| 239 | + header("Location: ".$_SERVER['PHP_SELF']."&id=".$id); |
|
| 240 | 240 | exit; |
| 241 | 241 | } |
| 242 | 242 | else { |
@@ -312,18 +312,18 @@ discard block |
||
| 312 | 312 | * View |
| 313 | 313 | */ |
| 314 | 314 | |
| 315 | -llxHeader('',$langs->trans("Donation"),'EN:Module_Donations|FR:Module_Dons|ES:Módulo_Donaciones'); |
|
| 315 | +llxHeader('', $langs->trans("Donation"), 'EN:Module_Donations|FR:Module_Dons|ES:Módulo_Donaciones'); |
|
| 316 | 316 | |
| 317 | -$form=new Form($db); |
|
| 317 | +$form = new Form($db); |
|
| 318 | 318 | $formfile = new FormFile($db); |
| 319 | 319 | $formcompany = new FormCompany($db); |
| 320 | -if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } |
|
| 320 | +if (!empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } |
|
| 321 | 321 | |
| 322 | 322 | if ($action == 'create') |
| 323 | 323 | { |
| 324 | 324 | print load_fiche_titre($langs->trans("AddDonation")); |
| 325 | 325 | |
| 326 | - print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">'; |
|
| 326 | + print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 327 | 327 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
| 328 | 328 | print '<input type="hidden" name="action" value="add">'; |
| 329 | 329 | |
@@ -333,26 +333,26 @@ discard block |
||
| 333 | 333 | print '<tbody>'; |
| 334 | 334 | |
| 335 | 335 | // Ref |
| 336 | - print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans('Draft') . '</td></tr>'; |
|
| 336 | + print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>'; |
|
| 337 | 337 | |
| 338 | 338 | // Company |
| 339 | - if (! empty($conf->societe->enabled) && ! empty($conf->global->DONATION_USE_THIRDPARTIES)) |
|
| 339 | + if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) |
|
| 340 | 340 | { |
| 341 | 341 | // Thirdparty |
| 342 | - print '<td>' . $langs->trans('Customer') . '</td>'; |
|
| 343 | - if ($soc->id > 0 && ! GETPOST('fac_rec','alpha')) |
|
| 342 | + print '<td>'.$langs->trans('Customer').'</td>'; |
|
| 343 | + if ($soc->id > 0 && !GETPOST('fac_rec', 'alpha')) |
|
| 344 | 344 | { |
| 345 | 345 | print '<td colspan="2">'; |
| 346 | 346 | print $soc->getNomUrl(1); |
| 347 | - print '<input type="hidden" name="socid" value="' . $soc->id . '">'; |
|
| 347 | + print '<input type="hidden" name="socid" value="'.$soc->id.'">'; |
|
| 348 | 348 | // Outstanding Bill |
| 349 | 349 | $outstandingBills = $soc->get_OutstandingBill(); |
| 350 | - print ' (' . $langs->trans('CurrentOutstandingBill') . ': '; |
|
| 350 | + print ' ('.$langs->trans('CurrentOutstandingBill').': '; |
|
| 351 | 351 | print price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency); |
| 352 | 352 | if ($soc->outstanding_limit != '') |
| 353 | 353 | { |
| 354 | 354 | if ($outstandingBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached")); |
| 355 | - print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency); |
|
| 355 | + print ' / '.price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency); |
|
| 356 | 356 | } |
| 357 | 357 | print ')'; |
| 358 | 358 | print '</td>'; |
@@ -370,21 +370,21 @@ discard block |
||
| 370 | 370 | var socid = $(this).val(); |
| 371 | 371 | var fac_rec = $(\'#fac_rec\').val(); |
| 372 | 372 | // reload page |
| 373 | - window.location.href = "' . $_SERVER["PHP_SELF"] . '&action=create&socid="+socid+"&fac_rec="+fac_rec; |
|
| 373 | + window.location.href = "' . $_SERVER["PHP_SELF"].'&action=create&socid="+socid+"&fac_rec="+fac_rec; |
|
| 374 | 374 | }); |
| 375 | 375 | }); |
| 376 | 376 | </script>'; |
| 377 | 377 | } |
| 378 | 378 | //print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>'; |
| 379 | - print ' <a href="' . BASE_URI . '?controller=societe&method=card&action=create&client=3&fournisseur=0&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?action=create') . '">' . $langs->trans("AddThirdParty") . '</a>'; |
|
| 379 | + print ' <a href="'.BASE_URI.'?controller=societe&method=card&action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>'; |
|
| 380 | 380 | print '</td>'; |
| 381 | 381 | } |
| 382 | - print '</tr>' . "\n"; |
|
| 382 | + print '</tr>'."\n"; |
|
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | // Date |
| 386 | 386 | print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Date").'</td><td>'; |
| 387 | - print $form->selectDate($donation_date?$donation_date:-1, '', '', '', '', "add", 1, 1); |
|
| 387 | + print $form->selectDate($donation_date ? $donation_date : -1, '', '', '', '', "add", 1, 1); |
|
| 388 | 388 | print '</td>'; |
| 389 | 389 | |
| 390 | 390 | // Amount |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | |
| 393 | 393 | // Public donation |
| 394 | 394 | print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>"; |
| 395 | - print $form->selectyesno("public",isset($_POST["public"])?$_POST["public"]:1,1); |
|
| 395 | + print $form->selectyesno("public", isset($_POST["public"]) ? $_POST["public"] : 1, 1); |
|
| 396 | 396 | print "</td></tr>\n"; |
| 397 | 397 | |
| 398 | 398 | if (empty($conf->societe->enabled) || empty($conf->global->DONATION_USE_THIRDPARTIES)) |
@@ -405,15 +405,15 @@ discard block |
||
| 405 | 405 | |
| 406 | 406 | // Zip / Town |
| 407 | 407 | print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>'; |
| 408 | - print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6); |
|
| 408 | + print $formcompany->select_ziptown((isset($_POST["zipcode"]) ? $_POST["zipcode"] : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); |
|
| 409 | 409 | print ' '; |
| 410 | - print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id')); |
|
| 410 | + print $formcompany->select_ziptown((isset($_POST["town"]) ? $_POST["town"] : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id')); |
|
| 411 | 411 | print '</tr>'; |
| 412 | 412 | |
| 413 | 413 | // Country |
| 414 | 414 | print '<tr><td><label for="selectcountry_id">'.$langs->trans('Country').'</label></td><td class="maxwidthonsmartphone">'; |
| 415 | - print $form->select_country(GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id); |
|
| 416 | - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
| 415 | + print $form->select_country(GETPOST('country_id') != '' ?GETPOST('country_id') : $object->country_id); |
|
| 416 | + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
| 417 | 417 | print '</td></tr>'; |
| 418 | 418 | |
| 419 | 419 | print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" value="'.dol_escape_htmltag(GETPOST("email")).'" class="maxwidth200"></td></tr>'; |
@@ -421,13 +421,13 @@ discard block |
||
| 421 | 421 | |
| 422 | 422 | // Payment mode |
| 423 | 423 | print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n"; |
| 424 | - $selected = GETPOST('modepayment','int'); |
|
| 424 | + $selected = GETPOST('modepayment', 'int'); |
|
| 425 | 425 | $form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1); |
| 426 | 426 | print "</td></tr>\n"; |
| 427 | 427 | |
| 428 | 428 | // Public note |
| 429 | 429 | print '<tr>'; |
| 430 | - print '<td class="tdtop">' . $langs->trans('NotePublic') . '</td>'; |
|
| 430 | + print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>'; |
|
| 431 | 431 | print '<td>'; |
| 432 | 432 | |
| 433 | 433 | $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | // Private note |
| 438 | 438 | if (empty($user->societe_id)) { |
| 439 | 439 | print '<tr>'; |
| 440 | - print '<td class="tdtop">' . $langs->trans('NotePrivate') . '</td>'; |
|
| 440 | + print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>'; |
|
| 441 | 441 | print '<td>'; |
| 442 | 442 | |
| 443 | 443 | $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); |
@@ -445,20 +445,20 @@ discard block |
||
| 445 | 445 | print '</td></tr>'; |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | - if (! empty($conf->projet->enabled)) |
|
| 448 | + if (!empty($conf->projet->enabled)) |
|
| 449 | 449 | { |
| 450 | 450 | print "<tr><td>".$langs->trans("Project")."</td><td>"; |
| 451 | - $formproject->select_projects(-1, $projectid,'fk_project', 0, 0, 1, 1); |
|
| 451 | + $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1); |
|
| 452 | 452 | print "</td></tr>\n"; |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | // Other attributes |
| 456 | - $parameters=array(); |
|
| 457 | - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
| 456 | + $parameters = array(); |
|
| 457 | + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 458 | 458 | print $hookmanager->resPrint; |
| 459 | 459 | if (empty($reshook)) |
| 460 | 460 | { |
| 461 | - print $object->showOptionals($extrafields,'edit',$parameters); |
|
| 461 | + print $object->showOptionals($extrafields, 'edit', $parameters); |
|
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | print '</tbody>'; |
@@ -482,21 +482,21 @@ discard block |
||
| 482 | 482 | /* */ |
| 483 | 483 | /* ************************************************************ */ |
| 484 | 484 | |
| 485 | -if (! empty($id) && $action == 'edit') |
|
| 485 | +if (!empty($id) && $action == 'edit') |
|
| 486 | 486 | { |
| 487 | - $result=$object->fetch($id); |
|
| 487 | + $result = $object->fetch($id); |
|
| 488 | 488 | if ($result < 0) { |
| 489 | - dol_print_error($db,$object->error); exit; |
|
| 489 | + dol_print_error($db, $object->error); exit; |
|
| 490 | 490 | } |
| 491 | - $result=$object->fetch_optionals(); |
|
| 491 | + $result = $object->fetch_optionals(); |
|
| 492 | 492 | if ($result < 0) { |
| 493 | 493 | dol_print_error($db); exit; |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | - $hselected='card'; |
|
| 496 | + $hselected = 'card'; |
|
| 497 | 497 | $head = donation_prepare_head($object); |
| 498 | 498 | |
| 499 | - print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">'; |
|
| 499 | + print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
| 500 | 500 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
| 501 | 501 | print '<input type="hidden" name="action" value="update">'; |
| 502 | 502 | print '<input type="hidden" name="rowid" value="'.$object->id.'">'; |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | |
| 516 | 516 | // Date |
| 517 | 517 | print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Date").'</td><td>'; |
| 518 | - print $form->selectDate($object->date,'','','','',"update"); |
|
| 518 | + print $form->selectDate($object->date, '', '', '', '', "update"); |
|
| 519 | 519 | print '</td>'; |
| 520 | 520 | |
| 521 | 521 | // Amount |
@@ -526,12 +526,12 @@ discard block |
||
| 526 | 526 | else |
| 527 | 527 | { |
| 528 | 528 | print '<tr><td>'.$langs->trans("Amount").'</td><td>'; |
| 529 | - print price($object->amount,0,$langs,0,0,-1,$conf->currency); |
|
| 529 | + print price($object->amount, 0, $langs, 0, 0, -1, $conf->currency); |
|
| 530 | 530 | print '</td></tr>'; |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | 533 | print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>"; |
| 534 | - print $form->selectyesno("public",1,1); |
|
| 534 | + print $form->selectyesno("public", 1, 1); |
|
| 535 | 535 | print "</td>"; |
| 536 | 536 | print "</tr>\n"; |
| 537 | 537 | |
@@ -544,15 +544,15 @@ discard block |
||
| 544 | 544 | |
| 545 | 545 | // Zip / Town |
| 546 | 546 | print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>'; |
| 547 | - print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6); |
|
| 547 | + print $formcompany->select_ziptown((isset($_POST["zipcode"]) ? $_POST["zipcode"] : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); |
|
| 548 | 548 | print ' '; |
| 549 | - print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id')); |
|
| 549 | + print $formcompany->select_ziptown((isset($_POST["town"]) ? $_POST["town"] : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id')); |
|
| 550 | 550 | print '</tr>'; |
| 551 | 551 | |
| 552 | 552 | // Country |
| 553 | 553 | print '<tr><td class="titlefieldcreate">'.$langs->trans('Country').'</td><td>'; |
| 554 | - print $form->select_country((!empty($object->country_id)?$object->country_id:$mysoc->country_code),'country_id'); |
|
| 555 | - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
|
| 554 | + print $form->select_country((!empty($object->country_id) ? $object->country_id : $mysoc->country_code), 'country_id'); |
|
| 555 | + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
| 556 | 556 | print '</td></tr>'; |
| 557 | 557 | |
| 558 | 558 | print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" class="maxwidth200" value="'.dol_escape_htmltag($object->email).'"></td></tr>'; |
@@ -568,23 +568,23 @@ discard block |
||
| 568 | 568 | print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>'; |
| 569 | 569 | |
| 570 | 570 | // Project |
| 571 | - if (! empty($conf->projet->enabled)) |
|
| 571 | + if (!empty($conf->projet->enabled)) |
|
| 572 | 572 | { |
| 573 | - $formproject=new FormProjets($db); |
|
| 573 | + $formproject = new FormProjets($db); |
|
| 574 | 574 | |
| 575 | 575 | $langs->load('projects'); |
| 576 | 576 | print '<tr><td>'.$langs->trans('Project').'</td><td>'; |
| 577 | - $formproject->select_projects(-1, $object->fk_project,'fk_project', 0, 0, 1, 1); |
|
| 577 | + $formproject->select_projects(-1, $object->fk_project, 'fk_project', 0, 0, 1, 1); |
|
| 578 | 578 | print '</td></tr>'; |
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | // Other attributes |
| 582 | - $parameters=array(); |
|
| 583 | - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
| 582 | + $parameters = array(); |
|
| 583 | + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 584 | 584 | print $hookmanager->resPrint; |
| 585 | 585 | if (empty($reshook)) |
| 586 | 586 | { |
| 587 | - print $object->showOptionals($extrafields,'edit'); |
|
| 587 | + print $object->showOptionals($extrafields, 'edit'); |
|
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | print "</table>\n"; |
@@ -603,25 +603,25 @@ discard block |
||
| 603 | 603 | /* Donation card in view mode */ |
| 604 | 604 | /* */ |
| 605 | 605 | /* ************************************************************ */ |
| 606 | -if (! empty($id) && $action != 'edit') |
|
| 606 | +if (!empty($id) && $action != 'edit') |
|
| 607 | 607 | { |
| 608 | 608 | // Confirmation delete |
| 609 | 609 | if ($action == 'delete') |
| 610 | 610 | { |
| 611 | - $text=$langs->trans("ConfirmDeleteADonation"); |
|
| 612 | - print $form->formconfirm($_SERVER["PHP_SELF"] . "&id=" . $object->id, $langs->trans("DeleteADonation"), $text, "confirm_delete", '', '', 1); |
|
| 611 | + $text = $langs->trans("ConfirmDeleteADonation"); |
|
| 612 | + print $form->formconfirm($_SERVER["PHP_SELF"]."&id=".$object->id, $langs->trans("DeleteADonation"), $text, "confirm_delete", '', '', 1); |
|
| 613 | 613 | } |
| 614 | 614 | |
| 615 | - $result=$object->fetch($id); |
|
| 615 | + $result = $object->fetch($id); |
|
| 616 | 616 | if ($result < 0) { |
| 617 | - dol_print_error($db,$object->error); exit; |
|
| 617 | + dol_print_error($db, $object->error); exit; |
|
| 618 | 618 | } |
| 619 | - $result=$object->fetch_optionals(); |
|
| 619 | + $result = $object->fetch_optionals(); |
|
| 620 | 620 | if ($result < 0) { |
| 621 | 621 | dol_print_error($db); exit; |
| 622 | 622 | } |
| 623 | 623 | |
| 624 | - $hselected='card'; |
|
| 624 | + $hselected = 'card'; |
|
| 625 | 625 | |
| 626 | 626 | $head = donation_prepare_head($object); |
| 627 | 627 | dol_fiche_head($head, $hselected, $langs->trans("Donation"), -1, 'generic'); |
@@ -630,41 +630,41 @@ discard block |
||
| 630 | 630 | print $formconfirm; |
| 631 | 631 | |
| 632 | 632 | // $linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; |
| 633 | - $linkback = '<a href="' . BASE_URI . '?controller=don&method=list' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
|
| 633 | + $linkback = '<a href="'.BASE_URI.'?controller=don&method=list'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
|
| 634 | 634 | |
| 635 | - $morehtmlref='<div class="refidno">'; |
|
| 635 | + $morehtmlref = '<div class="refidno">'; |
|
| 636 | 636 | // Project |
| 637 | - if (! empty($conf->projet->enabled)) |
|
| 637 | + if (!empty($conf->projet->enabled)) |
|
| 638 | 638 | { |
| 639 | 639 | $langs->load("projects"); |
| 640 | - $morehtmlref.=$langs->trans('Project') . ' '; |
|
| 640 | + $morehtmlref .= $langs->trans('Project').' '; |
|
| 641 | 641 | if ($user->rights->don->creer) |
| 642 | 642 | { |
| 643 | 643 | if ($action != 'classify') |
| 644 | - $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
| 644 | + $morehtmlref .= '<a href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : '; |
|
| 645 | 645 | if ($action == 'classify') { |
| 646 | - $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">'; |
|
| 647 | - $morehtmlref.='<input type="hidden" name="action" value="classin">'; |
|
| 648 | - $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 649 | - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
|
| 650 | - $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 651 | - $morehtmlref.='</form>'; |
|
| 646 | + $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'&id='.$object->id.'">'; |
|
| 647 | + $morehtmlref .= '<input type="hidden" name="action" value="classin">'; |
|
| 648 | + $morehtmlref .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 649 | + $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
|
| 650 | + $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 651 | + $morehtmlref .= '</form>'; |
|
| 652 | 652 | } else { |
| 653 | - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '&id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
| 653 | + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'&id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); |
|
| 654 | 654 | } |
| 655 | 655 | } else { |
| 656 | - if (! empty($object->fk_project)) { |
|
| 656 | + if (!empty($object->fk_project)) { |
|
| 657 | 657 | $proj = new Project($db); |
| 658 | 658 | $proj->fetch($object->fk_project); |
| 659 | - $morehtmlref .= '<a href="' . BASE_URI . '?controller=projet&methos=card&id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">'; |
|
| 660 | - $morehtmlref.=$proj->ref; |
|
| 661 | - $morehtmlref.='</a>'; |
|
| 659 | + $morehtmlref .= '<a href="'.BASE_URI.'?controller=projet&methos=card&id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">'; |
|
| 660 | + $morehtmlref .= $proj->ref; |
|
| 661 | + $morehtmlref .= '</a>'; |
|
| 662 | 662 | } else { |
| 663 | - $morehtmlref.=''; |
|
| 663 | + $morehtmlref .= ''; |
|
| 664 | 664 | } |
| 665 | 665 | } |
| 666 | 666 | } |
| 667 | - $morehtmlref.='</div>'; |
|
| 667 | + $morehtmlref .= '</div>'; |
|
| 668 | 668 | |
| 669 | 669 | |
| 670 | 670 | dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref); |
@@ -678,11 +678,11 @@ discard block |
||
| 678 | 678 | |
| 679 | 679 | // Date |
| 680 | 680 | print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td colspan="2">'; |
| 681 | - print dol_print_date($object->date,"day"); |
|
| 681 | + print dol_print_date($object->date, "day"); |
|
| 682 | 682 | print "</td>"; |
| 683 | 683 | |
| 684 | 684 | print '<tr><td>'.$langs->trans("Amount").'</td><td colspan="2">'; |
| 685 | - print price($object->amount,0,$langs,0,0,-1,$conf->currency); |
|
| 685 | + print price($object->amount, 0, $langs, 0, 0, -1, $conf->currency); |
|
| 686 | 686 | print '</td></tr>'; |
| 687 | 687 | |
| 688 | 688 | print '<tr><td>'.$langs->trans("PublicDonation").'</td><td colspan="2">'; |
@@ -695,12 +695,12 @@ discard block |
||
| 695 | 695 | |
| 696 | 696 | // Payment mode |
| 697 | 697 | print "<tr><td>".$langs->trans("PaymentMode")."</td><td>"; |
| 698 | - $form->form_modes_reglement(null, $object->modepaymentid,'none'); |
|
| 698 | + $form->form_modes_reglement(null, $object->modepaymentid, 'none'); |
|
| 699 | 699 | print "</td></tr>\n"; |
| 700 | 700 | |
| 701 | 701 | // Other attributes |
| 702 | 702 | $cols = 2; |
| 703 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; |
|
| 703 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; |
|
| 704 | 704 | |
| 705 | 705 | print '</table>'; |
| 706 | 706 | |
@@ -712,15 +712,15 @@ discard block |
||
| 712 | 712 | * Payments |
| 713 | 713 | */ |
| 714 | 714 | $sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,"; |
| 715 | - $sql.= "c.code as type_code,c.libelle as paiement_type"; |
|
| 716 | - $sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as p"; |
|
| 717 | - $sql.= ", ".MAIN_DB_PREFIX."c_paiement as c "; |
|
| 718 | - $sql.= ", ".MAIN_DB_PREFIX."don as d"; |
|
| 719 | - $sql.= " WHERE d.rowid = '".$id."'"; |
|
| 720 | - $sql.= " AND p.fk_donation = d.rowid"; |
|
| 721 | - $sql.= " AND d.entity IN (".getEntity('donation').")"; |
|
| 722 | - $sql.= " AND p.fk_typepayment = c.id"; |
|
| 723 | - $sql.= " ORDER BY dp"; |
|
| 715 | + $sql .= "c.code as type_code,c.libelle as paiement_type"; |
|
| 716 | + $sql .= " FROM ".MAIN_DB_PREFIX."payment_donation as p"; |
|
| 717 | + $sql .= ", ".MAIN_DB_PREFIX."c_paiement as c "; |
|
| 718 | + $sql .= ", ".MAIN_DB_PREFIX."don as d"; |
|
| 719 | + $sql .= " WHERE d.rowid = '".$id."'"; |
|
| 720 | + $sql .= " AND p.fk_donation = d.rowid"; |
|
| 721 | + $sql .= " AND d.entity IN (".getEntity('donation').")"; |
|
| 722 | + $sql .= " AND p.fk_typepayment = c.id"; |
|
| 723 | + $sql .= " ORDER BY dp"; |
|
| 724 | 724 | |
| 725 | 725 | //print $sql; |
| 726 | 726 | $resql = $db->query($sql); |
@@ -741,9 +741,9 @@ discard block |
||
| 741 | 741 | $objp = $db->fetch_object($resql); |
| 742 | 742 | |
| 743 | 743 | print '<tr class="oddeven"><td>'; |
| 744 | - print '<a href="' . BASE_URI . '?controller=don/payment&method=card&id=' . $objp->rowid . '">' . img_object($langs->trans("Payment"), "payment") . ' ' . $objp->rowid . '</a></td>'; |
|
| 745 | - print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n"; |
|
| 746 | - $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type; |
|
| 744 | + print '<a href="'.BASE_URI.'?controller=don/payment&method=card&id='.$objp->rowid.'">'.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.'</a></td>'; |
|
| 745 | + print '<td>'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n"; |
|
| 746 | + $labeltype = $langs->trans("PaymentType".$objp->type_code) != ("PaymentType".$objp->type_code) ? $langs->trans("PaymentType".$objp->type_code) : $objp->paiement_type; |
|
| 747 | 747 | print "<td>".$labeltype.' '.$objp->num_payment."</td>\n"; |
| 748 | 748 | print '<td align="right">'.price($objp->amount)."</td>\n"; |
| 749 | 749 | print "</tr>"; |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | $remaintopay = $object->amount - $totalpaid; |
| 760 | 760 | |
| 761 | 761 | print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("RemainderToPay")." :</td>"; |
| 762 | - print '<td align="right"'.($resteapayeraffiche?' class="amountremaintopay"':'').'><b>'.price($remaintopay)."</b></td></tr>\n"; |
|
| 762 | + print '<td align="right"'.($resteapayeraffiche ? ' class="amountremaintopay"' : '').'><b>'.price($remaintopay)."</b></td></tr>\n"; |
|
| 763 | 763 | } |
| 764 | 764 | print "</table>"; |
| 765 | 765 | $db->free($resql); |
@@ -783,16 +783,16 @@ discard block |
||
| 783 | 783 | |
| 784 | 784 | print '<div class="tabsAction">'; |
| 785 | 785 | |
| 786 | - print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '&action=edit&rowid=' . $object->id . '">' . $langs->trans('Modify') . '</a></div>'; |
|
| 786 | + print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'&action=edit&rowid='.$object->id.'">'.$langs->trans('Modify').'</a></div>'; |
|
| 787 | 787 | |
| 788 | 788 | if ($object->statut == 0) |
| 789 | 789 | { |
| 790 | - print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '&rowid=' . $object->id . '&action=valid_promesse">' . $langs->trans("ValidPromess") . '</a></div>'; |
|
| 790 | + print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'&rowid='.$object->id.'&action=valid_promesse">'.$langs->trans("ValidPromess").'</a></div>'; |
|
| 791 | 791 | } |
| 792 | 792 | |
| 793 | 793 | if (($object->statut == 0 || $object->statut == 1) && $totalpaid == 0 && $object->paid == 0) |
| 794 | 794 | { |
| 795 | - print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '&rowid=' . $object->id . '&action=set_cancel">' . $langs->trans("ClassifyCanceled") . "</a></div>"; |
|
| 795 | + print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'&rowid='.$object->id.'&action=set_cancel">'.$langs->trans("ClassifyCanceled")."</a></div>"; |
|
| 796 | 796 | } |
| 797 | 797 | |
| 798 | 798 | // Create payment |
@@ -800,18 +800,18 @@ discard block |
||
| 800 | 800 | { |
| 801 | 801 | if ($remaintopay == 0) |
| 802 | 802 | { |
| 803 | - print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>'; |
|
| 803 | + print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseRemainderToPayIsZero").'">'.$langs->trans('DoPayment').'</span></div>'; |
|
| 804 | 804 | } |
| 805 | 805 | else |
| 806 | 806 | { |
| 807 | - print '<div class="inline-block divButAction"><a class="butAction" href="' . BASE_URI . '?controller=don/payment&method=payment&rowid=' . $object->id . '&action=create">' . $langs->trans('DoPayment') . '</a></div>'; |
|
| 807 | + print '<div class="inline-block divButAction"><a class="butAction" href="'.BASE_URI.'?controller=don/payment&method=payment&rowid='.$object->id.'&action=create">'.$langs->trans('DoPayment').'</a></div>'; |
|
| 808 | 808 | } |
| 809 | 809 | } |
| 810 | 810 | |
| 811 | 811 | // Classify 'paid' |
| 812 | 812 | if ($object->statut == 1 && round($remaintopay) == 0 && $object->paid == 0 && $user->rights->don->creer) |
| 813 | 813 | { |
| 814 | - print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=set_paid">'.$langs->trans("ClassifyPaid")."</a></div>"; |
|
| 814 | + print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=set_paid">'.$langs->trans("ClassifyPaid")."</a></div>"; |
|
| 815 | 815 | } |
| 816 | 816 | |
| 817 | 817 | // Delete |
@@ -820,7 +820,7 @@ discard block |
||
| 820 | 820 | if ($object->statut == -1 || $object->statut == 0) |
| 821 | 821 | { |
| 822 | 822 | // TODO: Original href="card.php?rowid='.$object->id.'&action=delete" |
| 823 | - print '<div class="inline-block divButAction"><a class="butActionDelete" href="?controller=don&method=card&rowid=' . $object->id . '&action=delete">' . $langs->trans("Delete") . "</a></div>"; |
|
| 823 | + print '<div class="inline-block divButAction"><a class="butActionDelete" href="?controller=don&method=card&rowid='.$object->id.'&action=delete">'.$langs->trans("Delete")."</a></div>"; |
|
| 824 | 824 | } |
| 825 | 825 | else |
| 826 | 826 | { |
@@ -840,20 +840,20 @@ discard block |
||
| 840 | 840 | /* |
| 841 | 841 | * Documents generes |
| 842 | 842 | */ |
| 843 | - $filename = dol_sanitizeFileName($object->id); |
|
| 844 | - $filedir = $conf->don->dir_output . "/" . dol_sanitizeFileName($object->id); |
|
| 845 | - $urlsource = $_SERVER['PHP_SELF'] . '&rowid=' . $object->id; |
|
| 846 | - $genallowed = (($object->paid == 0 || $user->admin) && $user->rights->don->lire); |
|
| 847 | - $delallowed = $user->rights->don->creer; |
|
| 843 | + $filename = dol_sanitizeFileName($object->id); |
|
| 844 | + $filedir = $conf->don->dir_output."/".dol_sanitizeFileName($object->id); |
|
| 845 | + $urlsource = $_SERVER['PHP_SELF'].'&rowid='.$object->id; |
|
| 846 | + $genallowed = (($object->paid == 0 || $user->admin) && $user->rights->don->lire); |
|
| 847 | + $delallowed = $user->rights->don->creer; |
|
| 848 | 848 | |
| 849 | - print $formfile->showdocuments('donation',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf); |
|
| 849 | + print $formfile->showdocuments('donation', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf); |
|
| 850 | 850 | |
| 851 | 851 | // Show links to link elements |
| 852 | 852 | $linktoelem = $form->showLinkToObjectBlock($object, null, array('don')); |
| 853 | 853 | $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); |
| 854 | 854 | |
| 855 | 855 | // Show online payment link |
| 856 | - $useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled)); |
|
| 856 | + $useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled)); |
|
| 857 | 857 | |
| 858 | 858 | if ($useonlinepayment) //$object->statut != Facture::STATUS_DRAFT && |
| 859 | 859 | { |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * \brief File of class to manage donations |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | -require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; |
|
| 29 | +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; |
|
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | /** |
| 38 | 38 | * @var string ID to identify managed object |
| 39 | 39 | */ |
| 40 | - public $element='don'; |
|
| 40 | + public $element = 'don'; |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * @var string Name of table without prefix where object is stored |
| 44 | 44 | */ |
| 45 | - public $table_element='don'; |
|
| 45 | + public $table_element = 'don'; |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * @var int Field with ID of parent key if this field has a parent |
@@ -109,9 +109,9 @@ discard block |
||
| 109 | 109 | * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long |
| 110 | 110 | * @return string Libelle |
| 111 | 111 | */ |
| 112 | - function getLibStatut($mode=0) |
|
| 112 | + function getLibStatut($mode = 0) |
|
| 113 | 113 | { |
| 114 | - return $this->LibStatut($this->statut,$mode); |
|
| 114 | + return $this->LibStatut($this->statut, $mode); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
@@ -122,21 +122,21 @@ discard block |
||
| 122 | 122 | * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto |
| 123 | 123 | * @return string Libelle du statut |
| 124 | 124 | */ |
| 125 | - function LibStatut($statut,$mode=0) |
|
| 125 | + function LibStatut($statut, $mode = 0) |
|
| 126 | 126 | { |
| 127 | 127 | // phpcs:enable |
| 128 | 128 | if (empty($this->labelstatut) || empty($this->labelstatutshort)) |
| 129 | 129 | { |
| 130 | 130 | global $langs; |
| 131 | 131 | $langs->load("donations"); |
| 132 | - $this->labelstatut[-1]=$langs->trans("Canceled"); |
|
| 133 | - $this->labelstatut[0]=$langs->trans("DonationStatusPromiseNotValidated"); |
|
| 134 | - $this->labelstatut[1]=$langs->trans("DonationStatusPromiseValidated"); |
|
| 135 | - $this->labelstatut[2]=$langs->trans("DonationStatusPaid"); |
|
| 136 | - $this->labelstatutshort[-1]=$langs->trans("Canceled"); |
|
| 137 | - $this->labelstatutshort[0]=$langs->trans("DonationStatusPromiseNotValidatedShort"); |
|
| 138 | - $this->labelstatutshort[1]=$langs->trans("DonationStatusPromiseValidatedShort"); |
|
| 139 | - $this->labelstatutshort[2]=$langs->trans("DonationStatusPaidShort"); |
|
| 132 | + $this->labelstatut[-1] = $langs->trans("Canceled"); |
|
| 133 | + $this->labelstatut[0] = $langs->trans("DonationStatusPromiseNotValidated"); |
|
| 134 | + $this->labelstatut[1] = $langs->trans("DonationStatusPromiseValidated"); |
|
| 135 | + $this->labelstatut[2] = $langs->trans("DonationStatusPaid"); |
|
| 136 | + $this->labelstatutshort[-1] = $langs->trans("Canceled"); |
|
| 137 | + $this->labelstatutshort[0] = $langs->trans("DonationStatusPromiseNotValidatedShort"); |
|
| 138 | + $this->labelstatutshort[1] = $langs->trans("DonationStatusPromiseValidatedShort"); |
|
| 139 | + $this->labelstatutshort[2] = $langs->trans("DonationStatusPaidShort"); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if ($mode == 0) |
@@ -149,38 +149,38 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | elseif ($mode == 2) |
| 151 | 151 | { |
| 152 | - if ($statut == -1) return img_picto($this->labelstatut[$statut],'statut5').' '.$this->labelstatutshort[$statut]; |
|
| 153 | - elseif ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0').' '.$this->labelstatutshort[$statut]; |
|
| 154 | - elseif ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatutshort[$statut]; |
|
| 155 | - elseif ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatutshort[$statut]; |
|
| 152 | + if ($statut == -1) return img_picto($this->labelstatut[$statut], 'statut5').' '.$this->labelstatutshort[$statut]; |
|
| 153 | + elseif ($statut == 0) return img_picto($this->labelstatut[$statut], 'statut0').' '.$this->labelstatutshort[$statut]; |
|
| 154 | + elseif ($statut == 1) return img_picto($this->labelstatut[$statut], 'statut1').' '.$this->labelstatutshort[$statut]; |
|
| 155 | + elseif ($statut == 2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatutshort[$statut]; |
|
| 156 | 156 | } |
| 157 | 157 | elseif ($mode == 3) |
| 158 | 158 | { |
| 159 | - if ($statut == -1) return img_picto($this->labelstatut[$statut],'statut5'); |
|
| 160 | - elseif ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0'); |
|
| 161 | - elseif ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1'); |
|
| 162 | - elseif ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6'); |
|
| 159 | + if ($statut == -1) return img_picto($this->labelstatut[$statut], 'statut5'); |
|
| 160 | + elseif ($statut == 0) return img_picto($this->labelstatut[$statut], 'statut0'); |
|
| 161 | + elseif ($statut == 1) return img_picto($this->labelstatut[$statut], 'statut1'); |
|
| 162 | + elseif ($statut == 2) return img_picto($this->labelstatut[$statut], 'statut6'); |
|
| 163 | 163 | } |
| 164 | 164 | elseif ($mode == 4) |
| 165 | 165 | { |
| 166 | - if ($statut == -1) return img_picto($this->labelstatut[$statut],'statut5').' '.$this->labelstatut[$statut]; |
|
| 167 | - elseif ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0').' '.$this->labelstatut[$statut]; |
|
| 168 | - elseif ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatut[$statut]; |
|
| 169 | - elseif ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatut[$statut]; |
|
| 166 | + if ($statut == -1) return img_picto($this->labelstatut[$statut], 'statut5').' '.$this->labelstatut[$statut]; |
|
| 167 | + elseif ($statut == 0) return img_picto($this->labelstatut[$statut], 'statut0').' '.$this->labelstatut[$statut]; |
|
| 168 | + elseif ($statut == 1) return img_picto($this->labelstatut[$statut], 'statut1').' '.$this->labelstatut[$statut]; |
|
| 169 | + elseif ($statut == 2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatut[$statut]; |
|
| 170 | 170 | } |
| 171 | 171 | elseif ($mode == 5) |
| 172 | 172 | { |
| 173 | - if ($statut == -1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut5'); |
|
| 174 | - elseif ($statut == 0) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut0'); |
|
| 175 | - elseif ($statut == 1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut1'); |
|
| 176 | - elseif ($statut == 2) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut6'); |
|
| 173 | + if ($statut == -1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut], 'statut5'); |
|
| 174 | + elseif ($statut == 0) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut], 'statut0'); |
|
| 175 | + elseif ($statut == 1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut], 'statut1'); |
|
| 176 | + elseif ($statut == 2) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6'); |
|
| 177 | 177 | } |
| 178 | 178 | elseif ($mode == 6) |
| 179 | 179 | { |
| 180 | - if ($statut == -1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut5'); |
|
| 181 | - elseif ($statut == 0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut0'); |
|
| 182 | - elseif ($statut == 1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut1'); |
|
| 183 | - elseif ($statut == 2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut6'); |
|
| 180 | + if ($statut == -1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut5'); |
|
| 181 | + elseif ($statut == 0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut0'); |
|
| 182 | + elseif ($statut == 1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut1'); |
|
| 183 | + elseif ($statut == 2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6'); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | function initAsSpecimen() |
| 196 | 196 | { |
| 197 | - global $conf, $user,$langs; |
|
| 197 | + global $conf, $user, $langs; |
|
| 198 | 198 | |
| 199 | 199 | $now = dol_now(); |
| 200 | 200 | |
@@ -202,10 +202,10 @@ discard block |
||
| 202 | 202 | $socids = array(); |
| 203 | 203 | |
| 204 | 204 | $sql = "SELECT rowid"; |
| 205 | - $sql.= " FROM ".MAIN_DB_PREFIX."societe"; |
|
| 206 | - $sql.= " WHERE client IN (1, 3)"; |
|
| 207 | - $sql.= " AND entity = ".$conf->entity; |
|
| 208 | - $sql.= " LIMIT 10"; |
|
| 205 | + $sql .= " FROM ".MAIN_DB_PREFIX."societe"; |
|
| 206 | + $sql .= " WHERE client IN (1, 3)"; |
|
| 207 | + $sql .= " AND entity = ".$conf->entity; |
|
| 208 | + $sql .= " LIMIT 10"; |
|
| 209 | 209 | |
| 210 | 210 | $resql = $this->db->query($sql); |
| 211 | 211 | if ($resql) |
@@ -222,9 +222,9 @@ discard block |
||
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | // Initialise parametres |
| 225 | - $this->id=0; |
|
| 225 | + $this->id = 0; |
|
| 226 | 226 | $this->ref = 'SPECIMEN'; |
| 227 | - $this->specimen=1; |
|
| 227 | + $this->specimen = 1; |
|
| 228 | 228 | $this->lastname = 'Doe'; |
| 229 | 229 | $this->firstname = 'John'; |
| 230 | 230 | $this->socid = 1; |
@@ -236,11 +236,11 @@ discard block |
||
| 236 | 236 | $this->address = 'Twist road'; |
| 237 | 237 | $this->zip = '99999'; |
| 238 | 238 | $this->town = 'Town'; |
| 239 | - $this->note_private='Private note'; |
|
| 240 | - $this->note_public='Public note'; |
|
| 241 | - $this->email='[email protected]'; |
|
| 242 | - $this->note=''; |
|
| 243 | - $this->statut=1; |
|
| 239 | + $this->note_private = 'Private note'; |
|
| 240 | + $this->note_public = 'Public note'; |
|
| 241 | + $this->email = '[email protected]'; |
|
| 242 | + $this->note = ''; |
|
| 243 | + $this->statut = 1; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | * @param int $minimum Minimum |
| 252 | 252 | * @return int 0 if KO, >0 if OK |
| 253 | 253 | */ |
| 254 | - function check($minimum=0) |
|
| 254 | + function check($minimum = 0) |
|
| 255 | 255 | { |
| 256 | 256 | global $langs; |
| 257 | 257 | $langs->load('main'); |
@@ -264,62 +264,62 @@ discard block |
||
| 264 | 264 | { |
| 265 | 265 | if ((dol_strlen(trim($this->lastname)) + dol_strlen(trim($this->firstname))) == 0) |
| 266 | 266 | { |
| 267 | - $error_string[] = $langs->trans('ErrorFieldRequired',$langs->trans('Company').'/'.$langs->trans('Firstname').'-'.$langs->trans('Lastname')); |
|
| 267 | + $error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Company').'/'.$langs->trans('Firstname').'-'.$langs->trans('Lastname')); |
|
| 268 | 268 | $err++; |
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | if (dol_strlen(trim($this->address)) == 0) |
| 273 | 273 | { |
| 274 | - $error_string[] = $langs->trans('ErrorFieldRequired',$langs->trans('Address')); |
|
| 274 | + $error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Address')); |
|
| 275 | 275 | $err++; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | if (dol_strlen(trim($this->zip)) == 0) |
| 279 | 279 | { |
| 280 | - $error_string[] = $langs->trans('ErrorFieldRequired',$langs->trans('Zip')); |
|
| 280 | + $error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Zip')); |
|
| 281 | 281 | $err++; |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | if (dol_strlen(trim($this->town)) == 0) |
| 285 | 285 | { |
| 286 | - $error_string[] = $langs->trans('ErrorFieldRequired',$langs->trans('Town')); |
|
| 286 | + $error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Town')); |
|
| 287 | 287 | $err++; |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | if (dol_strlen(trim($this->email)) == 0) |
| 291 | 291 | { |
| 292 | - $error_string[] = $langs->trans('ErrorFieldRequired',$langs->trans('EMail')); |
|
| 292 | + $error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('EMail')); |
|
| 293 | 293 | $err++; |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | $this->amount = trim($this->amount); |
| 297 | 297 | |
| 298 | - $map = range(0,9); |
|
| 299 | - $len=dol_strlen($this->amount); |
|
| 298 | + $map = range(0, 9); |
|
| 299 | + $len = dol_strlen($this->amount); |
|
| 300 | 300 | for ($i = 0; $i < $len; $i++) |
| 301 | 301 | { |
| 302 | - if (!isset($map[substr($this->amount, $i, 1)] )) |
|
| 302 | + if (!isset($map[substr($this->amount, $i, 1)])) |
|
| 303 | 303 | { |
| 304 | - $error_string[] = $langs->trans('ErrorFieldRequired',$langs->trans('Amount')); |
|
| 304 | + $error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Amount')); |
|
| 305 | 305 | $err++; |
| 306 | 306 | $amount_invalid = 1; |
| 307 | 307 | break; |
| 308 | 308 | } |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - if (! $amount_invalid) |
|
| 311 | + if (!$amount_invalid) |
|
| 312 | 312 | { |
| 313 | 313 | if ($this->amount == 0) |
| 314 | 314 | { |
| 315 | - $error_string[] = $langs->trans('ErrorFieldRequired',$langs->trans('Amount')); |
|
| 315 | + $error_string[] = $langs->trans('ErrorFieldRequired', $langs->trans('Amount')); |
|
| 316 | 316 | $err++; |
| 317 | 317 | } |
| 318 | 318 | else |
| 319 | 319 | { |
| 320 | 320 | if ($this->amount < $minimum && $minimum > 0) |
| 321 | 321 | { |
| 322 | - $error_string[] = $langs->trans('MinimumAmount',$langs->trans('$minimum')); |
|
| 322 | + $error_string[] = $langs->trans('MinimumAmount', $langs->trans('$minimum')); |
|
| 323 | 323 | $err++; |
| 324 | 324 | } |
| 325 | 325 | } |
@@ -344,68 +344,68 @@ discard block |
||
| 344 | 344 | * @return int <0 if KO, id of created donation if OK |
| 345 | 345 | * TODO add numbering module for Ref |
| 346 | 346 | */ |
| 347 | - function create($user, $notrigger=0) |
|
| 347 | + function create($user, $notrigger = 0) |
|
| 348 | 348 | { |
| 349 | 349 | global $conf, $langs; |
| 350 | 350 | |
| 351 | 351 | $error = 0; |
| 352 | 352 | $ret = 0; |
| 353 | - $now=dol_now(); |
|
| 353 | + $now = dol_now(); |
|
| 354 | 354 | |
| 355 | 355 | // Clean parameters |
| 356 | - $this->address=($this->address>0?$this->address:$this->address); |
|
| 357 | - $this->zip=($this->zip>0?$this->zip:$this->zip); |
|
| 358 | - $this->town=($this->town>0?$this->town:$this->town); |
|
| 359 | - $this->country_id=($this->country_id>0?$this->country_id:$this->country_id); |
|
| 360 | - $this->country=($this->country?$this->country:$this->country); |
|
| 356 | + $this->address = ($this->address > 0 ? $this->address : $this->address); |
|
| 357 | + $this->zip = ($this->zip > 0 ? $this->zip : $this->zip); |
|
| 358 | + $this->town = ($this->town > 0 ? $this->town : $this->town); |
|
| 359 | + $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); |
|
| 360 | + $this->country = ($this->country ? $this->country : $this->country); |
|
| 361 | 361 | |
| 362 | 362 | $this->db->begin(); |
| 363 | 363 | |
| 364 | 364 | $sql = "INSERT INTO ".MAIN_DB_PREFIX."don ("; |
| 365 | - $sql.= "datec"; |
|
| 366 | - $sql.= ", entity"; |
|
| 367 | - $sql.= ", amount"; |
|
| 368 | - $sql.= ", fk_payment"; |
|
| 369 | - $sql.= ", firstname"; |
|
| 370 | - $sql.= ", lastname"; |
|
| 371 | - $sql.= ", societe"; |
|
| 372 | - $sql.= ", address"; |
|
| 373 | - $sql.= ", zip"; |
|
| 374 | - $sql.= ", town"; |
|
| 375 | - $sql.= ", fk_country"; |
|
| 376 | - $sql.= ", public"; |
|
| 377 | - $sql.= ", fk_projet"; |
|
| 378 | - $sql.= ", note_private"; |
|
| 379 | - $sql.= ", note_public"; |
|
| 380 | - $sql.= ", fk_user_author"; |
|
| 381 | - $sql.= ", fk_user_valid"; |
|
| 382 | - $sql.= ", datedon"; |
|
| 383 | - $sql.= ", email"; |
|
| 384 | - $sql.= ", phone"; |
|
| 385 | - $sql.= ", phone_mobile"; |
|
| 386 | - $sql.= ") VALUES ("; |
|
| 387 | - $sql.= " '".$this->db->idate($now)."'"; |
|
| 388 | - $sql.= ", ".$conf->entity; |
|
| 389 | - $sql.= ", ".price2num($this->amount); |
|
| 390 | - $sql.= ", ".($this->modepaymentid?$this->modepaymentid:"null"); |
|
| 391 | - $sql.= ", '".$this->db->escape($this->firstname)."'"; |
|
| 392 | - $sql.= ", '".$this->db->escape($this->lastname)."'"; |
|
| 393 | - $sql.= ", '".$this->db->escape($this->societe)."'"; |
|
| 394 | - $sql.= ", '".$this->db->escape($this->address)."'"; |
|
| 395 | - $sql.= ", '".$this->db->escape($this->zip)."'"; |
|
| 396 | - $sql.= ", '".$this->db->escape($this->town)."'"; |
|
| 397 | - $sql.= ", ".($this->country_id > 0 ? $this->country_id : '0'); |
|
| 398 | - $sql.= ", ".((int) $this->public); |
|
| 399 | - $sql.= ", ".($this->fk_project > 0?$this->fk_project:"null"); |
|
| 400 | - $sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL"); |
|
| 401 | - $sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL"); |
|
| 402 | - $sql.= ", ".$user->id; |
|
| 403 | - $sql.= ", null"; |
|
| 404 | - $sql.= ", '".$this->db->idate($this->date)."'"; |
|
| 405 | - $sql.= ", '".$this->db->escape($this->email)."'"; |
|
| 406 | - $sql.= ", '".$this->db->escape($this->phone)."'"; |
|
| 407 | - $sql.= ", '".$this->db->escape($this->phone_mobile)."'"; |
|
| 408 | - $sql.= ")"; |
|
| 365 | + $sql .= "datec"; |
|
| 366 | + $sql .= ", entity"; |
|
| 367 | + $sql .= ", amount"; |
|
| 368 | + $sql .= ", fk_payment"; |
|
| 369 | + $sql .= ", firstname"; |
|
| 370 | + $sql .= ", lastname"; |
|
| 371 | + $sql .= ", societe"; |
|
| 372 | + $sql .= ", address"; |
|
| 373 | + $sql .= ", zip"; |
|
| 374 | + $sql .= ", town"; |
|
| 375 | + $sql .= ", fk_country"; |
|
| 376 | + $sql .= ", public"; |
|
| 377 | + $sql .= ", fk_projet"; |
|
| 378 | + $sql .= ", note_private"; |
|
| 379 | + $sql .= ", note_public"; |
|
| 380 | + $sql .= ", fk_user_author"; |
|
| 381 | + $sql .= ", fk_user_valid"; |
|
| 382 | + $sql .= ", datedon"; |
|
| 383 | + $sql .= ", email"; |
|
| 384 | + $sql .= ", phone"; |
|
| 385 | + $sql .= ", phone_mobile"; |
|
| 386 | + $sql .= ") VALUES ("; |
|
| 387 | + $sql .= " '".$this->db->idate($now)."'"; |
|
| 388 | + $sql .= ", ".$conf->entity; |
|
| 389 | + $sql .= ", ".price2num($this->amount); |
|
| 390 | + $sql .= ", ".($this->modepaymentid ? $this->modepaymentid : "null"); |
|
| 391 | + $sql .= ", '".$this->db->escape($this->firstname)."'"; |
|
| 392 | + $sql .= ", '".$this->db->escape($this->lastname)."'"; |
|
| 393 | + $sql .= ", '".$this->db->escape($this->societe)."'"; |
|
| 394 | + $sql .= ", '".$this->db->escape($this->address)."'"; |
|
| 395 | + $sql .= ", '".$this->db->escape($this->zip)."'"; |
|
| 396 | + $sql .= ", '".$this->db->escape($this->town)."'"; |
|
| 397 | + $sql .= ", ".($this->country_id > 0 ? $this->country_id : '0'); |
|
| 398 | + $sql .= ", ".((int) $this->public); |
|
| 399 | + $sql .= ", ".($this->fk_project > 0 ? $this->fk_project : "null"); |
|
| 400 | + $sql .= ", ".(!empty($this->note_private) ? ("'".$this->db->escape($this->note_private)."'") : "NULL"); |
|
| 401 | + $sql .= ", ".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL"); |
|
| 402 | + $sql .= ", ".$user->id; |
|
| 403 | + $sql .= ", null"; |
|
| 404 | + $sql .= ", '".$this->db->idate($this->date)."'"; |
|
| 405 | + $sql .= ", '".$this->db->escape($this->email)."'"; |
|
| 406 | + $sql .= ", '".$this->db->escape($this->phone)."'"; |
|
| 407 | + $sql .= ", '".$this->db->escape($this->phone_mobile)."'"; |
|
| 408 | + $sql .= ")"; |
|
| 409 | 409 | |
| 410 | 410 | $resql = $this->db->query($sql); |
| 411 | 411 | if ($resql) |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | if (!$notrigger) |
| 417 | 417 | { |
| 418 | 418 | // Call trigger |
| 419 | - $result=$this->call_trigger('DON_CREATE',$user); |
|
| 419 | + $result = $this->call_trigger('DON_CREATE', $user); |
|
| 420 | 420 | if ($result < 0) { $error++; } |
| 421 | 421 | // End call triggers |
| 422 | 422 | } |
@@ -429,10 +429,10 @@ discard block |
||
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | // Update extrafield |
| 432 | - if (! $error) { |
|
| 432 | + if (!$error) { |
|
| 433 | 433 | if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used |
| 434 | 434 | { |
| 435 | - $result=$this->insertExtraFields(); |
|
| 435 | + $result = $this->insertExtraFields(); |
|
| 436 | 436 | if ($result < 0) |
| 437 | 437 | { |
| 438 | 438 | $error++; |
@@ -465,24 +465,24 @@ discard block |
||
| 465 | 465 | * @param int $notrigger Disable triggers |
| 466 | 466 | * @return int >0 if OK, <0 if KO |
| 467 | 467 | */ |
| 468 | - function update($user, $notrigger=0) |
|
| 468 | + function update($user, $notrigger = 0) |
|
| 469 | 469 | { |
| 470 | 470 | global $langs, $conf; |
| 471 | 471 | |
| 472 | - $error=0; |
|
| 472 | + $error = 0; |
|
| 473 | 473 | |
| 474 | 474 | // Clean parameters |
| 475 | - $this->address=($this->address>0?$this->address:$this->address); |
|
| 476 | - $this->zip=($this->zip>0?$this->zip:$this->zip); |
|
| 477 | - $this->town=($this->town>0?$this->town:$this->town); |
|
| 478 | - $this->country_id=($this->country_id>0?$this->country_id:$this->country_id); |
|
| 479 | - $this->country=($this->country?$this->country:$this->country); |
|
| 475 | + $this->address = ($this->address > 0 ? $this->address : $this->address); |
|
| 476 | + $this->zip = ($this->zip > 0 ? $this->zip : $this->zip); |
|
| 477 | + $this->town = ($this->town > 0 ? $this->town : $this->town); |
|
| 478 | + $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); |
|
| 479 | + $this->country = ($this->country ? $this->country : $this->country); |
|
| 480 | 480 | |
| 481 | 481 | $this->db->begin(); |
| 482 | 482 | |
| 483 | 483 | $sql = "UPDATE ".MAIN_DB_PREFIX."don SET "; |
| 484 | - $sql .= "amount = " . price2num($this->amount); |
|
| 485 | - $sql .= ",fk_payment = ".($this->modepaymentid?$this->modepaymentid:"null"); |
|
| 484 | + $sql .= "amount = ".price2num($this->amount); |
|
| 485 | + $sql .= ",fk_payment = ".($this->modepaymentid ? $this->modepaymentid : "null"); |
|
| 486 | 486 | $sql .= ",firstname = '".$this->db->escape($this->firstname)."'"; |
| 487 | 487 | $sql .= ",lastname='".$this->db->escape($this->lastname)."'"; |
| 488 | 488 | $sql .= ",societe='".$this->db->escape($this->societe)."'"; |
@@ -491,11 +491,11 @@ discard block |
||
| 491 | 491 | $sql .= ",town='".$this->db->escape($this->town)."'"; |
| 492 | 492 | $sql .= ",fk_country = ".$this->country_id; |
| 493 | 493 | $sql .= ",public=".$this->public; |
| 494 | - $sql .= ",fk_projet=".($this->fk_project>0?$this->fk_project:'null'); |
|
| 495 | - $sql .= ",note_private=".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL"); |
|
| 496 | - $sql .= ",note_public=".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL"); |
|
| 494 | + $sql .= ",fk_projet=".($this->fk_project > 0 ? $this->fk_project : 'null'); |
|
| 495 | + $sql .= ",note_private=".(!empty($this->note_private) ? ("'".$this->db->escape($this->note_private)."'") : "NULL"); |
|
| 496 | + $sql .= ",note_public=".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL"); |
|
| 497 | 497 | $sql .= ",datedon='".$this->db->idate($this->date)."'"; |
| 498 | - $sql .= ",date_valid=".($this->date_valid?"'".$this->db->idate($this->date)."'":"null"); |
|
| 498 | + $sql .= ",date_valid=".($this->date_valid ? "'".$this->db->idate($this->date)."'" : "null"); |
|
| 499 | 499 | $sql .= ",email='".$this->db->escape($this->email)."'"; |
| 500 | 500 | $sql .= ",phone='".$this->db->escape($this->phone)."'"; |
| 501 | 501 | $sql .= ",phone_mobile='".$this->db->escape($this->phone_mobile)."'"; |
@@ -503,23 +503,23 @@ discard block |
||
| 503 | 503 | $sql .= " WHERE rowid = ".$this->id; |
| 504 | 504 | |
| 505 | 505 | dol_syslog(get_class($this)."::Update", LOG_DEBUG); |
| 506 | - $resql=$this->db->query($sql); |
|
| 506 | + $resql = $this->db->query($sql); |
|
| 507 | 507 | if ($resql) |
| 508 | 508 | { |
| 509 | 509 | if (!$notrigger) |
| 510 | 510 | { |
| 511 | 511 | // Call trigger |
| 512 | - $result=$this->call_trigger('DON_MODIFY',$user); |
|
| 512 | + $result = $this->call_trigger('DON_MODIFY', $user); |
|
| 513 | 513 | if ($result < 0) { $error++; } |
| 514 | 514 | // End call triggers |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | // Update extrafield |
| 518 | - if (! $error) |
|
| 518 | + if (!$error) |
|
| 519 | 519 | { |
| 520 | 520 | if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used |
| 521 | 521 | { |
| 522 | - $result=$this->insertExtraFields(); |
|
| 522 | + $result = $this->insertExtraFields(); |
|
| 523 | 523 | if ($result < 0) |
| 524 | 524 | { |
| 525 | 525 | $error++; |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | } |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | - if (! $error ) |
|
| 530 | + if (!$error) |
|
| 531 | 531 | { |
| 532 | 532 | $this->db->commit(); |
| 533 | 533 | $result = 1; |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | $this->error = $this->db->lasterror(); |
| 544 | 544 | $this->errors[] = $this->error; |
| 545 | 545 | $this->db->rollback(); |
| 546 | - dol_syslog(get_class($this)."::Update error -2 " . $this->error, LOG_ERR); |
|
| 546 | + dol_syslog(get_class($this)."::Update error -2 ".$this->error, LOG_ERR); |
|
| 547 | 547 | $result = -2; |
| 548 | 548 | } |
| 549 | 549 | return $result; |
@@ -556,21 +556,21 @@ discard block |
||
| 556 | 556 | * @param int $notrigger Disable triggers |
| 557 | 557 | * @return int <0 if KO, 0 if not possible, >0 if OK |
| 558 | 558 | */ |
| 559 | - function delete($user, $notrigger=0) |
|
| 559 | + function delete($user, $notrigger = 0) |
|
| 560 | 560 | { |
| 561 | 561 | global $user, $conf, $langs; |
| 562 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
| 562 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
| 563 | 563 | |
| 564 | 564 | $error = 0; |
| 565 | 565 | |
| 566 | 566 | $this->db->begin(); |
| 567 | 567 | |
| 568 | - if (! $error) |
|
| 568 | + if (!$error) |
|
| 569 | 569 | { |
| 570 | 570 | if (!$notrigger) |
| 571 | 571 | { |
| 572 | 572 | // Call trigger |
| 573 | - $result=$this->call_trigger('DON_DELETE',$user); |
|
| 573 | + $result = $this->call_trigger('DON_DELETE', $user); |
|
| 574 | 574 | |
| 575 | 575 | if ($result < 0) { |
| 576 | 576 | $error++; |
@@ -580,23 +580,23 @@ discard block |
||
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | // Delete donation |
| 583 | - if (! $error) |
|
| 583 | + if (!$error) |
|
| 584 | 584 | { |
| 585 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "don_extrafields"; |
|
| 586 | - $sql.= " WHERE fk_object=" . $this->id; |
|
| 585 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."don_extrafields"; |
|
| 586 | + $sql .= " WHERE fk_object=".$this->id; |
|
| 587 | 587 | |
| 588 | 588 | $resql = $this->db->query($sql); |
| 589 | - if (! $resql) |
|
| 589 | + if (!$resql) |
|
| 590 | 590 | { |
| 591 | 591 | $this->errors[] = $this->db->lasterror(); |
| 592 | 592 | $error++; |
| 593 | 593 | } |
| 594 | 594 | } |
| 595 | 595 | |
| 596 | - if (! $error) |
|
| 596 | + if (!$error) |
|
| 597 | 597 | { |
| 598 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "don"; |
|
| 599 | - $sql.= " WHERE rowid=" . $this->id; |
|
| 598 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."don"; |
|
| 599 | + $sql .= " WHERE rowid=".$this->id; |
|
| 600 | 600 | |
| 601 | 601 | $resql = $this->db->query($sql); |
| 602 | 602 | if (!$resql) |
@@ -606,19 +606,19 @@ discard block |
||
| 606 | 606 | } |
| 607 | 607 | } |
| 608 | 608 | |
| 609 | - if (! $error) |
|
| 609 | + if (!$error) |
|
| 610 | 610 | { |
| 611 | 611 | $this->db->commit(); |
| 612 | 612 | return 1; |
| 613 | 613 | } |
| 614 | 614 | else |
| 615 | 615 | { |
| 616 | - foreach($this->errors as $errmsg) |
|
| 616 | + foreach ($this->errors as $errmsg) |
|
| 617 | 617 | { |
| 618 | - dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR); |
|
| 619 | - $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); |
|
| 618 | + dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); |
|
| 619 | + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); |
|
| 620 | 620 | } |
| 621 | - dol_syslog(get_class($this) . "::delete " . $this->error, LOG_ERR); |
|
| 621 | + dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); |
|
| 622 | 622 | $this->db->rollback(); |
| 623 | 623 | return -1; |
| 624 | 624 | } |
@@ -631,33 +631,33 @@ discard block |
||
| 631 | 631 | * @param string $ref Ref of donation to load |
| 632 | 632 | * @return int <0 if KO, >0 if OK |
| 633 | 633 | */ |
| 634 | - function fetch($id, $ref='') |
|
| 634 | + function fetch($id, $ref = '') |
|
| 635 | 635 | { |
| 636 | 636 | global $conf; |
| 637 | 637 | |
| 638 | 638 | $sql = "SELECT d.rowid, d.datec, d.date_valid, d.tms as datem, d.datedon,"; |
| 639 | - $sql.= " d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, "; |
|
| 640 | - $sql.= " d.fk_country, d.country as country_olddata, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, d.email, d.phone, "; |
|
| 641 | - $sql.= " d.phone_mobile, d.fk_projet as fk_project, d.model_pdf,"; |
|
| 642 | - $sql.= " p.ref as project_ref,"; |
|
| 643 | - $sql.= " cp.libelle as payment_label, cp.code as payment_code,"; |
|
| 644 | - $sql.= " c.code as country_code, c.label as country"; |
|
| 645 | - $sql.= " FROM ".MAIN_DB_PREFIX."don as d"; |
|
| 646 | - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = d.fk_projet"; |
|
| 647 | - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON cp.id = d.fk_payment"; |
|
| 648 | - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.fk_country = c.rowid"; |
|
| 649 | - $sql.= " WHERE d.entity IN (".getEntity('donation').")"; |
|
| 650 | - if (! empty($id)) |
|
| 639 | + $sql .= " d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, "; |
|
| 640 | + $sql .= " d.fk_country, d.country as country_olddata, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, d.email, d.phone, "; |
|
| 641 | + $sql .= " d.phone_mobile, d.fk_projet as fk_project, d.model_pdf,"; |
|
| 642 | + $sql .= " p.ref as project_ref,"; |
|
| 643 | + $sql .= " cp.libelle as payment_label, cp.code as payment_code,"; |
|
| 644 | + $sql .= " c.code as country_code, c.label as country"; |
|
| 645 | + $sql .= " FROM ".MAIN_DB_PREFIX."don as d"; |
|
| 646 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = d.fk_projet"; |
|
| 647 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON cp.id = d.fk_payment"; |
|
| 648 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.fk_country = c.rowid"; |
|
| 649 | + $sql .= " WHERE d.entity IN (".getEntity('donation').")"; |
|
| 650 | + if (!empty($id)) |
|
| 651 | 651 | { |
| 652 | - $sql.= " AND d.rowid=".$id; |
|
| 652 | + $sql .= " AND d.rowid=".$id; |
|
| 653 | 653 | } |
| 654 | - else if (! empty($ref)) |
|
| 654 | + else if (!empty($ref)) |
|
| 655 | 655 | { |
| 656 | - $sql.= " AND d.ref='".$this->db->escape($ref)."'"; |
|
| 656 | + $sql .= " AND d.ref='".$this->db->escape($ref)."'"; |
|
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | dol_syslog(get_class($this)."::fetch", LOG_DEBUG); |
| 660 | - $resql=$this->db->query($sql); |
|
| 660 | + $resql = $this->db->query($sql); |
|
| 661 | 661 | if ($resql) |
| 662 | 662 | { |
| 663 | 663 | if ($this->db->num_rows($resql)) |
@@ -681,21 +681,21 @@ discard block |
||
| 681 | 681 | $this->country_id = $obj->fk_country; |
| 682 | 682 | $this->country_code = $obj->country_code; |
| 683 | 683 | $this->country = $obj->country; |
| 684 | - $this->country_olddata= $obj->country_olddata; // deprecated |
|
| 685 | - $this->email = $obj->email; |
|
| 684 | + $this->country_olddata = $obj->country_olddata; // deprecated |
|
| 685 | + $this->email = $obj->email; |
|
| 686 | 686 | $this->phone = $obj->phone; |
| 687 | 687 | $this->phone_mobile = $obj->phone_mobile; |
| 688 | 688 | $this->project = $obj->project_ref; |
| 689 | - $this->fk_projet = $obj->fk_project; // deprecated |
|
| 689 | + $this->fk_projet = $obj->fk_project; // deprecated |
|
| 690 | 690 | $this->fk_project = $obj->fk_project; |
| 691 | 691 | $this->public = $obj->public; |
| 692 | 692 | $this->modepaymentid = $obj->fk_payment; |
| 693 | 693 | $this->modepaymentcode = $obj->payment_code; |
| 694 | 694 | $this->modepayment = $obj->payment_label; |
| 695 | - $this->paid = $obj->paid; |
|
| 695 | + $this->paid = $obj->paid; |
|
| 696 | 696 | $this->amount = $obj->amount; |
| 697 | 697 | $this->note_private = $obj->note_private; |
| 698 | - $this->note_public = $obj->note_public; |
|
| 698 | + $this->note_public = $obj->note_public; |
|
| 699 | 699 | $this->modelpdf = $obj->model_pdf; |
| 700 | 700 | |
| 701 | 701 | // Retreive all extrafield |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | * @param int $notrigger 1=Does not execute triggers, 0= execute triggers |
| 719 | 719 | * @return int <0 if KO, >0 if OK |
| 720 | 720 | */ |
| 721 | - function setValid($user, $notrigger=0) |
|
| 721 | + function setValid($user, $notrigger = 0) |
|
| 722 | 722 | { |
| 723 | 723 | return $this->valid_promesse($this->id, $user->id, $notrigger); |
| 724 | 724 | } |
@@ -732,18 +732,18 @@ discard block |
||
| 732 | 732 | * @param int $notrigger Disable triggers |
| 733 | 733 | * @return int <0 if KO, >0 if OK |
| 734 | 734 | */ |
| 735 | - function valid_promesse($id, $userid, $notrigger=0) |
|
| 735 | + function valid_promesse($id, $userid, $notrigger = 0) |
|
| 736 | 736 | { |
| 737 | 737 | // phpcs:enable |
| 738 | 738 | global $langs, $user; |
| 739 | 739 | |
| 740 | - $error=0; |
|
| 740 | + $error = 0; |
|
| 741 | 741 | |
| 742 | 742 | $this->db->begin(); |
| 743 | 743 | |
| 744 | 744 | $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 1, fk_user_valid = ".$userid." WHERE rowid = ".$id." AND fk_statut = 0"; |
| 745 | 745 | |
| 746 | - $resql=$this->db->query($sql); |
|
| 746 | + $resql = $this->db->query($sql); |
|
| 747 | 747 | if ($resql) |
| 748 | 748 | { |
| 749 | 749 | if ($this->db->affected_rows($resql)) |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | if (!$notrigger) |
| 752 | 752 | { |
| 753 | 753 | // Call trigger |
| 754 | - $result=$this->call_trigger('DON_VALIDATE',$user); |
|
| 754 | + $result = $this->call_trigger('DON_VALIDATE', $user); |
|
| 755 | 755 | if ($result < 0) { $error++; } |
| 756 | 756 | // End call triggers |
| 757 | 757 | } |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | * @param int $modepayment mode of payment |
| 784 | 784 | * @return int <0 if KO, >0 if OK |
| 785 | 785 | */ |
| 786 | - function set_paid($id, $modepayment=0) |
|
| 786 | + function set_paid($id, $modepayment = 0) |
|
| 787 | 787 | { |
| 788 | 788 | // phpcs:enable |
| 789 | 789 | $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2"; |
@@ -791,9 +791,9 @@ discard block |
||
| 791 | 791 | { |
| 792 | 792 | $sql .= ", fk_payment=".$modepayment; |
| 793 | 793 | } |
| 794 | - $sql .= " WHERE rowid = ".$id." AND fk_statut = 1"; |
|
| 794 | + $sql .= " WHERE rowid = ".$id." AND fk_statut = 1"; |
|
| 795 | 795 | |
| 796 | - $resql=$this->db->query($sql); |
|
| 796 | + $resql = $this->db->query($sql); |
|
| 797 | 797 | if ($resql) |
| 798 | 798 | { |
| 799 | 799 | if ($this->db->affected_rows($resql)) |
@@ -824,10 +824,10 @@ discard block |
||
| 824 | 824 | // phpcs:enable |
| 825 | 825 | $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = -1 WHERE rowid = ".$id; |
| 826 | 826 | |
| 827 | - $resql=$this->db->query($sql); |
|
| 827 | + $resql = $this->db->query($sql); |
|
| 828 | 828 | if ($resql) |
| 829 | 829 | { |
| 830 | - if ( $this->db->affected_rows($resql) ) |
|
| 830 | + if ($this->db->affected_rows($resql)) |
|
| 831 | 831 | { |
| 832 | 832 | return 1; |
| 833 | 833 | } |
@@ -855,18 +855,18 @@ discard block |
||
| 855 | 855 | // phpcs:enable |
| 856 | 856 | global $conf; |
| 857 | 857 | |
| 858 | - $result=0; |
|
| 858 | + $result = 0; |
|
| 859 | 859 | |
| 860 | 860 | $sql = "SELECT sum(amount) as total"; |
| 861 | - $sql.= " FROM ".MAIN_DB_PREFIX."don"; |
|
| 862 | - $sql.= " WHERE fk_statut = ".$param; |
|
| 863 | - $sql.= " AND entity = ".$conf->entity; |
|
| 861 | + $sql .= " FROM ".MAIN_DB_PREFIX."don"; |
|
| 862 | + $sql .= " WHERE fk_statut = ".$param; |
|
| 863 | + $sql .= " AND entity = ".$conf->entity; |
|
| 864 | 864 | |
| 865 | - $resql=$this->db->query($sql); |
|
| 865 | + $resql = $this->db->query($sql); |
|
| 866 | 866 | if ($resql) |
| 867 | 867 | { |
| 868 | 868 | $obj = $this->db->fetch_object($resql); |
| 869 | - $result=$obj->total; |
|
| 869 | + $result = $obj->total; |
|
| 870 | 870 | } |
| 871 | 871 | |
| 872 | 872 | return $result; |
@@ -883,19 +883,19 @@ discard block |
||
| 883 | 883 | // phpcs:enable |
| 884 | 884 | global $conf; |
| 885 | 885 | |
| 886 | - $this->nb=array(); |
|
| 886 | + $this->nb = array(); |
|
| 887 | 887 | |
| 888 | 888 | $sql = "SELECT count(d.rowid) as nb"; |
| 889 | - $sql.= " FROM ".MAIN_DB_PREFIX."don as d"; |
|
| 890 | - $sql.= " WHERE d.fk_statut > 0"; |
|
| 891 | - $sql.= " AND d.entity IN (".getEntity('donation').")"; |
|
| 889 | + $sql .= " FROM ".MAIN_DB_PREFIX."don as d"; |
|
| 890 | + $sql .= " WHERE d.fk_statut > 0"; |
|
| 891 | + $sql .= " AND d.entity IN (".getEntity('donation').")"; |
|
| 892 | 892 | |
| 893 | - $resql=$this->db->query($sql); |
|
| 893 | + $resql = $this->db->query($sql); |
|
| 894 | 894 | if ($resql) |
| 895 | 895 | { |
| 896 | - while ($obj=$this->db->fetch_object($resql)) |
|
| 896 | + while ($obj = $this->db->fetch_object($resql)) |
|
| 897 | 897 | { |
| 898 | - $this->nb["donations"]=$obj->nb; |
|
| 898 | + $this->nb["donations"] = $obj->nb; |
|
| 899 | 899 | } |
| 900 | 900 | $this->db->free($resql); |
| 901 | 901 | return 1; |
@@ -903,7 +903,7 @@ discard block |
||
| 903 | 903 | else |
| 904 | 904 | { |
| 905 | 905 | dol_print_error($this->db); |
| 906 | - $this->error=$this->db->error(); |
|
| 906 | + $this->error = $this->db->error(); |
|
| 907 | 907 | return -1; |
| 908 | 908 | } |
| 909 | 909 | } |
@@ -915,19 +915,19 @@ discard block |
||
| 915 | 915 | * @param int $notooltip 1=Disable tooltip |
| 916 | 916 | * @return string Chaine avec URL |
| 917 | 917 | */ |
| 918 | - function getNomUrl($withpicto=0, $notooltip=0) |
|
| 918 | + function getNomUrl($withpicto = 0, $notooltip = 0) |
|
| 919 | 919 | { |
| 920 | 920 | global $langs; |
| 921 | 921 | |
| 922 | - $result=''; |
|
| 923 | - $label=$langs->trans("ShowDonation").': '.$this->id; |
|
| 922 | + $result = ''; |
|
| 923 | + $label = $langs->trans("ShowDonation").': '.$this->id; |
|
| 924 | 924 | |
| 925 | - $linkstart = '<a href="' . BASE_URL . '?controller=don&method=card&id=' . $this->id . '" title="' . dol_escape_htmltag($label, 1) . '" class="classfortooltip">'; |
|
| 926 | - $linkend='</a>'; |
|
| 925 | + $linkstart = '<a href="'.BASE_URL.'?controller=don&method=card&id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; |
|
| 926 | + $linkend = '</a>'; |
|
| 927 | 927 | |
| 928 | 928 | $result .= $linkstart; |
| 929 | - if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); |
|
| 930 | - if ($withpicto != 2) $result.= $this->ref; |
|
| 929 | + if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 930 | + if ($withpicto != 2) $result .= $this->ref; |
|
| 931 | 931 | $result .= $linkend; |
| 932 | 932 | |
| 933 | 933 | return $result; |
@@ -942,9 +942,9 @@ discard block |
||
| 942 | 942 | function info($id) |
| 943 | 943 | { |
| 944 | 944 | $sql = 'SELECT d.rowid, d.datec, d.fk_user_author, d.fk_user_valid,'; |
| 945 | - $sql.= ' d.tms'; |
|
| 946 | - $sql.= ' FROM '.MAIN_DB_PREFIX.'don as d'; |
|
| 947 | - $sql.= ' WHERE d.rowid = '.$id; |
|
| 945 | + $sql .= ' d.tms'; |
|
| 946 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'don as d'; |
|
| 947 | + $sql .= ' WHERE d.rowid = '.$id; |
|
| 948 | 948 | |
| 949 | 949 | dol_syslog(get_class($this).'::info', LOG_DEBUG); |
| 950 | 950 | $result = $this->db->query($sql); |
@@ -989,19 +989,19 @@ discard block |
||
| 989 | 989 | * @param int $hideref Hide ref |
| 990 | 990 | * @return int 0 if KO, 1 if OK |
| 991 | 991 | */ |
| 992 | - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) |
|
| 992 | + public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) |
|
| 993 | 993 | { |
| 994 | - global $conf,$langs; |
|
| 994 | + global $conf, $langs; |
|
| 995 | 995 | |
| 996 | 996 | $langs->load("bills"); |
| 997 | 997 | |
| 998 | - if (! dol_strlen($modele)) { |
|
| 998 | + if (!dol_strlen($modele)) { |
|
| 999 | 999 | |
| 1000 | 1000 | $modele = 'html_cerfafr'; |
| 1001 | 1001 | |
| 1002 | 1002 | if ($this->modelpdf) { |
| 1003 | 1003 | $modele = $this->modelpdf; |
| 1004 | - } elseif (! empty($conf->global->DON_ADDON_MODEL)) { |
|
| 1004 | + } elseif (!empty($conf->global->DON_ADDON_MODEL)) { |
|
| 1005 | 1005 | $modele = $conf->global->DON_ADDON_MODEL; |
| 1006 | 1006 | } |
| 1007 | 1007 | } |
@@ -1012,37 +1012,37 @@ discard block |
||
| 1012 | 1012 | //return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); |
| 1013 | 1013 | |
| 1014 | 1014 | // Increase limit for PDF build |
| 1015 | - $err=error_reporting(); |
|
| 1015 | + $err = error_reporting(); |
|
| 1016 | 1016 | error_reporting(0); |
| 1017 | 1017 | @set_time_limit(120); |
| 1018 | 1018 | error_reporting($err); |
| 1019 | 1019 | |
| 1020 | - $srctemplatepath=''; |
|
| 1020 | + $srctemplatepath = ''; |
|
| 1021 | 1021 | |
| 1022 | 1022 | // If selected modele is a filename template (then $modele="modelname:filename") |
| 1023 | - $tmp=explode(':',$modele,2); |
|
| 1024 | - if (! empty($tmp[1])) |
|
| 1023 | + $tmp = explode(':', $modele, 2); |
|
| 1024 | + if (!empty($tmp[1])) |
|
| 1025 | 1025 | { |
| 1026 | - $modele=$tmp[0]; |
|
| 1027 | - $srctemplatepath=$tmp[1]; |
|
| 1026 | + $modele = $tmp[0]; |
|
| 1027 | + $srctemplatepath = $tmp[1]; |
|
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | 1030 | // Search template files |
| 1031 | - $file=''; $classname=''; $filefound=0; |
|
| 1032 | - $dirmodels=array('/'); |
|
| 1033 | - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
| 1034 | - foreach($dirmodels as $reldir) |
|
| 1031 | + $file = ''; $classname = ''; $filefound = 0; |
|
| 1032 | + $dirmodels = array('/'); |
|
| 1033 | + if (is_array($conf->modules_parts['models'])) $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); |
|
| 1034 | + foreach ($dirmodels as $reldir) |
|
| 1035 | 1035 | { |
| 1036 | - foreach(array('html','doc','pdf') as $prefix) |
|
| 1036 | + foreach (array('html', 'doc', 'pdf') as $prefix) |
|
| 1037 | 1037 | { |
| 1038 | - $file = $prefix."_".preg_replace('/^html_/','',$modele).".modules.php"; |
|
| 1038 | + $file = $prefix."_".preg_replace('/^html_/', '', $modele).".modules.php"; |
|
| 1039 | 1039 | |
| 1040 | 1040 | // On verifie l'emplacement du modele |
| 1041 | - $file=dol_buildpath($reldir."core/modules/dons/".$file,0); |
|
| 1041 | + $file = dol_buildpath($reldir."core/modules/dons/".$file, 0); |
|
| 1042 | 1042 | if (file_exists($file)) |
| 1043 | 1043 | { |
| 1044 | - $filefound=1; |
|
| 1045 | - $classname=$prefix.'_'.$modele; |
|
| 1044 | + $filefound = 1; |
|
| 1045 | + $classname = $prefix.'_'.$modele; |
|
| 1046 | 1046 | break; |
| 1047 | 1047 | } |
| 1048 | 1048 | } |
@@ -1054,17 +1054,17 @@ discard block |
||
| 1054 | 1054 | { |
| 1055 | 1055 | require_once $file; |
| 1056 | 1056 | |
| 1057 | - $object=$this; |
|
| 1057 | + $object = $this; |
|
| 1058 | 1058 | |
| 1059 | 1059 | $classname = $modele; |
| 1060 | 1060 | $obj = new $classname($this->db); |
| 1061 | 1061 | |
| 1062 | 1062 | // We save charset_output to restore it because write_file can change it if needed for |
| 1063 | 1063 | // output format that does not support UTF8. |
| 1064 | - $sav_charset_output=$outputlangs->charset_output; |
|
| 1065 | - if ($obj->write_file($object,$outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) |
|
| 1064 | + $sav_charset_output = $outputlangs->charset_output; |
|
| 1065 | + if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) |
|
| 1066 | 1066 | { |
| 1067 | - $outputlangs->charset_output=$sav_charset_output; |
|
| 1067 | + $outputlangs->charset_output = $sav_charset_output; |
|
| 1068 | 1068 | |
| 1069 | 1069 | // we delete preview files |
| 1070 | 1070 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
@@ -1073,15 +1073,15 @@ discard block |
||
| 1073 | 1073 | } |
| 1074 | 1074 | else |
| 1075 | 1075 | { |
| 1076 | - $outputlangs->charset_output=$sav_charset_output; |
|
| 1076 | + $outputlangs->charset_output = $sav_charset_output; |
|
| 1077 | 1077 | dol_syslog("Erreur dans don_create"); |
| 1078 | - dol_print_error($this->db,$obj->error); |
|
| 1078 | + dol_print_error($this->db, $obj->error); |
|
| 1079 | 1079 | return 0; |
| 1080 | 1080 | } |
| 1081 | 1081 | } |
| 1082 | 1082 | else |
| 1083 | 1083 | { |
| 1084 | - print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); |
|
| 1084 | + print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $file); |
|
| 1085 | 1085 | return 0; |
| 1086 | 1086 | } |
| 1087 | 1087 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * \brief File of class to manage payment of donations |
| 22 | 22 | */ |
| 23 | 23 | |
| 24 | -require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; |
|
| 24 | +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; |
|
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | public $datec = ''; |
| 58 | 58 | public $tms = ''; |
| 59 | 59 | public $datep = ''; |
| 60 | - public $amount; // Total amount of payment |
|
| 61 | - public $amounts = array(); // Array of amounts |
|
| 60 | + public $amount; // Total amount of payment |
|
| 61 | + public $amounts = array(); // Array of amounts |
|
| 62 | 62 | public $typepayment; |
| 63 | 63 | public $num_payment; |
| 64 | 64 | |
@@ -141,18 +141,18 @@ discard block |
||
| 141 | 141 | $this->db->begin(); |
| 142 | 142 | |
| 143 | 143 | if ($totalamount != 0) { |
| 144 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "payment_donation (fk_donation, datec, datep, amount,"; |
|
| 144 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_donation (fk_donation, datec, datep, amount,"; |
|
| 145 | 145 | $sql .= " fk_typepayment, num_payment, note, fk_user_creat, fk_bank)"; |
| 146 | - $sql .= " VALUES ($this->chid, '" . $this->db->idate($now) . "',"; |
|
| 147 | - $sql .= " '" . $this->db->idate($this->datepaid) . "',"; |
|
| 148 | - $sql .= " " . $totalamount . ","; |
|
| 149 | - $sql .= " " . $this->paymenttype . ", '" . $this->db->escape($this->num_payment) . "', '" . $this->db->escape($this->note) . "', " . $user->id . ","; |
|
| 146 | + $sql .= " VALUES ($this->chid, '".$this->db->idate($now)."',"; |
|
| 147 | + $sql .= " '".$this->db->idate($this->datepaid)."',"; |
|
| 148 | + $sql .= " ".$totalamount.","; |
|
| 149 | + $sql .= " ".$this->paymenttype.", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".$user->id.","; |
|
| 150 | 150 | $sql .= " 0)"; |
| 151 | 151 | |
| 152 | - dol_syslog(get_class($this) . "::create", LOG_DEBUG); |
|
| 152 | + dol_syslog(get_class($this)."::create", LOG_DEBUG); |
|
| 153 | 153 | $resql = $this->db->query($sql); |
| 154 | 154 | if ($resql) { |
| 155 | - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "payment_donation"); |
|
| 155 | + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_donation"); |
|
| 156 | 156 | $this->ref = $this->id; |
| 157 | 157 | } else { |
| 158 | 158 | $error++; |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | if ($totalamount != 0 && !$error) { |
| 172 | 172 | $this->amount = $totalamount; |
| 173 | - $this->total = $totalamount; // deprecated |
|
| 173 | + $this->total = $totalamount; // deprecated |
|
| 174 | 174 | $this->db->commit(); |
| 175 | 175 | return $this->id; |
| 176 | 176 | } else { |
@@ -204,12 +204,12 @@ discard block |
||
| 204 | 204 | $sql .= " t.fk_user_modif,"; |
| 205 | 205 | $sql .= " pt.code as type_code, pt.libelle as type_libelle,"; |
| 206 | 206 | $sql .= ' b.fk_account'; |
| 207 | - $sql .= " FROM " . MAIN_DB_PREFIX . "payment_donation as t"; |
|
| 208 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_paiement as pt ON t.fk_typepayment = pt.id"; |
|
| 209 | - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON t.fk_bank = b.rowid'; |
|
| 210 | - $sql .= " WHERE t.rowid = " . $id; |
|
| 207 | + $sql .= " FROM ".MAIN_DB_PREFIX."payment_donation as t"; |
|
| 208 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id"; |
|
| 209 | + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid'; |
|
| 210 | + $sql .= " WHERE t.rowid = ".$id; |
|
| 211 | 211 | |
| 212 | - dol_syslog(get_class($this) . "::fetch", LOG_DEBUG); |
|
| 212 | + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); |
|
| 213 | 213 | $resql = $this->db->query($sql); |
| 214 | 214 | if ($resql) { |
| 215 | 215 | if ($this->db->num_rows($resql)) { |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | return 1; |
| 242 | 242 | } else { |
| 243 | - $this->error = "Error " . $this->db->lasterror(); |
|
| 243 | + $this->error = "Error ".$this->db->lasterror(); |
|
| 244 | 244 | return -1; |
| 245 | 245 | } |
| 246 | 246 | } |
@@ -273,27 +273,27 @@ discard block |
||
| 273 | 273 | // Put here code to add control on parameters values |
| 274 | 274 | |
| 275 | 275 | // Update request |
| 276 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "payment_donation SET"; |
|
| 277 | - $sql .= " fk_donation=" . (isset($this->fk_donation) ? $this->fk_donation : "null") . ","; |
|
| 278 | - $sql .= " datec=" . (dol_strlen($this->datec) != 0 ? "'" . $this->db->idate($this->datec) . "'" : 'null') . ","; |
|
| 279 | - $sql .= " tms=" . (dol_strlen($this->tms) != 0 ? "'" . $this->db->idate($this->tms) . "'" : 'null') . ","; |
|
| 280 | - $sql .= " datep=" . (dol_strlen($this->datep) != 0 ? "'" . $this->db->idate($this->datep) . "'" : 'null') . ","; |
|
| 281 | - $sql .= " amount=" . (isset($this->amount) ? $this->amount : "null") . ","; |
|
| 282 | - $sql .= " fk_typepayment=" . (isset($this->fk_typepayment) ? $this->fk_typepayment : "null") . ","; |
|
| 283 | - $sql .= " num_payment=" . (isset($this->num_payment) ? "'" . $this->db->escape($this->num_payment) . "'" : "null") . ","; |
|
| 284 | - $sql .= " note=" . (isset($this->note) ? "'" . $this->db->escape($this->note) . "'" : "null") . ","; |
|
| 285 | - $sql .= " fk_bank=" . (isset($this->fk_bank) ? $this->fk_bank : "null") . ","; |
|
| 286 | - $sql .= " fk_user_creat=" . (isset($this->fk_user_creat) ? $this->fk_user_creat : "null") . ","; |
|
| 287 | - $sql .= " fk_user_modif=" . (isset($this->fk_user_modif) ? $this->fk_user_modif : "null") . ""; |
|
| 288 | - $sql .= " WHERE rowid=" . $this->id; |
|
| 276 | + $sql = "UPDATE ".MAIN_DB_PREFIX."payment_donation SET"; |
|
| 277 | + $sql .= " fk_donation=".(isset($this->fk_donation) ? $this->fk_donation : "null").","; |
|
| 278 | + $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').","; |
|
| 279 | + $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; |
|
| 280 | + $sql .= " datep=".(dol_strlen($this->datep) != 0 ? "'".$this->db->idate($this->datep)."'" : 'null').","; |
|
| 281 | + $sql .= " amount=".(isset($this->amount) ? $this->amount : "null").","; |
|
| 282 | + $sql .= " fk_typepayment=".(isset($this->fk_typepayment) ? $this->fk_typepayment : "null").","; |
|
| 283 | + $sql .= " num_payment=".(isset($this->num_payment) ? "'".$this->db->escape($this->num_payment)."'" : "null").","; |
|
| 284 | + $sql .= " note=".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : "null").","; |
|
| 285 | + $sql .= " fk_bank=".(isset($this->fk_bank) ? $this->fk_bank : "null").","; |
|
| 286 | + $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").","; |
|
| 287 | + $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null").""; |
|
| 288 | + $sql .= " WHERE rowid=".$this->id; |
|
| 289 | 289 | |
| 290 | 290 | $this->db->begin(); |
| 291 | 291 | |
| 292 | - dol_syslog(get_class($this) . "::update", LOG_DEBUG); |
|
| 292 | + dol_syslog(get_class($this)."::update", LOG_DEBUG); |
|
| 293 | 293 | $resql = $this->db->query($sql); |
| 294 | 294 | if (!$resql) { |
| 295 | 295 | $error++; |
| 296 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 296 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | if (!$error) { |
@@ -312,8 +312,8 @@ discard block |
||
| 312 | 312 | // Commit or rollback |
| 313 | 313 | if ($error) { |
| 314 | 314 | foreach ($this->errors as $errmsg) { |
| 315 | - dol_syslog(get_class($this) . "::update " . $errmsg, LOG_ERR); |
|
| 316 | - $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); |
|
| 315 | + dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); |
|
| 316 | + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); |
|
| 317 | 317 | } |
| 318 | 318 | $this->db->rollback(); |
| 319 | 319 | return -1 * $error; |
@@ -339,26 +339,26 @@ discard block |
||
| 339 | 339 | $this->db->begin(); |
| 340 | 340 | |
| 341 | 341 | if (!$error) { |
| 342 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "bank_url"; |
|
| 343 | - $sql .= " WHERE type='payment_donation' AND url_id=" . $this->id; |
|
| 342 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url"; |
|
| 343 | + $sql .= " WHERE type='payment_donation' AND url_id=".$this->id; |
|
| 344 | 344 | |
| 345 | - dol_syslog(get_class($this) . "::delete", LOG_DEBUG); |
|
| 345 | + dol_syslog(get_class($this)."::delete", LOG_DEBUG); |
|
| 346 | 346 | $resql = $this->db->query($sql); |
| 347 | 347 | if (!$resql) { |
| 348 | 348 | $error++; |
| 349 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 349 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 350 | 350 | } |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | if (!$error) { |
| 354 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "payment_donation"; |
|
| 355 | - $sql .= " WHERE rowid=" . $this->id; |
|
| 354 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_donation"; |
|
| 355 | + $sql .= " WHERE rowid=".$this->id; |
|
| 356 | 356 | |
| 357 | - dol_syslog(get_class($this) . "::delete", LOG_DEBUG); |
|
| 357 | + dol_syslog(get_class($this)."::delete", LOG_DEBUG); |
|
| 358 | 358 | $resql = $this->db->query($sql); |
| 359 | 359 | if (!$resql) { |
| 360 | 360 | $error++; |
| 361 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 361 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 362 | 362 | } |
| 363 | 363 | } |
| 364 | 364 | |
@@ -378,8 +378,8 @@ discard block |
||
| 378 | 378 | // Commit or rollback |
| 379 | 379 | if ($error) { |
| 380 | 380 | foreach ($this->errors as $errmsg) { |
| 381 | - dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR); |
|
| 382 | - $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); |
|
| 381 | + dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); |
|
| 382 | + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); |
|
| 383 | 383 | } |
| 384 | 384 | $this->db->rollback(); |
| 385 | 385 | return -1 * $error; |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | $error = 0; |
| 517 | 517 | |
| 518 | 518 | if (!empty($conf->banque->enabled)) { |
| 519 | - require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; |
|
| 519 | + require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; |
|
| 520 | 520 | |
| 521 | 521 | $acc = new Account($this->db); |
| 522 | 522 | $acc->fetch($accountid); |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | // Insert payment into llx_bank |
| 528 | 528 | $bank_line_id = $acc->addline( |
| 529 | 529 | $this->datepaid, |
| 530 | - $this->paymenttype, // Payment mode id or code ("CHQ or VIR for example") |
|
| 530 | + $this->paymenttype, // Payment mode id or code ("CHQ or VIR for example") |
|
| 531 | 531 | $label, |
| 532 | 532 | $amount, |
| 533 | 533 | $this->num_payment, |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | |
| 549 | 549 | // Add link 'payment', 'payment_supplier', 'payment_donation' in bank_url between payment and bank transaction |
| 550 | 550 | $url = ''; |
| 551 | - if ($mode == 'payment_donation') $url = DOL_URL_ROOT . '/don/payment/card.php?rowid='; |
|
| 551 | + if ($mode == 'payment_donation') $url = DOL_URL_ROOT.'/don/payment/card.php?rowid='; |
|
| 552 | 552 | if ($url) { |
| 553 | 553 | $result = $acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode); |
| 554 | 554 | if ($result <= 0) { |
@@ -581,9 +581,9 @@ discard block |
||
| 581 | 581 | function update_fk_bank($id_bank) |
| 582 | 582 | { |
| 583 | 583 | // phpcs:enable |
| 584 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "payment_donation SET fk_bank = " . $id_bank . " WHERE rowid = " . $this->id; |
|
| 584 | + $sql = "UPDATE ".MAIN_DB_PREFIX."payment_donation SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; |
|
| 585 | 585 | |
| 586 | - dol_syslog(get_class($this) . "::update_fk_bank", LOG_DEBUG); |
|
| 586 | + dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG); |
|
| 587 | 587 | $result = $this->db->query($sql); |
| 588 | 588 | if ($result) { |
| 589 | 589 | return 1; |
@@ -607,15 +607,15 @@ discard block |
||
| 607 | 607 | $result = ''; |
| 608 | 608 | |
| 609 | 609 | if (empty($this->ref)) $this->ref = $this->lib; |
| 610 | - $label = $langs->trans("ShowPayment") . ': ' . $this->ref; |
|
| 610 | + $label = $langs->trans("ShowPayment").': '.$this->ref; |
|
| 611 | 611 | |
| 612 | 612 | if (!empty($this->id)) { |
| 613 | - $link = '<a href="' . DOL_URL_ROOT . '/don/payment/card.php?id=' . $this->id . '" title="' . dol_escape_htmltag($label, 1) . '" class="classfortooltip">'; |
|
| 613 | + $link = '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; |
|
| 614 | 614 | $linkend = '</a>'; |
| 615 | 615 | |
| 616 | - if ($withpicto) $result .= ($link . img_object($label, 'payment', 'class="classfortooltip"') . $linkend . ' '); |
|
| 616 | + if ($withpicto) $result .= ($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend.' '); |
|
| 617 | 617 | if ($withpicto && $withpicto != 2) $result .= ' '; |
| 618 | - if ($withpicto != 2) $result .= $link . ($maxlen ? dol_trunc($this->ref, $maxlen) : $this->ref) . $linkend; |
|
| 618 | + if ($withpicto != 2) $result .= $link.($maxlen ? dol_trunc($this->ref, $maxlen) : $this->ref).$linkend; |
|
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | return $result; |