Merge branch 'develop' of github.com:Dolibarr/dolibarr into fix_list_uniformization
This commit is contained in:
commit
53ae1f9d5b
@ -7,6 +7,7 @@ English Dolibarr ChangeLog
|
||||
|
||||
For users:
|
||||
----------
|
||||
NEW: Several security issues after a second private bug bounty campaign.
|
||||
|
||||
|
||||
For developers:
|
||||
|
||||
@ -582,6 +582,10 @@ if ($resql) {
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($num == 0) {
|
||||
print '<tr><td colspan="'.$totalarray['nbfield'].'"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
print '</form>';
|
||||
|
||||
@ -84,12 +84,10 @@ if (!empty($canvas)) {
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('membercard', 'globalcard'));
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', 0);
|
||||
|
||||
if ($id > 0) {
|
||||
// Fetch object
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
// Load member
|
||||
$result = $object->fetch($id);
|
||||
$result = $object->fetch($id, $ref);
|
||||
|
||||
// Define variables to know what current user can do on users
|
||||
$canadduser = ($user->admin || $user->rights->user->user->creer);
|
||||
@ -97,9 +95,9 @@ if ($id > 0) {
|
||||
if ($object->user_id) {
|
||||
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
|
||||
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
|
||||
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,6 +108,8 @@ if ($id) {
|
||||
$caneditfieldmember = $user->rights->adherent->creer;
|
||||
}
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -42,9 +42,6 @@ $ref = GETPOST('ref', 'alphanohtml');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'adherent', $id);
|
||||
|
||||
// Get parameters
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
@ -63,8 +60,6 @@ if (!$sortfield) {
|
||||
$sortfield = "name";
|
||||
}
|
||||
|
||||
|
||||
$form = new Form($db);
|
||||
$object = new Adherent($db);
|
||||
$membert = new AdherentType($db);
|
||||
$result = $object->fetch($id, $ref);
|
||||
@ -74,6 +69,33 @@ if ($result < 0) {
|
||||
}
|
||||
$upload_dir = $conf->adherent->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'member');
|
||||
|
||||
// Fetch object
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
// Load member
|
||||
$result = $object->fetch($id, $ref);
|
||||
|
||||
// Define variables to know what current user can do on users
|
||||
$canadduser = ($user->admin || $user->rights->user->user->creer);
|
||||
// Define variables to know what current user can do on properties of user linked to edited member
|
||||
if ($object->user_id) {
|
||||
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
|
||||
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
|
||||
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
|
||||
}
|
||||
}
|
||||
|
||||
// Define variables to determine what the current user can do on the members
|
||||
$canaddmember = $user->rights->adherent->creer;
|
||||
// Define variables to determine what the current user can do on the properties of a member
|
||||
if ($id) {
|
||||
$caneditfieldmember = $user->rights->adherent->creer;
|
||||
}
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
@ -26,7 +26,16 @@
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
|
||||
$status = GETPOST('status', 'int');
|
||||
$cotis = GETPOST('cotis', 'int');
|
||||
|
||||
$sortfield = GETPOST('sortfield', 'alphanohtml');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09');
|
||||
|
||||
// Security check
|
||||
if (empty($conf->adherent->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->adherent->export) {
|
||||
accessforbidden();
|
||||
}
|
||||
@ -46,19 +55,10 @@ if (empty($sortorder)) {
|
||||
if (empty($sortfield)) {
|
||||
$sortfield = "d.login";
|
||||
}
|
||||
if (!isset($statut)) {
|
||||
$statut = 1;
|
||||
}
|
||||
|
||||
if (!isset($cotis)) {
|
||||
// by default, members must be up to date of subscription
|
||||
$cotis = 1;
|
||||
}
|
||||
|
||||
|
||||
$sql = "SELECT d.login, d.pass, d.datefin";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d ";
|
||||
$sql .= " WHERE d.statut = ".$statut;
|
||||
$sql .= " WHERE d.statut = ".((int) $status);
|
||||
if ($cotis == 1) {
|
||||
$sql .= " AND datefin > '".$db->idate($now)."'";
|
||||
}
|
||||
@ -70,6 +70,7 @@ if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$param = '';
|
||||
print_barre_liste($langs->trans("HTPasswordExport"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', 0);
|
||||
|
||||
print "<hr>\n";
|
||||
|
||||
@ -32,7 +32,8 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("companies", "members", "ldap", "admin"));
|
||||
|
||||
$rowid = GETPOST('id', 'int');
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alphanohtml');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
// Protection
|
||||
@ -42,12 +43,34 @@ if ($user->socid > 0) {
|
||||
}
|
||||
|
||||
$object = new Adherent($db);
|
||||
$result = $object->fetch($rowid);
|
||||
if (!$result) {
|
||||
dol_print_error($db, "Failed to get adherent: ".$object->error);
|
||||
exit;
|
||||
|
||||
// Fetch object
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
// Load member
|
||||
$result = $object->fetch($id, $ref);
|
||||
|
||||
// Define variables to know what current user can do on users
|
||||
$canadduser = ($user->admin || $user->rights->user->user->creer);
|
||||
// Define variables to know what current user can do on properties of user linked to edited member
|
||||
if ($object->user_id) {
|
||||
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
|
||||
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
|
||||
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
|
||||
}
|
||||
}
|
||||
|
||||
// Define variables to determine what the current user can do on the members
|
||||
$canaddmember = $user->rights->adherent->creer;
|
||||
// Define variables to determine what the current user can do on the properties of a member
|
||||
if ($id) {
|
||||
$caneditfieldmember = $user->rights->adherent->creer;
|
||||
}
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
@ -33,9 +33,7 @@ $langs->loadLangs(array("companies", "members", "bills"));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'adherent', $id);
|
||||
$ref = GETPOST('ref', 'alphanohtml');
|
||||
|
||||
$object = new Adherent($db);
|
||||
$result = $object->fetch($id);
|
||||
@ -46,6 +44,34 @@ if ($result > 0) {
|
||||
|
||||
$permissionnote = $user->rights->adherent->creer; // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
// Fetch object
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
// Load member
|
||||
$result = $object->fetch($id, $ref);
|
||||
|
||||
// Define variables to know what current user can do on users
|
||||
$canadduser = ($user->admin || $user->rights->user->user->creer);
|
||||
// Define variables to know what current user can do on properties of user linked to edited member
|
||||
if ($object->user_id) {
|
||||
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
|
||||
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
|
||||
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
|
||||
}
|
||||
}
|
||||
|
||||
// Define variables to determine what the current user can do on the members
|
||||
$canaddmember = $user->rights->adherent->creer;
|
||||
// Define variables to determine what the current user can do on the properties of a member
|
||||
if ($id) {
|
||||
$caneditfieldmember = $user->rights->adherent->creer;
|
||||
}
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
@ -42,7 +42,9 @@ $langs->loadLangs(array("companies", "bills", "members", "users", "mails", 'othe
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$rowid = GETPOST('rowid', 'int') ?GETPOST('rowid', 'int') : GETPOST('id', 'int');
|
||||
$id = GETPOST('rowid', 'int') ?GETPOST('rowid', 'int') : GETPOST('id', 'int');
|
||||
$rowid = $id;
|
||||
$ref = GETPOST('ref', 'alphanohtml');
|
||||
$typeid = GETPOST('typeid', 'int');
|
||||
$cancel = GETPOST('cancel');
|
||||
|
||||
@ -66,10 +68,6 @@ if (!$sortorder) {
|
||||
$sortorder = "DESC";
|
||||
}
|
||||
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'adherent', $rowid, '', 'cotisation');
|
||||
|
||||
$object = new Adherent($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$adht = new AdherentType($db);
|
||||
@ -82,29 +80,6 @@ $errmsg = '';
|
||||
$defaultdelay = 1;
|
||||
$defaultdelayunit = 'y';
|
||||
|
||||
if ($rowid) {
|
||||
// Load member
|
||||
$result = $object->fetch($rowid);
|
||||
|
||||
// Define variables to know what current user can do on users
|
||||
$canadduser = ($user->admin || $user->rights->user->user->creer);
|
||||
// Define variables to know what current user can do on properties of user linked to edited member
|
||||
if ($object->user_id) {
|
||||
// $user is the user editing, $object->user_id is the user's id linked to the edited member
|
||||
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
|
||||
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
|
||||
}
|
||||
}
|
||||
|
||||
// Define variables to know what current user can do on members
|
||||
$canaddmember = $user->rights->adherent->creer;
|
||||
// Define variables to know what current user can do on properties of a member
|
||||
if ($rowid) {
|
||||
$caneditfieldmember = $user->rights->adherent->creer;
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('subscription'));
|
||||
|
||||
@ -117,6 +92,33 @@ $datefrom = 0;
|
||||
$dateto = 0;
|
||||
$paymentdate = -1;
|
||||
|
||||
// Fetch object
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
// Load member
|
||||
$result = $object->fetch($id, $ref);
|
||||
|
||||
// Define variables to know what current user can do on users
|
||||
$canadduser = ($user->admin || $user->rights->user->user->creer);
|
||||
// Define variables to know what current user can do on properties of user linked to edited member
|
||||
if ($object->user_id) {
|
||||
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
|
||||
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
|
||||
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
|
||||
}
|
||||
}
|
||||
|
||||
// Define variables to determine what the current user can do on the members
|
||||
$canaddmember = $user->rights->adherent->creer;
|
||||
// Define variables to determine what the current user can do on the properties of a member
|
||||
if ($id) {
|
||||
$caneditfieldmember = $user->rights->adherent->creer;
|
||||
}
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
@ -496,11 +496,14 @@ while ($i < min($num, $limit)) {
|
||||
$adherent->morphy = $obj->morphy;
|
||||
$adherent->email = $obj->email;
|
||||
$adherent->typeid = $obj->type;
|
||||
$adherent->datefin = $db->jdate($obj->datef);
|
||||
|
||||
$typeid = ($obj->fk_type > 0 ? $obj->fk_type : $adherent->typeid);
|
||||
$adht = new AdherentType($db);
|
||||
$adht->fetch($typeid);
|
||||
|
||||
$adherent->need_subscription = $adht->subscription;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
|
||||
@ -30,71 +30,100 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/vcard.class.php';
|
||||
|
||||
$adherent = new adherent($db);
|
||||
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alphanohtml');
|
||||
|
||||
$object = new adherent($db);
|
||||
|
||||
// Fetch object
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
// Load member
|
||||
$result = $object->fetch($id, $ref);
|
||||
|
||||
// Define variables to know what current user can do on users
|
||||
$canadduser = ($user->admin || $user->rights->user->user->creer);
|
||||
// Define variables to know what current user can do on properties of user linked to edited member
|
||||
if ($object->user_id) {
|
||||
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
|
||||
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
|
||||
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
|
||||
}
|
||||
}
|
||||
|
||||
// Define variables to determine what the current user can do on the members
|
||||
$canaddmember = $user->rights->adherent->creer;
|
||||
// Define variables to determine what the current user can do on the properties of a member
|
||||
if ($id) {
|
||||
$caneditfieldmember = $user->rights->adherent->creer;
|
||||
}
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', $objcanvas);
|
||||
$result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0);
|
||||
|
||||
|
||||
$result = $adherent->fetch($id);
|
||||
if ($result <= 0) {
|
||||
dol_print_error($adherent->error);
|
||||
exit;
|
||||
}
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$physicalperson = 1;
|
||||
// None
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$company = new Societe($db);
|
||||
if ($adherent->socid) {
|
||||
$result = $company->fetch($adherent->socid);
|
||||
if ($object->socid) {
|
||||
$result = $company->fetch($object->socid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// We create VCard
|
||||
$v = new vCard();
|
||||
$v->setProdId('Dolibarr '.DOL_VERSION);
|
||||
|
||||
$v->setUid('DOLIBARR-ADHERENTID-'.$adherent->id);
|
||||
$v->setName($adherent->lastname, $adherent->firstname, "", $adherent->civility, "");
|
||||
$v->setFormattedName($adherent->getFullName($langs, 1));
|
||||
$v->setUid('DOLIBARR-ADHERENTID-'.$object->id);
|
||||
$v->setName($object->lastname, $object->firstname, "", $object->civility, "");
|
||||
$v->setFormattedName($object->getFullName($langs, 1));
|
||||
|
||||
$v->setPhoneNumber($adherent->phone_pro, "TYPE=WORK;VOICE");
|
||||
//$v->setPhoneNumber($adherent->phone_perso,"TYPE=HOME;VOICE");
|
||||
$v->setPhoneNumber($adherent->phone_mobile, "TYPE=CELL;VOICE");
|
||||
$v->setPhoneNumber($adherent->fax, "TYPE=WORK;FAX");
|
||||
$v->setPhoneNumber($object->phone_pro, "TYPE=WORK;VOICE");
|
||||
//$v->setPhoneNumber($object->phone_perso,"TYPE=HOME;VOICE");
|
||||
$v->setPhoneNumber($object->phone_mobile, "TYPE=CELL;VOICE");
|
||||
$v->setPhoneNumber($object->fax, "TYPE=WORK;FAX");
|
||||
|
||||
$country = $adherent->country_code ? $adherent->country : '';
|
||||
$country = $object->country_code ? $object->country : '';
|
||||
|
||||
$v->setAddress("", "", $adherent->address, $adherent->town, $adherent->state, $adherent->zip, $country, "TYPE=WORK;POSTAL");
|
||||
$v->setLabel("", "", $adherent->address, $adherent->town, $adherent->state, $adherent->zip, $country, "TYPE=WORK");
|
||||
$v->setAddress("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK;POSTAL");
|
||||
$v->setLabel("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK");
|
||||
|
||||
$v->setEmail($adherent->email);
|
||||
$v->setNote($adherent->note_public);
|
||||
$v->setTitle($adherent->poste);
|
||||
$v->setEmail($object->email);
|
||||
$v->setNote($object->note_public);
|
||||
$v->setTitle($object->poste);
|
||||
|
||||
// Data from linked company
|
||||
if ($company->id) {
|
||||
$v->setURL($company->url, "TYPE=WORK");
|
||||
if (!$adherent->phone_pro) {
|
||||
if (!$object->phone_pro) {
|
||||
$v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE");
|
||||
}
|
||||
if (!$adherent->fax) {
|
||||
if (!$object->fax) {
|
||||
$v->setPhoneNumber($company->fax, "TYPE=WORK;FAX");
|
||||
}
|
||||
if (!$adherent->zip) {
|
||||
if (!$object->zip) {
|
||||
$v->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK;POSTAL");
|
||||
}
|
||||
// when company e-mail is empty, use only adherent e-mail
|
||||
if (empty(trim($company->email))) {
|
||||
// was set before, don't set twice
|
||||
} elseif (empty(trim($adherent->email))) {
|
||||
} elseif (empty(trim($object->email))) {
|
||||
// when adherent e-mail is empty, use only company e-mail
|
||||
$v->setEmail($company->email);
|
||||
} elseif (strtolower(end(explode("@", $adherent->email))) == strtolower(end(explode("@", $company->email)))) {
|
||||
} elseif (strtolower(end(explode("@", $object->email))) == strtolower(end(explode("@", $company->email)))) {
|
||||
// when e-mail domain of adherent and company are the same, use adherent e-mail at first (and company e-mail at second)
|
||||
$v->setEmail($adherent->email);
|
||||
$v->setEmail($object->email);
|
||||
|
||||
// support by Microsoft Outlook (2019 and possible earlier)
|
||||
$v->setEmail($company->email, 'INTERNET');
|
||||
@ -103,7 +132,7 @@ if ($company->id) {
|
||||
$v->setEmail($company->email);
|
||||
|
||||
// support by Microsoft Outlook (2019 and possible earlier)
|
||||
$v->setEmail($adherent->email, 'INTERNET');
|
||||
$v->setEmail($object->email, 'INTERNET');
|
||||
}
|
||||
|
||||
// Si adherent lie a un tiers non de type "particulier"
|
||||
@ -113,9 +142,9 @@ if ($company->id) {
|
||||
}
|
||||
|
||||
// Personal informations
|
||||
$v->setPhoneNumber($adherent->phone_perso, "TYPE=HOME;VOICE");
|
||||
if ($adherent->birth) {
|
||||
$v->setBirthday($adherent->birth);
|
||||
$v->setPhoneNumber($object->phone_perso, "TYPE=HOME;VOICE");
|
||||
if ($object->birth) {
|
||||
$v->setBirthday($object->birth);
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -93,7 +93,7 @@ print '<br>';
|
||||
|
||||
// Show info setup module
|
||||
print img_picto('', 'cog', 'class="paddingright"').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules"));
|
||||
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only user module enabled
|
||||
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only minimal initial modules enabled
|
||||
$langs->load("errors");
|
||||
$warnpicto = img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"');
|
||||
print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$warnpicto.$langs->trans("WarningEnableYourModulesApplications").'</a></div>';
|
||||
|
||||
@ -463,11 +463,13 @@ asort($orders);
|
||||
//var_dump($modules);
|
||||
|
||||
$nbofactivatedmodules = count($conf->modules);
|
||||
$moreinfo = $langs->trans("TitleNumberOfActivatedModules");
|
||||
|
||||
//$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING = 1000;
|
||||
/*$moreinfo = $langs->trans("TitleNumberOfActivatedModules");
|
||||
$moreinfo2 = '<b class="largenumber">'.($nbofactivatedmodules - 1).'</b> / <b class="largenumber">'.count($modules).'</b>';
|
||||
if ($nbofactivatedmodules <= 1) {
|
||||
if ($nbofactivatedmodules <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) {
|
||||
$moreinfo2 .= ' '.img_warning($langs->trans("YouMustEnableOneModule"));
|
||||
}
|
||||
}*/
|
||||
|
||||
print load_fiche_titre($langs->trans("ModulesSetup"), '', 'title_setup');
|
||||
|
||||
@ -476,7 +478,9 @@ $deschelp = '';
|
||||
if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
$desc = $langs->trans("ModulesDesc", '{picto}');
|
||||
$desc = str_replace('{picto}', img_picto('', 'switch_off'), $desc);
|
||||
$deschelp = '<div class="info hideonsmartphone">'.$desc."<br></div><br>\n";
|
||||
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only minimal initial modules enabled
|
||||
$deschelp = '<div class="info hideonsmartphone">'.$desc."<br></div><br>\n";
|
||||
}
|
||||
}
|
||||
if ($mode == 'marketplace') {
|
||||
//$deschelp = '<div class="info hideonsmartphone">'.$langs->trans("ModulesMarketPlaceDesc")."<br></div><br>\n";
|
||||
@ -488,7 +492,7 @@ if ($mode == 'develop') {
|
||||
$deschelp = '<div class="info hideonsmartphone">'.$langs->trans("ModulesDevelopDesc")."<br></div><br>\n";
|
||||
}
|
||||
|
||||
$head = modules_prepare_head();
|
||||
$head = modules_prepare_head($nbofactivatedmodules, count($modules));
|
||||
|
||||
|
||||
if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
@ -521,7 +525,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-list-alt imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', 1, array('morecss'=>'reposition'.($mode == 'commonkanban' ? '' : ' btnTitleSelected')));
|
||||
$moreforfilter .= '</li></ul></div>';
|
||||
|
||||
$moreforfilter .= '<div class="floatright center marginrightonly hideonsmartphone" style="padding-top: 3px"><span class="paddingright">'.$moreinfo.'</span> '.$moreinfo2.'</div>';
|
||||
//$moreforfilter .= '<div class="floatright center marginrightonly hideonsmartphone" style="padding-top: 3px"><span class="paddingright">'.$moreinfo.'</span> '.$moreinfo2.'</div>';
|
||||
|
||||
$moreforfilter .= '<div class="colorbacktimesheet float valignmiddle">';
|
||||
$moreforfilter .= '<div class="divsearchfield paddingtop">';
|
||||
|
||||
@ -1,216 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @deprecated Old explorer. Not using Swagger. See instead explorer in htdocs/api/index.php.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup api Module DolibarrApi
|
||||
* \brief API loader
|
||||
* Search files htdocs/<module>/class/api_<module>.class.php
|
||||
* \file htdocs/api/admin/explorer.php
|
||||
*/
|
||||
|
||||
use Luracast\Restler\Routes;
|
||||
|
||||
require_once '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/api/class/api_access.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->load("admin");
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
// Enable and test if module Api is enabled
|
||||
if (empty($conf->global->MAIN_MODULE_API)) {
|
||||
dol_syslog("Call Dolibarr API interfaces with module REST disabled");
|
||||
print $langs->trans("WarningModuleNotActive", 'Api').'.<br><br>';
|
||||
print $langs->trans("ToActivateModule");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$api = new DolibarrApi($db);
|
||||
|
||||
$api->r->addAPIClass('Luracast\\Restler\\Resources'); //this creates resources.json at API Root
|
||||
$api->r->setSupportedFormats('JsonFormat', 'XmlFormat');
|
||||
$api->r->addAuthenticationClass('DolibarrApiAccess', '');
|
||||
|
||||
$listofapis = array();
|
||||
|
||||
$modulesdir = dolGetModulesDirs();
|
||||
foreach ($modulesdir as $dir) {
|
||||
/*
|
||||
* Search available module
|
||||
*/
|
||||
//dol_syslog("Scan directory ".$dir." for API modules");
|
||||
|
||||
$handle = @opendir(dol_osencode($dir));
|
||||
if (is_resource($handle)) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if (is_readable($dir.$file) && preg_match("/^(mod.*)\.class\.php$/i", $file, $reg)) {
|
||||
$modulename = $reg[1];
|
||||
|
||||
// Defined if module is enabled
|
||||
$enabled = true;
|
||||
$module = $part = $obj = strtolower(preg_replace('/^mod/i', '', $modulename));
|
||||
//if ($part == 'propale') $part='propal';
|
||||
if ($module == 'societe') {
|
||||
$obj = 'thirdparty';
|
||||
}
|
||||
if ($module == 'categorie') {
|
||||
$part = 'categories';
|
||||
$obj = 'category';
|
||||
}
|
||||
if ($module == 'facture') {
|
||||
$part = 'compta/facture';
|
||||
$obj = 'facture';
|
||||
}
|
||||
if ($module == 'ficheinter') {
|
||||
$obj = 'fichinter';
|
||||
$part = 'fichinter';
|
||||
$module = 'fichinter';
|
||||
}
|
||||
|
||||
if (empty($conf->$module->enabled)) {
|
||||
$enabled = false;
|
||||
}
|
||||
|
||||
if ($enabled) {
|
||||
/*
|
||||
* If exists, load the API class for enable module
|
||||
*
|
||||
* Search files named api_<object>.class.php into /htdocs/<module>/class directory
|
||||
*
|
||||
* @todo : take care of externals module!
|
||||
* @todo : use getElementProperties() function ?
|
||||
*/
|
||||
$dir_part = DOL_DOCUMENT_ROOT.'/'.$part.'/class/';
|
||||
|
||||
$handle_part = @opendir(dol_osencode($dir_part));
|
||||
if (is_resource($handle_part)) {
|
||||
while (($file_searched = readdir($handle_part)) !== false) {
|
||||
if (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i", $file_searched, $reg)) {
|
||||
$classname = ucwords($reg[1]);
|
||||
require_once $dir_part.$file_searched;
|
||||
if (class_exists($classname)) {
|
||||
dol_syslog("Found API classname=".$classname." into ".$dir);
|
||||
$listofapis[] = $classname;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (is_readable($dir_part.$file_searched) && preg_match("/^(api_.*)\.class\.php$/i",$file_searched,$reg))
|
||||
{
|
||||
$classname=$reg[1];
|
||||
$classname = str_replace('Api_','',ucwords($reg[1])).'Api';
|
||||
//$classname = str_replace('Api_','',ucwords($reg[1]));
|
||||
$classname = ucfirst($classname);
|
||||
require_once $dir_part.$file_searched;
|
||||
|
||||
// if (class_exists($classname))
|
||||
// {
|
||||
// dol_syslog("Found API classname=".$classname);
|
||||
// $api->r->addAPIClass($classname,'');
|
||||
|
||||
// require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/Routes.php';
|
||||
// $tmpclass = new ReflectionClass($classname);
|
||||
// try {
|
||||
// $classMetadata = CommentParser::parse($tmpclass->getDocComment());
|
||||
// } catch (Exception $e) {
|
||||
// throw new RestException(500, "Error while parsing comments of `$classname` class. " . $e->getMessage());
|
||||
// }
|
||||
|
||||
// //$listofapis[]=array('classname'=>$classname, 'fullpath'=>$file_searched);
|
||||
// }
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($listofapis);
|
||||
$listofapis = Routes::toArray(); // @todo api for "status" is lost here
|
||||
//var_dump($listofapis);
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("ApiSetup"), $linkback, 'title_setup');
|
||||
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
// Show message
|
||||
print '<br>';
|
||||
$message = '';
|
||||
$url = '<a href="'.$urlwithroot.'/api/index.php/login?login='.urlencode($user->login).'&password=yourpassword" target="_blank">'.$urlwithroot.'/api/index.php/login?login='.urlencode($user->login).'&password=yourpassword[&reset=1]</a>';
|
||||
$message .= $langs->trans("UrlToGetKeyToUseAPIs").':<br>';
|
||||
$message .= img_picto('', 'globe').' '.$url;
|
||||
print $message;
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
$oldclass = '';
|
||||
|
||||
print $langs->trans("ListOfAvailableAPIs").':<br>';
|
||||
foreach ($listofapis['v1'] as $key => $val) {
|
||||
if ($key == 'login') {
|
||||
continue;
|
||||
}
|
||||
if ($key == 'index') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($key) {
|
||||
foreach ($val as $method => $val2) {
|
||||
$newclass = $val2['className'];
|
||||
|
||||
if (preg_match('/restler/i', $newclass)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($oldclass != $newclass) {
|
||||
print "\n<br>\n".$langs->trans("Class").': '.$newclass.'<br>'."\n";
|
||||
$oldclass = $newclass;
|
||||
}
|
||||
//print $key.' - '.$val['classname'].' - '.$val['fullpath']." - ".DOL_MAIN_URL_ROOT.'/api/index.php/'.strtolower(preg_replace('/Api$/','',$val['classname']))."/xxx<br>\n";
|
||||
$url = $urlwithroot.'/api/index.php/'.$key;
|
||||
$url .= '?api_key=token';
|
||||
print img_picto('', 'globe').' '.$method.' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print $langs->trans("OnlyActiveElementsAreExposed", DOL_URL_ROOT.'/admin/modules.php');
|
||||
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
87
htdocs/api/admin/explorer_withredoc.php
Normal file
87
htdocs/api/admin/explorer_withredoc.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @deprecated Old explorer. Not using Swagger. See instead explorer in htdocs/api/index.php.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup api Module DolibarrApi
|
||||
* \brief API explorer using the swagger.json file
|
||||
* \file htdocs/api/admin/explorer_withredoc.php
|
||||
*/
|
||||
|
||||
require_once '../../main.inc.php';
|
||||
|
||||
// Enable and test if module Api is enabled
|
||||
if (empty($conf->global->MAIN_MODULE_API)) {
|
||||
$langs->load("admin");
|
||||
dol_syslog("Call of Dolibarr API interfaces with module API REST are disabled");
|
||||
print $langs->trans("WarningModuleNotActive", 'Api').'.<br><br>';
|
||||
print $langs->trans("ToActivateModule");
|
||||
//session_destroy();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Test if explorer is not disabled
|
||||
if (!empty($conf->global->API_EXPLORER_DISABLED)) {
|
||||
$langs->load("admin");
|
||||
dol_syslog("Call Dolibarr API interfaces with module REST disabled");
|
||||
print $langs->trans("WarningAPIExplorerDisabled").'.<br><br>';
|
||||
//session_destroy();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Restrict API to some IPs
|
||||
if (!empty($conf->global->API_RESTRICT_ON_IP)) {
|
||||
$allowedip = explode(' ', $conf->global->API_RESTRICT_ON_IP);
|
||||
$ipremote = getUserRemoteIP();
|
||||
if (!in_array($ipremote, $allowedip)) {
|
||||
dol_syslog('Remote ip is '.$ipremote.', not into list '.$conf->global->API_RESTRICT_ON_IP);
|
||||
print 'APIs are not allowed from the IP '.$ipremote;
|
||||
header('HTTP/1.1 503 API not allowed from your IP '.$ipremote);
|
||||
//session_destroy();
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>ReDoc</title>
|
||||
<!-- needed for adaptive design -->
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
|
||||
|
||||
<!--
|
||||
ReDoc doesn't change outer page styles
|
||||
-->
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<redoc spec-url='<?php echo DOL_MAIN_URL_ROOT.'/api/index.php/explorer/swagger.json?DOLAPIKEY='.GETPOST('DOLAPIKEY', 'aZ09'); ?>'></redoc>
|
||||
<!--<redoc spec-url='https://demo.dolibarr.org/api/index.php/explorer/swagger.json'></redoc>-->
|
||||
<!--<redoc spec-url='http://petstore.swagger.io/v2/swagger.json'></redoc>-->
|
||||
<script src="https://cdn.jsdelivr.net/npm/redoc/bundles/redoc.standalone.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
@ -139,18 +139,25 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai
|
||||
|
||||
// Show message
|
||||
$message = '';
|
||||
$url = $urlwithroot.'/api/index.php/login?login=<strong>auserlogin</strong>&password=<strong>thepassword</strong>[&reset=1]';
|
||||
//$url = $urlwithroot.'/api/index.php/login?login=<strong>auserlogin</strong>&password=<strong>thepassword</strong>[&reset=1]';
|
||||
$url = $urlwithroot.'/api/index.php/login?login=auserlogin&password=thepassword[&reset=1]';
|
||||
$message .= '<span class="opacitymedium">'.$langs->trans("UrlToGetKeyToUseAPIs").':</span><br>';
|
||||
$message .= img_picto('', 'globe').' '.$url;
|
||||
$message .= '<div class="urllink soixantepercent">'.img_picto('', 'globe').' <input type="text" class="quatrevingtpercent" id="urltogettoken" value="'.$url.'"></div>';
|
||||
print $message;
|
||||
print ajax_autoselect("urltogettoken");
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
// Explorer
|
||||
print '<u>'.$langs->trans("ApiExporerIs").':</u><br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("ApiExporerIs").':</span><br>';
|
||||
if (dol_is_dir(DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/explorer')) {
|
||||
$url = DOL_MAIN_URL_ROOT.'/api/index.php/explorer';
|
||||
print img_picto('', 'globe').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
|
||||
print '<div class="urllink soixantepercent">'.img_picto('', 'globe').' <a href="'.$url.'" target="_blank">'.$url."</a></div><br>\n";
|
||||
print '<div class="opacitymediumxxx"><br><span class="opacitymedium">'.$langs->trans("SwaggerDescriptionFile").':</span><br>';
|
||||
$urlswagger = DOL_MAIN_URL_ROOT.'/api/index.php/explorer/swagger.json?DOLAPIKEY=youruserapikey';
|
||||
//$urlswaggerreal = DOL_MAIN_URL_ROOT.'/api/index.php/explorer/swagger.json?DOLAPIKEY='.$user->api_key;
|
||||
print '<div class="urllink soixantepercent">'.img_picto('', 'globe').' <a href="'.$urlswagger.'" target="_blank">'.$urlswagger."</a></div><br>\n";
|
||||
print '</div>';
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
print info_admin($langs->trans("ErrorNotAvailableWithThisDistribution"), 0, 0, 'error');
|
||||
|
||||
@ -55,6 +55,12 @@ if (!empty($_SERVER['HTTP_DOLAPIENTITY'])) {
|
||||
define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']);
|
||||
}
|
||||
|
||||
// When we request url to get the json file, we accept Cross site so we can include the descriptor into an external tool.
|
||||
if (preg_match('/\/explorer\/swagger\.json/', $_SERVER["PHP_SELF"])) {
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
|
||||
header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY');
|
||||
}
|
||||
|
||||
$res = 0;
|
||||
if (!$res && file_exists("../main.inc.php")) {
|
||||
@ -89,7 +95,7 @@ if (!empty($conf->global->MAIN_NGINX_FIX)) {
|
||||
// Enable and test if module Api is enabled
|
||||
if (empty($conf->global->MAIN_MODULE_API)) {
|
||||
$langs->load("admin");
|
||||
dol_syslog("Call Dolibarr API interfaces with module REST disabled");
|
||||
dol_syslog("Call of Dolibarr API interfaces with module API REST are disabled");
|
||||
print $langs->trans("WarningModuleNotActive", 'Api').'.<br><br>';
|
||||
print $langs->trans("ToActivateModule");
|
||||
//session_destroy();
|
||||
|
||||
@ -75,6 +75,7 @@ function llxFooter()
|
||||
print "\n".'</html>'."\n";
|
||||
}
|
||||
|
||||
|
||||
require_once '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
@ -117,10 +118,10 @@ if (!isset($conf->global->ASTERISK_MAX_RETRY)) {
|
||||
}
|
||||
|
||||
|
||||
$login = GETPOST('login');
|
||||
$password = GETPOST('password');
|
||||
$caller = GETPOST('caller');
|
||||
$called = GETPOST('called');
|
||||
$login = GETPOST('login', 'alphanohtml');
|
||||
$password = GETPOST('password', 'none');
|
||||
$caller = GETPOST('caller', 'alphanohtml');
|
||||
$called = GETPOST('called', 'alphanohtml');
|
||||
|
||||
// IP address of Asterisk server
|
||||
$strHost = $conf->global->ASTERISK_HOST;
|
||||
@ -163,7 +164,7 @@ if ($resql) {
|
||||
if ($obj) {
|
||||
$found = $obj->name;
|
||||
} else {
|
||||
$found = $notfound;
|
||||
$found = 'Not found';
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
@ -177,7 +178,7 @@ if (!empty($number)) {
|
||||
if ($pos === false) {
|
||||
$errno = 0;
|
||||
$errstr = 0;
|
||||
$strCallerId = "Dolibarr call $found <".strtolower($number).">";
|
||||
$strCallerId = "Dolibarr caller $found <".strtolower($number).">";
|
||||
$oSocket = @fsockopen($strHost, $port, $errno, $errstr, 10);
|
||||
if (!$oSocket) {
|
||||
print '<body>'."\n";
|
||||
@ -211,7 +212,7 @@ if (!empty($number)) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print 'Bad parameters in URL. Must be '.$_SERVER['PHP_SELF'].'?caller=99999&called=99999&login=xxxxx&password=xxxxx';
|
||||
print 'Bad parameters in URL. Must be '.dol_escape_htmltag($_SERVER['PHP_SELF']).'?caller=99999&called=99999&login=xxxxx&password=xxxxx';
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -1324,9 +1324,9 @@ if (empty($reshook)) {
|
||||
// Terms of payment
|
||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
||||
} elseif ($action == 'setremisepercent' && $usercancreate) {
|
||||
$result = $object->set_remise_percent($user, $_POST['remise_percent']);
|
||||
$result = $object->set_remise_percent($user, price2num(GETPOST('remise_percent')));
|
||||
} elseif ($action == 'setremiseabsolue' && $usercancreate) {
|
||||
$result = $object->set_remise_absolue($user, $_POST['remise_absolue']);
|
||||
$result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue')));
|
||||
} elseif ($action == 'setmode' && $usercancreate) {
|
||||
// Payment choice
|
||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||
@ -1387,7 +1387,7 @@ if (empty($reshook)) {
|
||||
} elseif ($action == 'swapstatut') {
|
||||
// Toggle the status of a contact
|
||||
if ($object->fetch($id) > 0) {
|
||||
$result = $object->swapContactStatus(GETPOST('ligne'));
|
||||
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
@ -3843,7 +3843,7 @@ class PropaleLigne extends CommonObjectLine
|
||||
$sql .= ' pd.date_start, pd.date_end, pd.product_type';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'propaldet as pd';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pd.fk_product = p.rowid';
|
||||
$sql .= ' WHERE pd.rowid = '.$rowid;
|
||||
$sql .= ' WHERE pd.rowid = '.((int) $rowid);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
|
||||
@ -93,7 +93,7 @@ if ($action == 'addcontact' && $user->rights->propale->creer) {
|
||||
} elseif ($action == 'swapstatut' && $user->rights->propale->creer) {
|
||||
// Toggle the status of a contact
|
||||
if ($object->id > 0) {
|
||||
$result = $object->swapContactStatus(GETPOST('ligne'));
|
||||
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
|
||||
}
|
||||
} elseif ($action == 'deletecontact' && $user->rights->propale->creer) {
|
||||
// Deletes a contact
|
||||
|
||||
@ -843,31 +843,31 @@ if ($resql) {
|
||||
if ($user->rights->societe->client->voir || $socid) {
|
||||
$langs->load("commercial");
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('ThirdPartiesOfSaleRepresentative').': ';
|
||||
$moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth200');
|
||||
$tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
|
||||
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250');
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->societe->client->voir || $socid) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('LinkedToSpecificUsers').': ';
|
||||
$moreforfilter .= $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
|
||||
$tmptitle = $langs->trans('LinkedToSpecificUsers');
|
||||
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250');
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// If the user can view products
|
||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('IncludingProductWithTag').': ';
|
||||
$tmptitle = $langs->trans('IncludingProductWithTag');
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
|
||||
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
|
||||
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('CustomersProspectsCategoriesShort').': ';
|
||||
$moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1);
|
||||
$tmptitle = $langs->trans('CustomersProspectsCategoriesShort');
|
||||
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
$parameters = array();
|
||||
@ -1532,7 +1532,7 @@ if ($resql) {
|
||||
}
|
||||
// Amount HT
|
||||
if (!empty($arrayfields['p.total_ht']['checked'])) {
|
||||
print '<td class="nowrap right">'.price($obj->total_ht)."</td>\n";
|
||||
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ht)."</span></td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1543,7 +1543,7 @@ if ($resql) {
|
||||
}
|
||||
// Amount VAT
|
||||
if (!empty($arrayfields['p.total_tva']['checked'])) {
|
||||
print '<td class="nowrap right">'.price($obj->total_tva)."</td>\n";
|
||||
print '<td class="nowrap right"><span class="amount">'.price($obj->total_tva)."</span></td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1554,7 +1554,7 @@ if ($resql) {
|
||||
}
|
||||
// Amount TTC
|
||||
if (!empty($arrayfields['p.total_ttc']['checked'])) {
|
||||
print '<td class="nowrap right">'.price($obj->total_ttc)."</td>\n";
|
||||
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc)."</span></td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1563,9 +1563,9 @@ if ($resql) {
|
||||
}
|
||||
$totalarray['val']['p.total_ttc'] += $obj->total_ttc;
|
||||
}
|
||||
// Amount invoiced
|
||||
// Amount invoiced HT
|
||||
if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) {
|
||||
print '<td class="nowrap right">'.price($totalInvoicedHT)."</td>\n";
|
||||
print '<td class="nowrap right"><span class="amount">'.price($totalInvoicedHT)."</span></td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1574,9 +1574,9 @@ if ($resql) {
|
||||
}
|
||||
$totalarray['val']['p.total_ht_invoiced'] += $totalInvoicedHT;
|
||||
}
|
||||
// Amount invoiced
|
||||
// Amount invoiced TTC
|
||||
if (!empty($arrayfields['p.total_invoiced']['checked'])) {
|
||||
print '<td class="nowrap right">'.price($totalInvoicedTTC)."</td>\n";
|
||||
print '<td class="nowrap right"><span class="amount">'.price($totalInvoicedTTC)."</span></td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1604,35 +1604,35 @@ if ($resql) {
|
||||
}
|
||||
// Amount HT
|
||||
if (!empty($arrayfields['p.multicurrency_total_ht']['checked'])) {
|
||||
print '<td class="right nowrap">'.price($obj->multicurrency_total_ht)."</td>\n";
|
||||
print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht)."</span></td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Amount VAT
|
||||
if (!empty($arrayfields['p.multicurrency_total_tva']['checked'])) {
|
||||
print '<td class="right nowrap">'.price($obj->multicurrency_total_tva)."</td>\n";
|
||||
print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_tva)."</span></td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Amount TTC
|
||||
if (!empty($arrayfields['p.multicurrency_total_ttc']['checked'])) {
|
||||
print '<td class="right nowrap">'.price($obj->multicurrency_total_ttc)."</td>\n";
|
||||
print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc)."</span></td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Amount invoiced
|
||||
if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked'])) {
|
||||
print '<td class="nowrap right">'.price($multicurrency_totalInvoicedHT)."</td>\n";
|
||||
print '<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedHT)."</span></td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Amount invoiced
|
||||
if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked'])) {
|
||||
print '<td class="nowrap right">'.price($multicurrency_totalInvoicedTTC)."</td>\n";
|
||||
print '<td class="nowrap right"><span class="amount">'.price($multicurrency_totalInvoicedTTC)."</span></td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ if (!empty($conf->facture->enabled)) {
|
||||
}
|
||||
|
||||
// Security check
|
||||
$socid = $_GET["socid"];
|
||||
$socid = GETPOST("socid", 'int');
|
||||
if ($user->socid > 0) {
|
||||
$action = '';
|
||||
$socid = $user->socid;
|
||||
|
||||
@ -24,6 +24,8 @@
|
||||
* \brief Page to edit absolute discounts for a customer
|
||||
*/
|
||||
|
||||
if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
|
||||
@ -1370,7 +1370,7 @@ if (empty($reshook)) {
|
||||
} elseif ($action == 'swapstatut') {
|
||||
// bascule du statut d'un contact
|
||||
if ($object->id > 0) {
|
||||
$result = $object->swapContactStatus(GETPOST('ligne'));
|
||||
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
@ -4126,7 +4126,7 @@ class OrderLine extends CommonOrderLine
|
||||
$sql .= ' cd.date_start, cd.date_end';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'commandedet as cd';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid';
|
||||
$sql .= ' WHERE cd.rowid = '.$rowid;
|
||||
$sql .= ' WHERE cd.rowid = '.((int) $rowid);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
@ -75,14 +75,14 @@ if ($action == 'addcontact' && $user->rights->commande->creer) {
|
||||
} elseif ($action == 'swapstatut' && $user->rights->commande->creer) {
|
||||
// bascule du statut d'un contact
|
||||
if ($object->fetch($id)) {
|
||||
$result = $object->swapContactStatus(GETPOST('ligne'));
|
||||
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
} elseif ($action == 'deletecontact' && $user->rights->commande->creer) {
|
||||
// Efface un contact
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($_GET["lineid"]);
|
||||
$result = $object->delete_contact(GETPOST("lineid", 'int'));
|
||||
|
||||
if ($result >= 0) {
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
|
||||
@ -806,39 +806,39 @@ if ($resql) {
|
||||
if ($user->rights->societe->client->voir || $socid) {
|
||||
$langs->load("commercial");
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('ThirdPartiesOfSaleRepresentative').': ';
|
||||
$moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth200');
|
||||
$tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
|
||||
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250');
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// If the user can view other users
|
||||
if ($user->rights->user->user->lire) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('LinkedToSpecificUsers').': ';
|
||||
$moreforfilter .= $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
|
||||
$tmptitle = $langs->trans('LinkedToSpecificUsers');
|
||||
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250');
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// If the user can view prospects other than his'
|
||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('IncludingProductWithTag').': ';
|
||||
$tmptitle = $langs->trans('IncludingProductWithTag');
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
|
||||
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
|
||||
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('CustomersProspectsCategoriesShort').': ';
|
||||
$moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1);
|
||||
$tmptitle = $langs->trans('CustomersProspectsCategoriesShort');
|
||||
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('Warehouse').': ';
|
||||
$moreforfilter .= $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', 1);
|
||||
$tmptitle = $langs->trans('Warehouse');
|
||||
$moreforfilter .= img_picto($tmptitle, 'warehouse', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', $tmptitle);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
$parameters = array();
|
||||
@ -1437,7 +1437,7 @@ if ($resql) {
|
||||
}
|
||||
// Amount HT
|
||||
if (!empty($arrayfields['c.total_ht']['checked'])) {
|
||||
print '<td class="nowrap right">'.price($obj->total_ht)."</td>\n";
|
||||
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ht)."</span></td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1448,7 +1448,7 @@ if ($resql) {
|
||||
}
|
||||
// Amount VAT
|
||||
if (!empty($arrayfields['c.total_vat']['checked'])) {
|
||||
print '<td class="nowrap right">'.price($obj->total_tva)."</td>\n";
|
||||
print '<td class="nowrap right"><span class="amount">'.price($obj->total_tva)."</span></td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1459,7 +1459,7 @@ if ($resql) {
|
||||
}
|
||||
// Amount TTC
|
||||
if (!empty($arrayfields['c.total_ttc']['checked'])) {
|
||||
print '<td class="nowrap right">'.price($obj->total_ttc)."</td>\n";
|
||||
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc)."</span></td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1488,21 +1488,21 @@ if ($resql) {
|
||||
}
|
||||
// Amount HT
|
||||
if (!empty($arrayfields['c.multicurrency_total_ht']['checked'])) {
|
||||
print '<td class="right nowrap">'.price($obj->multicurrency_total_ht)."</td>\n";
|
||||
print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht)."</span></td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Amount VAT
|
||||
if (!empty($arrayfields['c.multicurrency_total_vat']['checked'])) {
|
||||
print '<td class="right nowrap">'.price($obj->multicurrency_total_vat)."</td>\n";
|
||||
print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat)."</span></td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Amount TTC
|
||||
if (!empty($arrayfields['c.multicurrency_total_ttc']['checked'])) {
|
||||
print '<td class="right nowrap">'.price($obj->multicurrency_total_ttc)."</td>\n";
|
||||
print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc)."</span></td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -211,7 +211,6 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_thirdparty_user = '';
|
||||
$search_num_releve = '';
|
||||
$search_conciliated = '';
|
||||
$thirdparty = '';
|
||||
|
||||
$search_account = "";
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
@ -992,9 +991,9 @@ if ($resql) {
|
||||
|
||||
// Bank line
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('RubriquesTransactions').' : ';
|
||||
$tmptitle = $langs->trans('RubriquesTransactions');
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, $search_bid, 'parent', null, null, 1);
|
||||
$moreforfilter .= $form->selectarray('search_bid', $cate_arbo, $search_bid, 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_bid', $cate_arbo, $search_bid, $tmptitle, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
}
|
||||
@ -1561,12 +1560,12 @@ if ($resql) {
|
||||
|
||||
// Debit
|
||||
if (!empty($arrayfields['b.debit']['checked'])) {
|
||||
print '<td class="nowrap right">';
|
||||
print '<td class="nowrap right"><span class="amount">';
|
||||
if ($objp->amount < 0) {
|
||||
print price($objp->amount * -1);
|
||||
$totalarray['totaldeb'] += $objp->amount;
|
||||
}
|
||||
print "</td>\n";
|
||||
print "</span></td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1577,12 +1576,12 @@ if ($resql) {
|
||||
|
||||
// Credit
|
||||
if (!empty($arrayfields['b.credit']['checked'])) {
|
||||
print '<td class="nowrap right">';
|
||||
print '<td class="nowrap right"><span class="amount">';
|
||||
if ($objp->amount > 0) {
|
||||
print price($objp->amount);
|
||||
$totalarray['totalcred'] += $objp->amount;
|
||||
}
|
||||
print "</td>\n";
|
||||
print "</span></td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1717,9 +1716,9 @@ if ($resql) {
|
||||
print '<td class="left tdoverflowmax50" title="'.$langs->trans("Totalforthispage").'">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
} elseif ($totalarray['totaldebfield'] == $i) {
|
||||
print '<td class="right">'.price(-1 * $totalarray['totaldeb']).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(-1 * $totalarray['totaldeb']).'</span></td>';
|
||||
} elseif ($totalarray['totalcredfield'] == $i) {
|
||||
print '<td class="right">'.price($totalarray['totalcred']).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($totalarray['totalcred']).'</span></td>';
|
||||
} elseif ($i == $posconciliatecol) {
|
||||
print '<td class="center">';
|
||||
if ($user->rights->banque->consolidate && $action == 'reconcile') {
|
||||
|
||||
@ -82,8 +82,8 @@ if ($result) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<td><a href=\"".DOL_URL_ROOT."/compta/bank/bankentries_list.php?bid=$objp->rowid\">$objp->label</a></td>";
|
||||
print '<td class="right">'.$objp->nombre.'</td>';
|
||||
print '<td class="right">'.price(abs($objp->somme))."</td>";
|
||||
print '<td class="right">'.price(abs(price2num($objp->somme / $objp->nombre, 'MT')))."</td>";
|
||||
print '<td class="right"><span class="amount">'.price(abs($objp->somme))."</span></td>";
|
||||
print '<td class="right"><span class="amount">'.price(abs(price2num($objp->somme / $objp->nombre, 'MT')))."</span></td>";
|
||||
print "</tr>";
|
||||
$i++;
|
||||
$total += abs($objp->somme);
|
||||
|
||||
@ -346,7 +346,7 @@ if (empty($numref)) {
|
||||
$balancestart[$objp->numr] = $obj->amount;
|
||||
$db->free($resql);
|
||||
}
|
||||
print '<td class="right">'.price($balancestart[$objp->numr], '', $langs, 1, -1, -1, $conf->currency).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($balancestart[$objp->numr], '', $langs, 1, -1, -1, $conf->currency).'</span></td>';
|
||||
|
||||
// Calculate end amount
|
||||
$sql = "SELECT sum(b.amount) as amount";
|
||||
@ -359,7 +359,7 @@ if (empty($numref)) {
|
||||
$content[$objp->numr] = $obj->amount;
|
||||
$db->free($resql);
|
||||
}
|
||||
print '<td class="right">'.price(($balancestart[$objp->numr] + $content[$objp->numr]), '', $langs, 1, -1, -1, $conf->currency).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(($balancestart[$objp->numr] + $content[$objp->numr]), '', $langs, 1, -1, -1, $conf->currency).'</span></td>';
|
||||
|
||||
print '<td class="center">';
|
||||
if ($user->rights->banque->consolidate && $action != 'editbankreceipt') {
|
||||
|
||||
@ -671,7 +671,7 @@ if ($result) {
|
||||
if ($arrayfields['debit']['checked']) {
|
||||
print '<td class="nowrap right">';
|
||||
if ($obj->sens == 0) {
|
||||
print price($obj->amount);
|
||||
print '<span class="amount">'.price($obj->amount).'</span>';
|
||||
$totalarray['val']['total_deb'] += $obj->amount;
|
||||
}
|
||||
if (!$i) {
|
||||
@ -687,7 +687,7 @@ if ($result) {
|
||||
if ($arrayfields['credit']['checked']) {
|
||||
print '<td class="nowrap right">';
|
||||
if ($obj->sens == 1) {
|
||||
print price($obj->amount);
|
||||
print '<span class="amount">'.price($obj->amount).'</span>';
|
||||
$totalarray['val']['total_cred'] += $obj->amount;
|
||||
}
|
||||
if (!$i) {
|
||||
|
||||
@ -31,14 +31,17 @@
|
||||
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
|
||||
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
|
||||
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
|
||||
//if (! defined('NOIPCHECK')) define('NOIPCHECK','1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
|
||||
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
|
||||
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
|
||||
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||
//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
|
||||
//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value
|
||||
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler
|
||||
//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
|
||||
//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
|
||||
//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
|
||||
//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php';
|
||||
@ -66,7 +69,7 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
|
||||
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
$offset = $limit * $page;
|
||||
@ -83,11 +86,13 @@ $hookmanager->initHooks(array('cashcontrol')); // Note that conf->hooks_modules
|
||||
|
||||
// Fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
//$extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||
|
||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
|
||||
// Default sort order (if not yet defined by previous GETPOST)
|
||||
if (!$sortfield) {
|
||||
reset($object->fields); // Reset is required to avoid key() to return null.
|
||||
$sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
|
||||
}
|
||||
if (!$sortorder) {
|
||||
@ -95,12 +100,16 @@ if (!$sortorder) {
|
||||
}
|
||||
|
||||
// Initialize array of search criterias
|
||||
$search_all = GETPOST("search_all", 'alpha');
|
||||
$search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml');
|
||||
$search = array();
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (GETPOST('search_'.$key, 'alpha')) {
|
||||
if (GETPOST('search_'.$key, 'alpha') !== '') {
|
||||
$search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||
}
|
||||
if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
$search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
|
||||
$search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
|
||||
}
|
||||
}
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
@ -161,6 +170,10 @@ if (empty($reshook)) {
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$search[$key] = '';
|
||||
if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
$search[$key.'_dtstart'] = '';
|
||||
$search[$key.'_dtend'] = '';
|
||||
}
|
||||
}
|
||||
$toselect = '';
|
||||
$search_array_options = array();
|
||||
@ -198,9 +211,7 @@ $title = $langs->trans('CashControl');
|
||||
// Build and execute select
|
||||
// --------------------------------------------------------------------
|
||||
$sql = 'SELECT ';
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$sql .= 't.'.$key.', ';
|
||||
}
|
||||
$sql .= $object->getFieldList('t');
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
@ -210,24 +221,48 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
// Add fields from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql = preg_replace('/, $/', '', $sql);
|
||||
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
}
|
||||
// Add table from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
if ($object->ismultientitymanaged == 1) {
|
||||
$sql .= " WHERE t.entity IN (".getEntity($object->element).")";
|
||||
} else {
|
||||
$sql .= " WHERE 1 = 1";
|
||||
}
|
||||
foreach ($search as $key => $val) {
|
||||
if ($key == 'status' && $search[$key] == -1) {
|
||||
continue;
|
||||
}
|
||||
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
|
||||
if ($search[$key] != '') {
|
||||
$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
|
||||
if (array_key_exists($key, $object->fields)) {
|
||||
if ($key == 'status' && $search[$key] == -1) {
|
||||
continue;
|
||||
}
|
||||
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
|
||||
if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0)) {
|
||||
if ($search[$key] == '-1' || $search[$key] === '0') {
|
||||
$search[$key] = '';
|
||||
}
|
||||
$mode_search = 2;
|
||||
}
|
||||
if ($search[$key] != '') {
|
||||
$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
|
||||
}
|
||||
} else {
|
||||
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
|
||||
$columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key);
|
||||
if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
|
||||
if (preg_match('/_dtstart$/', $key)) {
|
||||
$sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'";
|
||||
}
|
||||
if (preg_match('/_dtend$/', $key)) {
|
||||
$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($search_all) {
|
||||
@ -241,20 +276,20 @@ $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $objec
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
/* If a group by is required
|
||||
$sql.= " GROUP BY "
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$sql.='t.'.$key.', ';
|
||||
}
|
||||
// Add fields from extrafields
|
||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql=preg_replace('/, $/','', $sql);
|
||||
*/
|
||||
$sql.= " GROUP BY ";
|
||||
foreach($object->fields as $key => $val) {
|
||||
$sql.='t.'.$key.', ';
|
||||
}
|
||||
// Add fields from extrafields
|
||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql=preg_replace('/,\s*$/','', $sql);
|
||||
*/
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
@ -269,10 +304,12 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
}
|
||||
}
|
||||
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
|
||||
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) {
|
||||
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
|
||||
$num = $nbtotalofrecords;
|
||||
} else {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
@ -284,10 +321,10 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) {
|
||||
}
|
||||
|
||||
// Direct jump if only one record found
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) {
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
header("Location: ".dol_buildpath('/compta/cashcontrol/cashcontrol_card.php', 1).'?id='.$id);
|
||||
header("Location: ".DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card.php?id='.$id);
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -295,7 +332,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
|
||||
// Output page
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs');
|
||||
|
||||
// Example : Adding jquery code
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
@ -322,13 +359,23 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.urlencode($limit);
|
||||
}
|
||||
foreach ($search as $key => $val) {
|
||||
$param .= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
if (is_array($search[$key]) && count($search[$key])) {
|
||||
foreach ($search[$key] as $skey) {
|
||||
$param .= '&search_'.$key.'[]='.urlencode($skey);
|
||||
}
|
||||
} else {
|
||||
$param .= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
}
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
}
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
// Add $param from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$param .= $hookmanager->resPrint;
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
@ -341,7 +388,7 @@ if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'pr
|
||||
}
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
}
|
||||
@ -365,11 +412,11 @@ $objecttmp = new CashControl($db);
|
||||
$trackid = 'cashfence'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($sall) {
|
||||
if ($search_all) {
|
||||
foreach ($fieldstosearchall as $key => $val) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
}
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
|
||||
}
|
||||
|
||||
$moreforfilter = '';
|
||||
@ -396,7 +443,7 @@ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfi
|
||||
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
|
||||
// Fields title search
|
||||
@ -417,8 +464,17 @@ foreach ($object->fields as $key => $val) {
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
|
||||
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
} else {
|
||||
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
|
||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
|
||||
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print '</div>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
@ -442,7 +498,7 @@ print '</tr>'."\n";
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
||||
if ($key == 'status') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
@ -462,6 +518,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
@ -481,24 +538,19 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co
|
||||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
while ($i < min($num, $limit)) {
|
||||
while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) {
|
||||
break; // Should not happen
|
||||
}
|
||||
|
||||
// Store properties in $object
|
||||
$object->id = $obj->rowid;
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (property_exists($obj, $key)) {
|
||||
$object->$key = $obj->$key;
|
||||
}
|
||||
}
|
||||
$object->setVarsFromFetchObj($obj);
|
||||
|
||||
// Show here line of result
|
||||
print '<tr class="oddeven">';
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif ($key == 'status') {
|
||||
@ -511,7 +563,7 @@ while ($i < min($num, $limit)) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
}
|
||||
|
||||
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') {
|
||||
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
|
||||
@ -519,10 +571,8 @@ while ($i < min($num, $limit)) {
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
|
||||
if ($key == 'status') {
|
||||
print $object->getLibStatut(5);
|
||||
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
print $object->showOutputField($val, $key, $db->jdate($obj->$key), '');
|
||||
} else {
|
||||
print $object->showOutputField($val, $key, $obj->$key, '');
|
||||
print $object->showOutputField($val, $key, $object->$key, '');
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
@ -532,21 +582,21 @@ while ($i < min($num, $limit)) {
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||
}
|
||||
$totalarray['val']['t.'.$key] += $obj->$key;
|
||||
$totalarray['val']['t.'.$key] += $object->$key;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print '<td class="nowrap" align="center">';
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) {
|
||||
if (in_array($object->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
@ -587,6 +637,7 @@ print '</div>'."\n";
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
/*
|
||||
if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
|
||||
$hidegeneratedfilelistifempty = 1;
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
|
||||
@ -601,11 +652,12 @@ if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $n
|
||||
$urlsource .= str_replace('&', '&', $param);
|
||||
|
||||
$filedir = $diroutputmassaction;
|
||||
$genallowed = $user->rights->monmodule->read;
|
||||
$delallowed = $user->rights->monmodule->create;
|
||||
$genallowed = $permissiontoread;
|
||||
$delallowed = $permissiontoadd;
|
||||
|
||||
print $formfile->showdocuments('massfilesarea_monmodule', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
|
||||
}
|
||||
*/
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -54,7 +54,31 @@ class CashControl extends CommonObject
|
||||
*/
|
||||
public $picto = 'cash-register';
|
||||
|
||||
|
||||
/**
|
||||
* 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
|
||||
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
|
||||
* 'label' the translation key.
|
||||
* 'picto' is code of a picto to show before value in forms
|
||||
* 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM)
|
||||
* 'position' is the sort order of field.
|
||||
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
|
||||
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
|
||||
* 'noteditable' says if field is not editable (1 or 0)
|
||||
* 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
|
||||
* 'index' if we want an index in database.
|
||||
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
|
||||
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
||||
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||
* 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'maxwidth200', 'wordbreak', 'tdoverflowmax200'
|
||||
* 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click.
|
||||
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
||||
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
|
||||
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
|
||||
* 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1.
|
||||
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
||||
*
|
||||
* Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor.
|
||||
*/
|
||||
public $fields = array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>10),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>15),
|
||||
@ -62,10 +86,10 @@ class CashControl extends CommonObject
|
||||
'posmodule' =>array('type'=>'varchar(30)', 'label'=>'Module', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>19),
|
||||
'posnumber' =>array('type'=>'varchar(30)', 'label'=>'Terminal', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>20, 'css'=>'center'),
|
||||
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>0, 'position'=>24),
|
||||
'opening' =>array('type'=>'price', 'label'=>'Opening', 'enabled'=>1, 'visible'=>1, 'position'=>25),
|
||||
'cash' =>array('type'=>'price', 'label'=>'Cash', 'enabled'=>1, 'visible'=>1, 'position'=>30),
|
||||
'cheque' =>array('type'=>'price', 'label'=>'Cheque', 'enabled'=>1, 'visible'=>1, 'position'=>33),
|
||||
'card' =>array('type'=>'price', 'label'=>'CreditCard', 'enabled'=>1, 'visible'=>1, 'position'=>36),
|
||||
'opening' =>array('type'=>'price', 'label'=>'Opening', 'enabled'=>1, 'visible'=>1, 'position'=>25, 'csslist'=>'amount'),
|
||||
'cash' =>array('type'=>'price', 'label'=>'Cash', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'csslist'=>'amount'),
|
||||
'cheque' =>array('type'=>'price', 'label'=>'Cheque', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'csslist'=>'amount'),
|
||||
'card' =>array('type'=>'price', 'label'=>'CreditCard', 'enabled'=>1, 'visible'=>1, 'position'=>36, 'csslist'=>'amount'),
|
||||
'year_close' =>array('type'=>'integer', 'label'=>'Year close', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>50, 'css'=>'center'),
|
||||
'month_close' =>array('type'=>'integer', 'label'=>'Month close', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'css'=>'center'),
|
||||
'day_close' =>array('type'=>'integer', 'label'=>'Day close', 'enabled'=>1, 'visible'=>1, 'position'=>60, 'css'=>'center'),
|
||||
|
||||
@ -204,7 +204,7 @@ if ($resql) {
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").'</td>';
|
||||
print '<td></td><td></td><td></td><td class="right">'.price($cashcontrol->opening).'</td>';
|
||||
print '<td></td><td></td><td></td><td class="right"><span class="amount">'.price($cashcontrol->opening).'</span></td>';
|
||||
print '</tr>';
|
||||
$first = "no";
|
||||
}*/
|
||||
|
||||
@ -206,7 +206,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
|
||||
// Type
|
||||
print '<td><a href="../sociales/list.php?filtre=cs.fk_type:'.$obj->type.'">'.$obj->label.'</a></td>';
|
||||
// Expected to pay
|
||||
print '<td class="right">'.price($obj->total).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($obj->total).'</span></td>';
|
||||
// Ref payment
|
||||
$payment_sc_static->id = $obj->pid;
|
||||
$payment_sc_static->ref = $obj->pid;
|
||||
@ -323,7 +323,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
|
||||
$tva_static->ref = $obj->label;
|
||||
print "<td>".$tva_static->getNomUrl(1)."</td>\n";
|
||||
|
||||
print '<td class="right">'.price($obj->amount_tva)."</td>";
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount_tva)."</span></td>";
|
||||
|
||||
// Ref payment
|
||||
$ptva_static->id = $obj->rowid;
|
||||
@ -359,7 +359,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
|
||||
}
|
||||
|
||||
// Paid
|
||||
print '<td class="right">'.price($obj->amount)."</td>";
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
@ -442,7 +442,7 @@ while ($j < $numlt) {
|
||||
|
||||
print "<td>".$obj->label."</td>\n";
|
||||
|
||||
print '<td class="right">'.price($obj->amount)."</td>";
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>";
|
||||
|
||||
// Ref payment
|
||||
$ptva_static->id = $obj->rowid;
|
||||
@ -450,7 +450,7 @@ while ($j < $numlt) {
|
||||
print '<td class="left">'.$ptva_static->getNomUrl(1)."</td>\n";
|
||||
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->dp), 'day')."</td>\n";
|
||||
print '<td class="right">'.price($obj->amount)."</td>";
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
|
||||
@ -268,7 +268,7 @@ print '<br><br>';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="border centpercent">';
|
||||
print '<tr height="24">';
|
||||
print '<tr>';
|
||||
print '<td class="center">'.$langs->trans("Year").'</td>';
|
||||
print '<td class="center">'.$langs->trans("Number").'</td>';
|
||||
print '<td class="center">'.$langs->trans("AmountTotal").'</td>';
|
||||
@ -280,14 +280,16 @@ foreach ($data as $val) {
|
||||
$year = $val['year'];
|
||||
while ($year && $oldyear > $year + 1) { // If we have empty year
|
||||
$oldyear--;
|
||||
print '<tr height="24">';
|
||||
print '<tr>';
|
||||
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&mode='.$mode.'">'.$oldyear.'</a></td>';
|
||||
print '<td class="right">0</td>';
|
||||
print '<td class="right">0</td>';
|
||||
print '<td class="right">0</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '<tr height="24">';
|
||||
|
||||
// Total
|
||||
print '<tr>';
|
||||
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&mode='.$mode.'">'.$year.'</a></td>';
|
||||
print '<td class="right">'.$val['nb'].'</td>';
|
||||
print '<td class="right">'.price(price2num($val['total'], 'MT'), 1).'</td>';
|
||||
|
||||
@ -1778,7 +1778,7 @@ if (empty($reshook)) {
|
||||
$product->fetch(GETPOST('idprod'.$i, 'int'));
|
||||
$startday = dol_mktime(12, 0, 0, GETPOST('date_start'.$i.'month'), GETPOST('date_start'.$i.'day'), GETPOST('date_start'.$i.'year'));
|
||||
$endday = dol_mktime(12, 0, 0, GETPOST('date_end'.$i.'month'), GETPOST('date_end'.$i.'day'), GETPOST('date_end'.$i.'year'));
|
||||
$result = $object->addline($product->description, $product->price, price2num(GETPOST('qty'.$i), 'MS'), $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, $_POST['idprod'.$i], $_POST['remise_percent'.$i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type, -1, 0, '', 0, 0, null, 0, '', 0, 100, '', $product->fk_unit);
|
||||
$result = $object->addline($product->description, $product->price, price2num(GETPOST('qty'.$i), 'MS'), $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, GETPOST('idprod'.$i, 'int'), price2num(GETPOST('remise_percent'.$i)), $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type, -1, 0, '', 0, 0, null, 0, '', 0, 100, '', $product->fk_unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2773,7 +2773,7 @@ if (empty($reshook)) {
|
||||
} elseif ($action == 'swapstatut') {
|
||||
// bascule du statut d'un contact
|
||||
if ($object->fetch($id)) {
|
||||
$result = $object->swapContactStatus(GETPOST('ligne'));
|
||||
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
@ -4733,8 +4733,8 @@ if ($action == 'create') {
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
print '<td class="right"></td>';
|
||||
}
|
||||
print '<td class="right">'.price($prev_invoice->total_ht).'</td>';
|
||||
print '<td class="right">'.price($prev_invoice->total_ttc).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($prev_invoice->total_ht).'</span></td>';
|
||||
print '<td class="right"><span class="amount">'.price($prev_invoice->total_ttc).'</span></td>';
|
||||
print '<td class="right">'.$prev_invoice->getLibStatut(3, $tmptotalpaidforthisinvoice).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -4753,8 +4753,8 @@ if ($action == 'create') {
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
print '<td class="right"></td>';
|
||||
}
|
||||
print '<td class="right">'.price($object->total_ht).'</td>';
|
||||
print '<td class="right">'.price($object->total_ttc).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($object->total_ht).'</span></td>';
|
||||
print '<td class="right"><span class="amount">'.price($object->total_ttc).'</span></td>';
|
||||
print '<td class="right">'.$object->getLibStatut(3, $object->getSommePaiement()).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -4808,8 +4808,8 @@ if ($action == 'create') {
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
print '<td class="right"></td>';
|
||||
}
|
||||
print '<td class="right">'.price($next_invoice->total_ht).'</td>';
|
||||
print '<td class="right">'.price($next_invoice->total_ttc).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($next_invoice->total_ht).'</span></td>';
|
||||
print '<td class="right"><span class="amount">'.price($next_invoice->total_ttc).'</span></td>';
|
||||
print '<td class="right">'.$next_invoice->getLibStatut(3, $totalpaye).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -4914,7 +4914,7 @@ if ($action == 'create') {
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="right">'.price($sign * $objp->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($sign * $objp->amount).'</span></td>';
|
||||
print '<td class="center">';
|
||||
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0) {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deletepayment&token='.newToken().'&paiement_id='.$objp->rowid.'">';
|
||||
@ -4972,7 +4972,7 @@ if ($action == 'create') {
|
||||
print $invoice->getNomUrl(0);
|
||||
print '</span>';
|
||||
print '</td>';
|
||||
print '<td class="right">'.price($obj->amount_ttc).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount_ttc).'</span></td>';
|
||||
print '<td class="right">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=unlinkdiscount&discountid='.$obj->rowid.'">'.img_delete().'</a>';
|
||||
print '</td></tr>';
|
||||
@ -4994,7 +4994,7 @@ if ($action == 'create') {
|
||||
print '<span class="opacitymedium">';
|
||||
print $form->textwithpicto($langs->trans("Discount"), $langs->trans("HelpEscompte"), - 1);
|
||||
print '</span>';
|
||||
print '</td><td class="right">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</td><td> </td></tr>';
|
||||
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</span></td><td> </td></tr>';
|
||||
$resteapayeraffiche = 0;
|
||||
$cssforamountpaymentcomplete = 'amountpaymentneutral';
|
||||
}
|
||||
@ -5014,7 +5014,7 @@ if ($action == 'create') {
|
||||
print '<span class="opacitymedium">';
|
||||
print $form->textwithpicto($langs->trans("ProductReturned"), $langs->trans("HelpAbandonProductReturned"), - 1);
|
||||
print '</span>';
|
||||
print '</td><td class="right">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</td><td> </td></tr>';
|
||||
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</span></td><td> </td></tr>';
|
||||
$resteapayeraffiche = 0;
|
||||
$cssforamountpaymentcomplete = 'amountpaymentneutral';
|
||||
}
|
||||
@ -5028,7 +5028,7 @@ if ($action == 'create') {
|
||||
print '<span class="opacitymedium">';
|
||||
print $form->textwithpicto($langs->trans("Abandoned"), $text, - 1);
|
||||
print '</span>';
|
||||
print '</td><td class="right">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</td><td> </td></tr>';
|
||||
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</span></td><td> </td></tr>';
|
||||
$resteapayeraffiche = 0;
|
||||
$cssforamountpaymentcomplete = 'amountpaymentneutral';
|
||||
}
|
||||
@ -5037,7 +5037,7 @@ if ($action == 'create') {
|
||||
print '<tr><td colspan="'.$nbcols.'" class="right">';
|
||||
print '<span class="opacitymedium">';
|
||||
print $langs->trans("Billed");
|
||||
print '</td><td class="right">'.price($object->total_ttc).'</td><td> </td></tr>';
|
||||
print '</td><td class="right"><span class="amount">'.price($object->total_ttc).'</span></td><td> </td></tr>';
|
||||
// Remainder to pay
|
||||
print '<tr><td colspan="'.$nbcols.'" class="right">';
|
||||
print '<span class="opacitymedium">';
|
||||
@ -5047,7 +5047,7 @@ if ($action == 'create') {
|
||||
}
|
||||
print '</span>';
|
||||
print '</td>';
|
||||
print '<td class="right'.($resteapayeraffiche ? ' amountremaintopay' : (' '.$cssforamountpaymentcomplete)).'">'.price($resteapayeraffiche).'</td>';
|
||||
print '<td class="right'.($resteapayeraffiche ? ' amountremaintopay' : (' '.$cssforamountpaymentcomplete)).'"><span class="amount">'.price($resteapayeraffiche).'</span></td>';
|
||||
print '<td class="nowrap"> </td></tr>';
|
||||
|
||||
// Retained warranty : usualy use on construction industry
|
||||
@ -5076,10 +5076,10 @@ if ($action == 'create') {
|
||||
// Total already paid back
|
||||
print '<tr><td colspan="'.$nbcols.'" class="right">';
|
||||
print $langs->trans('AlreadyPaidBack');
|
||||
print ' :</td><td class="right">'.price($sign * $totalpaye).'</td><td> </td></tr>';
|
||||
print ' :</td><td class="right"><span class="amount">'.price($sign * $totalpaye).'</span></td><td> </td></tr>';
|
||||
|
||||
// Billed
|
||||
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("Billed").' :</td><td class="right">'.price($sign * $object->total_ttc).'</td><td> </td></tr>';
|
||||
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("Billed").' :</td><td class="right"><span class="amount">'.price($sign * $object->total_ttc).'</span></td><td> </td></tr>';
|
||||
|
||||
// Remainder to pay back
|
||||
print '<tr><td colspan="'.$nbcols.'" class="right">';
|
||||
|
||||
@ -2007,7 +2007,7 @@ class FactureLigneRec extends CommonInvoiceLine
|
||||
$sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'facturedet_rec as l';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
|
||||
$sql .= ' WHERE l.rowid = '.$rowid;
|
||||
$sql .= ' WHERE l.rowid = '.((int) $rowid);
|
||||
$sql .= ' ORDER BY l.rang';
|
||||
|
||||
dol_syslog('FactureRec::fetch', LOG_DEBUG);
|
||||
|
||||
@ -283,44 +283,42 @@ class Facture extends CommonInvoice
|
||||
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||
*/
|
||||
public $fields = array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>15),
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>1),
|
||||
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>5),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1),
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>25),
|
||||
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>30), // deprecated
|
||||
'type' =>array('type'=>'smallint(6)', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
|
||||
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'Ref client', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
|
||||
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'Ref client', 'enabled'=>1, 'visible'=>-1, 'position'=>10),
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>12),
|
||||
//'ref_int' =>array('type'=>'varchar(255)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>30), // deprecated
|
||||
'type' =>array('type'=>'smallint(6)', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15),
|
||||
//'increment' =>array('type'=>'varchar(10)', 'label'=>'Increment', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>50),
|
||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||
'datef' =>array('type'=>'date', 'label'=>'DateInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
||||
'date_valid' =>array('type'=>'date', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||
'date_closing' =>array('type'=>'datetime', 'label'=>'Date closing', 'enabled'=>1, 'visible'=>-1, 'position'=>70),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>75),
|
||||
'datef' =>array('type'=>'date', 'label'=>'DateInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
|
||||
'date_valid' =>array('type'=>'date', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>22),
|
||||
'date_lim_reglement' =>array('type'=>'date', 'label'=>'DateDue', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
|
||||
'date_closing' =>array('type'=>'datetime', 'label'=>'Date closing', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
|
||||
'paye' =>array('type'=>'smallint(6)', 'label'=>'InvoicePaidCompletely', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>80),
|
||||
//'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>85),
|
||||
'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>91),
|
||||
//'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
||||
'close_code' =>array('type'=>'varchar(16)', 'label'=>'EarlyClosingReason', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
|
||||
'close_note' =>array('type'=>'varchar(128)', 'label'=>'EarlyClosingComment', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
|
||||
'tva' =>array('type'=>'double(24,8)', 'label'=>'TotalVAT', 'enabled'=>1, 'visible'=>-1, 'position'=>115, 'isameasure'=>1),
|
||||
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LT1', 'enabled'=>1, 'visible'=>-1, 'position'=>120, 'isameasure'=>1),
|
||||
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LT2', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
|
||||
'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'RevenueStamp', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1),
|
||||
'total' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
|
||||
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
|
||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>155),
|
||||
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
|
||||
'fk_user_closing' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'close_code' =>array('type'=>'varchar(16)', 'label'=>'EarlyClosingReason', 'enabled'=>1, 'visible'=>-1, 'position'=>92),
|
||||
'close_note' =>array('type'=>'varchar(128)', 'label'=>'EarlyClosingComment', 'enabled'=>1, 'visible'=>-1, 'position'=>93),
|
||||
'total' =>array('type'=>'double(24,8)', 'label'=>'AmountHT', 'enabled'=>1, 'visible'=>-1, 'position'=>95, 'isameasure'=>1),
|
||||
'tva' =>array('type'=>'double(24,8)', 'label'=>'AmountVAT', 'enabled'=>1, 'visible'=>-1, 'position'=>100, 'isameasure'=>1),
|
||||
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LT1', 'enabled'=>1, 'visible'=>-1, 'position'=>110, 'isameasure'=>1),
|
||||
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LT2', 'enabled'=>1, 'visible'=>-1, 'position'=>120, 'isameasure'=>1),
|
||||
'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'RevenueStamp', 'enabled'=>1, 'visible'=>-1, 'position'=>115, 'isameasure'=>1),
|
||||
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'AmountTTC', 'enabled'=>1, 'visible'=>1, 'position'=>130, 'isameasure'=>1),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>166),
|
||||
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>167),
|
||||
'fk_user_closing' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>168),
|
||||
'fk_facture_source' =>array('type'=>'integer', 'label'=>'SourceInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
|
||||
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'CurrencyCode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>190),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|
||||
'date_lim_reglement' =>array('type'=>'date', 'label'=>'DateDue', 'enabled'=>1, 'visible'=>-1, 'position'=>200),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>205),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>210),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>215),
|
||||
@ -335,8 +333,8 @@ class Facture extends CommonInvoice
|
||||
'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLabel', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>265),
|
||||
'date_pointoftax' =>array('type'=>'date', 'label'=>'DatePointOfTax', 'enabled'=>'$conf->global->INVOICE_POINTOFTAX_DATE', 'visible'=>-1, 'position'=>270),
|
||||
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'MulticurrencyID', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>275),
|
||||
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'MulticurrencyCurrency', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>280),
|
||||
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyRate', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>285, 'isameasure'=>1),
|
||||
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Currency', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>280),
|
||||
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'CurrencyRate', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>285, 'isameasure'=>1),
|
||||
'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountHT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>290, 'isameasure'=>1),
|
||||
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>295, 'isameasure'=>1),
|
||||
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>300, 'isameasure'=>1),
|
||||
@ -344,8 +342,10 @@ class Facture extends CommonInvoice
|
||||
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>310),
|
||||
'module_source' =>array('type'=>'varchar(32)', 'label'=>'POSModule', 'enabled'=>1, 'visible'=>-1, 'position'=>315),
|
||||
'pos_source' =>array('type'=>'varchar(32)', 'label'=>'POSTerminal', 'enabled'=>1, 'visible'=>-1, 'position'=>320),
|
||||
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Paid', 3=>'Abandonned')),
|
||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModificationShort', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900),
|
||||
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Paid', 3=>'Abandonned')),
|
||||
);
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
@ -2289,7 +2289,7 @@ class Facture extends CommonInvoice
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
|
||||
if ($this->db->query($sqlef) && $this->db->query($sql) && $this->delete_linked_contact()) {
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture WHERE rowid = '.$rowid;
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture WHERE rowid = '.((int) $rowid);
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
|
||||
@ -4982,7 +4982,7 @@ class FactureLigne extends CommonInvoiceLine
|
||||
$sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'facturedet as fd';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON fd.fk_product = p.rowid';
|
||||
$sql .= ' WHERE fd.rowid = '.$rowid;
|
||||
$sql .= ' WHERE fd.rowid = '.((int) $rowid);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
|
||||
@ -82,7 +82,7 @@ if ($action == 'addcontact' && $user->rights->facture->creer) {
|
||||
}
|
||||
} elseif ($action == 'swapstatut' && $user->rights->facture->creer) {
|
||||
// Toggle the status of a contact
|
||||
$result = $object->swapContactStatus(GETPOST('ligne'));
|
||||
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
|
||||
} elseif ($action == 'deletecontact' && $user->rights->facture->creer) {
|
||||
// Deletes a contact
|
||||
$result = $object->delete_contact($lineid);
|
||||
|
||||
@ -285,7 +285,7 @@ function getDraftTable($maxCount = 500, $socid = 0)
|
||||
$result .= '<tr class="oddeven">';
|
||||
$result .= '<td class="nowrap">'.$objectstatic->getNomUrl(1).'</td>';
|
||||
$result .= '<td>'.$companystatic->getNomUrl(1, 'customer', 24).'</td>';
|
||||
$result .= '<td class="right">'.price($obj->total_ttc).'</td>';
|
||||
$result .= '<td class="right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
|
||||
$result .= '</tr>';
|
||||
|
||||
$i++;
|
||||
@ -299,7 +299,7 @@ function getDraftTable($maxCount = 500, $socid = 0)
|
||||
} elseif ($total > 0) {
|
||||
$result .= '<tr class="liste_total">';
|
||||
$result .= '<td colspan="2" class="right">'.$langs->trans("Total").'</td>';
|
||||
$result .= '<td class="right">'.price($total).'</td>';
|
||||
$result .= '<td class="right"><span class="amount">'.price($total).'</span></td>';
|
||||
$result .= '</tr>';
|
||||
}
|
||||
|
||||
@ -508,7 +508,7 @@ function getOpenTable($maxCount = 500, $socid = 0)
|
||||
|
||||
$result .= '<td class="left">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>';
|
||||
$result .= '<td class="right">'.dol_print_date($db->jdate($obj->df), 'day').'</td>';
|
||||
$result .= '<td class="right">'.price($obj->total_ttc).'</td>';
|
||||
$result .= '<td class="right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
|
||||
|
||||
$result .= '</tr>';
|
||||
|
||||
|
||||
@ -125,22 +125,22 @@ $permissiondellink = $user->rights->facture->creer; // Used by the include of ac
|
||||
$permissiontoedit = $user->rights->facture->creer; // Used by the include of actions_lineupdonw.inc.php
|
||||
|
||||
$arrayfields = array(
|
||||
'f.titre'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
|
||||
'f.total'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
|
||||
'f.tva'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>1),
|
||||
'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>1),
|
||||
'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>0),
|
||||
'f.fk_cond_reglement'=>array('label'=>$langs->trans("PaymentTerm"), 'checked'=>0),
|
||||
'recurring'=>array('label'=>$langs->trans("RecurringInvoiceTemplate"), 'checked'=>1),
|
||||
'f.frequency'=>array('label'=>$langs->trans("Frequency"), 'checked'=>1),
|
||||
'f.unit_frequency'=>array('label'=>$langs->trans("FrequencyUnit"), 'checked'=>1),
|
||||
'f.nb_gen_done'=>array('label'=>$langs->trans("NbOfGenerationDoneShort"), 'checked'=>1),
|
||||
'f.date_last_gen'=>array('label'=>$langs->trans("DateLastGenerationShort"), 'checked'=>1),
|
||||
'f.date_when'=>array('label'=>$langs->trans("NextDateToExecutionShort"), 'checked'=>1),
|
||||
'status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>100),
|
||||
'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
'f.titre'=>array('label'=>"Ref", 'checked'=>1),
|
||||
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
|
||||
'f.total'=>array('label'=>"AmountHT", 'checked'=>1),
|
||||
'f.tva'=>array('label'=>"AmountVAT", 'checked'=>1),
|
||||
'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>1),
|
||||
'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>0),
|
||||
'f.fk_cond_reglement'=>array('label'=>"PaymentTerm", 'checked'=>0),
|
||||
'recurring'=>array('label'=>"RecurringInvoiceTemplate", 'checked'=>1),
|
||||
'f.frequency'=>array('label'=>"Frequency", 'checked'=>1),
|
||||
'f.unit_frequency'=>array('label'=>"FrequencyUnit", 'checked'=>1),
|
||||
'f.nb_gen_done'=>array('label'=>"NbOfGenerationDoneShort", 'checked'=>1),
|
||||
'f.date_last_gen'=>array('label'=>"DateLastGenerationShort", 'checked'=>1),
|
||||
'f.date_when'=>array('label'=>"NextDateToExecutionShort", 'checked'=>1),
|
||||
'status'=>array('label'=>"Status", 'checked'=>1, 'position'=>100),
|
||||
'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
||||
'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
||||
);
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
@ -655,7 +655,7 @@ if ($resql) {
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfields['f.total']['checked'])) {
|
||||
print '<td class="nowrap right">'.price($objp->total).'</td>'."\n";
|
||||
print '<td class="nowrap right amount">'.price($objp->total).'</td>'."\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -665,7 +665,7 @@ if ($resql) {
|
||||
$totalarray['val']['f.total'] += $objp->total;
|
||||
}
|
||||
if (!empty($arrayfields['f.tva']['checked'])) {
|
||||
print '<td class="nowrap right">'.price($objp->total_vat).'</td>'."\n";
|
||||
print '<td class="nowrap right amount">'.price($objp->total_vat).'</td>'."\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -675,7 +675,7 @@ if ($resql) {
|
||||
$totalarray['val']['f.tva'] += $objp->total_vat;
|
||||
}
|
||||
if (!empty($arrayfields['f.total_ttc']['checked'])) {
|
||||
print '<td class="nowrap right">'.price($objp->total_ttc).'</td>'."\n";
|
||||
print '<td class="nowrap right amount">'.price($objp->total_ttc).'</td>'."\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -189,33 +189,33 @@ $arrayfields = array(
|
||||
'f.ref'=>array('label'=>"Ref", 'checked'=>1, 'position'=>5),
|
||||
'f.ref_client'=>array('label'=>"RefCustomer", 'checked'=>-1, 'position'=>10),
|
||||
'f.type'=>array('label'=>"Type", 'checked'=>0, 'position'=>15),
|
||||
'f.date'=>array('label'=>"DateInvoice", 'checked'=>1, 'position'=>20),
|
||||
'f.datef'=>array('label'=>"DateInvoice", 'checked'=>1, 'position'=>20),
|
||||
'f.date_valid'=>array('label'=>"DateValidation", 'checked'=>0, 'position'=>22),
|
||||
'f.date_lim_reglement'=>array('label'=>"DateDue", 'checked'=>1, 'position'=>25),
|
||||
'f.date_closing'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>30),
|
||||
'p.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled) ? 0 : 1), 'position'=>40),
|
||||
'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(empty($conf->projet->enabled) ? 0 : 1), 'position'=>40),
|
||||
'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(empty($conf->projet->enabled) ? 0 : 1), 'position'=>41),
|
||||
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1, 'position'=>50),
|
||||
's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>1, 'position'=>51),
|
||||
's.town'=>array('label'=>"Town", 'checked'=>1, 'position'=>55),
|
||||
's.town'=>array('label'=>"Town", 'checked'=>-1, 'position'=>55),
|
||||
's.zip'=>array('label'=>"Zip", 'checked'=>1, 'position'=>60),
|
||||
'state.nom'=>array('label'=>"StateShort", 'checked'=>0, 'position'=>65),
|
||||
'country.code_iso'=>array('label'=>"Country", 'checked'=>0, 'position'=>70),
|
||||
'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers, 'position'=>75),
|
||||
'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>1, 'position'=>80),
|
||||
'f.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>1, 'position'=>85),
|
||||
'f.module_source'=>array('label'=>"Module", 'checked'=>($contextpage == 'poslist' ? 1 : 0), 'enabled'=>((empty($conf->cashdesk->enabled) && empty($conf->takepos->enabled) && empty($conf->global->INVOICE_SHOW_POS)) ? 0 : 1), 'position'=>90),
|
||||
'f.pos_source'=>array('label'=>"Terminal", 'checked'=>($contextpage == 'poslist' ? 1 : 0), 'enabled'=>((empty($conf->cashdesk->enabled) && empty($conf->takepos->enabled) && empty($conf->global->INVOICE_SHOW_POS)) ? 0 : 1), 'position'=>91),
|
||||
'f.module_source'=>array('label'=>"POSModule", 'checked'=>($contextpage == 'poslist' ? 1 : 0), 'enabled'=>((empty($conf->cashdesk->enabled) && empty($conf->takepos->enabled) && empty($conf->global->INVOICE_SHOW_POS)) ? 0 : 1), 'position'=>90),
|
||||
'f.pos_source'=>array('label'=>"POSTerminal", 'checked'=>($contextpage == 'poslist' ? 1 : 0), 'enabled'=>((empty($conf->cashdesk->enabled) && empty($conf->takepos->enabled) && empty($conf->global->INVOICE_SHOW_POS)) ? 0 : 1), 'position'=>91),
|
||||
'f.total_ht'=>array('label'=>"AmountHT", 'checked'=>1, 'position'=>95),
|
||||
'f.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0, 'position'=>100),
|
||||
'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax1_assuj == "1"), 'position'=>110),
|
||||
'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax2_assuj == "1"), 'position'=>120),
|
||||
'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0, 'position'=>130),
|
||||
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>135),
|
||||
'dynamount_payed'=>array('label'=>"Received", 'checked'=>0, 'position'=>140),
|
||||
'rtp'=>array('label'=>"Rest", 'checked'=>0, 'position'=>150), // Not enabled by default because slow
|
||||
'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>160),
|
||||
'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>170),
|
||||
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>165),
|
||||
'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>170),
|
||||
'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>171),
|
||||
'f.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>180),
|
||||
'f.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>190),
|
||||
'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>200),
|
||||
@ -235,7 +235,24 @@ $arrayfields = array(
|
||||
if ($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_RETAINED_WARRANTY) {
|
||||
$arrayfields['f.retained_warranty'] = array('label'=>$langs->trans("RetainedWarranty"), 'checked'=>0, 'position'=>86);
|
||||
}
|
||||
|
||||
// Overwrite $arrayfields from columns into ->fields (transition before removal of $arrayoffields)
|
||||
foreach ($object->fields as $key => $val) {
|
||||
// If $val['visible']==0, then we never show the field
|
||||
if (!empty($val['visible'])) {
|
||||
$visible = (int) dol_eval($val['visible'], 1);
|
||||
$newkey = '';
|
||||
if (array_key_exists($key, $arrayfields)) { $newkey = $key; } elseif (array_key_exists('t.'.$key, $arrayfields)) { $newkey = 't.'.$key; } elseif (array_key_exists('f.'.$key, $arrayfields)) { $newkey = 'f.'.$key; } elseif (array_key_exists('s.'.$key, $arrayfields)) { $newkey = 's.'.$key; }
|
||||
if ($newkey) {
|
||||
$arrayfields[$newkey] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
|
||||
'position'=>$val['position'],
|
||||
'help'=>$val['help']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
|
||||
@ -434,7 +451,7 @@ $sql .= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_pub
|
||||
$sql .= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
|
||||
$sql .= ' f.fk_user_author,';
|
||||
$sql .= ' f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva as multicurrency_total_vat, f.multicurrency_total_ttc,';
|
||||
$sql .= ' f.datef as df, f.date_valid, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,';
|
||||
$sql .= ' f.datef, f.date_valid, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,';
|
||||
$sql .= ' f.paye as paye, f.fk_statut, f.close_code,';
|
||||
$sql .= ' f.datec as date_creation, f.tms as date_update, f.date_closing as date_closing,';
|
||||
$sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
|
||||
@ -942,31 +959,31 @@ if ($resql) {
|
||||
if ($user->rights->societe->client->voir || $socid) {
|
||||
$langs->load("commercial");
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('ThirdPartiesOfSaleRepresentative').': ';
|
||||
$moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth200');
|
||||
$tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
|
||||
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250');
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->societe->client->voir || $socid) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('LinkedToSpecificUsers').': ';
|
||||
$moreforfilter .= $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
|
||||
$tmptitle = $langs->trans('LinkedToSpecificUsers');
|
||||
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250');
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// If the user can view prospects other than his'
|
||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('IncludingProductWithTag').': ';
|
||||
$tmptitle = $langs->trans('IncludingProductWithTag');
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
|
||||
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
|
||||
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('CustomersProspectsCategoriesShort').': ';
|
||||
$moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1);
|
||||
$tmptitle = $langs->trans('CustomersProspectsCategoriesShort');
|
||||
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
$parameters = array();
|
||||
@ -985,6 +1002,7 @@ if ($resql) {
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
// Show the massaction checkboxes only when this page is not opend from the Extended POS
|
||||
if ($massactionbutton && $contextpage != 'poslist') {
|
||||
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
||||
@ -1028,7 +1046,7 @@ if ($resql) {
|
||||
print '</td>';
|
||||
}
|
||||
// Date invoice
|
||||
if (!empty($arrayfields['f.date']['checked'])) {
|
||||
if (!empty($arrayfields['f.datef']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
@ -1291,7 +1309,7 @@ if ($resql) {
|
||||
if (!empty($arrayfields['f.type']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['f.type']['label'], $_SERVER["PHP_SELF"], 'f.type', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['f.date']['checked'])) {
|
||||
if (!empty($arrayfields['f.datef']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['f.date']['label'], $_SERVER['PHP_SELF'], 'f.datef', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['f.date_valid']['checked'])) {
|
||||
@ -1456,7 +1474,7 @@ if ($resql) {
|
||||
$facturestatic->paye = $obj->paye;
|
||||
$facturestatic->fk_soc = $obj->fk_soc;
|
||||
|
||||
$facturestatic->date = $db->jdate($obj->df);
|
||||
$facturestatic->date = $db->jdate($obj->datef);
|
||||
$facturestatic->date_valid = $db->jdate($obj->date_valid);
|
||||
$facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
|
||||
|
||||
@ -1576,9 +1594,9 @@ if ($resql) {
|
||||
}
|
||||
|
||||
// Date
|
||||
if (!empty($arrayfields['f.date']['checked'])) {
|
||||
if (!empty($arrayfields['f.datef']['checked'])) {
|
||||
print '<td align="center" class="nowraponall">';
|
||||
print dol_print_date($db->jdate($obj->df), 'day');
|
||||
print dol_print_date($db->jdate($obj->datef), 'day');
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
@ -1755,7 +1773,7 @@ if ($resql) {
|
||||
|
||||
// Amount HT
|
||||
if (!empty($arrayfields['f.total_ht']['checked'])) {
|
||||
print '<td class="right nowraponall">'.price($obj->total_ht)."</td>\n";
|
||||
print '<td class="right nowraponall amount">'.price($obj->total_ht)."</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1766,7 +1784,7 @@ if ($resql) {
|
||||
}
|
||||
// Amount VAT
|
||||
if (!empty($arrayfields['f.total_vat']['checked'])) {
|
||||
print '<td class="right nowraponall">'.price($obj->total_vat)."</td>\n";
|
||||
print '<td class="right nowraponall amount">'.price($obj->total_vat)."</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1777,7 +1795,7 @@ if ($resql) {
|
||||
}
|
||||
// Amount LocalTax1
|
||||
if (!empty($arrayfields['f.total_localtax1']['checked'])) {
|
||||
print '<td class="right nowraponall">'.price($obj->total_localtax1)."</td>\n";
|
||||
print '<td class="right nowraponall amount">'.price($obj->total_localtax1)."</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1788,7 +1806,7 @@ if ($resql) {
|
||||
}
|
||||
// Amount LocalTax2
|
||||
if (!empty($arrayfields['f.total_localtax2']['checked'])) {
|
||||
print '<td class="right nowraponall">'.price($obj->total_localtax2)."</td>\n";
|
||||
print '<td class="right nowraponall amount">'.price($obj->total_localtax2)."</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1799,7 +1817,7 @@ if ($resql) {
|
||||
}
|
||||
// Amount TTC
|
||||
if (!empty($arrayfields['f.total_ttc']['checked'])) {
|
||||
print '<td class="right nowraponall">'.price($obj->total_ttc)."</td>\n";
|
||||
print '<td class="right nowraponall amount">'.price($obj->total_ttc)."</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1826,11 +1844,11 @@ if ($resql) {
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['f.retained_warranty']['checked'])) {
|
||||
print '<td align="right">'.(!empty($obj->retained_warranty) ?price($obj->retained_warranty).'%' : ' ').'</td>';
|
||||
print '<td align="right amount">'.(!empty($obj->retained_warranty) ?price($obj->retained_warranty).'%' : ' ').'</td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['dynamount_payed']['checked'])) {
|
||||
print '<td class="right nowraponall">'.(!empty($totalpay) ?price($totalpay, 0, $langs) : ' ').'</td>'; // TODO Use a denormalized field
|
||||
print '<td class="right nowraponall amount">'.(!empty($totalpay) ?price($totalpay, 0, $langs) : ' ').'</td>'; // TODO Use a denormalized field
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1842,7 +1860,7 @@ if ($resql) {
|
||||
|
||||
// Pending amount
|
||||
if (!empty($arrayfields['rtp']['checked'])) {
|
||||
print '<td class="right nowraponall">';
|
||||
print '<td class="right nowraponall amount">';
|
||||
print (!empty($remaintopay) ? price($remaintopay, 0, $langs) : ' ');
|
||||
print '</td>'; // TODO Use a denormalized field
|
||||
if (!$i) {
|
||||
@ -1874,27 +1892,27 @@ if ($resql) {
|
||||
}
|
||||
// Amount HT
|
||||
if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) {
|
||||
print '<td class="right nowraponall">'.price($obj->multicurrency_total_ht)."</td>\n";
|
||||
print '<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht)."</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Amount VAT
|
||||
if (!empty($arrayfields['f.multicurrency_total_vat']['checked'])) {
|
||||
print '<td class="right nowraponall">'.price($obj->multicurrency_total_vat)."</td>\n";
|
||||
print '<td class="right nowraponall amount">'.price($obj->multicurrency_total_vat)."</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Amount TTC
|
||||
if (!empty($arrayfields['f.multicurrency_total_ttc']['checked'])) {
|
||||
print '<td class="right nowraponall">'.price($obj->multicurrency_total_ttc)."</td>\n";
|
||||
print '<td class="right nowraponall amount">'.price($obj->multicurrency_total_ttc)."</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfields['multicurrency_dynamount_payed']['checked'])) {
|
||||
print '<td class="right nowraponall">'.(!empty($multicurrency_totalpay) ?price($multicurrency_totalpay, 0, $langs) : ' ').'</td>'; // TODO Use a denormalized field
|
||||
print '<td class="right nowraponall amount">'.(!empty($multicurrency_totalpay) ?price($multicurrency_totalpay, 0, $langs) : ' ').'</td>'; // TODO Use a denormalized field
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -384,9 +384,9 @@ foreach ($data as $val) {
|
||||
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&mode='.$mode.($socid > 0 ? '&socid='.$socid : '').($userid > 0 ? '&userid='.$userid : '').'">'.$year.'</a></td>';
|
||||
print '<td class="right">'.$val['nb'].'</td>';
|
||||
print '<td class="right" style="'.(($val['nb_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.round($val['nb_diff']).'</td>';
|
||||
print '<td class="right">'.price(price2num($val['total'], 'MT'), 1).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(price2num($val['total'], 'MT'), 1).'</span></td>';
|
||||
print '<td class="right" style="'.(($val['total_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.round($val['total_diff']).'</td>';
|
||||
print '<td class="right">'.price(price2num($val['avg'], 'MT'), 1).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(price2num($val['avg'], 'MT'), 1).'</span></td>';
|
||||
print '<td class="right" style="'.(($val['avg_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.round($val['avg_diff']).'</td>';
|
||||
print '</tr>';
|
||||
$oldyear = $year;
|
||||
|
||||
@ -351,7 +351,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
|
||||
print '<td class="nowrap tdoverflowmax100">';
|
||||
print $companystatic->getNomUrl(1, 'supplier');
|
||||
print '</td>';
|
||||
print '<td class="right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
|
||||
print '</tr>';
|
||||
$tot_ttc += $obj->total_ttc;
|
||||
$i++;
|
||||
@ -620,7 +620,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
|
||||
print $thirdpartystatic->getNomUrl(1, 'supplier');
|
||||
print '</td>';
|
||||
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
|
||||
print '<td class="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($obj->total_ht).'</span></td>';
|
||||
}
|
||||
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->tms), 'day').'</td>';
|
||||
@ -951,7 +951,7 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user
|
||||
print $societestatic->getNomUrl(1, 'customer');
|
||||
print '</td>';
|
||||
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
|
||||
print '<td class="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($obj->total_ht).'</span></td>';
|
||||
}
|
||||
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td class="nowrap right">'.price($obj->total_ttc - $obj->tot_fttc).'</td>';
|
||||
@ -974,10 +974,10 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user
|
||||
|
||||
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").' <font style="font-weight: normal">('.$langs->trans("RemainderToBill").': '.price($tot_tobill).')</font> </td>';
|
||||
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
|
||||
print '<td class="right">'.price($tot_ht).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($tot_ht).'</span></td>';
|
||||
}
|
||||
print '<td class="nowrap right">'.price($tot_ttc).'</td>';
|
||||
print '<td class="nowrap right">'.price($tot_tobill).'</td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price($tot_ttc).'</span></td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price($tot_tobill).'</span></td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
print '</table></div><br>';
|
||||
@ -1110,10 +1110,10 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
|
||||
print '</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->datelimite), 'day').'</td>';
|
||||
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
|
||||
print '<td class="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($obj->total_ht).'</span></td>';
|
||||
}
|
||||
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td class="nowrap right">'.price($obj->am).'</td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price($obj->am).'</span></td>';
|
||||
print '<td>'.$tmpinvoice->getLibStatut(3, $obj->am).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -1139,10 +1139,10 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
|
||||
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").' <font style="font-weight: normal">('.$langs->trans("RemainderToTake").': '.price($total_ttc - $totalam).')</font> </td>';
|
||||
print '<td> </td>';
|
||||
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
|
||||
print '<td class="right">'.price($total).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($total).'</span></td>';
|
||||
}
|
||||
print '<td class="nowrap right">'.price($total_ttc).'</td>';
|
||||
print '<td class="nowrap right">'.price($totalam).'</td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price($total_ttc).'</span></td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price($totalam).'</span></td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
} else {
|
||||
@ -1260,10 +1260,10 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
|
||||
print '<td class="nowrap tdoverflowmax100">'.$societestatic->getNomUrl(1, 'supplier').'</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->date_lim_reglement), 'day').'</td>';
|
||||
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
|
||||
print '<td class="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($obj->total_ht).'</span></td>';
|
||||
}
|
||||
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td class="nowrap right">'.price($obj->am).'</td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price($obj->am).'</span></td>';
|
||||
print '<td>'.$facstatic->getLibStatut(3, $obj->am).'</td>';
|
||||
print '</tr>';
|
||||
$total += $obj->total_ht;
|
||||
|
||||
@ -91,7 +91,7 @@ if ($result) {
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="4">'.$langs->trans("Total").'</td>';
|
||||
print '<td class="right">'.price($total).'</td></tr>';
|
||||
print '<td class="right"><span class="amount">'.price($total).'</span></td></tr>';
|
||||
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
|
||||
@ -492,8 +492,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
||||
print '<td class="nowrap right"> </td>';
|
||||
print '<td class="right"> </td>';
|
||||
}
|
||||
print '<td class="right">'.price(price2num($subtot_coll_total_ht, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($subtot_coll_vat, 'MT')).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(price2num($subtot_coll_total_ht, 'MT')).'</span></td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price(price2num($subtot_coll_vat, 'MT')).'</span></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -505,8 +505,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
||||
print '<td class="nowrap right"> </td>';
|
||||
print '<td class="right"> </td>';
|
||||
}
|
||||
print '<td class="right">'.price(price2num(0, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num(0, 'MT')).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(price2num(0, 'MT')).'</span></td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price(price2num(0, 'MT')).'</span></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -643,8 +643,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
||||
print '<td class="nowrap right"> </td>';
|
||||
print '<td class="right"> </td>';
|
||||
}
|
||||
print '<td class="right">'.price(price2num($subtot_paye_total_ht, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($subtot_paye_vat, 'MT')).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(price2num($subtot_paye_total_ht, 'MT')).'</span></td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price(price2num($subtot_paye_vat, 'MT')).'</span></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -656,8 +656,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
||||
print '<td class="nowrap right"> </td>';
|
||||
print '<td class="right"> </td>';
|
||||
}
|
||||
print '<td class="right">'.price(price2num(0, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num(0, 'MT')).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(price2num(0, 'MT')).'</span></td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price(price2num(0, 'MT')).'</span></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -713,17 +713,17 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
}
|
||||
|
||||
// Price
|
||||
print '<td class="right">'.price($sign * $objp->total_ttc).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($sign * $objp->total_ttc).'</span></td>';
|
||||
|
||||
// Received + already paid
|
||||
print '<td class="right">'.price($sign * $paiement);
|
||||
print '<td class="right"><span class="amount">'.price($sign * $paiement);
|
||||
if ($creditnotes) {
|
||||
print '<span class="opacitymedium">+'.price($creditnotes).'</span>';
|
||||
}
|
||||
if ($deposits) {
|
||||
print '<span class="opacitymedium">+'.price($deposits).'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</span></td>';
|
||||
|
||||
// Remain to take or to pay back
|
||||
print '<td class="right">'.price($sign * $remaintopay).'</td>';
|
||||
@ -901,7 +901,7 @@ if (!GETPOST('action', 'aZ09')) {
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$objp->facid.'">'.$objp->ref."</a></td>\n";
|
||||
print '<td>'.dol_print_date($db->jdate($objp->dp))."</td>\n";
|
||||
print '<td>'.$objp->paiement_type.' '.$objp->num_payment."</td>\n";
|
||||
print '<td class="right">'.price($objp->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -365,13 +365,13 @@ if ($resql) {
|
||||
print '</td>';
|
||||
}
|
||||
// Expected to pay
|
||||
print '<td class="right">'.price($objp->total_ttc).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($objp->total_ttc).'</span></td>';
|
||||
|
||||
// Amount payed
|
||||
print '<td class="right">'.price($objp->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
|
||||
|
||||
// Remain to pay
|
||||
print '<td class="right">'.price($remaintopay).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($remaintopay).'</span></td>';
|
||||
|
||||
// Status
|
||||
print '<td class="right">'.$invoice->getLibStatut(5, $alreadypayed).'</td>';
|
||||
|
||||
@ -462,7 +462,7 @@ if ($action == 'new') {
|
||||
print '<td>'.$value["numero"]."</td>\n";
|
||||
print '<td>'.$value["emetteur"]."</td>\n";
|
||||
print '<td>'.$value["banque"]."</td>\n";
|
||||
print '<td class="right">'.price($value["amount"], 0, $langs, 1, -1, -1, $conf->currency).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($value["amount"], 0, $langs, 1, -1, -1, $conf->currency).'</span></td>';
|
||||
|
||||
// Link to payment
|
||||
print '<td class="center">';
|
||||
@ -639,7 +639,7 @@ if ($action == 'new') {
|
||||
print '<td class="center">'.($objp->num_chq ? $objp->num_chq : ' ').'</td>';
|
||||
print '<td>'.dol_trunc($objp->emetteur, 24).'</td>';
|
||||
print '<td>'.dol_trunc($objp->banque, 24).'</td>';
|
||||
print '<td class="right">'.price($objp->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
|
||||
// Link to payment
|
||||
print '<td class="center">';
|
||||
$paymentstatic->id = $objp->pid;
|
||||
|
||||
@ -131,7 +131,7 @@ if ($resql) {
|
||||
print '<td>'.dol_print_date($db->jdate($objp->db), 'day').'</td>';
|
||||
print '<td class="nowraponall">'.$accountstatic->getNomUrl(1).'</td>';
|
||||
print '<td class="right">'.$objp->nbcheque.'</td>';
|
||||
print '<td class="right">'.price($objp->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
|
||||
print '<td class="right">'.$checkdepositstatic->LibStatut($objp->statut, 3).'</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
@ -228,7 +228,7 @@ if ($resql) {
|
||||
print '<td class="right">'.$objp->nbcheque.'</td>';
|
||||
|
||||
// Amount
|
||||
print '<td class="right">'.price($objp->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
|
||||
|
||||
// Statut
|
||||
print '<td class="right">';
|
||||
|
||||
@ -547,7 +547,7 @@ while ($i < min($num, $limit)) {
|
||||
|
||||
// Amount
|
||||
if (!empty($arrayfields['p.amount']['checked'])) {
|
||||
print '<td class="right">'.price($objp->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ if ($resql) {
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowPayment"), "payment").' '.$objp->rowid.'</a></td>';
|
||||
print '<td width="80" align="center">'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n";
|
||||
print "<td>$objp->paiement_type $objp->num_payment</td>\n";
|
||||
print '<td class="right">'.price($objp->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
|
||||
print '<td class="center">';
|
||||
|
||||
if ($objp->statut == 0) {
|
||||
|
||||
@ -266,11 +266,11 @@ if ($action == 'create') {
|
||||
print "<td align=\"center\"><b>!!!</b></td>\n";
|
||||
}
|
||||
|
||||
print '<td class="right">'.price($objp->amount)."</td>";
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount)."</span></td>";
|
||||
|
||||
print '<td class="right">'.price($sumpaid)."</td>";
|
||||
print '<td class="right"><span class="amount">'.price($sumpaid)."</span></td>";
|
||||
|
||||
print '<td class="right">'.price($objp->amount - $sumpaid)."</td>";
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount - $sumpaid)."</span></td>";
|
||||
|
||||
print '<td class="center">';
|
||||
if ($sumpaid < $objp->amount) {
|
||||
|
||||
@ -262,11 +262,11 @@ if ($action == 'create') {
|
||||
print "<td align=\"center\"><b>!!!</b></td>\n";
|
||||
}
|
||||
|
||||
print '<td class="right">'.price($objp->amount)."</td>";
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount)."</span></td>";
|
||||
|
||||
print '<td class="right">'.price($sumpaid)."</td>";
|
||||
print '<td class="right"><span class="amount">'.price($sumpaid)."</span></td>";
|
||||
|
||||
print '<td class="right">'.price($objp->amount - $sumpaid)."</td>";
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount - $sumpaid)."</span></td>";
|
||||
|
||||
print '<td class="center">';
|
||||
|
||||
|
||||
@ -207,11 +207,11 @@ if ($resql) {
|
||||
// Label
|
||||
print '<td>'.$objp->label.'</td>';
|
||||
// Expected to pay
|
||||
print '<td class="right">'.price($objp->sc_amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($objp->sc_amount).'</span></td>';
|
||||
// Status
|
||||
print '<td class="center">'.$socialcontrib->getLibStatut(4, $objp->amount).'</td>';
|
||||
// Amount paid
|
||||
print '<td class="right">'.price($objp->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
|
||||
print "</tr>\n";
|
||||
if ($objp->paye == 1) { // If at least one invoice is paid, disable delete
|
||||
$disable_delete = 1;
|
||||
|
||||
@ -263,11 +263,11 @@ if ($resql) {
|
||||
// Label
|
||||
print '<td>'.$objp->label.'</td>';
|
||||
// Expected to pay
|
||||
print '<td class="right">'.price($objp->tva_amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($objp->tva_amount).'</span></td>';
|
||||
// Status
|
||||
print '<td class="center">'.$tva->getLibStatut(4, $objp->amount).'</td>';
|
||||
// Amount payed
|
||||
print '<td class="right">'.price($objp->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
|
||||
print "</tr>\n";
|
||||
if ($objp->paye == 1) { // If at least one invoice is paid, disable delete
|
||||
$disable_delete = 1;
|
||||
|
||||
@ -84,9 +84,9 @@ print '</a>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("AmountToWithdraw").'</td>';
|
||||
print '<td class="right">';
|
||||
print '<td class="right"><span class="amount">';
|
||||
print price($bprev->SommeAPrelever('bank-transfer'), '', '', 1, -1, -1, 'auto');
|
||||
print '</td></tr></table></div><br>';
|
||||
print '</span></td></tr></table></div><br>';
|
||||
|
||||
|
||||
|
||||
@ -216,8 +216,8 @@ if ($result) {
|
||||
print $bprev->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
print '<td>'.dol_print_date($db->jdate($obj->datec), "dayhour")."</td>\n";
|
||||
print '<td class="right">'.price($obj->amount)."</td>\n";
|
||||
print '<td class="right">'.$bprev->getLibStatut(3)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>\n";
|
||||
print '<td class="right"><span class="amount">'.$bprev->getLibStatut(3)."</span></td>\n";
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
|
||||
@ -423,7 +423,7 @@ if ($id > 0 || $ref) {
|
||||
print $thirdparty->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
|
||||
print '<td class="right">'.price($obj->amount)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>\n";
|
||||
|
||||
print '<td class="right">';
|
||||
|
||||
|
||||
@ -503,7 +503,7 @@ if ($result)
|
||||
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->datec),'day')."</td>\n";
|
||||
|
||||
print '<td class="right">'.price($obj->amount,0,$langs,0,0,-1,$conf->currency)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount,0,$langs,0,0,-1,$conf->currency)."</span></td>\n";
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
|
||||
@ -281,10 +281,10 @@ if ($resql) {
|
||||
print "</td>\n";
|
||||
|
||||
// Amount of invoice
|
||||
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($obj->total_ttc)."</span></td>\n";
|
||||
|
||||
// Amount requested
|
||||
print '<td class="right">'.price($obj->amount_requested)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount_requested)."</span></td>\n";
|
||||
|
||||
// Status of requests
|
||||
print '<td class="center">';
|
||||
|
||||
@ -222,7 +222,7 @@ if ($resql) {
|
||||
print '</a></td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.$obj->name."</a></td>\n";
|
||||
|
||||
print '<td class="right">'.price($obj->amount)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>\n";
|
||||
print '<td>'.$rej->motifs[$obj->motif].'</td>';
|
||||
|
||||
print '<td class="center">'.yn($obj->afacturer).'</td>';
|
||||
@ -240,7 +240,7 @@ if ($resql) {
|
||||
if ($num > 0) {
|
||||
print '<tr class="liste_total"><td> </td>';
|
||||
print '<td class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
print '<td class="right">'.price($total)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($total)."</span></td>\n";
|
||||
print '<td colspan="3"> </td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
@ -84,9 +84,9 @@ print '</a>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("AmountToWithdraw").'</td>';
|
||||
print '<td class="right">';
|
||||
print '<td class="right"><span class="amount">';
|
||||
print price($bprev->SommeAPrelever('direct-debit'), '', '', 1, -1, -1, 'auto');
|
||||
print '</td></tr></table></div><br>';
|
||||
print '</span></td></tr></table></div><br>';
|
||||
|
||||
|
||||
|
||||
@ -218,7 +218,7 @@ if ($result) {
|
||||
print $bprev->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
print '<td>'.dol_print_date($db->jdate($obj->datec), "dayhour")."</td>\n";
|
||||
print '<td class="right">'.price($obj->amount)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>\n";
|
||||
print '<td class="right">'.$bprev->getLibStatut(3)."</td>\n";
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
@ -301,7 +301,7 @@ if ($id) {
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">';
|
||||
print img_object($langs->trans("ShowCompany"), "company").' '.$obj->name."</a></td>\n";
|
||||
|
||||
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($obj->total_ttc)."</span></td>\n";
|
||||
|
||||
print '<td class="right">';
|
||||
$invoicestatic->fetch($obj->facid);
|
||||
|
||||
@ -266,7 +266,7 @@ if ($result) {
|
||||
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->datec), 'day')."</td>\n";
|
||||
|
||||
print '<td class="right">'.price($obj->amount)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>\n";
|
||||
|
||||
print '<td> </td>';
|
||||
|
||||
|
||||
@ -205,7 +205,7 @@ if ($result) {
|
||||
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->datec), 'day')."</td>\n";
|
||||
|
||||
print '<td class="right">'.price($obj->amount)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>\n";
|
||||
|
||||
print '<td class="right">';
|
||||
print $bon->LibStatut($obj->statut, 3);
|
||||
|
||||
@ -286,7 +286,7 @@ if ($id > 0) {
|
||||
$totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']);
|
||||
|
||||
// Balance
|
||||
print '<td class="right">'.price($data['balance'])."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($data['balance'])."</span></td>\n";
|
||||
|
||||
// Author
|
||||
print '<td class="nowrap right">';
|
||||
|
||||
@ -311,7 +311,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td>';
|
||||
print '<td>'.$objp->pcg_type.($objp->name ? ' ('.$objp->name.')' : '')."</td>\n";
|
||||
print '<td class="right">'.price($objp->amount)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount)."</span></td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$total_ht += (isset($objp->amount) ? $objp->amount : 0);
|
||||
@ -350,7 +350,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
print '<tr>';
|
||||
print '<td></td>';
|
||||
print '<td class="tdoverflowmax200"> '.length_accountg($cpt['account_number']).' - '.$cpt['account_label'].'</td>';
|
||||
print '<td class="right">'.price($resultN).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($resultN).'</span></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
@ -420,9 +420,9 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
print "<td>".$langs->trans("Bills").' <a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$objp->socid.'">'.$objp->name."</td>\n";
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right">'.price($objp->amount_ht)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount_ht)."</span></td>\n";
|
||||
}
|
||||
print '<td class="right">'.price($objp->amount_ttc)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount_ttc)."</span></td>\n";
|
||||
|
||||
$total_ht += (isset($objp->amount_ht) ? $objp->amount_ht : 0);
|
||||
$total_ttc += $objp->amount_ttc;
|
||||
@ -465,9 +465,9 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
print "<td>".$langs->trans("Bills")." ".$langs->trans("Other")." (".$langs->trans("PaymentsNotLinkedToInvoice").")\n";
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right">'.price($objp->amount_ht)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount_ht)."</span></td>\n";
|
||||
}
|
||||
print '<td class="right">'.price($objp->amount_ttc)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount_ttc)."</span></td>\n";
|
||||
|
||||
$total_ht += (isset($objp->amount_ht) ? $objp->amount_ht : 0);
|
||||
$total_ttc += $objp->amount_ttc;
|
||||
@ -557,9 +557,9 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
print "<td>".$langs->trans("Donation")." <a href=\"".DOL_URL_ROOT."/don/list.php?search_company=".$obj->name."&search_name=".$obj->firstname." ".$obj->lastname."\">".$obj->name." ".$obj->firstname." ".$obj->lastname."</a></td>\n";
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right">'.price($obj->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount).'</span></td>';
|
||||
}
|
||||
print '<td class="right">'.price($obj->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount).'</span></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
@ -638,9 +638,9 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
print "<td>".$langs->trans("Bills")." <a href=\"".DOL_URL_ROOT."/fourn/facture/list.php?socid=".$objp->socid."\">".$objp->name."</a></td>\n";
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right">'.price(-$objp->amount_ht)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price(-$objp->amount_ht)."</span></td>\n";
|
||||
}
|
||||
print '<td class="right">'.price(-$objp->amount_ttc)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price(-$objp->amount_ttc)."</span></td>\n";
|
||||
|
||||
$total_ht -= (isset($objp->amount_ht) ? $objp->amount_ht : 0);
|
||||
$total_ttc -= $objp->amount_ttc;
|
||||
@ -733,9 +733,9 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print '<td>'.$obj->label.'</td>';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right">'.price(-$obj->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
|
||||
}
|
||||
print '<td class="right">'.price(-$obj->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
@ -820,9 +820,9 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print '<td>'.$obj->label.'</td>';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right">'.price(-$obj->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
|
||||
}
|
||||
print '<td class="right">'.price(-$obj->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
@ -903,9 +903,9 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
print "<td>".$langs->trans("Salary")." <a href=\"".DOL_URL_ROOT."/salaries/list.php?filtre=s.fk_user=".$obj->fk_user."\">".$obj->firstname." ".$obj->lastname."</a></td>\n";
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right">'.price(-$obj->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
|
||||
}
|
||||
print '<td class="right">'.price(-$obj->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
@ -989,9 +989,9 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
print "<td>".$langs->trans("ExpenseReport")." <a href=\"".DOL_URL_ROOT."/expensereport/list.php?search_user=".$obj->userid."\">".$obj->firstname." ".$obj->lastname."</a></td>\n";
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right">'.price(-$obj->amount_ht).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount_ht).'</span></td>';
|
||||
}
|
||||
print '<td class="right">'.price(-$obj->amount_ttc).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount_ttc).'</span></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
} else {
|
||||
@ -1050,9 +1050,9 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print "<td>".$langs->trans("Debit")."</td>\n";
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right">'.price(-$obj->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
|
||||
}
|
||||
print '<td class="right">'.price(-$obj->amount)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount)."</span></td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
// Credit (payment received from customer for example)
|
||||
@ -1067,9 +1067,9 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print "<td>".$langs->trans("Credit")."</td>\n";
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right">'.price($obj->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount).'</span></td>';
|
||||
}
|
||||
print '<td class="right">'.price($obj->amount)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
// Total
|
||||
@ -1117,9 +1117,9 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print "<td>".$loan_static->getNomUrl(1).' - '.$obj->label."</td>\n";
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right">'.price(-$obj->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
|
||||
}
|
||||
print '<td class="right">'.price(-$obj->amount)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount)."</span></td>\n";
|
||||
print "</tr>\n";
|
||||
$subtotal_ht -= $obj->amount;
|
||||
$subtotal_ttc -= $obj->amount;
|
||||
@ -1205,7 +1205,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print "<td>".$langs->trans("VATToPay")."</td>\n";
|
||||
print '<td class="right"> </td>'."\n";
|
||||
print '<td class="right">'.price($amount)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($amount)."</span></td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
// VAT to retreive
|
||||
@ -1263,7 +1263,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print '<td>'.$langs->trans("VATToCollect")."</td>\n";
|
||||
print '<td class="right"> </td>'."\n";
|
||||
print '<td class="right">'.price($amount)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($amount)."</span></td>\n";
|
||||
print "</tr>\n";
|
||||
} else {
|
||||
// VAT really already paid
|
||||
@ -1319,7 +1319,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td <class="right"></td>'."\n";
|
||||
}
|
||||
print '<td class="right">'.price($amount)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($amount)."</span></td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
// VAT really received
|
||||
@ -1375,7 +1375,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right"></td>'."\n";
|
||||
}
|
||||
print '<td class="right">'.price($amount)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($amount)."</span></td>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -500,18 +500,18 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td class="right">'.price($totCat['NP']).'</td>';
|
||||
print '<td class="right">'.price($totCat['N']).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($totCat['NP']).'</span></td>';
|
||||
print '<td class="right"><span class="amount">'.price($totCat['N']).'</span></td>';
|
||||
|
||||
// Each month
|
||||
foreach ($totCat['M'] as $k => $v) {
|
||||
if (($k + 1) >= $date_startmonth) {
|
||||
print '<td class="right">'.price($v).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($v).'</span></td>';
|
||||
}
|
||||
}
|
||||
foreach ($totCat['M'] as $k => $v) {
|
||||
if (($k + 1) < $date_startmonth) {
|
||||
print '<td class="right">'.price($v).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($v).'</span></td>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -531,20 +531,20 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
print ' - ';
|
||||
print $cpt['account_label'];
|
||||
print '</td>';
|
||||
print '<td class="right">'.price($resultNP).'</td>';
|
||||
print '<td class="right">'.price($resultN).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($resultNP).'</span></td>';
|
||||
print '<td class="right"><span class="amount">'.price($resultN).'</span></td>';
|
||||
|
||||
// Make one call for each month
|
||||
foreach ($months as $k => $v) {
|
||||
if (($k + 1) >= $date_startmonth) {
|
||||
$resultM = $totPerAccount[$cpt['account_number']]['M'][$k];
|
||||
print '<td class="right">'.price($resultM).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($resultM).'</span>/td>';
|
||||
}
|
||||
}
|
||||
foreach ($months as $k => $v) {
|
||||
if (($k + 1) < $date_startmonth) {
|
||||
$resultM = $totPerAccount[$cpt['account_number']]['M'][$k];
|
||||
print '<td class="right">'.price($resultM).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($resultM).'</span></td>';
|
||||
}
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
@ -677,7 +677,7 @@ if ($id > 0) {
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="right">'.price($objp->amount)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount)."</span></td>\n";
|
||||
print "</tr>";
|
||||
$totalpaye += $objp->amount;
|
||||
$i++;
|
||||
|
||||
@ -675,7 +675,7 @@ if ($id) {
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="right">'.price($objp->amount)."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount)."</span></td>\n";
|
||||
print "</tr>";
|
||||
$totalpaye += $objp->amount;
|
||||
$i++;
|
||||
|
||||
@ -558,8 +558,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
||||
print '<td class="nowrap right"> </td>';
|
||||
print '<td class="right"> </td>';
|
||||
}
|
||||
print '<td class="right">'.price(price2num($subtot_coll_total_ht, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($subtot_coll_vat, 'MT')).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(price2num($subtot_coll_total_ht, 'MT')).'</span></td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price(price2num($subtot_coll_vat, 'MT')).'</span></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
@ -748,8 +748,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
||||
print '<td class="nowrap right"> </td>';
|
||||
print '<td class="right"> </td>';
|
||||
}
|
||||
print '<td class="right">'.price(price2num($subtot_paye_total_ht, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($subtot_paye_vat, 'MT')).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(price2num($subtot_paye_total_ht, 'MT')).'</span></td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price(price2num($subtot_paye_vat, 'MT')).'</span></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
|
||||
// Type
|
||||
//print '<td><a href="../tva/list.php?filtre=tva.fk_type:'.$obj->type.'">'.$obj->type_label.'</a></td>';
|
||||
// Expected to pay
|
||||
print '<td class="right">'.price($obj->total).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($obj->total).'</span></td>';
|
||||
// Paid
|
||||
print '<td class="right">';
|
||||
if ($obj->totalpaye) {
|
||||
|
||||
@ -595,8 +595,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
||||
print '<td class="nowrap right"> </td>';
|
||||
print '<td class="right"> </td>';
|
||||
}
|
||||
print '<td class="right">'.price(price2num($subtot_coll_total_ht, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($subtot_coll_vat, 'MT')).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(price2num($subtot_coll_total_ht, 'MT')).'</span></td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price(price2num($subtot_coll_vat, 'MT')).'</span></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -831,8 +831,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
||||
print '<td class="nowrap right"> </td>';
|
||||
print '<td class="right"> </td>';
|
||||
}
|
||||
print '<td class="right">'.price(price2num($subtot_paye_total_ht, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($subtot_paye_vat, 'MT')).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(price2num($subtot_paye_total_ht, 'MT')).'</span></td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price(price2num($subtot_paye_vat, 'MT')).'</span></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -844,8 +844,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
||||
print '<td class="nowrap right"> </td>';
|
||||
print '<td class="right"> </td>';
|
||||
}
|
||||
print '<td class="right">'.price(price2num(0, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num(0, 'MT')).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price(price2num(0, 'MT')).'</span></td>';
|
||||
print '<td class="nowrap right"><span class="amount">'.price(price2num(0, 'MT')).'</span></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -704,25 +704,29 @@ $moreforfilter = '';
|
||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('Categories').': ';
|
||||
$moreforfilter .= $formother->select_categories(Categorie::TYPE_CONTACT, $search_categ, 'search_categ', 1);
|
||||
$tmptitle = $langs->trans('ContactCategoriesShort');
|
||||
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"');
|
||||
$moreforfilter .= $formother->select_categories(Categorie::TYPE_CONTACT, $search_categ, 'search_categ', 1, $tmptitle);
|
||||
$moreforfilter .= '</div>';
|
||||
if (empty($type) || $type == 'c' || $type == 'p') {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$tmptitle = '';
|
||||
if ($type == 'c') {
|
||||
$moreforfilter .= $langs->trans('CustomersCategoriesShort').': ';
|
||||
$tmptitle .= $langs->trans('CustomersCategoriesShort');
|
||||
} elseif ($type == 'p') {
|
||||
$moreforfilter .= $langs->trans('ProspectsCategoriesShort').': ';
|
||||
$tmptitle .= $langs->trans('ProspectsCategoriesShort');
|
||||
} else {
|
||||
$moreforfilter .= $langs->trans('CustomersProspectsCategoriesShort').': ';
|
||||
$tmptitle .= $langs->trans('CustomersProspectsCategoriesShort');
|
||||
}
|
||||
$moreforfilter .= $formother->select_categories(Categorie::TYPE_CUSTOMER, $search_categ_thirdparty, 'search_categ_thirdparty', 1);
|
||||
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"');
|
||||
$moreforfilter .= $formother->select_categories(Categorie::TYPE_CUSTOMER, $search_categ_thirdparty, 'search_categ_thirdparty', 1, $tmptitle);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
if (empty($type) || $type == 'f') {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('SuppliersCategoriesShort').': ';
|
||||
$moreforfilter .= $formother->select_categories(Categorie::TYPE_SUPPLIER, $search_categ_supplier, 'search_categ_supplier', 1);
|
||||
$tmptitle = $langs->trans('SuppliersCategoriesShort');
|
||||
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"');
|
||||
$moreforfilter .= $formother->select_categories(Categorie::TYPE_SUPPLIER, $search_categ_supplier, 'search_categ_supplier', 1, $tmptitle);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
}
|
||||
@ -1092,35 +1096,35 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
// Phone
|
||||
if (!empty($arrayfields['p.phone']['checked'])) {
|
||||
print '<td>'.dol_print_phone($obj->phone_pro, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
|
||||
print '<td class="nowraponall">'.dol_print_phone($obj->phone_pro, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Phone perso
|
||||
if (!empty($arrayfields['p.phone_perso']['checked'])) {
|
||||
print '<td>'.dol_print_phone($obj->phone_perso, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
|
||||
print '<td class="nowraponall">'.dol_print_phone($obj->phone_perso, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Phone mobile
|
||||
if (!empty($arrayfields['p.phone_mobile']['checked'])) {
|
||||
print '<td>'.dol_print_phone($obj->phone_mobile, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'mobile').'</td>';
|
||||
print '<td class="nowraponall">'.dol_print_phone($obj->phone_mobile, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'mobile').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Fax
|
||||
if (!empty($arrayfields['p.fax']['checked'])) {
|
||||
print '<td>'.dol_print_phone($obj->fax, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'fax').'</td>';
|
||||
print '<td class="nowraponall">'.dol_print_phone($obj->fax, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'fax').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// EMail
|
||||
if (!empty($arrayfields['p.email']['checked'])) {
|
||||
print '<td>'.dol_print_email($obj->email, $obj->rowid, $obj->socid, 'AC_EMAIL', 18, 0, 1).'</td>';
|
||||
print '<td class="nowraponall tdmaxoverflow300">'.dol_print_email($obj->email, $obj->rowid, $obj->socid, 'AC_EMAIL', 18, 0, 1).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1144,7 +1148,7 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
// Company
|
||||
if (!empty($arrayfields['p.fk_soc']['checked']) || !empty($arrayfields['s.nom']['checked'])) {
|
||||
print '<td>';
|
||||
print '<td class="tdoverflowmax200">';
|
||||
if ($obj->socid) {
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->fetch($obj->socid);
|
||||
|
||||
@ -54,6 +54,8 @@ $langs->loadLangs(array("contracts", "orders", "companies", "bills", "products",
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
|
||||
$socid = GETPOST('socid', 'int');
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
@ -113,7 +115,7 @@ if (empty($reshook)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
|
||||
|
||||
if ($action == 'confirm_active' && $confirm == 'yes' && $user->rights->contrat->activer) {
|
||||
$result = $object->active_line($user, GETPOST('ligne'), GETPOST('date'), GETPOST('dateend'), GETPOST('comment'));
|
||||
$result = $object->active_line($user, GETPOST('ligne', 'int'), GETPOST('date'), GETPOST('dateend'), GETPOST('comment'));
|
||||
|
||||
if ($result > 0) {
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
@ -127,7 +129,7 @@ if (empty($reshook)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd")), null, 'errors');
|
||||
}
|
||||
if (!$error) {
|
||||
$result = $object->close_line($user, GETPOST('ligne'), GETPOST('dateend'), urldecode(GETPOST('comment')));
|
||||
$result = $object->close_line($user, GETPOST('ligne', 'int'), GETPOST('dateend'), urldecode(GETPOST('comment')));
|
||||
if ($result > 0) {
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
@ -931,10 +933,10 @@ if (empty($reshook)) {
|
||||
}
|
||||
} elseif ($action == 'swapstatut') {
|
||||
// bascule du statut d'un contact
|
||||
$result = $object->swapContactStatus(GETPOST('ligne'));
|
||||
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
|
||||
} elseif ($action == 'deletecontact') {
|
||||
// Efface un contact
|
||||
$result = $object->delete_contact(GETPOST('lineid'));
|
||||
$result = $object->delete_contact(GETPOST('lineid', 'int'));
|
||||
|
||||
if ($result >= 0) {
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
@ -1747,25 +1749,25 @@ if ($action == 'create') {
|
||||
'text' => $langs->trans("ConfirmMoveToAnotherContractQuestion"),
|
||||
array('type' => 'select', 'name' => 'newcid', 'values' => $arraycontractid));
|
||||
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid'), $langs->trans("MoveToAnotherContract"), $langs->trans("ConfirmMoveToAnotherContract"), "confirm_move", $formquestion);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid', 'int'), $langs->trans("MoveToAnotherContract"), $langs->trans("ConfirmMoveToAnotherContract"), "confirm_move", $formquestion);
|
||||
print '<table class="notopnoleftnoright" width="100%"><tr class="oddeven" height="6"><td></td></tr></table>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la validation activation
|
||||
*/
|
||||
if ($action == 'active' && !$_REQUEST["cancel"] && $user->rights->contrat->activer && $object->lines[$cursorline - 1]->id == GETPOST('ligne')) {
|
||||
if ($action == 'active' && !$cancel && $user->rights->contrat->activer && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
|
||||
$dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
$dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
|
||||
$comment = GETPOST('comment', 'alpha');
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("ActivateService"), $langs->trans("ConfirmActivateService", dol_print_date($dateactstart, "%A %d %B %Y")), "confirm_active", '', 0, 1);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne', 'int')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("ActivateService"), $langs->trans("ConfirmActivateService", dol_print_date($dateactstart, "%A %d %B %Y")), "confirm_active", '', 0, 1);
|
||||
print '<table class="notopnoleftnoright" width="100%"><tr class="oddeven" height="6"><td></td></tr></table>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la validation fermeture
|
||||
*/
|
||||
if ($action == 'closeline' && !$_REQUEST["cancel"] && $user->rights->contrat->activer && $object->lines[$cursorline - 1]->id == GETPOST('ligne')) {
|
||||
if ($action == 'closeline' && !$cancel && $user->rights->contrat->activer && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
|
||||
$dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
$dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
|
||||
$comment = GETPOST('comment', 'alpha');
|
||||
@ -1843,8 +1845,8 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
// Form to activate line
|
||||
if ($user->rights->contrat->activer && $action == 'activateline' && $object->lines[$cursorline - 1]->id == GETPOST('ligne')) {
|
||||
print '<form name="active" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&ligne='.GETPOST('ligne').'&action=active" method="post">';
|
||||
if ($user->rights->contrat->activer && $action == 'activateline' && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
|
||||
print '<form name="active" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&ligne='.GETPOST('ligne', 'int').'&action=active" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
print '<table class="noborder tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').'" width="100%">';
|
||||
@ -1893,7 +1895,7 @@ if ($action == 'create') {
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
if ($user->rights->contrat->activer && $action == 'unactivateline' && $object->lines[$cursorline - 1]->id == GETPOST('ligne')) {
|
||||
if ($user->rights->contrat->activer && $action == 'unactivateline' && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
|
||||
/**
|
||||
* Disable a contract line
|
||||
*/
|
||||
|
||||
@ -85,7 +85,7 @@ if ($action == 'addcontact' && $user->rights->contrat->creer) {
|
||||
// bascule du statut d'un contact
|
||||
if ($action == 'swapstatut' && $user->rights->contrat->creer) {
|
||||
if ($object->fetch($id)) {
|
||||
$result = $object->swapContactStatus(GETPOST('ligne'));
|
||||
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
|
||||
} else {
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
@ -94,7 +94,7 @@ if ($action == 'swapstatut' && $user->rights->contrat->creer) {
|
||||
// Delete contact
|
||||
if ($action == 'deletecontact' && $user->rights->contrat->creer) {
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($_GET["lineid"]);
|
||||
$result = $object->delete_contact(GETPOST("lineid", 'int'));
|
||||
|
||||
if ($result >= 0) {
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
|
||||
@ -488,24 +488,24 @@ $moreforfilter = '';
|
||||
if ($user->rights->societe->client->voir || $socid) {
|
||||
$langs->load("commercial");
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('ThirdPartiesOfSaleRepresentative').': ';
|
||||
$moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth200');
|
||||
$tmpttile = $langs->trans('ThirdPartiesOfSaleRepresentative');
|
||||
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmpttile, 'maxwidth250');
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// If the user can view other users
|
||||
if ($user->rights->user->user->lire) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('LinkedToSpecificUsers').': ';
|
||||
$moreforfilter .= $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
|
||||
$tmpttile = $langs->trans('LinkedToSpecificUsers');
|
||||
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmpttile, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250');
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// If the user can view categories of products
|
||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('IncludingProductWithTag').': ';
|
||||
$tmpttile = $langs->trans('IncludingProductWithTag');
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
|
||||
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
|
||||
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmpttile, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
|
||||
|
||||
@ -81,7 +81,7 @@ if (((!empty($conf->product->enabled) && $user->rights->produit->lire) || (!empt
|
||||
$arrayresult['searchintoproduct'] = array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'text'=>img_picto('', 'object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
// search on lot/serial numbers
|
||||
if ( ! empty($conf->productbatch->enabled) ) {
|
||||
$arrayresult['searchintobatch'] = array('position'=>32, 'shortcut'=>'B', 'img'=>'object_plot', 'label'=>$langs->trans("SearchIntoBatch", $search_boxvalue), 'text'=>img_picto('', 'object_lot').' '.$langs->trans("SearchIntoBatch", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/stock/productlot_list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintobatch'] = array('position'=>32, 'shortcut'=>'B', 'img'=>'object_lot', 'label'=>$langs->trans("SearchIntoBatch", $search_boxvalue), 'text'=>img_picto('', 'object_lot').' '.$langs->trans("SearchIntoBatch", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/stock/productlot_list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -153,7 +153,7 @@ class box_members_last_subscriptions extends ModeleBoxes
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right" width="18"',
|
||||
'text' => price($obj->subscription),
|
||||
'text' => '<span class="amount">'.price($obj->subscription).'</span>',
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
|
||||
@ -180,11 +180,11 @@ class box_members_subscriptions_by_year extends ModeleBoxes
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => price($value),
|
||||
'text' => '<span class="amount">'.price($value).'</span>',
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => price(price2num($value / $Number[$key], 'MT')),
|
||||
'text' => '<span class="amount">'.price(price2num($value / $Number[$key], 'MT')).'</span>',
|
||||
);
|
||||
$line++;
|
||||
}
|
||||
@ -205,11 +205,11 @@ class box_members_subscriptions_by_year extends ModeleBoxes
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => price($tot),
|
||||
'text' => '<span class="amount">'.price($tot).'</span>',
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => price(price2num($numb > 0 ? ($tot / $numb) : 0, 'MT')),
|
||||
'text' => '<span class="amount">'.price(price2num($numb > 0 ? ($tot / $numb) : 0, 'MT')).'</span>',
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -1338,7 +1338,7 @@ abstract class CommonObject
|
||||
$sql = "SELECT ec.datecreate, ec.statut, ec.fk_socpeople, ec.fk_c_type_contact,";
|
||||
$sql .= " tc.code, tc.libelle";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as tc)";
|
||||
$sql .= " WHERE ec.rowid =".$rowid;
|
||||
$sql .= " WHERE ec.rowid =".((int) $rowid);
|
||||
$sql .= " AND ec.fk_c_type_contact=tc.rowid";
|
||||
$sql .= " AND tc.element = '".$this->db->escape($this->element)."'";
|
||||
|
||||
@ -3067,7 +3067,7 @@ abstract class CommonObject
|
||||
$sql .= ' AND rang = '.($rang - 1);
|
||||
if ($this->db->query($sql)) {
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET '.$fieldposition.' = '.($rang - 1);
|
||||
$sql .= ' WHERE rowid = '.$rowid;
|
||||
$sql .= ' WHERE rowid = '.((int) $rowid);
|
||||
if (!$this->db->query($sql)) {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
@ -3098,7 +3098,7 @@ abstract class CommonObject
|
||||
$sql .= ' AND rang = '.($rang + 1);
|
||||
if ($this->db->query($sql)) {
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET '.$fieldposition.' = '.($rang + 1);
|
||||
$sql .= ' WHERE rowid = '.$rowid;
|
||||
$sql .= ' WHERE rowid = '.((int) $rowid);
|
||||
if (!$this->db->query($sql)) {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
@ -1831,7 +1831,7 @@ class Form
|
||||
*
|
||||
* @param string $selected User id or user object of user preselected. If 0 or < -2, we use id of current user. If -1, keep unselected (if empty is allowed)
|
||||
* @param string $htmlname Field name in form
|
||||
* @param int $show_empty 0=list with no empty value, 1=add also an empty value into list
|
||||
* @param int|string $show_empty 0=list with no empty value, 1=add also an empty value into list
|
||||
* @param array $exclude Array list of users id to exclude
|
||||
* @param int $disabled If select list must be disabled
|
||||
* @param array|string $include Array list of users id to include. User '' for all users or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me
|
||||
@ -1931,9 +1931,9 @@ class Form
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { // MAIN_FIRSTNAME_NAME_POSITION is 0 means firstname+lastname
|
||||
$sql .= " ORDER BY u.firstname ASC";
|
||||
$sql .= " ORDER BY u.statut DESC, u.firstname ASC, u.lastname ASC";
|
||||
} else {
|
||||
$sql .= " ORDER BY u.lastname ASC";
|
||||
$sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG);
|
||||
@ -1949,7 +1949,14 @@ class Form
|
||||
// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined
|
||||
$out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
|
||||
if ($show_empty && !$multiple) {
|
||||
$out .= '<option value="-1"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'> </option>'."\n";
|
||||
$textforempty = ' ';
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
$textforempty = ' '; // If we use ajaxcombo, we need here to avoid to have an empty element that is too small.
|
||||
}
|
||||
if (!is_numeric($show_empty)) {
|
||||
$textforempty = $show_empty;
|
||||
}
|
||||
$out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
|
||||
}
|
||||
if ($show_every) {
|
||||
$out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
|
||||
@ -7334,7 +7341,7 @@ class Form
|
||||
|
||||
|
||||
/**
|
||||
* Show a multiselect dropbox from an array.
|
||||
* Show a multiselect dropbox from an array. If a saved selection of fields exists for user (into $user->conf->MAIN_SELECTEDFIELDS_contextofpage), we use this one instead of default.
|
||||
*
|
||||
* @param string $htmlname Name of HTML field
|
||||
* @param array $array Array with array of fields we could show. This array may be modified according to setup of user.
|
||||
@ -7350,8 +7357,9 @@ class Form
|
||||
return '';
|
||||
}
|
||||
|
||||
$tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved seleteced properties
|
||||
if (!empty($user->conf->$tmpvar)) {
|
||||
$tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show
|
||||
|
||||
if (!empty($user->conf->$tmpvar)) { // A list of fields was already customized for user
|
||||
$tmparray = explode(',', $user->conf->$tmpvar);
|
||||
foreach ($array as $key => $val) {
|
||||
//var_dump($key);
|
||||
@ -7362,6 +7370,12 @@ class Form
|
||||
$array[$key]['checked'] = 0;
|
||||
}
|
||||
}
|
||||
} else { // There is no list of fields already customized for user
|
||||
foreach ($array as $key => $val) {
|
||||
if ($array[$key]['checked'] < 0) {
|
||||
$array[$key]['checked'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$lis = '';
|
||||
@ -7380,7 +7394,8 @@ class Form
|
||||
$langs->load($val['langfile']);
|
||||
}
|
||||
|
||||
$lis .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.(empty($val['checked']) ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>';
|
||||
// Note: $val['checked'] <> 0 means we must show the field into the combo list
|
||||
$lis .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.((empty($val['checked']) && $val['checked'] != '-1') ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>';
|
||||
$listcheckedstring .= (empty($val['checked']) ? '' : $key.',');
|
||||
}
|
||||
}
|
||||
@ -7721,16 +7736,17 @@ class Form
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="left">';
|
||||
print '<input type="radio" name="idtolinkto" value='.$objp->rowid.'>';
|
||||
print '<input type="radio" name="idtolinkto" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">';
|
||||
print '</td>';
|
||||
print '<td class="center">'.$objp->ref.'</td>';
|
||||
print '<td class="center"><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>';
|
||||
print '<td>'.$objp->ref_client.'</td>';
|
||||
print '<td class="right">';
|
||||
if ($possiblelink['label'] == 'LinkToContract') {
|
||||
$form = new Form($this->db);
|
||||
print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' ';
|
||||
}
|
||||
print price($objp->total_ht).'</td>';
|
||||
print '<span class="amount">'.price($objp->total_ht).'</span>';
|
||||
print '</td>';
|
||||
print '<td>'.$objp->name.'</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
@ -7760,7 +7776,7 @@ class Form
|
||||
<dl class="dropdown" id="linktoobjectname">
|
||||
';
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
$linktoelem .= '<dt><a href="#linktoobjectname">'.$langs->trans("LinkTo").'...</a></dt>';
|
||||
$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>';
|
||||
}
|
||||
$linktoelem .= '<dd>
|
||||
<div class="multiselectlinkto">
|
||||
|
||||
@ -364,7 +364,7 @@ class FormAccounting extends Form
|
||||
$sql = "SELECT DISTINCT aa.account_number, aa.label, aa.labelshort, aa.rowid, aa.fk_pcg_version";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS;
|
||||
$sql .= " AND asy.rowid = ".((int) $conf->global->CHARTOFACCOUNTS);
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " AND aa.entity=".$conf->entity;
|
||||
$sql .= " ORDER BY aa.account_number";
|
||||
@ -380,7 +380,7 @@ class FormAccounting extends Form
|
||||
|
||||
$num_rows = $this->db->num_rows($resql);
|
||||
|
||||
if ($num_rows == 0) {
|
||||
if ($num_rows == 0 && (empty($conf->global->CHARTOFACCOUNTS) || $conf->global->CHARTOFACCOUNTS < 0)) {
|
||||
$langs->load("errors");
|
||||
$showempty = $langs->trans("ErrorYouMustFirstSetupYourChartOfAccount");
|
||||
} else {
|
||||
|
||||
@ -49,11 +49,13 @@ class FormCategory extends Form
|
||||
$categoryArray = $this->select_all_categories($type, "", "", 64, 0, 1);
|
||||
$categoryArray[-2] = "- ".$langs->trans('NotCategorized')." -";
|
||||
|
||||
$tmptitle = $langs->trans("Category");
|
||||
|
||||
$filter = '';
|
||||
$filter .= '<div class="divsearchfield">';
|
||||
$filter .= img_picto($langs->trans("Categories"), 'category', 'class="pictofixedwidth"');
|
||||
$filter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"');
|
||||
//$filter .= $langs->trans('Categories').": ";
|
||||
$filter .= Form::multiselectarray($htmlName, $categoryArray, $preSelected, 0, 0, "minwidth300");
|
||||
$filter .= Form::multiselectarray($htmlName, $categoryArray, $preSelected, 0, 0, "minwidth300", 0, 0, '', '', $tmptitle);
|
||||
$filter .= "</div>";
|
||||
|
||||
return $filter;
|
||||
|
||||
@ -481,7 +481,12 @@ class FormOther
|
||||
$sql_usr .= $hookmanager->resArray[1];
|
||||
}
|
||||
}
|
||||
$sql_usr .= " ORDER BY statut DESC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION.
|
||||
|
||||
if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { // MAIN_FIRSTNAME_NAME_POSITION is 0 means firstname+lastname
|
||||
$sql_usr .= " ORDER BY statut DESC, firstname ASC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION.
|
||||
} else {
|
||||
$sql_usr .= " ORDER BY statut DESC, lastname ASC, firstname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION.
|
||||
}
|
||||
//print $sql_usr;exit;
|
||||
|
||||
$resql_usr = $this->db->query($sql_usr);
|
||||
|
||||
@ -303,14 +303,17 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
|
||||
|
||||
if ($offsetforchartofaccount > 0) {
|
||||
// Replace lines
|
||||
// 'INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401, 'PCG99-ABREGE', 'CAPIT', '1234', 1400, '...', 1);'
|
||||
// 'INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401, 'PCG99-ABREGE', 'CAPIT', '1234', 1400,...'
|
||||
// with
|
||||
// 'INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401 + 200100000, 'PCG99-ABREGE','CAPIT', '1234', 1400 + 200100000, '...', 1);'
|
||||
// Note: string with 1234 instead of '1234' is also supported
|
||||
// 'INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401 + 200100000, 'PCG99-ABREGE','CAPIT', '1234', 1400 + 200100000,...'
|
||||
// Note: string with 'PCG99-ABREGE','CAPIT', 1234 instead of 'PCG99-ABREGE','CAPIT', '1234' is also supported
|
||||
$newsql = preg_replace('/VALUES\s*\(__ENTITY__, \s*(\d+)\s*,(\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'?[^\',]*\'?\s*),\s*\'?([^\',]*)\'?/ims', 'VALUES (__ENTITY__, \1 + '.$offsetforchartofaccount.', \2, \3 + '.$offsetforchartofaccount, $newsql);
|
||||
$newsql = preg_replace('/([,\s])0 \+ '.$offsetforchartofaccount.'/ims', '\1 0', $newsql);
|
||||
//var_dump($newsql);
|
||||
$arraysql[$i] = $newsql;
|
||||
|
||||
// FIXME Because we force the rowid during insert, we must also update the sequence with postgresql by running
|
||||
// SELECT dol_util_rebuild_sequences();
|
||||
}
|
||||
}
|
||||
|
||||
@ -632,16 +635,28 @@ function dolibarr_set_const($db, $name, $value, $type = 'chaine', $visible = 0,
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @return array Array of tabs to show
|
||||
* @param int $nbofactivatedmodules Number f oactivated modules
|
||||
* @param int $nboftotalmodules Nb of total modules
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function modules_prepare_head()
|
||||
function modules_prepare_head($nbofactivatedmodules, $nboftotalmodules)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $langs, $conf, $user, $form;
|
||||
|
||||
$desc = $langs->trans("ModulesDesc", '{picto}');
|
||||
$desc = str_replace('{picto}', img_picto('', 'switch_off'), $desc);
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
$mode = empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ? 'commonkanban' : 'common';
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$mode;
|
||||
$head[$h][1] = $langs->trans("AvailableModules");
|
||||
if ($nbofactivatedmodules <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only minimal initial modules enabled)
|
||||
$head[$h][1] = $form->textwithpicto($langs->trans("AvailableModules"), $desc);
|
||||
$head[$h][1] .= img_warning($langs->trans("YouMustEnableOneModule"));
|
||||
} else {
|
||||
//$head[$h][1] = $langs->trans("AvailableModules").$form->textwithpicto('<span class="badge marginleftonly">'.$nbofactivatedmodules.' / '.$nboftotalmodules.'</span>', $desc, 1, 'help', '', 1, 3);
|
||||
$head[$h][1] = $langs->trans("AvailableModules").'<span class="badge marginleftonly">'.$nbofactivatedmodules.' / '.$nboftotalmodules.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'modules';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -2243,6 +2243,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
$modulepart = 'user';
|
||||
}
|
||||
|
||||
//print 'dol_check_secure_access_document modulepart='.$modulepart.' original_file='.$original_file.' entity='.$entity;
|
||||
dol_syslog('dol_check_secure_access_document modulepart='.$modulepart.' original_file='.$original_file.' entity='.$entity);
|
||||
|
||||
// We define $accessallowed and $sqlprotectagainstexternals
|
||||
@ -2727,7 +2728,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
} elseif ($modulepart == 'export' && !empty($conf->export->dir_temp)) {
|
||||
// Wrapping for export module
|
||||
// Note that a test may not be required because we force the dir of download on the directory of the user that export
|
||||
$accessallowed = $user->rights->export->run;
|
||||
$accessallowed = $user->rights->export->lire;
|
||||
$original_file = $conf->export->dir_temp.'/'.$fuser->id.'/'.$original_file;
|
||||
} elseif ($modulepart == 'import' && !empty($conf->import->dir_temp)) {
|
||||
// Wrapping for import module
|
||||
|
||||
@ -634,8 +634,8 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
|
||||
$out = checkVal($out, $check, $filter, $options);
|
||||
}
|
||||
|
||||
// Sanitizing for special parameters. There is no reason to allow the backtopage parameter to contains an external URL.
|
||||
if ($paramname == 'backtopage' || $paramname == 'backtolist') {
|
||||
// Sanitizing for special parameters. There is no reason to allow the backtopage, backtolist or backtourl parameter to contains an external URL.
|
||||
if ($paramname == 'backtopage' || $paramname == 'backtolist' || $paramname == 'backtourl') {
|
||||
$out = str_replace('\\', '/', $out);
|
||||
$out = str_replace(array(':', ';', '@'), '', $out);
|
||||
|
||||
@ -746,12 +746,14 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options =
|
||||
case 'alpha': // No html and no ../ and "
|
||||
case 'alphanohtml': // Recommended for most scalar parameters and search parameters
|
||||
if (!is_array($out)) {
|
||||
$out = dol_string_nohtmltag($out, 0);
|
||||
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
|
||||
// '../' is dangerous because it allows dir transversals
|
||||
$out = trim($out);
|
||||
do {
|
||||
$oldstringtoclean = $out;
|
||||
// Remove html tags
|
||||
$out = dol_string_nohtmltag($out, 0);
|
||||
// Remove also other dangerous string sequences
|
||||
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
|
||||
// '../' is dangerous because it allows dir transversals
|
||||
// Note &, '&', '&'... is a simple char like '&' alone but there is no reason to accept such way to encode input data.
|
||||
$out = str_ireplace(array('&', '&', '&', '"', '"', '"', '"', '"', '/', '/', '/', '../'), '', $out);
|
||||
} while ($oldstringtoclean != $out);
|
||||
@ -760,25 +762,28 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options =
|
||||
break;
|
||||
case 'alphawithlgt': // No " and no ../ but we keep balanced < > tags with no special chars inside. Can be used for email string like "Name <email>"
|
||||
if (!is_array($out)) {
|
||||
$out = dol_html_entity_decode($out, ENT_COMPAT | ENT_HTML5, 'UTF-8');
|
||||
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
|
||||
// '../' is dangerous because it allows dir transversals
|
||||
$out = trim($out);
|
||||
do {
|
||||
$oldstringtoclean = $out;
|
||||
// Remove html tags
|
||||
$out = dol_html_entity_decode($out, ENT_COMPAT | ENT_HTML5, 'UTF-8');
|
||||
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
|
||||
// '../' is dangerous because it allows dir transversals
|
||||
// Note &, '&', '&'... is a simple char like '&' alone but there is no reason to accept such way to encode input data.
|
||||
$out = str_ireplace(array('&', '&', '&', '"', '"', '"', '"', '"', '/', '/', '/', '../'), '', $out);
|
||||
} while ($oldstringtoclean != $out);
|
||||
}
|
||||
break;
|
||||
case 'restricthtml': // Recommended for most html textarea
|
||||
$out = dol_string_onlythesehtmltags($out, 0, 1, 1);
|
||||
|
||||
// We should also exclude non expected attributes
|
||||
if (!empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)) {
|
||||
$out = dol_string_onlythesehtmlattributes($out);
|
||||
}
|
||||
do {
|
||||
$oldstringtoclean = $out;
|
||||
$out = dol_string_onlythesehtmltags($out, 0, 1, 1);
|
||||
|
||||
// We should also exclude non expected attributes
|
||||
if (!empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)) {
|
||||
$out = dol_string_onlythesehtmlattributes($out);
|
||||
}
|
||||
} while ($oldstringtoclean != $out);
|
||||
break;
|
||||
case 'custom':
|
||||
if (empty($filter)) {
|
||||
@ -3528,17 +3533,17 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
'accountancy', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'asset',
|
||||
'bank_account', 'barcode', 'bank', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'building',
|
||||
'cash-register', 'category', 'chart', 'check', 'clock', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'cron', 'cubes',
|
||||
'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'edit', 'ellipsis-h', 'email', 'eraser', 'external-link-alt', 'external-link-square-alt',
|
||||
'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'edit', 'ellipsis-h', 'email', 'eraser', 'establishment', 'external-link-alt', 'external-link-square-alt',
|
||||
'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title', 'group',
|
||||
'help', 'holiday',
|
||||
'info', 'intervention', 'inventory', 'intracommreport',
|
||||
'label', 'language', 'link', 'list', 'listlight', 'loan', 'lot', 'long-arrow-alt-right',
|
||||
'margin', 'map-marker-alt', 'member', 'meeting', 'money-bill-alt', 'movement', 'mrp', 'note', 'next',
|
||||
'object_accounting', 'object_account', 'object_accountline', 'object_action', 'object_asset', 'object_barcode', 'object_bill', 'object_billr', 'object_billa', 'object_billd', 'object_bom',
|
||||
'object_category', 'conferenceorbooth', 'object_conversation', 'object_bookmark', 'object_bug', 'object_clock', 'object_dolly', 'object_dollyrevert',
|
||||
'object_category', 'conferenceorbooth', 'object_conversation', 'object_bookmark', 'object_bug', 'object_building', 'object_clock', 'object_collab', 'object_dolly', 'object_dollyrevert',
|
||||
'object_folder', 'object_folder-open','object_generic',
|
||||
'object_list-alt', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
|
||||
'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_cron', 'object_donation', 'object_dynamicprice',
|
||||
'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_cron', 'object_donation', 'object_dynamicprice', 'object_establishment',
|
||||
'object_globe', 'object_holiday', 'object_hrm', 'object_invoice', 'object_intervention', 'object_inventory', 'object_intracommreport', 'object_label',
|
||||
'object_margin', 'object_members', 'object_money-bill-alt', 'object_multicurrency', 'object_order', 'object_payment',
|
||||
'object_lot', 'object_mrp', 'object_other',
|
||||
@ -3568,7 +3573,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
$facolor = '';
|
||||
$fasize = '';
|
||||
$fa = 'fas';
|
||||
if (in_array($pictowithouttext, array('clock', 'generic', 'minus-square', 'object_generic', 'pdf', 'plus-square', 'timespent', 'note', 'off', 'on', 'object_bookmark', 'bookmark', 'vcard'))) {
|
||||
if (in_array($pictowithouttext, array('clock', 'establishment', 'generic', 'minus-square', 'object_generic', 'pdf', 'plus-square', 'timespent', 'note', 'off', 'on', 'object_bookmark', 'bookmark', 'vcard'))) {
|
||||
$fa = 'far';
|
||||
}
|
||||
if (in_array($pictowithouttext, array('black-tie', 'github', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'stripe', 'stripe-s', 'youtube', 'google-plus-g', 'whatsapp'))) {
|
||||
@ -3584,7 +3589,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins',
|
||||
'accounting'=>'chart-line', 'category'=>'tag', 'dollyrevert'=>'dolly',
|
||||
'hrm'=>'user-tie', 'margin'=>'calculator', 'members'=>'user-friends', 'ticket'=>'ticket-alt', 'globe'=>'external-link-alt', 'lot'=>'barcode',
|
||||
'email'=>'at',
|
||||
'email'=>'at', 'establishment'=>'building',
|
||||
'edit'=>'pencil-alt', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'question-circle',
|
||||
'generic'=>'file', 'holiday'=>'umbrella-beach',
|
||||
'info'=>'info-circle', 'inventory'=>'boxes', 'intracommreport'=>'globe-europe', 'label'=>'layer-group', 'loan'=>'money-bill-alt',
|
||||
@ -8821,8 +8826,8 @@ function showDirectDownloadLink($object)
|
||||
$url = $object->getLastMainDocLink($object->element);
|
||||
|
||||
if ($url) {
|
||||
$out .= img_picto($langs->trans("PublicDownloadLinkdesc"), 'globe').' '.$langs->trans("DirectDownloadLink").'<br>';
|
||||
$out .= '<input type="text" id="directdownloadlink" class="quatrevingtpercent" value="'.$url.'">';
|
||||
$out .= img_picto($langs->trans("PublicDownloadLinkdesc"), 'globe').' <span class="opacitymedium">'.$langs->trans("DirectDownloadLink").'</span><br>';
|
||||
$out .= '<div class="urllink"><input type="text" id="directdownloadlink" class="quatrevingtpercent" value="'.$url.'"></div>';
|
||||
$out .= ajax_autoselect("directdownloadlink", 0);
|
||||
}
|
||||
return $out;
|
||||
|
||||
@ -90,20 +90,27 @@ function loan_prepare_head($object)
|
||||
/**
|
||||
* Calculate remaining loan mensuality and interests
|
||||
*
|
||||
* @param int $mens Value of this mensuality (interests include, set 0 if we don't paid interests for this mensuality)
|
||||
* @param float $capital Remaining capital for this mensuality
|
||||
* @param float $rate Loan rate
|
||||
* @param int $echance Actual loan term
|
||||
* @param int $nbterm Total number of term for this loan
|
||||
* @return array Array with remaining capital, interest, and mensuality for each remaining terms
|
||||
* @param float $mens Value of this mensuality (interests include, set 0 if we don't paid interests for this mensuality)
|
||||
* @param float $capital Remaining capital for this mensuality
|
||||
* @param float $rate Loan rate
|
||||
* @param int $numactualloadterm Actual loan term
|
||||
* @param int $nbterm Total number of term for this loan
|
||||
* @return array Array with remaining capital, interest, and mensuality for each remaining terms
|
||||
*/
|
||||
function loanCalcMonthlyPayment($mens, $capital, $rate, $echance, $nbterm)
|
||||
function loanCalcMonthlyPayment($mens, $capital, $rate, $numactualloadterm, $nbterm)
|
||||
{
|
||||
global $conf, $db;
|
||||
require_once DOL_DOCUMENT_ROOT.'/loan/class/loanschedule.class.php';
|
||||
$object = new LoanSchedule($db);
|
||||
$output = array();
|
||||
|
||||
// Sanitize data in case of
|
||||
$mens = price2num($mens);
|
||||
$capital = price2num($capital);
|
||||
$rate = price2num($rate);
|
||||
$numactualloadterm = ((int) $numactualloadterm);
|
||||
$nbterm = ((int) $nbterm);
|
||||
|
||||
// If mensuality is 0 we don't pay interests and remaining capital not modified
|
||||
if ($mens == 0) {
|
||||
$int = 0;
|
||||
@ -113,18 +120,18 @@ function loanCalcMonthlyPayment($mens, $capital, $rate, $echance, $nbterm)
|
||||
$int = round($int, 2, PHP_ROUND_HALF_UP);
|
||||
$cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP);
|
||||
}
|
||||
$output[$echance] = array('cap_rest'=>$cap_rest, 'cap_rest_str'=>price($cap_rest, 0, '', 1, -1, -1, $conf->currency), 'interet'=>$int, 'interet_str'=>price($int, 0, '', 1, -1, -1, $conf->currency), 'mens'=>$mens);
|
||||
$output[$numactualloadterm] = array('cap_rest'=>$cap_rest, 'cap_rest_str'=>price($cap_rest, 0, '', 1, -1, -1, $conf->currency), 'interet'=>$int, 'interet_str'=>price($int, 0, '', 1, -1, -1, $conf->currency), 'mens'=>$mens);
|
||||
|
||||
$echance++;
|
||||
$numactualloadterm++;
|
||||
$capital = $cap_rest;
|
||||
while ($echance <= $nbterm) {
|
||||
$mens = round($object->calcMonthlyPayments($capital, $rate, $nbterm - $echance + 1), 2, PHP_ROUND_HALF_UP);
|
||||
while ($numactualloadterm <= $nbterm) {
|
||||
$mens = round($object->calcMonthlyPayments($capital, $rate, $nbterm - $numactualloadterm + 1), 2, PHP_ROUND_HALF_UP);
|
||||
|
||||
$int = ($capital * ($rate / 12));
|
||||
$int = round($int, 2, PHP_ROUND_HALF_UP);
|
||||
$cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP);
|
||||
|
||||
$output[$echance] = array(
|
||||
$output[$numactualloadterm] = array(
|
||||
'cap_rest' => $cap_rest,
|
||||
'cap_rest_str' => price($cap_rest, 0, '', 1, -1, -1, $conf->currency),
|
||||
'interet' => $int,
|
||||
@ -133,7 +140,7 @@ function loanCalcMonthlyPayment($mens, $capital, $rate, $echance, $nbterm)
|
||||
);
|
||||
|
||||
$capital = $cap_rest;
|
||||
$echance++;
|
||||
$numactualloadterm++;
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
||||
@ -171,9 +171,9 @@ function showOnlinePaymentUrl($type, $ref)
|
||||
|
||||
$servicename = $langs->transnoentitiesnoconv('Online');
|
||||
|
||||
$out = img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).'<br>';
|
||||
$out = img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).'</span><br>';
|
||||
$url = getOnlinePaymentUrl(0, $type, $ref);
|
||||
$out .= '<input type="text" id="onlinepaymenturl" class="quatrevingtpercent" value="'.$url.'">';
|
||||
$out .= '<div class="urllink"><input type="text" id="onlinepaymenturl" class="quatrevingtpercent" value="'.$url.'"></div>';
|
||||
$out .= ajax_autoselect("onlinepaymenturl", 0);
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -2554,7 +2554,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
|
||||
$ponderated_opp_amount += price2num($opp_weighted_amount);
|
||||
}
|
||||
if ($objp->opp_amount) {
|
||||
print '<span title="'.$alttext.'">'.price($objp->opp_amount, 0, '', 1, -1, 0, $conf->currency).'</span>';
|
||||
print '<span class="amount" title="'.$alttext.'">'.price($objp->opp_amount, 0, '', 1, -1, 0, $conf->currency).'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -33,9 +33,15 @@ function showOnlineSignatureUrl($type, $ref)
|
||||
|
||||
$servicename = 'Online';
|
||||
|
||||
$out = img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlineSignature", $servicename).'<br>';
|
||||
$out = img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlineSignature", $servicename).'</span><br>';
|
||||
$url = getOnlineSignatureUrl(0, $type, $ref);
|
||||
$out .= '<input type="text" id="onlinesignatureurl" class="quatrevingtpercent" value="'.$url.'">';
|
||||
$out .= '<div class="urllink">';
|
||||
if ($url == $langs->trans("FeatureOnlineSignDisabled")) {
|
||||
$out .= $url;
|
||||
} else {
|
||||
$out .= '<input type="text" id="onlinesignatureurl" class="quatrevingtpercent" value="'.$url.'">';
|
||||
}
|
||||
$out .= '</div>';
|
||||
$out .= ajax_autoselect("onlinesignatureurl", 0);
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -78,14 +78,14 @@ class modExport extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 1201;
|
||||
$this->rights[$r][1] = 'Lire les exports';
|
||||
$this->rights[$r][1] = 'Read exports';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'lire';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 1202;
|
||||
$this->rights[$r][1] = 'Creer/modifier un export';
|
||||
$this->rights[$r][1] = 'Creeate/modify export';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'creer';
|
||||
|
||||
@ -277,7 +277,7 @@ class modService extends DolibarrModules
|
||||
$r++;
|
||||
$this->export_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->export_label[$r] = "ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r] = array(array("produit", "export"));
|
||||
$this->export_permission[$r] = array(array("service", "export"));
|
||||
$this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref",
|
||||
'pr.price_base_type'=>"PriceBase", 'pr.price_level'=>"PriceLevel",
|
||||
'pr.price'=>"PriceLevelUnitPriceHT", 'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
|
||||
@ -311,7 +311,7 @@ class modService extends DolibarrModules
|
||||
$r++;
|
||||
$this->export_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->export_label[$r] = "ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r] = array(array("produit", "export"));
|
||||
$this->export_permission[$r] = array(array("service", "export"));
|
||||
$this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref",
|
||||
's.nom'=>'ThirdParty',
|
||||
'pr.price_base_type'=>"PriceBase",
|
||||
@ -344,7 +344,7 @@ class modService extends DolibarrModules
|
||||
$r++;
|
||||
$this->export_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->export_label[$r] = "AssociatedProducts"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r] = array(array("produit", "export"));
|
||||
$this->export_permission[$r] = array(array("service", "export"));
|
||||
$this->export_fields_array[$r] = array(
|
||||
'p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label", 'p.description'=>"Description", 'p.url'=>"PublicUrl",
|
||||
'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
|
||||
|
||||
@ -292,7 +292,7 @@ if ($resql) {
|
||||
}
|
||||
print "</td>\n";
|
||||
}
|
||||
print '<td class="right">'.price($objp->amount).'</td>';
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
|
||||
print '<td class="right">'.$donationstatic->LibStatut($objp->status, 5).'</td>';
|
||||
print '<td></td>';
|
||||
print "</tr>";
|
||||
|
||||
@ -110,7 +110,7 @@ if ($action == 'addcontact' && $permission) { // Add a new contact
|
||||
}
|
||||
} elseif ($action == 'swapstatut' && $permission) {
|
||||
// Toggle the status of a contact
|
||||
$result = $object->swapContactStatus(GETPOST('ligne'));
|
||||
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
|
||||
} elseif ($action == 'deletecontact' && $permission) {
|
||||
// Deletes a contact
|
||||
$result = $object->delete_contact($lineid);
|
||||
|
||||
@ -2682,7 +2682,7 @@ class ExpeditionLigne extends CommonObjectLine
|
||||
{
|
||||
$sql = 'SELECT ed.rowid, ed.fk_expedition, ed.fk_entrepot, ed.fk_origin_line, ed.qty, ed.rang';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as ed';
|
||||
$sql .= ' WHERE ed.rowid = '.$rowid;
|
||||
$sql .= ' WHERE ed.rowid = '.((int) $rowid);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
@ -96,7 +96,7 @@ if ($action == 'addcontact' && $user->rights->expedition->creer) {
|
||||
}
|
||||
} elseif ($action == 'swapstatut' && $user->rights->expedition->creer) {
|
||||
// bascule du statut d'un contact
|
||||
$result = $objectsrc->swapContactStatus(GETPOST('ligne'));
|
||||
$result = $objectsrc->swapContactStatus(GETPOST('ligne', 'int'));
|
||||
} elseif ($action == 'deletecontact' && $user->rights->expedition->creer) {
|
||||
// Efface un contact
|
||||
$result = $objectsrc->delete_contact(GETPOST("lineid"));
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user