Merge remote-tracking branch 'Dolibarr/develop' into 14

This commit is contained in:
Francis Appels 2021-06-10 16:23:39 +02:00
commit 87783cbf7a
328 changed files with 1869 additions and 2726 deletions

View File

@ -13,7 +13,7 @@ You can freely use, study, modify or distribute it according to its licence.
You can use it as a standalone application or as a web application to access it from the Internet or a LAN.
Dolibarr has a large community ready to help you, free forums and [officially preferred partners ready to offer commercial support should you need it](https://partners.dolibarr.org)
Dolibarr has a large community ready to help you, free forums and [preferred partners ready to offer commercial support should you need it](https://partners.dolibarr.org)
![ScreenShot](https://www.dolibarr.org/medias/dolibarr_screenshot1_1920x1080.jpg)
@ -97,41 +97,68 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
### Main application/modules (all optional)
- Customers, Prospects (Leads) and/or Suppliers directory + Contacts
- Members/Membership management
- Products and/or Services catalog
- Commercial proposals management
- Customer & Supplier Orders management
- Invoices and payment management
- Shipping management
- Warehouse/Stock management/Inventory
- Manufacturing Orders
- Bank accounts management
- Direct debit orders management (European SEPA)
- Accounting management
- Shared calendar/agenda (with ical and vcal export for third party tools integration)
- Opportunities or Leads management
- Projects & Tasks management
- Ticket System
- Contracts management
- Interventions management
- Employee's leave requests management
- Expense reports
- Recruitment management
- Timesheets
- Electronic Document Management (EDM)
- Foundations members management
- Point of Sale (POS)
- … (around 100 modules available by default, + 1000 on the addon market place)
- Third-Parties Management: Customers, Prospects (Leads) and/or Suppliers + Contacts
- Members/Membership/Foundation management
Product Management
- Products and/or Services catalog
- Stock / Warehouse management + Inventory
- Barcodes
- Batches / Lots / Serials
- Product Variants
- Bill of Materials
- Manufacturing Orders
Customer/Sales Management
- Customers/Prospects + Contacts management
- Opportunities or Leads management
- Commercial proposals management
- Customer Orders management
- Contracts/Subscription management
- Interventions management
- Ticket System
- Shipping management
- Customer Invoices/Credit notes and payment management
- Point of Sale (POS)
Supplier/Purchase Management
- Suppliers/Vendors + Contacts
- Supplier (price) requests
- Purchase Order management
- Delivery/Receiption
- Supplier Invoices/credit notes and payment management
Finance / Accounting
- Invoices / Payments
- Bank accounts management
- Direct debit orders management (European SEPA)
- Accounting management
- Donations management
- Loan management
- Margins
- Reports
- Shared calendar/agenda (with ical and vcal export for third party tools integration)
- Projects & Tasks management
- Ticket System
- Employee's leave requests management
- Expense reports
- Recruitment management
- Timesheets
- (around 100 modules available by default, 1000+ on the addon market place)
### Other application/modules
- Electronic Document Management (EDM)
- Bookmarks management
- Donations management
- Reporting
- Surveys
- Data export/import
- Barcodes support
- Barcodes
- Margin calculations
- LDAP connectivity
- ClickToDial integration
@ -139,7 +166,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- RSS integration
- Skype integration
- Payment platforms integration (PayPal, Stripe, Paybox...)
-
-
### Other general features

View File

@ -6,7 +6,7 @@ const createThirdparty = async (z, bundle) => {
const response = await z.request({
method: 'POST',
url: apiurl,
body: JSON.stringify({
body: {
name: bundle.inputData.name,
name_alias: bundle.inputData.name_alias,
ref_ext: bundle.inputData.ref_ext,
@ -24,7 +24,7 @@ const createThirdparty = async (z, bundle) => {
code_client: bundle.inputData.code_client,
code_fournisseur: bundle.inputData.code_fournisseur,
sens: 'fromzapier'
})
}
});
const result = z.JSON.parse(response.content);
// api returns an integer when ok, a json when ko

View File

@ -15,7 +15,7 @@
"npm": ">=5.6.0"
},
"dependencies": {
"zapier-platform-core": "11.0.0"
"zapier-platform-core": "11.0.1"
},
"devDependencies": {
"mocha": "^5.2.0",

View File

@ -56,6 +56,12 @@ const getThirdparty = (z, bundle) => {
fournisseur: bundle.cleanedRequest.fournisseur,
code_client: bundle.cleanedRequest.code_client,
code_fournisseur: bundle.cleanedRequest.code_fournisseur,
idprof1: bundle.cleanedRequest.idprof1,
idprof2: bundle.cleanedRequest.idprof2,
idprof3: bundle.cleanedRequest.idprof3,
idprof4: bundle.cleanedRequest.idprof4,
idprof5: bundle.cleanedRequest.idprof5,
idprof6: bundle.cleanedRequest.idprof6,
authorId: bundle.cleanedRequest.authorId,
createdAt: bundle.cleanedRequest.createdAt,
action: bundle.cleanedRequest.action
@ -170,7 +176,13 @@ module.exports = {
{key: 'client', label: 'Customer/Prospect 0/1/2/3'},
{key: 'fournisseur', label: 'Supplier 0/1'},
{key: 'code_client', label: 'Customer code'},
{key: 'code_fournisseur', label: 'Supplier code'}
{key: 'code_fournisseur', label: 'Supplier code'},
{key: 'idprof1', label: 'Id Prof 1'},
{key: 'idprof2', label: 'Id Prof 2'},
{key: 'idprof3', label: 'Id Prof 3'},
{key: 'idprof4', label: 'Id Prof 4'},
{key: 'idprof5', label: 'Id Prof 5'},
{key: 'idprof6', label: 'Id Prof 6'}
]
}
};

View File

@ -444,7 +444,7 @@ if ($search_country_id > 0) {
} else {
$sql .= " WHERE ";
}
$sql .= " (a.fk_country = ".$search_country_id." OR a.fk_country = 0)";
$sql .= " (a.fk_country = ".((int) $search_country_id)." OR a.fk_country = 0)";
}
// If sort order is "country", we use country_code instead

View File

@ -675,7 +675,7 @@ class AccountancyCategory // extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
$sql .= " WHERE c.active = 1";
$sql .= " AND c.entity = ".$conf->entity;
$sql .= " AND (c.fk_country = ".$mysoc->country_id." OR c.fk_country = 0)";
$sql .= " AND (c.fk_country = ".((int) $mysoc->country_id)." OR c.fk_country = 0)";
$sql .= " AND cat.rowid = t.fk_accounting_category";
$sql .= " AND t.entity = ".$conf->entity;
$sql .= " ORDER BY cat.position ASC";
@ -806,7 +806,7 @@ class AccountancyCategory // extends CommonObject
if ($categorytype >= 0) {
$sql .= " AND c.category_type = 1";
}
$sql .= " AND (c.fk_country = ".$mysoc->country_id." OR c.fk_country = 0)";
$sql .= " AND (c.fk_country = ".((int) $mysoc->country_id)." OR c.fk_country = 0)";
$sql .= " ORDER BY c.position ASC";
$resql = $this->db->query($sql);

View File

@ -602,7 +602,7 @@ class AccountingAccount extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account ";
$sql .= "SET ".$fieldtouse." = '0'";
$sql .= " WHERE rowid = ".$this->db->escape($id);
$sql .= " WHERE rowid = ".((int) $id);
dol_syslog(get_class($this)."::accountDeactivate ".$fieldtouse." sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql);
@ -640,7 +640,7 @@ class AccountingAccount extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account";
$sql .= " SET ".$fieldtouse." = '1'";
$sql .= " WHERE rowid = ".$this->db->escape($id);
$sql .= " WHERE rowid = ".((int) $id);
dol_syslog(get_class($this)."::account_activate ".$fieldtouse." sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql);

View File

@ -294,7 +294,7 @@ class BookKeeping extends CommonObject
$sql = "SELECT count(*) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " WHERE doc_type = '".$this->db->escape($this->doc_type)."'";
$sql .= " AND fk_doc = ".$this->fk_doc;
$sql .= " AND fk_doc = ".((int) $this->fk_doc);
if (!empty($conf->global->ACCOUNTANCY_ENABLE_FKDOCDET)) {
// DO NOT USE THIS IN PRODUCTION. This will generate a lot of trouble into reports and will corrupt database (by generating duplicate entries.
$sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 if record is for several lines
@ -312,7 +312,7 @@ class BookKeeping extends CommonObject
$sqlnum = "SELECT piece_num";
$sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sqlnum .= " WHERE doc_type = '".$this->db->escape($this->doc_type)."'"; // For example doc_type = 'bank'
$sqlnum .= " AND fk_doc = ".$this->fk_doc;
$sqlnum .= " AND fk_doc = ".((int) $this->fk_doc);
if (!empty($conf->global->ACCOUNTANCY_ENABLE_FKDOCDET)) {
// fk_docdet is rowid into llx_bank or llx_facturedet or llx_facturefourndet, or ...
$sqlnum .= " AND fk_docdet = ".((int) $this->fk_docdet);

View File

@ -1320,7 +1320,7 @@ function getSourceDocRef($val, $typerecord)
if ($typerecord == 'payment') {
$sqlmid = 'SELECT payfac.fk_facture as id, f.ref as ref';
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f";
$sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=".$val["paymentid"];
$sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=".((int) $val["paymentid"]);
$ref = $langs->transnoentitiesnoconv("Invoice");
} elseif ($typerecord == 'payment_supplier') {
$sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref';

View File

@ -260,9 +260,9 @@ class Adherent extends CommonObject
public $datefin;
// From member table
// Fields loaded by fetch_subscriptions()
// Fields loaded by fetch_subscriptions() from member table
public $first_subscription_date;
public $first_subscription_amount;
@ -277,6 +277,12 @@ class Adherent extends CommonObject
public $subscriptions = array();
// Fields loaded by fetchPartnerships() from partnership table
public $partnerships = array();
/**
* @var Adherent To contains a clone of this when we need to save old properties of object
*/
@ -296,15 +302,15 @@ class Adherent extends CommonObject
'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1),
'ref_ext' => array('type' => 'varchar(128)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 0, 'position' => 20),
'civility' => array('type' => 'varchar(6)', 'label' => 'Civility', 'enabled' => 1, 'visible' => -1, 'position' => 25),
'lastname' => array('type' => 'varchar(50)', 'label' => 'Lastname', 'enabled' => 1, 'visible' => -1, 'position' => 30),
'firstname' => array('type' => 'varchar(50)', 'label' => 'Firstname', 'enabled' => 1, 'visible' => -1, 'position' => 35),
'lastname' => array('type' => 'varchar(50)', 'label' => 'Lastname', 'enabled' => 1, 'visible' => -1, 'position' => 30, 'showoncombobox'=>1),
'firstname' => array('type' => 'varchar(50)', 'label' => 'Firstname', 'enabled' => 1, 'visible' => -1, 'position' => 35, 'showoncombobox'=>1),
'login' => array('type' => 'varchar(50)', 'label' => 'Login', 'enabled' => 1, 'visible' => -1, 'position' => 40),
'gender' => array('type' => 'varchar(10)', 'label' => 'Gender', 'enabled' => 1, 'visible' => -1, 'position' => 250),
'pass' => array('type' => 'varchar(50)', 'label' => 'Pass', 'enabled' => 1, 'visible' => -1, 'position' => 45),
'pass_crypted' => array('type' => 'varchar(128)', 'label' => 'Pass crypted', 'enabled' => 1, 'visible' => -1, 'position' => 50),
'fk_adherent_type' => array('type' => 'integer', 'label' => 'Fk adherent type', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 55),
'morphy' => array('type' => 'varchar(3)', 'label' => 'MorPhy', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 60),
'societe' => array('type' => 'varchar(128)', 'label' => 'Societe', 'enabled' => 1, 'visible' => -1, 'position' => 65),
'societe' => array('type' => 'varchar(128)', 'label' => 'Societe', 'enabled' => 1, 'visible' => -1, 'position' => 65, 'showoncombobox'=>2),
'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'enabled' => 1, 'visible' => -1, 'position' => 70),
'address' => array('type' => 'text', 'label' => 'Address', 'enabled' => 1, 'visible' => -1, 'position' => 75),
'zip' => array('type' => 'varchar(10)', 'label' => 'Zip', 'enabled' => 1, 'visible' => -1, 'position' => 80),
@ -592,8 +598,8 @@ class Adherent extends CommonObject
if ($this->user_id) {
// Add link to user
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET";
$sql .= " fk_member = ".$this->id;
$sql .= " WHERE rowid = ".$this->user_id;
$sql .= " fk_member = ".((int) $this->id);
$sql .= " WHERE rowid = ".((int) $this->user_id);
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
@ -722,7 +728,7 @@ class Adherent extends CommonObject
if (!empty($this->oldcopy) && $this->typeid != $this->oldcopy->typeid) {
$sql2 = "SELECT libelle as label";
$sql2 .= " FROM ".MAIN_DB_PREFIX."adherent_type";
$sql2 .= " WHERE rowid = ".$this->typeid;
$sql2 .= " WHERE rowid = ".((int) $this->typeid);
$resql2 = $this->db->query($sql2);
if ($resql2) {
while ($obj = $this->db->fetch_object($resql2)) {
@ -1439,11 +1445,12 @@ class Adherent extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to get member subscriptions data
* first_subscription_date, first_subscription_date_start, first_subscription_date_end, first_subscription_amount
* last_subscription_date, last_subscription_date_start, last_subscription_date_end, last_subscription_amount
* Function to get member subscriptions data:
* subscriptions,
* first_subscription_date, first_subscription_date_start, first_subscription_date_end, first_subscription_amount
* last_subscription_date, last_subscription_date_start, last_subscription_date_end, last_subscription_amount
*
* @return int <0 si KO, >0 si OK
* @return int <0 if KO, >0 if OK
*/
public function fetch_subscriptions()
{
@ -1503,6 +1510,25 @@ class Adherent extends CommonObject
}
/**
* Function to get partnerships array
*
* @param string $mode 'member' or 'thirdparty'
* @return int <0 if KO, >0 if OK
*/
public function fetchPartnerships($mode)
{
global $langs;
require_once DOL_DOCUMENT_ROOT.'/parntership/class/partnership.class.php';
$this->partnerships[] = array();
return 1;
}
/**
* Insert subscription into database and eventually add links to banks, mailman, etc...
*
@ -1712,7 +1738,8 @@ class Adherent extends CommonObject
}
}
$invoice->socid = $this->fk_soc;
$invoice->date = $datesubscription;
//$invoice->date = $datesubscription;
$invoice->date = dol_now();
// Possibility to add external linked objects with hooks
$invoice->linked_objects['subscription'] = $subscriptionid;

View File

@ -362,7 +362,7 @@ class AdherentType extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type ";
$sql .= "SET ";
$sql .= "statut = ".$this->status.",";
$sql .= "statut = ".((int) $this->status).",";
$sql .= "libelle = '".$this->db->escape($this->label)."',";
$sql .= "morphy = '".$this->db->escape($this->morphy)."',";
$sql .= "subscription = '".$this->db->escape($this->subscription)."',";

View File

@ -228,12 +228,12 @@ class Members extends DolibarrApi
}
$sql .= ' WHERE t.entity IN ('.getEntity('adherent').')';
if (!empty($typeid)) {
$sql .= ' AND t.fk_adherent_type='.$typeid;
$sql .= ' AND t.fk_adherent_type='.((int) $typeid);
}
// Select members of given category
if ($category > 0) {
$sql .= " AND c.fk_categorie = ".$this->db->escape($category);
$sql .= " AND c.fk_member = t.rowid ";
$sql .= " AND c.fk_categorie = ".((int) $category);
$sql .= " AND c.fk_member = t.rowid";
}
// Add sql filters
if ($sqlfilters) {

View File

@ -267,14 +267,14 @@ class Subscription extends CommonObject
}
$sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET ";
$sql .= " fk_type = ".$this->fk_type.",";
$sql .= " fk_adherent = ".$this->fk_adherent.",";
$sql .= " fk_type = ".((int) $this->fk_type).",";
$sql .= " fk_adherent = ".((int) $this->fk_adherent).",";
$sql .= " note=".($this->note ? "'".$this->db->escape($this->note)."'" : 'null').",";
$sql .= " subscription = ".price2num($this->amount).",";
$sql .= " dateadh='".$this->db->idate($this->dateh)."',";
$sql .= " datef='".$this->db->idate($this->datef)."',";
$sql .= " datec='".$this->db->idate($this->datec)."',";
$sql .= " fk_bank = ".($this->fk_bank ? $this->fk_bank : 'null');
$sql .= " fk_bank = ".($this->fk_bank ? ((int) $this->fk_bank) : 'null');
$sql .= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::update", LOG_DEBUG);
@ -341,7 +341,7 @@ class Subscription extends CommonObject
}
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".$this->id;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {

View File

@ -182,7 +182,7 @@ if ($id > 0) {
print dol_get_fiche_end();
$modulepart = 'member';
$permission = $user->rights->adherent->creer;
$permissiontoadd = $user->rights->adherent->creer;
$permtoedit = $user->rights->adherent->creer;
$param = '&id='.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';

View File

@ -44,50 +44,20 @@
//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
// Load Dolibarr environment
$res = 0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
}
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
$i--; $j--;
}
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
}
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
}
// Try main.inc.php using relative path
if (!$res && file_exists("../main.inc.php")) {
$res = @include "../main.inc.php";
}
if (!$res && file_exists("../../main.inc.php")) {
$res = @include "../../main.inc.php";
}
if (!$res && file_exists("../../../main.inc.php")) {
$res = @include "../../../main.inc.php";
}
if (!$res) {
die("Include of main fails");
}
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
dol_include_once('/partnership/class/partnership.class.php');
dol_include_once('/partnership/lib/partnership.lib.php');
require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("companies","members","partnership", "other"));
// Get parameters
$id = GETPOST('id', 'int');
$memberid = GETPOST('rowid', 'int');
$id = GETPOST('rowid', 'int') ? GETPOST('rowid', 'int') : GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
@ -97,9 +67,9 @@ $backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
//$lineid = GETPOST('lineid', 'int');
$member = new Adherent($db);
if ($memberid > 0) {
$member->fetch($memberid);
$object = new Adherent($db);
if ($id > 0) {
$object->fetch($id);
}
// Initialize technical objects
@ -141,15 +111,15 @@ if (empty($conf->partnership->enabled)) accessforbidden();
if (empty($permissiontoread)) accessforbidden();
if ($action == 'edit' && empty($permissiontoadd)) accessforbidden();
$partnershipid = $object->fetch(0, "", $memberid);
if (empty($action) && empty($partnershipid)) {
$action = 'create';
if (($action == 'update' || $action == 'edit') && $object->status != $object::STATUS_DRAFT) {
accessforbidden();
}
if (($action == 'update' || $action == 'edit') && $object->status != $object::STATUS_DRAFT) accessforbidden();
if (empty($memberid) && $object) {
$memberid = $object->fk_member;
}
// Security check
$result = restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', 0);
/*
* Actions
*/
@ -166,102 +136,7 @@ $date_end = dol_mktime(0, 0, 0, GETPOST('date_partnership_endmonth', 'int'), GET
if (empty($reshook)) {
$error = 0;
$backtopage = dol_buildpath('/partnership/partnership.php', 1).'?rowid='.($memberid > 0 ? $memberid : '__ID__');
$triggermodname = 'PARTNERSHIP_MODIFY'; // Name of trigger action code to execute when we modify record
if ($action == 'add' && $permissiontoread) {
$error = 0;
$db->begin();
$now = dol_now();
if (!$error) {
$old_start_date = $object->date_partnership_start;
$object->fk_member = $memberid;
$object->date_partnership_start = (!GETPOST('date_partnership_start')) ? '' : $date_start;
$object->date_partnership_end = (!GETPOST('date_partnership_end')) ? '' : $date_end;
$object->note_public = GETPOST('note_public', 'restricthtml');
$object->date_creation = $now;
$object->fk_user_creat = $user->id;
$object->entity = $conf->entity;
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) {
$error++;
}
}
if (!$error) {
$result = $object->create($user);
if ($result < 0) {
$error++;
if ($result == -4) {
setEventMessages($langs->trans("ErrorRefAlreadyExists"), null, 'errors');
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
if ($error) {
$db->rollback();
$action = 'create';
} else {
$db->commit();
}
} elseif ($action == 'update' && $permissiontoread) {
$error = 0;
$db->begin();
$now = dol_now();
if (!$error) {
$object->oldcopy = clone $object;
$old_start_date = $object->date_partnership_start;
$object->date_partnership_start = (!GETPOST('date_partnership_start')) ? '' : $date_start;
$object->date_partnership_end = (!GETPOST('date_partnership_end')) ? '' : $date_end;
$object->note_public = GETPOST('note_public', 'restricthtml');
$object->fk_user_creat = $user->id;
$object->fk_user_modif = $user->id;
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) {
$error++;
}
}
if (!$error) {
$result = $object->update($user);
if ($result < 0) {
$error++;
if ($result == -4) {
setEventMessages($langs->trans("ErrorRefAlreadyExists"), null, 'errors');
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
if ($error) {
$db->rollback();
$action = 'edit';
} else {
$db->commit();
}
} elseif ($action == 'confirm_close' || $action == 'update_extras') {
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
header("Location: ".$_SERVER['PHP_SELF']."?rowid=".$memberid);
exit;
}
$backtopage = dol_buildpath('/partnership/partnership.php', 1).'?rowid='.($id > 0 ? $id : '__ID__');
// Actions when linking object each other
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
@ -271,10 +146,9 @@ $object->fields['fk_member']['visible'] = 0;
if ($object->id > 0 && $object->status == $object::STATUS_REFUSED && empty($action)) $object->fields['reason_decline_or_cancel']['visible'] = 1;
$object->fields['note_public']['visible'] = 1;
/*
* View
*
* Put here all code to build page
*/
$form = new Form($db);
@ -285,11 +159,11 @@ llxHeader('', $title);
$form = new Form($db);
if ($memberid) {
if ($id > 0) {
$langs->load("members");
$member = new Adherent($db);
$result = $member->fetch($memberid);
$object = new Adherent($db);
$result = $object->fetch($id);
if (!empty($conf->notification->enabled)) {
$langs->load("mails");
@ -297,13 +171,13 @@ if ($memberid) {
$adht->fetch($object->typeid);
$head = member_prepare_head($member);
$head = member_prepare_head($object);
print dol_get_fiche_head($head, 'partnership', $langs->trans("ThirdParty"), -1, 'user');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($member, 'rowid', $linkback);
dol_banner_tab($object, 'rowid', $linkback);
print '<div class="fichecenter">';
@ -312,21 +186,21 @@ if ($memberid) {
// Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$member->login.'&nbsp;</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
}
// Type
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
// Morphy
print '<tr><td>'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$member->getmorphylib().'</td>';
print '<tr><td>'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
print '</tr>';
// Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$member->company.'</td></tr>';
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>';
// Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$member->getCivilityLabel().'&nbsp;</td>';
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';
print '</tr>';
print '</table>';
@ -334,194 +208,13 @@ if ($memberid) {
print '</div>';
print dol_get_fiche_end();
$params = '';
print '<br>';
} else {
dol_print_error('', 'Parameter rowid not defined');
}
// Part to create
if ($action == 'create') {
print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Partnership")), '', '');
$backtopageforcancel = DOL_URL_ROOT.'/partnership/partnership.php?rowid='.$memberid;
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="rowid" value="'.$memberid.'">';
print '<input type="hidden" name="fk_member" value="'.$memberid.'">';
if ($backtopage) {
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
}
if ($backtopageforcancel) {
print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
}
print dol_get_fiche_head(array(), '');
print '<table class="border centpercent tableforfieldcreate">'."\n";
// Common attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
print '</table>'."\n";
print dol_get_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Validate")).'">';
print '&nbsp; ';
// print '<input type="'.($backtopage ? "submit" : "button").'" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage ? '' : ' onclick="javascript:history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage
print '</div>';
print '</form>';
}
// Part to edit record
if (($partnershipid || $ref) && $action == 'edit') {
print load_fiche_titre($langs->trans("Partnership"), '', '');
$backtopageforcancel = DOL_URL_ROOT.'/partnership/partnership.php?rowid='.$memberid;
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="rowid" value="'.$memberid.'">';
print '<input type="hidden" name="fk_member" value="'.$memberid.'">';
if ($backtopage) {
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
}
if ($backtopageforcancel) {
print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
}
print dol_get_fiche_head();
print '<table class="border centpercent tableforfieldedit">'."\n";
// Common attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
print '</table>';
print dol_get_fiche_end();
print '<div class="center"><input type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'">';
print ' &nbsp; <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>';
}
// Part to show record
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
print load_fiche_titre($langs->trans("PartnershipDedicatedToThisMember", $langs->transnoentitiesnoconv("Partnership")), '', '');
$res = $object->fetch_optionals();
// $head = partnershipPrepareHead($object);
// print dol_get_fiche_head($head, 'card', $langs->trans("Partnership"), -1, $object->picto);
$linkback = '';
dol_banner_tab($object, 'id', $linkback, 0, 'rowid', 'ref');
$formconfirm = '';
// Close confirmation
if ($action == 'close') {
// Create an array for form
$formquestion = array();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClose'), $langs->trans('ConfirmClosePartnershipAsk', $object->ref), 'confirm_close', $formquestion, 'yes', 1);
}
// Reopon confirmation
if ($action == 'reopen') {
// Create an array for form
$formquestion = array();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToReopon'), $langs->trans('ConfirmReoponAsk', $object->ref), 'confirm_reopen', $formquestion, 'yes', 1);
}
// Refuse confirmatio
if ($action == 'refuse') {
//Form to close proposal (signed or not)
$formquestion = array(
array('type' => 'text', 'name' => 'reason_decline_or_cancel', 'label' => $langs->trans("Note"), 'morecss' => 'reason_decline_or_cancel', 'value' => '') // Field to complete private note (not replace)
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReasonDecline'), $text, 'confirm_refuse', $formquestion, '', 1, 250);
}
// Call Hook formConfirm
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$formconfirm .= $hookmanager->resPrint;
} elseif ($reshook > 0) {
$formconfirm = $hookmanager->resPrint;
}
// Print form confirm
print $formconfirm;
// Object card
// ------------------------------------------------------------
$linkback = '<a href="'.dol_buildpath('/partnership/partnership_list.php', 1).'?restore_lastsearch_values=1'.(!empty($memberid) ? '&rowid='.$memberid : '').'">'.$langs->trans("BackToList").'</a>';
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">'."\n";
// Common attributes
//$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field
//unset($object->fields['fk_project']); // Hide field already shown in banner
//unset($object->fields['fk_member']); // Hide field already shown in banner
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
// End of subscription date
$fadherent = new Adherent($db);
$fadherent->fetch($object->fk_member);
print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';
if ($fadherent->datefin) {
print dol_print_date($fadherent->datefin, 'day');
if ($fadherent->hasDelay()) {
print " ".img_warning($langs->trans("Late"));
}
} else {
if (!$adht->subscription) {
print $langs->trans("SubscriptionNotRecorded");
if ($fadherent->statut > 0) {
print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
}
} else {
print $langs->trans("SubscriptionNotReceived");
if ($fadherent->statut > 0) {
print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
}
}
}
print '</td></tr>';
// Other attributes. Fields from hook formObjectOptions and Extrafields.
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print '</table>';
print '</div>';
print '<div class="clearboth"></div>';
print dol_get_fiche_end();
// Buttons for actions
if ($action != 'presend') {
@ -533,24 +226,67 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
if (empty($reshook)) {
if ($object->status == $object::STATUS_DRAFT) {
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?rowid='.$memberid.'&action=edit', '', $permissiontoadd);
}
// Show
if ($permissiontoadd) {
print dolGetButtonAction($langs->trans('ShowPartnership'), '', 'default', dol_buildpath('/partnership/partnership_card.php', 1).'?id='.$object->id, '', $permissiontoadd);
}
// Cancel
if ($permissiontoadd) {
if ($object->status == $object::STATUS_ACCEPTED) {
print dolGetButtonAction($langs->trans('Cancel'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken(), '', $permissiontoadd);
}
print dolGetButtonAction($langs->trans('AddPartnership'), '', 'default', DOL_URL_ROOT.'/partnership/partnership_card.php?action=create&fk_member='.$object->id.'&backtopage='.urlencode(DOL_URL_ROOT.'/adherents/partnership.php?id='.$object->id), '', $permissiontoadd);
}
}
print '</div>'."\n";
}
//$morehtmlright = 'partnership/partnership_card.php?action=create&backtopage=%2Fdolibarr%2Fhtdocs%2Fpartnership%2Fpartnership_list.php';
$morehtmlright = '';
print load_fiche_titre($langs->trans("PartnershipDedicatedToThisMember", $langs->transnoentitiesnoconv("Partnership")), $morehtmlright, '');
$memberid = $object->id;
// TODO Replace this card with the list of all partnerships.
$object = new Partnership($db);
$partnershipid = $object->fetch(0, "", $memberid);
if ($partnershipid > 0) {
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">'."\n";
// Common attributes
//$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field
//unset($object->fields['fk_project']); // Hide field already shown in banner
//unset($object->fields['fk_member']); // Hide field already shown in banner
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
// End of subscription date
$fadherent = new Adherent($db);
$fadherent->fetch($object->fk_member);
print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';
if ($fadherent->datefin) {
print dol_print_date($fadherent->datefin, 'day');
if ($fadherent->hasDelay()) {
print " ".img_warning($langs->trans("Late"));
}
} else {
if (!$adht->subscription) {
print $langs->trans("SubscriptionNotRecorded");
if ($fadherent->statut > 0) {
print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
}
} else {
print $langs->trans("SubscriptionNotReceived");
if ($fadherent->statut > 0) {
print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
}
}
}
print '</td></tr>';
print '</table>';
print '</div>';
}
}
// End of page

View File

@ -100,7 +100,7 @@ $hookmanager->initHooks(array('admin'));
// Put here declaration of dictionaries properties
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
$taborder = array(9, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 6, 0, 29, 0, 33, 34, 32, 24, 28, 17, 35, 36, 0, 10, 23, 12, 13, 7, 0, 14, 0, 22, 20, 18, 21, 41, 0, 15, 30, 0, 37, 42, 0, 25, 0, 43, 0);
$taborder = array(9, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 6, 0, 29, 0, 33, 34, 32, 24, 28, 17, 35, 36, 0, 10, 23, 12, 13, 7, 0, 14, 0, 22, 20, 18, 21, 41, 0, 15, 30, 0, 37, 42, 0, 43, 0, 25, 0);
// Name of SQL tables of dictionaries
$tabname = array();
@ -608,7 +608,7 @@ $tabcomplete = array(
'c_prospectcontactlevel'=>array('picto'=>'company'),
'c_stcommcontact'=>array('picto'=>'company'),
'c_product_nature'=>array('picto'=>'product'),
'c_productbatch_qcstatus'=>array('picto'=>'batch'),
'c_productbatch_qcstatus'=>array('picto'=>'lot'),
);

View File

@ -23,32 +23,8 @@
*/
// Load Dolibarr environment
$res = 0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
}
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
$i--; $j--;
}
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
}
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
}
// Try main.inc.php using relative path
if (!$res && file_exists("../main.inc.php")) {
$res = @include "../main.inc.php";
}
if (!$res && file_exists("../../main.inc.php")) {
$res = @include "../../main.inc.php";
}
if (!$res) {
die("Include of main fails");
}
require '../main.inc.php';
global $langs, $user;
// Libraries

View File

@ -27,32 +27,7 @@
*/
// Load Dolibarr environment
$res = 0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
}
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
$i--; $j--;
}
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
}
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
}
// Try main.inc.php using relative path
if (!$res && file_exists("../main.inc.php")) {
$res = @include "../main.inc.php";
}
if (!$res && file_exists("../../main.inc.php")) {
$res = @include "../../main.inc.php";
}
if (!$res) {
die("Include of main fails");
}
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/lib/knowledgemanagement.lib.php';

View File

@ -228,7 +228,7 @@ print '<br>';
print '<br>';
print load_fiche_titre($langs->trans("ConfigurationFile").' ('.$conffile.')', '', 'folder');
print '<strong>$dolibarr_main_prod</strong>: '.$dolibarr_main_prod;
print '<strong>$dolibarr_main_prod</strong>: '.($dolibarr_main_prod ? $dolibarr_main_prod : '0');
if (empty($dolibarr_main_prod)) {
print ' &nbsp; '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 1);
}
@ -245,8 +245,22 @@ if (empty($dolibarr_main_restrict_ip)) {
print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
//print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("IPsOfUsers")).')</span>';
}
print '<br>';
if (empty($conf->global->SECURITY_DISABLE_TEST_ON_OBFUSCATED_CONF)) {
print '<strong>$dolibarr_main_db_pass</strong>: ';
if (!empty($dolibarr_main_db_pass) && empty($dolibarr_main_db_encrypted_pass)) {
print img_picto('', 'warning').' '.$langs->trans("DatabasePasswordNotObfuscated").' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommanded").': '.$langs->trans("SetOptionTo", $langs->transnoentitiesnoconv("MainDbPasswordFileConfEncrypted"), yn(1)).')</span>';
//print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("IPsOfUsers")).')</span>';
} else {
print img_picto('', 'tick').' '.$langs->trans("DatabasePasswordObfuscated");
}
print '<br>';
}
// Menu security
@ -277,7 +291,7 @@ if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') {
print '<br>';
print '<strong>MAIN_SECURITY_ANTI_SSRF_SERVER_IP</strong> = '.(empty($conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP)."<br>";
print '<strong>MAIN_SECURITY_ANTI_SSRF_SERVER_IP</strong> = '.(empty($conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span> &nbsp; <span class="opacitymedium">('.$langs->trans("Example").': static-ips-of-server - '.$langs->trans("Note").': common loopback ip like 127.*.*.*, [::1] are already added)</span>' : $conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP)."<br>";
print '<br>';
print '<strong>MAIN_ALLOW_SVG_FILES_AS_IMAGES</strong> = '.(empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES) ? '0 &nbsp; <span class="opacitymedium">('.$langs->trans("Recommanded").': 0)</span>' : $conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES)."<br>";

View File

@ -200,7 +200,7 @@ class Setup extends DolibarrApi
$sql = "SELECT id, code, type, libelle as label, module";
$sql .= " FROM ".MAIN_DB_PREFIX."c_paiement as t";
$sql .= " WHERE t.entity IN (".getEntity('c_paiement').")";
$sql .= " AND t.active = ".$active;
$sql .= " AND t.active = ".((int) $active);
// Add sql filters
if ($sqlfilters) {
if (!DolibarrApi::_checkFilters($sqlfilters)) {
@ -1055,7 +1055,7 @@ class Setup extends DolibarrApi
$sql = "SELECT rowid AS id, zip, town, fk_county, fk_pays AS fk_country";
$sql .= " FROM ".MAIN_DB_PREFIX."c_ziptown as t";
$sql .= " AND t.active = ".$active;
$sql .= " AND t.active = ".((int) $active);
if ($zipcode) {
$sql .= " AND t.zip LIKE '%".$this->db->escape($zipcode)."%'";
}
@ -1125,7 +1125,7 @@ class Setup extends DolibarrApi
$sql = "SELECT rowid as id, code, sortorder, libelle as label, libelle_facture as descr, type_cdr, nbjour, decalage, module";
$sql .= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
$sql .= " WHERE t.entity IN (".getEntity('c_payment_term').")";
$sql .= " AND t.active = ".$active;
$sql .= " AND t.active = ".((int) $active);
// Add sql filters
if ($sqlfilters) {
if (!DolibarrApi::_checkFilters($sqlfilters)) {
@ -1183,7 +1183,7 @@ class Setup extends DolibarrApi
$sql = "SELECT rowid as id, code, libelle as label, description, tracking, module";
$sql .= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as t";
$sql .= " WHERE t.entity IN (".getEntity('c_shipment_mode').")";
$sql .= " AND t.active = ".$active;
$sql .= " AND t.active = ".((int) $active);
// Add sql filters
if ($sqlfilters) {
if (!DolibarrApi::_checkFilters($sqlfilters)) {
@ -1307,7 +1307,7 @@ class Setup extends DolibarrApi
$sql = "SELECT t.rowid, t.entity, t.code, t.label, t.url, t.icon, t.active";
$sql .= " FROM ".MAIN_DB_PREFIX."c_socialnetworks as t";
$sql .= " WHERE t.entity IN (".getEntity('c_socialnetworks').")";
$sql .= " AND t.active = ".$active;
$sql .= " AND t.active = ".((int) $active);
// Add sql filters
if ($sqlfilters) {
if (!DolibarrApi::_checkFilters($sqlfilters)) {

View File

@ -332,7 +332,7 @@ class AssetType extends CommonObject
/**
* Return array of Asset objects for asset type this->id (or all if this->id not defined)
*
* @param string $excludefilter Filter to exclude. This parameter must not be provided by input of users
* @param string $excludefilter Filter string to exclude. This parameter must not be provided by input of users
* @param int $mode 0=Return array of asset instance
* 1=Return array of asset instance without extra data
* 2=Return array of asset id only
@ -347,7 +347,7 @@ class AssetType extends CommonObject
$sql = "SELECT a.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."asset as a";
$sql .= " WHERE a.entity IN (".getEntity('asset').")";
$sql .= " AND a.fk_asset_type = ".$this->id;
$sql .= " AND a.fk_asset_type = ".((int) $this->id);
if (!empty($excludefilter)) {
$sql .= ' AND ('.$excludefilter.')';
}

View File

@ -128,7 +128,7 @@ if ($id > 0 || !empty($ref)) {
print dol_get_fiche_end();
$modulepart = 'asset';
$permission = $user->rights->asset->write;
$permissiontoadd = $user->rights->asset->write;
$permtoedit = $user->rights->asset->write;
$param = '&id='.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';

View File

@ -71,7 +71,7 @@ class BlockedLogAuthority
$this->blockchain = '';
if (is_array($bocks)) {
if (is_array($blocks)) {
foreach ($blocks as &$b) {
$this->blockchain .= $b->signature;
}
@ -299,16 +299,18 @@ class BlockedLogAuthority
$signature = $block_static->getSignature();
foreach ($blocks as &$block) {
$url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.$signature.'&b='.$block->signature;
if (is_array($blocks)) {
foreach ($blocks as &$block) {
$url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.$signature.'&b='.$block->signature;
$res = file_get_contents($url);
echo $block->signature.' '.$url.' '.$res.'<br>';
if ($res === 'blockalreadyadded' || $res === 'blockadded') {
$block->setCertified();
} else {
$this->error = $langs->trans('ImpossibleToContactAuthority ', $url);
return -1;
$res = getURLContent($url);
echo $block->signature.' '.$url.' '.$res.'<br>';
if ($res === 'blockalreadyadded' || $res === 'blockadded') {
$block->setCertified();
} else {
$this->error = $langs->trans('ImpossibleToContactAuthority ', $url);
return -1;
}
}
}

View File

@ -147,7 +147,7 @@ if ($object->id) {
print dol_get_fiche_end();
$modulepart = 'bom';
$permission = $user->rights->bom->write;
$permissiontoadd = $user->rights->bom->write;
$permtoedit = $user->rights->bom->write;
$param = '&id='.$object->id;

View File

@ -96,7 +96,7 @@ class BOM extends CommonObject
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'autofocusoncreate'=>1),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'2', 'autofocusoncreate'=>1),
'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth150', 'csslist'=>'minwidth150 center'),
//'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500'),
@ -614,8 +614,8 @@ class BOM extends CommonObject
$sql .= " SET ref = '".$this->db->escape($num)."',";
$sql .= " status = ".self::STATUS_VALIDATED.",";
$sql .= " date_valid='".$this->db->idate($now)."',";
$sql .= " fk_user_valid = ".$user->id;
$sql .= " WHERE rowid = ".$this->id;
$sql .= " fk_user_valid = ".((int) $user->id);
$sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
$resql = $this->db->query($sql);

View File

@ -80,7 +80,7 @@ function printDropdownBookmarksList()
// Menu with list of bookmarks
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
$sql .= " WHERE (fk_user = ".$user->id." OR fk_user is NULL OR fk_user = 0)";
$sql .= " WHERE (fk_user = ".((int) $user->id)." OR fk_user is NULL OR fk_user = 0)";
$sql .= " AND entity IN (".getEntity('bookmarks').")";
$sql .= " ORDER BY position";
if ($resql = $db->query($sql)) {

View File

@ -98,7 +98,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."bookmark as b LEFT JOIN ".MAIN_DB_PREFIX."user
$sql .= " WHERE 1=1";
$sql .= " AND b.entity IN (".getEntity('bookmark').")";
if (!$user->admin) {
$sql .= " AND (b.fk_user = ".$user->id." OR b.fk_user is NULL OR b.fk_user = 0)";
$sql .= " AND (b.fk_user = ".((int) $user->id)." OR b.fk_user is NULL OR b.fk_user = 0)";
}
$sql .= $db->order($sortfield.", position", $sortorder);

View File

@ -774,7 +774,7 @@ class Categorie extends CommonObject
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_".(empty($this->MAP_CAT_TABLE[$type]) ? $type : $this->MAP_CAT_TABLE[$type]);
$sql .= " WHERE fk_categorie = ".$this->id;
$sql .= " AND fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = ".$obj->id;
$sql .= " AND fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = ".((int) $obj->id);
dol_syslog(get_class($this).'::del_type', LOG_DEBUG);
if ($this->db->query($sql)) {
@ -1303,7 +1303,7 @@ class Categorie extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."categorie as c ";
$sql .= " WHERE c.entity IN (".getEntity('category').")";
$sql .= " AND c.type = ".((int) $type);
$sql .= " AND c.fk_parent = ".$this->fk_parent;
$sql .= " AND c.fk_parent = ".((int) $this->fk_parent);
$sql .= " AND c.label = '".$this->db->escape($this->label)."'";
dol_syslog(get_class($this)."::already_exists", LOG_DEBUG);
@ -1552,7 +1552,7 @@ class Categorie extends CommonObject
// Generation requete recherche
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie";
$sql .= " WHERE type = ".$this->MAP_ID[$type];
$sql .= " WHERE type = ".((int) $this->MAP_ID[$type]);
$sql .= " AND entity IN (".getEntity('category').")";
if ($nom) {
if (!$exact) {

View File

@ -1896,7 +1896,7 @@ class ActionComm extends CommonObject
$userforfilter = new User($this->db);
$result = $userforfilter->fetch('', $logint);
if ($result > 0) {
$sql .= " AND ar.fk_element = ".$userforfilter->id;
$sql .= " AND ar.fk_element = ".((int) $userforfilter->id);
} elseif ($result < 0 || $condition == '=') {
$sql .= " AND ar.fk_element = 0";
}
@ -2410,7 +2410,7 @@ class ActionComm extends CommonObject
// Delete also very old past events (we do not keep more than 1 month record in past)
$sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_reminder";
$sql .= " WHERE dateremind < '".$this->db->idate($now - (3600 * 24 * 32))."'";
$sql .= " AND status = ".$actionCommReminder::STATUS_DONE;
$sql .= " AND status = ".((int) $actionCommReminder::STATUS_DONE);
$resql = $this->db->query($sql);
if (!$resql) {

View File

@ -287,7 +287,7 @@ if ($object->id > 0) {
$modulepart = 'actions';
$permission = $user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create;
$permissiontoadd = $user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create;
$param = '&id='.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {

View File

@ -741,10 +741,10 @@ if ($status == 'todo') {
if ($filtert > 0 || $usergroup > 0) {
$sql .= " AND (";
if ($filtert > 0) {
$sql .= "ar.fk_element = ".$filtert;
$sql .= "ar.fk_element = ".((int) $filtert);
}
if ($usergroup > 0) {
$sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".$usergroup;
$sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".((int) $usergroup);
}
$sql .= ")";
}

View File

@ -106,7 +106,8 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if ($page == -1 || $page == null) {
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
}
$offset = $limit * $page;

View File

@ -616,7 +616,7 @@ if ($filtert > 0 || $usergroup > 0) {
$sql .= "ar.fk_element = ".$filtert;
}
if ($usergroup > 0) {
$sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".$usergroup;
$sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".((int) $usergroup);
}
$sql .= ")";
}

View File

@ -637,7 +637,7 @@ if ($filtert > 0 || $usergroup > 0) {
$sql .= "ar.fk_element = ".$filtert;
}
if ($usergroup > 0) {
$sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".$usergroup;
$sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".((int) $usergroup);
}
$sql .= ")";
}
@ -899,7 +899,7 @@ while ($currentdaytoshow < $lastdaytoshow) {
}
$sql .= " WHERE u.statut = 1 AND u.entity IN (".getEntity('user').")";
if ($usergroup > 0) {
$sql .= " AND ug.fk_usergroup = ".$usergroup;
$sql .= " AND ug.fk_usergroup = ".((int) $usergroup);
}
//print $sql;
$resql = $db->query($sql);

View File

@ -43,7 +43,8 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if ($page == -1 || $page == null) {
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
}
$offset = $limit * $page;

View File

@ -104,23 +104,15 @@ if ($type == "f") {
if ($socid) {
$sql .= " AND s.rowid = ".((int) $socid);
}
if (dol_strlen($stcomm)) {
$sql .= " AND s.fk_stcomm=".$db->escape($stcomm);
}
if (!empty($search_lastname)) {
$sql .= " AND p.name LIKE '%".$db->escape($search_lastname)."%'";
}
if (!empty($search_firstname)) {
$sql .= " AND p.firstname LIKE '%".$db->escape($search_firstname)."%'";
}
if (!empty($search_company)) {
$sql .= " AND s.nom LIKE '%".$db->escape($search_company)."%'";
}
if (!empty($contactname)) { // acces a partir du module de recherche
$sql .= " AND (p.name LIKE '%".$db->escape($contactname)."%' OR lower(p.firstname) LIKE '%".$db->escape($contactname)."%') ";
$sortfield = "p.name";

View File

@ -2294,6 +2294,7 @@ if ($action == 'create') {
print $langs->trans('OutstandingBill');
print '</td><td class="valuefield">';
$arrayoutstandingbills = $soc->getOutstandingBills();
print ($arrayoutstandingbills['opened'] > $soc->outstanding_limit ? img_warning() : '');
print price($arrayoutstandingbills['opened']).' / ';
print price($soc->outstanding_limit, 0, $langs, 1, - 1, - 1, $conf->currency);
print '</td>';

View File

@ -2463,12 +2463,12 @@ class Propal extends CommonObject
$error = 0;
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
$sql .= " SET fk_statut = ".$status.",";
$sql .= " SET fk_statut = ".((int) $status).",";
if (!empty($note)) {
$sql .= " note_private = '".$this->db->escape($note)."',";
}
$sql .= " date_cloture=NULL, fk_user_cloture=NULL";
$sql .= " WHERE rowid = ".$this->id;
$sql .= " WHERE rowid = ".((int) $this->id);
$this->db->begin();
@ -4305,7 +4305,7 @@ class PropaleLigne extends CommonObjectLine
}
$sql .= ", fk_parent_line=".($this->fk_parent_line > 0 ? $this->fk_parent_line : "null");
if (!empty($this->rang)) {
$sql .= ", rang=".$this->rang;
$sql .= ", rang=".((int) $this->rang);
}
$sql .= ", date_start=".(!empty($this->date_start) ? "'".$this->db->idate($this->date_start)."'" : "null");
$sql .= ", date_end=".(!empty($this->date_end) ? "'".$this->db->idate($this->date_end)."'" : "null");
@ -4317,7 +4317,7 @@ class PropaleLigne extends CommonObjectLine
$sql .= ", multicurrency_total_tva=".price2num($this->multicurrency_total_tva)."";
$sql .= ", multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc)."";
$sql .= " WHERE rowid = ".$this->id;
$sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
@ -4365,7 +4365,7 @@ class PropaleLigne extends CommonObjectLine
$sql .= " total_ht=".price2num($this->total_ht, 'MT')."";
$sql .= ",total_tva=".price2num($this->total_tva, 'MT')."";
$sql .= ",total_ttc=".price2num($this->total_ttc, 'MT')."";
$sql .= " WHERE rowid = ".$this->rowid;
$sql .= " WHERE rowid = ".((int) $this->rowid);
dol_syslog("PropaleLigne::update_total", LOG_DEBUG);

View File

@ -189,7 +189,7 @@ if ($object->id > 0) {
print dol_get_fiche_end();
$modulepart = 'propal';
$permission = $user->rights->propal->creer;
$permissiontoadd = $user->rights->propal->creer;
$permtoedit = $user->rights->propal->creer;
$param = '&id='.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';

View File

@ -88,7 +88,7 @@ if (!empty($conf->propal->enabled)) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
}
if ($socid) {
$sql .= " AND p.fk_soc = ".$socid;
$sql .= " AND p.fk_soc = ".((int) $socid);
}
$resql = $db->query($sql);
@ -160,7 +160,7 @@ $sql .= " WHERE c.entity IN (".getEntity($propalstatic->element).")";
$sql .= " AND c.fk_soc = s.rowid";
//$sql.= " AND c.fk_statut > 2";
if ($socid) {
$sql .= " AND c.fk_soc = ".$socid;
$sql .= " AND c.fk_soc = ".((int) $socid);
}
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
@ -318,7 +318,7 @@ if (! empty($conf->propal->enabled))
$sql.= " WHERE c.fk_soc = s.rowid";
$sql.= " AND c.entity = ".$conf->entity;
$sql.= " AND c.fk_statut = 1";
if ($socid) $sql.= " AND c.fk_soc = ".$socid;
if ($socid) $sql.= " AND c.fk_soc = ".((int) $socid);
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " ORDER BY c.rowid DESC";
@ -393,7 +393,7 @@ if (! empty($conf->propal->enabled))
$sql.= " WHERE c.fk_soc = s.rowid";
$sql.= " AND c.entity = ".$conf->entity;
$sql.= " AND c.fk_statut = 2 ";
if ($socid) $sql.= " AND c.fk_soc = ".$socid;
if ($socid) $sql.= " AND c.fk_soc = ".((int) $socid);
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " ORDER BY c.rowid DESC";

View File

@ -593,27 +593,27 @@ if ($sall) {
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
}
if ($search_categ_cus > 0) {
$sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
$sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus);
}
if ($search_categ_cus == -2) {
$sql .= " AND cc.fk_categorie IS NULL";
}
if ($search_fk_cond_reglement > 0) {
$sql .= " AND p.fk_cond_reglement = ".$db->escape($search_fk_cond_reglement);
$sql .= " AND p.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
}
if ($search_fk_shipping_method > 0) {
$sql .= " AND p.fk_shipping_method = ".$db->escape($search_fk_shipping_method);
$sql .= " AND p.fk_shipping_method = ".((int) $search_fk_shipping_method);
}
if ($search_fk_input_reason > 0) {
$sql .= " AND p.fk_input_reason = ".$db->escape($search_fk_input_reason);
$sql .= " AND p.fk_input_reason = ".((int) $search_fk_input_reason);
}
if ($search_fk_mode_reglement > 0) {
$sql .= " AND p.fk_mode_reglement = ".$db->escape($search_fk_mode_reglement);
$sql .= " AND p.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
}
if ($search_product_category > 0) {
$sql .= " AND cp.fk_categorie = ".$db->escape($search_product_category);
$sql .= " AND cp.fk_categorie = ".((int) $search_product_category);
}
if ($socid > 0) {
$sql .= ' AND s.rowid = '.((int) $socid);
@ -1419,7 +1419,7 @@ if ($resql) {
if (!empty($arrayfields['pr.ref']['checked'])) {
// Project ref
print '<td class="nowrap">';
print '<td class="nowraponall">';
if ($obj->project_id > 0) {
print $projectstatic->getNomUrl(1);
}

View File

@ -87,7 +87,7 @@ $sql .= " WHERE s.fk_stcomm = st.id";
$sql .= " AND s.client IN (2, 3)";
$sql .= " AND s.entity IN (".getEntity($companystatic->element).")";
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= " GROUP BY st.id";
$sql .= " ORDER BY st.id";
@ -129,7 +129,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
$sql .= " AND p.fk_soc = s.rowid";
$sql .= " AND p.entity IN (".getEntity('propal').")";
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$resql = $db->query($sql);
@ -191,7 +191,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
$sql .= " AND p.fk_statut = 1";
$sql .= " AND p.entity IN (".getEntity('propal').")";
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {
$sql .= " AND s.rowid = ".((int) $socid);
@ -250,7 +250,7 @@ if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " WHERE s.fk_stcomm = 1";
$sql .= " AND s.entity IN (".getEntity($companystatic->element).")";
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= " ORDER BY s.tms ASC";
$sql .= $db->plimit(15, 0);

View File

@ -2539,7 +2539,7 @@ class Commande extends CommonOrder
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
$sql .= " SET date_commande = ".($date ? "'".$this->db->idate($date)."'" : 'null');
$sql .= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
$sql .= " WHERE rowid = ".$this->id." AND fk_statut = ".((int) self::STATUS_DRAFT);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
@ -4559,14 +4559,14 @@ class OrderLine extends CommonOrderLine
}
$sql .= " , fk_product_fournisseur_price=".(!empty($this->fk_fournprice) ? $this->fk_fournprice : "null");
$sql .= " , buy_price_ht='".price2num($this->pa_ht)."'";
$sql .= " , info_bits=".$this->info_bits;
$sql .= " , special_code=".$this->special_code;
$sql .= " , info_bits=".((int) $this->info_bits);
$sql .= " , special_code=".((int) $this->special_code);
$sql .= " , date_start=".(!empty($this->date_start) ? "'".$this->db->idate($this->date_start)."'" : "null");
$sql .= " , date_end=".(!empty($this->date_end) ? "'".$this->db->idate($this->date_end)."'" : "null");
$sql .= " , product_type=".$this->product_type;
$sql .= " , fk_parent_line=".(!empty($this->fk_parent_line) ? $this->fk_parent_line : "null");
if (!empty($this->rang)) {
$sql .= ", rang=".$this->rang;
$sql .= ", rang=".((int) $this->rang);
}
$sql .= " , fk_unit=".(!$this->fk_unit ? 'NULL' : $this->fk_unit);
@ -4576,7 +4576,7 @@ class OrderLine extends CommonOrderLine
$sql .= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva)."";
$sql .= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc)."";
$sql .= " WHERE rowid = ".$this->rowid;
$sql .= " WHERE rowid = ".((int) $this->rowid);
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);

View File

@ -89,9 +89,6 @@ $sql .= " AND s.entity IN (".getEntity('societe').")";
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
}
if (dol_strlen($stcomm)) {
$sql .= " AND s.fk_stcomm=".$stcomm;
}
if (GETPOST("search_nom")) {
$sql .= natural_search("s.nom", GETPOST("search_nom"));
}

View File

@ -184,7 +184,7 @@ if ($id > 0 || !empty($ref)) {
print dol_get_fiche_end();
$modulepart = 'commande';
$permission = $user->rights->commande->creer;
$permissiontoadd = $user->rights->commande->creer;
$permtoedit = $user->rights->commande->creer;
$param = '&id='.$object->id.'&entity='.(!empty($object->entity) ? $object->entity : $conf->entity);
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';

View File

@ -166,7 +166,7 @@ $sql .= " WHERE c.fk_soc = s.rowid";
$sql .= " AND c.entity IN (".getEntity('commande').")";
//$sql.= " AND c.fk_statut > 2";
if ($socid) {
$sql .= " AND c.fk_soc = ".$socid;
$sql .= " AND c.fk_soc = ".((int) $socid);
}
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
@ -250,7 +250,7 @@ if (!empty($conf->commande->enabled)) {
$sql .= " AND c.entity IN (".getEntity('commande').")";
$sql .= " AND c.fk_statut = ".Commande::STATUS_VALIDATED;
if ($socid) {
$sql .= " AND c.fk_soc = ".$socid;
$sql .= " AND c.fk_soc = ".((int) $socid);
}
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
@ -337,9 +337,9 @@ if (!empty($conf->commande->enabled)) {
}
$sql .= " WHERE c.fk_soc = s.rowid";
$sql .= " AND c.entity IN (".getEntity('commande').")";
$sql .= " AND c.fk_statut = ".Commande::STATUS_ACCEPTED;
$sql .= " AND c.fk_statut = ".((int) Commande::STATUS_ACCEPTED);
if ($socid) {
$sql .= " AND c.fk_soc = ".$socid;
$sql .= " AND c.fk_soc = ".((int) $socid);
}
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;

View File

@ -473,7 +473,7 @@ if ($search_user > 0) {
$sql .= ' WHERE c.fk_soc = s.rowid';
$sql .= ' AND c.entity IN ('.getEntity('commande').')';
if ($search_product_category > 0) {
$sql .= " AND cp.fk_categorie = ".$search_product_category;
$sql .= " AND cp.fk_categorie = ".((int) $search_product_category);
}
if ($socid > 0) {
$sql .= ' AND s.rowid = '.((int) $socid);

View File

@ -183,7 +183,7 @@ if ($id > 0 || !empty($ref)) {
$modulepart = 'bank';
$permission = $user->rights->banque->modifier;
$permissiontoadd = $user->rights->banque->modifier;
$permtoedit = $user->rights->banque->modifier;
$param = '&id='.$object->id.'&num='.urlencode($numref);
$moreparam = '&num='.urlencode($numref);

View File

@ -1181,7 +1181,7 @@ if ($resql) {
$sqlforbalance .= " ".MAIN_DB_PREFIX."bank as b";
$sqlforbalance .= " WHERE b.fk_account = ba.rowid";
$sqlforbalance .= " AND ba.entity IN (".getEntity('bank_account').")";
$sqlforbalance .= " AND b.fk_account = ".$search_account;
$sqlforbalance .= " AND b.fk_account = ".((int) $search_account);
$sqlforbalance .= " AND (b.datev < '".$db->idate($db->jdate($objp->dv))."' OR (b.datev = '".$db->idate($db->jdate($objp->dv))."' AND (b.dateo < '".$db->idate($db->jdate($objp->do))."' OR (b.dateo = '".$db->idate($db->jdate($objp->do))."' AND b.rowid < ".$objp->rowid."))))";
$resqlforbalance = $db->query($sqlforbalance);
//print $sqlforbalance;

View File

@ -177,6 +177,10 @@ class Account extends CommonObject
* @var int ID
*/
public $fk_accountancy_journal;
/**
* @var string Label of journal
*/
public $accountancy_journal;
/**
* Currency code
@ -281,6 +285,7 @@ class Account extends CommonObject
'rappro' =>array('type'=>'smallint(6)', 'label'=>'Rappro', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
'url' =>array('type'=>'varchar(128)', 'label'=>'Url', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
'account_number' =>array('type'=>'varchar(32)', 'label'=>'Account number', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
'fk_accountancy_journal' =>array('type'=>'integer', 'label'=>'Accountancy journal ID', 'enabled'=>1, 'visible'=>-1, 'position'=>132),
'accountancy_journal' =>array('type'=>'varchar(20)', 'label'=>'Accountancy journal', 'enabled'=>1, 'visible'=>-1, 'position'=>135),
'currency_code' =>array('type'=>'varchar(3)', 'label'=>'Currency code', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>140),
'min_allowed' =>array('type'=>'integer', 'label'=>'Min allowed', 'enabled'=>1, 'visible'=>-1, 'position'=>145),
@ -294,7 +299,6 @@ class Account extends CommonObject
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>175),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>180),
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'fk_accountancy_journal' =>array('type'=>'integer', 'label'=>'Fk accountancy journal', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
);
// END MODULEBUILDER PROPERTIES
@ -311,9 +315,11 @@ class Account extends CommonObject
*/
const TYPE_SAVINGS = 0;
const STATUS_OPEN = 0;
const STATUS_CLOSED = 1;
/**
* Constructor
*
@ -1064,7 +1070,7 @@ class Account extends CommonObject
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_account";
$sql .= " WHERE rowid = ".$this->rowid;
$sql .= " WHERE rowid = ".((int) $this->rowid);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$result = $this->db->query($sql);
@ -2084,7 +2090,7 @@ class AccountLine extends CommonObject
$sql .= " amount = ".price2num($this->amount).",";
$sql .= " datev='".$this->db->idate($this->datev)."',";
$sql .= " dateo='".$this->db->idate($this->dateo)."'";
$sql .= " WHERE rowid = ".$this->rowid;
$sql .= " WHERE rowid = ".((int) $this->rowid);
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);

View File

@ -77,7 +77,7 @@ class BankAccounts extends DolibarrApi
$sql .= ' WHERE t.entity IN ('.getEntity('bank_account').')';
// Select accounts of given category
if ($category > 0) {
$sql .= " AND c.fk_categorie = ".$this->db->escape($category)." AND c.fk_account = t.rowid ";
$sql .= " AND c.fk_categorie = ".((int) $category)." AND c.fk_account = t.rowid";
}
// Add sql filters
if ($sqlfilters) {

View File

@ -136,7 +136,7 @@ if ($id > 0 || !empty($ref)) {
$modulepart = 'bank';
$permission = $user->rights->banque->modifier;
$permissiontoadd = $user->rights->banque->modifier;
$permtoedit = $user->rights->banque->modifier;
$param = '&id='.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';

View File

@ -173,7 +173,7 @@ if ($user->rights->banque->modifier && $action == "update") {
$sql .= " datev = '".$db->idate($dateval)."',";
}
}
$sql .= " fk_account = ".$actarget->id;
$sql .= " fk_account = ".((int) $actarget->id);
$sql .= " WHERE rowid = ".((int) $acline->id);
$result = $db->query($sql);

View File

@ -606,7 +606,7 @@ if (empty($numref)) {
$sql .= ", ".MAIN_DB_PREFIX."bank_class as cl";
$sql .= " WHERE ct.rowid = cl.fk_categ";
$sql .= " AND ct.entity = ".$conf->entity;
$sql .= " AND cl.lineid = ".$objp->rowid;
$sql .= " AND cl.lineid = ".((int) $objp->rowid);
$resc = $db->query($sql);
if ($resc) {

View File

@ -150,7 +150,7 @@ if ($object->id) {
print dol_get_fiche_end();
$modulepart = 'banque';
$permission = $user->rights->banque->modifier;
$permissiontoadd = $user->rights->banque->modifier;
$param = '&id='.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {

View File

@ -250,19 +250,19 @@ if ($search_amount_cred) {
$sql .= natural_search("v.amount", $search_amount_cred, 1);
}
if ($search_bank_account > 0) {
$sql .= " AND b.fk_account=".$db->escape($search_bank_account);
$sql .= " AND b.fk_account = ".((int) $search_bank_account);
}
if ($search_bank_entry > 0) {
$sql .= " AND b.fk_account=".$db->escape($search_bank_account);
$sql .= " AND b.fk_account = ".((int) $search_bank_account);
}
if ($search_accountancy_account > 0) {
$sql .= " AND v.accountancy_code=".$db->escape($search_accountancy_account);
$sql .= " AND v.accountancy_code = ".((int) $search_accountancy_account);
}
if ($search_accountancy_subledger > 0) {
$sql .= " AND v.subledger_account=".$db->escape($search_accountancy_subledger);
$sql .= " AND v.subledger_account = ".((int) $search_accountancy_subledger);
}
if ($typeid > 0) {
$sql .= " AND v.fk_typepayment=".$typeid;
$sql .= " AND v.fk_typepayment=".((int) $typeid);
}
if ($search_all) {
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);

View File

@ -93,10 +93,12 @@ class CashControl extends CommonObject
'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'),
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>490),
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>502),
'tms' =>array('type'=>'timestamp', 'label'=>'Tms', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>505),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'Import key', 'enabled'=>1, 'visible'=>0, 'position'=>510),
'fk_user_creat' =>array('type'=>'integer:User', 'label'=>'userCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>600),
'fk_user_valid' =>array('type'=>'integer:User', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>602),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'Import key', 'enabled'=>1, 'visible'=>0, 'position'=>700),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated')),
);
@ -115,21 +117,24 @@ class CashControl extends CommonObject
public $cheque;
public $card;
/**
* @var integer|string $date_valid
*/
public $date_valid;
/**
* @var integer|string date_creation
*/
public $date_creation;
public $fk_user_creat;
/**
* @var integer|string $date_modification
*/
public $date_modification;
/**
* @var integer|string $date_valid
*/
public $date_valid;
public $fk_user_valid;
const STATUS_DRAFT = 0;
const STATUS_VALIDATED = 1;
const STATUS_CLOSED = 1; // For the moment CLOSED = VALIDATED

View File

@ -26,7 +26,7 @@
/**
* \file htdocs/compta/cashcontrol/report.php
* \ingroup cashdesk|takepos
* \brief List of bank transactions
* \brief List of sales from POS
*/
if (!defined('NOREQUIREMENU')) {
@ -36,6 +36,8 @@ if (!defined('NOBROWSERNOTIF')) {
define('NOBROWSERNOTIF', '1'); // Disable browser notification
}
$_GET['optioncss'] = "print";
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
@ -48,10 +50,8 @@ $langs->loadLangs(array("bills", "banks"));
$id = GETPOST('id', 'int');
$_GET['optioncss'] = "print";
$cashcontrol = new CashControl($db);
$cashcontrol->fetch($id);
$object = new CashControl($db);
$object->fetch($id);
//$limit = GETPOST('limit')?GETPOST('limit', 'int'):$conf->liste_limit;
$sortorder = 'ASC';
@ -67,19 +67,19 @@ $arrayfields = array(
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
);
$syear = $cashcontrol->year_close;
$smonth = $cashcontrol->month_close;
$sday = $cashcontrol->day_close;
$syear = $object->year_close;
$smonth = $object->month_close;
$sday = $object->day_close;
$posmodule = $cashcontrol->posmodule;
$terminalid = $cashcontrol->posnumber;
$posmodule = $object->posmodule;
$terminalid = $object->posnumber;
// Security check
if ($user->socid > 0) { // Protection if external user
//$socid = $user->socid;
accessforbidden();
}
if (!$user->rights->cashdesk->run && !$user->rights->takepos->run) {
if (empty($user->rights->cashdesk->run) && empty($user->rights->takepos->run)) {
accessforbidden();
}
@ -106,8 +106,8 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON bu.url_id = f.rowid";
$sql.= " WHERE b.fk_account = ba.rowid";
// Define filter on invoice
$sql.= " AND f.module_source = '".$db->escape($cashcontrol->posmodule)."'";
$sql.= " AND f.pos_source = '".$db->escape($cashcontrol->posnumber)."'";
$sql.= " AND f.module_source = '".$db->escape($object->posmodule)."'";
$sql.= " AND f.pos_source = '".$db->escape($object->posnumber)."'";
$sql.= " AND f.entity IN (".getEntity('facture').")";
// Define filter on data
if ($syear && ! $smonth) $sql.= " AND dateo BETWEEN '".$db->idate(dol_get_first_day($syear, 1))."' AND '".$db->idate(dol_get_last_day($syear, 12))."'";
@ -151,19 +151,33 @@ if ($resql) {
$i = 0;
print "<!-- title of cash fence -->\n";
print "<center><h2>";
if ($cashcontrol->status != $cashcontrol::STATUS_DRAFT) {
print $langs->trans("CashControl")." ".$cashcontrol->id;
print '<center>';
print '<h2>';
if ($object->status != $object::STATUS_DRAFT) {
print $langs->trans("CashControl")." ".$object->id;
} else {
print $langs->trans("CashControl")." - ".$langs->trans("Draft");
}
print "<br>".$langs->trans("DateCreationShort").": ".dol_print_date($cashcontrol->date_creation, 'dayhour');
print "</h2></center>";
print "</h2>";
print $mysoc->name;
print '<br>'.$langs->trans("DateCreationShort").": ".dol_print_date($object->date_creation, 'dayhour');
$userauthor = $object->fk_user_valid;
if (empty($userauthor)) {
$userauthor = $object->fk_user_creat;
}
$uservalid = new User($db);
if ($userauthor > 0) {
$uservalid->fetch($userauthor);
print '<br>'.$langs->trans("Author").': '.$uservalid->getFullName($langs);
}
print '<br>'.$langs->trans("Period").': '.$object->year_close.($object->month_close ? '-'.$object->month_close : '').($object->day_close ? '-'.$object->day_close : '');
print '</center>';
$invoicetmp = new Facture($db);
print "<div style='text-align: right'><h2>";
print $langs->trans("InitialBankBalance").' - '.$langs->trans("Cash")." : ".price($cashcontrol->opening);
print $langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").' : <span class="amount">'.price($object->opening).'</span>';
print "</h2></div>";
print '<div class="div-table-responsive">';
@ -182,15 +196,20 @@ if ($resql) {
print "</tr>\n";
// Loop on each record
$sign = 1;
$cash = $bank = $cheque = $other = 0;
$totalarray = array();
$totalqty = 0;
$totalvat = 0;
$cachebankaccount = array();
$cacheinvoiceid = array();
$transactionspertype = array();
$amountpertype = array();
$totalarray = array();
while ($i < $num) {
$objp = $db->fetch_object($resql);
// Load bankaccount
if (empty($cachebankaccount[$objp->bankid])) {
$bankaccounttmp = new Account($db);
$bankaccounttmp->fetch($objp->bankid);
@ -202,14 +221,13 @@ if ($resql) {
$invoicetmp->fetch($objp->facid);
/*if ($first == "yes")
{
print '<tr class="oddeven">';
print '<td>'.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").'</td>';
print '<td></td><td></td><td></td><td class="right"><span class="amount">'.price($cashcontrol->opening).'</span></td>';
print '</tr>';
$first = "no";
}*/
if (empty($cacheinvoiceid[$objp->facid])) {
$cacheinvoiceid[$objp->facid] = $objp->facid; // First time this invoice is found into list of invoice x payments
foreach ($invoicetmp->lines as $line) {
$totalqty += $line->qty;
$totalvat += $line->total_tva;
}
}
print '<tr class="oddeven">';
@ -229,25 +247,42 @@ if ($resql) {
$totalarray['nbfield']++;
}
// Bank account
print '<td class="nowrap right">';
print $bankaccount->getNomUrl(1);
if ($cashcontrol->posmodule == "takepos") {
$var1 = 'CASHDESK_ID_BANKACCOUNT_CASH'.$cashcontrol->posnumber;
if ($object->posmodule == "takepos") {
$var1 = 'CASHDESK_ID_BANKACCOUNT_CASH'.$object->posnumber;
} else {
$var1 = 'CASHDESK_ID_BANKACCOUNT_CASH';
}
// Bank account
print '<td class="nowrap right">';
print $bankaccount->getNomUrl(1);
if ($objp->code == 'CHQ') {
$cheque += $objp->amount;
if (empty($transactionspertype[$objp->code])) {
$transactionspertype[$objp->code] = 0;
}
$transactionspertype[$objp->code] += 1;
} elseif ($objp->code == 'CB') {
$bank += $objp->amount;
if (empty($transactionspertype[$objp->code])) {
$transactionspertype[$objp->code] = 0;
}
$transactionspertype[$objp->code] += 1;
} else {
if ($conf->global->$var1 == $bankaccount->id) {
$cash += $objp->amount;
// } elseif ($conf->global->$var2 == $bankaccount->id) $bank+=$objp->amount;
//elseif ($conf->global->$var3 == $bankaccount->id) $cheque+=$objp->amount;
if (empty($transactionspertype['CASH'])) {
$transactionspertype['CASH'] = 0;
}
$transactionspertype['CASH'] += 1;
} else {
$other += $objp->amount;
if (empty($transactionspertype['OTHER'])) {
$transactionspertype['OTHER'] = 0;
}
$transactionspertype['OTHER'] += 1;
}
}
print "</td>\n";
@ -305,48 +340,46 @@ if ($resql) {
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
print "</table>";
print "</div>";
//$cash = $amountpertype['LIQ'] + $cashcontrol->opening;
$cash = price2num($cash + $cashcontrol->opening, 'MT');
//$cash = $amountpertype['LIQ'] + $object->opening;
$cash = price2num($cash + $object->opening, 'MT');
print '<div style="text-align: right"><h2>';
print $langs->trans("Cash").": ".price($cash);
if ($cashcontrol->status == $cashcontrol::STATUS_VALIDATED && $cash != $cashcontrol->cash) {
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($cashcontrol->cash).'</span>';
print '<div style="text-align: right">';
print '<h2>';
print $langs->trans("Cash").' '.($transactionspertype['CASH']?'('.$transactionspertype['CASH'].')':'').': <span class="amount">'.price($cash).'</span>';
if ($object->status == $object::STATUS_VALIDATED && $cash != $object->cash) {
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($object->cash).'</span>';
}
print "<br><br>";
print "<br>";
//print '<br>';
print $langs->trans("PaymentTypeCHQ").": ".price($cheque);
if ($cashcontrol->status == $cashcontrol::STATUS_VALIDATED && $cheque != $cashcontrol->cheque) {
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($cashcontrol->cheque).'</span>';
print $langs->trans("PaymentTypeCHQ").' '.($transactionspertype['CHQ']?'('.$transactionspertype['CHQ'].')':'').': <span class="amount">'.price($cheque).'</span>';
if ($object->status == $object::STATUS_VALIDATED && $cheque != $object->cheque) {
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($object->cheque).'</span>';
}
print "<br><br>";
print "<br>";
//print '<br>';
print $langs->trans("PaymentTypeCB").": ".price($bank);
if ($cashcontrol->status == $cashcontrol::STATUS_VALIDATED && $bank != $cashcontrol->card) {
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($cashcontrol->card).'</span>';
print $langs->trans("PaymentTypeCB").' '.($transactionspertype['CB']?'('.$transactionspertype['CB'].')':'').': <span class="amount">'.price($bank).'</span>';
if ($object->status == $object::STATUS_VALIDATED && $bank != $object->card) {
print ' <> <span class="amountremaintopay">'.$langs->trans("Declared").': '.price($object->card).'</span>';
}
print "<br><br>";
print "<br>";
// print '<br>';
if ($other) {
print '<br>'.$langs->trans("Other").": ".price($other)."<br><br>";
print ''.$langs->trans("Other").' '.($transactionspertype['OTHER']?'('.$transactionspertype['OTHER'].')':'').': <span class="amount">'.price($other)."</span>";
print '<br>';
}
print "</h2></div>";
//save totals to DB
/*
$sql = "UPDATE ".MAIN_DB_PREFIX."pos_cash_fence ";
$sql .= "SET";
$sql .= " cash='".$db->escape($cash)."'";
$sql .= ", card='".$db->escape($bank)."'";
$sql .= " where rowid = ".((int) $id);
$db->query($sql);
*/
print $langs->trans("Total").' ('.$totalqty.' '.$langs->trans("Articles").') : <span class="amount">'.price($cash + $cheque + $bank + $other).'</span>';
print '<br>'.$langs->trans("TotalVAT").' : <span class="amount">'.price($totalvat).'</span>';
// TODO Add total localtaxes.
print "</div>";
print '</h2>';
print '</div>';
print '</form>';

View File

@ -227,9 +227,10 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
$accountstatic->id = $obj->bid;
$accountstatic->ref = $obj->bref;
$accountstatic->number = $obj->bnumber;
$accountstatic->accountancy_number = $obj->account_number;
$accountstatic->accountancy_journal = $obj->accountancy_journal;
$accountstatic->account_number = $obj->account_number;
$accountstatic->fk_accountancy_journal = $obj->fk_accountancy_journal;
$accountstatic->label = $obj->blabel;
print $accountstatic->getNomUrl(1);
} else {
print '&nbsp;';
@ -348,9 +349,10 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
$accountstatic->id = $obj->bid;
$accountstatic->ref = $obj->bref;
$accountstatic->number = $obj->bnumber;
$accountstatic->accountancy_number = $obj->account_number;
$accountstatic->accountancy_journal = $obj->accountancy_journal;
$accountstatic->account_number = $obj->account_number;
$accountstatic->fk_accountancy_journal = $obj->fk_accountancy_journal;
$accountstatic->label = $obj->blabel;
print $accountstatic->getNomUrl(1);
} else {
print '&nbsp;';

View File

@ -71,7 +71,7 @@ llxHeader();
$thirdpartystatic = new Societe($db);
if ($action == 'note') {
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET note='".$db->escape($note)."' WHERE rowid=".$socid;
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET note='".$db->escape($note)."' WHERE rowid=".((int) $socid);
$result = $db->query($sql);
}
@ -107,29 +107,21 @@ if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
}
if (dol_strlen($stcomm)) {
$sql .= " AND s.fk_stcomm=".$stcomm;
$sql .= " AND s.fk_stcomm=".((int) $stcomm);
}
if ($socname) {
$sql .= natural_search("s.nom", $socname);
$sortfield = "s.nom";
$sortorder = "ASC";
}
if ($_GET["search_nom"]) {
if (GETPOST("search_nom")) {
$sql .= natural_search("s.nom", GETPOST("search_nom"));
}
if ($_GET["search_compta"]) {
if (GETPOST("search_compta")) {
$sql .= natural_search("s.code_compta", GETPOST("search_compta"));
}
if ($_GET["search_code_client"]) {
if (GETPOST("search_code_client")) {
$sql .= natural_search("s.code_client", GETPOST("search_code_client"));
}
if (dol_strlen($begin)) {
$sql .= natural_search("s.nom", $begin);
}
if ($socid) {
$sql .= " AND s.rowid = ".((int) $socid);
}
$sql .= " ORDER BY $sortfield $sortorder ";
$sql .= " ORDER BY $sortfield $sortorder";
$sql .= $db->plimit($conf->liste_limit + 1, $offset);
//print $sql;

View File

@ -126,7 +126,7 @@ if ($object->id) {
print '</div>';
$modulepart = 'deplacement';
$permission = $user->rights->deplacement->creer;
$permissiontoadd = $user->rights->deplacement->creer;
$param = '&id='.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {

View File

@ -217,7 +217,7 @@ class Invoices extends DolibarrApi
}
// Insert sale filter
if ($search_sale > 0) {
$sql .= " AND sc.fk_user = ".$search_sale;
$sql .= " AND sc.fk_user = ".((int) $search_sale);
}
// Add sql filters
if ($sqlfilters) {

View File

@ -470,9 +470,9 @@ class FactureRec extends CommonInvoice
$error = 0;
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_rec SET";
$sql .= " fk_soc = ".$this->fk_soc;
$sql .= " fk_soc = ".((int) $this->fk_soc);
// TODO Add missing fields
$sql .= " WHERE rowid = ".$this->id;
$sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
@ -1136,12 +1136,12 @@ class FactureRec extends CommonInvoice
$sql .= ", qty=".price2num($qty);
$sql .= ", tva_tx=".price2num($txtva);
$sql .= ", vat_src_code='".$this->db->escape($vat_src_code)."'";
$sql .= ", localtax1_tx=".$txlocaltax1;
$sql .= ", localtax1_tx=".((float) $txlocaltax1);
$sql .= ", localtax1_type='".$this->db->escape($localtaxes_type[0])."'";
$sql .= ", localtax2_tx=".$txlocaltax2;
$sql .= ", localtax2_tx=".((float) $txlocaltax2);
$sql .= ", localtax2_type='".$this->db->escape($localtaxes_type[2])."'";
$sql .= ", fk_product=".(!empty($fk_product) ? "'".$this->db->escape($fk_product)."'" : "null");
$sql .= ", product_type=".$product_type;
$sql .= ", product_type=".((int) $product_type);
$sql .= ", remise_percent='".price2num($remise_percent)."'";
$sql .= ", subprice='".price2num($pu_ht)."'";
$sql .= ", total_ht='".price2num($total_ht)."'";
@ -2124,11 +2124,11 @@ class FactureLigneRec extends CommonInvoiceLine
$sql .= ", total_localtax2=".price2num($this->total_localtax2);
$sql .= ", total_ttc=".price2num($this->total_ttc);
}
$sql .= ", rang=".$this->rang;
$sql .= ", special_code=".$this->special_code;
$sql .= ", rang=".((int) $this->rang);
$sql .= ", special_code=".((int) $this->special_code);
$sql .= ", fk_unit=".($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : "null");
$sql .= ", fk_contract_line=".($this->fk_contract_line ? $this->fk_contract_line : "null");
$sql .= " WHERE rowid = ".$this->id;
$sql .= " WHERE rowid = ".((int) $this->id);
$this->db->begin();

View File

@ -4105,7 +4105,7 @@ class Facture extends CommonInvoice
$sql .= " AND pf.fk_paiement IS NULL"; // Aucun paiement deja fait
$sql .= " AND ff.fk_statut IS NULL"; // Renvoi vrai si pas facture de remplacement
if ($socid > 0) {
$sql .= " AND f.fk_soc = ".$socid;
$sql .= " AND f.fk_soc = ".((int) $socid);
}
$sql .= " ORDER BY f.ref";
@ -5594,7 +5594,7 @@ class FactureLigne extends CommonInvoiceLine
$sql .= ", buy_price_ht=".(($this->pa_ht || $this->pa_ht === 0 || $this->pa_ht === '0') ? price2num($this->pa_ht) : "null"); // $this->pa_ht should always be defined (set to 0 or to sell price depending on option)
$sql .= ", fk_parent_line=".($this->fk_parent_line > 0 ? $this->fk_parent_line : "null");
if (!empty($this->rang)) {
$sql .= ", rang=".$this->rang;
$sql .= ", rang=".((int) $this->rang);
}
$sql .= ", situation_percent=".$this->situation_percent;
$sql .= ", fk_unit=".(!$this->fk_unit ? 'NULL' : $this->fk_unit);
@ -5606,7 +5606,7 @@ class FactureLigne extends CommonInvoiceLine
$sql .= ", multicurrency_total_tva=".price2num($this->multicurrency_total_tva)."";
$sql .= ", multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc)."";
$sql .= " WHERE rowid = ".$this->rowid;
$sql .= " WHERE rowid = ".((int) $this->rowid);
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);

View File

@ -181,7 +181,7 @@ if ($id > 0 || !empty($ref)) {
print dol_get_fiche_end();
$modulepart = 'facture';
$permission = $user->rights->facture->creer;
$permissiontoadd = $user->rights->facture->creer;
$permtoedit = $user->rights->facture->creer;
$param = '&id='.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';

View File

@ -59,8 +59,8 @@ print load_fiche_titre($langs->trans("CustomersInvoicesArea"), '', 'bill');
print '<div class="fichecenter">';
print '<div class="fichethirdleft">';
print getCustomerInvoicePieChart($socid);
print getNumberInvoicesPieChart('customers');
//print getCustomerInvoicePieChart($socid);
print '<br>';
print getCustomerInvoiceDraftTable($max, $socid);

View File

@ -50,8 +50,7 @@ $confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'invoicetemplatelist'; // To manage different context of search
$socid = GETPOST('socid', 'int');
$optioncss = GETPOST('optioncss', 'alpha');
$socid = GETPOST('socid', 'int');
@ -138,9 +137,11 @@ $arrayfields = array(
'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),
'f.fk_user_author'=>array('label'=>"UserCreation", 'checked'=>0, 'position'=>500),
'f.fk_user_modif'=>array('label'=>"UserModification", 'checked'=>0, 'position'=>505),
'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>520),
'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>525),
'status'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@ -241,6 +242,7 @@ if (!empty($conf->projet->enabled)) {
}
$companystatic = new Societe($db);
$invoicerectmp = new FactureRec($db);
$tmpuser = new User($db);
$now = dol_now();
$tmparray = dol_getdate($now);
@ -253,7 +255,7 @@ $today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['
$sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre as title, f.total_ht, f.total_tva, f.total_ttc, f.frequency, f.unit_frequency,";
$sql .= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,";
$sql .= " f.datec, f.tms,";
$sql .= " f.datec, f.fk_user_author, f.tms, f.fk_user_modif,";
$sql .= " f.fk_cond_reglement, f.fk_mode_reglement";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
@ -275,7 +277,7 @@ if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " WHERE f.fk_soc = s.rowid";
$sql .= ' AND f.entity IN ('.getEntity('invoice').')';
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($search_ref) {
$sql .= natural_search('f.titre', $search_ref);
@ -394,7 +396,7 @@ if ($resql) {
if ($search_payment_term != '') {
$param .= '&search_payment_term='.urlencode($search_payment_term);
}
if ($search_recurring != '' && $search_recurrning != '-1') {
if ($search_recurring != '' && $search_recurring != '-1') {
$param .= '&search_recurring='.urlencode($search_recurring);
}
if ($search_frequency > 0) {
@ -535,6 +537,16 @@ if ($resql) {
$parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// User creation
if (!empty($arrayfields['f.fk_user_author']['checked'])) {
print '<td class="liste_titre">';
print '</td>';
}
// User modification
if (!empty($arrayfields['f.fk_user_modif']['checked'])) {
print '<td class="liste_titre">';
print '</td>';
}
// Date creation
if (!empty($arrayfields['f.datec']['checked'])) {
print '<td class="liste_titre">';
@ -570,7 +582,7 @@ if ($resql) {
if (!empty($arrayfields['s.nom']['checked'])) {
print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER['PHP_SELF'], "s.nom", "", $param, "", $sortfield, $sortorder);
}
if (!empty($arrayfields['f.total_total']['checked'])) {
if (!empty($arrayfields['f.total_ht']['checked'])) {
print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], "f.total_ht", "", $param, 'class="right"', $sortfield, $sortorder);
}
if (!empty($arrayfields['f.total_tva']['checked'])) {
@ -603,6 +615,12 @@ if ($resql) {
if (!empty($arrayfields['f.date_when']['checked'])) {
print_liste_field_titre($arrayfields['f.date_when']['label'], $_SERVER['PHP_SELF'], "f.date_when", "", $param, 'align="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['f.fk_user_author']['checked'])) {
print_liste_field_titre($arrayfields['f.fk_user_author']['label'], $_SERVER['PHP_SELF'], "f.fk_user_author", "", $param, 'align="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['f.fk_user_modif']['checked'])) {
print_liste_field_titre($arrayfields['f.fk_user_modif']['label'], $_SERVER['PHP_SELF'], "f.fk_user_modif", "", $param, 'align="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['f.datec']['checked'])) {
print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER['PHP_SELF'], "f.datec", "", $param, 'align="center"', $sortfield, $sortorder);
}
@ -636,6 +654,9 @@ if ($resql) {
$invoicerectmp->nb_gen_max = $objp->nb_gen_max;
$invoicerectmp->nb_gen_done = $objp->nb_gen_done;
$invoicerectmp->ref = $objp->title;
$invoicerectmp->total_ht = $objp->total_ht;
$invoicerectmp->total_tva = $objp->total_tva;
$invoicerectmp->total_ttc = $objp->total_ttc;
print '<tr class="oddeven">';
@ -655,7 +676,7 @@ if ($resql) {
}
}
if (!empty($arrayfields['f.total_ht']['checked'])) {
print '<td class="nowrap right amount">'.price($objp->total).'</td>'."\n";
print '<td class="nowrap right amount">'.price($objp->total_ht).'</td>'."\n";
if (!$i) {
$totalarray['nbfield']++;
}
@ -665,7 +686,7 @@ if ($resql) {
$totalarray['val']['f.total_ht'] += $objp->total_ht;
}
if (!empty($arrayfields['f.total_tva']['checked'])) {
print '<td class="nowrap right amount">'.price($objp->total_vat).'</td>'."\n";
print '<td class="nowrap right amount">'.price($objp->total_tva).'</td>'."\n";
if (!$i) {
$totalarray['nbfield']++;
}
@ -755,6 +776,28 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['f.fk_user_author']['checked'])) {
print '<td class="center tdoverflowmax150">';
if ($objp->fk_user_author > 0) {
$tmpuser->fetch($objp->fk_user_author);
print $tmpuser->getNomUrl(1);
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['f.fk_user_modif']['checked'])) {
print '<td class="center tdoverflowmax150">';
if ($objp->fk_user_author > 0) {
$tmpuser->fetch($objp->fk_user_author);
print $tmpuser->getNomUrl(1);
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['f.datec']['checked'])) {
print '<td class="center">';
print dol_print_date($db->jdate($objp->datec), 'dayhour');
@ -789,12 +832,13 @@ if ($resql) {
}
}
// Action column
print '<td class="center">';
print '<td class="center tdoverflowmax125">';
if ($user->rights->facture->creer && empty($invoicerectmp->suspended)) {
if ($invoicerectmp->isMaxNbGenReached()) {
print $langs->trans("MaxNumberOfGenerationReached");
} elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
print '<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&amp;socid='.$objp->socid.'&amp;fac_rec='.$objp->facid.'">';
print img_picto($langs->trans("CreateBill"), 'add', 'class="paddingrightonly"');
print $langs->trans("CreateBill").'</a>';
} else {
print $form->textwithpicto('', $langs->trans("DateIsNotEnough"));

View File

@ -240,7 +240,7 @@ $arrayfields = array(
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>502),
'f.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'position'=>510, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES))),
'f.note_private'=>array('label'=>'NotePrivate', 'checked'=>0, 'position'=>511, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES))),
'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
@ -546,7 +546,7 @@ if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
}
if ($search_product_category > 0) {
$sql .= " AND cp.fk_categorie = ".$db->escape($search_product_category);
$sql .= " AND cp.fk_categorie = ".((int) $search_product_category);
}
if ($socid > 0) {
$sql .= ' AND s.rowid = '.((int) $socid);
@ -634,7 +634,7 @@ if ($search_login) {
$sql .= natural_search(array('u.login', 'u.firstname', 'u.lastname'), $search_login);
}
if ($search_categ_cus > 0) {
$sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
$sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus);
}
if ($search_categ_cus == -2) {
$sql .= " AND cc.fk_categorie IS NULL";
@ -659,10 +659,10 @@ if ($search_status != '-1' && $search_status != '') {
}
if ($search_paymentmode > 0) {
$sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode);
$sql .= " AND f.fk_mode_reglement = ".((int) $search_paymentmode);
}
if ($search_paymentterms > 0) {
$sql .= " AND f.fk_cond_reglement = ".$db->escape($search_paymentterms);
$sql .= " AND f.fk_cond_reglement = ".((int) $search_paymentterms);
}
if ($search_module_source) {
$sql .= natural_search("f.module_source", $search_module_source);
@ -692,10 +692,10 @@ if ($option == 'late') {
$sql .= " AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'";
}
if ($search_sale > 0) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".(int) $search_sale;
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
}
if ($search_user > 0) {
$sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".$search_user;
$sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".((int) $search_user);
}
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';

View File

@ -138,7 +138,7 @@ if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
}
if ($socid) {
$sql .= " AND f.fk_soc = ".$socid;
$sql .= " AND f.fk_soc = ".((int) $socid);
}
// Add where from hooks
$parameters = array();
@ -267,7 +267,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$langs->load("boxes");
$facstatic = new FactureFournisseur($db);
$sql = "SELECT ff.rowid, ff.ref, ff.fk_statut as status, ff.libelle, ff.total_ht, ff.total_tva, ff.total_ttc, ff.tms, ff.paye";
$sql = "SELECT ff.rowid, ff.ref, ff.fk_statut as status, ff.type, ff.libelle, ff.total_ht, ff.total_tva, ff.total_ttc, ff.tms, ff.paye, ff.ref_supplier";
$sql .= ", s.nom as name";
$sql .= ", s.rowid as socid";
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.email";
@ -283,14 +283,14 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
}
if ($socid) {
$sql .= " AND ff.fk_soc = ".$socid;
$sql .= " AND ff.fk_soc = ".((int) $socid);
}
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhereSupplierLastModified', $parameters);
$sql .= $hookmanager->resPrint;
$sql .= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.tms, ff.paye,";
$sql .= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.type, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.tms, ff.paye, ff.ref_supplier,";
$sql .= " s.nom, s.rowid, s.code_fournisseur, s.code_compta_fournisseur, s.email";
$sql .= " ORDER BY ff.tms DESC ";
$sql .= $db->plimit($max, 0);
@ -332,6 +332,8 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$facstatic->total_ttc = $obj->total_ttc;
$facstatic->statut = $obj->status;
$facstatic->paye = $obj->paye;
$facstatic->type = $obj->type;
$facstatic->ref_supplier = $obj->ref_supplier;
$thirdpartystatic->id = $obj->socid;
$thirdpartystatic->name = $obj->name;
@ -593,7 +595,7 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
}
if ($socid) {
$sql .= " AND c.fk_soc = ".$socid;
$sql .= " AND c.fk_soc = ".((int) $socid);
}
$sql .= " AND c.fk_statut = ".Commande::STATUS_CLOSED;
$sql .= " AND c.facture = 0";

View File

@ -170,7 +170,7 @@ class Localtax extends CommonObject
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."localtax SET";
$sql .= " localtaxtype=".$this->ltt.",";
$sql .= " localtaxtype=".((int) $this->ltt).",";
$sql .= " tms='".$this->db->idate($this->tms)."',";
$sql .= " datep='".$this->db->idate($this->datep)."',";
$sql .= " datev='".$this->db->idate($this->datev)."',";

View File

@ -584,7 +584,7 @@ $sql .= "SELECT SUM(amount) as mm, date_format(f.datev,'%Y-%m') as dm, 'claimed'
$sql .= " FROM ".MAIN_DB_PREFIX."localtax as f";
$sql .= " WHERE f.entity = ".$conf->entity;
$sql .= " AND (f.datev >= '".$db->idate($date_start)."' AND f.datev <= '".$db->idate($date_end)."')";
$sql .= " AND localtaxtype=".$localTaxType;
$sql .= " AND localtaxtype=".((int) $localTaxType);
$sql .= " GROUP BY dm";
$sql .= " UNION ";
@ -593,7 +593,7 @@ $sql .= "SELECT SUM(amount) as mm, date_format(f.datep,'%Y-%m') as dm, 'paid' as
$sql .= " FROM ".MAIN_DB_PREFIX."localtax as f";
$sql .= " WHERE f.entity = ".$conf->entity;
$sql .= " AND (f.datep >= '".$db->idate($date_start)."' AND f.datep <= '".$db->idate($date_end)."')";
$sql .= " AND localtaxtype=".$localTaxType;
$sql .= " AND localtaxtype=".((int) $localTaxType);
$sql .= " GROUP BY dm";
$sql .= " ORDER BY dm ASC, mode ASC";

View File

@ -606,7 +606,7 @@ if ($action == 'new') {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement as p ON p.fk_bank = b.rowid";
$sql .= " WHERE ba.entity IN (".getEntity('bank_account').")";
$sql .= " AND b.fk_type= 'CHQ'";
$sql .= " AND b.fk_bordereau = ".$object->id;
$sql .= " AND b.fk_bordereau = ".((int) $object->id);
$sql .= $db->order($sortfield, $sortorder);
$resql = $db->query($sql);

View File

@ -104,7 +104,7 @@ if ($search_ref) {
$sql .= natural_search("bc.ref", $search_ref);
}
if ($search_account > 0) {
$sql .= " AND bc.fk_bank_account=".$search_account;
$sql .= " AND bc.fk_bank_account = ".((int) $search_account);
}
if ($search_amount) {
$sql .= natural_search("bc.amount", price2num($search_amount));

View File

@ -78,7 +78,7 @@ if ($socid) {
}
$sql .= " WHERE p.entity IN (".getEntity('invoice').')';
if ($socid) {
$sql .= " AND f.fk_soc = ".$socid;
$sql .= " AND f.fk_soc = ".((int) $socid);
}
$sql .= " AND p.statut = 0";

View File

@ -203,7 +203,7 @@ class BonPrelevement extends CommonObject
$sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes";
$sql .= " WHERE fk_prelevement_bons = ".$this->id;
$sql .= " AND fk_soc =".$client_id;
$sql .= " AND fk_soc =".((int) $client_id);
$sql .= " AND code_banque = '".$this->db->escape($code_banque)."'";
$sql .= " AND code_guichet = '".$this->db->escape($code_guichet)."'";
$sql .= " AND number = '".$this->db->escape($number)."'";

View File

@ -329,7 +329,7 @@ class RejetPrelevement
$sql = "SELECT pr.date_rejet as dr, motif, afacturer";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_rejet as pr";
$sql .= " WHERE pr.fk_prelevement_lignes =".$rowid;
$sql .= " WHERE pr.fk_prelevement_lignes =".((int) $rowid);
$resql = $this->db->query($sql);
if ($resql) {
@ -345,11 +345,11 @@ class RejetPrelevement
return 0;
} else {
dol_syslog("RejetPrelevement::Fetch Erreur rowid=$rowid numrows=0");
dol_syslog("RejetPrelevement::Fetch Erreur rowid=".$rowid." numrows=0");
return -1;
}
} else {
dol_syslog("RejetPrelevement::Fetch Erreur rowid=$rowid");
dol_syslog("RejetPrelevement::Fetch Erreur rowid=".$rowid);
return -2;
}
}

View File

@ -170,15 +170,15 @@ $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql .= " , ".MAIN_DB_PREFIX."societe as s";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_rejet as pr";
$sql .= " WHERE p.rowid=".$object->id;
$sql .= " WHERE p.rowid=".((int) $object->id);
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
$sql .= " AND p.entity = ".$conf->entity;
$sql .= " AND pl.fk_soc = s.rowid";
$sql .= " AND pl.statut = 3 ";
$sql .= " AND pr.fk_prelevement_lignes = pl.rowid";
if ($socid) {
/*if ($socid) {
$sql .= " AND s.rowid = ".((int) $socid);
}
}*/
$sql .= " ORDER BY pl.amount DESC";
// Count total nb of records

View File

@ -51,7 +51,8 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortorder = GETPOST('sortorder', 'aZ09comma');
$sortfield = GETPOST('sortfield', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if ($page == -1 || $page == null) {
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
}
$offset = $limit * $page;

View File

@ -189,7 +189,7 @@ if ($id > 0) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON p.fk_user_creat = u.rowid";
$sql .= " WHERE pf.fk_paiement = p.rowid";
$sql .= " AND p.entity = ".$conf->entity;
$sql .= " AND pf.fk_facture = ".$fac->id;
$sql .= " AND pf.fk_facture = ".((int) $fac->id);
$sql .= " ORDER BY p.datep ASC, p.rowid ASC";
$resqlp = $db->query($sql);

View File

@ -403,7 +403,7 @@ if ($modecompta == 'BOOKKEEPING') {
}
$sql .= " AND f.entity IN (".getEntity('invoice').")";
if ($socid) {
$sql .= " AND f.fk_soc = ".$socid;
$sql .= " AND f.fk_soc = ".((int) $socid);
}
$sql .= " GROUP BY name, socid";
$sql .= $db->order($sortfield, $sortorder);

View File

@ -164,7 +164,7 @@ if ($object->id) {
print dol_get_fiche_end();
$modulepart = 'tax';
$permission = $user->rights->tax->charges->creer;
$permissiontoadd = $user->rights->tax->charges->creer;
$permtoedit = $user->rights->tax->charges->creer;
$param = '&id='.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';

View File

@ -218,7 +218,7 @@ if ($search_amount) {
$sql .= natural_search("cs.amount", $search_amount, 1);
}
if ($search_status != '' && $search_status >= 0) {
$sql .= " AND cs.paye = ".$db->escape($search_status);
$sql .= " AND cs.paye = ".((int) $search_status);
}
$sql .= dolSqlDateFilter("cs.periode", $search_day_lim, $search_month_lim, $search_year_lim);
//$sql.= dolSqlDateFilter("cs.periode", 0, 0, $year);
@ -230,8 +230,8 @@ if ($year > 0) {
$sql .= "OR (cs.periode IS NULL AND date_format(cs.date_ech, '%Y') = '".$db->escape($year)."')";
$sql .= ")";
}
if ($search_typeid) {
$sql .= " AND cs.fk_type=".$db->escape($search_typeid);
if ($search_typeid > 0) {
$sql .= " AND cs.fk_type = ".((int) $search_typeid);
}
$sql .= " GROUP BY cs.rowid, cs.fk_type, cs.fk_user, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, c.libelle, cs.fk_account, ba.label, ba.ref, ba.number, ba.account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos, pay.code, u.lastname";
if (!empty($conf->projet->enabled)) {

View File

@ -391,7 +391,8 @@ if ($modecompta == 'CREANCES-DETTES') {
// Category filter
print '<tr class="liste_titre">';
print '<td>';
print $langs->trans("Category").': '.$formother->select_categories(Categorie::TYPE_PRODUCT, $selected_cat, 'search_categ', true);
print img_picto('', 'category', 'class="paddingrightonly"');
print $formother->select_categories(Categorie::TYPE_PRODUCT, $selected_cat, 'search_categ', 0, $langs->trans("Category"));
print ' ';
print $langs->trans("SubCats").'? ';
print '<input type="checkbox" name="subcat" value="yes"';
@ -406,7 +407,8 @@ if ($modecompta == 'CREANCES-DETTES') {
//select thirdparty
print '</br>';
print $langs->trans("ThirdParty").': '.$form->select_thirdparty_list($selected_soc, 'search_soc', '', 1);
print img_picto('', 'company', 'class="paddingrightonly"');
print $form->select_thirdparty_list($selected_soc, 'search_soc', '', $langs->trans("ThirdParty"));
print '</td>';
print '<td colspan="5" class="right">';

View File

@ -262,7 +262,7 @@ if ($modecompta == 'CREANCES-DETTES') {
}
$sql .= " AND f.entity IN (".getEntity('invoice').")";
if ($socid) {
$sql .= " AND f.fk_soc = ".$socid;
$sql .= " AND f.fk_soc = ".((int) $socid);
}
$sql .= " GROUP BY u.rowid, u.lastname, u.firstname";
$sql .= " ORDER BY u.rowid";

View File

@ -405,7 +405,8 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
// Category filter
print '<tr class="liste_titre">';
print '<td>';
print $langs->trans("Category").': '.$formother->select_categories(Categorie::TYPE_CUSTOMER, $selected_cat, 'search_categ', true);
print img_picto('', 'category', 'class="paddingrightonly"');
print $formother->select_categories(Categorie::TYPE_CUSTOMER, $selected_cat, 'search_categ', 0, $langs->trans("Category"));
print ' ';
print $langs->trans("SubCats").'? ';
print '<input type="checkbox" name="subcat" value="yes"';
@ -420,13 +421,13 @@ print '</tr>';
print '<tr class="liste_titre">';
print '<td class="liste_titre left">';
print '<input class="flat" size="6" type="text" name="search_societe" value="'.$search_societe.'">';
print '<input class="flat" size="6" type="text" name="search_societe" value="'.dol_escape_htmltag($search_societe).'">';
print '</td>';
print '<td class="liste_titre left">';
print '<input class="flat" size="6" type="text" name="search_zip" value="'.$search_zip.'">';
print '<input class="flat" size="6" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).'">';
print '</td>';
print '<td class="liste_titre left">';
print '<input class="flat" size="6" type="text" name="search_town" value="'.$search_town.'">';
print '<input class="flat" size="6" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'">';
print '</td>';
print '<td class="liste_titre left">';
print $form->select_country($search_country, 'search_country');

View File

@ -149,9 +149,11 @@ if ($modecompta == "CREANCES-DETTES") {
$name = $langs->trans("Turnover");
$calcmode = $langs->trans("CalcModeDebt");
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{link1}', '{link2}').')';
$calcmode = str_replace('{link1}', '<a class="bold" href="'.$_SERVER["PHP_SELF"].'?'.($param ? $param : 'year_start='.$year_start).'&modecompta=BOOKKEEPING">', $calcmode);
$calcmode = str_replace('{link2}', '</a>', $calcmode);
if (!empty($conf->accounting->enabled)) {
$calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{link1}', '{link2}').')';
$calcmode = str_replace('{link1}', '<a class="bold" href="'.$_SERVER["PHP_SELF"].'?'.($param ? $param : 'year_start='.$year_start).'&modecompta=BOOKKEEPING">', $calcmode);
$calcmode = str_replace('{link2}', '</a>', $calcmode);
}
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesCADue");
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
@ -164,8 +166,10 @@ if ($modecompta == "CREANCES-DETTES") {
} elseif ($modecompta == "RECETTES-DEPENSES") {
$name = $langs->trans("TurnoverCollected");
$calcmode = $langs->trans("CalcModeEngagement");
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
//$calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
//if (!empty($conf->accounting->enabled)) {
//$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPINGCOLLECTED">','</a>').')';
//}
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesCAIn");
$description .= $langs->trans("DepositsAreIncluded");
@ -677,7 +681,7 @@ print '</div>';
AND p.facture =0";
if ($socid)
{
$sql .= " AND f.fk_soc = ".$socid;
$sql .= " AND f.fk_soc = ".((int) $socid);
}
$sql .= " GROUP BY p.rowid";

View File

@ -128,23 +128,31 @@ llxHeader();
$form = new Form($db);
// TODO Report from bookkeeping not yet available, so we switch on report on business events
if ($modecompta == "BOOKKEEPING") {
$modecompta = "CREANCES-DETTES";
}
if ($modecompta == "BOOKKEEPINGCOLLECTED") {
$modecompta = "RECETTES-DEPENSES";
}
// Affiche en-tete du rapport
if ($modecompta == "CREANCES-DETTES") {
$name = $langs->trans("PurchaseTurnover");
$calcmode = $langs->trans("CalcModeDebt");
$calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{link1}', '{link2}').')';
$calcmode = str_replace('{link1}', '<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">', $calcmode);
$calcmode = str_replace('{link2}', '</a>', $calcmode);
if (!empty($conf->accounting->enabled)) {
$calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{link1}', '{link2}').')';
$calcmode = str_replace('{link1}', '<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">', $calcmode);
$calcmode = str_replace('{link2}', '</a>', $calcmode);
}
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesPurchaseTurnoverDue");
$builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "RECETTES-DEPENSES") {
$name = $langs->trans("PurchaseTurnoverCollected");
$calcmode = $langs->trans("CalcModeEngagement");
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesPurchaseTurnoverIn");
$builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "BOOKKEEPING") {
$name = $langs->trans("PurchaseTurnover");
@ -154,9 +162,19 @@ if ($modecompta == "CREANCES-DETTES") {
$calcmode = str_replace('{link2}', '</a>', $calcmode);
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesPurchaseTurnoverOfExpenseAccounts");
$builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "BOOKKEEPINGCOLLECTED") {
$name = $langs->trans("PurchaseTurnoverCollected");
$calcmode = $langs->trans("CalcModeBookkeeping");
$calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode", '{link1}', '{link2}').')';
$calcmode = str_replace('{link1}', '<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">', $calcmode);
$calcmode = str_replace('{link2}', '</a>', $calcmode);
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesPurchaseTurnoverCollectedOfExpenseAccounts");
//$exportlink=$langs->trans("NotYetAvailable");
}
$builddate = dol_now();
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
$period .= ' - ';
$period .= $form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
@ -179,7 +197,7 @@ if ($modecompta == 'CREANCES-DETTES') {
$sql .= " AND f.type IN (0,2)";
$sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
if ($socid) {
$sql .= " AND f.fk_soc = ".$socid;
$sql .= " AND f.fk_soc = ".((int) $socid);
}
} elseif ($modecompta == "RECETTES-DEPENSES") {
$sql = "SELECT date_format(p.datep,'%Y-%m') as dm, sum(pf.amount) as amount_ttc";
@ -190,7 +208,7 @@ if ($modecompta == 'CREANCES-DETTES') {
$sql .= " AND pf.fk_facturefourn = f.rowid";
$sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
if ($socid) {
$sql .= " AND f.fk_soc = ".$socid;
$sql .= " AND f.fk_soc = ".((int) $socid);
}
} elseif ($modecompta == "BOOKKEEPING") {
$pcgverid = $conf->global->CHARTOFACCOUNTS;

View File

@ -345,7 +345,8 @@ if ($modecompta == 'CREANCES-DETTES') {
// Category filter
print '<tr class="liste_titre">';
print '<td>';
print $langs->trans("Category").': '.$formother->select_categories(Categorie::TYPE_PRODUCT, $selected_cat, 'search_categ', true);
print img_picto('', 'category', 'class="paddingrightonly"');
print $formother->select_categories(Categorie::TYPE_PRODUCT, $selected_cat, 'search_categ', 0, $langs->trans("Category"));
print ' ';
print $langs->trans("SubCats").'? ';
print '<input type="checkbox" name="subcat" value="yes"';
@ -360,7 +361,8 @@ if ($modecompta == 'CREANCES-DETTES') {
//select thirdparty
print '</br>';
print $langs->trans("ThirdParty").': '.$form->select_thirdparty_list($selected_soc, 'search_soc', '', 1);
print img_picto('', 'company', 'class="paddingrightonly"');
print $form->select_thirdparty_list($selected_soc, 'search_soc', '', $langs->trans("ThirdParty"));
print '</td>';
print '<td colspan="5" class="right">';

View File

@ -200,18 +200,19 @@ if ($modecompta == "CREANCES-DETTES") {
$calcmode = $langs->trans("CalcModeDebt");
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$description = $langs->trans("RulesPurchaseTurnoverDue");
$builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "RECETTES-DEPENSES") {
$name = $langs->trans("PurchaseTurnoverCollected").', '.$langs->trans("ByThirdParties");
$calcmode = $langs->trans("CalcModeEngagement");
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
$description = $langs->trans("RulesPurchaseTurnoverIn");
$builddate = dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "BOOKKEEPING") {
// TODO
} elseif ($modecompta == "BOOKKEEPINGCOLLECTED") {
// TODO
}
$builddate = dol_now();
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
$period .= ' - ';
$period .= $form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
@ -300,7 +301,7 @@ if ($search_country > 0) {
}
$sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
if ($socid) {
$sql .= " AND f.fk_soc = ".$socid;
$sql .= " AND f.fk_soc = ".((int) $socid);
}
$sql .= " GROUP BY s.rowid, s.nom, s.zip, s.town, s.fk_pays";
$sql .= " ORDER BY s.rowid";
@ -344,7 +345,8 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
// Category filter
print '<tr class="liste_titre">';
print '<td>';
print $langs->trans("Category").': '.$formother->select_categories(Categorie::TYPE_SUPPLIER, $selected_cat, 'search_categ', true);
print img_picto('', 'category', 'class="paddingrightonly"');
print $formother->select_categories(Categorie::TYPE_SUPPLIER, $selected_cat, 'search_categ', 0, $langs->trans("Category"));
print ' ';
print $langs->trans("SubCats").'? ';
print '<input type="checkbox" name="subcat" value="yes"';
@ -359,13 +361,13 @@ print '</tr>';
print '<tr class="liste_titre">';
print '<td class="liste_titre left">';
print '<input class="flat" size="6" type="text" name="search_societe" value="'.$search_societe.'">';
print '<input class="flat" size="6" type="text" name="search_societe" value="'.dol_escape_htmltag($search_societe).'">';
print '</td>';
print '<td class="liste_titre left">';
print '<input class="flat" size="6" type="text" name="search_zip" value="'.$search_zip.'">';
print '<input class="flat" size="6" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).'">';
print '</td>';
print '<td class="liste_titre left">';
print '<input class="flat" size="6" type="text" name="search_town" value="'.$search_town.'">';
print '<input class="flat" size="6" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'">';
print '</td>';
print '<td class="liste_titre left">';
print $form->select_country($search_country, 'search_country');

View File

@ -207,7 +207,7 @@ class Tva extends CommonObject
$sql .= " amount=".price2num($this->amount).",";
$sql .= " label='".$this->db->escape($this->label)."',";
$sql .= " note='".$this->db->escape($this->note)."',";
$sql .= " fk_user_creat=".$this->fk_user_creat.",";
$sql .= " fk_user_creat=".((int) $this->fk_user_creat).",";
$sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? $this->fk_user_modif : $user->id)."";
$sql .= " WHERE rowid=".((int) $this->id);

View File

@ -150,7 +150,7 @@ if ($object->id) {
print dol_get_fiche_end();
$permission = $user->rights->tax->charges->creer;
$permissiontoadd = $user->rights->tax->charges->creer;
$permtoedit = $user->rights->tax->charges->creer;
$param = '&id='.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';

View File

@ -171,16 +171,16 @@ if (!empty($search_datepayment_end)) {
$sql .= ' AND t.datep <= "'.$db->idate($search_datepayment_end).'"';
}
if (!empty($search_type) && $search_type > 0) {
$sql .= ' AND t.fk_typepayment='.$search_type;
$sql .= ' AND t.fk_typepayment = '.((int) $search_type);
}
if (!empty($search_account) && $search_account > 0) {
$sql .= ' AND t.fk_account='.$search_account;
$sql .= ' AND t.fk_account = '.((int) $search_account);
}
if (!empty($search_amount)) {
$sql .= natural_search('t.amount', price2num(trim($search_amount)), 1);
}
if ($search_status != '' && $search_status >= 0) {
$sql .= " AND t.paye = ".$db->escape($search_status);
$sql .= " AND t.paye = ".((int) $search_status);
}
$sql .= " GROUP BY t.rowid, t.amount, t.label, t.datev, t.datep, t.paye, t.fk_typepayment, t.fk_account, ba.label, ba.ref, ba.number, ba.account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos, t.num_payment, pst.code";

View File

@ -283,10 +283,7 @@ abstract class ActionsContactCardCommon
// phpcs:enable
global $langs, $mysoc;
$this->object->old_name = GETPOST("old_name");
$this->object->old_firstname = GETPOST("old_firstname");
$this->object->socid = GETPOST("socid");
$this->object->socid = GETPOST("socid", 'int');
$this->object->lastname = GETPOST("name");
$this->object->firstname = GETPOST("firstname");
$this->object->civility_id = GETPOST("civility_id");
@ -301,7 +298,6 @@ abstract class ActionsContactCardCommon
$this->object->phone_mobile = GETPOST("phone_mobile");
$this->object->fax = GETPOST("fax");
$this->object->email = GETPOST("email");
$this->object->jabberid = GETPOST("jabberid");
$this->object->priv = GETPOST("priv");
$this->object->note = GETPOST("note", "restricthtml");
$this->object->canvas = GETPOST("canvas");

View File

@ -109,11 +109,6 @@ echo $this->control->tpl['ajax_selectcountry']; ?>
<td colspan="3"><input name="email" type="text" size="50" maxlength="80" value="<?php echo $this->control->tpl['email']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans("IM"); ?></td>
<td colspan="3"><input name="jabberid" type="text" size="50" maxlength="80" value="<?php echo $this->control->tpl['jabberid']; ?>"></td>
</tr>
<tr>
<td><?php echo $langs->trans("ContactVisibility"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['select_visibility']; ?></td>

View File

@ -297,7 +297,7 @@ if (empty($reshook)) {
$object->old_lastname = (string) GETPOST("old_lastname", 'alpha');
$object->old_firstname = (string) GETPOST("old_firstname", 'alpha');
$result = $object->delete();
$result = $object->delete(); // TODO Add $user as first param
if ($result > 0) {
if ($backtopage) {
header("Location: ".$backtopage);
@ -443,8 +443,6 @@ if (empty($reshook)) {
}
}
$object->old_lastname = '';
$object->old_firstname = '';
$action = 'view';
} else {
setEventMessages($object->error, $object->errors, 'errors');

View File

@ -545,8 +545,6 @@ class Contact extends CommonObject
$this->phone_pro = trim($this->phone_pro);
$this->phone_perso = trim($this->phone_perso);
$this->phone_mobile = trim($this->phone_mobile);
$this->jabberid = trim($this->jabberid);
$this->skype = trim($this->skype);
$this->photo = trim($this->photo);
$this->fax = trim($this->fax);
$this->zip = (empty($this->zip) ? '' : trim($this->zip));
@ -591,11 +589,11 @@ class Contact extends CommonObject
if (isset($this->stcomm_id)) {
$sql .= ", fk_stcommcontact = ".($this->stcomm_id > 0 || $this->stcomm_id == -1 ? $this->stcomm_id : "0");
}
$sql .= ", statut = ".$this->db->escape($this->statut);
$sql .= ", statut = ".((int) $this->statut);
$sql .= ", fk_user_modif=".($user->id > 0 ? "'".$this->db->escape($user->id)."'" : "NULL");
$sql .= ", default_lang=".($this->default_lang ? "'".$this->db->escape($this->default_lang)."'" : "NULL");
$sql .= ", entity = ".$this->db->escape($this->entity);
$sql .= " WHERE rowid=".$this->db->escape($id);
$sql .= ", entity = ".((int) $this->entity);
$sql .= " WHERE rowid=".((int) $id);
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$result = $this->db->query($sql);
@ -1190,10 +1188,11 @@ class Contact extends CommonObject
}
/**
* Efface le contact de la base
* Delete a contact from database
* // TODO Add $user as first param
*
* @param int $notrigger Disable all trigger
* @return int <0 if KO, >0 if OK
* @param int $notrigger Disable all trigger
* @return int <0 if KO, >0 if OK
*/
public function delete($notrigger = 0)
{
@ -1221,7 +1220,7 @@ class Contact extends CommonObject
$obj = $this->db->fetch_object($resql);
$sqldel = "DELETE FROM ".MAIN_DB_PREFIX."element_contact";
$sqldel .= " WHERE rowid = ".$obj->rowid;
$sqldel .= " WHERE rowid = ".((int) $obj->rowid);
dol_syslog(__METHOD__, LOG_DEBUG);
$result = $this->db->query($sqldel);
if (!$result) {
@ -1324,7 +1323,7 @@ class Contact extends CommonObject
$sql = "SELECT c.rowid, c.datec as datec, c.fk_user_creat,";
$sql .= " c.tms as tms, c.fk_user_modif";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c";
$sql .= " WHERE c.rowid = ".$this->db->escape($id);
$sql .= " WHERE c.rowid = ".((int) $id);
$resql = $this->db->query($sql);
if ($resql) {
@ -1770,10 +1769,10 @@ class Contact extends CommonObject
$sql = "SELECT sc.fk_socpeople as id, sc.fk_c_type_contact";
$sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact tc";
$sql .= ", ".MAIN_DB_PREFIX."societe_contacts sc";
$sql .= " WHERE sc.fk_soc =".$this->socid;
$sql .= " WHERE sc.fk_soc =".((int) $this->socid);
$sql .= " AND sc.fk_c_type_contact=tc.rowid";
$sql .= " AND tc.element='".$this->db->escape($element)."'";
$sql .= " AND tc.active=1";
$sql .= " AND tc.element = '".$this->db->escape($element)."'";
$sql .= " AND tc.active = 1";
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);

View File

@ -182,7 +182,7 @@ if ($object->id) {
print dol_get_fiche_end();
$modulepart = 'contact';
$permission = $user->rights->societe->contact->creer;
$permissiontoadd = $user->rights->societe->contact->creer;
$permtoedit = $user->rights->societe->contact->creer;
$param = '&id='.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';

View File

@ -392,7 +392,7 @@ if (!$user->rights->societe->client->voir && !$socid) { //restriction
$sql .= " AND (sc.fk_user = ".$user->id." OR p.fk_soc IS NULL)";
}
if (!empty($userid)) { // propre au commercial
$sql .= " AND p.fk_user_creat=".$db->escape($userid);
$sql .= " AND p.fk_user_creat=".((int) $userid);
}
if ($search_level) {
$sql .= natural_search("p.fk_prospectcontactlevel", join(',', $search_level), 3);
@ -414,19 +414,19 @@ if ($search_priv != '0' && $search_priv != '1') {
}
if ($search_categ > 0) {
$sql .= " AND cc.fk_categorie = ".$db->escape($search_categ);
$sql .= " AND cc.fk_categorie = ".((int) $search_categ);
}
if ($search_categ == -2) {
$sql .= " AND cc.fk_categorie IS NULL";
}
if ($search_categ_thirdparty > 0) {
$sql .= " AND cs.fk_categorie = ".$db->escape($search_categ_thirdparty);
$sql .= " AND cs.fk_categorie = ".((int) $search_categ_thirdparty);
}
if ($search_categ_thirdparty == -2) {
$sql .= " AND cs.fk_categorie IS NULL";
}
if ($search_categ_supplier > 0) {
$sql .= " AND cs2.fk_categorie = ".$db->escape($search_categ_supplier);
$sql .= " AND cs2.fk_categorie = ".((int) $search_categ_supplier);
}
if ($search_categ_supplier == -2) {
$sql .= " AND cs2.fk_categorie IS NULL";
@ -495,10 +495,10 @@ if (count($search_roles) > 0) {
$sql .= " AND p.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX."societe_contacts as sc WHERE sc.fk_c_type_contact IN (".$db->sanitize(implode(',', $search_roles))."))";
}
if ($search_no_email != '' && $search_no_email >= 0) {
$sql .= " AND p.no_email = ".$db->escape($search_no_email);
$sql .= " AND p.no_email = ".((int) $search_no_email);
}
if ($search_status != '' && $search_status >= 0) {
$sql .= " AND p.statut = ".$db->escape($search_status);
$sql .= " AND p.statut = ".((int) $search_status);
}
if ($search_import_key) {
$sql .= natural_search("p.import_key", $search_import_key);

View File

@ -60,8 +60,8 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->societe->contact
$result = $object->update_perso($id, $user);
if ($result > 0) {
$object->old_name = '';
$object->old_firstname = '';
$object->oldcopy = clone $object;
// Logo/Photo save
$dir = $conf->societe->dir_output.'/contact/'.get_exdir($object->id, 0, 0, 1, $object, 'contact').'/photos';

View File

@ -3066,9 +3066,9 @@ class ContratLigne extends CommonObjectLine
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET";
$sql .= " fk_contrat=".$this->fk_contrat.",";
$sql .= " fk_contrat=".((int) $this->fk_contrat).",";
$sql .= " fk_product=".($this->fk_product ? "'".$this->db->escape($this->fk_product)."'" : 'null').",";
$sql .= " statut=".$this->statut.",";
$sql .= " statut=".((int) $this->statut).",";
$sql .= " label='".$this->db->escape($this->label)."',";
$sql .= " description='".$this->db->escape($this->description)."',";
$sql .= " date_commande=".($this->date_commande != '' ? "'".$this->db->idate($this->date_commande)."'" : "null").",";
@ -3373,11 +3373,11 @@ class ContratLigne extends CommonObjectLine
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = ".ContratLigne::STATUS_CLOSED.",";
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = ".((int) ContratLigne::STATUS_CLOSED).",";
$sql .= " date_cloture = '".$this->db->idate($date_end)."',";
$sql .= " fk_user_cloture = ".$user->id.",";
$sql .= " commentaire = '".$this->db->escape($comment)."'";
$sql .= " WHERE rowid = ".$this->id." AND statut = ".ContratLigne::STATUS_OPEN;
$sql .= " WHERE rowid = ".$this->id." AND statut = ".((int) ContratLigne::STATUS_OPEN);
$resql = $this->db->query($sql);
if ($resql) {

Some files were not shown because too many files have changed in this diff Show More