mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into add_option_pdf_global_thirdparty_alias
This commit is contained in:
commit
b4fffc6a23
|
|
@ -12,10 +12,9 @@ NEW: Online proposal signature
|
|||
NEW: Can define some max limit on expense report (per period, per type or expense, ...)
|
||||
NEW: Allow the use of __NEWREF__ to get for example the new reference a draft order will get after validation.
|
||||
NEW: Add option to disable globaly some notifications emails.
|
||||
NEW: #18326 Workflow: Close order on shipment closing.
|
||||
NEW: #18401 Add __NEWREF__ subtitute to get new object reference.
|
||||
NEW: #18403 Add __URL_SHIPMENT__ substitute to get the URL of a shipment
|
||||
NEW: #18689 REST API module: add api key generate / modify pemrission.
|
||||
NEW: #18689 REST API module: add api key generate / modify permission.
|
||||
NEW: #18663 Make "L'Annuaire des Entreprises" the default provider for SIREN verification for French thirdparties.
|
||||
NEW: #18046 Add tags on ticket/categories
|
||||
NEW: #18326 Workflow: Close order on shipment closing.
|
||||
|
|
|
|||
|
|
@ -1,62 +1,93 @@
|
|||
<VirtualHost *:80>
|
||||
#php_admin_value sendmail_path "/usr/sbin/sendmail -t -i"
|
||||
#php_admin_value mail.force_extra_parameters "-f postmaster@mydomain.com"
|
||||
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com"
|
||||
php_admin_value open_basedir /tmp/:/home/../htdocs
|
||||
#php_admin_value sendmail_path "/usr/sbin/sendmail -t -i"
|
||||
#php_admin_value mail.force_extra_parameters "-f postmaster@mydomain.com"
|
||||
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com"
|
||||
php_admin_value open_basedir /tmp/:/home/.../htdocs:/home/.../dolibarr_documents:
|
||||
|
||||
ServerName myvirtualalias
|
||||
ServerAlias myvirtualalias
|
||||
|
||||
UseCanonicalName On
|
||||
|
||||
KeepAlive On
|
||||
KeepAliveTimeout 5
|
||||
MaxKeepAliveRequests 20
|
||||
|
||||
AddDefaultCharset UTF-8
|
||||
|
||||
DocumentRoot "/home/.../htdocs"
|
||||
|
||||
<Directory /home/.../htdocs/>
|
||||
AllowOverride None
|
||||
Options -Indexes -MultiViews +FollowSymLinks -ExecCGI
|
||||
Require all granted
|
||||
|
||||
ServerName myvirtualalias
|
||||
ServerAlias myvirtualalias
|
||||
# To restrict access by a HTTP basic auth
|
||||
#AuthType Basic
|
||||
#AuthName "Authenticate to backoffice"
|
||||
#AuthUserFile /etc/apache2/.htpasswd
|
||||
#require valid-user
|
||||
</Directory>
|
||||
|
||||
# Leaving /public and /api, /dav, .well_known but also wrappers for document and viewimage accessible to everyone
|
||||
<Directory /home/admin/wwwroot/dolibarr/htdocs/public/>
|
||||
AuthType None
|
||||
Require all granted
|
||||
Satisfy any
|
||||
</Directory>
|
||||
<Directory /home/admin/wwwroot/dolibarr/htdocs/api/>
|
||||
AuthType None
|
||||
Require all granted
|
||||
Satisfy any
|
||||
</Directory>
|
||||
<Directory /home/admin/wwwroot/dolibarr/htdocs/dav/>
|
||||
AuthType None
|
||||
Require all granted
|
||||
Satisfy any
|
||||
</Directory>
|
||||
<Directory /home/admin/wwwroot/dolibarr/htdocs/.well-known/>
|
||||
AuthType None
|
||||
Require all granted
|
||||
Satisfy any
|
||||
</Directory>
|
||||
<Files ~ "(document\.php|viewimage\.php|\.js\.php|\.json\.php|\.js|\.css\.php|\.css|\.gif|\.png|\.svg|\.woff2|favicon\.ico)$">
|
||||
AuthType None
|
||||
Require all granted
|
||||
Satisfy any
|
||||
</Files>
|
||||
|
||||
UseCanonicalName On
|
||||
|
||||
AddDefaultCharset UTF-8
|
||||
|
||||
DocumentRoot "/home/.../htdocs"
|
||||
|
||||
<Directory /home/.../htdocs/>
|
||||
AllowOverride None
|
||||
Options -Indexes -MultiViews +FollowSymLinks -ExecCGI
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
<Directory "/home/../htdocs/cache">
|
||||
Deny from all
|
||||
RemoveHandler .phtml .php .php3 .php4 .php5 .php6 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml
|
||||
AddType application/x-httpd-php-source .phtml .php .php3 .php4 .php5 .php6 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml
|
||||
</Directory>
|
||||
|
||||
|
||||
ErrorLog /var/log/apache2/myvirtualalias_error_log
|
||||
TransferLog /var/log/apache2/myvirtualalias_access_log
|
||||
|
||||
# Compress returned resources of type php pages, text file export, css and javascript
|
||||
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
|
||||
|
||||
AddType text/javascript .jgz
|
||||
AddEncoding gzip .jgz
|
||||
ExpiresActive On
|
||||
ExpiresByType image/x-icon A2592000
|
||||
ExpiresByType image/gif A2592000
|
||||
ExpiresByType image/png A2592000
|
||||
ExpiresByType image/jpeg A2592000
|
||||
ExpiresByType text/css A2592000
|
||||
ExpiresByType text/javascript A2592000
|
||||
ExpiresByType application/x-javascript A2592000
|
||||
ExpiresByType application/javascript A2592000
|
||||
|
||||
SSLEngine On
|
||||
|
||||
# A self-signed (snakeoil) certificate can be created by installing
|
||||
# the ssl-cert package. See
|
||||
# /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
|
||||
# If both key and certificate are stored in the same file, only the
|
||||
# SSLCertificateFile directive is needed.
|
||||
SSLCertificateFile /etc/letsencrypt/live/www.mydomain.com/cert.pem
|
||||
SSLCertificateKeyFile /etc/letsencrypt/live/www.mydomain.com/privkey.pem
|
||||
SSLCertificateChainFile /etc/letsencrypt/live/www.mydomain.com/chain.pem
|
||||
|
||||
#RewriteEngine on
|
||||
#RewriteCond %{SERVER_PORT} ^80$
|
||||
#RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]
|
||||
|
||||
ErrorLog /var/log/apache2/myvirtualalias_error_log
|
||||
TransferLog /var/log/apache2/myvirtualalias_access_log
|
||||
|
||||
# Compress returned resources of type php pages, text file export, css and javascript
|
||||
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
|
||||
|
||||
AddType text/javascript .jgz
|
||||
AddEncoding gzip .jgz
|
||||
ExpiresActive On
|
||||
ExpiresByType image/x-icon A2592000
|
||||
ExpiresByType image/gif A2592000
|
||||
ExpiresByType image/png A2592000
|
||||
ExpiresByType image/jpeg A2592000
|
||||
ExpiresByType text/css A2592000
|
||||
ExpiresByType text/javascript A2592000
|
||||
ExpiresByType application/x-javascript A2592000
|
||||
ExpiresByType application/javascript A2592000
|
||||
|
||||
SSLEngine On
|
||||
|
||||
# A self-signed (snakeoil) certificate can be created by installing
|
||||
# the ssl-cert package. See
|
||||
# /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
|
||||
# If both key and certificate are stored in the same file, only the
|
||||
# SSLCertificateFile directive is needed.
|
||||
SSLCertificateFile /etc/letsencrypt/live/www.mydomain.com/cert.pem
|
||||
SSLCertificateKeyFile /etc/letsencrypt/live/www.mydomain.com/privkey.pem
|
||||
SSLCertificateChainFile /etc/letsencrypt/live/www.mydomain.com/chain.pem
|
||||
|
||||
#RewriteEngine on
|
||||
#RewriteCond %{SERVER_PORT} ^80$
|
||||
#RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]
|
||||
|
||||
</VirtualHost>
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ llxHeader('', $langs->trans("Setup"), $wikihelp);
|
|||
|
||||
print load_fiche_titre($langs->trans("SetupArea"), '', 'tools');
|
||||
|
||||
|
||||
if (!empty($conf->global->MAIN_MOTD_SETUPPAGE)) {
|
||||
$conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $conf->global->MAIN_MOTD_SETUPPAGE);
|
||||
if (!empty($conf->global->MAIN_MOTD_SETUPPAGE)) {
|
||||
|
|
@ -76,12 +77,15 @@ print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySet
|
|||
print "<br><br>";
|
||||
print '</span>';
|
||||
|
||||
print '<br><br>';
|
||||
print '<br>';
|
||||
|
||||
// Show info setup company
|
||||
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) {
|
||||
$setupcompanynotcomplete = 1;
|
||||
}
|
||||
|
||||
print '<section class="setupsection">';
|
||||
|
||||
print img_picto('', 'company', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit&token='.newToken()), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup"));
|
||||
print '<br><br>';
|
||||
print $langs->trans("SetupDescription3b");
|
||||
|
|
@ -90,10 +94,13 @@ if (!empty($setupcompanynotcomplete)) {
|
|||
$warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
|
||||
print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit').'">'.$warnpicto.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>';
|
||||
}
|
||||
|
||||
print '</section>';
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<section class="setupsection">';
|
||||
|
||||
// Show info setup module
|
||||
print img_picto('', 'cog', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules"));
|
||||
|
|
@ -103,7 +110,9 @@ if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FO
|
|||
$warnpicto = img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"');
|
||||
print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$warnpicto.$langs->trans("WarningEnableYourModulesApplications").'</a></div>';
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
print '</section>';
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
|
|
|||
|
|
@ -246,11 +246,14 @@ if ($reshook == 0) {
|
|||
}
|
||||
}
|
||||
|
||||
$permissiontoadd = 1;
|
||||
|
||||
//asort($elementList);
|
||||
|
||||
$id = 25;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
|
@ -338,6 +341,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
$action = 'add';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -411,6 +415,7 @@ if (empty($reshook)) {
|
|||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
$action = 'add';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -489,6 +494,7 @@ if (empty($reshook)) {
|
|||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($db->error(), null, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -515,7 +521,7 @@ if (empty($reshook)) {
|
|||
if ($action == $acts[0]) {
|
||||
$rowidcol = "rowid";
|
||||
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."=".((int) $rowid);
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE rowid = ".((int) $rowid);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
|
|
@ -527,7 +533,7 @@ if (empty($reshook)) {
|
|||
if ($action == $acts[1]) {
|
||||
$rowidcol = "rowid";
|
||||
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."=".((int) $rowid);
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE rowid = ".((int) $rowid);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
|
|
@ -545,18 +551,38 @@ $form = new Form($db);
|
|||
$formadmin = new FormAdmin($db);
|
||||
|
||||
$help_url = '';
|
||||
$title = $langs->trans("EMailsSetup");
|
||||
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
|
||||
$title = $langs->trans("EMailsSetup");
|
||||
} else {
|
||||
$title = $langs->trans("EMailsTemplates");
|
||||
}
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$linkback = '';
|
||||
$titlepicto = 'title_setup';
|
||||
|
||||
print load_fiche_titre($title, $linkback, $titlepicto);
|
||||
|
||||
$head = email_admin_prepare_head();
|
||||
$url = DOL_URL_ROOT.'/admin/mails_templates.php?action=add';
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('NewEMailTemplate'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
|
||||
|
||||
|
||||
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
|
||||
print load_fiche_titre($title, '', $titlepicto);
|
||||
} else {
|
||||
print load_fiche_titre($title, $newcardbutton, $titlepicto);
|
||||
}
|
||||
|
||||
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
|
||||
$head = email_admin_prepare_head();
|
||||
|
||||
print dol_get_fiche_head($head, 'templates', '', -1);
|
||||
|
||||
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
|
||||
print load_fiche_titre('', $newcardbutton, '');
|
||||
}
|
||||
}
|
||||
|
||||
print dol_get_fiche_head($head, 'templates', '', -1);
|
||||
|
||||
// Confirmation de la suppression de la ligne
|
||||
if ($action == 'delete') {
|
||||
|
|
@ -599,7 +625,7 @@ $sql .= $db->plimit($listlimit + 1, $offset);
|
|||
|
||||
$fieldlist = explode(',', $tabfield[$id]);
|
||||
|
||||
if ($action == 'view') {
|
||||
if ($action == 'add') {
|
||||
// Form to add a new line
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
|
@ -750,7 +776,8 @@ if ($action == 'view') {
|
|||
if ($tmpfieldlist == 'topic') {
|
||||
print '<td class="center" rowspan="'.(count($fieldsforcontent)).'">';
|
||||
if ($action != 'edit') {
|
||||
print '<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans("Add").'">';
|
||||
print '<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans("Add").'"><br>';
|
||||
print '<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
|
@ -1142,7 +1169,10 @@ print '</div>';
|
|||
print '</form>';
|
||||
|
||||
|
||||
print dol_get_fiche_end();
|
||||
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
|
||||
print dol_get_fiche_end();
|
||||
}
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
|
|
|||
|
|
@ -96,9 +96,9 @@ if ($action == 'update') {
|
|||
dolibarr_set_const($db, "MAIN_PDF_NO_RECIPENT_FRAME", GETPOST("MAIN_PDF_NO_RECIPENT_FRAME"), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
if (GETPOSTISSET('MAIN_PDF_HIDE_SENDER_NAME')) {
|
||||
/*if (GETPOSTISSET('MAIN_PDF_HIDE_SENDER_NAME')) {
|
||||
dolibarr_set_const($db, "MAIN_PDF_HIDE_SENDER_NAME", GETPOST("MAIN_PDF_HIDE_SENDER_NAME"), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
}*/
|
||||
|
||||
if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) {
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", GETPOST("MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"), 'chaine', 0, '', $conf->entity);
|
||||
|
|
@ -315,6 +315,18 @@ print '<div class="div-table-responsive-no-min">';
|
|||
print '<table summary="more" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
// Show sender name
|
||||
|
||||
/* Set option as hidden because no need of this for 99.99% of users.
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_HIDE_SENDER_NAME").'</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_PDF_HIDE_SENDER_NAME');
|
||||
} else {
|
||||
print $form->selectyesno('MAIN_PDF_HIDE_SENDER_NAME', (!empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) ? $conf->global->MAIN_PDF_HIDE_SENDER_NAME : 0, 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
// Hide VAT Intra on address
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td>';
|
||||
|
|
@ -366,16 +378,6 @@ if ($conf->use_javascript_ajax) {
|
|||
print $form->selectarray("MAIN_PDF_NO_RECIPENT_FRAME", $arrval, $conf->global->MAIN_PDF_NO_RECIPENT_FRAME);
|
||||
}
|
||||
|
||||
// Show sender name
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_HIDE_SENDER_NAME").'</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_PDF_HIDE_SENDER_NAME');
|
||||
} else {
|
||||
print $form->selectyesno('MAIN_PDF_HIDE_SENDER_NAME', (!empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) ? $conf->global->MAIN_PDF_HIDE_SENDER_NAME : 0, 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
//Invert sender and recipient
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("SwapSenderAndRecipientOnPDF").'</td><td>';
|
||||
|
|
@ -514,22 +516,6 @@ if ($conf->use_javascript_ajax) {
|
|||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("BoldLabelOnPDF").'</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('PDF_BOLD_PRODUCT_LABEL');
|
||||
} else {
|
||||
print $form->selectyesno('PDF_BOLD_PRODUCT_LABEL', (!empty($conf->global->PDF_BOLD_PRODUCT_LABEL)) ? $conf->global->PDF_BOLD_PRODUCT_LABEL : 0, 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("BoldRefAndPeriodOnPDF").'</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('PDF_BOLD_PRODUCT_REF_AND_PERIOD');
|
||||
} else {
|
||||
print $form->selectyesno('PDF_BOLD_PRODUCT_REF_AND_PERIOD', (!empty($conf->global->PDF_BOLD_PRODUCT_REF_AND_PERIOD)) ? $conf->global->PDF_BOLD_PRODUCT_REF_AND_PERIOD : 0, 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Desc
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
|
||||
|
|
@ -550,6 +536,26 @@ if ($conf->use_javascript_ajax) {
|
|||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Swicth in Bold
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("BoldLabelOnPDF").'</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('PDF_BOLD_PRODUCT_LABEL');
|
||||
} else {
|
||||
print $form->selectyesno('PDF_BOLD_PRODUCT_LABEL', (!empty($conf->global->PDF_BOLD_PRODUCT_LABEL)) ? $conf->global->PDF_BOLD_PRODUCT_LABEL : 0, 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Swicth in Bold
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("BoldRefAndPeriodOnPDF").'</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('PDF_BOLD_PRODUCT_REF_AND_PERIOD');
|
||||
} else {
|
||||
print $form->selectyesno('PDF_BOLD_PRODUCT_REF_AND_PERIOD', (!empty($conf->global->PDF_BOLD_PRODUCT_REF_AND_PERIOD)) ? $conf->global->PDF_BOLD_PRODUCT_REF_AND_PERIOD : 0, 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// SHOW_SUBPRODUCT_REF_IN_PDF - Option to show the detail of product ref for kits.
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("SHOW_SUBPRODUCT_REF_IN_PDF", $langs->transnoentitiesnoconv("AssociatedProductsAbility"), $langs->transnoentitiesnoconv("Products")).'</td><td>';
|
||||
|
|
|
|||
|
|
@ -320,12 +320,12 @@ class BlockedLog
|
|||
$this->error++;
|
||||
}
|
||||
} elseif ($this->action == 'MODULE_SET') {
|
||||
return '<i class="opacitymedium">System to track events into unalterable logs were enabled</i>';
|
||||
return '<i class="opacitymedium">'.$langs->trans("BlockedLogEnabled").'</i>';
|
||||
} elseif ($this->action == 'MODULE_RESET') {
|
||||
if ($this->signature == '0000000000') {
|
||||
return '<i class="opacitymedium">System to track events into unalterable logs were disabled after some recording were done. We saved a special Fingerprint to track the chain as broken.</i>';
|
||||
return '<i class="opacitymedium">'.$langs->trans("BlockedLogDisabled").'</i>';
|
||||
} else {
|
||||
return '<i class="opacitymedium">System to track events into unalterable logs were disabled. This is possible because no record were done yet.</i>';
|
||||
return '<i class="opacitymedium">'.$langs->trans("BlockedLogDisabledBis").'</i>';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -148,8 +148,17 @@ if (empty($reshook)) {
|
|||
$error = 0;
|
||||
|
||||
// Set if we used free entry or predefined product
|
||||
$idprod = (int) GETPOST('idprod', 'int');
|
||||
$bom_child = (int) GETPOST('bom_select', 'int');
|
||||
$bom_child_id = (int) GETPOST('bom_id', 'int');
|
||||
if ($bom_child_id > 0) {
|
||||
$bom_child = new BOM($db);
|
||||
$res = $bom_child->fetch($bom_child_id);
|
||||
if ($res) {
|
||||
$idprod = $bom_child->fk_product;
|
||||
}
|
||||
} else {
|
||||
$idprod = (int) GETPOST('idprod', 'int');
|
||||
}
|
||||
|
||||
$qty = price2num(GETPOST('qty', 'alpha'), 'MS');
|
||||
$qty_frozen = price2num(GETPOST('qty_frozen', 'alpha'), 'MS');
|
||||
$disable_stock_change = GETPOST('disable_stock_change', 'int');
|
||||
|
|
@ -173,7 +182,7 @@ if (empty($reshook)) {
|
|||
$bomline = new BOMLine($db);
|
||||
$bomline->fk_bom = $id;
|
||||
$bomline->fk_product = $idprod;
|
||||
$bomline->fk_bom_child = $bom_child;
|
||||
$bomline->fk_bom_child = $bom_child_id;
|
||||
$bomline->qty = $qty;
|
||||
$bomline->qty_frozen = (int) $qty_frozen;
|
||||
$bomline->disable_stock_change = (int) $disable_stock_change;
|
||||
|
|
@ -580,13 +589,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
$(".collapse_bom").click(function() {
|
||||
console.log("We click on collapse");
|
||||
var id_bom_line = $(this).attr('id').replace('collapse-', '');
|
||||
if($(this).text().indexOf('+') > 0) {
|
||||
console.log($(this).html().indexOf('folder-open'));
|
||||
if($(this).html().indexOf('folder-open') <= 0) {
|
||||
$('[parentid="'+ id_bom_line +'"]').show();
|
||||
$(this).html('(-) ');
|
||||
$(this).html('<?php echo dol_escape_js(img_picto('', 'folder-open')); ?>');
|
||||
}
|
||||
else {
|
||||
$('[parentid="'+ id_bom_line +'"]').hide();
|
||||
$(this).html('(+) ');
|
||||
$(this).html('<?php echo dol_escape_js(img_picto('', 'folder')); ?>');
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -596,7 +606,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
$("#show_all").click(function() {
|
||||
console.log("We click on show all");
|
||||
$("[class^=sub_bom_lines]").show();
|
||||
$("[class^=collapse_bom]").html('(-) ');
|
||||
$("[class^=collapse_bom]").html('<?php echo dol_escape_js(img_picto('', 'folder-open')); ?>');
|
||||
return false;
|
||||
});
|
||||
|
||||
|
|
@ -604,7 +614,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
$("#hide_all").click(function() {
|
||||
console.log("We click on hide all");
|
||||
$("[class^=sub_bom_lines]").hide();
|
||||
$("[class^=collapse_bom]").html('(+) ');
|
||||
$("[class^=collapse_bom]").html('<?php echo dol_escape_js(img_picto('', 'folder')); ?>');
|
||||
return false;
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1064,26 +1064,40 @@ class BOM extends CommonObject
|
|||
$tmpproduct->cost_price = 0;
|
||||
$tmpproduct->pmp = 0;
|
||||
|
||||
$result = $tmpproduct->fetch($line->fk_product, '', '', '', 0, 1, 1); // We discard selling price and language loading
|
||||
if ($result < 0) {
|
||||
$this->error = $tmpproduct->error;
|
||||
return -1;
|
||||
}
|
||||
$line->unit_cost = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp);
|
||||
if (empty($line->unit_cost)) {
|
||||
if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0) {
|
||||
$line->unit_cost = $productFournisseur->fourn_unitprice;
|
||||
if (empty($line->fk_bom_child)) {
|
||||
$result = $tmpproduct->fetch($line->fk_product, '', '', '', 0, 1, 1); // We discard selling price and language loading
|
||||
if ($result < 0) {
|
||||
$this->error = $tmpproduct->error;
|
||||
return -1;
|
||||
}
|
||||
$line->unit_cost = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp);
|
||||
if (empty($line->unit_cost)) {
|
||||
if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0) {
|
||||
$line->unit_cost = $productFournisseur->fourn_unitprice;
|
||||
}
|
||||
}
|
||||
|
||||
$line->total_cost = price2num($line->qty * $line->unit_cost, 'MT');
|
||||
|
||||
$this->total_cost += $line->total_cost;
|
||||
} else {
|
||||
$bom_child= new BOM($this->db);
|
||||
$res = $bom_child->fetch($line->fk_bom_child);
|
||||
if ($res>0) {
|
||||
$bom_child->calculateCosts();
|
||||
$this->total_cost += $bom_child->total_cost;
|
||||
} else {
|
||||
$this->error = $bom_child->error;
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
$line->total_cost = price2num($line->qty * $line->unit_cost, 'MT');
|
||||
|
||||
$this->total_cost += $line->total_cost;
|
||||
}
|
||||
|
||||
$this->total_cost = price2num($this->total_cost, 'MT');
|
||||
if ($this->qty) {
|
||||
if ($this->qty > 0) {
|
||||
$this->unit_cost = price2num($this->total_cost / $this->qty, 'MU');
|
||||
} elseif ($this->qty < 0) {
|
||||
$this->unit_cost = price2num($this->total_cost * $this->qty, 'MU');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
|
|||
if (!empty($conf->global->BOM_SUB_BOM)) {
|
||||
print '<br><span class="opacitymedium">'.$langs->trans("or").'</span><br>'.$langs->trans("BOM");
|
||||
// TODO Add component to select a BOM
|
||||
print '<select id="bom_select" name="bom_select"><option value="-1">TODO</option></select>';
|
||||
$form->select_bom();
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ if (empty($object) || !is_object($object)) {
|
|||
}
|
||||
|
||||
|
||||
global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax;
|
||||
global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax, $langs;
|
||||
|
||||
if (empty($dateSelector)) {
|
||||
$dateSelector = 0;
|
||||
|
|
@ -83,8 +83,12 @@ $tmpproduct->fetch($line->fk_product);
|
|||
$tmpbom = new BOM($object->db);
|
||||
$res = $tmpbom->fetch($line->fk_bom_child);
|
||||
if ($tmpbom->id > 0) {
|
||||
print $tmpproduct->getNomUrl(1);
|
||||
print ' '.$langs->trans("or").' ';
|
||||
print $tmpbom->getNomUrl(1);
|
||||
print '<a class="collapse_bom" id="collapse-'.$line->id.'" href="#">' . (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? '(+)' : '(-)') . ' </a>';
|
||||
print ' <a class="collapse_bom" id="collapse-'.$line->id.'" href="#">';
|
||||
print (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? img_picto('', 'folder') : img_picto('', 'folder-open'));
|
||||
print '</a>';
|
||||
} else {
|
||||
print $tmpproduct->getNomUrl(1);
|
||||
print ' - '.$tmpproduct->label;
|
||||
|
|
@ -176,7 +180,7 @@ if ($action == 'selectlines') {
|
|||
print '</tr>';
|
||||
|
||||
// Select of all the sub-BOM lines
|
||||
$sql = 'SELECT rowid, fk_bom_child, fk_product FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl';
|
||||
$sql = 'SELECT rowid, fk_bom_child, fk_product, qty FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl';
|
||||
$sql.= ' WHERE fk_bom ='. (int) $tmpbom->id;
|
||||
$resql = $object->db->query($sql);
|
||||
|
||||
|
|
@ -199,21 +203,23 @@ if ($resql) {
|
|||
print '<tr class="sub_bom_lines" parentid="'.$line->id.'">';
|
||||
}
|
||||
|
||||
// Product
|
||||
print '<td style="padding-left: 5%" id="sub_bom_product_'.$sub_bom_line->id.'">'.$sub_bom_product->getNomUrl(1).'</td>';
|
||||
|
||||
// Sub-BOM
|
||||
if ($sub_bom_line->fk_bom_child > 0) {
|
||||
print '<td id="sub_bom_bom_'.$sub_bom_line->id.'">'.$sub_bom->getNomUrl(1).'</td>';
|
||||
// Product OR BOM
|
||||
print '<td style="padding-left: 5%" id="sub_bom_product_'.$sub_bom_line->id.'">';
|
||||
if (!empty($obj->fk_bom_child)) {
|
||||
print $sub_bom_product->getNomUrl(1);
|
||||
print ' '.$langs->trans('or').' ';
|
||||
print $sub_bom->getNomUrl(1);
|
||||
} else {
|
||||
print '<td id="sub_bom_bom_'.$sub_bom_line->id.'"> </td>';
|
||||
print $sub_bom_product->getNomUrl(1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Qty
|
||||
print '<td class="linecolqty nowrap right" id="sub_bom_qty_'.$sub_bom_line->id.'">'.price($sub_bom_line->qty * $line->qty, 0, '', 0, 0).'</td>';
|
||||
if ($sub_bom_line->qty_frozen > 0) {
|
||||
print '<td class="linecolqtyfrozen nowrap right" id="sub_bom_qty_frozen_'.$sub_bom_line->id.'">'.$sub_bom_line->qty_frozen.'</td>';
|
||||
print '<td class="linecolqty nowrap right" id="sub_bom_qty_'.$sub_bom_line->id.'">'.price($sub_bom_line->qty, 0, '', 0, 0).'</td>';
|
||||
print '<td class="linecolqtyfrozen nowrap right" id="sub_bom_qty_frozen_'.$sub_bom_line->id.'">'.$langs->trans('Yes').'</td>';
|
||||
} else {
|
||||
print '<td class="linecolqty nowrap right" id="sub_bom_qty_'.$sub_bom_line->id.'">'.price($sub_bom_line->qty * $line->qty, 0, '', 0, 0).'</td>';
|
||||
print '<td class="linecolqtyfrozen nowrap right" id="sub_bom_qty_frozen_'.$sub_bom_line->id.'"> </td>';
|
||||
}
|
||||
|
||||
|
|
@ -230,18 +236,20 @@ if ($resql) {
|
|||
// Cost price if it's defined
|
||||
if ($sub_bom_product->cost_price > 0) {
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->cost_price * $line->qty).'</td>';
|
||||
$total_cost.= $sub_bom_product->cost_price * $line->qty;
|
||||
$total_cost+= $sub_bom_product->cost_price * $line->qty;
|
||||
} elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->pmp * $line->qty).'</td>';
|
||||
$total_cost.= $sub_bom_product->pmp * $line->qty;
|
||||
} else { // Minimum purchase price if cost price and PMP aren't defined
|
||||
$sql_supplier_price = 'SELECT MIN(price) AS min_price FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
|
||||
$sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
|
||||
$sql_supplier_price.= ' WHERE fk_product = '. (int) $sub_bom_product->id;
|
||||
$resql_supplier_price = $object->db->query($sql_supplier_price);
|
||||
if ($resql_supplier_price) {
|
||||
$obj = $object->db->fetch_object($resql_supplier_price);
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($obj->min_price * $line->qty).'</td>';
|
||||
$total_cost+= $obj->min_price * $line->qty;
|
||||
$line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty;
|
||||
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($line_cost).'</td>';
|
||||
$total_cost+= $line_cost;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ if (empty($reshook) && $action == 'add') {
|
|||
if (!$error) {
|
||||
// Initialisation objet actioncomm
|
||||
$object->priority = GETPOSTISSET("priority") ? GETPOST("priority", "int") : 0;
|
||||
$object->fulldayevent = (!empty($fulldayevent) ? 1 : 0);
|
||||
$object->fulldayevent = ($fulldayevent ? 1 : 0);
|
||||
$object->location = GETPOST("location", 'alphanohtml');
|
||||
$object->label = GETPOST('label', 'alphanohtml');
|
||||
|
||||
|
|
@ -1960,7 +1960,7 @@ if ($id > 0) {
|
|||
}
|
||||
|
||||
// Full day event
|
||||
print '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td>'.yn($object->fulldayevent, 3).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td>'.yn($object->fulldayevent ? 1 : 0, 3).'</td></tr>';
|
||||
|
||||
$rowspan = 4;
|
||||
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
|
||||
|
|
@ -1969,7 +1969,7 @@ if ($id > 0) {
|
|||
|
||||
// Date start
|
||||
print '<tr><td>'.$langs->trans("DateActionStart").'</td><td>';
|
||||
if (!$object->fulldayevent) {
|
||||
if (empty($object->fulldayevent)) {
|
||||
print dol_print_date($object->datep, 'dayhour', 'tzuser');
|
||||
} else {
|
||||
print dol_print_date($object->datep, 'day', 'tzuser');
|
||||
|
|
@ -1982,7 +1982,7 @@ if ($id > 0) {
|
|||
|
||||
// Date end
|
||||
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td>';
|
||||
if (!$object->fulldayevent) {
|
||||
if (empty($object->fulldayevent)) {
|
||||
print dol_print_date($object->datef, 'dayhour', 'tzuser');
|
||||
} else {
|
||||
print dol_print_date($object->datef, 'day', 'tzuser');
|
||||
|
|
|
|||
|
|
@ -555,7 +555,11 @@ class ActionComm extends CommonObject
|
|||
$sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", ";
|
||||
$sql .= ($userownerid > 0 ? $userownerid : "null").", ";
|
||||
$sql .= ($userdoneid > 0 ? $userdoneid : "null").", ";
|
||||
$sql .= "'".$this->db->escape($this->label)."','".$this->db->escape($this->percentage)."','".$this->db->escape($this->priority)."','".$this->db->escape($this->fulldayevent)."','".$this->db->escape($this->location)."', ";
|
||||
$sql .= "'".$this->db->escape($this->label)."', ";
|
||||
$sql .= "'".$this->db->escape($this->percentage)."', ";
|
||||
$sql .= "'".$this->db->escape($this->priority)."', ";
|
||||
$sql .= "'".$this->db->escape($this->fulldayevent)."', ";
|
||||
$sql .= "'".$this->db->escape($this->location)."', ";
|
||||
$sql .= "'".$this->db->escape($this->transparency)."', ";
|
||||
$sql .= (!empty($this->fk_element) ? ((int) $this->fk_element) : "null").", ";
|
||||
$sql .= (!empty($this->elementtype) ? "'".$this->db->escape($this->elementtype)."'" : "null").", ";
|
||||
|
|
|
|||
|
|
@ -194,11 +194,11 @@ if ($object->id > 0) {
|
|||
}
|
||||
|
||||
// Full day event
|
||||
print '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($object->fulldayevent, 3).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($object->fulldayevent ? 1 : 0, 3).'</td></tr>';
|
||||
|
||||
// Date start
|
||||
print '<tr><td>'.$langs->trans("DateActionStart").'</td><td colspan="3">';
|
||||
if (!$object->fulldayevent) {
|
||||
if (empty($object->fulldayevent)) {
|
||||
print dol_print_date($object->datep, 'dayhour', 'tzuser');
|
||||
} else {
|
||||
print dol_print_date($object->datep, 'day', 'tzuser');
|
||||
|
|
@ -211,7 +211,7 @@ if ($object->id > 0) {
|
|||
|
||||
// Date end
|
||||
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="3">';
|
||||
if (!$object->fulldayevent) {
|
||||
if (empty($object->fulldayevent)) {
|
||||
print dol_print_date($object->datef, 'dayhour', 'tzuser');
|
||||
} else {
|
||||
print dol_print_date($object->datef, 'day', 'tzuser');
|
||||
|
|
|
|||
|
|
@ -310,6 +310,8 @@ if ($object->fetch($id) >= 0) {
|
|||
print load_fiche_titre($langs->trans("ToAddRecipientsChooseHere"), ($user->admin ?info_admin($langs->trans("YouCanAddYourOwnPredefindedListHere"), 1) : ''), 'generic');
|
||||
|
||||
//print '<table class="noborder centpercent">';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<div class="tagtable centpercent liste_titre_bydiv borderbottom" id="tablelines">';
|
||||
|
||||
//print '<tr class="liste_titre">';
|
||||
|
|
@ -323,7 +325,7 @@ if ($object->fetch($id) >= 0) {
|
|||
//print '<td class="liste_titre" align="center"> </td>';
|
||||
print '<div class="tagtd"> </div>';
|
||||
//print "</tr>\n";
|
||||
print '</div>';
|
||||
print '</div>'; // End tr
|
||||
|
||||
clearstatcache();
|
||||
|
||||
|
|
@ -424,9 +426,9 @@ if ($object->fetch($id) >= 0) {
|
|||
|
||||
print '<div class="tagtd right">';
|
||||
if ($allowaddtarget) {
|
||||
print '<input type="submit" class="button button-add" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
|
||||
print '<input type="submit" class="button button-add small" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
|
||||
} else {
|
||||
print '<input type="submit" class="button disabled" disabled="disabled" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
|
||||
print '<input type="submit" class="button small disabled" disabled="disabled" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
|
||||
//print $langs->trans("MailNoChangePossible");
|
||||
print " ";
|
||||
}
|
||||
|
|
@ -445,6 +447,7 @@ if ($object->fetch($id) >= 0) {
|
|||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</div>'; // End table
|
||||
print '</div>';
|
||||
|
||||
print '<br><br>';
|
||||
|
|
@ -535,7 +538,7 @@ if ($object->fetch($id) >= 0) {
|
|||
|
||||
$morehtmlcenter = '';
|
||||
if ($allowaddtarget) {
|
||||
$morehtmlcenter = '<span class="opacitymedium">'.$langs->trans("ToClearAllRecipientsClickHere").'</span> <a href="'.$_SERVER["PHP_SELF"].'?clearlist=1&id='.$object->id.'" class="button reposition smallpaddingimp">'.$langs->trans("TargetsReset").'</a>';
|
||||
$morehtmlcenter = '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ToClearAllRecipientsClickHere").'</span> <a href="'.$_SERVER["PHP_SELF"].'?clearlist=1&id='.$object->id.'" class="button reposition smallpaddingimp">'.$langs->trans("TargetsReset").'</a>';
|
||||
}
|
||||
$morehtmlcenter .= ' <a class="reposition" href="'.$_SERVER["PHP_SELF"].'?exportcsv=1&id='.$object->id.'">'.$langs->trans("Download").'</a>';
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
if (!empty($conf->margin->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php';
|
||||
}
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
|
|
@ -223,6 +226,10 @@ $arrayfields = array(
|
|||
'p.multicurrency_total_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedTTC', 'checked'=>0, 'enabled'=>!empty($conf->multicurrency->enabled) && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10),
|
||||
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>-1),
|
||||
'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
|
||||
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
|
||||
'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)),
|
||||
'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
||||
'p.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
||||
'p.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500),
|
||||
|
|
@ -486,6 +493,10 @@ $form = new Form($db);
|
|||
$formother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
$formpropal = new FormPropal($db);
|
||||
$formmargin = null;
|
||||
if (!empty($conf->margin->enabled)) {
|
||||
$formmargin = new FormMargin($db);
|
||||
}
|
||||
$companystatic = new Societe($db);
|
||||
$projectstatic = new Project($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
|
|
@ -1244,6 +1255,22 @@ if ($resql) {
|
|||
if (!empty($arrayfields['sale_representative']['checked'])) {
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
if (!empty($arrayfields['total_pa']['checked'])) {
|
||||
print '<td class="liste_titre right">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['total_margin']['checked'])) {
|
||||
print '<td class="liste_titre right">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['total_margin_rate']['checked'])) {
|
||||
print '<td class="liste_titre right">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['total_mark_rate']['checked'])) {
|
||||
print '<td class="liste_titre right">';
|
||||
print '</td>';
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
|
||||
|
|
@ -1392,6 +1419,18 @@ if ($resql) {
|
|||
if (!empty($arrayfields['sale_representative']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['total_pa']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['total_pa']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['total_margin']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['total_margin']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['total_margin_rate']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['total_margin_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['total_mark_rate']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['total_mark_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
}
|
||||
$totalarray = array(
|
||||
'nbfield' => 0,
|
||||
'val' => array(
|
||||
|
|
@ -1437,6 +1476,17 @@ if ($resql) {
|
|||
$i = 0;
|
||||
$typenArray = null;
|
||||
|
||||
$with_margin_info = false;
|
||||
if (!empty($conf->margin->enabled) && (
|
||||
!empty($arrayfields['total_pa']['checked'])
|
||||
|| !empty($arrayfields['total_margin']['checked'])
|
||||
|| !empty($arrayfields['total_margin_rate']['checked'])
|
||||
|| !empty($arrayfields['total_mark_rate']['checked'])
|
||||
)
|
||||
) {
|
||||
$with_margin_info = true;
|
||||
}
|
||||
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
|
@ -1487,6 +1537,12 @@ if ($resql) {
|
|||
}
|
||||
}
|
||||
|
||||
$marginInfo = array();
|
||||
if ($with_margin_info === true) {
|
||||
$objectstatic->fetch_lines();
|
||||
$marginInfo = $formmargin->getMarginInfosArray($objectstatic);
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if (!empty($arrayfields['p.ref']['checked'])) {
|
||||
|
|
@ -1887,6 +1943,39 @@ if ($resql) {
|
|||
}
|
||||
}
|
||||
|
||||
// Total buying or cost price
|
||||
if (!empty($arrayfields['total_pa']['checked'])) {
|
||||
print '<td class="right nowrap">'.price($marginInfo['pa_total']).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Total margin
|
||||
if (!empty($arrayfields['total_margin']['checked'])) {
|
||||
print '<td class="right nowrap">'.price($marginInfo['total_margin']).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'total_margin';
|
||||
}
|
||||
$totalarray['val']['total_margin'] += $marginInfo['total_margin'];
|
||||
}
|
||||
// Total margin rate
|
||||
if (!empty($arrayfields['total_margin_rate']['checked'])) {
|
||||
print '<td class="right nowrap">'.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Total mark rate
|
||||
if (!empty($arrayfields['total_mark_rate']['checked'])) {
|
||||
print '<td class="right nowrap">'.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
|
|
|
|||
|
|
@ -626,7 +626,7 @@ class Commande extends CommonOrder
|
|||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
||||
$sql .= " SET fk_statut = ".self::STATUS_DRAFT."',";
|
||||
$sql .= " SET fk_statut = ".self::STATUS_DRAFT.",";
|
||||
$sql .= " fk_user_modif = ".((int) $user->id);
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
if (!empty($conf->margin->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php';
|
||||
}
|
||||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
|
|
@ -187,6 +190,10 @@ $arrayfields = array(
|
|||
'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>110),
|
||||
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115),
|
||||
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116),
|
||||
'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
|
||||
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
|
||||
'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)),
|
||||
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>120),
|
||||
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>125),
|
||||
'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>130),
|
||||
|
|
@ -407,6 +414,10 @@ $now = dol_now();
|
|||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
$formmargin = null;
|
||||
if (!empty($conf->margin->enabled)) {
|
||||
$formmargin = new FormMargin($db);
|
||||
}
|
||||
$companystatic = new Societe($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
$projectstatic = new Project($db);
|
||||
|
|
@ -1193,6 +1204,22 @@ if ($resql) {
|
|||
if (!empty($arrayfields['sale_representative']['checked'])) {
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
if (!empty($arrayfields['total_pa']['checked'])) {
|
||||
print '<td class="liste_titre right">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['total_margin']['checked'])) {
|
||||
print '<td class="liste_titre right">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['total_margin_rate']['checked'])) {
|
||||
print '<td class="liste_titre right">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['total_mark_rate']['checked'])) {
|
||||
print '<td class="liste_titre right">';
|
||||
print '</td>';
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
// Fields from hook
|
||||
|
|
@ -1354,6 +1381,18 @@ if ($resql) {
|
|||
if (!empty($arrayfields['sale_representative']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['total_pa']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['total_pa']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['total_margin']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['total_margin']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['total_margin_rate']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['total_margin_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['total_mark_rate']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['total_mark_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
}
|
||||
|
||||
$totalarray = array(
|
||||
'nbfield' => 0,
|
||||
|
|
@ -1413,6 +1452,18 @@ if ($resql) {
|
|||
$generic_product = new Product($db);
|
||||
$userstatic = new User($db);
|
||||
$i = 0;
|
||||
|
||||
$with_margin_info = false;
|
||||
if (!empty($conf->margin->enabled) && (
|
||||
!empty($arrayfields['total_pa']['checked'])
|
||||
|| !empty($arrayfields['total_margin']['checked'])
|
||||
|| !empty($arrayfields['total_margin_rate']['checked'])
|
||||
|| !empty($arrayfields['total_mark_rate']['checked'])
|
||||
)
|
||||
) {
|
||||
$with_margin_info = true;
|
||||
}
|
||||
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
|
@ -1455,6 +1506,12 @@ if ($resql) {
|
|||
$projectstatic->ref = $obj->project_ref;
|
||||
$projectstatic->title = $obj->project_label;
|
||||
|
||||
$marginInfo = array();
|
||||
if ($with_margin_info === true) {
|
||||
$generic_commande->fetch_lines();
|
||||
$marginInfo = $formmargin->getMarginInfosArray($generic_commande);
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
|
|
@ -1462,11 +1519,6 @@ if ($resql) {
|
|||
print '<td class="nowraponall">';
|
||||
print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
|
||||
|
||||
// Warning late icon and note
|
||||
if ($generic_commande->hasDelay()) {
|
||||
print img_picto($langs->trans("Late").' : '.$generic_commande->showDelay(), "warning");
|
||||
}
|
||||
|
||||
$filename = dol_sanitizeFileName($obj->ref);
|
||||
$filedir = $conf->commande->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($obj->ref);
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
|
|
@ -1590,6 +1642,10 @@ if ($resql) {
|
|||
if (!empty($arrayfields['c.date_commande']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print dol_print_date($db->jdate($obj->date_commande), 'day');
|
||||
// Warning late icon and note
|
||||
if ($generic_commande->hasDelay()) {
|
||||
print img_picto($langs->trans("Late").' : '.$generic_commande->showDelay(), "warning");
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
|
@ -1792,6 +1848,39 @@ if ($resql) {
|
|||
}
|
||||
}
|
||||
|
||||
// Total buying or cost price
|
||||
if (!empty($arrayfields['total_pa']['checked'])) {
|
||||
print '<td class="right nowrap">'.price($marginInfo['pa_total']).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Total margin
|
||||
if (!empty($arrayfields['total_margin']['checked'])) {
|
||||
print '<td class="right nowrap">'.price($marginInfo['total_margin']).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'total_margin';
|
||||
}
|
||||
$totalarray['val']['total_margin'] += $marginInfo['total_margin'];
|
||||
}
|
||||
// Total margin rate
|
||||
if (!empty($arrayfields['total_margin_rate']['checked'])) {
|
||||
print '<td class="right nowrap">'.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Total mark rate
|
||||
if (!empty($arrayfields['total_mark_rate']['checked'])) {
|
||||
print '<td class="right nowrap">'.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
|
|
|
|||
|
|
@ -1135,6 +1135,8 @@ if (empty($reshook)) {
|
|||
$facture_source->fetchPreviousNextSituationInvoice();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$id = $object->create($user);
|
||||
if ($id < 0) {
|
||||
$error++;
|
||||
|
|
@ -1262,6 +1264,7 @@ if (empty($reshook)) {
|
|||
$line->multicurrency_total_tva = -$line->multicurrency_total_tva;
|
||||
$line->multicurrency_total_ttc = -$line->multicurrency_total_ttc;
|
||||
|
||||
$line->context['createcreditnotefrominvoice'] = 1;
|
||||
$result = $line->insert(0, 1); // When creating credit note with same lines than source, we must ignore error if discount alreayd linked
|
||||
|
||||
$object->lines[] = $line; // insert new line in current object
|
||||
|
|
|
|||
|
|
@ -1,22 +1,23 @@
|
|||
<?php
|
||||
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
* Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
* Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2022 Sylvain Legrand <contact@infras.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -1166,6 +1167,9 @@ class Facture extends CommonInvoice
|
|||
|
||||
$object->fetch($fromid);
|
||||
|
||||
// Load source object
|
||||
$objFrom = clone $object;
|
||||
|
||||
// Change socid if needed
|
||||
if (!empty($this->socid) && $this->socid != $object->socid) {
|
||||
$objsoc = new Societe($this->db);
|
||||
|
|
@ -1246,13 +1250,13 @@ class Facture extends CommonInvoice
|
|||
$this->errors = $object->errors;
|
||||
} else {
|
||||
// copy internal contacts
|
||||
if ($object->copy_linked_contact($this, 'internal') < 0) {
|
||||
if ($object->copy_linked_contact($objFrom, 'internal') < 0) {
|
||||
$error++;
|
||||
$this->error = $object->error;
|
||||
$this->errors = $object->errors;
|
||||
} elseif ($this->socid == $object->socid) {
|
||||
} elseif ($object->socid == $objFrom->socid) {
|
||||
// copy external contacts if same company
|
||||
if ($object->copy_linked_contact($this, 'external') < 0) {
|
||||
if ($object->copy_linked_contact($objFrom, 'external') < 0) {
|
||||
$error++;
|
||||
$this->error = $object->error;
|
||||
$this->errors = $object->errors;
|
||||
|
|
@ -1263,7 +1267,7 @@ class Facture extends CommonInvoice
|
|||
if (!$error) {
|
||||
// Hook of thirdparty module
|
||||
if (is_object($hookmanager)) {
|
||||
$parameters = array('objFrom'=>$this);
|
||||
$parameters = array('objFrom'=>$objFrom);
|
||||
$action = '';
|
||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
|
|
|
|||
|
|
@ -43,9 +43,8 @@ if (isset($user->socid) && $user->socid > 0) {
|
|||
$max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
|
||||
|
||||
// Maximum elements of the tables
|
||||
$maxDraftCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD;
|
||||
$maxLatestEditCount = 5;
|
||||
$maxOpenCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD;
|
||||
$maxDraftCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? $max : $conf->global->MAIN_MAXLIST_OVERLOAD;
|
||||
$maxOpenCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? $max : $conf->global->MAIN_MAXLIST_OVERLOAD;
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -64,7 +63,7 @@ if ($tmp) {
|
|||
print $tmp;
|
||||
print '<br>';
|
||||
}
|
||||
$tmp = getCustomerInvoiceDraftTable($max, $socid);
|
||||
$tmp = getCustomerInvoiceDraftTable($maxDraftCount, $socid);
|
||||
if ($tmp) {
|
||||
print $tmp;
|
||||
print '<br>';
|
||||
|
|
@ -74,13 +73,13 @@ print '</div>';
|
|||
|
||||
print '<div class="fichetwothirdright">';
|
||||
|
||||
$tmp = getCustomerInvoiceLatestEditTable($maxLatestEditCount, $socid);
|
||||
$tmp = getCustomerInvoiceLatestEditTable($max, $socid);
|
||||
if ($tmp) {
|
||||
print $tmp;
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
$tmp = getCustomerInvoiceUnpaidOpenTable($max, $socid);
|
||||
$tmp = getCustomerInvoiceUnpaidOpenTable($maxOpenCount, $socid);
|
||||
if ($tmp) {
|
||||
print $tmp;
|
||||
print '<br>';
|
||||
|
|
|
|||
|
|
@ -1621,6 +1621,18 @@ if ($resql) {
|
|||
$totalarray['val'] = array();
|
||||
$totalarray['val']['f.total_ht'] = 0;
|
||||
$totalarray['val']['f.total_ttc'] = 0;
|
||||
|
||||
$with_margin_info = false;
|
||||
if (!empty($conf->margin->enabled) && (
|
||||
!empty($arrayfields['total_pa']['checked'])
|
||||
|| !empty($arrayfields['total_margin']['checked'])
|
||||
|| !empty($arrayfields['total_margin_rate']['checked'])
|
||||
|| !empty($arrayfields['total_mark_rate']['checked'])
|
||||
)
|
||||
) {
|
||||
$with_margin_info = true;
|
||||
}
|
||||
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
|
@ -1706,7 +1718,7 @@ if ($resql) {
|
|||
$facturestatic->alreadypaid = $paiement;
|
||||
|
||||
$marginInfo = array();
|
||||
if (!empty($conf->margin->enabled)) {
|
||||
if ($with_margin_info === true) {
|
||||
$facturestatic->fetch_lines();
|
||||
$marginInfo = $formmargin->getMarginInfosArray($facturestatic);
|
||||
}
|
||||
|
|
@ -2194,7 +2206,7 @@ if ($resql) {
|
|||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// total mark rate
|
||||
// Total mark rate
|
||||
if (!empty($arrayfields['total_mark_rate']['checked'])) {
|
||||
print '<td class="right nowrap">'.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').'</td>';
|
||||
if (!$i) {
|
||||
|
|
|
|||
|
|
@ -210,11 +210,11 @@ if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) {
|
|||
print '<td class="nobordernopadding nowraponall">';
|
||||
print $tmpinvoice->getNomUrl(1, '');
|
||||
print '</td>';
|
||||
print '<td width="20" class="nobordernopadding nowrap">';
|
||||
if ($tmpinvoice->hasDelay()) {
|
||||
print '<td width="20" class="nobordernopadding nowrap">';
|
||||
print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td width="16" class="nobordernopadding hideonsmartphone right">';
|
||||
$filename = dol_sanitizeFileName($obj->ref);
|
||||
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($obj->ref);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019 Eric Seigne <eric.seigne@cap-rel.fr>
|
||||
* Copyright (C) 2021 Open-Dsi <support@open-dsi.fr>
|
||||
* Copyright (C) 2021-2022 Open-Dsi <support@open-dsi.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -47,7 +47,7 @@ $langs->loadLangs(array("other", "compta", "banks", "bills", "companies", "produ
|
|||
|
||||
$refresh = (GETPOSTISSET('submit') || GETPOSTISSET('vat_rate_show') || GETPOSTISSET('invoice_type')) ? true : false;
|
||||
$invoice_type = GETPOSTISSET('invoice_type') ? GETPOST('invoice_type', 'alpha') : '';
|
||||
$vat_rate_show = GETPOSTISSET('vat_rate_show') ? GETPOST('vat_rate_show', 'int') : -1;
|
||||
$vat_rate_show = GETPOSTISSET('vat_rate_show') ? GETPOST('vat_rate_show', 'alphanohtml') : -1;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/compta/tva/initdatesforvat.inc.php';
|
||||
|
||||
|
|
@ -409,7 +409,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
|||
print '<td class="tax_rate" colspan="' . ($span+1) . '">';
|
||||
print $langs->trans('Rate') . ' : ' . vatrate($rate) . '%';
|
||||
print ' - <a href="'.DOL_URL_ROOT.'/compta/tva/quadri_detail.php?invoice_type=customer';
|
||||
if (!GETPOSTISSET('vat_rate_show') || GETPOST('vat_rate_show') != $rate) {
|
||||
if ($invoice_type != 'customer' || !GETPOSTISSET('vat_rate_show') || GETPOST('vat_rate_show') != $rate) {
|
||||
print '&vat_rate_show='.urlencode($rate);
|
||||
}
|
||||
print '&date_startyear='.urlencode($date_start_year).'&date_startmonth='.urlencode($date_start_month).'&date_startday='.urlencode($date_start_day).'&date_endyear='.urlencode($date_end_year).'&date_endmonth='.urlencode($date_end_month).'&date_endday='.urlencode($date_end_day).'">' . img_picto('', 'chevron-down', 'class="paddingrightonly"') . $langs->trans('VATReportShowByRateDetails') . '</a>';
|
||||
|
|
@ -643,7 +643,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
|||
print '<td class="tax_rate" colspan="' . ($span+1) . '">';
|
||||
print $langs->trans('Rate') . ' : ' . vatrate($rate) . '%';
|
||||
print ' - <a href="'.DOL_URL_ROOT.'/compta/tva/quadri_detail.php?invoice_type=supplier';
|
||||
if (!GETPOSTISSET('vat_rate_show') || GETPOST('vat_rate_show') != $rate) {
|
||||
if ($invoice_type != 'supplier' || !GETPOSTISSET('vat_rate_show') || GETPOST('vat_rate_show') != $rate) {
|
||||
print '&vat_rate_show='.urlencode($rate);
|
||||
}
|
||||
print '&date_startyear='.urlencode($date_start_year).'&date_startmonth='.urlencode($date_start_month).'&date_startday='.urlencode($date_start_day).'&date_endyear='.urlencode($date_end_year).'&date_endmonth='.urlencode($date_end_month).'&date_endday='.urlencode($date_end_day).'">' . img_picto('', 'chevron-down', 'class="paddingrightonly"') . $langs->trans('VATReportShowByRateDetails') . '</a>';
|
||||
|
|
|
|||
|
|
@ -1389,7 +1389,7 @@ class Contact extends CommonObject
|
|||
* Return name of contact with link (and eventually picto)
|
||||
* Use $this->id, $this->lastname, $this->firstname, this->civility_id
|
||||
*
|
||||
* @param int $withpicto Include picto with link
|
||||
* @param int $withpicto Include picto with link (1=picto + name, 2=picto only, -1=photo+name, -2=photo only)
|
||||
* @param string $option Where the link point to
|
||||
* @param int $maxlen Max length of
|
||||
* @param string $moreparam Add more param into URL
|
||||
|
|
@ -1475,14 +1475,14 @@ class Contact extends CommonObject
|
|||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) {
|
||||
if ($withpicto == -2) {
|
||||
if ($withpicto < 0) {
|
||||
$result .= '<!-- picto photo user --><span class="nopadding userimg'.($morecss ? ' '.$morecss : '').'">'.Form::showphoto('contact', $this, 0, 0, 0, 'userphoto'.($withpicto == -3 ? 'small' : ''), 'mini', 0, 1).'</span>';
|
||||
} else {
|
||||
$result .= img_object(($notooltip ? '' : $label), ( $this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||
}
|
||||
}
|
||||
if ($withpicto != 2 && $withpicto != -2) {
|
||||
$result .= ($maxlen ?dol_trunc($this->getFullName($langs), $maxlen) : $this->getFullName($langs));
|
||||
$result .= '<span class="valigmiddle">'.($maxlen ? dol_trunc($this->getFullName($langs), $maxlen) : $this->getFullName($langs)).'</span>';
|
||||
}
|
||||
$result .= $linkend;
|
||||
|
||||
|
|
|
|||
|
|
@ -387,7 +387,7 @@ class Contrat extends CommonObject
|
|||
if ($contratline->statut != ContratLigne::STATUS_OPEN) {
|
||||
$contratline->context = $this->context;
|
||||
|
||||
$result = $contratline->active_line($user, $date_start, -1, $comment);
|
||||
$result = $contratline->active_line($user, $date_start, -1, $comment); // This call trigger LINECONTRACT_ACTIVATE
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->error = $contratline->error;
|
||||
|
|
|
|||
|
|
@ -65,58 +65,58 @@ $arrayresult = array();
|
|||
// Define $searchform
|
||||
|
||||
if (!empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire) {
|
||||
$arrayresult['searchintomember'] = array('position'=>8, 'shortcut'=>'M', 'img'=>'object_member', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('', 'object_member').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintomember'] = array('position'=>8, 'shortcut'=>'M', 'img'=>'object_member', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('', 'object_member', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
|
||||
if (((!empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire) {
|
||||
$arrayresult['searchintothirdparty'] = array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('', 'object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintothirdparty'] = array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('', 'object_company', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
|
||||
if (!empty($conf->societe->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED) && $user->rights->societe->lire) {
|
||||
$arrayresult['searchintocontact'] = array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('', 'object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintocontact'] = array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('', 'object_contact', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
|
||||
if (((!empty($conf->product->enabled) && $user->rights->produit->lire) || (!empty($conf->service->enabled) && $user->rights->service->lire))
|
||||
&& empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED)) {
|
||||
$arrayresult['searchintoproduct'] = array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'text'=>img_picto('', 'object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintoproduct'] = array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'text'=>img_picto('', 'object_product', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
// search on lot/serial numbers
|
||||
if ( ! empty($conf->productbatch->enabled) ) {
|
||||
$arrayresult['searchintobatch'] = array('position'=>32, 'shortcut'=>'B', 'img'=>'object_lot', 'label'=>$langs->trans("SearchIntoBatch", $search_boxvalue), 'text'=>img_picto('', 'object_lot').' '.$langs->trans("SearchIntoBatch", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/stock/productlot_list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintobatch'] = array('position'=>32, 'shortcut'=>'B', 'img'=>'object_lot', 'label'=>$langs->trans("SearchIntoBatch", $search_boxvalue), 'text'=>img_picto('', 'object_lot', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoBatch", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/stock/productlot_list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($conf->mrp->enabled) && $user->rights->mrp->read && empty($conf->global->MAIN_SEARCHFORM_MRP_DISABLED)) {
|
||||
$arrayresult['searchintomo'] = array('position'=>35, 'shortcut'=>'', 'img'=>'object_mrp', 'label'=>$langs->trans("SearchIntoMO", $search_boxvalue), 'text'=>img_picto('', 'object_mrp').' '.$langs->trans("SearchIntoMO", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/mrp/mo_list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintomo'] = array('position'=>35, 'shortcut'=>'', 'img'=>'object_mrp', 'label'=>$langs->trans("SearchIntoMO", $search_boxvalue), 'text'=>img_picto('', 'object_mrp', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoMO", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/mrp/mo_list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
|
||||
if (!empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->projet->lire) {
|
||||
$arrayresult['searchintoprojects'] = array('position'=>40, 'shortcut'=>'Q', 'img'=>'object_project', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('', 'object_project').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintoprojects'] = array('position'=>40, 'shortcut'=>'Q', 'img'=>'object_project', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('', 'object_project', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
if (!empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLED) && $user->rights->projet->lire) {
|
||||
$arrayresult['searchintotasks'] = array('position'=>45, 'img'=>'object_projecttask', 'label'=>$langs->trans("SearchIntoTasks", $search_boxvalue), 'text'=>img_picto('', 'object_projecttask').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintotasks'] = array('position'=>45, 'img'=>'object_projecttask', 'label'=>$langs->trans("SearchIntoTasks", $search_boxvalue), 'text'=>img_picto('', 'object_projecttask', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
|
||||
if (!empty($conf->propal->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_PROPAL_DISABLED) && $user->rights->propal->lire) {
|
||||
$arrayresult['searchintopropal'] = array('position'=>60, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('', 'object_propal').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintopropal'] = array('position'=>60, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('', 'object_propal', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
if (!empty($conf->commande->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_ORDER_DISABLED) && $user->rights->commande->lire) {
|
||||
$arrayresult['searchintoorder'] = array('position'=>70, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('', 'object_order').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintoorder'] = array('position'=>70, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('', 'object_order', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
if (!empty($conf->expedition->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED) && $user->rights->expedition->lire) {
|
||||
$arrayresult['searchintoshipment'] = array('position'=>80, 'img'=>'object_shipment', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('', 'object_shipment').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintoshipment'] = array('position'=>80, 'img'=>'object_shipment', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('', 'object_shipment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
if (!empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->rights->facture->lire) {
|
||||
$arrayresult['searchintoinvoice'] = array('position'=>90, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_bill').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintoinvoice'] = array('position'=>90, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_bill', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
|
||||
if (!empty($conf->supplier_proposal->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED) && $user->rights->supplier_proposal->lire) {
|
||||
$arrayresult['searchintosupplierpropal'] = array('position'=>100, 'img'=>'object_supplier_proposal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_proposal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintosupplierpropal'] = array('position'=>100, 'img'=>'object_supplier_proposal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_proposal', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->lire) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire)) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED)) {
|
||||
$arrayresult['searchintosupplierorder'] = array('position'=>110, 'img'=>'object_supplier_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintosupplierorder'] = array('position'=>110, 'img'=>'object_supplier_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_order', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED)) {
|
||||
$arrayresult['searchintosupplierinvoice'] = array('position'=>120, 'img'=>'object_supplier_invoice', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_invoice').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintosupplierinvoice'] = array('position'=>120, 'img'=>'object_supplier_invoice', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_invoice', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
|
||||
// Customer payments
|
||||
|
|
@ -125,7 +125,7 @@ if (!empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUST
|
|||
'position'=>170,
|
||||
'img'=>'object_payment',
|
||||
'label'=>$langs->trans("SearchIntoCustomerPayments", $search_boxvalue),
|
||||
'text'=>img_picto('', 'object_payment').' '.$langs->trans("SearchIntoCustomerPayments", $search_boxvalue),
|
||||
'text'=>img_picto('', 'object_payment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerPayments", $search_boxvalue),
|
||||
'url'=>DOL_URL_ROOT.'/compta/paiement/list.php?leftmenu=customers_bills_payment'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_S
|
|||
'position'=>175,
|
||||
'img'=>'object_payment',
|
||||
'label'=>$langs->trans("SearchIntoVendorPayments", $search_boxvalue),
|
||||
'text'=>img_picto('', 'object_payment').' '.$langs->trans("SearchIntoVendorPayments", $search_boxvalue),
|
||||
'text'=>img_picto('', 'object_payment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoVendorPayments", $search_boxvalue),
|
||||
'url'=>DOL_URL_ROOT.'/fourn/paiement/list.php?leftmenu=suppliers_bills_payment'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
|
||||
|
|
@ -145,29 +145,29 @@ if (!empty($conf->banque->enabled) && empty($conf->global->MAIN_SEARCHFORM_MISC_
|
|||
'position'=>180,
|
||||
'img'=>'object_payment',
|
||||
'label'=>$langs->trans("SearchIntoMiscPayments", $search_boxvalue),
|
||||
'text'=>img_picto('', 'object_payment').' '.$langs->trans("SearchIntoMiscPayments", $search_boxvalue),
|
||||
'text'=>img_picto('', 'object_payment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoMiscPayments", $search_boxvalue),
|
||||
'url'=>DOL_URL_ROOT.'/compta/bank/various_payment/list.php?leftmenu=tax_various'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
|
||||
if (!empty($conf->contrat->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTRACT_DISABLED) && $user->rights->contrat->lire) {
|
||||
$arrayresult['searchintocontract'] = array('position'=>130, 'img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('', 'object_contract').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintocontract'] = array('position'=>130, 'img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('', 'object_contract', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
if (!empty($conf->ficheinter->enabled) && empty($conf->global->MAIN_SEARCHFORM_FICHINTER_DISABLED) && $user->rights->ficheinter->lire) {
|
||||
$arrayresult['searchintointervention'] = array('position'=>140, 'img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('', 'object_intervention').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintointervention'] = array('position'=>140, 'img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('', 'object_intervention', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
if (!empty($conf->ticket->enabled) && empty($conf->global->MAIN_SEARCHFORM_TICKET_DISABLED) && $user->rights->ticket->read) {
|
||||
$arrayresult['searchintotickets'] = array('position'=>145, 'img'=>'object_ticket', 'label'=>$langs->trans("SearchIntoTickets", $search_boxvalue), 'text'=>img_picto('', 'object_ticket').' '.$langs->trans("SearchIntoTickets", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/ticket/list.php?mainmenu=ticket'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintotickets'] = array('position'=>145, 'img'=>'object_ticket', 'label'=>$langs->trans("SearchIntoTickets", $search_boxvalue), 'text'=>img_picto('', 'object_ticket', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoTickets", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/ticket/list.php?mainmenu=ticket'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
|
||||
// HR
|
||||
if (!empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->rights->user->user->lire) {
|
||||
$arrayresult['searchintouser'] = array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('', 'object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintouser'] = array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('', 'object_user', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
if (!empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire) {
|
||||
$arrayresult['searchintoexpensereport'] = array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('', 'object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintoexpensereport'] = array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('', 'object_trip', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
if (!empty($conf->holiday->enabled) && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->rights->holiday->read) {
|
||||
$arrayresult['searchintoleaves'] = array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('', 'object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
|
||||
$arrayresult['searchintoleaves'] = array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('', 'object_holiday', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
|
||||
// Execute hook addSearchEntry
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ class box_scheduled_jobs extends ModeleBoxes
|
|||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="center"',
|
||||
'textnoformat' => ($nbjobsinerror ? '<a href="'.DOL_URL_ROOT.'/cron/list.php?search_lastresult='.urlencode('<>0').'"><div class="badge badge-danger"><i class="fa fa-exclamation-triangle"></i> '.$nbjobsinerror.'</div></a>' : '<div class="center badge-status4">0</div>')
|
||||
'textnoformat' => ($nbjobsinerror ? '<a href="'.DOL_URL_ROOT.'/cron/list.php?search_lastresult='.urlencode('<>0').'"><div class="badge badge-danger"><i class="fa fa-exclamation-triangle"></i> '.$nbjobsinerror.'</div></a>' : '<a href="'.DOL_URL_ROOT.'/cron/list.php"><div class="center badge-status4">0</div></a>')
|
||||
);
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ class Ccountry // extends CommonObject
|
|||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_country(";
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."c_country(";
|
||||
$sql .= "rowid,";
|
||||
$sql .= "code,";
|
||||
$sql .= "code_iso,";
|
||||
|
|
@ -135,7 +135,7 @@ class Ccountry // extends CommonObject
|
|||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_country");
|
||||
$this->id = $this->db->last_insert_id($this->db->prefix()."c_country");
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
|
|
@ -169,7 +169,7 @@ class Ccountry // extends CommonObject
|
|||
$sql .= " t.code_iso,";
|
||||
$sql .= " t.label,";
|
||||
$sql .= " t.active";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_country as t";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_country as t";
|
||||
if ($id) {
|
||||
$sql .= " WHERE t.rowid = ".((int) $id);
|
||||
} elseif ($code) {
|
||||
|
|
@ -235,7 +235,7 @@ class Ccountry // extends CommonObject
|
|||
// Put here code to add control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."c_country SET";
|
||||
$sql = "UPDATE ".$this->db->prefix()."c_country SET";
|
||||
$sql .= " code=".(isset($this->code) ? "'".$this->db->escape($this->code)."'" : "null").",";
|
||||
$sql .= " code_iso=".(isset($this->code_iso) ? "'".$this->db->escape($this->code_iso)."'" : "null").",";
|
||||
$sql .= " label=".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").",";
|
||||
|
|
@ -278,7 +278,7 @@ class Ccountry // extends CommonObject
|
|||
global $conf, $langs;
|
||||
$error = 0;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_country";
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."c_country";
|
||||
$sql .= " WHERE rowid=".((int) $this->id);
|
||||
|
||||
$this->db->begin();
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ class Comment extends CommonObject
|
|||
$error = 0;
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element." (";
|
||||
$sql = "INSERT INTO ".$this->db->prefix().$this->table_element." (";
|
||||
$sql .= "description";
|
||||
$sql .= ", datec";
|
||||
$sql .= ", fk_element";
|
||||
|
|
@ -146,7 +146,7 @@ class Comment extends CommonObject
|
|||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
|
||||
$this->id = $this->db->last_insert_id($this->db->prefix().$this->table_element);
|
||||
|
||||
if (!$notrigger) {
|
||||
// Call trigger
|
||||
|
|
@ -195,7 +195,7 @@ class Comment extends CommonObject
|
|||
$sql .= " c.fk_user_modif,";
|
||||
$sql .= " c.entity,";
|
||||
$sql .= " c.import_key";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as c";
|
||||
$sql .= " FROM ".$this->db->prefix().$this->table_element." as c";
|
||||
$sql .= " WHERE c.rowid = ".((int) $id);
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
|
|
@ -254,7 +254,7 @@ class Comment extends CommonObject
|
|||
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element." SET";
|
||||
$sql .= " description=".(isset($this->description) ? "'".$this->db->escape($this->description)."'" : "null").",";
|
||||
$sql .= " datec=".($this->datec != '' ? "'".$this->db->idate($this->datec)."'" : 'null').",";
|
||||
$sql .= " fk_element=".(isset($this->fk_element) ? $this->fk_element : "null").",";
|
||||
|
|
@ -315,7 +315,7 @@ class Comment extends CommonObject
|
|||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = "DELETE FROM ".$this->db->prefix().$this->table_element;
|
||||
$sql .= " WHERE rowid=".((int) $this->id);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -364,7 +364,7 @@ class Comment extends CommonObject
|
|||
if (!empty($element_type) && !empty($fk_element)) {
|
||||
$sql = "SELECT";
|
||||
$sql .= " c.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as c";
|
||||
$sql .= " FROM ".$this->db->prefix().$this->table_element." as c";
|
||||
$sql .= " WHERE c.fk_element = ".((int) $fk_element);
|
||||
$sql .= " AND c.element_type = '".$this->db->escape($element_type)."'";
|
||||
$sql .= " AND c.entity = ".$conf->entity;
|
||||
|
|
|
|||
|
|
@ -653,7 +653,7 @@ abstract class CommonDocGenerator
|
|||
|
||||
if ($columns != "") {
|
||||
$columns = substr($columns, 0, strlen($columns) - 2);
|
||||
$resql = $this->db->query("SELECT ".$columns." FROM ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields AS ex INNER JOIN ".MAIN_DB_PREFIX."product_fournisseur_price AS f ON ex.fk_object = f.rowid WHERE f.ref_fourn = '".$this->db->escape($line->ref_supplier)."'");
|
||||
$resql = $this->db->query("SELECT ".$columns." FROM ".$this->db->prefix()."product_fournisseur_price_extrafields AS ex INNER JOIN ".$this->db->prefix()."product_fournisseur_price AS f ON ex.fk_object = f.rowid WHERE f.ref_fourn = '".$this->db->escape($line->ref_supplier)."'");
|
||||
|
||||
if ($this->db->num_rows($resql) > 0) {
|
||||
$resql = $this->db->fetch_object($resql);
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ trait CommonIncoterm
|
|||
|
||||
$this->label_incoterms = '';
|
||||
if (!empty($this->fk_incoterms)) {
|
||||
$sql = "SELECT code FROM ".MAIN_DB_PREFIX."c_incoterms WHERE rowid = ".(int) $this->fk_incoterms;
|
||||
$sql = "SELECT code FROM ".$this->db->prefix()."c_incoterms WHERE rowid = ".(int) $this->fk_incoterms;
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$res = $this->db->fetch_object($result);
|
||||
|
|
@ -80,7 +80,7 @@ trait CommonIncoterm
|
|||
*/
|
||||
public function getIncotermsForPDF()
|
||||
{
|
||||
$sql = "SELECT code FROM ".MAIN_DB_PREFIX."c_incoterms WHERE rowid = ".(int) $this->fk_incoterms;
|
||||
$sql = "SELECT code FROM ".$this->db->prefix()."c_incoterms WHERE rowid = ".(int) $this->fk_incoterms;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
|
@ -106,7 +106,7 @@ trait CommonIncoterm
|
|||
public function setIncoterms($id_incoterm, $location)
|
||||
{
|
||||
if ($this->id && $this->table_element) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element;
|
||||
$sql .= " SET fk_incoterms = ".($id_incoterm > 0 ? ((int) $id_incoterm) : "null");
|
||||
$sql .= ", location_incoterms = ".($id_incoterm > 0 ? "'".$this->db->escape($location)."'" : "null");
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
|
@ -116,7 +116,7 @@ trait CommonIncoterm
|
|||
$this->fk_incoterms = $id_incoterm;
|
||||
$this->location_incoterms = $location;
|
||||
|
||||
$sql = "SELECT libelle as label_incoterms FROM ".MAIN_DB_PREFIX."c_incoterms WHERE rowid = ".(int) $this->fk_incoterms;
|
||||
$sql = "SELECT libelle as label_incoterms FROM ".$this->db->prefix()."c_incoterms WHERE rowid = ".(int) $this->fk_incoterms;
|
||||
$res = $this->db->query($sql);
|
||||
if ($res) {
|
||||
$obj = $this->db->fetch_object($res);
|
||||
|
|
|
|||
|
|
@ -130,8 +130,8 @@ abstract class CommonInvoice extends CommonObject
|
|||
$field = 'fk_facturefourn';
|
||||
}
|
||||
|
||||
$sql = 'SELECT sum(amount) as amount, sum(multicurrency_amount) as multicurrency_amount';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$table;
|
||||
$sql = "SELECT sum(amount) as amount, sum(multicurrency_amount) as multicurrency_amount";
|
||||
$sql .= " FROM ".$this->db->prefix().$table;
|
||||
$sql .= " WHERE ".$field." = ".((int) $this->id);
|
||||
|
||||
dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG);
|
||||
|
|
@ -226,10 +226,10 @@ abstract class CommonInvoice extends CommonObject
|
|||
{
|
||||
$idarray = array();
|
||||
|
||||
$sql = 'SELECT rowid';
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = "SELECT rowid";
|
||||
$sql .= " FROM ".$this->db->prefix().$this->table_element;
|
||||
$sql .= " WHERE fk_facture_source = ".((int) $this->id);
|
||||
$sql .= ' AND type = 2';
|
||||
$sql .= " AND type = 2";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
|
@ -253,10 +253,10 @@ abstract class CommonInvoice extends CommonObject
|
|||
*/
|
||||
public function getIdReplacingInvoice($option = '')
|
||||
{
|
||||
$sql = 'SELECT rowid';
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = "SELECT rowid";
|
||||
$sql .= " FROM ".$this->db->prefix().$this->table_element;
|
||||
$sql .= " WHERE fk_facture_source = ".((int) $this->id);
|
||||
$sql .= ' AND type < 2';
|
||||
$sql .= " AND type < 2";
|
||||
if ($option == 'validated') {
|
||||
$sql .= ' AND fk_statut = 1';
|
||||
}
|
||||
|
|
@ -265,7 +265,7 @@ abstract class CommonInvoice extends CommonObject
|
|||
// and another no, priority is given to the valid one.
|
||||
// Should not happen (unless concurrent access and 2 people have created a
|
||||
// replacement invoice for the same invoice at the same time)
|
||||
$sql .= ' ORDER BY fk_statut DESC';
|
||||
$sql .= " ORDER BY fk_statut DESC";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
|
@ -308,7 +308,7 @@ abstract class CommonInvoice extends CommonObject
|
|||
}
|
||||
|
||||
$sql = "SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code".$field3;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$table." as pf, ".MAIN_DB_PREFIX.$table2." as p, ".MAIN_DB_PREFIX."c_paiement as t";
|
||||
$sql .= " FROM ".$this->db->prefix().$table." as pf, ".$this->db->prefix().$table2." as p, ".$this->db->prefix()."c_paiement as t";
|
||||
$sql .= " WHERE pf.".$field." = ".((int) $this->id);
|
||||
$sql .= " AND pf.".$field2." = p.rowid";
|
||||
$sql .= ' AND p.fk_paiement = t.id';
|
||||
|
|
@ -337,12 +337,12 @@ abstract class CommonInvoice extends CommonObject
|
|||
$sql = '';
|
||||
if ($this->element == 'facture' || $this->element == 'invoice') {
|
||||
$sql = "SELECT rc.amount_ttc as amount, rc.multicurrency_amount_ttc as multicurrency_amount, rc.datec as date, f.ref as ref, rc.description as type";
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture as f';
|
||||
$sql .= ' FROM '.$this->db->prefix().'societe_remise_except as rc, '.$this->db->prefix().'facture as f';
|
||||
$sql .= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.((int) $this->id);
|
||||
$sql .= ' AND (f.type = 2 OR f.type = 0 OR f.type = 3)'; // Find discount coming from credit note or excess received or deposits (payments from deposits are always null except if FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is set)
|
||||
} elseif ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') {
|
||||
$sql = "SELECT rc.amount_ttc as amount, rc.multicurrency_amount_ttc as multicurrency_amount, rc.datec as date, f.ref as ref, rc.description as type";
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture_fourn as f';
|
||||
$sql .= ' FROM '.$this->db->prefix().'societe_remise_except as rc, '.$this->db->prefix().'facture_fourn as f';
|
||||
$sql .= ' WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = '.((int) $this->id);
|
||||
$sql .= ' AND (f.type = 2 OR f.type = 0 OR f.type = 3)'; // Find discount coming from credit note or excess received or deposits (payments from deposits are always null except if FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is set)
|
||||
}
|
||||
|
|
@ -462,7 +462,7 @@ abstract class CommonInvoice extends CommonObject
|
|||
$type = 'supplier_invoice';
|
||||
}
|
||||
|
||||
$sql = " SELECT COUNT(ab.rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='".$this->db->escape($type)."' AND ab.fk_doc = ".((int) $this->id);
|
||||
$sql = " SELECT COUNT(ab.rowid) as nb FROM ".$this->db->prefix()."accounting_bookkeeping as ab WHERE ab.doc_type='".$this->db->escape($type)."' AND ab.fk_doc = ".((int) $this->id);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
|
@ -601,8 +601,8 @@ abstract class CommonInvoice extends CommonObject
|
|||
$cdr_type = 0;
|
||||
$cdr_decalage = 0;
|
||||
|
||||
$sqltemp = 'SELECT c.type_cdr, c.nbjour, c.decalage';
|
||||
$sqltemp .= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c';
|
||||
$sqltemp = "SELECT c.type_cdr, c.nbjour, c.decalage";
|
||||
$sqltemp .= " FROM ".$this->db->prefix()."c_payment_term as c";
|
||||
if (is_numeric($cond_reglement)) {
|
||||
$sqltemp .= " WHERE c.rowid=".((int) $cond_reglement);
|
||||
} else {
|
||||
|
|
@ -697,15 +697,15 @@ abstract class CommonInvoice extends CommonObject
|
|||
$bac = new CompanyBankAccount($this->db);
|
||||
$bac->fetch(0, $this->socid);
|
||||
|
||||
$sql = 'SELECT count(*)';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
|
||||
$sql = "SELECT count(*)";
|
||||
$sql .= " FROM ".$this->db->prefix()."prelevement_facture_demande";
|
||||
if ($type == 'bank-transfer') {
|
||||
$sql .= ' WHERE fk_facture_fourn = '.((int) $this->id);
|
||||
$sql .= " WHERE fk_facture_fourn = ".((int) $this->id);
|
||||
} else {
|
||||
$sql .= ' WHERE fk_facture = '.((int) $this->id);
|
||||
$sql .= " WHERE fk_facture = ".((int) $this->id);
|
||||
}
|
||||
$sql .= ' AND ext_payment_id IS NULL'; // To exclude record done for some online payments
|
||||
$sql .= ' AND traite = 0';
|
||||
$sql .= " AND ext_payment_id IS NULL"; // To exclude record done for some online payments
|
||||
$sql .= " AND traite = 0";
|
||||
|
||||
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -728,7 +728,7 @@ abstract class CommonInvoice extends CommonObject
|
|||
}
|
||||
|
||||
if (is_numeric($amount) && $amount != 0) {
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande(';
|
||||
$sql = 'INSERT INTO '.$this->db->prefix().'prelevement_facture_demande(';
|
||||
if ($type == 'bank-transfer') {
|
||||
$sql .= 'fk_facture_fourn, ';
|
||||
} else {
|
||||
|
|
@ -800,7 +800,7 @@ abstract class CommonInvoice extends CommonObject
|
|||
public function demande_prelevement_delete($fuser, $did)
|
||||
{
|
||||
// phpcs:enable
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
|
||||
$sql = 'DELETE FROM '.$this->db->prefix().'prelevement_facture_demande';
|
||||
$sql .= ' WHERE rowid = '.((int) $did);
|
||||
$sql .= ' AND traite = 0';
|
||||
if ($this->db->query($sql)) {
|
||||
|
|
@ -857,7 +857,7 @@ abstract class CommonInvoice extends CommonObject
|
|||
// Using TLV format
|
||||
$s = pack('C1', 1).pack('C1', strlen($this->thirdparty->name)).$this->thirdparty->name;
|
||||
$s .= pack('C1', 2).pack('C1', strlen($this->thirdparty->tva_intra)).$this->thirdparty->tva_intra;
|
||||
$s .= pack('C1', 3).pack('C1', strlen($datestring)).$date;
|
||||
$s .= pack('C1', 3).pack('C1', strlen($datestring)).$this->date;
|
||||
$s .= pack('C1', 4).pack('C1', strlen($pricewithtaxstring)).$pricewithtaxstring;
|
||||
$s .= pack('C1', 5).pack('C1', strlen($pricetaxstring)).$pricetaxstring;
|
||||
$s .= ''; // Hash of xml invoice
|
||||
|
|
|
|||
|
|
@ -536,7 +536,7 @@ abstract class CommonObject
|
|||
global $db, $conf;
|
||||
|
||||
$sql = "SELECT rowid, ref, ref_ext";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$element;
|
||||
$sql .= " FROM ".$db->prefix().$element;
|
||||
$sql .= " WHERE entity IN (".getEntity($element).")";
|
||||
|
||||
if ($id > 0) {
|
||||
|
|
@ -1041,7 +1041,7 @@ abstract class CommonObject
|
|||
} else {
|
||||
// We look for id type_contact
|
||||
$sql = "SELECT tc.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_type_contact as tc";
|
||||
$sql .= " WHERE tc.element='".$this->db->escape($this->element)."'";
|
||||
$sql .= " AND tc.source='".$this->db->escape($source)."'";
|
||||
$sql .= " AND tc.code='".$this->db->escape($type_contact)."' AND tc.active=1";
|
||||
|
|
@ -1079,7 +1079,7 @@ abstract class CommonObject
|
|||
$this->db->begin();
|
||||
|
||||
// Insert into database
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact";
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."element_contact";
|
||||
$sql .= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_contact) ";
|
||||
$sql .= " VALUES (".$this->id.", ".((int) $fk_socpeople)." , ";
|
||||
$sql .= "'".$this->db->idate($datecreate)."'";
|
||||
|
|
@ -1148,7 +1148,7 @@ abstract class CommonObject
|
|||
{
|
||||
// phpcs:enable
|
||||
// Insert into database
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."element_contact set";
|
||||
$sql = "UPDATE ".$this->db->prefix()."element_contact set";
|
||||
$sql .= " statut = ".$statut;
|
||||
if ($type_contact_id) {
|
||||
$sql .= ", fk_c_type_contact = ".((int) $type_contact_id);
|
||||
|
|
@ -1182,7 +1182,7 @@ abstract class CommonObject
|
|||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact";
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."element_contact";
|
||||
$sql .= " WHERE rowid = ".((int) $rowid);
|
||||
|
||||
dol_syslog(get_class($this)."::delete_contact", LOG_DEBUG);
|
||||
|
|
@ -1226,7 +1226,7 @@ abstract class CommonObject
|
|||
$listId = implode(",", $temp);
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact";
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."element_contact";
|
||||
$sql .= " WHERE element_id = ".((int) $this->id);
|
||||
if (!empty($listId)) {
|
||||
$sql .= " AND fk_c_type_contact IN (".$this->db->sanitize($listId).")";
|
||||
|
|
@ -1267,13 +1267,13 @@ abstract class CommonObject
|
|||
}
|
||||
$sql .= ", t.civility as civility, t.lastname as lastname, t.firstname, t.email";
|
||||
$sql .= ", tc.source, tc.element, tc.code, tc.libelle";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact tc";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."element_contact ec";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_type_contact tc";
|
||||
$sql .= ", ".$this->db->prefix()."element_contact ec";
|
||||
if ($source == 'internal') {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user t on ec.fk_socpeople = t.rowid";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."user t on ec.fk_socpeople = t.rowid";
|
||||
}
|
||||
if ($source == 'external' || $source == 'thirdparty') {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople t on ec.fk_socpeople = t.rowid";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."socpeople t on ec.fk_socpeople = t.rowid";
|
||||
}
|
||||
$sql .= " WHERE ec.element_id = ".((int) $this->id);
|
||||
$sql .= " AND ec.fk_c_type_contact = tc.rowid";
|
||||
|
|
@ -1348,7 +1348,7 @@ abstract class CommonObject
|
|||
{
|
||||
$sql = "SELECT ec.datecreate, ec.statut, ec.fk_socpeople, ec.fk_c_type_contact,";
|
||||
$sql .= " tc.code, tc.libelle";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as tc)";
|
||||
$sql .= " FROM (".$this->db->prefix()."element_contact as ec, ".$this->db->prefix()."c_type_contact as tc)";
|
||||
$sql .= " WHERE ec.rowid =".((int) $rowid);
|
||||
$sql .= " AND ec.fk_c_type_contact=tc.rowid";
|
||||
$sql .= " AND tc.element = '".$this->db->escape($this->element)."'";
|
||||
|
|
@ -1393,7 +1393,7 @@ abstract class CommonObject
|
|||
|
||||
$tab = array();
|
||||
$sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle, tc.position";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_type_contact as tc";
|
||||
$sql .= " WHERE tc.element='".$this->db->escape($this->element)."'";
|
||||
if ($activeonly == 1) {
|
||||
$sql .= " AND tc.active=1"; // only the active types
|
||||
|
|
@ -1453,7 +1453,7 @@ abstract class CommonObject
|
|||
$tab = array();
|
||||
|
||||
$sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle, tc.position, tc.element";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_type_contact as tc";
|
||||
|
||||
$sqlWhere = array();
|
||||
if (!empty($element)) {
|
||||
|
|
@ -1551,14 +1551,14 @@ abstract class CommonObject
|
|||
}
|
||||
|
||||
$sql = "SELECT ec.fk_socpeople";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."element_contact as ec,";
|
||||
$sql .= " FROM ".$this->db->prefix()."element_contact as ec,";
|
||||
if ($source == 'internal') {
|
||||
$sql .= " ".MAIN_DB_PREFIX."user as c,";
|
||||
$sql .= " ".$this->db->prefix()."user as c,";
|
||||
}
|
||||
if ($source == 'external') {
|
||||
$sql .= " ".MAIN_DB_PREFIX."socpeople as c,";
|
||||
$sql .= " ".$this->db->prefix()."socpeople as c,";
|
||||
}
|
||||
$sql .= " ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||
$sql .= " ".$this->db->prefix()."c_type_contact as tc";
|
||||
$sql .= " WHERE ec.element_id = ".((int) $id);
|
||||
$sql .= " AND ec.fk_socpeople = c.rowid";
|
||||
if ($source == 'internal') {
|
||||
|
|
@ -1674,7 +1674,7 @@ abstract class CommonObject
|
|||
return 0;
|
||||
}
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$this->table_element." WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."' LIMIT 1";
|
||||
$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element." WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."' LIMIT 1";
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
|
|
@ -1716,7 +1716,7 @@ abstract class CommonObject
|
|||
if ($idtype > 0) {
|
||||
if (empty($this->barcode_type) || empty($this->barcode_type_code) || empty($this->barcode_type_label) || empty($this->barcode_type_coder)) { // If data not already loaded
|
||||
$sql = "SELECT rowid, code, libelle as label, coder";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_barcode_type";
|
||||
$sql .= " WHERE rowid = ".((int) $idtype);
|
||||
dol_syslog(get_class($this).'::fetch_barcode', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -1853,7 +1853,7 @@ abstract class CommonObject
|
|||
|
||||
$result = false;
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$table;
|
||||
$sql = "SELECT rowid FROM ".$this->db->prefix().$table;
|
||||
$sql .= " WHERE ".$field." = '".$this->db->escape($key)."'";
|
||||
if (!empty($element)) {
|
||||
$sql .= " AND entity IN (".getEntity($element).")";
|
||||
|
|
@ -1886,7 +1886,7 @@ abstract class CommonObject
|
|||
{
|
||||
$result = false;
|
||||
if (!empty($id) && !empty($field) && !empty($table)) {
|
||||
$sql = "SELECT ".$field." FROM ".MAIN_DB_PREFIX.$table;
|
||||
$sql = "SELECT ".$field." FROM ".$this->db->prefix().$table;
|
||||
$sql .= " WHERE rowid = ".((int) $id);
|
||||
|
||||
dol_syslog(get_class($this).'::getValueFrom', LOG_DEBUG);
|
||||
|
|
@ -1944,7 +1944,7 @@ abstract class CommonObject
|
|||
$fk_user_field = 'fk_user_mod';
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET ";
|
||||
$sql = "UPDATE ".$this->db->prefix().$table." SET ";
|
||||
|
||||
if ($format == 'text') {
|
||||
$sql .= $field." = '".$this->db->escape($value)."'";
|
||||
|
|
@ -2044,20 +2044,20 @@ abstract class CommonObject
|
|||
}
|
||||
$restrictiononfksoc = empty($this->restrictiononfksoc) ? 0 : $this->restrictiononfksoc;
|
||||
$sql = "SELECT MAX(te.".$fieldid.")";
|
||||
$sql .= " FROM ".(empty($nodbprefix) ?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
||||
$sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te";
|
||||
if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
$sql .= ",".$this->db->prefix()."usergroup_user as ug";
|
||||
}
|
||||
if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) {
|
||||
$tmparray = explode('@', $this->ismultientitymanaged);
|
||||
$sql .= ", ".MAIN_DB_PREFIX.$tmparray[1]." as ".($tmparray[1] == 'societe' ? 's' : 'parenttable'); // If we need to link to this table to limit select to entity
|
||||
$sql .= ", ".$this->db->prefix().$tmparray[1]." as ".($tmparray[1] == 'societe' ? 's' : 'parenttable'); // If we need to link to this table to limit select to entity
|
||||
} elseif ($restrictiononfksoc == 1 && $this->element != 'societe' && empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to socid
|
||||
$sql .= ", ".$this->db->prefix()."societe as s"; // If we need to link to societe to limit select to socid
|
||||
} elseif ($restrictiononfksoc == 2 && $this->element != 'societe' && empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid
|
||||
}
|
||||
if ($restrictiononfksoc && empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$aliastablesociete.".rowid = sc.fk_soc";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."societe_commerciaux as sc ON ".$aliastablesociete.".rowid = sc.fk_soc";
|
||||
}
|
||||
$sql .= " WHERE te.".$fieldid." < '".$this->db->escape($fieldid == 'rowid' ? $this->id : $this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
||||
if ($restrictiononfksoc == 1 && empty($user->rights->societe->client->voir) && !$socid) {
|
||||
|
|
@ -2114,20 +2114,20 @@ abstract class CommonObject
|
|||
$this->ref_previous = $row[0];
|
||||
|
||||
$sql = "SELECT MIN(te.".$fieldid.")";
|
||||
$sql .= " FROM ".(empty($nodbprefix) ?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
||||
$sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te";
|
||||
if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
$sql .= ",".$this->db->prefix()."usergroup_user as ug";
|
||||
}
|
||||
if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) {
|
||||
$tmparray = explode('@', $this->ismultientitymanaged);
|
||||
$sql .= ", ".MAIN_DB_PREFIX.$tmparray[1]." as ".($tmparray[1] == 'societe' ? 's' : 'parenttable'); // If we need to link to this table to limit select to entity
|
||||
$sql .= ", ".$this->db->prefix().$tmparray[1]." as ".($tmparray[1] == 'societe' ? 's' : 'parenttable'); // If we need to link to this table to limit select to entity
|
||||
} elseif ($restrictiononfksoc == 1 && $this->element != 'societe' && empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to socid
|
||||
$sql .= ", ".$this->db->prefix()."societe as s"; // If we need to link to societe to limit select to socid
|
||||
} elseif ($restrictiononfksoc == 2 && $this->element != 'societe' && empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid
|
||||
}
|
||||
if ($restrictiononfksoc && empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$aliastablesociete.".rowid = sc.fk_soc";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."societe_commerciaux as sc ON ".$aliastablesociete.".rowid = sc.fk_soc";
|
||||
}
|
||||
$sql .= " WHERE te.".$fieldid." > '".$this->db->escape($fieldid == 'rowid' ? $this->id : $this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
||||
if ($restrictiononfksoc == 1 && empty($user->rights->societe->client->voir) && !$socid) {
|
||||
|
|
@ -2226,7 +2226,7 @@ abstract class CommonObject
|
|||
return -1;
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element;
|
||||
if (!empty($this->fields['fk_project'])) { // Common case
|
||||
if ($projectid) {
|
||||
$sql .= " SET fk_project = ".((int) $projectid);
|
||||
|
|
@ -2269,6 +2269,8 @@ abstract class CommonObject
|
|||
*/
|
||||
public function setPaymentMethods($id)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$error = 0; $notrigger = 0;
|
||||
|
||||
dol_syslog(get_class($this).'::setPaymentMethods('.$id.')');
|
||||
|
|
@ -2289,7 +2291,7 @@ abstract class CommonObject
|
|||
$fieldname = 'fk_typepayment';
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element;
|
||||
$sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL');
|
||||
$sql .= ' WHERE rowid='.((int) $this->id);
|
||||
|
||||
|
|
@ -2333,7 +2335,7 @@ abstract class CommonObject
|
|||
if ($this->statut >= 0 || $this->element == 'societe') {
|
||||
$fieldname = 'multicurrency_code';
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = 'UPDATE '.$this->db->prefix().$this->table_element;
|
||||
$sql .= " SET ".$fieldname." = '".$this->db->escape($code)."'";
|
||||
$sql .= ' WHERE rowid='.((int) $this->id);
|
||||
|
||||
|
|
@ -2371,7 +2373,7 @@ abstract class CommonObject
|
|||
if ($this->statut >= 0 || $this->element == 'societe') {
|
||||
$fieldname = 'multicurrency_tx';
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = 'UPDATE '.$this->db->prefix().$this->table_element;
|
||||
$sql .= " SET ".$fieldname." = ".((float) $rate);
|
||||
$sql .= ' WHERE rowid='.((int) $this->id);
|
||||
|
||||
|
|
@ -2579,7 +2581,7 @@ abstract class CommonObject
|
|||
$fieldname = 'cond_reglement_supplier';
|
||||
}
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = 'UPDATE '.$this->db->prefix().$this->table_element;
|
||||
$sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL');
|
||||
$sql .= ' WHERE rowid='.((int) $this->id);
|
||||
|
||||
|
|
@ -2621,7 +2623,7 @@ abstract class CommonObject
|
|||
$fieldname = 'transport_mode_supplier';
|
||||
}
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = 'UPDATE '.$this->db->prefix().$this->table_element;
|
||||
$sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL');
|
||||
$sql .= ' WHERE rowid='.((int) $this->id);
|
||||
|
||||
|
|
@ -2656,7 +2658,7 @@ abstract class CommonObject
|
|||
if ($this->statut >= 0 || $this->element == 'societe') {
|
||||
$fieldname = 'retained_warranty_fk_cond_reglement';
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = 'UPDATE '.$this->db->prefix().$this->table_element;
|
||||
$sql .= " SET ".$fieldname." = ".((int) $id);
|
||||
$sql .= ' WHERE rowid='.((int) $this->id);
|
||||
|
||||
|
|
@ -2689,7 +2691,7 @@ abstract class CommonObject
|
|||
$fieldname = 'fk_address';
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET ".$fieldname." = ".((int) $id);
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element." SET ".$fieldname." = ".((int) $id);
|
||||
$sql .= " WHERE rowid = ".((int) $this->id)." AND fk_statut = 0";
|
||||
|
||||
if ($this->db->query($sql)) {
|
||||
|
|
@ -2734,7 +2736,7 @@ abstract class CommonObject
|
|||
}
|
||||
dol_syslog(get_class($this).'::setShippingMethod('.$shipping_method_id.')');
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element;
|
||||
$sql .= " SET fk_shipping_method = ".((int) $shipping_method_id);
|
||||
$sql .= " WHERE rowid=".((int) $this->id);
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -2781,7 +2783,7 @@ abstract class CommonObject
|
|||
}
|
||||
dol_syslog(get_class($this).'::setWarehouse('.$warehouse_id.')');
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element;
|
||||
$sql .= " SET fk_warehouse = ".((int) $warehouse_id);
|
||||
$sql .= " WHERE rowid=".((int) $this->id);
|
||||
|
||||
|
|
@ -2812,7 +2814,7 @@ abstract class CommonObject
|
|||
|
||||
$newmodelpdf = dol_trunc($modelpdf, 255);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element;
|
||||
$sql .= " SET model_pdf = '".$this->db->escape($newmodelpdf)."'";
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
|
|
@ -2858,7 +2860,7 @@ abstract class CommonObject
|
|||
}
|
||||
dol_syslog(get_class($this).'::setBankAccount('.$fk_account.')');
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element;
|
||||
$sql .= " SET fk_account = ".((int) $fk_account);
|
||||
$sql .= " WHERE rowid=".((int) $this->id);
|
||||
|
||||
|
|
@ -2915,7 +2917,7 @@ abstract class CommonObject
|
|||
|
||||
// Count number of lines to reorder (according to choice $renum)
|
||||
$nl = 0;
|
||||
$sql = "SELECT count(rowid) FROM ".MAIN_DB_PREFIX.$this->table_element_line;
|
||||
$sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line;
|
||||
$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
|
||||
if (!$renum) {
|
||||
$sql .= ' AND rang = 0';
|
||||
|
|
@ -2937,7 +2939,7 @@ abstract class CommonObject
|
|||
$rows = array();
|
||||
|
||||
// We first search all lines that are parent lines (for multilevel details lines)
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$this->table_element_line;
|
||||
$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line;
|
||||
$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
|
||||
if ($fk_parent_line) {
|
||||
$sql .= ' AND fk_parent_line IS NULL';
|
||||
|
|
@ -2985,7 +2987,7 @@ abstract class CommonObject
|
|||
{
|
||||
$rows = array();
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$this->table_element_line;
|
||||
$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line;
|
||||
$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
|
||||
$sql .= ' AND fk_parent_line = '.((int) $id);
|
||||
$sql .= ' ORDER BY rang ASC';
|
||||
|
|
@ -3063,7 +3065,7 @@ abstract class CommonObject
|
|||
$fieldposition = 'position';
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
|
||||
$sql .= ' WHERE rowid = '.((int) $rowid);
|
||||
|
||||
dol_syslog(get_class($this)."::updateRangOfLine", LOG_DEBUG);
|
||||
|
|
@ -3109,11 +3111,11 @@ abstract class CommonObject
|
|||
$fieldposition = 'position';
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
|
||||
$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
|
||||
$sql .= ' AND rang = '.((int) ($rang - 1));
|
||||
if ($this->db->query($sql)) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang - 1));
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang - 1));
|
||||
$sql .= ' WHERE rowid = '.((int) $rowid);
|
||||
if (!$this->db->query($sql)) {
|
||||
dol_print_error($this->db);
|
||||
|
|
@ -3140,11 +3142,11 @@ abstract class CommonObject
|
|||
$fieldposition = 'position';
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
|
||||
$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
|
||||
$sql .= ' AND rang = '.((int) ($rang + 1));
|
||||
if ($this->db->query($sql)) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang + 1));
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang + 1));
|
||||
$sql .= ' WHERE rowid = '.((int) $rowid);
|
||||
if (!$this->db->query($sql)) {
|
||||
dol_print_error($this->db);
|
||||
|
|
@ -3163,7 +3165,7 @@ abstract class CommonObject
|
|||
*/
|
||||
public function getRangOfLine($rowid)
|
||||
{
|
||||
$sql = "SELECT rang FROM ".MAIN_DB_PREFIX.$this->table_element_line;
|
||||
$sql = "SELECT rang FROM ".$this->db->prefix().$this->table_element_line;
|
||||
$sql .= " WHERE rowid = ".((int) $rowid);
|
||||
|
||||
dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG);
|
||||
|
|
@ -3182,7 +3184,7 @@ abstract class CommonObject
|
|||
*/
|
||||
public function getIdOfLine($rang)
|
||||
{
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$this->table_element_line;
|
||||
$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line;
|
||||
$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
|
||||
$sql .= " AND rang = ".((int) $rang);
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -3209,7 +3211,7 @@ abstract class CommonObject
|
|||
|
||||
// Search the last rang with fk_parent_line
|
||||
if ($fk_parent_line) {
|
||||
$sql = "SELECT max(".$positionfield.") FROM ".MAIN_DB_PREFIX.$this->table_element_line;
|
||||
$sql = "SELECT max(".$positionfield.") FROM ".$this->db->prefix().$this->table_element_line;
|
||||
$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
|
||||
$sql .= " AND fk_parent_line = ".((int) $fk_parent_line);
|
||||
|
||||
|
|
@ -3225,7 +3227,7 @@ abstract class CommonObject
|
|||
}
|
||||
} else {
|
||||
// If not, search the last rang of element
|
||||
$sql = "SELECT max(".$positionfield.") FROM ".MAIN_DB_PREFIX.$this->table_element_line;
|
||||
$sql = "SELECT max(".$positionfield.") FROM ".$this->db->prefix().$this->table_element_line;
|
||||
$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
|
||||
|
||||
dol_syslog(get_class($this)."::line_max", LOG_DEBUG);
|
||||
|
|
@ -3252,7 +3254,7 @@ abstract class CommonObject
|
|||
return -1;
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element;
|
||||
$sql .= " SET ref_ext = '".$this->db->escape($ref_ext)."'";
|
||||
$sql .= " WHERE ".(isset($this->table_rowid) ? $this->table_rowid : 'rowid')." = ".((int) $this->id);
|
||||
|
||||
|
|
@ -3303,7 +3305,7 @@ abstract class CommonObject
|
|||
} else {
|
||||
$fieldusermod = "fk_user_modif";
|
||||
}
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element;
|
||||
$sql .= " SET note".$newsuffix." = ".(!empty($note) ? ("'".$this->db->escape($note)."'") : "NULL");
|
||||
$sql .= ", ".$fieldusermod." = ".((int) $user->id);
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
|
@ -3427,7 +3429,7 @@ abstract class CommonObject
|
|||
$sql .= ', situation_percent';
|
||||
}
|
||||
$sql .= ', multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc';
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element_line;
|
||||
$sql .= " FROM ".$this->db->prefix().$this->table_element_line;
|
||||
$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
|
||||
if ($exclspec) {
|
||||
$product_field = 'product_type';
|
||||
|
|
@ -3475,7 +3477,7 @@ abstract class CommonObject
|
|||
//var_dump($diff_when_using_price_ht.' '.$diff_on_current_total);
|
||||
|
||||
if ($diff_when_using_price_ht && $diff_on_current_total) {
|
||||
$sqlfix = "UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldtva." = ".price2num((float) $tmpcal[1]).", total_ttc = ".price2num((float) $tmpcal[2])." WHERE rowid = ".((int) $obj->rowid);
|
||||
$sqlfix = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldtva." = ".price2num((float) $tmpcal[1]).", total_ttc = ".price2num((float) $tmpcal[2])." WHERE rowid = ".((int) $obj->rowid);
|
||||
dol_syslog('We found unconsistent data into detailed line (diff_when_using_price_ht = '.$diff_when_using_price_ht.' and diff_on_current_total = '.$diff_on_current_total.') for line rowid = '.$obj->rowid." (total vat of line calculated=".$tmpcal[1].", database=".$obj->total_tva."). We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix, LOG_WARNING);
|
||||
$resqlfix = $this->db->query($sqlfix);
|
||||
if (!$resqlfix) {
|
||||
|
|
@ -3519,7 +3521,7 @@ abstract class CommonObject
|
|||
dol_print_error('', $errmsg);
|
||||
exit;
|
||||
}
|
||||
$sqlfix = "UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldtva." = ".price2num($obj->total_tva - $diff).", total_ttc = ".price2num($obj->total_ttc - $diff)." WHERE rowid = ".((int) $obj->rowid);
|
||||
$sqlfix = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldtva." = ".price2num($obj->total_tva - $diff).", total_ttc = ".price2num($obj->total_ttc - $diff)." WHERE rowid = ".((int) $obj->rowid);
|
||||
dol_syslog('We found a difference of '.$diff.' for line rowid = '.$obj->rowid.". We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix);
|
||||
$resqlfix = $this->db->query($sqlfix);
|
||||
if (!$resqlfix) {
|
||||
|
|
@ -3587,7 +3589,7 @@ abstract class CommonObject
|
|||
}
|
||||
|
||||
if (empty($nodatabaseupdate)) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element.' SET';
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element.' SET';
|
||||
$sql .= " ".$fieldht." = ".((float) price2num($this->total_ht)).",";
|
||||
$sql .= " ".$fieldtva." = ".((float) price2num($this->total_tva)).",";
|
||||
$sql .= " ".$fieldlocaltax1." = ".((float) price2num($this->total_localtax1)).",";
|
||||
|
|
@ -3668,7 +3670,7 @@ abstract class CommonObject
|
|||
$this->db->begin();
|
||||
$error = 0;
|
||||
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "element_element (";
|
||||
$sql = "INSERT INTO " . $this->db->prefix() . "element_element (";
|
||||
$sql .= "fk_source";
|
||||
$sql .= ", sourcetype";
|
||||
$sql .= ", fk_target";
|
||||
|
|
@ -3775,8 +3777,8 @@ abstract class CommonObject
|
|||
}*/
|
||||
|
||||
// Links between objects are stored in table element_element
|
||||
$sql = 'SELECT rowid, fk_source, sourcetype, fk_target, targettype';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'element_element';
|
||||
$sql = "SELECT rowid, fk_source, sourcetype, fk_target, targettype";
|
||||
$sql .= " FROM ".$this->db->prefix()."element_element";
|
||||
$sql .= " WHERE ";
|
||||
if ($justsource || $justtarget) {
|
||||
if ($justsource) {
|
||||
|
|
@ -3794,7 +3796,7 @@ abstract class CommonObject
|
|||
$sql .= "(fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."')";
|
||||
$sql .= " ".$clause." (fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."')";
|
||||
}
|
||||
$sql .= ' ORDER BY '.$orderby;
|
||||
$sql .= " ORDER BY ".$orderby;
|
||||
|
||||
dol_syslog(get_class($this)."::fetchObjectLink", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -3962,7 +3964,7 @@ abstract class CommonObject
|
|||
$this->db->begin();
|
||||
$error = 0;
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "element_element SET ";
|
||||
$sql = "UPDATE " . $this->db->prefix() . "element_element SET ";
|
||||
if ($updatesource) {
|
||||
$sql .= "fk_source = " . ((int) $sourceid);
|
||||
$sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'";
|
||||
|
|
@ -4051,7 +4053,7 @@ abstract class CommonObject
|
|||
}
|
||||
|
||||
if (!$error) {
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "element_element";
|
||||
$sql = "DELETE FROM " . $this->db->prefix() . "element_element";
|
||||
$sql .= " WHERE";
|
||||
if ($rowid > 0) {
|
||||
$sql .= " rowid = " . ((int) $rowid);
|
||||
|
|
@ -4103,7 +4105,7 @@ abstract class CommonObject
|
|||
|
||||
global $db;
|
||||
|
||||
$sql = "SELECT ".$field_select." FROM ".MAIN_DB_PREFIX.$table_element." WHERE ".$field_where." = ".((int) $fk_object_where);
|
||||
$sql = "SELECT ".$field_select." FROM ".$db->prefix().$table_element." WHERE ".$field_where." = ".((int) $fk_object_where);
|
||||
$resql = $db->query($sql);
|
||||
|
||||
$TRes = array();
|
||||
|
|
@ -4132,7 +4134,7 @@ abstract class CommonObject
|
|||
|
||||
global $db;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$table_element." WHERE ".$field_where." = ".((int) $fk_object_where);
|
||||
$sql = "DELETE FROM ".$db->prefix().$table_element." WHERE ".$field_where." = ".((int) $fk_object_where);
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if (empty($resql)) {
|
||||
|
|
@ -4185,7 +4187,7 @@ abstract class CommonObject
|
|||
$fieldstatus = 'status';
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$elementTable;
|
||||
$sql = "UPDATE ".$this->db->prefix().$elementTable;
|
||||
$sql .= " SET ".$fieldstatus." = ".((int) $status);
|
||||
// If status = 1 = validated, update also fk_user_valid
|
||||
// TODO Replace the test on $elementTable by doing a test on existence of the field in $this->fields
|
||||
|
|
@ -4286,7 +4288,7 @@ abstract class CommonObject
|
|||
$ref = trim($ref);
|
||||
|
||||
$sql = "SELECT rowid, canvas";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= " FROM ".$this->db->prefix().$this->table_element;
|
||||
$sql .= " WHERE entity IN (".getEntity($this->element).")";
|
||||
if (!empty($id)) {
|
||||
$sql .= " AND rowid = ".((int) $id);
|
||||
|
|
@ -4319,7 +4321,7 @@ abstract class CommonObject
|
|||
*/
|
||||
public function getSpecialCode($lineid)
|
||||
{
|
||||
$sql = "SELECT special_code FROM ".MAIN_DB_PREFIX.$this->table_element_line;
|
||||
$sql = "SELECT special_code FROM ".$this->db->prefix().$this->table_element_line;
|
||||
$sql .= " WHERE rowid = ".((int) $lineid);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
|
@ -4361,7 +4363,7 @@ abstract class CommonObject
|
|||
foreach ($arraytoscan as $table => $elementname) {
|
||||
//print $id.'-'.$table.'-'.$elementname.'<br>';
|
||||
// Check if third party can be deleted
|
||||
$sql = "SELECT COUNT(*) as nb from ".MAIN_DB_PREFIX.$table;
|
||||
$sql = "SELECT COUNT(*) as nb from ".$this->db->prefix().$table;
|
||||
$sql .= " WHERE ".$this->fk_element." = ".((int) $id);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
|
@ -4437,7 +4439,7 @@ abstract class CommonObject
|
|||
$total_discount = 0.00;
|
||||
|
||||
$sql = "SELECT subprice as pu_ht, qty, remise_percent, total_ht";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element_line;
|
||||
$sql .= " FROM ".$this->db->prefix().$this->table_element_line;
|
||||
$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
|
||||
|
||||
dol_syslog(get_class($this).'::getTotalDiscount', LOG_DEBUG);
|
||||
|
|
@ -4577,7 +4579,7 @@ abstract class CommonObject
|
|||
|
||||
$extraparams = (!empty($this->extraparams) ? json_encode($this->extraparams) : null);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element;
|
||||
$sql .= " SET extraparams = ".(!empty($extraparams) ? "'".$this->db->escape($extraparams)."'" : "null");
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
|
|
@ -5072,7 +5074,7 @@ abstract class CommonObject
|
|||
// phpcs:enable
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_resources (";
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."element_resources (";
|
||||
$sql .= "resource_id";
|
||||
$sql .= ", resource_type";
|
||||
$sql .= ", element_id";
|
||||
|
|
@ -5115,7 +5117,7 @@ abstract class CommonObject
|
|||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_resources";
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."element_resources";
|
||||
$sql .= " WHERE rowid = ".((int) $rowid);
|
||||
|
||||
dol_syslog(get_class($this)."::delete_resource", LOG_DEBUG);
|
||||
|
|
@ -5435,7 +5437,7 @@ abstract class CommonObject
|
|||
//var_dump($obj->update_main_doc_field);exit;
|
||||
|
||||
if ($update_main_doc_field && !empty($this->table_element)) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET last_main_doc = '".$this->db->escape($ecmfile->filepath."/".$ecmfile->filename)."'";
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element." SET last_main_doc = '".$this->db->escape($ecmfile->filepath."/".$ecmfile->filename)."'";
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -5599,7 +5601,7 @@ abstract class CommonObject
|
|||
|
||||
// Request to get translation values for object
|
||||
$sql = "SELECT rowid, property, lang , value";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."object_lang";
|
||||
$sql .= " FROM ".$this->db->prefix()."object_lang";
|
||||
$sql .= " WHERE type_object = '".$this->db->escape($element)."'";
|
||||
$sql .= " AND fk_object = ".((int) $this->id);
|
||||
|
||||
|
|
@ -5804,7 +5806,7 @@ abstract class CommonObject
|
|||
$sql .= ", ".$name;
|
||||
}
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$table_element."_extrafields";
|
||||
$sql .= " FROM ".$this->db->prefix().$table_element."_extrafields";
|
||||
$sql .= " WHERE fk_object = ".((int) $rowid);
|
||||
|
||||
//dol_syslog(get_class($this)."::fetch_optionals get extrafields data for ".$this->table_element, LOG_DEBUG); // Too verbose
|
||||
|
|
@ -5878,7 +5880,7 @@ abstract class CommonObject
|
|||
|
||||
dol_syslog(get_class($this)."::deleteExtraFields delete", LOG_DEBUG);
|
||||
|
||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$table_element."_extrafields WHERE fk_object = ".((int) $this->id);
|
||||
$sql_del = "DELETE FROM ".$this->db->prefix().$table_element."_extrafields WHERE fk_object = ".((int) $this->id);
|
||||
|
||||
$resql = $this->db->query($sql_del);
|
||||
if (!$resql) {
|
||||
|
|
@ -6078,10 +6080,10 @@ abstract class CommonObject
|
|||
|
||||
dol_syslog(get_class($this)."::insertExtraFields delete then insert", LOG_DEBUG);
|
||||
|
||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$table_element."_extrafields WHERE fk_object = ".((int) $this->id);
|
||||
$sql_del = "DELETE FROM ".$this->db->prefix().$table_element."_extrafields WHERE fk_object = ".((int) $this->id);
|
||||
$this->db->query($sql_del);
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$table_element."_extrafields (fk_object";
|
||||
$sql = "INSERT INTO ".$this->db->prefix().$table_element."_extrafields (fk_object";
|
||||
foreach ($new_array_options as $key => $value) {
|
||||
$attributeKey = substr($key, 8); // Remove 'options_' prefix
|
||||
// Add field of attribut
|
||||
|
|
@ -6229,13 +6231,13 @@ abstract class CommonObject
|
|||
|
||||
foreach ($new_array_languages as $key => $langcodearray) { // $key = 'name', 'town', ...
|
||||
foreach ($langcodearray as $langcode => $value) {
|
||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."object_lang";
|
||||
$sql_del = "DELETE FROM ".$this->db->prefix()."object_lang";
|
||||
$sql_del .= " WHERE fk_object = ".((int) $this->id)." AND property = '".$this->db->escape($key)."' AND type_object = '".$this->db->escape($table_element)."'";
|
||||
$sql_del .= " AND lang = '".$this->db->escape($langcode)."'";
|
||||
$this->db->query($sql_del);
|
||||
|
||||
if ($value !== '') {
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."object_lang (fk_object, property, type_object, lang, value";
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."object_lang (fk_object, property, type_object, lang, value";
|
||||
$sql .= ") VALUES (".$this->id.", '".$this->db->escape($key)."', '".$this->db->escape($table_element)."', '".$this->db->escape($langcode)."', '".$this->db->escape($value)."'";
|
||||
$sql .= ")";
|
||||
|
||||
|
|
@ -6419,7 +6421,7 @@ abstract class CommonObject
|
|||
$linealreadyfound = 0;
|
||||
|
||||
// Check if there is already a line for this object (in most cases, it is, but sometimes it is not, for example when extra field has been created after), so we must keep this overload)
|
||||
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".((int) $this->id);
|
||||
$sql = "SELECT COUNT(rowid) as nb FROM ".$this->db->prefix().$this->table_element."_extrafields WHERE fk_object = ".((int) $this->id);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$tmpobj = $this->db->fetch_object($resql);
|
||||
|
|
@ -6430,9 +6432,9 @@ abstract class CommonObject
|
|||
|
||||
if ($linealreadyfound) {
|
||||
if ($this->array_options["options_".$key] === null) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET ".$key." = null";
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element."_extrafields SET ".$key." = null";
|
||||
} else {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET ".$key." = '".$this->db->escape($this->array_options["options_".$key])."'";
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element."_extrafields SET ".$key." = '".$this->db->escape($this->array_options["options_".$key])."'";
|
||||
}
|
||||
$sql .= " WHERE fk_object = ".((int) $this->id);
|
||||
} else {
|
||||
|
|
@ -6761,7 +6763,7 @@ abstract class CommonObject
|
|||
|
||||
$sqlwhere = '';
|
||||
$sql = "SELECT ".$keyList;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$InfoFieldList[0];
|
||||
$sql .= " FROM ".$this->db->prefix().$InfoFieldList[0];
|
||||
if (!empty($InfoFieldList[4])) {
|
||||
// can use SELECT request
|
||||
if (strpos($InfoFieldList[4], '$SEL$') !== false) {
|
||||
|
|
@ -6777,7 +6779,7 @@ abstract class CommonObject
|
|||
|
||||
//We have to join on extrafield table
|
||||
if (strpos($InfoFieldList[4], 'extra') !== false) {
|
||||
$sql .= " as main, ".MAIN_DB_PREFIX.$InfoFieldList[0]."_extrafields as extra";
|
||||
$sql .= " as main, ".$this->db->prefix().$InfoFieldList[0]."_extrafields as extra";
|
||||
$sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4];
|
||||
} else {
|
||||
$sqlwhere .= " WHERE ".$InfoFieldList[4];
|
||||
|
|
@ -6913,7 +6915,7 @@ abstract class CommonObject
|
|||
|
||||
$sqlwhere = '';
|
||||
$sql = "SELECT ".$keyList;
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0];
|
||||
$sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0];
|
||||
if (!empty($InfoFieldList[4])) {
|
||||
// can use SELECT request
|
||||
if (strpos($InfoFieldList[4], '$SEL$') !== false) {
|
||||
|
|
@ -6929,7 +6931,7 @@ abstract class CommonObject
|
|||
|
||||
// We have to join on extrafield table
|
||||
if (strpos($InfoFieldList[4], 'extra') !== false) {
|
||||
$sql .= ' as main, '.MAIN_DB_PREFIX.$InfoFieldList[0].'_extrafields as extra';
|
||||
$sql .= ' as main, '.$this->db->prefix().$InfoFieldList[0].'_extrafields as extra';
|
||||
$sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4];
|
||||
} else {
|
||||
$sqlwhere .= " WHERE ".$InfoFieldList[4];
|
||||
|
|
@ -7274,7 +7276,7 @@ abstract class CommonObject
|
|||
}
|
||||
|
||||
$sql = "SELECT ".$keyList;
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0];
|
||||
$sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0];
|
||||
if (strpos($InfoFieldList[4], 'extra') !== false) {
|
||||
$sql .= ' as main';
|
||||
}
|
||||
|
|
@ -7357,7 +7359,7 @@ abstract class CommonObject
|
|||
}
|
||||
|
||||
$sql = "SELECT ".$keyList;
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0];
|
||||
$sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0];
|
||||
if (strpos($InfoFieldList[4], 'extra') !== false) {
|
||||
$sql .= ' as main';
|
||||
}
|
||||
|
|
@ -8050,7 +8052,7 @@ abstract class CommonObject
|
|||
public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables, $ignoreerrors = 0)
|
||||
{
|
||||
foreach ($tables as $table) {
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$table.' SET fk_soc = '.((int) $dest_id).' WHERE fk_soc = '.((int) $origin_id);
|
||||
$sql = 'UPDATE '.$db->prefix().$table.' SET fk_soc = '.((int) $dest_id).' WHERE fk_soc = '.((int) $origin_id);
|
||||
|
||||
if (!$db->query($sql)) {
|
||||
if ($ignoreerrors) {
|
||||
|
|
@ -8774,7 +8776,7 @@ abstract class CommonObject
|
|||
$this->db->begin();
|
||||
|
||||
if (!$error) {
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = "INSERT INTO ".$this->db->prefix().$this->table_element;
|
||||
$sql .= " (".implode(", ", $keys).')';
|
||||
$sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123
|
||||
|
||||
|
|
@ -8790,13 +8792,13 @@ abstract class CommonObject
|
|||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
|
||||
$this->id = $this->db->last_insert_id($this->db->prefix().$this->table_element);
|
||||
}
|
||||
|
||||
// If we have a field ref with a default value of (PROV)
|
||||
if (!$error) {
|
||||
if (key_exists('ref', $this->fields) && $this->fields['ref']['notnull'] > 0 && key_exists('default', $this->fields['ref']) && $this->fields['ref']['default'] == '(PROV)') {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET ref = '(PROV".((int) $this->id).")' WHERE (ref = '(PROV)' OR ref = '') AND rowid = ".((int) $this->id);
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element." SET ref = '(PROV".((int) $this->id).")' WHERE (ref = '(PROV)' OR ref = '') AND rowid = ".((int) $this->id);
|
||||
$resqlupdate = $this->db->query($sql);
|
||||
|
||||
if ($resqlupdate === false) {
|
||||
|
|
@ -8881,7 +8883,7 @@ abstract class CommonObject
|
|||
}
|
||||
|
||||
$sql = "SELECT ".$fieldlist;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
$sql .= " FROM ".$this->db->prefix().$this->table_element.' as t';
|
||||
|
||||
if (!empty($id)) {
|
||||
$sql .= ' WHERE t.rowid = '.((int) $id);
|
||||
|
|
@ -8936,7 +8938,7 @@ abstract class CommonObject
|
|||
$objectline = new $objectlineclassname($this->db);
|
||||
|
||||
$sql = "SELECT ".$objectline->getFieldList('l');
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$objectline->table_element." as l";
|
||||
$sql .= " FROM ".$this->db->prefix().$objectline->table_element." as l";
|
||||
$sql .= " WHERE l.fk_".$this->db->escape($this->element)." = ".((int) $this->id);
|
||||
if ($morewhere) {
|
||||
$sql .= $morewhere;
|
||||
|
|
@ -9026,7 +9028,7 @@ abstract class CommonObject
|
|||
}*/
|
||||
}
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET '.implode(', ', $tmp).' WHERE rowid='.((int) $this->id);
|
||||
$sql = 'UPDATE '.$this->db->prefix().$this->table_element.' SET '.implode(', ', $tmp).' WHERE rowid='.((int) $this->id);
|
||||
|
||||
$this->db->begin();
|
||||
if (!$error) {
|
||||
|
|
@ -9083,7 +9085,7 @@ abstract class CommonObject
|
|||
|
||||
if ($forcechilddeletion) { // Force also delete of childtables that should lock deletion in standard case when option force is off
|
||||
foreach ($this->childtables as $table) {
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$table." WHERE ".$this->fk_element." = ".((int) $this->id);
|
||||
$sql = "DELETE FROM ".$this->db->prefix().$table." WHERE ".$this->fk_element." = ".((int) $this->id);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->error = $this->db->lasterror();
|
||||
|
|
@ -9137,7 +9139,7 @@ abstract class CommonObject
|
|||
}
|
||||
} else {
|
||||
// Delete record in child table
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$table." WHERE ".$this->fk_element." = ".((int) $this->id);
|
||||
$sql = "DELETE FROM ".$this->db->prefix().$table." WHERE ".$this->fk_element." = ".((int) $this->id);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
|
|
@ -9177,7 +9179,7 @@ abstract class CommonObject
|
|||
}
|
||||
|
||||
if (!$error) {
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.((int) $this->id);
|
||||
$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.' WHERE rowid='.((int) $this->id);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
|
|
@ -9216,7 +9218,7 @@ abstract class CommonObject
|
|||
if (!empty($parentId) && !empty($parentField)) {
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element;
|
||||
$sql .= " WHERE ".$parentField." = ".(int) $parentId;
|
||||
|
||||
// Manage filters
|
||||
|
|
@ -9301,7 +9303,7 @@ abstract class CommonObject
|
|||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element_line;
|
||||
$sql = "DELETE FROM ".$this->db->prefix().$this->table_element_line;
|
||||
$sql .= " WHERE rowid = ".((int) $idline);
|
||||
|
||||
dol_syslog(get_class($this)."::deleteLineCommon", LOG_DEBUG);
|
||||
|
|
@ -9355,7 +9357,7 @@ abstract class CommonObject
|
|||
$statusfield = 'fk_statut';
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element;
|
||||
$sql .= " SET ".$statusfield." = ".((int) $status);
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
|
|
@ -9592,8 +9594,8 @@ abstract class CommonObject
|
|||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$categorystatic = new Categorie($this->db);
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_".(empty($categorystatic->MAP_CAT_TABLE[$type]) ? $type : $categorystatic->MAP_CAT_TABLE[$type])." (fk_categorie, fk_product)";
|
||||
$sql .= " SELECT fk_categorie, $toId FROM ".MAIN_DB_PREFIX."categorie_".(empty($categorystatic->MAP_CAT_TABLE[$type]) ? $type : $categorystatic->MAP_CAT_TABLE[$type]);
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."categorie_".(empty($categorystatic->MAP_CAT_TABLE[$type]) ? $type : $categorystatic->MAP_CAT_TABLE[$type])." (fk_categorie, fk_product)";
|
||||
$sql .= " SELECT fk_categorie, $toId FROM ".$this->db->prefix()."categorie_".(empty($categorystatic->MAP_CAT_TABLE[$type]) ? $type : $categorystatic->MAP_CAT_TABLE[$type]);
|
||||
$sql .= " WHERE fk_product = ".((int) $fromId);
|
||||
|
||||
if (!$this->db->query($sql)) {
|
||||
|
|
@ -9641,8 +9643,8 @@ abstract class CommonObject
|
|||
}
|
||||
|
||||
// Delete ecm_files extrafields
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."ecm_files_extrafields WHERE fk_object IN (";
|
||||
$sql .= " SELECT rowid FROM ".MAIN_DB_PREFIX."ecm_files WHERE filename LIKE '".$this->db->escape($this->ref)."%'";
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."ecm_files_extrafields WHERE fk_object IN (";
|
||||
$sql .= " SELECT rowid FROM ".$this->db->prefix()."ecm_files WHERE filename LIKE '".$this->db->escape($this->ref)."%'";
|
||||
$sql .= " AND filepath = '".$this->db->escape($element)."/".$this->db->escape($this->ref)."' AND entity = ".((int) $conf->entity); // No need of getEntity here
|
||||
$sql .= ")";
|
||||
|
||||
|
|
@ -9653,7 +9655,7 @@ abstract class CommonObject
|
|||
}
|
||||
|
||||
// Delete ecm_files
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."ecm_files";
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."ecm_files";
|
||||
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%'";
|
||||
$sql .= " AND filepath = '".$this->db->escape($element)."/".$this->db->escape($this->ref)."' AND entity = ".((int) $conf->entity); // No need of getEntity here
|
||||
|
||||
|
|
@ -9666,8 +9668,8 @@ abstract class CommonObject
|
|||
|
||||
// Delete in database with mode 1
|
||||
if ($mode == 1) {
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."ecm_files_extrafields";
|
||||
$sql .= " WHERE fk_object IN (SELECT rowid FROM ".MAIN_DB_PREFIX."ecm_files WHERE src_object_type = '".$this->db->escape($this->table_element.(empty($this->module) ? "" : "@".$this->module))."' AND src_object_id = ".((int) $this->id).")";
|
||||
$sql = 'DELETE FROM '.$this->db->prefix()."ecm_files_extrafields";
|
||||
$sql .= " WHERE fk_object IN (SELECT rowid FROM ".$this->db->prefix()."ecm_files WHERE src_object_type = '".$this->db->escape($this->table_element.(empty($this->module) ? "" : "@".$this->module))."' AND src_object_id = ".((int) $this->id).")";
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->error = $this->db->lasterror();
|
||||
|
|
@ -9675,7 +9677,7 @@ abstract class CommonObject
|
|||
return false;
|
||||
}
|
||||
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."ecm_files";
|
||||
$sql = 'DELETE FROM '.$this->db->prefix()."ecm_files";
|
||||
$sql .= " WHERE src_object_type = '".$this->db->escape($this->table_element.(empty($this->module) ? "" : "@".$this->module))."' AND src_object_id = ".((int) $this->id);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ abstract class CommonObjectLine extends CommonObject
|
|||
$label_type = 'code';
|
||||
}
|
||||
|
||||
$sql = "SELECT ".$label_type.", code from ".MAIN_DB_PREFIX."c_units where rowid = ".((int) $this->fk_unit);
|
||||
$sql = "SELECT ".$label_type.", code from ".$this->db->prefix()."c_units where rowid = ".((int) $this->fk_unit);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql && $this->db->num_rows($resql) > 0) {
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ class CoreObject extends CommonObject
|
|||
|
||||
$this->{$className} = array();
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$childTable." WHERE ".$this->fk_element." = ".((int) $this->id);
|
||||
$sql = "SELECT rowid FROM ".$this->db->prefix().$childTable." WHERE ".$this->fk_element." = ".((int) $this->id);
|
||||
$res = $this->db->query($sql);
|
||||
|
||||
if ($res) {
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class CProductNature // extends CommonObject
|
|||
global $conf, $langs;
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."(";
|
||||
$sql = "INSERT INTO ".$this->db->prefix().$this->table_element."(";
|
||||
$sql .= "rowid,";
|
||||
$sql .= "code,";
|
||||
$sql .= "label,";
|
||||
|
|
@ -125,7 +125,7 @@ class CProductNature // extends CommonObject
|
|||
$this->db->rollback();
|
||||
return -1;
|
||||
} else {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
|
||||
$this->id = $this->db->last_insert_id($this->db->prefix().$this->table_element);
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
|
|
@ -148,7 +148,7 @@ class CProductNature // extends CommonObject
|
|||
$sql .= " t.code,";
|
||||
$sql .= " t.label,";
|
||||
$sql .= " t.active";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
|
||||
$sql .= " FROM ".$this->db->prefix().$this->table_element." as t";
|
||||
$sql_where = array();
|
||||
if ($id) {
|
||||
$sql_where[] = " t.rowid = ".((int) $id);
|
||||
|
|
@ -197,12 +197,12 @@ class CProductNature // extends CommonObject
|
|||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql = "SELECT";
|
||||
$sql .= " t.rowid,";
|
||||
$sql .= " t.code,";
|
||||
$sql .= " t.label,";
|
||||
$sql .= " t.active";
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
$sql .= " FROM ".$this->db->prefix().$this->table_element." as t";
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
|
|
@ -267,7 +267,7 @@ class CProductNature // extends CommonObject
|
|||
global $conf, $langs;
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element." SET";
|
||||
$sql .= " code=".(isset($this->code) ? ((int) $this->code) : "null").",";
|
||||
$sql .= " label=".(isset($this->label) ? "'".$this->db->escape(trim($this->label))."'" : "null").",";
|
||||
$sql .= " active=".(isset($this->active) ? ((int) $this->active) : "null");
|
||||
|
|
@ -302,7 +302,7 @@ class CProductNature // extends CommonObject
|
|||
global $conf, $langs;
|
||||
$error = 0;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = "DELETE FROM ".$this->db->prefix().$this->table_element;
|
||||
$sql .= " WHERE rowid=".(int) $this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ class Cstate // extends CommonObject
|
|||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_departements(";
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."c_departements(";
|
||||
$sql .= "rowid,";
|
||||
$sql .= "code_departement,";
|
||||
$sql .= "nom,";
|
||||
|
|
@ -128,7 +128,7 @@ class Cstate // extends CommonObject
|
|||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_departements");
|
||||
$this->id = $this->db->last_insert_id($this->db->prefix()."c_departements");
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
|
|
@ -161,7 +161,7 @@ class Cstate // extends CommonObject
|
|||
$sql .= " t.code_departement,";
|
||||
$sql .= " t.nom,";
|
||||
$sql .= " t.active";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_departements as t";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_departements as t";
|
||||
if ($id) {
|
||||
$sql .= " WHERE t.rowid = ".((int) $id);
|
||||
} elseif ($code) {
|
||||
|
|
@ -219,7 +219,7 @@ class Cstate // extends CommonObject
|
|||
// Put here code to add control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."c_departements SET";
|
||||
$sql = "UPDATE ".$this->db->prefix()."c_departements SET";
|
||||
$sql .= " code_departement=".(isset($this->code_departement) ? "'".$this->db->escape($this->code_departement)."'" : "null").",";
|
||||
$sql .= " nom=".(isset($this->nom) ? "'".$this->db->escape($this->nom)."'" : "null").",";
|
||||
$sql .= " active=".(isset($this->active) ? $this->active : "null")."";
|
||||
|
|
@ -260,7 +260,7 @@ class Cstate // extends CommonObject
|
|||
global $conf, $langs;
|
||||
$error = 0;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_departements";
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."c_departements";
|
||||
$sql .= " WHERE rowid=".((int) $this->id);
|
||||
|
||||
$this->db->begin();
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ class Ctypent // extends CommonObject
|
|||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_typent(";
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."c_typent(";
|
||||
|
||||
$sql .= "id,";
|
||||
$sql .= "code,";
|
||||
|
|
@ -135,7 +135,7 @@ class Ctypent // extends CommonObject
|
|||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_typent");
|
||||
$this->id = $this->db->last_insert_id($this->db->prefix()."c_typent");
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
|
|
@ -170,7 +170,7 @@ class Ctypent // extends CommonObject
|
|||
$sql .= " t.fk_country as country_id,";
|
||||
$sql .= " t.active,";
|
||||
$sql .= " t.module";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_typent as t";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_typent as t";
|
||||
if ($id) {
|
||||
$sql .= " WHERE t.id = ".((int) $id);
|
||||
} elseif ($code) {
|
||||
|
|
@ -232,7 +232,7 @@ class Ctypent // extends CommonObject
|
|||
// Put here code to add control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."c_typent SET";
|
||||
$sql = "UPDATE ".$this->db->prefix()."c_typent SET";
|
||||
$sql .= " code=".(isset($this->code) ? "'".$this->db->escape($this->code)."'" : "null").",";
|
||||
$sql .= " libelle=".(isset($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : "null").",";
|
||||
$sql .= " active=".(isset($this->active) ? $this->active : "null").",";
|
||||
|
|
@ -275,7 +275,7 @@ class Ctypent // extends CommonObject
|
|||
global $conf, $langs;
|
||||
$error = 0;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_typent";
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."c_typent";
|
||||
$sql .= " WHERE id=".$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class Ctyperesource
|
|||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'(';
|
||||
$sql = 'INSERT INTO '.$this->db->prefix().$this->table_element.'(';
|
||||
|
||||
$sql .= 'code,';
|
||||
$sql .= 'label';
|
||||
|
|
@ -125,7 +125,7 @@ class Ctyperesource
|
|||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
|
||||
$this->id = $this->db->last_insert_id($this->db->prefix().$this->table_element);
|
||||
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action to call a trigger.
|
||||
|
|
@ -163,12 +163,12 @@ class Ctyperesource
|
|||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
$sql = "SELECT";
|
||||
$sql .= " t.rowid,";
|
||||
$sql .= " t.code,";
|
||||
$sql .= " t.label,";
|
||||
$sql .= " t.active";
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
$sql .= " FROM ".$this->db->prefix().$this->table_element." as t";
|
||||
if ($id) {
|
||||
$sql .= " WHERE t.id = ".((int) $id);
|
||||
} elseif ($code) {
|
||||
|
|
@ -228,12 +228,12 @@ class Ctyperesource
|
|||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
$sql = "SELECT";
|
||||
$sql .= " t.rowid,";
|
||||
$sql .= " t.code,";
|
||||
$sql .= " t.label,";
|
||||
$sql .= " t.active";
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
$sql .= " FROM ".$this->db->prefix().$this->table_element." as t";
|
||||
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
|
|
@ -307,7 +307,7 @@ class Ctyperesource
|
|||
// Put here code to add a control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET';
|
||||
$sql = 'UPDATE '.$this->db->prefix().$this->table_element.' SET';
|
||||
|
||||
$sql .= ' code = '.(isset($this->code) ? "'".$this->db->escape($this->code)."'" : "null").',';
|
||||
$sql .= ' label = '.(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").',';
|
||||
|
|
@ -376,7 +376,7 @@ class Ctyperesource
|
|||
// If you need to delete child tables to, you can insert them here
|
||||
|
||||
if (!$error) {
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element;
|
||||
$sql .= ' WHERE rowid='.((int) $this->id);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class CUnits // extends CommonObject
|
|||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_units(";
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."c_units(";
|
||||
$sql .= "rowid,";
|
||||
$sql .= "code,";
|
||||
$sql .= "label,";
|
||||
|
|
@ -138,7 +138,7 @@ class CUnits // extends CommonObject
|
|||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_units");
|
||||
$this->id = $this->db->last_insert_id($this->db->prefix()."c_units");
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
|
|
@ -178,7 +178,7 @@ class CUnits // extends CommonObject
|
|||
$sql .= " t.unit_type,";
|
||||
$sql .= " t.scale,";
|
||||
$sql .= " t.active";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_units as t";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_units as t";
|
||||
$sql_where = array();
|
||||
if ($id) {
|
||||
$sql_where[] = " t.rowid = ".((int) $id);
|
||||
|
|
@ -237,7 +237,7 @@ class CUnits // extends CommonObject
|
|||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql = "SELECT";
|
||||
$sql .= " t.rowid,";
|
||||
$sql .= " t.code,";
|
||||
$sql .= " t.sortorder,";
|
||||
|
|
@ -246,7 +246,7 @@ class CUnits // extends CommonObject
|
|||
$sql .= " t.unit_type,";
|
||||
$sql .= " t.scale,";
|
||||
$sql .= " t.active";
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'c_units as t';
|
||||
$sql .= " FROM ".$this->db->prefix()."c_units as t";
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
|
|
@ -343,7 +343,7 @@ class CUnits // extends CommonObject
|
|||
// Put here code to add control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."c_units SET";
|
||||
$sql = "UPDATE ".$this->db->prefix()."c_units SET";
|
||||
$sql .= " code=".(isset($this->code) ? "'".$this->db->escape($this->code)."'" : "null").",";
|
||||
$sql .= " sortorder=".(isset($this->sortorder) ? "'".$this->db->escape($this->sortorder)."'" : "null").",";
|
||||
$sql .= " label=".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").",";
|
||||
|
|
@ -389,7 +389,7 @@ class CUnits // extends CommonObject
|
|||
global $conf, $langs;
|
||||
$error = 0;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_units";
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."c_units";
|
||||
$sql .= " WHERE rowid=".((int) $this->id);
|
||||
|
||||
$this->db->begin();
|
||||
|
|
@ -471,7 +471,7 @@ class CUnits // extends CommonObject
|
|||
{
|
||||
$base = 10;
|
||||
// TODO : add base col into unit dictionary table
|
||||
$unit = $this->db->getRow('SELECT scale, unit_type from '.MAIN_DB_PREFIX.'c_units WHERE rowid = '.intval($id));
|
||||
$unit = $this->db->getRow("SELECT scale, unit_type from ".$this->db->prefix()."c_units WHERE rowid = ".intval($id));
|
||||
if ($unit) {
|
||||
// TODO : if base exist in unit dictionary table remove this convertion exception and update convertion infos in database exemple time hour currently scale 3600 will become scale 2 base 60
|
||||
if ($unit->unit_type == 'time') {
|
||||
|
|
|
|||
|
|
@ -259,10 +259,10 @@ class DefaultValues extends CommonObject
|
|||
|
||||
$records = array();
|
||||
|
||||
$sql = 'SELECT ';
|
||||
$sql = "SELECT ";
|
||||
$sql .= $this->getFieldList();
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
$sql .= ' WHERE 1 = 1';
|
||||
$sql .= " FROM ".$this->db->prefix().$this->table_element." as t";
|
||||
$sql .= " WHERE 1 = 1";
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
|
|
|
|||
|
|
@ -139,9 +139,9 @@ class DiscountAbsolute
|
|||
$sql .= " sr.datec,";
|
||||
$sql .= " f.ref as ref_facture_source, f.type as type_facture_source,";
|
||||
$sql .= " fsup.ref as ref_invoice_supplier_source, fsup.type as type_invoice_supplier_source";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except as sr";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON sr.fk_facture_source = f.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as fsup ON sr.fk_invoice_supplier_source = fsup.rowid";
|
||||
$sql .= " FROM ".$this->db->prefix()."societe_remise_except as sr";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."facture as f ON sr.fk_facture_source = f.rowid";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."facture_fourn as fsup ON sr.fk_invoice_supplier_source = fsup.rowid";
|
||||
$sql .= " WHERE sr.entity IN (".getEntity('invoice').")";
|
||||
if ($rowid) {
|
||||
$sql .= " AND sr.rowid = ".((int) $rowid);
|
||||
|
|
@ -251,7 +251,7 @@ class DiscountAbsolute
|
|||
}
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_except";
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."societe_remise_except";
|
||||
$sql .= " (entity, datec, fk_soc, discount_type, fk_user, description,";
|
||||
$sql .= " amount_ht, amount_tva, amount_ttc, tva_tx, vat_src_code,";
|
||||
$sql .= " multicurrency_amount_ht, multicurrency_amount_tva, multicurrency_amount_ttc,";
|
||||
|
|
@ -267,7 +267,7 @@ class DiscountAbsolute
|
|||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."societe_remise_except");
|
||||
$this->id = $this->db->last_insert_id($this->db->prefix()."societe_remise_except");
|
||||
return $this->id;
|
||||
} else {
|
||||
$this->error = $this->db->lasterror().' - sql='.$sql;
|
||||
|
|
@ -289,7 +289,7 @@ class DiscountAbsolute
|
|||
// Check if we can remove the discount
|
||||
if ($this->fk_facture_source) {
|
||||
$sql = "SELECT COUNT(rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except";
|
||||
$sql .= " FROM ".$this->db->prefix()."societe_remise_except";
|
||||
$sql .= " WHERE (fk_facture_line IS NOT NULL"; // Not used as absolute simple discount
|
||||
$sql .= " OR fk_facture IS NOT NULL)"; // Not used as credit note and not used as deposit
|
||||
$sql .= " AND fk_facture_source = ".((int) $this->fk_facture_source);
|
||||
|
|
@ -312,7 +312,7 @@ class DiscountAbsolute
|
|||
// Check if we can remove the discount
|
||||
if ($this->fk_invoice_supplier_source) {
|
||||
$sql = "SELECT COUNT(rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except";
|
||||
$sql .= " FROM ".$this->db->prefix()."societe_remise_except";
|
||||
$sql .= " WHERE (fk_invoice_supplier_line IS NOT NULL"; // Not used as absolute simple discount
|
||||
$sql .= " OR fk_invoice_supplier IS NOT NULL)"; // Not used as credit note and not used as deposit
|
||||
$sql .= " AND fk_invoice_supplier_source = ".((int) $this->fk_invoice_supplier_source);
|
||||
|
|
@ -335,7 +335,7 @@ class DiscountAbsolute
|
|||
$this->db->begin();
|
||||
|
||||
// Delete but only if not used
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except ";
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."societe_remise_except ";
|
||||
if ($this->fk_facture_source) {
|
||||
$sql .= " WHERE fk_facture_source = ".((int) $this->fk_facture_source); // Delete all lines of same serie
|
||||
} elseif ($this->fk_invoice_supplier_source) {
|
||||
|
|
@ -353,7 +353,7 @@ class DiscountAbsolute
|
|||
if ($result) {
|
||||
// If source of discount was a credit note or deposit, we change source statut.
|
||||
if ($this->fk_facture_source) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture";
|
||||
$sql = "UPDATE ".$this->db->prefix()."facture";
|
||||
$sql .= " set paye=0, fk_statut=1";
|
||||
$sql .= " WHERE (type = 2 or type = 3) AND rowid = ".((int) $this->fk_facture_source);
|
||||
|
||||
|
|
@ -368,7 +368,7 @@ class DiscountAbsolute
|
|||
return -1;
|
||||
}
|
||||
} elseif ($this->fk_invoice_supplier_source) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn";
|
||||
$sql = "UPDATE ".$this->db->prefix()."facture_fourn";
|
||||
$sql .= " set paye=0, fk_statut=1";
|
||||
$sql .= " WHERE (type = 2 or type = 3) AND rowid = ".((int) $this->fk_invoice_supplier_source);
|
||||
|
||||
|
|
@ -418,7 +418,7 @@ class DiscountAbsolute
|
|||
return -2;
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe_remise_except";
|
||||
$sql = "UPDATE ".$this->db->prefix()."societe_remise_except";
|
||||
if (!empty($this->discount_type)) {
|
||||
if ($rowidline) {
|
||||
$sql .= " SET fk_invoice_supplier_line = ".((int) $rowidline);
|
||||
|
|
@ -464,7 +464,7 @@ class DiscountAbsolute
|
|||
public function unlink_invoice()
|
||||
{
|
||||
// phpcs:enable
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe_remise_except";
|
||||
$sql = "UPDATE ".$this->db->prefix()."societe_remise_except";
|
||||
if (!empty($this->discount_type)) {
|
||||
$sql .= " SET fk_invoice_supplier_line = NULL, fk_invoice_supplier = NULL";
|
||||
} else {
|
||||
|
|
@ -501,7 +501,7 @@ class DiscountAbsolute
|
|||
dol_syslog(get_class($this)."::getAvailableDiscounts discount_type=".$discount_type, LOG_DEBUG);
|
||||
|
||||
$sql = "SELECT SUM(rc.amount_ttc) as amount, SUM(rc.multicurrency_amount_ttc) as multicurrency_amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc";
|
||||
$sql .= " FROM ".$this->db->prefix()."societe_remise_except as rc";
|
||||
$sql .= " WHERE rc.entity = ".$conf->entity;
|
||||
$sql .= " AND rc.discount_type=".((int) $discount_type);
|
||||
if (!empty($discount_type)) {
|
||||
|
|
@ -553,15 +553,15 @@ class DiscountAbsolute
|
|||
dol_syslog(get_class($this)."::getSumDepositsUsed", LOG_DEBUG);
|
||||
|
||||
if ($invoice->element == 'facture' || $invoice->element == 'invoice') {
|
||||
$sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture as f';
|
||||
$sql .= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.((int) $invoice->id);
|
||||
$sql .= ' AND f.type = 3';
|
||||
$sql = "SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount";
|
||||
$sql .= " FROM ".$this->db->prefix()."societe_remise_except as rc, ".$this->db->prefix()."facture as f";
|
||||
$sql .= " WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = ".((int) $invoice->id);
|
||||
$sql .= " AND f.type = 3";
|
||||
} elseif ($invoice->element == 'invoice_supplier') {
|
||||
$sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture_fourn as f';
|
||||
$sql .= ' WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = '.((int) $invoice->id);
|
||||
$sql .= ' AND f.type = 3';
|
||||
$sql = "SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount";
|
||||
$sql .= " FROM ".$this->db->prefix()."societe_remise_except as rc, ".$this->db->prefix()."facture_fourn as f";
|
||||
$sql .= " WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = ".((int) $invoice->id);
|
||||
$sql .= " AND f.type = 3";
|
||||
} else {
|
||||
$this->error = get_class($this)."::getSumDepositsUsed was called with a bad object as a first parameter";
|
||||
dol_print_error($this->error);
|
||||
|
|
@ -594,15 +594,15 @@ class DiscountAbsolute
|
|||
dol_syslog(get_class($this)."::getSumCreditNotesUsed", LOG_DEBUG);
|
||||
|
||||
if ($invoice->element == 'facture' || $invoice->element == 'invoice') {
|
||||
$sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture as f';
|
||||
$sql .= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.((int) $invoice->id);
|
||||
$sql .= " AND f.type IN (".$this->db->sanitize($invoice::TYPE_STANDARD.", ".$invoice::TYPE_CREDIT_NOTE.", ".$invoice::TYPE_SITUATION).')'; // Find discount coming from credit note or excess received
|
||||
$sql = "SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount";
|
||||
$sql .= " FROM ".$this->db->prefix()."societe_remise_except as rc, ".$this->db->prefix()."facture as f";
|
||||
$sql .= " WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = ".((int) $invoice->id);
|
||||
$sql .= " AND f.type IN (".$this->db->sanitize($invoice::TYPE_STANDARD.", ".$invoice::TYPE_CREDIT_NOTE.", ".$invoice::TYPE_SITUATION).")"; // Find discount coming from credit note or excess received
|
||||
} elseif ($invoice->element == 'invoice_supplier') {
|
||||
$sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture_fourn as f';
|
||||
$sql .= ' WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = '.((int) $invoice->id);
|
||||
$sql .= " AND f.type IN (".$this->db->sanitize($invoice::TYPE_STANDARD.", ".$invoice::TYPE_CREDIT_NOTE).')'; // Find discount coming from credit note or excess paid
|
||||
$sql = "SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount";
|
||||
$sql .= " FROM ".$this->db->prefix()."societe_remise_except as rc, ".$this->db->prefix()."facture_fourn as f";
|
||||
$sql .= " WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = ".((int) $invoice->id);
|
||||
$sql .= " AND f.type IN (".$this->db->sanitize($invoice::TYPE_STANDARD.", ".$invoice::TYPE_CREDIT_NOTE).")"; // Find discount coming from credit note or excess paid
|
||||
} else {
|
||||
$this->error = get_class($this)."::getSumCreditNotesUsed was called with a bad object as a first parameter";
|
||||
dol_print_error($this->error);
|
||||
|
|
@ -634,13 +634,13 @@ class DiscountAbsolute
|
|||
dol_syslog(get_class($this)."::getSumCreditNotesUsed", LOG_DEBUG);
|
||||
|
||||
if ($invoice->element == 'facture' || $invoice->element == 'invoice') {
|
||||
$sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc';
|
||||
$sql .= ' WHERE rc.fk_facture IS NULL AND rc.fk_facture_source = '.((int) $invoice->id);
|
||||
$sql = "SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount";
|
||||
$sql .= " FROM ".$this->db->prefix()."societe_remise_except as rc";
|
||||
$sql .= " WHERE rc.fk_facture IS NULL AND rc.fk_facture_source = ".((int) $invoice->id);
|
||||
} elseif ($invoice->element == 'invoice_supplier') {
|
||||
$sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc';
|
||||
$sql .= ' WHERE rc.fk_invoice_supplier IS NULL AND rc.fk_invoice_supplier_source = '.((int) $invoice->id);
|
||||
$sql = "SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount";
|
||||
$sql .= " FROM ".$this->db->prefix()."societe_remise_except as rc";
|
||||
$sql .= " WHERE rc.fk_invoice_supplier IS NULL AND rc.fk_invoice_supplier_source = ".((int) $invoice->id);
|
||||
} else {
|
||||
$this->error = get_class($this)."::getSumCreditNotesUsed was called with a bad object as a first parameter";
|
||||
dol_print_error($this->error);
|
||||
|
|
|
|||
|
|
@ -242,9 +242,9 @@ class dolReceiptPrinter extends Printer
|
|||
$error = 0;
|
||||
$line = 0;
|
||||
$obj = array();
|
||||
$sql = 'SELECT rowid, name, fk_type, fk_profile, parameter';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'printer_receipt';
|
||||
$sql .= ' WHERE entity = '.$conf->entity;
|
||||
$sql = "SELECT rowid, name, fk_type, fk_profile, parameter";
|
||||
$sql .= " FROM ".$this->db->prefix()."printer_receipt";
|
||||
$sql .= " WHERE entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
|
@ -310,9 +310,9 @@ class dolReceiptPrinter extends Printer
|
|||
$error = 0;
|
||||
$line = 0;
|
||||
$obj = array();
|
||||
$sql = 'SELECT rowid, name, template';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'printer_receipt_template';
|
||||
$sql .= ' WHERE entity = '.$conf->entity;
|
||||
$sql = "SELECT rowid, name, template";
|
||||
$sql .= " FROM ".$this->db->prefix()."printer_receipt_template";
|
||||
$sql .= " WHERE entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
|
@ -391,7 +391,7 @@ class dolReceiptPrinter extends Printer
|
|||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."printer_receipt";
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."printer_receipt";
|
||||
$sql .= " (name, fk_type, fk_profile, parameter, entity)";
|
||||
$sql .= " VALUES ('".$this->db->escape($name)."', ".((int) $type).", ".((int) $profile).", '".$this->db->escape($parameter)."', ".((int) $conf->entity).")";
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -417,7 +417,7 @@ class dolReceiptPrinter extends Printer
|
|||
global $conf;
|
||||
$error = 0;
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."printer_receipt";
|
||||
$sql = "UPDATE ".$this->db->prefix()."printer_receipt";
|
||||
$sql .= " SET name='".$this->db->escape($name)."'";
|
||||
$sql .= ", fk_type=".((int) $type);
|
||||
$sql .= ", fk_profile=".((int) $profile);
|
||||
|
|
@ -442,7 +442,7 @@ class dolReceiptPrinter extends Printer
|
|||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'printer_receipt';
|
||||
$sql = 'DELETE FROM '.$this->db->prefix().'printer_receipt';
|
||||
$sql .= ' WHERE rowid='.((int) $printerid);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
|
|
@ -463,7 +463,7 @@ class dolReceiptPrinter extends Printer
|
|||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."printer_receipt_template";
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."printer_receipt_template";
|
||||
$sql .= " (name, template, entity) VALUES ('".$this->db->escape($name)."'";
|
||||
$sql .= ", '".$this->db->escape($template)."', ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -484,7 +484,7 @@ class dolReceiptPrinter extends Printer
|
|||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'printer_receipt_template';
|
||||
$sql = 'DELETE FROM '.$this->db->prefix().'printer_receipt_template';
|
||||
$sql .= " WHERE rowid = ".((int) $templateid);
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -508,7 +508,7 @@ class dolReceiptPrinter extends Printer
|
|||
global $conf;
|
||||
$error = 0;
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."printer_receipt_template";
|
||||
$sql = "UPDATE ".$this->db->prefix()."printer_receipt_template";
|
||||
$sql .= " SET name='".$this->db->escape($name)."'";
|
||||
$sql .= ", template='".$this->db->escape($template)."'";
|
||||
$sql .= " WHERE rowid=".((int) $templateid);
|
||||
|
|
@ -807,8 +807,8 @@ class dolReceiptPrinter extends Printer
|
|||
case 'DOL_PRINT_PAYMENT':
|
||||
$sql = "SELECT p.pos_change as pos_change, p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,";
|
||||
$sql .= " cp.code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id";
|
||||
$sql .= " FROM ".$this->db->prefix()."paiement_facture as pf, ".$this->db->prefix()."paiement as p";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."c_paiement as cp ON p.fk_paiement = cp.id";
|
||||
$sql .= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".((int) $object->id);
|
||||
$sql .= " ORDER BY p.datep";
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -834,7 +834,7 @@ class dolReceiptPrinter extends Printer
|
|||
}
|
||||
break;
|
||||
case 'DOL_VALUE_PLACE':
|
||||
$sql = "SELECT floor, label FROM ".MAIN_DB_PREFIX."takepos_floor_tables where rowid=".((int) str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $object->ref)));
|
||||
$sql = "SELECT floor, label FROM ".$this->db->prefix()."takepos_floor_tables where rowid=".((int) str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $object->ref)));
|
||||
$resql = $this->db->query($sql);
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
|
|
@ -873,10 +873,10 @@ class dolReceiptPrinter extends Printer
|
|||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$sql = 'SELECT template';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'printer_receipt_template';
|
||||
$sql .= ' WHERE rowid = '.((int) $templateid);
|
||||
$sql .= ' AND entity = '.$conf->entity;
|
||||
$sql = "SELECT template";
|
||||
$sql .= " FROM ".$this->db->prefix()."printer_receipt_template";
|
||||
$sql .= " WHERE rowid = ".((int) $templateid);
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $this->db->fetch_array($resql);
|
||||
|
|
@ -910,10 +910,10 @@ class dolReceiptPrinter extends Printer
|
|||
return;
|
||||
}
|
||||
$error = 0;
|
||||
$sql = 'SELECT rowid, name, fk_type, fk_profile, parameter';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'printer_receipt';
|
||||
$sql .= ' WHERE rowid = '.((int) $printerid);
|
||||
$sql .= ' AND entity = '.((int) $conf->entity);
|
||||
$sql = "SELECT rowid, name, fk_type, fk_profile, parameter";
|
||||
$sql .= " FROM ".$this->db->prefix()."printer_receipt";
|
||||
$sql .= " WHERE rowid = ".((int) $printerid);
|
||||
$sql .= " AND entity = ".((int) $conf->entity);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $this->db->fetch_array($resql);
|
||||
|
|
|
|||
|
|
@ -347,9 +347,9 @@ class EmailSenderProfile extends CommonObject
|
|||
*/
|
||||
public function info($id)
|
||||
{
|
||||
$sql = 'SELECT rowid, date_creation as datec, tms as datem';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
$sql .= ' WHERE t.rowid = '.((int) $id);
|
||||
$sql = "SELECT rowid, date_creation as datec, tms as datem";
|
||||
$sql .= " FROM ".$this->db->prefix().$this->table_element." as t";
|
||||
$sql .= " WHERE t.rowid = ".((int) $id);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
if ($this->db->num_rows($result)) {
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ class Events // extends CommonObject
|
|||
}
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."events(";
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."events(";
|
||||
$sql .= "type,";
|
||||
$sql .= "entity,";
|
||||
$sql .= "ip,";
|
||||
|
|
@ -175,7 +175,7 @@ class Events // extends CommonObject
|
|||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."events");
|
||||
$this->id = $this->db->last_insert_id($this->db->prefix()."events");
|
||||
return $this->id;
|
||||
} else {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
|
|
@ -202,7 +202,7 @@ class Events // extends CommonObject
|
|||
// Put here code to add control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."events SET";
|
||||
$sql = "UPDATE ".$this->db->prefix()."events SET";
|
||||
$sql .= " type='".$this->db->escape($this->type)."',";
|
||||
$sql .= " dateevent='".$this->db->idate($this->dateevent)."',";
|
||||
$sql .= " description='".$this->db->escape($this->description)."'";
|
||||
|
|
@ -237,7 +237,7 @@ class Events // extends CommonObject
|
|||
$sql .= " t.ip,";
|
||||
$sql .= " t.user_agent,";
|
||||
$sql .= " t.prefix_session";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."events as t";
|
||||
$sql .= " FROM ".$this->db->prefix()."events as t";
|
||||
$sql .= " WHERE t.rowid = ".((int) $id);
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
|
|
@ -274,7 +274,7 @@ class Events // extends CommonObject
|
|||
*/
|
||||
public function delete($user)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."events";
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."events";
|
||||
$sql .= " WHERE rowid=".((int) $this->id);
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
|
|
|
|||
|
|
@ -265,10 +265,10 @@ class ExtraFields
|
|||
'default' => $default_value
|
||||
);
|
||||
|
||||
$result = $this->db->DDLAddField(MAIN_DB_PREFIX.$table, $attrname, $field_desc);
|
||||
$result = $this->db->DDLAddField($this->db->prefix().$table, $attrname, $field_desc);
|
||||
if ($result > 0) {
|
||||
if ($unique) {
|
||||
$sql = "ALTER TABLE ".MAIN_DB_PREFIX.$table." ADD UNIQUE INDEX uk_".$table."_".$attrname." (".$attrname.")";
|
||||
$sql = "ALTER TABLE ".$this->db->prefix().$table." ADD UNIQUE INDEX uk_".$table."_".$attrname." (".$attrname.")";
|
||||
$resql = $this->db->query($sql, 1, 'dml');
|
||||
}
|
||||
return 1;
|
||||
|
|
@ -353,7 +353,7 @@ class ExtraFields
|
|||
$params = '';
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(";
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."extrafields(";
|
||||
$sql .= " name,";
|
||||
$sql .= " label,";
|
||||
$sql .= " type,";
|
||||
|
|
@ -447,7 +447,7 @@ class ExtraFields
|
|||
|
||||
if (!$error) {
|
||||
$sql = "SELECT COUNT(rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."extrafields";
|
||||
$sql .= " FROM ".$this->db->prefix()."extrafields";
|
||||
$sql .= " WHERE elementtype = '".$this->db->escape($elementtype)."'";
|
||||
$sql .= " AND name = '".$this->db->escape($attrname)."'";
|
||||
//$sql.= " AND entity IN (0,".$conf->entity.")"; Do not test on entity here. We want to see if there is still on field remaning in other entities before deleting field in table
|
||||
|
|
@ -455,7 +455,7 @@ class ExtraFields
|
|||
if ($resql) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj->nb <= 0) {
|
||||
$result = $this->db->DDLDropField(MAIN_DB_PREFIX.$table, $attrname); // This also drop the unique key
|
||||
$result = $this->db->DDLDropField($this->db->prefix().$table, $attrname); // This also drop the unique key
|
||||
if ($result < 0) {
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
|
|
@ -492,7 +492,7 @@ class ExtraFields
|
|||
}
|
||||
|
||||
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/", $attrname)) {
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."extrafields";
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."extrafields";
|
||||
$sql .= " WHERE name = '".$this->db->escape($attrname)."'";
|
||||
$sql .= " AND entity IN (0,".$conf->entity.')';
|
||||
$sql .= " AND elementtype = '".$this->db->escape($elementtype)."'";
|
||||
|
|
@ -597,7 +597,7 @@ class ExtraFields
|
|||
}
|
||||
|
||||
if ($type != 'separate') { // No table update when separate type
|
||||
$result = $this->db->DDLUpdateField(MAIN_DB_PREFIX.$table, $attrname, $field_desc);
|
||||
$result = $this->db->DDLUpdateField($this->db->prefix().$table, $attrname, $field_desc);
|
||||
}
|
||||
if ($result > 0 || $type == 'separate') {
|
||||
if ($label) {
|
||||
|
|
@ -606,9 +606,9 @@ class ExtraFields
|
|||
if ($result > 0) {
|
||||
$sql = '';
|
||||
if ($unique) {
|
||||
$sql = "ALTER TABLE ".MAIN_DB_PREFIX.$table." ADD UNIQUE INDEX uk_".$table."_".$attrname." (".$attrname.")";
|
||||
$sql = "ALTER TABLE ".$this->db->prefix().$table." ADD UNIQUE INDEX uk_".$table."_".$attrname." (".$attrname.")";
|
||||
} else {
|
||||
$sql = "ALTER TABLE ".MAIN_DB_PREFIX.$table." DROP INDEX uk_".$table."_".$attrname;
|
||||
$sql = "ALTER TABLE ".$this->db->prefix().$table." DROP INDEX uk_".$table."_".$attrname;
|
||||
}
|
||||
dol_syslog(get_class($this).'::update', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql, 1, 'dml');
|
||||
|
|
@ -699,20 +699,20 @@ class ExtraFields
|
|||
|
||||
if ($entity === '' || $entity != '0') {
|
||||
// We dont want on all entities, we delete all and current
|
||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields";
|
||||
$sql_del = "DELETE FROM ".$this->db->prefix()."extrafields";
|
||||
$sql_del .= " WHERE name = '".$this->db->escape($attrname)."'";
|
||||
$sql_del .= " AND entity IN (0, ".($entity === '' ? $conf->entity : $entity).")";
|
||||
$sql_del .= " AND elementtype = '".$this->db->escape($elementtype)."'";
|
||||
} else {
|
||||
// We want on all entities ($entities = '0'), we delete on all only (we keep setup specific to each entity)
|
||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields";
|
||||
$sql_del = "DELETE FROM ".$this->db->prefix()."extrafields";
|
||||
$sql_del .= " WHERE name = '".$this->db->escape($attrname)."'";
|
||||
$sql_del .= " AND entity = 0";
|
||||
$sql_del .= " AND elementtype = '".$this->db->escape($elementtype)."'";
|
||||
}
|
||||
$resql1 = $this->db->query($sql_del);
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(";
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."extrafields(";
|
||||
$sql .= " name,"; // This is code
|
||||
$sql .= " entity,";
|
||||
$sql .= " label,";
|
||||
|
|
@ -804,15 +804,12 @@ class ExtraFields
|
|||
if ($elementtype == 'order_supplier') {
|
||||
$elementtype = 'commande_fournisseur';
|
||||
}
|
||||
if ($elementtype == 'stock_mouvement') {
|
||||
$elementtype = 'movement';
|
||||
}
|
||||
|
||||
$array_name_label = array();
|
||||
|
||||
// We should not have several time this request. If we have, there is some optimization to do by calling a simple $extrafields->fetch_optionals() in top of code and not into subcode
|
||||
$sql = "SELECT rowid, name, label, type, size, elementtype, fieldunique, fieldrequired, param, pos, alwayseditable, perms, langs, list, printable, totalizable, fielddefault, fieldcomputed, entity, enabled, help";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."extrafields";
|
||||
$sql .= " FROM ".$this->db->prefix()."extrafields";
|
||||
//$sql.= " WHERE entity IN (0,".$conf->entity.")"; // Filter is done later
|
||||
if ($elementtype) {
|
||||
$sql .= " WHERE elementtype = '".$this->db->escape($elementtype)."'"; // Filed with object->table_element
|
||||
|
|
@ -1139,7 +1136,7 @@ class ExtraFields
|
|||
|
||||
$sqlwhere = '';
|
||||
$sql = "SELECT ".$keyList;
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0];
|
||||
$sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0];
|
||||
if (!empty($InfoFieldList[4])) {
|
||||
// can use curent entity filter
|
||||
if (strpos($InfoFieldList[4], '$ENTITY$') !== false) {
|
||||
|
|
@ -1158,7 +1155,7 @@ class ExtraFields
|
|||
}
|
||||
//We have to join on extrafield table
|
||||
if (strpos($InfoFieldList[4], 'extra') !== false) {
|
||||
$sql .= ' as main, '.MAIN_DB_PREFIX.$InfoFieldList[0].'_extrafields as extra';
|
||||
$sql .= ' as main, '.$this->db->prefix().$InfoFieldList[0].'_extrafields as extra';
|
||||
$sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4];
|
||||
} else {
|
||||
$sqlwhere .= " WHERE ".$InfoFieldList[4];
|
||||
|
|
@ -1307,7 +1304,7 @@ class ExtraFields
|
|||
|
||||
$sqlwhere = '';
|
||||
$sql = "SELECT ".$keyList;
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0];
|
||||
$sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0];
|
||||
if (!empty($InfoFieldList[4])) {
|
||||
// can use SELECT request
|
||||
if (strpos($InfoFieldList[4], '$SEL$') !== false) {
|
||||
|
|
@ -1370,7 +1367,7 @@ class ExtraFields
|
|||
|
||||
// We have to join on extrafield table
|
||||
if (strpos($InfoFieldList[4], 'extra.') !== false) {
|
||||
$sql .= ' as main, '.MAIN_DB_PREFIX.$InfoFieldList[0].'_extrafields as extra';
|
||||
$sql .= ' as main, '.$this->db->prefix().$InfoFieldList[0].'_extrafields as extra';
|
||||
$sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4];
|
||||
} else {
|
||||
$sqlwhere .= " WHERE ".$InfoFieldList[4];
|
||||
|
|
@ -1595,7 +1592,7 @@ class ExtraFields
|
|||
}
|
||||
|
||||
$sql = "SELECT ".$keyList;
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0];
|
||||
$sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0];
|
||||
if (!empty($InfoFieldList[4]) && strpos($InfoFieldList[4], 'extra') !== false) {
|
||||
$sql .= ' as main';
|
||||
}
|
||||
|
|
@ -1699,7 +1696,7 @@ class ExtraFields
|
|||
}
|
||||
|
||||
$sql = "SELECT ".$keyList;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$InfoFieldList[0];
|
||||
$sql .= " FROM ".$this->db->prefix().$InfoFieldList[0];
|
||||
if (strpos($InfoFieldList[4], 'extra') !== false) {
|
||||
$sql .= ' as main';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ class Fiscalyear extends CommonObject
|
|||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."accounting_fiscalyear (";
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."accounting_fiscalyear (";
|
||||
$sql .= "label";
|
||||
$sql .= ", date_start";
|
||||
$sql .= ", date_end";
|
||||
|
|
@ -155,7 +155,7 @@ class Fiscalyear extends CommonObject
|
|||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."accounting_fiscalyear");
|
||||
$this->id = $this->db->last_insert_id($this->db->prefix()."accounting_fiscalyear");
|
||||
|
||||
$result = $this->update($user);
|
||||
if ($result > 0) {
|
||||
|
|
@ -191,7 +191,7 @@ class Fiscalyear extends CommonObject
|
|||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_fiscalyear";
|
||||
$sql = "UPDATE ".$this->db->prefix()."accounting_fiscalyear";
|
||||
$sql .= " SET label = '".$this->db->escape($this->label)."'";
|
||||
$sql .= ", date_start = '".$this->db->idate($this->date_start)."'";
|
||||
$sql .= ", date_end = ".($this->date_end ? "'".$this->db->idate($this->date_end)."'" : "null");
|
||||
|
|
@ -221,7 +221,7 @@ class Fiscalyear extends CommonObject
|
|||
public function fetch($id)
|
||||
{
|
||||
$sql = "SELECT rowid, label, date_start, date_end, statut";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_fiscalyear";
|
||||
$sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear";
|
||||
$sql .= " WHERE rowid = ".((int) $id);
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
|
|
@ -253,7 +253,7 @@ class Fiscalyear extends CommonObject
|
|||
{
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE rowid = ".((int) $id);
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."accounting_fiscalyear WHERE rowid = ".((int) $id);
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
|
@ -414,10 +414,10 @@ class Fiscalyear extends CommonObject
|
|||
*/
|
||||
public function info($id)
|
||||
{
|
||||
$sql = 'SELECT fy.rowid, fy.datec, fy.fk_user_author, fy.fk_user_modif,';
|
||||
$sql .= ' fy.tms';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'accounting_fiscalyear as fy';
|
||||
$sql .= ' WHERE fy.rowid = '.((int) $id);
|
||||
$sql = "SELECT fy.rowid, fy.datec, fy.fk_user_author, fy.fk_user_modif,";
|
||||
$sql .= " fy.tms";
|
||||
$sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear as fy";
|
||||
$sql .= " WHERE fy.rowid = ".((int) $id);
|
||||
|
||||
dol_syslog(get_class($this)."::fetch info", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
|
@ -464,7 +464,7 @@ class Fiscalyear extends CommonObject
|
|||
}
|
||||
|
||||
$sql = "SELECT count(DISTINCT piece_num) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||
$sql .= " FROM ".$this->db->prefix()."accounting_bookkeeping";
|
||||
$sql .= " WHERE entity IN (".getEntity('bookkeeping', 0).")";
|
||||
$sql .= " AND doc_date >= '".$this->db->idate($datestart)."' and doc_date <= '".$this->db->idate($dateend)."'";
|
||||
|
||||
|
|
@ -498,7 +498,7 @@ class Fiscalyear extends CommonObject
|
|||
}
|
||||
|
||||
$sql = "SELECT count(rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping ";
|
||||
$sql .= " FROM ".$this->db->prefix()."accounting_bookkeeping ";
|
||||
$sql .= " WHERE entity IN (".getEntity('bookkeeping', 0).")";
|
||||
$sql .= " AND doc_date >= '".$this->db->idate($datestart)."' and doc_date <= '".$this->db->idate($dateend)."'";
|
||||
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ class Form
|
|||
*/
|
||||
public function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata = 'string', $editvalue = '', $extObject = null, $custommsg = null, $moreparam = '', $notabletag = 0, $formatfunc = '', $paramid = 'id')
|
||||
{
|
||||
global $conf, $langs, $db;
|
||||
global $conf, $langs;
|
||||
|
||||
$ret = '';
|
||||
|
||||
|
|
@ -886,7 +886,7 @@ class Form
|
|||
$atleastonefavorite = 0;
|
||||
|
||||
$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite, eec";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_country";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_country";
|
||||
$sql .= " WHERE active > 0";
|
||||
//$sql.= " ORDER BY code ASC";
|
||||
|
||||
|
|
@ -1009,7 +1009,7 @@ class Form
|
|||
$incotermArray = array();
|
||||
|
||||
$sql = "SELECT rowid, code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_incoterms";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_incoterms";
|
||||
$sql .= " WHERE active > 0";
|
||||
$sql .= " ORDER BY code ASC";
|
||||
|
||||
|
|
@ -1088,7 +1088,7 @@ class Form
|
|||
public function select_type_of_lines($selected = '', $htmlname = 'type', $showempty = 0, $hidetext = 0, $forceall = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $db, $langs, $user, $conf;
|
||||
global $langs, $conf;
|
||||
|
||||
// If product & services are enabled or both disabled.
|
||||
if ($forceall == 1 || (empty($forceall) && !empty($conf->product->enabled) && !empty($conf->service->enabled))
|
||||
|
|
@ -1155,7 +1155,7 @@ class Form
|
|||
$langs->load("trips");
|
||||
|
||||
$sql = "SELECT c.code, c.label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_type_fees as c";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_type_fees as c";
|
||||
$sql .= " WHERE active > 0";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -1344,12 +1344,12 @@ class Form
|
|||
$sql .= ", s.address, s.zip, s.town";
|
||||
$sql .= ", dictp.code as country_code";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " FROM ".$this->db->prefix()."societe as s";
|
||||
if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as dictp ON dictp.rowid = s.fk_pays";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays";
|
||||
}
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE s.entity IN (".getEntity('societe').")";
|
||||
if (!empty($user->socid)) {
|
||||
|
|
@ -1523,7 +1523,7 @@ class Form
|
|||
// On recherche les remises
|
||||
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
|
||||
$sql .= " re.description, re.fk_facture_source";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except as re";
|
||||
$sql .= " FROM ".$this->db->prefix()."societe_remise_except as re";
|
||||
$sql .= " WHERE re.fk_soc = ".(int) $socid;
|
||||
$sql .= " AND re.entity = ".$conf->entity;
|
||||
if ($filter) {
|
||||
|
|
@ -1668,9 +1668,9 @@ class Form
|
|||
if ($showsoc > 0 || !empty($conf->global->CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST)) {
|
||||
$sql .= ", s.nom as company, s.town AS company_town";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
$sql .= " FROM ".$this->db->prefix()."socpeople as sp";
|
||||
if ($showsoc > 0 || !empty($conf->global->CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST)) {
|
||||
$sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=sp.fk_soc";
|
||||
$sql .= " LEFT OUTER JOIN ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc";
|
||||
}
|
||||
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
|
||||
if ($socid > 0 || $socid == -1) {
|
||||
|
|
@ -1922,9 +1922,9 @@ class Form
|
|||
if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
$sql .= ", e.label";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " FROM ".$this->db->prefix()."user as u";
|
||||
if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entity as e ON e.rowid = u.entity";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity";
|
||||
if ($force_entity) {
|
||||
$sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")";
|
||||
} else {
|
||||
|
|
@ -1932,7 +1932,7 @@ class Form
|
|||
}
|
||||
} else {
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."usergroup_user as ug";
|
||||
$sql .= " ON ug.fk_user = u.rowid";
|
||||
$sql .= " WHERE ug.entity = ".$conf->entity;
|
||||
} else {
|
||||
|
|
@ -2367,6 +2367,69 @@ class Form
|
|||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
|
||||
/**
|
||||
* Return list of BOM for customer in Ajax if Ajax activated or go to select_produits_list
|
||||
*
|
||||
* @param int $selected Preselected BOM id
|
||||
* @param string $htmlname Name of HTML select field (must be unique in page).
|
||||
* @param int $limit Limit on number of returned lines
|
||||
* @param int $status Sell status -1=Return all bom, 0=Draft BOM, 1=Validated BOM
|
||||
* @param int $type type of the BOM (-1=Return all BOM, 0=Return disassemble BOM, 1=Return manufacturing BOM)
|
||||
* @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
|
||||
* @param string $morecss Add more css on select
|
||||
* @param string $nooutput No print, return the output into a string
|
||||
* @param int $forcecombo Force to use combo box
|
||||
* @return void|string
|
||||
*/
|
||||
public function select_bom($selected = '', $htmlname = 'bom_id', $limit = 0, $status = 1, $type = 1, $showempty = '1', $morecss = '', $nooutput = '', $forcecombo = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $user, $langs, $db;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
|
||||
$error = 0;
|
||||
$out = '';
|
||||
|
||||
if (!$forcecombo) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
|
||||
}
|
||||
|
||||
$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
|
||||
$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';
|
||||
$sql.= ' WHERE b.entity IN ('.getEntity('bom').')';
|
||||
if (!empty($status)) $sql.= ' AND status = '. (int) $status;
|
||||
if (!empty($type)) $sql.= ' AND status = '. (int) $type;
|
||||
if (!empty($limit)) $sql.= 'LIMIT '. (int) $limit;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
if ($showempty) {
|
||||
$out .= '<option value="-1"';
|
||||
if (empty($selected)) $out .= ' selected';
|
||||
$out .= '> </option>';
|
||||
}
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
$product = new Product($db);
|
||||
$res = $product->fetch($obj->fk_product);
|
||||
if ($obj->rowid == $selected) $out .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.' - '. $product->label .' - '.$obj->label.'</option>';
|
||||
$out .= '<option value="'.$obj->rowid.'">'.$obj->ref.' - '.$product->label .' - '. $obj->label.'</option>';
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
dol_print_error($db);
|
||||
}
|
||||
if (empty($nooutput)) {
|
||||
print $out;
|
||||
} else {
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return list of products for a customer.
|
||||
|
|
@ -2395,7 +2458,7 @@ class Form
|
|||
public function select_produits_list($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 20, $price_level = 0, $filterkey = '', $status = 1, $finished = 2, $outputmode = 0, $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs, $conf, $user, $db;
|
||||
global $langs, $conf;
|
||||
|
||||
$out = '';
|
||||
$outarray = array();
|
||||
|
|
@ -2431,9 +2494,9 @@ class Form
|
|||
|
||||
if (!empty($conf->global->PRODUCT_SORT_BY_CATEGORY)) {
|
||||
//Product category
|
||||
$sql .= ", (SELECT ".MAIN_DB_PREFIX."categorie_product.fk_categorie
|
||||
FROM ".MAIN_DB_PREFIX."categorie_product
|
||||
WHERE ".MAIN_DB_PREFIX."categorie_product.fk_product=p.rowid
|
||||
$sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie
|
||||
FROM ".$this->db->prefix()."categorie_product
|
||||
WHERE ".$this->db->prefix()."categorie_product.fk_product=p.rowid
|
||||
LIMIT 1
|
||||
) AS categorie_product_id ";
|
||||
}
|
||||
|
|
@ -2459,13 +2522,13 @@ class Form
|
|||
}
|
||||
// Price by quantity
|
||||
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
|
||||
$sql .= ", (SELECT pp.rowid FROM ".MAIN_DB_PREFIX."product_price as pp WHERE pp.fk_product = p.rowid";
|
||||
$sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid";
|
||||
if ($price_level >= 1 && !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
|
||||
$sql .= " AND price_level = ".((int) $price_level);
|
||||
}
|
||||
$sql .= " ORDER BY date_price";
|
||||
$sql .= " DESC LIMIT 1) as price_rowid";
|
||||
$sql .= ", (SELECT pp.price_by_qty FROM ".MAIN_DB_PREFIX."product_price as pp WHERE pp.fk_product = p.rowid"; // price_by_qty is 1 if some prices by qty exists in subtable
|
||||
$sql .= ", (SELECT pp.price_by_qty FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid"; // price_by_qty is 1 if some prices by qty exists in subtable
|
||||
if ($price_level >= 1 && !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
|
||||
$sql .= " AND price_level = ".((int) $price_level);
|
||||
}
|
||||
|
|
@ -2473,32 +2536,32 @@ class Form
|
|||
$sql .= " DESC LIMIT 1) as price_by_qty";
|
||||
$selectFields .= ", price_rowid, price_by_qty";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql .= " FROM ".$this->db->prefix()."product as p";
|
||||
if (count($warehouseStatusArray)) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.fk_product = p.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")";
|
||||
$sql .= ' AND e.statut IN ('.$this->db->sanitize($this->db->escape(implode(',', $warehouseStatusArray))).')'; // Return line if product is inside the selected stock. If not, an empty line will be returned so we will count 0.
|
||||
}
|
||||
|
||||
// include search in supplier ref
|
||||
if (!empty($conf->global->MAIN_SEARCH_PRODUCT_BY_FOURN_REF)) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
|
||||
}
|
||||
|
||||
//Price by customer
|
||||
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid";
|
||||
}
|
||||
// Units
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_units u ON u.rowid = p.fk_unit";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";
|
||||
}
|
||||
// Multilang : we add translation
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid ";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid ";
|
||||
if (!empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE) && !empty($socid)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
$soc = new Societe($db);
|
||||
$soc = new Societe($this->db);
|
||||
$result = $soc->fetch($socid);
|
||||
if ($result > 0 && !empty($soc->default_lang)) {
|
||||
$sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'";
|
||||
|
|
@ -2511,7 +2574,7 @@ class Form
|
|||
}
|
||||
|
||||
if (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination pac ON pac.fk_product_child = p.rowid";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid";
|
||||
}
|
||||
|
||||
$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
|
||||
|
|
@ -2639,7 +2702,7 @@ class Form
|
|||
|
||||
if ((!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) && !empty($objp->price_by_qty) && $objp->price_by_qty == 1) { // Price by quantity will return many prices for the same product
|
||||
$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_price_by_qty";
|
||||
$sql .= " FROM ".$this->db->prefix()."product_price_by_qty";
|
||||
$sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid);
|
||||
$sql .= " ORDER BY quantity ASC";
|
||||
|
||||
|
|
@ -2712,7 +2775,7 @@ class Form
|
|||
}
|
||||
return $outarray;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2733,7 +2796,7 @@ class Form
|
|||
*/
|
||||
protected function constructProductListOption(&$objp, &$opt, &$optJson, $price_level, $selected, $hidepriceinlabel = 0, $filterkey = '', $novirtualstock = 0)
|
||||
{
|
||||
global $langs, $conf, $user, $db;
|
||||
global $langs, $conf, $user;
|
||||
|
||||
$outkey = '';
|
||||
$outval = '';
|
||||
|
|
@ -2879,7 +2942,7 @@ class Form
|
|||
// If we need a particular price level (from 1 to n)
|
||||
if (empty($hidepriceinlabel) && $price_level >= 1 && (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) {
|
||||
$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_price";
|
||||
$sql .= " FROM ".$this->db->prefix()."product_price";
|
||||
$sql .= " WHERE fk_product = ".((int) $objp->rowid);
|
||||
$sql .= " AND entity IN (".getEntity('productprice').")";
|
||||
$sql .= " AND price_level = ".((int) $price_level);
|
||||
|
|
@ -3110,7 +3173,7 @@ class Form
|
|||
public function select_produits_fournisseurs_list($socid, $selected = '', $htmlname = 'productid', $filtertype = '', $filtre = '', $filterkey = '', $statut = -1, $outputmode = 0, $limit = 100, $alsoproductwithnosupplierprice = 0, $morecss = '', $showstockinlist = 0, $placeholder = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs, $conf, $db, $user;
|
||||
global $langs, $conf, $user;
|
||||
|
||||
$out = '';
|
||||
$outarray = array();
|
||||
|
|
@ -3140,15 +3203,15 @@ class Form
|
|||
if (!empty($conf->barcode->enabled)) {
|
||||
$sql .= ", pfp.barcode";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )";
|
||||
$sql .= " FROM ".$this->db->prefix()."product as p";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )";
|
||||
if ($socid > 0) {
|
||||
$sql .= " AND pfp.fk_soc = ".((int) $socid);
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";
|
||||
// Units
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_units u ON u.rowid = p.fk_unit";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";
|
||||
}
|
||||
$sql .= " WHERE p.entity IN (".getEntity('product').")";
|
||||
if ($statut != -1) {
|
||||
|
|
@ -3490,9 +3553,9 @@ class Form
|
|||
$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,";
|
||||
$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,";
|
||||
$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid";
|
||||
$sql .= " FROM ".$this->db->prefix()."product as p";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";
|
||||
$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")";
|
||||
$sql .= " AND p.tobuy = 1";
|
||||
$sql .= " AND s.fournisseur = 1";
|
||||
|
|
@ -3588,7 +3651,7 @@ class Form
|
|||
// phpcs:enable
|
||||
// looking for users
|
||||
$sql = "SELECT a.rowid, a.label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe_address as a";
|
||||
$sql .= " FROM ".$this->db->prefix()."societe_address as a";
|
||||
$sql .= " WHERE a.fk_soc = ".((int) $socid);
|
||||
$sql .= " ORDER BY a.label ASC";
|
||||
|
||||
|
|
@ -3640,7 +3703,7 @@ class Form
|
|||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = "SELECT rowid, code, libelle as label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.'c_payment_term';
|
||||
$sql .= " FROM ".$this->db->prefix().'c_payment_term';
|
||||
$sql .= " WHERE entity IN (".getEntity('c_payment_term').")";
|
||||
$sql .= " AND active > 0";
|
||||
$sql .= " ORDER BY sortorder";
|
||||
|
|
@ -3689,7 +3752,7 @@ class Form
|
|||
$langs->load('propal');
|
||||
|
||||
$sql = "SELECT rowid, code, label, position";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.'c_availability';
|
||||
$sql .= " FROM ".$this->db->prefix().'c_availability';
|
||||
$sql .= " WHERE active > 0";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -3769,7 +3832,7 @@ class Form
|
|||
}
|
||||
|
||||
$sql = "SELECT rowid, code, label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.'c_input_reason';
|
||||
$sql .= " FROM ".$this->db->prefix().'c_input_reason';
|
||||
$sql .= " WHERE active > 0";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -3869,7 +3932,7 @@ class Form
|
|||
$this->cache_types_paiements = array();
|
||||
|
||||
$sql = "SELECT id, code, libelle as label, type, active";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_paiement";
|
||||
$sql .= " WHERE entity IN (".getEntity('c_paiement').")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -4131,7 +4194,7 @@ class Form
|
|||
$this->cache_transport_mode = array();
|
||||
|
||||
$sql = "SELECT rowid, code, label, active";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_transport_mode";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_transport_mode";
|
||||
$sql .= " WHERE entity IN (".getEntity('c_transport_mode').")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -4249,7 +4312,7 @@ class Form
|
|||
$langs->load("deliveries");
|
||||
|
||||
$sql = "SELECT rowid, code, libelle as label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_shipment_mode";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_shipment_mode";
|
||||
$sql .= " WHERE active > 0";
|
||||
if ($filtre) {
|
||||
$sql .= " AND ".$filtre;
|
||||
|
|
@ -4302,7 +4365,7 @@ class Form
|
|||
*/
|
||||
public function formSelectShippingMethod($page, $selected = '', $htmlname = 'shipping_method_id', $addempty = 0)
|
||||
{
|
||||
global $langs, $db;
|
||||
global $langs;
|
||||
|
||||
$langs->load("deliveries");
|
||||
|
||||
|
|
@ -4315,7 +4378,7 @@ class Form
|
|||
print '</form>';
|
||||
} else {
|
||||
if ($selected) {
|
||||
$code = $langs->getLabelFromKey($db, $selected, 'c_shipment_mode', 'rowid', 'code');
|
||||
$code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code');
|
||||
print $langs->trans("SendingMethod".strtoupper($code));
|
||||
} else {
|
||||
print " ";
|
||||
|
|
@ -4337,9 +4400,9 @@ class Form
|
|||
|
||||
$langs->load('bills');
|
||||
|
||||
$opt = '<option value ="" selected></option>';
|
||||
$sql = 'SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'facture';
|
||||
$opt = '<option value="" selected></option>';
|
||||
$sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc";
|
||||
$sql .= ' FROM '.$this->db->prefix().'facture';
|
||||
$sql .= ' WHERE entity IN ('.getEntity('invoice').')';
|
||||
$sql .= ' AND situation_counter >= 1';
|
||||
$sql .= ' AND fk_soc = '.(int) $socid;
|
||||
|
|
@ -4394,7 +4457,7 @@ class Form
|
|||
|
||||
$return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
|
||||
$sql = 'SELECT rowid, label, code from '.MAIN_DB_PREFIX.'c_units';
|
||||
$sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units";
|
||||
$sql .= ' WHERE active > 0';
|
||||
if (!empty($unit_type)) {
|
||||
$sql .= " AND unit_type = '".$this->db->escape($unit_type)."'";
|
||||
|
|
@ -4450,7 +4513,7 @@ class Form
|
|||
$num = 0;
|
||||
|
||||
$sql = "SELECT rowid, label, bank, clos as status, currency_code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
$sql .= " FROM ".$this->db->prefix()."bank_account";
|
||||
$sql .= " WHERE entity IN (".getEntity('bank_account').")";
|
||||
if ($status != 2) {
|
||||
$sql .= " AND clos = ".(int) $status;
|
||||
|
|
@ -4530,7 +4593,7 @@ class Form
|
|||
$num = 0;
|
||||
|
||||
$sql = "SELECT rowid, name, fk_country, status, entity";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."establishment";
|
||||
$sql .= " FROM ".$this->db->prefix()."establishment";
|
||||
$sql .= " WHERE 1=1";
|
||||
if ($status != 2) {
|
||||
$sql .= " AND status = ".(int) $status;
|
||||
|
|
@ -4652,7 +4715,7 @@ class Form
|
|||
// TODO Move this into common category feature
|
||||
$cate_arbo = array();
|
||||
$sql = "SELECT c.label, c.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank_categ as c";
|
||||
$sql .= " FROM ".$this->db->prefix()."bank_categ as c";
|
||||
$sql .= " WHERE entity = ".$conf->entity;
|
||||
$sql .= " ORDER BY c.label";
|
||||
$result = $this->db->query($sql);
|
||||
|
|
@ -5736,13 +5799,13 @@ class Form
|
|||
*/
|
||||
public function selectMultiCurrency($selected = '', $htmlname = 'multicurrency_code', $useempty = 0, $filter = '', $excludeConfCurrency = false)
|
||||
{
|
||||
global $db, $conf, $langs, $user;
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->loadCacheCurrencies(''); // Load ->cache_currencies
|
||||
|
||||
$TCurrency = array();
|
||||
|
||||
$sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'multicurrency';
|
||||
$sql = "SELECT code FROM ".$this->db->prefix()."multicurrency";
|
||||
$sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')";
|
||||
if ($filter) {
|
||||
$sql .= " AND ".$filter;
|
||||
|
|
@ -5807,7 +5870,7 @@ class Form
|
|||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = "SELECT DISTINCT t.rowid, t.code, t.taux, t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.recuperableonly";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_tva as t, ".$this->db->prefix()."c_country as c";
|
||||
$sql .= " WHERE t.fk_pays = c.rowid";
|
||||
$sql .= " AND t.active > 0";
|
||||
$sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")";
|
||||
|
|
@ -6272,7 +6335,7 @@ class Form
|
|||
if (empty($conf->global->MAIN_POPUP_CALENDAR_ON_FOCUS)) {
|
||||
$retstring .= "
|
||||
showOn: 'button', /* both has problem with autocompletion */
|
||||
buttonImage: '".DOL_URL_ROOT."/theme/".$conf->theme."/img/object_calendarday.png',
|
||||
buttonImage: '".DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png',
|
||||
buttonImageOnly: true";
|
||||
}
|
||||
$retstring .= "
|
||||
|
|
@ -6285,7 +6348,7 @@ class Form
|
|||
$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"';
|
||||
$retstring .= ($disabled ? ' disabled' : '');
|
||||
$retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '');
|
||||
$retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
|
||||
$retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
|
||||
$retstring .= '>';
|
||||
|
||||
// Icone calendrier
|
||||
|
|
@ -6756,7 +6819,7 @@ class Form
|
|||
*/
|
||||
public function selectTicketsList($selected = '', $htmlname = 'ticketid', $filtertype = '', $limit = 20, $filterkey = '', $status = 1, $outputmode = 0, $showempty = '1', $forcecombo = 0, $morecss = '')
|
||||
{
|
||||
global $langs, $conf, $user, $db;
|
||||
global $langs, $conf;
|
||||
|
||||
$out = '';
|
||||
$outarray = array();
|
||||
|
|
@ -6765,7 +6828,7 @@ class Form
|
|||
|
||||
$sql = "SELECT ";
|
||||
$sql .= $selectFields;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as p";
|
||||
$sql .= " FROM ".$this->db->prefix()."ticket as p";
|
||||
$sql .= ' WHERE p.entity IN ('.getEntity('ticket').')';
|
||||
|
||||
// Add criteria on ref/label
|
||||
|
|
@ -6840,7 +6903,7 @@ class Form
|
|||
if (empty($outputmode)) return $out;
|
||||
return $outarray;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -6857,8 +6920,6 @@ class Form
|
|||
*/
|
||||
protected function constructTicketListOption(&$objp, &$opt, &$optJson, $selected, $filterkey = '')
|
||||
{
|
||||
global $langs, $conf, $user, $db;
|
||||
|
||||
$outkey = '';
|
||||
$outval = '';
|
||||
$outref = '';
|
||||
|
|
@ -6962,7 +7023,7 @@ class Form
|
|||
*/
|
||||
public function selectProjectsList($selected = '', $htmlname = 'projectid', $filtertype = '', $limit = 20, $filterkey = '', $status = 1, $outputmode = 0, $showempty = '1', $forcecombo = 0, $morecss = '')
|
||||
{
|
||||
global $langs, $conf, $user, $db;
|
||||
global $langs, $conf;
|
||||
|
||||
$out = '';
|
||||
$outarray = array();
|
||||
|
|
@ -6971,7 +7032,7 @@ class Form
|
|||
|
||||
$sql = "SELECT ";
|
||||
$sql .= $selectFields;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
$sql .= " FROM ".$this->db->prefix()."projet as p";
|
||||
$sql .= ' WHERE p.entity IN ('.getEntity('project').')';
|
||||
|
||||
// Add criteria on ref/label
|
||||
|
|
@ -7046,7 +7107,7 @@ class Form
|
|||
if (empty($outputmode)) return $out;
|
||||
return $outarray;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7063,8 +7124,6 @@ class Form
|
|||
*/
|
||||
protected function constructProjectListOption(&$objp, &$opt, &$optJson, $selected, $filterkey = '')
|
||||
{
|
||||
global $langs, $conf, $user, $db;
|
||||
|
||||
$outkey = '';
|
||||
$outval = '';
|
||||
$outref = '';
|
||||
|
|
@ -7087,7 +7146,7 @@ class Form
|
|||
$outval .= $objRef;
|
||||
|
||||
$opt .= "</option>\n";
|
||||
$optJson = array('key'=>$outkey, 'value'=>$outref, 'type'=>$outtypem);
|
||||
$optJson = array('key'=>$outkey, 'value'=>$outref, 'type'=>$outtype);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -7169,7 +7228,7 @@ class Form
|
|||
*/
|
||||
public function selectMembersList($selected = '', $htmlname = 'adherentid', $filtertype = '', $limit = 20, $filterkey = '', $status = 1, $outputmode = 0, $showempty = '1', $forcecombo = 0, $morecss = '')
|
||||
{
|
||||
global $langs, $conf, $user, $db;
|
||||
global $langs, $conf;
|
||||
|
||||
$out = '';
|
||||
$outarray = array();
|
||||
|
|
@ -7178,7 +7237,7 @@ class Form
|
|||
|
||||
$sql = "SELECT ";
|
||||
$sql .= $selectFields;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as p";
|
||||
$sql .= " FROM ".$this->db->prefix()."adherent as p";
|
||||
$sql .= ' WHERE p.entity IN ('.getEntity('adherent').')';
|
||||
|
||||
// Add criteria on ref/label
|
||||
|
|
@ -7253,7 +7312,7 @@ class Form
|
|||
if (empty($outputmode)) return $out;
|
||||
return $outarray;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7270,8 +7329,6 @@ class Form
|
|||
*/
|
||||
protected function constructMemberListOption(&$objp, &$opt, &$optJson, $selected, $filterkey = '')
|
||||
{
|
||||
global $langs, $conf, $user, $db;
|
||||
|
||||
$outkey = '';
|
||||
$outval = '';
|
||||
$outref = '';
|
||||
|
|
@ -7294,7 +7351,7 @@ class Form
|
|||
$outval .= $objRef;
|
||||
|
||||
$opt .= "</option>\n";
|
||||
$optJson = array('key'=>$outkey, 'value'=>$outref, 'type'=>$outtypem);
|
||||
$optJson = array('key'=>$outkey, 'value'=>$outref, 'type'=>$outtype);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -7480,15 +7537,15 @@ class Form
|
|||
$num = 0;
|
||||
|
||||
// Search data
|
||||
$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".MAIN_DB_PREFIX.$objecttmp->table_element." as t";
|
||||
$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$objecttmp->table_element." as t";
|
||||
if (isset($objecttmp->ismultientitymanaged)) {
|
||||
if (!is_numeric($objecttmp->ismultientitymanaged)) {
|
||||
$tmparray = explode('@', $objecttmp->ismultientitymanaged);
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX.$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0];
|
||||
$sql .= " INNER JOIN ".$this->db->prefix().$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0];
|
||||
}
|
||||
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8019,6 +8076,31 @@ class Form
|
|||
}
|
||||
}
|
||||
|
||||
// Try also magic suggest
|
||||
$out .= '<select id="'.$htmlname.'" class="multiselect'.($morecss ? ' '.$morecss : '').'" multiple name="'.$htmlname.'[]"'.($moreattrib ? ' '.$moreattrib : '').($width ? ' style="width: '.(preg_match('/%/', $width) ? $width : $width.'px').'"' : '').'>'."\n";
|
||||
if (is_array($array) && !empty($array)) {
|
||||
if ($value_as_key) {
|
||||
$array = array_combine($array, $array);
|
||||
}
|
||||
|
||||
if (!empty($array)) {
|
||||
foreach ($array as $key => $value) {
|
||||
$newval = ($translate ? $langs->trans($value) : $value);
|
||||
$newval = ($key_in_label ? $key.' - '.$newval : $newval);
|
||||
|
||||
$out .= '<option value="'.$key.'"';
|
||||
if (is_array($selected) && !empty($selected) && in_array((string) $key, $selected) && ((string) $key != '')) {
|
||||
$out .= ' selected';
|
||||
}
|
||||
$out .= ' data-html="'.dol_escape_htmltag($newval).'"';
|
||||
$out .= '>';
|
||||
$out .= dol_htmlentitiesbr($newval);
|
||||
$out .= '</option>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$out .= '</select>'."\n";
|
||||
|
||||
// Add code for jquery to use multiselect
|
||||
if (!empty($conf->use_javascript_ajax) && !empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) {
|
||||
$out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->';
|
||||
|
|
@ -8073,31 +8155,6 @@ class Form
|
|||
$out .= '</script>';
|
||||
}
|
||||
|
||||
// Try also magic suggest
|
||||
$out .= '<select id="'.$htmlname.'" class="multiselect'.($morecss ? ' '.$morecss : '').'" multiple name="'.$htmlname.'[]"'.($moreattrib ? ' '.$moreattrib : '').($width ? ' style="width: '.(preg_match('/%/', $width) ? $width : $width.'px').'"' : '').'>'."\n";
|
||||
if (is_array($array) && !empty($array)) {
|
||||
if ($value_as_key) {
|
||||
$array = array_combine($array, $array);
|
||||
}
|
||||
|
||||
if (!empty($array)) {
|
||||
foreach ($array as $key => $value) {
|
||||
$newval = ($translate ? $langs->trans($value) : $value);
|
||||
$newval = ($key_in_label ? $key.' - '.$newval : $newval);
|
||||
|
||||
$out .= '<option value="'.$key.'"';
|
||||
if (is_array($selected) && !empty($selected) && in_array((string) $key, $selected) && ((string) $key != '')) {
|
||||
$out .= ' selected';
|
||||
}
|
||||
$out .= ' data-html="'.dol_escape_htmltag($newval).'"';
|
||||
$out .= '>';
|
||||
$out .= dol_htmlentitiesbr($newval);
|
||||
$out .= '</option>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$out .= '</select>'."\n";
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
|
@ -8222,11 +8279,9 @@ class Form
|
|||
*/
|
||||
public function showCategories($id, $type, $rendermode = 0, $nolink = 0)
|
||||
{
|
||||
global $db;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
|
||||
$cat = new Categorie($db);
|
||||
$cat = new Categorie($this->db);
|
||||
$categories = $cat->containing($id, $type);
|
||||
|
||||
if ($rendermode == 1) {
|
||||
|
|
@ -8454,22 +8509,23 @@ class Form
|
|||
}
|
||||
|
||||
$possiblelinks = array(
|
||||
'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'),
|
||||
'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'),
|
||||
'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
|
||||
'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
|
||||
'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'),
|
||||
'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'),
|
||||
'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
|
||||
'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
|
||||
'contrat'=>array(
|
||||
'enabled'=>$conf->contrat->enabled,
|
||||
'perms'=>1,
|
||||
'label'=>'LinkToContract',
|
||||
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t, ".MAIN_DB_PREFIX."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier'
|
||||
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht
|
||||
FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."contrat as t, ".$this->db->prefix()."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier'
|
||||
),
|
||||
'fichinter'=>array('enabled'=>!empty($conf->ficheinter->enabled) ? $conf->ficheinter->enabled : 0, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'),
|
||||
'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'),
|
||||
'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
|
||||
'invoice_supplier'=>array('enabled'=>$conf->supplier_invoice->enabled, 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'),
|
||||
'ticket'=>array('enabled'=>$conf->ticket->enabled, 'perms'=>1, 'label'=>'LinkToTicket', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'),
|
||||
'mo'=>array('enabled'=>$conf->mrp->enabled, 'perms'=>1, 'label'=>'LinkToMo', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".MAIN_DB_PREFIX."societe as s INNER JOIN ".MAIN_DB_PREFIX."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')')
|
||||
'fichinter'=>array('enabled'=>!empty($conf->ficheinter->enabled) ? $conf->ficheinter->enabled : 0, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'),
|
||||
'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'),
|
||||
'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
|
||||
'invoice_supplier'=>array('enabled'=>$conf->supplier_invoice->enabled, 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'),
|
||||
'ticket'=>array('enabled'=>$conf->ticket->enabled, 'perms'=>1, 'label'=>'LinkToTicket', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'),
|
||||
'mo'=>array('enabled'=>$conf->mrp->enabled, 'perms'=>1, 'label'=>'LinkToMo', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix()."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')')
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -8675,7 +8731,7 @@ class Form
|
|||
{
|
||||
// phpcs:enable
|
||||
$sql = "SELECT rowid, label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."export_model";
|
||||
$sql .= " FROM ".$this->db->prefix()."export_model";
|
||||
$sql .= " WHERE type = '".$this->db->escape($type)."'";
|
||||
$sql .= " ORDER BY rowid";
|
||||
$result = $this->db->query($sql);
|
||||
|
|
@ -9193,9 +9249,9 @@ class Form
|
|||
if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
$sql .= ", e.label";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."usergroup as ug ";
|
||||
$sql .= " FROM ".$this->db->prefix()."usergroup as ug ";
|
||||
if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entity as e ON e.rowid=ug.entity";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity";
|
||||
if ($force_entity) {
|
||||
$sql .= " WHERE ug.entity IN (0, ".$force_entity.")";
|
||||
} else {
|
||||
|
|
@ -9357,24 +9413,24 @@ class Form
|
|||
*/
|
||||
public function selectExpenseCategories($selected = '', $htmlname = 'fk_c_exp_tax_cat', $useempty = 0, $excludeid = array(), $target = '', $default_selected = 0, $params = array(), $info_admin = 1)
|
||||
{
|
||||
global $db, $langs, $user;
|
||||
global $langs, $user;
|
||||
|
||||
$out = '';
|
||||
$sql = 'SELECT rowid, label FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat WHERE active = 1';
|
||||
$sql .= ' AND entity IN (0,'.getEntity('exp_tax_cat').')';
|
||||
$sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1";
|
||||
$sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")";
|
||||
if (!empty($excludeid)) {
|
||||
$sql .= ' AND rowid NOT IN ('.$this->db->sanitize(implode(',', $excludeid)).')';
|
||||
$sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")";
|
||||
}
|
||||
$sql .= ' ORDER BY label';
|
||||
$sql .= " ORDER BY label";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">';
|
||||
if ($useempty) {
|
||||
$out .= '<option value="0"> </option>';
|
||||
}
|
||||
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>';
|
||||
}
|
||||
$out .= '</select>';
|
||||
|
|
@ -9385,11 +9441,11 @@ class Form
|
|||
}
|
||||
|
||||
if (!empty($target)) {
|
||||
$sql = "SELECT c.id FROM ".MAIN_DB_PREFIX."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
|
||||
$resql = $db->query($sql);
|
||||
$sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
if ($db->num_rows($resql) > 0) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($this->db->num_rows($resql) > 0) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$out .= '<script>
|
||||
$(function() {
|
||||
$("select[name='.$target.']").on("change", function() {
|
||||
|
|
@ -9431,7 +9487,7 @@ class Form
|
|||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
return $out;
|
||||
|
|
@ -9447,25 +9503,25 @@ class Form
|
|||
*/
|
||||
public function selectExpenseRanges($selected = '', $htmlname = 'fk_range', $useempty = 0)
|
||||
{
|
||||
global $db, $conf, $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$out = '';
|
||||
$sql = 'SELECT rowid, range_ik FROM '.MAIN_DB_PREFIX.'c_exp_tax_range';
|
||||
$sql .= ' WHERE entity = '.$conf->entity.' AND active = 1';
|
||||
$sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range";
|
||||
$sql .= " WHERE entity = ".$conf->entity." AND active = 1";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
|
||||
if ($useempty) {
|
||||
$out .= '<option value="0"></option>';
|
||||
}
|
||||
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>';
|
||||
}
|
||||
$out .= '</select>';
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
return $out;
|
||||
|
|
@ -9483,13 +9539,13 @@ class Form
|
|||
*/
|
||||
public function selectExpense($selected = '', $htmlname = 'fk_c_type_fees', $useempty = 0, $allchoice = 1, $useid = 0)
|
||||
{
|
||||
global $db, $langs;
|
||||
global $langs;
|
||||
|
||||
$out = '';
|
||||
$sql = 'SELECT id, code, label FROM '.MAIN_DB_PREFIX.'c_type_fees';
|
||||
$sql .= ' WHERE active = 1';
|
||||
$sql = "SELECT id, code, label FROM ".$this->db->prefix()."c_type_fees";
|
||||
$sql .= " WHERE active = 1";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
|
||||
if ($useempty) {
|
||||
|
|
@ -9504,13 +9560,13 @@ class Form
|
|||
$field = 'id';
|
||||
}
|
||||
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$key = $langs->trans($obj->code);
|
||||
$out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>';
|
||||
}
|
||||
$out .= '</select>';
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
return $out;
|
||||
|
|
@ -9562,9 +9618,9 @@ class Form
|
|||
$sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref,
|
||||
p.title, p.fk_soc, p.fk_statut, p.public,";
|
||||
$sql .= ' s.nom as name';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'projet as p';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc,';
|
||||
$sql .= ' '.MAIN_DB_PREFIX.'facture as f';
|
||||
$sql .= ' FROM '.$this->db->prefix().'projet as p';
|
||||
$sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,';
|
||||
$sql .= ' '.$this->db->prefix().'facture as f';
|
||||
$sql .= " WHERE p.entity IN (".getEntity('project').")";
|
||||
$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement
|
||||
//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")";
|
||||
|
|
@ -9742,14 +9798,14 @@ class Form
|
|||
*/
|
||||
public function selectModelMail($prefix, $modelType = '', $default = 0, $addjscombo = 0)
|
||||
{
|
||||
global $langs, $db, $user;
|
||||
global $langs, $user;
|
||||
|
||||
$retstring = '';
|
||||
|
||||
$TModels = array();
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail = new FormMail($this->db);
|
||||
$result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs);
|
||||
|
||||
if ($default) {
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class FormAccounting extends Form
|
|||
$selected = $selectid;
|
||||
} else {
|
||||
$sql = "SELECT rowid, code, label, nature, entity, active";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_journal";
|
||||
$sql .= " FROM ".$this->db->prefix()."accounting_journal";
|
||||
$sql .= " WHERE active = 1";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
if ($nature && is_numeric($nature)) {
|
||||
|
|
@ -162,7 +162,7 @@ class FormAccounting extends Form
|
|||
$selected = $selectedIds;
|
||||
} else {
|
||||
$sql = "SELECT rowid, code, label, nature, entity, active";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_journal";
|
||||
$sql .= " FROM ".$this->db->prefix()."accounting_journal";
|
||||
$sql .= " WHERE active = 1";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
if ($nature && is_numeric($nature)) {
|
||||
|
|
@ -238,7 +238,7 @@ class FormAccounting extends Form
|
|||
|
||||
if (!empty($mysoc->country_id)) {
|
||||
$sql = "SELECT c.rowid, c.label as type, c.range_account";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_accounting_category as c";
|
||||
$sql .= " WHERE c.active = 1";
|
||||
$sql .= " AND c.category_type = 0";
|
||||
if (empty($allcountries)) {
|
||||
|
|
@ -247,7 +247,7 @@ class FormAccounting extends Form
|
|||
$sql .= " ORDER BY c.label ASC";
|
||||
} else {
|
||||
$sql = "SELECT c.rowid, c.label as type, c.range_account";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_accounting_category as c, ".$this->db->prefix()."c_country as co";
|
||||
$sql .= " WHERE c.active = 1";
|
||||
$sql .= " AND c.category_type = 0";
|
||||
$sql .= " AND c.fk_country = co.rowid";
|
||||
|
|
@ -307,7 +307,7 @@ class FormAccounting extends Form
|
|||
// phpcs:enable
|
||||
$options = array();
|
||||
|
||||
$sql = 'SELECT DISTINCT import_key from '.MAIN_DB_PREFIX.'accounting_bookkeeping';
|
||||
$sql = "SELECT DISTINCT import_key FROM ".$this->db->prefix()."accounting_bookkeeping";
|
||||
$sql .= " WHERE entity IN (".getEntity('accountancy').")";
|
||||
$sql .= ' ORDER BY import_key DESC';
|
||||
|
||||
|
|
@ -363,8 +363,8 @@ class FormAccounting extends Form
|
|||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT) ? 50 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT;
|
||||
|
||||
$sql = "SELECT DISTINCT aa.account_number, aa.label, aa.labelshort, aa.rowid, aa.fk_pcg_version";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " FROM ".$this->db->prefix()."accounting_account as aa";
|
||||
$sql .= " INNER JOIN ".$this->db->prefix()."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = ".((int) $conf->global->CHARTOFACCOUNTS);
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " AND aa.entity=".$conf->entity;
|
||||
|
|
@ -454,7 +454,7 @@ class FormAccounting extends Form
|
|||
|
||||
// Auxiliary thirdparties account
|
||||
$sql = "SELECT code_compta, code_compta_fournisseur, nom as name";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe";
|
||||
$sql .= " FROM ".$this->db->prefix()."societe";
|
||||
$sql .= " WHERE entity IN (".getEntity('societe').")";
|
||||
$sql .= " AND (client IN (1,3) OR fournisseur = 1)";
|
||||
|
||||
|
|
@ -480,7 +480,7 @@ class FormAccounting extends Form
|
|||
|
||||
// Auxiliary user account
|
||||
$sql = "SELECT DISTINCT accountancy_code, lastname, firstname ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user";
|
||||
$sql .= " FROM ".$this->db->prefix()."user";
|
||||
$sql .= " WHERE entity IN (".getEntity('user').")";
|
||||
$sql .= " ORDER BY accountancy_code";
|
||||
|
||||
|
|
@ -527,7 +527,7 @@ class FormAccounting extends Form
|
|||
$out_array = array();
|
||||
|
||||
$sql = "SELECT DISTINCT date_format(doc_date, '%Y') as dtyear";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||
$sql .= " FROM ".$this->db->prefix()."accounting_bookkeeping";
|
||||
$sql .= " WHERE entity IN (".getEntity('accountancy').")";
|
||||
$sql .= " ORDER BY date_format(doc_date, '%Y')";
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
|
|
|||
|
|
@ -359,7 +359,7 @@ class FormActions
|
|||
* @param string $morecss More css to add to SELECT component.
|
||||
* @return string
|
||||
*/
|
||||
public function select_type_actions($selected = '', $htmlname = 'actioncode', $excludetype = '', $onlyautoornot = 0, $hideinfohelp = 0, $multiselect = 0, $nooutput = 0, $morecss = '')
|
||||
public function select_type_actions($selected = '', $htmlname = 'actioncode', $excludetype = '', $onlyautoornot = 0, $hideinfohelp = 0, $multiselect = 0, $nooutput = 0, $morecss = 'minwidth300')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs, $user, $form, $conf;
|
||||
|
|
@ -399,7 +399,7 @@ class FormActions
|
|||
}
|
||||
$out .= $form->multiselectarray($htmlname, $arraylist, $selected, 0, 0, 'centpercent', 0, 0);
|
||||
} else {
|
||||
$out .= $form->selectarray($htmlname, $arraylist, $selected, 0, 0, 0, '', 0, 0, 0, '', 'minwidth300'.($morecss ? ' '.$morecss : ''), 1);
|
||||
$out .= $form->selectarray($htmlname, $arraylist, $selected, 0, 0, 0, '', 0, 0, 0, '', $morecss, 1);
|
||||
}
|
||||
|
||||
if ($user->admin && empty($onlyautoornot) && $hideinfohelp <= 0) {
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ class FormAdmin
|
|||
$langs->load("dict");
|
||||
|
||||
$sql = "SELECT code, label, width, height, unit";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_paper_format";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_paper_format";
|
||||
$sql .= " WHERE active=1";
|
||||
if ($filter) {
|
||||
$sql .= " AND code LIKE '%".$this->db->escape($filter)."%'";
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ class FormBarCode
|
|||
$out = '';
|
||||
|
||||
$sql = "SELECT rowid, code, libelle";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_barcode_type";
|
||||
$sql .= " WHERE coder <> '0'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$sql .= " ORDER BY code";
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class FormCompany extends Form
|
|||
$effs = array();
|
||||
|
||||
$sql = "SELECT id, code, libelle";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_typent";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_typent";
|
||||
$sql .= " WHERE active = 1 AND (fk_country IS NULL OR fk_country = ".(empty($mysoc->country_id) ? '0' : $mysoc->country_id).")";
|
||||
if ($filter) {
|
||||
$sql .= " ".$filter;
|
||||
|
|
@ -105,7 +105,7 @@ class FormCompany extends Form
|
|||
$effs = array();
|
||||
|
||||
$sql = "SELECT id, code, libelle";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_effectif";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_effectif";
|
||||
$sql .= " WHERE active = 1";
|
||||
if ($filter) {
|
||||
$sql .= " ".$filter;
|
||||
|
|
@ -155,7 +155,7 @@ class FormCompany extends Form
|
|||
|
||||
dol_syslog(get_class($this).'::form_prospect_level', LOG_DEBUG);
|
||||
$sql = "SELECT code, label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_prospectlevel";
|
||||
$sql .= " WHERE active > 0";
|
||||
$sql .= " ORDER BY sortorder";
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -206,7 +206,7 @@ class FormCompany extends Form
|
|||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$sql = "SELECT code, label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_prospectcontactlevel";
|
||||
$sql .= " WHERE active > 0";
|
||||
$sql .= " ORDER BY sortorder";
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -283,7 +283,7 @@ class FormCompany extends Form
|
|||
|
||||
// Serch departements/cantons/province active d'une region et pays actif
|
||||
$sql = "SELECT d.rowid, d.code_departement as code, d.nom as name, d.active, c.label as country, c.code as country_code, r.nom as region_name FROM";
|
||||
$sql .= " ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r,".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql .= " ".$this->db->prefix()."c_departements as d, ".$this->db->prefix()."c_regions as r,".$this->db->prefix()."c_country as c";
|
||||
$sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid";
|
||||
$sql .= " AND d.active = 1 AND r.active = 1 AND c.active = 1";
|
||||
if ($country_codeid && is_numeric($country_codeid)) {
|
||||
|
|
@ -385,7 +385,7 @@ class FormCompany extends Form
|
|||
$langs->load("dict");
|
||||
|
||||
$sql = "SELECT r.rowid, r.code_region as code, r.nom as label, r.active, c.code as country_code, c.label as country";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_regions as r, ".$this->db->prefix()."c_country as c";
|
||||
$sql .= " WHERE r.fk_pays=c.rowid AND r.active = 1 and c.active = 1";
|
||||
$sql .= " ORDER BY c.code, c.label ASC";
|
||||
|
||||
|
|
@ -444,7 +444,7 @@ class FormCompany extends Form
|
|||
|
||||
$out = '';
|
||||
|
||||
$sql = "SELECT rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_civility";
|
||||
$sql = "SELECT rowid, code, label, active FROM ".$this->db->prefix()."c_civility";
|
||||
$sql .= " WHERE active = 1";
|
||||
|
||||
dol_syslog("Form::select_civility", LOG_DEBUG);
|
||||
|
|
@ -525,7 +525,7 @@ class FormCompany extends Form
|
|||
|
||||
// On recherche les formes juridiques actives des pays actifs
|
||||
$sql = "SELECT f.rowid, f.code as code , f.libelle as label, f.active, c.label as country, c.code as country_code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_forme_juridique as f, ".$this->db->prefix()."c_country as c";
|
||||
$sql .= " WHERE f.fk_pays=c.rowid";
|
||||
$sql .= " AND f.active = 1 AND c.active = 1";
|
||||
if ($country_codeid) {
|
||||
|
|
@ -709,9 +709,9 @@ class FormCompany extends Form
|
|||
$sql .= ", s.address, s.zip, s.town";
|
||||
$sql .= ", dictp.code as country_code";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " FROM ".$this->db->prefix()."societe as s";
|
||||
if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as dictp ON dictp.rowid = s.fk_pays";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays";
|
||||
}
|
||||
$sql .= " WHERE s.entity IN (".getEntity('societe').")";
|
||||
// For ajax search we limit here. For combo list, we limit later
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class FormContract
|
|||
public function select_contract($socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1, $showRef = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $db, $user, $conf, $langs;
|
||||
global $user, $conf, $langs;
|
||||
|
||||
$hideunselectables = false;
|
||||
if (!empty($conf->global->CONTRACT_HIDE_UNSELECTABLES)) {
|
||||
|
|
@ -72,9 +72,9 @@ class FormContract
|
|||
}
|
||||
|
||||
// Search all contacts
|
||||
$sql = 'SELECT c.rowid, c.ref, c.fk_soc, c.statut,';
|
||||
$sql .= ' c.ref_customer, c.ref_supplier';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'contrat as c';
|
||||
$sql = "SELECT c.rowid, c.ref, c.fk_soc, c.statut,";
|
||||
$sql .= " c.ref_customer, c.ref_supplier";
|
||||
$sql .= " FROM ".$this->db->prefix()."contrat as c";
|
||||
$sql .= " WHERE c.entity = ".$conf->entity;
|
||||
//if ($contratListId) $sql.= " AND c.rowid IN (".$this->db->sanitize($contratListId).")";
|
||||
if ($socid > 0) {
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class FormExpenseReport
|
|||
$out .= '> </option>';
|
||||
}
|
||||
|
||||
$sql = "SELECT c.id, c.code, c.label as type FROM ".MAIN_DB_PREFIX."c_type_fees as c";
|
||||
$sql = "SELECT c.id, c.code, c.label as type FROM ".$this->db->prefix()."c_type_fees as c";
|
||||
if ($active >= 0) {
|
||||
$sql .= " WHERE c.active = ".((int) $active);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1417,7 +1417,7 @@ class FormFile
|
|||
} else {
|
||||
print '<a href="'.$urlforhref['url'].'" class="'.$urlforhref['css'].'" target="'.$urlforhref['target'].'" mime="'.$urlforhref['mime'].'">';
|
||||
}
|
||||
print '<img class="photo maxwidth200 shadow valignmiddle" height="'.(($useinecm == 4 || $useinecm == 5 || $useinecm == 6) ? '12' : $maxheightmini).'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity) ? $object->entity : $conf->entity).'&file='.urlencode($relativepath.$smallfile).'" title="">';
|
||||
print '<img class="photo maxwidth200 shadow valignmiddle" height="'.(($useinecm == 4 || $useinecm == 5 || $useinecm == 6) ? '20' : $maxheightmini).'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity) ? $object->entity : $conf->entity).'&file='.urlencode($relativepath.$smallfile).'" title="">';
|
||||
print '</a>';
|
||||
} else {
|
||||
print ' ';
|
||||
|
|
|
|||
|
|
@ -64,15 +64,15 @@ class FormIntervention
|
|||
public function select_interventions($socid = -1, $selected = '', $htmlname = 'interventionid', $maxlength = 16, $showempty = 1, $draftonly = false)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $db, $user, $conf, $langs;
|
||||
global $user, $conf, $langs;
|
||||
|
||||
$out = '';
|
||||
|
||||
$hideunselectables = false;
|
||||
|
||||
// Search all contacts
|
||||
$sql = 'SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'fichinter as f';
|
||||
$sql = "SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut";
|
||||
$sql .= " FROM ".$this->db->prefix()."fichinter as f";
|
||||
$sql .= " WHERE f.entity = ".$conf->entity;
|
||||
if ($socid != '') {
|
||||
if ($socid == '0') {
|
||||
|
|
|
|||
|
|
@ -602,9 +602,9 @@ class FormMail extends Form
|
|||
}
|
||||
|
||||
// Add also email aliases from the c_email_senderprofile table
|
||||
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile';
|
||||
$sql .= ' WHERE active = 1 AND (private = 0 OR private = '.((int) $user->id).')';
|
||||
$sql .= ' ORDER BY position';
|
||||
$sql = "SELECT rowid, label, email FROM ".$this->db->prefix()."c_email_senderprofile";
|
||||
$sql .= " WHERE active = 1 AND (private = 0 OR private = ".((int) $user->id).")";
|
||||
$sql .= " ORDER BY position";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
|
@ -1279,7 +1279,7 @@ class FormMail extends Form
|
|||
}
|
||||
|
||||
$sql = "SELECT rowid, module, label, type_template, topic, joinfiles, content, content_lines, lang";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
|
||||
$sql .= " FROM ".$db->prefix().'c_email_templates';
|
||||
$sql .= " WHERE (type_template='".$db->escape($type_template)."' OR type_template='all')";
|
||||
$sql .= " AND entity IN (".getEntity('c_email_templates').")";
|
||||
$sql .= " AND (private = 0 OR fk_user = ".((int) $user->id).")"; // Get all public or private owned
|
||||
|
|
@ -1402,7 +1402,7 @@ class FormMail extends Form
|
|||
public function isEMailTemplate($type_template, $user, $outputlangs)
|
||||
{
|
||||
$sql = "SELECT label, topic, content, lang";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
|
||||
$sql .= " FROM ".$this->db->prefix().'c_email_templates';
|
||||
$sql .= " WHERE type_template='".$this->db->escape($type_template)."'";
|
||||
$sql .= " AND entity IN (".getEntity('c_email_templates').")";
|
||||
$sql .= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".((int) $user->id).")";
|
||||
|
|
@ -1438,7 +1438,7 @@ class FormMail extends Form
|
|||
global $conf;
|
||||
|
||||
$sql = "SELECT rowid, module, label, topic, content, content_lines, lang, fk_user, private, position";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
|
||||
$sql .= " FROM ".$this->db->prefix().'c_email_templates';
|
||||
$sql .= " WHERE type_template IN ('".$this->db->escape($type_template)."', 'all')";
|
||||
$sql .= " AND entity IN (".getEntity('c_email_templates').")";
|
||||
$sql .= " AND (private = 0 OR fk_user = ".((int) $user->id).")"; // See all public templates or templates I own.
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class FormOrder extends Form
|
|||
$listofmethods = array();
|
||||
|
||||
$sql = "SELECT rowid, code, libelle as label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_input_method";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_input_method";
|
||||
$sql .= " WHERE active = 1";
|
||||
|
||||
dol_syslog(get_class($this)."::selectInputMethod", LOG_DEBUG);
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ class FormOther
|
|||
global $conf, $langs, $user;
|
||||
|
||||
$sql = "SELECT rowid, label, fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."export_model";
|
||||
$sql .= " FROM ".$this->db->prefix()."export_model";
|
||||
$sql .= " WHERE type = '".$this->db->escape($type)."'";
|
||||
if (empty($conf->global->EXPORTS_SHARE_MODELS)) { // EXPORTS_SHARE_MODELS means all templates are visible, whatever is owner.
|
||||
$sql .= " AND fk_user IN (0, ".((int) $fk_user).")";
|
||||
|
|
@ -201,7 +201,7 @@ class FormOther
|
|||
global $conf, $langs, $user;
|
||||
|
||||
$sql = "SELECT rowid, label, fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."import_model";
|
||||
$sql .= " FROM ".$this->db->prefix()."import_model";
|
||||
$sql .= " WHERE type = '".$this->db->escape($type)."'";
|
||||
if (empty($conf->global->EXPORTS_SHARE_MODELS)) { // EXPORTS_SHARE_MODELS means all templates are visible, whatever is owner.
|
||||
$sql .= " AND fk_user IN (0, ".((int) $fk_user).")";
|
||||
|
|
@ -261,7 +261,7 @@ class FormOther
|
|||
|
||||
$sql = "SELECT e.rowid, e.code, e.label, e.price, e.organization,";
|
||||
$sql .= " c.label as country";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_ecotaxe as e,".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_ecotaxe as e,".$this->db->prefix()."c_country as c";
|
||||
$sql .= " WHERE e.active = 1 AND e.fk_pays = c.rowid";
|
||||
$sql .= " ORDER BY country, e.organization ASC, e.code ASC";
|
||||
|
||||
|
|
@ -313,7 +313,7 @@ class FormOther
|
|||
$out = '';
|
||||
|
||||
$sql = "SELECT r.taux, r.revenuestamp_type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_revenuestamp as r,".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_revenuestamp as r,".$this->db->prefix()."c_country as c";
|
||||
$sql .= " WHERE r.active = 1 AND r.fk_pays = c.rowid";
|
||||
$sql .= " AND c.code = '".$this->db->escape($country_code)."'";
|
||||
|
||||
|
|
@ -500,13 +500,13 @@ class FormOther
|
|||
|
||||
// Get list of users allowed to be viewed
|
||||
$sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut as status, u.login, u.photo, u.gender, u.entity, u.admin";
|
||||
$sql_usr .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql_usr .= " FROM ".$this->db->prefix()."user as u";
|
||||
|
||||
if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (!empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
||||
$sql_usr .= " WHERE u.entity IS NOT NULL"; // Show all users
|
||||
} else {
|
||||
$sql_usr .= " WHERE EXISTS (SELECT ug.fk_user FROM ".MAIN_DB_PREFIX."usergroup_user as ug WHERE u.rowid = ug.fk_user AND ug.entity IN (".getEntity('usergroup')."))";
|
||||
$sql_usr .= " WHERE EXISTS (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE u.rowid = ug.fk_user AND ug.entity IN (".getEntity('usergroup')."))";
|
||||
$sql_usr .= " OR u.entity = 0"; // Show always superadmin
|
||||
}
|
||||
} else {
|
||||
|
|
@ -529,13 +529,13 @@ class FormOther
|
|||
if (empty($user->rights->user->user->lire) && $user->socid) {
|
||||
$sql_usr .= " UNION ";
|
||||
$sql_usr .= "SELECT u2.rowid, u2.lastname, u2.firstname, u2.statut as status, u2.login, u2.photo, u2.gender, u2.entity, u2.admin";
|
||||
$sql_usr .= " FROM ".MAIN_DB_PREFIX."user as u2, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql_usr .= " FROM ".$this->db->prefix()."user as u2, ".$this->db->prefix()."societe_commerciaux as sc";
|
||||
|
||||
if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (!empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
||||
$sql_usr .= " WHERE u2.entity IS NOT NULL"; // Show all users
|
||||
} else {
|
||||
$sql_usr .= " WHERE EXISTS (SELECT ug2.fk_user FROM ".MAIN_DB_PREFIX."usergroup_user as ug2 WHERE u2.rowid = ug2.fk_user AND ug2.entity IN (".getEntity('usergroup')."))";
|
||||
$sql_usr .= " WHERE EXISTS (SELECT ug2.fk_user FROM ".$this->db->prefix()."usergroup_user as ug2 WHERE u2.rowid = ug2.fk_user AND ug2.entity IN (".getEntity('usergroup')."))";
|
||||
}
|
||||
} else {
|
||||
$sql_usr .= " WHERE u2.entity IN (".getEntity('user').")";
|
||||
|
|
@ -1398,7 +1398,7 @@ class FormOther
|
|||
$langs->load("admin");
|
||||
|
||||
$sql = "SELECT rowid, ".$keyfield.", ".$labelfield;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$dictionarytable;
|
||||
$sql .= " FROM ".$this->db->prefix().$dictionarytable;
|
||||
$sql .= " ORDER BY ".$labelfield;
|
||||
|
||||
dol_syslog(get_class($this)."::select_dictionary", LOG_DEBUG);
|
||||
|
|
|
|||
|
|
@ -164,8 +164,8 @@ class FormProjets
|
|||
}
|
||||
|
||||
// Search all projects
|
||||
$sql = 'SELECT p.rowid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public, s.nom as name, s.name_alias';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'projet as p LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc';
|
||||
$sql = "SELECT p.rowid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public, s.nom as name, s.name_alias";
|
||||
$sql .= " FROM ".$this->db->prefix()."projet as p LEFT JOIN ".$this->db->prefix()."societe as s ON s.rowid = p.fk_soc";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('project').")";
|
||||
if ($projectsListId !== false) {
|
||||
$sql .= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")";
|
||||
|
|
@ -338,12 +338,12 @@ class FormProjets
|
|||
}
|
||||
|
||||
// Search all projects
|
||||
$sql = 'SELECT t.rowid, t.ref as tref, t.label as tlabel, t.progress,';
|
||||
$sql .= ' p.rowid as pid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public, p.usage_task,';
|
||||
$sql .= ' s.nom as name';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'projet as p';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc,';
|
||||
$sql .= ' '.MAIN_DB_PREFIX.'projet_task as t';
|
||||
$sql = "SELECT t.rowid, t.ref as tref, t.label as tlabel, t.progress,";
|
||||
$sql .= " p.rowid as pid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public, p.usage_task,";
|
||||
$sql .= " s.nom as name";
|
||||
$sql .= " FROM ".$this->db->prefix()."projet as p";
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON s.rowid = p.fk_soc,";
|
||||
$sql .= " ".$this->db->prefix()."projet_task as t";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('project').")";
|
||||
$sql .= " AND t.fk_projet = p.rowid";
|
||||
if ($projectsListId) {
|
||||
|
|
@ -566,7 +566,7 @@ class FormProjets
|
|||
$sql = "SELECT t.rowid, t.ref";
|
||||
break;
|
||||
case 'stock_mouvement':
|
||||
$sql = 'SELECT t.rowid, t.label as ref';
|
||||
$sql = "SELECT t.rowid, t.label as ref";
|
||||
$projectkey = 'fk_origin';
|
||||
break;
|
||||
case "payment_salary":
|
||||
|
|
@ -583,9 +583,9 @@ class FormProjets
|
|||
if ($linkedtothirdparty) {
|
||||
$sql .= ", s.nom as name";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$table_element." as t";
|
||||
$sql .= " FROM ".$this->db->prefix().$table_element." as t";
|
||||
if ($linkedtothirdparty) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".$this->db->prefix()."societe as s";
|
||||
}
|
||||
$sql .= " WHERE ".$projectkey." is null";
|
||||
if (!empty($socid) && $linkedtothirdparty) {
|
||||
|
|
@ -666,7 +666,7 @@ class FormProjets
|
|||
global $conf, $langs, $user;
|
||||
|
||||
$sql = "SELECT rowid, code, label, percent";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.'c_lead_status';
|
||||
$sql .= " FROM ".$this->db->prefix().'c_lead_status';
|
||||
$sql .= " WHERE active = 1";
|
||||
$sql .= " ORDER BY position";
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class FormPropal
|
|||
} else {
|
||||
$prefix = "PropalStatus";
|
||||
|
||||
$sql = "SELECT id, code, label, active FROM ".MAIN_DB_PREFIX."c_propalst";
|
||||
$sql = "SELECT id, code, label, active FROM ".$this->db->prefix()."c_propalst";
|
||||
$sql .= " WHERE active = 1";
|
||||
dol_syslog(get_class($this)."::selectProposalStatus", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
|
|||
|
|
@ -74,13 +74,13 @@ class FormSocialContrib
|
|||
|
||||
if (!empty($mysoc->country_id)) {
|
||||
$sql = "SELECT c.id, c.libelle as type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_chargesociales as c";
|
||||
$sql .= " WHERE c.active = 1";
|
||||
$sql .= " AND c.fk_pays = ".((int) $mysoc->country_id);
|
||||
$sql .= " ORDER BY c.libelle ASC";
|
||||
} else {
|
||||
$sql = "SELECT c.id, c.libelle as type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c, ".MAIN_DB_PREFIX."c_country as co";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_chargesociales as c, ".$this->db->prefix()."c_country as co";
|
||||
$sql .= " WHERE c.active = 1 AND c.fk_pays = co.rowid";
|
||||
$sql .= " AND co.code = '".$this->db->escape($mysoc->country_code)."'";
|
||||
$sql .= " ORDER BY c.libelle ASC";
|
||||
|
|
|
|||
|
|
@ -762,13 +762,13 @@ class FormTicket
|
|||
$child_id=GETPOST($htmlname.'_child_id', 'aZ09')?GETPOST($htmlname.'_child_id', 'aZ09'):0;
|
||||
if (!empty($groupticket)) {
|
||||
$tmpgroupticket = $groupticket;
|
||||
$sql = "SELECT ctc.rowid, ctc.fk_parent, ctc.code FROM ".MAIN_DB_PREFIX."c_ticket_category as ctc WHERE ctc.code = '".$this->db->escape($tmpgroupticket)."'";
|
||||
$sql = "SELECT ctc.rowid, ctc.fk_parent, ctc.code FROM ".$this->db->prefix()."c_ticket_category as ctc WHERE ctc.code = '".$this->db->escape($tmpgroupticket)."'";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$selectedgroups[] = $obj->code;
|
||||
while ($obj->fk_parent > 0) {
|
||||
$sql = "SELECT ctc.rowid, ctc.fk_parent, ctc.code FROM ".MAIN_DB_PREFIX."c_ticket_category as ctc WHERE ctc.rowid ='".$this->db->escape($obj->fk_parent)."'";
|
||||
$sql = "SELECT ctc.rowid, ctc.fk_parent, ctc.code FROM ".$this->db->prefix()."c_ticket_category as ctc WHERE ctc.rowid ='".$this->db->escape($obj->fk_parent)."'";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
|
@ -788,7 +788,7 @@ class FormTicket
|
|||
|
||||
$sql = "SELECT ctc.rowid, ctc.code, ctc.label, ctc.fk_parent, ctc.public, ";
|
||||
$sql .= $this->db->ifsql("ctc.rowid NOT IN (SELECT ctcfather.rowid FROM llx_c_ticket_category as ctcfather JOIN llx_c_ticket_category as ctcjoin ON ctcfather.rowid = ctcjoin.fk_parent)", "'NOTPARENT'", "'PARENT'")." as isparent";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category as ctc";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_ticket_category as ctc";
|
||||
$sql .= " WHERE ctc.active > 0 AND ctc.entity = ".((int) $conf->entity);
|
||||
if ($filtertype == 'public=1') {
|
||||
$sql .= " AND ctc.public = 1";
|
||||
|
|
@ -847,8 +847,8 @@ class FormTicket
|
|||
$stringtoprint .= '<option value=""> </option>';
|
||||
|
||||
$sql = "SELECT ctc.rowid, ctc.code, ctc.label, ctc.fk_parent, ctc.public, ctcjoin.code as codefather";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category as ctc";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."c_ticket_category as ctcjoin ON ctc.fk_parent = ctcjoin.rowid";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_ticket_category as ctc";
|
||||
$sql .= " JOIN ".$this->db->prefix()."c_ticket_category as ctcjoin ON ctc.fk_parent = ctcjoin.rowid";
|
||||
$sql .= " WHERE ctc.active > 0 AND ctc.entity = ".((int) $conf->entity);
|
||||
$sql .= " AND ctc.rowid NOT IN (".$this->db->sanitize(join(',', $arrayidusedconcat)).")";
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class FormWebsite
|
|||
$out = '';
|
||||
|
||||
$sql = "SELECT rowid, ref";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."website";
|
||||
$sql .= " FROM ".$this->db->prefix()."website";
|
||||
$sql .= " WHERE 1 = 1";
|
||||
$sql .= " ORDER BY rowid";
|
||||
$result = $this->db->query($sql);
|
||||
|
|
@ -113,7 +113,7 @@ class FormWebsite
|
|||
$langs->load("admin");
|
||||
|
||||
$sql = "SELECT rowid, code, label, entity";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.'c_type_container';
|
||||
$sql .= " FROM ".$this->db->prefix().'c_type_container';
|
||||
$sql .= " WHERE active = 1 AND entity IN (".getEntity('c_type_container').")";
|
||||
$sql .= " ORDER BY label";
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ class InfoBox
|
|||
/**
|
||||
* Return array of boxes qualified for area and user
|
||||
*
|
||||
* @param DoliDB $dbs Database handler
|
||||
* @param DoliDB $dbs Database handler
|
||||
* @param string $mode 'available' or 'activated'
|
||||
* @param int $zone Name or area (-1 for all, 0 for Homepage, 1 for Accountancy, 2 for xxx, ...)
|
||||
* @param User|null $user Object user to filter
|
||||
|
|
@ -100,7 +100,7 @@ class InfoBox
|
|||
if ($mode == 'activated') { // activated
|
||||
$sql = "SELECT b.rowid, b.position, b.box_order, b.fk_user,";
|
||||
$sql .= " d.rowid as box_id, d.file, d.note, d.tms";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as d";
|
||||
$sql .= " FROM ".$dbs->prefix()."boxes as b, ".$dbs->prefix()."boxes_def as d";
|
||||
$sql .= " WHERE b.box_id = d.rowid";
|
||||
$sql .= " AND b.entity IN (0,".$conf->entity.")";
|
||||
if ($zone >= 0) {
|
||||
|
|
@ -114,7 +114,7 @@ class InfoBox
|
|||
$sql .= " ORDER BY b.box_order";
|
||||
} else { // available
|
||||
$sql = "SELECT d.rowid as box_id, d.file, d.note, d.tms";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."boxes_def as d";
|
||||
$sql .= " FROM ".$dbs->prefix()."boxes_def as d";
|
||||
$sql .= " WHERE d.entity IN (0, ".$conf->entity.")";
|
||||
}
|
||||
|
||||
|
|
@ -251,7 +251,7 @@ class InfoBox
|
|||
}
|
||||
|
||||
// Delete all lines
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes";
|
||||
$sql = "DELETE FROM ".$dbs->prefix()."boxes";
|
||||
$sql .= " WHERE entity = ".$conf->entity;
|
||||
$sql .= " AND fk_user = ".((int) $userid);
|
||||
$sql .= " AND position = ".((int) $zone);
|
||||
|
|
@ -274,7 +274,7 @@ class InfoBox
|
|||
$i++;
|
||||
$ii = sprintf('%02d', $i);
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes";
|
||||
$sql = "INSERT INTO ".$dbs->prefix()."boxes";
|
||||
$sql .= "(box_id, position, box_order, fk_user, entity)";
|
||||
$sql .= " values (";
|
||||
$sql .= " ".((int) $id).",";
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ class Link extends CommonObject
|
|||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."links (entity, datea, url, label, objecttype, objectid)";
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."links (entity, datea, url, label, objecttype, objectid)";
|
||||
$sql .= " VALUES (".$conf->entity.", '".$this->db->idate($this->datea)."'";
|
||||
$sql .= ", '".$this->db->escape($this->url)."'";
|
||||
$sql .= ", '".$this->db->escape($this->label)."'";
|
||||
|
|
@ -107,7 +107,7 @@ class Link extends CommonObject
|
|||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."links");
|
||||
$this->id = $this->db->last_insert_id($this->db->prefix()."links");
|
||||
|
||||
if ($this->id > 0) {
|
||||
// Call trigger
|
||||
|
|
@ -175,7 +175,7 @@ class Link extends CommonObject
|
|||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."links SET ";
|
||||
$sql = "UPDATE ".$this->db->prefix()."links SET ";
|
||||
$sql .= "entity = ".$conf->entity;
|
||||
$sql .= ", datea = '".$this->db->idate(dol_now())."'";
|
||||
$sql .= ", url = '".$this->db->escape($this->url)."'";
|
||||
|
|
@ -233,7 +233,7 @@ class Link extends CommonObject
|
|||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT rowid, entity, datea, url, label, objecttype, objectid FROM ".MAIN_DB_PREFIX."links";
|
||||
$sql = "SELECT rowid, entity, datea, url, label, objecttype, objectid FROM ".$this->db->prefix()."links";
|
||||
$sql .= " WHERE objecttype = '".$this->db->escape($objecttype)."' AND objectid = ".((int) $objectid);
|
||||
if ($conf->entity != 0) {
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
|
@ -274,7 +274,7 @@ class Link extends CommonObject
|
|||
/**
|
||||
* Return nb of links
|
||||
*
|
||||
* @param DoliDb $dbs Database handler
|
||||
* @param DoliDb $dbs Database handler
|
||||
* @param string $objecttype Type of the associated object in dolibarr
|
||||
* @param int $objectid Id of the associated object in dolibarr
|
||||
* @return int Nb of links, -1 if error
|
||||
|
|
@ -283,7 +283,7 @@ class Link extends CommonObject
|
|||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."links";
|
||||
$sql = "SELECT COUNT(rowid) as nb FROM ".$dbs->prefix()."links";
|
||||
$sql .= " WHERE objecttype = '".$dbs->escape($objecttype)."' AND objectid = ".((int) $objectid);
|
||||
if ($conf->entity != 0) {
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
|
@ -313,7 +313,7 @@ class Link extends CommonObject
|
|||
$rowid = $this->id;
|
||||
}
|
||||
|
||||
$sql = "SELECT rowid, entity, datea, url, label, objecttype, objectid FROM ".MAIN_DB_PREFIX."links";
|
||||
$sql = "SELECT rowid, entity, datea, url, label, objecttype, objectid FROM ".$this->db->prefix()."links";
|
||||
$sql .= " WHERE rowid = ".((int) $rowid);
|
||||
if ($conf->entity != 0) {
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
|
@ -364,7 +364,7 @@ class Link extends CommonObject
|
|||
// End call triggers
|
||||
|
||||
// Remove link
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."links";
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."links";
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ class Menubase
|
|||
// may use an already used value because its internal cursor does not increase when we do
|
||||
// an insert with a forced id.
|
||||
if (in_array($this->db->type, array('pgsql'))) {
|
||||
$sql = "SELECT MAX(rowid) as maxrowid FROM ".MAIN_DB_PREFIX."menu";
|
||||
$sql = "SELECT MAX(rowid) as maxrowid FROM ".$this->db->prefix()."menu";
|
||||
$resqlrowid = $this->db->query($sql);
|
||||
if ($resqlrowid) {
|
||||
$obj = $this->db->fetch_object($resqlrowid);
|
||||
|
|
@ -224,7 +224,7 @@ class Menubase
|
|||
$maxrowid = 1;
|
||||
}
|
||||
|
||||
$sql = "SELECT setval('".MAIN_DB_PREFIX."menu_rowid_seq', ".($maxrowid).")";
|
||||
$sql = "SELECT setval('".$this->db->prefix()."menu_rowid_seq', ".($maxrowid).")";
|
||||
//print $sql; exit;
|
||||
$resqlrowidset = $this->db->query($sql);
|
||||
if (!$resqlrowidset) {
|
||||
|
|
@ -237,7 +237,7 @@ class Menubase
|
|||
|
||||
// Check that entry does not exists yet on key menu_handler-fk_menu-position-url-entity, to avoid errors with postgresql
|
||||
$sql = "SELECT count(*)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."menu";
|
||||
$sql .= " FROM ".$this->db->prefix()."menu";
|
||||
$sql .= " WHERE menu_handler = '".$this->db->escape($this->menu_handler)."'";
|
||||
$sql .= " AND fk_menu = ".((int) $this->fk_menu);
|
||||
$sql .= " AND position = ".((int) $this->position);
|
||||
|
|
@ -250,7 +250,7 @@ class Menubase
|
|||
|
||||
if ($row[0] == 0) { // If not found
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."menu(";
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."menu(";
|
||||
$sql .= "menu_handler,";
|
||||
$sql .= "entity,";
|
||||
$sql .= "module,";
|
||||
|
|
@ -293,7 +293,7 @@ class Menubase
|
|||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."menu");
|
||||
$this->id = $this->db->last_insert_id($this->db->prefix()."menu");
|
||||
dol_syslog(get_class($this)."::create record added has rowid=".((int) $this->id), LOG_DEBUG);
|
||||
|
||||
return $this->id;
|
||||
|
|
@ -346,7 +346,7 @@ class Menubase
|
|||
// Put here code to add control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."menu SET";
|
||||
$sql = "UPDATE ".$this->db->prefix()."menu SET";
|
||||
$sql .= " menu_handler='".$this->db->escape($this->menu_handler)."',";
|
||||
$sql .= " module='".$this->db->escape($this->module)."',";
|
||||
$sql .= " type='".$this->db->escape($this->type)."',";
|
||||
|
|
@ -409,7 +409,7 @@ class Menubase
|
|||
$sql .= " t.enabled,";
|
||||
$sql .= " t.usertype as user,";
|
||||
$sql .= " t.tms";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."menu as t";
|
||||
$sql .= " FROM ".$this->db->prefix()."menu as t";
|
||||
$sql .= " WHERE t.rowid = ".((int) $id);
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
|
|
@ -460,7 +460,7 @@ class Menubase
|
|||
{
|
||||
//global $conf, $langs;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."menu";
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."menu";
|
||||
$sql .= " WHERE rowid=".((int) $this->id);
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
|
|
@ -635,7 +635,7 @@ class Menubase
|
|||
$leftmenu = $myleftmenu; // To export to dol_eval function
|
||||
|
||||
$sql = "SELECT m.rowid, m.type, m.module, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.url, m.titre, m.prefix, m.langs, m.perms, m.enabled, m.target, m.mainmenu, m.leftmenu, m.position";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."menu as m";
|
||||
$sql .= " FROM ".$this->db->prefix()."menu as m";
|
||||
$sql .= " WHERE m.entity IN (0,".$conf->entity.")";
|
||||
$sql .= " AND m.menu_handler IN ('".$this->db->escape($menu_handler)."','all')";
|
||||
if ($type_user == 0) {
|
||||
|
|
|
|||
|
|
@ -208,10 +208,10 @@ class Notify
|
|||
if (!$error) {
|
||||
if ($socid >= 0 && in_array('thirdparty', $scope)) {
|
||||
$sql = "SELECT a.code, c.email, c.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."notify_def as n,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."socpeople as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " FROM ".$this->db->prefix()."notify_def as n,";
|
||||
$sql .= " ".$this->db->prefix()."socpeople as c,";
|
||||
$sql .= " ".$this->db->prefix()."c_action_trigger as a,";
|
||||
$sql .= " ".$this->db->prefix()."societe as s";
|
||||
$sql .= " WHERE n.fk_contact = c.rowid";
|
||||
$sql .= " AND a.rowid = n.fk_action";
|
||||
$sql .= " AND n.fk_soc = s.rowid";
|
||||
|
|
@ -248,9 +248,9 @@ class Notify
|
|||
if (!$error) {
|
||||
if ($userid >= 0 && in_array('user', $scope)) {
|
||||
$sql = "SELECT a.code, c.email, c.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."notify_def as n,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."user as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."c_action_trigger as a";
|
||||
$sql .= " FROM ".$this->db->prefix()."notify_def as n,";
|
||||
$sql .= " ".$this->db->prefix()."user as c,";
|
||||
$sql .= " ".$this->db->prefix()."c_action_trigger as a";
|
||||
$sql .= " WHERE n.fk_user = c.rowid";
|
||||
$sql .= " AND a.rowid = n.fk_action";
|
||||
$sql .= $sqlnotifcode;
|
||||
|
|
@ -395,10 +395,10 @@ class Notify
|
|||
if (!empty($object->socid) && $object->socid > 0) {
|
||||
$sql .= "SELECT 'tocontactid' as type_target, c.email, c.rowid as cid, c.lastname, c.firstname, c.default_lang,";
|
||||
$sql .= " a.rowid as adid, a.label, a.code, n.rowid, n.type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."notify_def as n,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " FROM ".$this->db->prefix()."socpeople as c,";
|
||||
$sql .= " ".$this->db->prefix()."c_action_trigger as a,";
|
||||
$sql .= " ".$this->db->prefix()."notify_def as n,";
|
||||
$sql .= " ".$this->db->prefix()."societe as s";
|
||||
$sql .= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action";
|
||||
$sql .= " AND n.fk_soc = s.rowid";
|
||||
$sql .= " AND c.statut = 1";
|
||||
|
|
@ -415,9 +415,9 @@ class Notify
|
|||
// Check notification per user
|
||||
$sql .= "SELECT 'touserid' as type_target, c.email, c.rowid as cid, c.lastname, c.firstname, c.lang as default_lang,";
|
||||
$sql .= " a.rowid as adid, a.label, a.code, n.rowid, n.type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."notify_def as n";
|
||||
$sql .= " FROM ".$this->db->prefix()."user as c,";
|
||||
$sql .= " ".$this->db->prefix()."c_action_trigger as a,";
|
||||
$sql .= " ".$this->db->prefix()."notify_def as n";
|
||||
$sql .= " WHERE n.fk_user = c.rowid AND a.rowid = n.fk_action";
|
||||
$sql .= " AND c.statut = 1";
|
||||
if (is_numeric($notifcode)) {
|
||||
|
|
@ -644,10 +644,10 @@ class Notify
|
|||
|
||||
if ($mailfile->sendfile()) {
|
||||
if ($obj->type_target == 'touserid') {
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_user, type, objet_type, type_target, objet_id, email)";
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."notify (daten, fk_action, fk_soc, fk_user, type, objet_type, type_target, objet_id, email)";
|
||||
$sql .= " VALUES ('".$this->db->idate(dol_now())."', ".((int) $notifcodedefid).", ".($object->socid > 0 ? ((int) $object->socid) : 'null').", ".((int) $obj->cid).", '".$this->db->escape($obj->type)."', '".$this->db->escape($object_type)."', '".$this->db->escape($obj->type_target)."', ".((int) $object->id).", '".$this->db->escape($obj->email)."')";
|
||||
} else {
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, type_target, objet_id, email)";
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, type_target, objet_id, email)";
|
||||
$sql .= " VALUES ('".$this->db->idate(dol_now())."', ".((int) $notifcodedefid).", ".($object->socid > 0 ? ((int) $object->socid) : 'null').", ".((int) $obj->cid).", '".$this->db->escape($obj->type)."', '".$this->db->escape($object_type)."', '".$this->db->escape($obj->type_target)."', ".((int) $object->id).", '".$this->db->escape($obj->email)."')";
|
||||
}
|
||||
if (!$this->db->query($sql)) {
|
||||
|
|
@ -879,7 +879,7 @@ class Notify
|
|||
);
|
||||
|
||||
if ($mailfile->sendfile()) {
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, type_target, objet_type, objet_id, email)";
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."notify (daten, fk_action, fk_soc, fk_contact, type, type_target, objet_type, objet_id, email)";
|
||||
$sql .= " VALUES ('".$this->db->idate(dol_now())."', ".((int) $notifcodedefid).", ".($object->socid > 0 ? ((int) $object->socid) : 'null').", null, 'email', 'tofixedemail', '".$this->db->escape($object_type)."', ".((int) $object->id).", '".$this->db->escape($conf->global->$param)."')";
|
||||
if (!$this->db->query($sql)) {
|
||||
dol_print_error($this->db);
|
||||
|
|
|
|||
|
|
@ -480,7 +480,7 @@ class Translate
|
|||
|
||||
if (!$found && !empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) {
|
||||
// Overwrite translation with database read
|
||||
$sql = "SELECT transkey, transvalue FROM ".MAIN_DB_PREFIX."overwrite_trans where lang='".$db->escape($this->defaultlang)."' OR lang IS NULL";
|
||||
$sql = "SELECT transkey, transvalue FROM ".$db->prefix()."overwrite_trans where lang='".$db->escape($this->defaultlang)."' OR lang IS NULL";
|
||||
$sql .= " AND entity IN (0, ".getEntity('overwrite_trans').")";
|
||||
$sql .= $db->order("lang", "DESC");
|
||||
$resql = $db->query($sql);
|
||||
|
|
@ -980,7 +980,7 @@ class Translate
|
|||
|
||||
// Not found in loaded language file nor in cache. So we will take the label into database.
|
||||
$sql = "SELECT ".$fieldlabel." as label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$tablename;
|
||||
$sql .= " FROM ".$db->prefix().$tablename;
|
||||
$sql .= " WHERE ".$fieldkey." = '".$db->escape($keyforselect ? $keyforselect : $key)."'";
|
||||
if ($filteronentity) {
|
||||
$sql .= " AND entity IN (".getEntity($tablename).')';
|
||||
|
|
@ -1067,7 +1067,7 @@ class Translate
|
|||
}
|
||||
|
||||
$sql = "SELECT code_iso, label, unicode";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_currencies";
|
||||
$sql .= " FROM ".$db->prefix()."c_currencies";
|
||||
$sql .= " WHERE active = 1";
|
||||
if (!empty($currency_code)) {
|
||||
$sql .= " AND code_iso = '".$db->escape($currency_code)."'";
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ class Validate
|
|||
* Check for all values in db
|
||||
*
|
||||
* @param array $values Boolean to validate
|
||||
* @param string $table the db table name without MAIN_DB_PREFIX
|
||||
* @param string $table the db table name without $this->db->prefix()
|
||||
* @param string $col the target col
|
||||
* @return boolean Validity is ok or not
|
||||
* @throws Exception
|
||||
|
|
@ -281,7 +281,7 @@ class Validate
|
|||
}
|
||||
|
||||
foreach ($value_arr as $val) {
|
||||
$sql = "SELECT ".$col." FROM ".MAIN_DB_PREFIX.$table." WHERE ".$col." = '".$this->db->escape($val)."'"; // nore quick than count(*) to check existing of a row
|
||||
$sql = "SELECT ".$col." FROM ".$this->db->prefix().$table." WHERE ".$col." = '".$this->db->escape($val)."'"; // nore quick than count(*) to check existing of a row
|
||||
$resql = $this->db->getRow($sql);
|
||||
if ($resql) {
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -210,6 +210,8 @@ class DoliDBMysqli extends DoliDB
|
|||
{
|
||||
dol_syslog(get_class($this)."::connect host=$host, port=$port, login=$login, passwd=--hidden--, name=$name", LOG_DEBUG);
|
||||
|
||||
//mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
|
||||
// Can also be
|
||||
// mysqli::init(); mysql::options(MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0'); mysqli::options(MYSQLI_OPT_CONNECT_TIMEOUT, 5);
|
||||
// return mysqli::real_connect($host, $user, $pass, $db, $port);
|
||||
|
|
@ -255,6 +257,8 @@ class DoliDBMysqli extends DoliDB
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Execute a SQL request and return the resultset
|
||||
*
|
||||
|
|
@ -288,11 +292,16 @@ class DoliDBMysqli extends DoliDB
|
|||
}
|
||||
}
|
||||
|
||||
if (!$this->database_name) {
|
||||
// Ordre SQL ne necessitant pas de connexion a une base (exemple: CREATE DATABASE)
|
||||
$ret = $this->db->query($query, $result_mode);
|
||||
} else {
|
||||
$ret = $this->db->query($query, $result_mode);
|
||||
try {
|
||||
if (!$this->database_name) {
|
||||
// Ordre SQL ne necessitant pas de connexion a une base (exemple: CREATE DATABASE)
|
||||
$ret = $this->db->query($query, $result_mode);
|
||||
} else {
|
||||
$ret = $this->db->query($query, $result_mode);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
dol_syslog(get_class($this)."::query Exception in query instead of returning an error: ".$e->getMessage(), LOG_ERR);
|
||||
$ret = false;
|
||||
}
|
||||
|
||||
if (!preg_match("/^COMMIT/i", $query) && !preg_match("/^ROLLBACK/i", $query)) {
|
||||
|
|
|
|||
|
|
@ -201,8 +201,7 @@ function societe_prepare_head(Societe $object)
|
|||
$foundonexternalonlinesystem = 0;
|
||||
$langs->load("banks");
|
||||
|
||||
//$title = $langs->trans("BankAccounts");
|
||||
$title = $langs->trans("PaymentInformation");
|
||||
$title = $langs->trans("PaymentModes");
|
||||
|
||||
if (!empty($conf->stripe->enabled)) {
|
||||
//$langs->load("stripe");
|
||||
|
|
@ -1710,7 +1709,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
|||
$out .= '<td class="liste_titre"></td>';
|
||||
$out .= '<td class="liste_titre"></td>';
|
||||
$out .= '<td class="liste_titre">';
|
||||
$out .= $formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1, 0, (empty($conf->global->AGENDA_USE_MULTISELECT_TYPE) ? 0 : 1), 1);
|
||||
$out .= $formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1, 0, (empty($conf->global->AGENDA_USE_MULTISELECT_TYPE) ? 0 : 1), 1, 'minwidth200');
|
||||
$out .= '</td>';
|
||||
$out .= '<td class="liste_titre maxwidth100onsmartphone"><input type="text" class="maxwidth100onsmartphone" name="search_agenda_label" value="'.$filters['search_agenda_label'].'"></td>';
|
||||
$out .= '<td class="liste_titre center">';
|
||||
|
|
@ -1741,14 +1740,14 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
|||
}
|
||||
$out .= getTitleFieldOfList($tmp);
|
||||
}
|
||||
$out .= getTitleFieldOfList($langs->trans("Ref"), 0, $_SERVER["PHP_SELF"], 'a.id', '', $param, '', $sortfield, $sortorder);
|
||||
$out .= getTitleFieldOfList($langs->trans("Owner"));
|
||||
$out .= getTitleFieldOfList($langs->trans("Type"));
|
||||
$out .= getTitleFieldOfList($langs->trans("Label"), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
$out .= getTitleFieldOfList($langs->trans("Date"), 0, $_SERVER["PHP_SELF"], 'a.datep,a.id', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
$out .= getTitleFieldOfList($langs->trans("RelatedObjects"), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
$out .= getTitleFieldOfList($langs->trans("ActionOnContact"), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
$out .= getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], 'a.percent', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
$out .= getTitleFieldOfList("Ref", 0, $_SERVER["PHP_SELF"], 'a.id', '', $param, '', $sortfield, $sortorder);
|
||||
$out .= getTitleFieldOfList("Owner");
|
||||
$out .= getTitleFieldOfList("Type");
|
||||
$out .= getTitleFieldOfList("Label", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
$out .= getTitleFieldOfList("Date", 0, $_SERVER["PHP_SELF"], 'a.datep,a.id', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
$out .= getTitleFieldOfList("RelatedObjects", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
$out .= getTitleFieldOfList("ActionOnContact", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'tdoverflowmax125 ', 0, '', 0);
|
||||
$out .= getTitleFieldOfList("Status", 0, $_SERVER["PHP_SELF"], 'a.percent', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
$out .= getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
$out .= '</tr>';
|
||||
|
||||
|
|
@ -1782,7 +1781,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
|||
$out .= '</td>';
|
||||
|
||||
// Author of event
|
||||
$out .= '<td class="tdoverflowmax200">';
|
||||
$out .= '<td class="tdoverflowmax150">';
|
||||
//$userstatic->id=$histo[$key]['userid'];
|
||||
//$userstatic->login=$histo[$key]['login'];
|
||||
//$out.=$userstatic->getLoginUrl(1);
|
||||
|
|
@ -1813,25 +1812,27 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
|||
$labeltype .= ' - '.$arraylist[$actionstatic->code]; // Use code in priority on type_code
|
||||
}
|
||||
}
|
||||
$out .= '<td class="tdoverflowmax200" title="'.$labeltype.'">';
|
||||
$out .= '<td class="tdoverflowmax150" title="'.$labeltype.'">';
|
||||
$out .= $actionstatic->getTypePicto();
|
||||
$out .= $labeltype;
|
||||
$out .= '</td>';
|
||||
|
||||
// Title
|
||||
$out .= '<td>';
|
||||
// Title/Label of event
|
||||
$out .= '<td class="tdoverflowmax300"';
|
||||
if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'action') {
|
||||
$transcode = $langs->trans("Action".$histo[$key]['acode']);
|
||||
$libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : $histo[$key]['alabel']);
|
||||
//$actionstatic->libelle=$libelle;
|
||||
$libelle = $histo[$key]['note'];
|
||||
$actionstatic->id = $histo[$key]['id'];
|
||||
$out .= ' title="'.dol_escape_htmltag($libelle).'">';
|
||||
$out .= dol_trunc($libelle, 120);
|
||||
}
|
||||
if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'mailing') {
|
||||
$out .= '<a href="'.DOL_URL_ROOT.'/comm/mailing/card.php?id='.$histo[$key]['id'].'">'.img_object($langs->trans("ShowEMailing"), "email").' ';
|
||||
$transcode = $langs->trans("Action".$histo[$key]['acode']);
|
||||
$libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : 'Send mass mailing');
|
||||
$out .= ' title="'.dol_escape_htmltag($libelle).'">';
|
||||
$out .= dol_trunc($libelle, 120);
|
||||
}
|
||||
$out .= '</td>';
|
||||
|
|
@ -1888,13 +1889,8 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
|||
$out .= '</td>';
|
||||
|
||||
// Contact(s) for action
|
||||
if (empty($objcon->id) && isset($histo[$key]['contact_id']) && $histo[$key]['contact_id'] > 0) {
|
||||
$contactstatic->lastname = $histo[$key]['lastname'];
|
||||
$contactstatic->firstname = $histo[$key]['firstname'];
|
||||
$contactstatic->id = $histo[$key]['contact_id'];
|
||||
$out .= '<td width="120">'.$contactstatic->getNomUrl(1, '', 10).'</td>';
|
||||
} elseif (isset($histo[$key]['socpeopleassigned']) && is_array($histo[$key]['socpeopleassigned']) && count($histo[$key]['socpeopleassigned']) > 0) {
|
||||
$out .= '<td>';
|
||||
if (isset($histo[$key]['socpeopleassigned']) && is_array($histo[$key]['socpeopleassigned']) && count($histo[$key]['socpeopleassigned']) > 0) {
|
||||
$out .= '<td class="valignmiddle">';
|
||||
$contact = new Contact($db);
|
||||
foreach ($histo[$key]['socpeopleassigned'] as $cid => $value) {
|
||||
$result = $contact->fetch($cid);
|
||||
|
|
@ -1904,7 +1900,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
|||
}
|
||||
|
||||
if ($result > 0) {
|
||||
$out .= $contact->getNomUrl(1, '', 16);
|
||||
$out .= $contact->getNomUrl(-3, '', 10, '', -1, 0, 'paddingright');
|
||||
if (isset($histo[$key]['acode']) && $histo[$key]['acode'] == 'AC_TEL') {
|
||||
if (!empty($contact->phone_pro)) {
|
||||
$out .= '('.dol_print_phone($contact->phone_pro).')';
|
||||
|
|
@ -1914,6 +1910,12 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
|||
}
|
||||
}
|
||||
$out .= '</td>';
|
||||
} elseif (empty($objcon->id) && isset($histo[$key]['contact_id']) && $histo[$key]['contact_id'] > 0) {
|
||||
$contactstatic->lastname = $histo[$key]['lastname'];
|
||||
$contactstatic->firstname = $histo[$key]['firstname'];
|
||||
$contactstatic->id = $histo[$key]['contact_id'];
|
||||
$contactstatic->photo = $histo[$key]['contact_photo'];
|
||||
$out .= '<td width="120">'.$contactstatic->getNomUrl(-1, '', 10).'</td>';
|
||||
} else {
|
||||
$out .= '<td> </td>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1232,8 +1232,8 @@ function dol_string_unaccent($str)
|
|||
*
|
||||
* @param string $str String to clean
|
||||
* @param string $newstr String to replace forbidden chars with
|
||||
* @param array|string $badcharstoreplace List of forbidden characters to replace
|
||||
* @param array|string $badcharstoremove List of forbidden characters to remove
|
||||
* @param array|string $badcharstoreplace Array of forbidden characters to replace. Use '' to keep default list.
|
||||
* @param array|string $badcharstoremove Array of forbidden characters to remove. Use '' to keep default list.
|
||||
* @return string Cleaned string
|
||||
*
|
||||
* @see dol_sanitizeFilename(), dol_string_unaccent(), dol_string_nounprintableascii()
|
||||
|
|
@ -2890,15 +2890,15 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
|
|||
// Use dictionary definition for picto $dictsocialnetworks[$type]['icon']
|
||||
$htmllink .= '<span class="fa paddingright '.($dictsocialnetworks[$type]['icon'] ? $dictsocialnetworks[$type]['icon'] : 'fa-link').'"></span>';
|
||||
if ($type == 'skype') {
|
||||
$htmllink .= $value;
|
||||
$htmllink .= dol_escape_htmltag($value);
|
||||
$htmllink .= ' ';
|
||||
$htmllink .= '<a href="skype:';
|
||||
$htmllink .= $value;
|
||||
$htmllink .= '?call" alt="'.$langs->trans("Call").' '.$value.'" title="'.$langs->trans("Call").' '.$value.'">';
|
||||
$htmllink .= dol_string_nospecial($value, '_', '', array('@'));
|
||||
$htmllink .= '?call" alt="'.$langs->trans("Call").' '.$value.'" title="'.dol_escape_htmltag($langs->trans("Call").' '.$value).'">';
|
||||
$htmllink .= '<img src="'.DOL_URL_ROOT.'/theme/common/skype_callbutton.png" border="0">';
|
||||
$htmllink .= '</a><a href="skype:';
|
||||
$htmllink .= $value;
|
||||
$htmllink .= '?chat" alt="'.$langs->trans("Chat").' '.$value.'" title="'.$langs->trans("Chat").' '.$value.'">';
|
||||
$htmllink .= dol_string_nospecial($value, '_', '', array('@'));
|
||||
$htmllink .= '?chat" alt="'.$langs->trans("Chat").' '.$value.'" title="'.dol_escape_htmltag($langs->trans("Chat").' '.$value).'">';
|
||||
$htmllink .= '<img class="paddingleft" src="'.DOL_URL_ROOT.'/theme/common/skype_chatbutton.png" border="0">';
|
||||
$htmllink .= '</a>';
|
||||
if (($cid || $socid) && !empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) {
|
||||
|
|
@ -2912,9 +2912,9 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
|
|||
} else {
|
||||
if (!empty($dictsocialnetworks[$type]['url'])) {
|
||||
$link = str_replace('{socialid}', $value, $dictsocialnetworks[$type]['url']);
|
||||
$htmllink .= ' <a href="'.$link.'" target="_blank" rel="noopener noreferrer">'.$value.'</a>';
|
||||
$htmllink .= ' <a href="'.$link.'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
|
||||
} else {
|
||||
$htmllink .= $value;
|
||||
$htmllink .= dol_escape_htmltag($value);
|
||||
}
|
||||
}
|
||||
$htmllink .= '</div>';
|
||||
|
|
@ -2925,6 +2925,38 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
|
|||
return $htmllink;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format profIDs according to country
|
||||
*
|
||||
* @param string $profID Value of profID to format
|
||||
* @param string $profIDtype Type of profID to format ('1', '2', '3', '4', '5', '6' or 'VAT')
|
||||
* @param string $countrycode Country code to use for formatting
|
||||
* @param int $addcpButton Add button to copy to clipboard (1 => show only on hoover ; 2 => always display )
|
||||
* @param string $separ Separation between numbers for a better visibility example : xxx xxx xxx xxxxx
|
||||
* @return string Formated profID
|
||||
*/
|
||||
function dol_print_profids($profID, $profIDtype, $countrycode = '', $addcpButton = 1, $separ = ' ')
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
if (empty($profID) || empty($profIDtype)) {
|
||||
return '';
|
||||
}
|
||||
if (empty($countrycode)) $countrycode = $mysoc->country_code;
|
||||
$newProfID = $profID;
|
||||
$id = substr($profIDtype, -1);
|
||||
$ret = '';
|
||||
if (strtoupper($countrycode) == 'FR') {
|
||||
// France
|
||||
if ($id == 1 && dol_strlen($newProfID) == 9) $newProfID = substr($newProfID, 0, 3).$separ.substr($newProfID, 3, 3).$separ.substr($newProfID, 6, 3);
|
||||
if ($id == 2 && dol_strlen($newProfID) == 14) $newProfID = substr($newProfID, 0, 3).$separ.substr($newProfID, 3, 3).$separ.substr($newProfID, 6, 3).$separ.substr($newProfID, 9, 5);
|
||||
if ($profIDtype === 'VAT' && dol_strlen($newProfID) == 13) $newProfID = substr($newProfID, 0, 4).$separ.substr($newProfID, 4, 3).$separ.substr($newProfID, 7, 3).$separ.substr($newProfID, 10, 3);
|
||||
}
|
||||
if (!empty($addcpButton)) $ret = showValueWithClipboardCPButton(dol_escape_htmltag($profID), ($addcpButton == 1 ? 1 : 0), $newProfID);
|
||||
else $ret = $newProfID;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format phone numbers according to country
|
||||
*
|
||||
|
|
@ -4819,6 +4851,7 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin
|
|||
if ($field1 && ($sortfield1 == $field1 || $sortfield1 == preg_replace("/^[^\.]+\./", "", $field1))) {
|
||||
$liste_titre = 'liste_titre_sel';
|
||||
}
|
||||
|
||||
$out .= '<'.$tag.' class="'.$prefix.$liste_titre.'" '.$moreattrib;
|
||||
//$out .= (($field && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) && preg_match('/^[a-zA-Z_0-9\s\.\-:&;]*$/', $name)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : '');
|
||||
$out .= ($name && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) && empty($forcenowrapcolumntitle) && !dol_textishtml($name)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : '';
|
||||
|
|
@ -4853,7 +4886,6 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin
|
|||
//$out .= (empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : '');
|
||||
$out .= '>';
|
||||
}
|
||||
|
||||
if ($tooltip) {
|
||||
// You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click.
|
||||
$tmptooltip = explode(':', $tooltip);
|
||||
|
|
@ -7075,6 +7107,19 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
|||
/*$substitutionarray['__MEMBER_NOTE_PUBLIC__'] = '__MEMBER_NOTE_PUBLIC__';
|
||||
$substitutionarray['__MEMBER_NOTE_PRIVATE__'] = '__MEMBER_NOTE_PRIVATE__';*/
|
||||
}
|
||||
// add variables subtitutions ticket
|
||||
if (!empty($conf->ticket->enabled) && (!is_object($object) || $object->element == 'ticket')) {
|
||||
$substitutionarray['__TICKET_TRACKID__'] = '__TICKET_TRACKID__';
|
||||
$substitutionarray['__TICKET_SUBJECT__'] = '__TICKET_SUBJECT__';
|
||||
$substitutionarray['__TICKET_TYPE__'] = '__TICKET_TYPE__';
|
||||
$substitutionarray['__TICKET_SEVERITY__'] = '__TICKET_SEVERITY__';
|
||||
$substitutionarray['__TICKET_CATEGORY__'] = '__TICKET_CATEGORY__';
|
||||
$substitutionarray['__TICKET_ANALYTIC_CODE__'] = '__TICKET_ANALYTIC_CODE__';
|
||||
$substitutionarray['__TICKET_MESSAGE__'] = '__TICKET_MESSAGE__';
|
||||
$substitutionarray['__TICKET_PROGRESSION__'] = '__TICKET_PROGRESSION__';
|
||||
$substitutionarray['__TICKET_USER_ASSIGN__'] = '__TICKET_USER_ASSIGN__';
|
||||
}
|
||||
|
||||
if (!empty($conf->recruitment->enabled) && (!is_object($object) || $object->element == 'candidature')) {
|
||||
$substitutionarray['__CANDIDATE_FULLNAME__'] = '__CANDIDATE_FULLNAME__';
|
||||
$substitutionarray['__CANDIDATE_FIRSTNAME__'] = '__CANDIDATE_FIRSTNAME__';
|
||||
|
|
@ -7264,6 +7309,28 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
|||
$substitutionarray['__CONTRACT_LOWEST_EXPIRATION_DATE__'] = dol_print_date($datenextexpiration, 'dayrfc');
|
||||
$substitutionarray['__CONTRACT_LOWEST_EXPIRATION_DATETIME__'] = dol_print_date($datenextexpiration, 'standard');
|
||||
}
|
||||
// add substition variable for ticket
|
||||
if (is_object($object) && $object->element == 'ticket') {
|
||||
$substitutionarray['__TICKET_TRACKID__'] = $object->track_id;
|
||||
$substitutionarray['__REF__'] = $object->ref;
|
||||
$substitutionarray['__TICKET_SUBJECT__'] = $object->subject;
|
||||
$substitutionarray['__TICKET_TYPE__'] = $object->type_code;
|
||||
$substitutionarray['__TICKET_SEVERITY__'] = $object->severity_code;
|
||||
$substitutionarray['__TICKET_CATEGORY__'] = $object->category_code; // For backward compatibility
|
||||
$substitutionarray['__TICKET_ANALYTIC_CODE__'] = $object->category_code;
|
||||
$substitutionarray['__TICKET_MESSAGE__'] = $object->message;
|
||||
$substitutionarray['__TICKET_PROGRESSION__'] = $object->progress;
|
||||
$userstat = new User($db);
|
||||
if ($object->fk_user_assign > 0) {
|
||||
$userstat->fetch($object->fk_user_assign);
|
||||
$substitutionarray['__TICKET_USER_ASSIGN__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname);
|
||||
}
|
||||
|
||||
if ($object->fk_user_create > 0) {
|
||||
$userstat->fetch($object->fk_user_create);
|
||||
$substitutionarray['__USER_CREATE__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname);
|
||||
}
|
||||
}
|
||||
|
||||
// Create dynamic tags for __EXTRAFIELD_FIELD__
|
||||
if ($object->table_element && $object->id > 0) {
|
||||
|
|
@ -9081,12 +9148,15 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
|
|||
if (preg_match('/\.(id|rowid)$/', $field)) { // Special case for rowid that is sometimes a ref so used as a search field
|
||||
$newres .= $field." = ".(is_numeric(trim($tmpcrit)) ? ((float) trim($tmpcrit)) : '0');
|
||||
} else {
|
||||
$newres .= $field." LIKE '";
|
||||
|
||||
$tmpcrit = trim($tmpcrit);
|
||||
$tmpcrit2 = $tmpcrit;
|
||||
$tmpbefore = '%';
|
||||
$tmpafter = '%';
|
||||
if (preg_match('/^!/', $tmpcrit)) {
|
||||
$newres .= $field." NOT LIKE '"; // ! as exclude character
|
||||
$tmpcrit2 = preg_replace('/^!/', '', $tmpcrit2);
|
||||
} else $newres .= $field." LIKE '";
|
||||
|
||||
if (preg_match('/^[\^\$]/', $tmpcrit)) {
|
||||
$tmpbefore = '';
|
||||
$tmpcrit2 = preg_replace('/^[\^\$]/', '', $tmpcrit2);
|
||||
|
|
|
|||
|
|
@ -1368,6 +1368,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
|
|||
$numFinal = $ref;
|
||||
} elseif ($mode == 'next') {
|
||||
$counter++;
|
||||
$maskrefclient_counter = 0;
|
||||
|
||||
// If value for $counter has a length higher than $maskcounter chars
|
||||
if ($counter >= pow(10, dol_strlen($maskcounter))) {
|
||||
|
|
@ -1398,7 +1399,6 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
|
|||
$maskrefclient_maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'), $maskrefclient_clientcode.str_pad("", dol_strlen($maskrefclient_maskcounter), "_"), $maskrefclient_maskLike);
|
||||
|
||||
// Get counter in database
|
||||
$maskrefclient_counter = 0;
|
||||
$maskrefclient_sql = "SELECT MAX(".$maskrefclient_sqlstring.") as val";
|
||||
$maskrefclient_sql .= " FROM ".MAIN_DB_PREFIX.$table;
|
||||
//$sql.= " WHERE ".$field." not like '(%'";
|
||||
|
|
|
|||
|
|
@ -1196,11 +1196,6 @@ function getCustomerInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0)
|
|||
print '<td class="nobordernopadding nowrap">';
|
||||
print $tmpinvoice->getNomUrl(1, '');
|
||||
print '</td>';
|
||||
print '<td width="20" class="nobordernopadding nowrap">';
|
||||
if ($tmpinvoice->hasDelay()) {
|
||||
print img_warning($langs->trans("Late"));
|
||||
}
|
||||
print '</td>';
|
||||
print '<td width="16" class="nobordernopadding hideonsmartphone right">';
|
||||
$filename = dol_sanitizeFileName($obj->ref);
|
||||
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($obj->ref);
|
||||
|
|
@ -1212,7 +1207,12 @@ function getCustomerInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0)
|
|||
print '<td class="nowrap tdoverflowmax100">';
|
||||
print $societestatic->getNomUrl(1, 'customer');
|
||||
print '</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->datelimite), 'day').'</td>';
|
||||
print '<td class="right">';
|
||||
print dol_print_date($db->jdate($obj->datelimite), 'day');
|
||||
if ($tmpinvoice->hasDelay()) {
|
||||
print img_warning($langs->trans("Late"));
|
||||
}
|
||||
print '</td>';
|
||||
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
|
||||
print '<td class="right"><span class="amount">'.price($obj->total_ht).'</span></td>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -717,6 +717,7 @@ function pdf_pagehead(&$pdf, $outputlangs, $page_height)
|
|||
if (file_exists($filepath)) {
|
||||
$pdf->SetAutoPageBreak(0, 0); // Disable auto pagebreak before adding image
|
||||
$pdf->Image($filepath, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_X : 0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y : 0), 0, $page_height);
|
||||
$pdf->SetPageMark(); // This option avoid to have the images missing on some pages
|
||||
$pdf->SetAutoPageBreak(1, 0); // Restore pagebreak
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -382,7 +382,7 @@ function show_stats_for_company($product, $socid)
|
|||
}
|
||||
$langs->load("propal");
|
||||
print '<tr><td>';
|
||||
print '<a href="propal.php?id='.$product->id.'">'.img_object('', 'propal', 'class="paddingright"').$langs->trans("Proposals").'</a>';
|
||||
print '<a href="propal.php?id='.$product->id.'">'.img_object('', 'propal', 'class="pictofixedwidth"').$langs->trans("Proposals").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_propale['customers'];
|
||||
print '</td><td class="right">';
|
||||
|
|
@ -401,7 +401,7 @@ function show_stats_for_company($product, $socid)
|
|||
}
|
||||
$langs->load("supplier_proposal");
|
||||
print '<tr><td>';
|
||||
print '<a href="supplier_proposal.php?id='.$product->id.'">'.img_object('', 'supplier_proposal', 'class="paddingright"').$langs->trans("SupplierProposals").'</a>';
|
||||
print '<a href="supplier_proposal.php?id='.$product->id.'">'.img_object('', 'supplier_proposal', 'class="pictofixedwidth"').$langs->trans("SupplierProposals").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_proposal_supplier['suppliers'];
|
||||
print '</td><td class="right">';
|
||||
|
|
@ -420,7 +420,7 @@ function show_stats_for_company($product, $socid)
|
|||
}
|
||||
$langs->load("orders");
|
||||
print '<tr><td>';
|
||||
print '<a href="commande.php?id='.$product->id.'">'.img_object('', 'order', 'class="paddingright"').$langs->trans("CustomersOrders").'</a>';
|
||||
print '<a href="commande.php?id='.$product->id.'">'.img_object('', 'order', 'class="pictofixedwidth"').$langs->trans("CustomersOrders").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_commande['customers'];
|
||||
print '</td><td class="right">';
|
||||
|
|
@ -439,7 +439,7 @@ function show_stats_for_company($product, $socid)
|
|||
}
|
||||
$langs->load("orders");
|
||||
print '<tr><td>';
|
||||
print '<a href="commande_fournisseur.php?id='.$product->id.'">'.img_object('', 'supplier_order', 'class="paddingright"').$langs->trans("SuppliersOrders").'</a>';
|
||||
print '<a href="commande_fournisseur.php?id='.$product->id.'">'.img_object('', 'supplier_order', 'class="pictofixedwidth"').$langs->trans("SuppliersOrders").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_commande_fournisseur['suppliers'];
|
||||
print '</td><td class="right">';
|
||||
|
|
@ -458,7 +458,7 @@ function show_stats_for_company($product, $socid)
|
|||
}
|
||||
$langs->load("bills");
|
||||
print '<tr><td>';
|
||||
print '<a href="facture.php?id='.$product->id.'">'.img_object('', 'bill').' '.$langs->trans("CustomersInvoices").'</a>';
|
||||
print '<a href="facture.php?id='.$product->id.'">'.img_object('', 'bill', 'class="pictofixedwidth"').$langs->trans("CustomersInvoices").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_facture['customers'];
|
||||
print '</td><td class="right">';
|
||||
|
|
@ -477,7 +477,7 @@ function show_stats_for_company($product, $socid)
|
|||
}
|
||||
$langs->load("bills");
|
||||
print '<tr><td>';
|
||||
print '<a href="facture_fournisseur.php?id='.$product->id.'">'.img_object('', 'supplier_invoice', 'class="paddingright"').$langs->trans("SuppliersInvoices").'</a>';
|
||||
print '<a href="facture_fournisseur.php?id='.$product->id.'">'.img_object('', 'supplier_invoice', 'class="pictofixedwidth"').$langs->trans("SuppliersInvoices").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_facture_fournisseur['suppliers'];
|
||||
print '</td><td class="right">';
|
||||
|
|
@ -497,7 +497,7 @@ function show_stats_for_company($product, $socid)
|
|||
}
|
||||
$langs->load("contracts");
|
||||
print '<tr><td>';
|
||||
print '<a href="contrat.php?id='.$product->id.'">'.img_object('', 'contract', 'class="paddingright"').$langs->trans("Contracts").'</a>';
|
||||
print '<a href="contrat.php?id='.$product->id.'">'.img_object('', 'contract', 'class="pictofixedwidth"').$langs->trans("Contracts").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_contrat['customers'];
|
||||
print '</td><td class="right">';
|
||||
|
|
@ -518,7 +518,7 @@ function show_stats_for_company($product, $socid)
|
|||
$langs->load("mrp");
|
||||
|
||||
print '<tr><td>';
|
||||
print '<a href="bom.php?id='.$product->id.'">'.img_object('', 'bom', 'class="paddingright"').$langs->trans("BOM").'</a>';
|
||||
print '<a href="bom.php?id='.$product->id.'">'.img_object('', 'bom', 'class="pictofixedwidth"').$langs->trans("BOM").'</a>';
|
||||
print '</td><td class="right">';
|
||||
|
||||
print '</td><td class="right">';
|
||||
|
|
@ -540,7 +540,7 @@ function show_stats_for_company($product, $socid)
|
|||
}
|
||||
$langs->load("mrp");
|
||||
print '<tr><td>';
|
||||
print '<a href="mo.php?id='.$product->id.'">'.img_object('', 'mrp', 'class="paddingright"').$langs->trans("MO").'</a>';
|
||||
print '<a href="mo.php?id='.$product->id.'">'.img_object('', 'mrp', 'class="pictofixedwidth"').$langs->trans("MO").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $form->textwithpicto($product->stats_mo['customers_toconsume'], $langs->trans("ToConsume"));
|
||||
print $form->textwithpicto($product->stats_mo['customers_consumed'], $langs->trans("QtyAlreadyConsumed"));
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ if (!function_exists('dol_loginfunction')) {
|
|||
|
||||
// Note: $conf->css looks like '/theme/eldy/style.css.php'
|
||||
/*
|
||||
$conf->css = "/theme/".(GETPOST('theme','alpha')?GETPOST('theme','alpha'):$conf->theme)."/style.css.php";
|
||||
$conf->css = "/theme/".(GETPOST('theme','aZ09')?GETPOST('theme','aZ09'):$conf->theme)."/style.css.php";
|
||||
$themepath=dol_buildpath($conf->css,1);
|
||||
if (! empty($conf->modules_parts['theme'])) // Using this feature slow down application
|
||||
{
|
||||
|
|
|
|||
|
|
@ -109,6 +109,11 @@ function stock_admin_prepare_head()
|
|||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/admin/stock_mouvement_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("StockMouvementExtraFields");
|
||||
$head[$h][2] = 'stockMouvementAttributes';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'stock_admin', 'remove');
|
||||
|
||||
return $head;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2021 Open-Dsi <support@open-dsi.fr>
|
||||
* Copyright (C) 2021-2022 Open-Dsi <support@open-dsi.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -696,7 +696,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
|
|||
if (($direction == 'sell' && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice')
|
||||
|| ($direction == 'buy' && $conf->global->TAX_MODE_BUY_PRODUCT == 'invoice')) {
|
||||
// Count on delivery date (use invoice date as delivery is unknown)
|
||||
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
|
||||
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.vat_src_code as vat_src_code, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
|
||||
$sql .= " d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";
|
||||
$sql .= " d.date_start as date_start, d.date_end as date_end,";
|
||||
$sql .= " f.".$invoicefieldref." as facnum, f.type, f.total_ttc as ftotal_ttc, f.datef,";
|
||||
|
|
@ -739,7 +739,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
|
|||
$sql .= " ORDER BY d.rowid, d.".$fk_facture;
|
||||
} else {
|
||||
// Count on payments date
|
||||
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
|
||||
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.vat_src_code as vat_src_code, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
|
||||
$sql .= " d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";
|
||||
$sql .= " d.date_start as date_start, d.date_end as date_end,";
|
||||
$sql .= " f.".$invoicefieldref." as facnum, f.type, f.total_ttc as ftotal_ttc, f.datef,";
|
||||
|
|
@ -799,66 +799,71 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
|
|||
$rate = -1;
|
||||
$oldrowid = '';
|
||||
while ($assoc = $db->fetch_array($resql)) {
|
||||
$rate_key = $assoc['rate'];
|
||||
if ($f_rate == 'tva_tx' && !empty($assoc['vat_src_code']) && !preg_match('/\(/', $rate_key)) {
|
||||
$rate_key .= ' (' . $assoc['vat_src_code'] . ')';
|
||||
}
|
||||
|
||||
// Code to avoid warnings when array entry not defined
|
||||
if (!isset($list[$assoc['rate']]['totalht'])) {
|
||||
$list[$assoc['rate']]['totalht'] = 0;
|
||||
if (!isset($list[$rate_key]['totalht'])) {
|
||||
$list[$rate_key]['totalht'] = 0;
|
||||
}
|
||||
if (!isset($list[$assoc['rate']]['vat'])) {
|
||||
$list[$assoc['rate']]['vat'] = 0;
|
||||
if (!isset($list[$rate_key]['vat'])) {
|
||||
$list[$rate_key]['vat'] = 0;
|
||||
}
|
||||
if (!isset($list[$assoc['rate']]['localtax1'])) {
|
||||
$list[$assoc['rate']]['localtax1'] = 0;
|
||||
if (!isset($list[$rate_key]['localtax1'])) {
|
||||
$list[$rate_key]['localtax1'] = 0;
|
||||
}
|
||||
if (!isset($list[$assoc['rate']]['localtax2'])) {
|
||||
$list[$assoc['rate']]['localtax2'] = 0;
|
||||
if (!isset($list[$rate_key]['localtax2'])) {
|
||||
$list[$rate_key]['localtax2'] = 0;
|
||||
}
|
||||
|
||||
if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
|
||||
$oldrowid = $assoc['rowid'];
|
||||
$list[$assoc['rate']]['totalht'] += $assoc['total_ht'];
|
||||
$list[$assoc['rate']]['vat'] += $assoc['total_vat'];
|
||||
$list[$assoc['rate']]['localtax1'] += $assoc['total_localtax1'];
|
||||
$list[$assoc['rate']]['localtax2'] += $assoc['total_localtax2'];
|
||||
$list[$rate_key]['totalht'] += $assoc['total_ht'];
|
||||
$list[$rate_key]['vat'] += $assoc['total_vat'];
|
||||
$list[$rate_key]['localtax1'] += $assoc['total_localtax1'];
|
||||
$list[$rate_key]['localtax2'] += $assoc['total_localtax2'];
|
||||
}
|
||||
$list[$assoc['rate']]['dtotal_ttc'][] = $assoc['total_ttc'];
|
||||
$list[$assoc['rate']]['dtype'][] = $assoc['dtype'];
|
||||
$list[$assoc['rate']]['datef'][] = $db->jdate($assoc['datef']);
|
||||
$list[$assoc['rate']]['datep'][] = $db->jdate($assoc['datep']);
|
||||
$list[$rate_key]['dtotal_ttc'][] = $assoc['total_ttc'];
|
||||
$list[$rate_key]['dtype'][] = $assoc['dtype'];
|
||||
$list[$rate_key]['datef'][] = $db->jdate($assoc['datef']);
|
||||
$list[$rate_key]['datep'][] = $db->jdate($assoc['datep']);
|
||||
|
||||
$list[$assoc['rate']]['company_name'][] = $assoc['company_name'];
|
||||
$list[$assoc['rate']]['company_id'][] = $assoc['company_id'];
|
||||
$list[$assoc['rate']]['company_alias'][] = $assoc['company_alias'];
|
||||
$list[$assoc['rate']]['company_email'][] = $assoc['company_email'];
|
||||
$list[$assoc['rate']]['company_tva_intra'][] = $assoc['company_tva_intra'];
|
||||
$list[$assoc['rate']]['company_client'][] = $assoc['company_client'];
|
||||
$list[$assoc['rate']]['company_fournisseur'][] = $assoc['company_fournisseur'];
|
||||
$list[$assoc['rate']]['company_customer_code'][] = $assoc['company_customer_code'];
|
||||
$list[$assoc['rate']]['company_supplier_code'][] = $assoc['company_supplier_code'];
|
||||
$list[$assoc['rate']]['company_customer_accounting_code'][] = $assoc['company_customer_accounting_code'];
|
||||
$list[$assoc['rate']]['company_supplier_accounting_code'][] = $assoc['company_supplier_accounting_code'];
|
||||
$list[$assoc['rate']]['company_status'][] = $assoc['company_status'];
|
||||
$list[$rate_key]['company_name'][] = $assoc['company_name'];
|
||||
$list[$rate_key]['company_id'][] = $assoc['company_id'];
|
||||
$list[$rate_key]['company_alias'][] = $assoc['company_alias'];
|
||||
$list[$rate_key]['company_email'][] = $assoc['company_email'];
|
||||
$list[$rate_key]['company_tva_intra'][] = $assoc['company_tva_intra'];
|
||||
$list[$rate_key]['company_client'][] = $assoc['company_client'];
|
||||
$list[$rate_key]['company_fournisseur'][] = $assoc['company_fournisseur'];
|
||||
$list[$rate_key]['company_customer_code'][] = $assoc['company_customer_code'];
|
||||
$list[$rate_key]['company_supplier_code'][] = $assoc['company_supplier_code'];
|
||||
$list[$rate_key]['company_customer_accounting_code'][] = $assoc['company_customer_accounting_code'];
|
||||
$list[$rate_key]['company_supplier_accounting_code'][] = $assoc['company_supplier_accounting_code'];
|
||||
$list[$rate_key]['company_status'][] = $assoc['company_status'];
|
||||
|
||||
$list[$assoc['rate']]['ddate_start'][] = $db->jdate($assoc['date_start']);
|
||||
$list[$assoc['rate']]['ddate_end'][] = $db->jdate($assoc['date_end']);
|
||||
$list[$rate_key]['ddate_start'][] = $db->jdate($assoc['date_start']);
|
||||
$list[$rate_key]['ddate_end'][] = $db->jdate($assoc['date_end']);
|
||||
|
||||
$list[$assoc['rate']]['facid'][] = $assoc['facid'];
|
||||
$list[$assoc['rate']]['facnum'][] = $assoc['facnum'];
|
||||
$list[$assoc['rate']]['type'][] = $assoc['type'];
|
||||
$list[$assoc['rate']]['ftotal_ttc'][] = $assoc['ftotal_ttc'];
|
||||
$list[$assoc['rate']]['descr'][] = $assoc['descr'];
|
||||
$list[$rate_key]['facid'][] = $assoc['facid'];
|
||||
$list[$rate_key]['facnum'][] = $assoc['facnum'];
|
||||
$list[$rate_key]['type'][] = $assoc['type'];
|
||||
$list[$rate_key]['ftotal_ttc'][] = $assoc['ftotal_ttc'];
|
||||
$list[$rate_key]['descr'][] = $assoc['descr'];
|
||||
|
||||
$list[$assoc['rate']]['totalht_list'][] = $assoc['total_ht'];
|
||||
$list[$assoc['rate']]['vat_list'][] = $assoc['total_vat'];
|
||||
$list[$assoc['rate']]['localtax1_list'][] = $assoc['total_localtax1'];
|
||||
$list[$assoc['rate']]['localtax2_list'][] = $assoc['total_localtax2'];
|
||||
$list[$rate_key]['totalht_list'][] = $assoc['total_ht'];
|
||||
$list[$rate_key]['vat_list'][] = $assoc['total_vat'];
|
||||
$list[$rate_key]['localtax1_list'][] = $assoc['total_localtax1'];
|
||||
$list[$rate_key]['localtax2_list'][] = $assoc['total_localtax2'];
|
||||
|
||||
$list[$assoc['rate']]['pid'][] = $assoc['pid'];
|
||||
$list[$assoc['rate']]['pref'][] = $assoc['pref'];
|
||||
$list[$assoc['rate']]['ptype'][] = $assoc['ptype'];
|
||||
$list[$rate_key]['pid'][] = $assoc['pid'];
|
||||
$list[$rate_key]['pref'][] = $assoc['pref'];
|
||||
$list[$rate_key]['ptype'][] = $assoc['ptype'];
|
||||
|
||||
$list[$assoc['rate']]['payment_id'][] = $assoc['payment_id'];
|
||||
$list[$assoc['rate']]['payment_ref'][] = $assoc['payment_ref'];
|
||||
$list[$assoc['rate']]['payment_amount'][] = $assoc['payment_amount'];
|
||||
$list[$rate_key]['payment_id'][] = $assoc['payment_id'];
|
||||
$list[$rate_key]['payment_ref'][] = $assoc['payment_ref'];
|
||||
$list[$rate_key]['payment_amount'][] = $assoc['payment_amount'];
|
||||
|
||||
$rate = $assoc['rate'];
|
||||
}
|
||||
|
|
@ -876,7 +881,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
|
|||
if (($direction == 'sell' && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice')
|
||||
|| ($direction == 'buy' && $conf->global->TAX_MODE_BUY_SERVICE == 'invoice')) {
|
||||
// Count on invoice date
|
||||
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
|
||||
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.vat_src_code as vat_src_code, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
|
||||
$sql .= " d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";
|
||||
$sql .= " d.date_start as date_start, d.date_end as date_end,";
|
||||
$sql .= " f.".$invoicefieldref." as facnum, f.type, f.total_ttc as ftotal_ttc, f.datef,";
|
||||
|
|
@ -919,7 +924,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
|
|||
$sql .= " ORDER BY d.rowid, d.".$fk_facture;
|
||||
} else {
|
||||
// Count on payments date
|
||||
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
|
||||
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.vat_src_code as vat_src_code, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
|
||||
$sql .= " d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";
|
||||
$sql .= " d.date_start as date_start, d.date_end as date_end,";
|
||||
$sql .= " f.".$invoicefieldref." as facnum, f.type, f.total_ttc as ftotal_ttc, f.datef,";
|
||||
|
|
@ -979,66 +984,71 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
|
|||
$rate = -1;
|
||||
$oldrowid = '';
|
||||
while ($assoc = $db->fetch_array($resql)) {
|
||||
$rate_key = $assoc['rate'];
|
||||
if ($f_rate == 'tva_tx' && !empty($assoc['vat_src_code']) && !preg_match('/\(/', $rate_key)) {
|
||||
$rate_key .= ' (' . $assoc['vat_src_code'] . ')';
|
||||
}
|
||||
|
||||
// Code to avoid warnings when array entry not defined
|
||||
if (!isset($list[$assoc['rate']]['totalht'])) {
|
||||
$list[$assoc['rate']]['totalht'] = 0;
|
||||
if (!isset($list[$rate_key]['totalht'])) {
|
||||
$list[$rate_key]['totalht'] = 0;
|
||||
}
|
||||
if (!isset($list[$assoc['rate']]['vat'])) {
|
||||
$list[$assoc['rate']]['vat'] = 0;
|
||||
if (!isset($list[$rate_key]['vat'])) {
|
||||
$list[$rate_key]['vat'] = 0;
|
||||
}
|
||||
if (!isset($list[$assoc['rate']]['localtax1'])) {
|
||||
$list[$assoc['rate']]['localtax1'] = 0;
|
||||
if (!isset($list[$rate_key]['localtax1'])) {
|
||||
$list[$rate_key]['localtax1'] = 0;
|
||||
}
|
||||
if (!isset($list[$assoc['rate']]['localtax2'])) {
|
||||
$list[$assoc['rate']]['localtax2'] = 0;
|
||||
if (!isset($list[$rate_key]['localtax2'])) {
|
||||
$list[$rate_key]['localtax2'] = 0;
|
||||
}
|
||||
|
||||
if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
|
||||
$oldrowid = $assoc['rowid'];
|
||||
$list[$assoc['rate']]['totalht'] += $assoc['total_ht'];
|
||||
$list[$assoc['rate']]['vat'] += $assoc['total_vat'];
|
||||
$list[$assoc['rate']]['localtax1'] += $assoc['total_localtax1'];
|
||||
$list[$assoc['rate']]['localtax2'] += $assoc['total_localtax2'];
|
||||
$list[$rate_key]['totalht'] += $assoc['total_ht'];
|
||||
$list[$rate_key]['vat'] += $assoc['total_vat'];
|
||||
$list[$rate_key]['localtax1'] += $assoc['total_localtax1'];
|
||||
$list[$rate_key]['localtax2'] += $assoc['total_localtax2'];
|
||||
}
|
||||
$list[$assoc['rate']]['dtotal_ttc'][] = $assoc['total_ttc'];
|
||||
$list[$assoc['rate']]['dtype'][] = $assoc['dtype'];
|
||||
$list[$assoc['rate']]['datef'][] = $db->jdate($assoc['datef']);
|
||||
$list[$assoc['rate']]['datep'][] = $db->jdate($assoc['datep']);
|
||||
$list[$rate_key]['dtotal_ttc'][] = $assoc['total_ttc'];
|
||||
$list[$rate_key]['dtype'][] = $assoc['dtype'];
|
||||
$list[$rate_key]['datef'][] = $db->jdate($assoc['datef']);
|
||||
$list[$rate_key]['datep'][] = $db->jdate($assoc['datep']);
|
||||
|
||||
$list[$assoc['rate']]['ddate_start'][] = $db->jdate($assoc['date_start']);
|
||||
$list[$assoc['rate']]['ddate_end'][] = $db->jdate($assoc['date_end']);
|
||||
$list[$rate_key]['ddate_start'][] = $db->jdate($assoc['date_start']);
|
||||
$list[$rate_key]['ddate_end'][] = $db->jdate($assoc['date_end']);
|
||||
|
||||
$list[$assoc['rate']]['company_name'][] = $assoc['company_name'];
|
||||
$list[$assoc['rate']]['company_id'][] = $assoc['company_id'];
|
||||
$list[$assoc['rate']]['company_alias'][] = $assoc['company_alias'];
|
||||
$list[$assoc['rate']]['company_email'][] = $assoc['company_email'];
|
||||
$list[$assoc['rate']]['company_tva_intra'][] = $assoc['company_tva_intra'];
|
||||
$list[$assoc['rate']]['company_client'][] = $assoc['company_client'];
|
||||
$list[$assoc['rate']]['company_fournisseur'][] = $assoc['company_fournisseur'];
|
||||
$list[$assoc['rate']]['company_customer_code'][] = $assoc['company_customer_code'];
|
||||
$list[$assoc['rate']]['company_supplier_code'][] = $assoc['company_supplier_code'];
|
||||
$list[$assoc['rate']]['company_customer_accounting_code'][] = $assoc['company_customer_accounting_code'];
|
||||
$list[$assoc['rate']]['company_supplier_accounting_code'][] = $assoc['company_supplier_accounting_code'];
|
||||
$list[$assoc['rate']]['company_status'][] = $assoc['company_status'];
|
||||
$list[$rate_key]['company_name'][] = $assoc['company_name'];
|
||||
$list[$rate_key]['company_id'][] = $assoc['company_id'];
|
||||
$list[$rate_key]['company_alias'][] = $assoc['company_alias'];
|
||||
$list[$rate_key]['company_email'][] = $assoc['company_email'];
|
||||
$list[$rate_key]['company_tva_intra'][] = $assoc['company_tva_intra'];
|
||||
$list[$rate_key]['company_client'][] = $assoc['company_client'];
|
||||
$list[$rate_key]['company_fournisseur'][] = $assoc['company_fournisseur'];
|
||||
$list[$rate_key]['company_customer_code'][] = $assoc['company_customer_code'];
|
||||
$list[$rate_key]['company_supplier_code'][] = $assoc['company_supplier_code'];
|
||||
$list[$rate_key]['company_customer_accounting_code'][] = $assoc['company_customer_accounting_code'];
|
||||
$list[$rate_key]['company_supplier_accounting_code'][] = $assoc['company_supplier_accounting_code'];
|
||||
$list[$rate_key]['company_status'][] = $assoc['company_status'];
|
||||
|
||||
$list[$assoc['rate']]['facid'][] = $assoc['facid'];
|
||||
$list[$assoc['rate']]['facnum'][] = $assoc['facnum'];
|
||||
$list[$assoc['rate']]['type'][] = $assoc['type'];
|
||||
$list[$assoc['rate']]['ftotal_ttc'][] = $assoc['ftotal_ttc'];
|
||||
$list[$assoc['rate']]['descr'][] = $assoc['descr'];
|
||||
$list[$rate_key]['facid'][] = $assoc['facid'];
|
||||
$list[$rate_key]['facnum'][] = $assoc['facnum'];
|
||||
$list[$rate_key]['type'][] = $assoc['type'];
|
||||
$list[$rate_key]['ftotal_ttc'][] = $assoc['ftotal_ttc'];
|
||||
$list[$rate_key]['descr'][] = $assoc['descr'];
|
||||
|
||||
$list[$assoc['rate']]['totalht_list'][] = $assoc['total_ht'];
|
||||
$list[$assoc['rate']]['vat_list'][] = $assoc['total_vat'];
|
||||
$list[$assoc['rate']]['localtax1_list'][] = $assoc['total_localtax1'];
|
||||
$list[$assoc['rate']]['localtax2_list'][] = $assoc['total_localtax2'];
|
||||
$list[$rate_key]['totalht_list'][] = $assoc['total_ht'];
|
||||
$list[$rate_key]['vat_list'][] = $assoc['total_vat'];
|
||||
$list[$rate_key]['localtax1_list'][] = $assoc['total_localtax1'];
|
||||
$list[$rate_key]['localtax2_list'][] = $assoc['total_localtax2'];
|
||||
|
||||
$list[$assoc['rate']]['pid'][] = $assoc['pid'];
|
||||
$list[$assoc['rate']]['pref'][] = $assoc['pref'];
|
||||
$list[$assoc['rate']]['ptype'][] = $assoc['ptype'];
|
||||
$list[$rate_key]['pid'][] = $assoc['pid'];
|
||||
$list[$rate_key]['pref'][] = $assoc['pref'];
|
||||
$list[$rate_key]['ptype'][] = $assoc['ptype'];
|
||||
|
||||
$list[$assoc['rate']]['payment_id'][] = $assoc['payment_id'];
|
||||
$list[$assoc['rate']]['payment_ref'][] = $assoc['payment_ref'];
|
||||
$list[$assoc['rate']]['payment_amount'][] = $assoc['payment_amount'];
|
||||
$list[$rate_key]['payment_id'][] = $assoc['payment_id'];
|
||||
$list[$rate_key]['payment_ref'][] = $assoc['payment_ref'];
|
||||
$list[$rate_key]['payment_amount'][] = $assoc['payment_amount'];
|
||||
|
||||
$rate = $assoc['rate'];
|
||||
}
|
||||
|
|
@ -1056,7 +1066,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
|
|||
$sql = '';
|
||||
|
||||
// Count on payments date
|
||||
$sql = "SELECT d.rowid, d.product_type as dtype, e.rowid as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.total_tva as total_vat, e.note_private as descr,";
|
||||
$sql = "SELECT d.rowid, d.product_type as dtype, e.rowid as facid, d.$f_rate as rate, d.vat_src_code as vat_src_code, d.total_ht as total_ht, d.total_ttc as total_ttc, d.total_tva as total_vat, e.note_private as descr,";
|
||||
$sql .= " d.total_localtax1 as total_localtax1, d.total_localtax2 as total_localtax2, ";
|
||||
$sql .= " e.date_debut as date_start, e.date_fin as date_end, e.fk_user_author,";
|
||||
$sql .= " e.ref as facnum, e.total_ttc as ftotal_ttc, e.date_create, d.fk_c_type_fees as type,";
|
||||
|
|
@ -1101,55 +1111,60 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
|
|||
$rate = -1;
|
||||
$oldrowid = '';
|
||||
while ($assoc = $db->fetch_array($resql)) {
|
||||
$rate_key = $assoc['rate'];
|
||||
if ($f_rate == 'tva_tx' && !empty($assoc['vat_src_code']) && !preg_match('/\(/', $rate_key)) {
|
||||
$rate_key .= ' (' . $assoc['vat_src_code'] . ')';
|
||||
}
|
||||
|
||||
// Code to avoid warnings when array entry not defined
|
||||
if (!isset($list[$assoc['rate']]['totalht'])) {
|
||||
$list[$assoc['rate']]['totalht'] = 0;
|
||||
if (!isset($list[$rate_key]['totalht'])) {
|
||||
$list[$rate_key]['totalht'] = 0;
|
||||
}
|
||||
if (!isset($list[$assoc['rate']]['vat'])) {
|
||||
$list[$assoc['rate']]['vat'] = 0;
|
||||
if (!isset($list[$rate_key]['vat'])) {
|
||||
$list[$rate_key]['vat'] = 0;
|
||||
}
|
||||
if (!isset($list[$assoc['rate']]['localtax1'])) {
|
||||
$list[$assoc['rate']]['localtax1'] = 0;
|
||||
if (!isset($list[$rate_key]['localtax1'])) {
|
||||
$list[$rate_key]['localtax1'] = 0;
|
||||
}
|
||||
if (!isset($list[$assoc['rate']]['localtax2'])) {
|
||||
$list[$assoc['rate']]['localtax2'] = 0;
|
||||
if (!isset($list[$rate_key]['localtax2'])) {
|
||||
$list[$rate_key]['localtax2'] = 0;
|
||||
}
|
||||
|
||||
if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
|
||||
$oldrowid = $assoc['rowid'];
|
||||
$list[$assoc['rate']]['totalht'] += $assoc['total_ht'];
|
||||
$list[$assoc['rate']]['vat'] += $assoc['total_vat'];
|
||||
$list[$assoc['rate']]['localtax1'] += $assoc['total_localtax1'];
|
||||
$list[$assoc['rate']]['localtax2'] += $assoc['total_localtax2'];
|
||||
$list[$rate_key]['totalht'] += $assoc['total_ht'];
|
||||
$list[$rate_key]['vat'] += $assoc['total_vat'];
|
||||
$list[$rate_key]['localtax1'] += $assoc['total_localtax1'];
|
||||
$list[$rate_key]['localtax2'] += $assoc['total_localtax2'];
|
||||
}
|
||||
|
||||
$list[$assoc['rate']]['dtotal_ttc'][] = $assoc['total_ttc'];
|
||||
$list[$assoc['rate']]['dtype'][] = 'ExpenseReportPayment';
|
||||
$list[$assoc['rate']]['datef'][] = $assoc['datef'];
|
||||
$list[$assoc['rate']]['company_name'][] = '';
|
||||
$list[$assoc['rate']]['company_id'][] = '';
|
||||
$list[$assoc['rate']]['user_id'][] = $assoc['fk_user_author'];
|
||||
$list[$assoc['rate']]['ddate_start'][] = $db->jdate($assoc['date_start']);
|
||||
$list[$assoc['rate']]['ddate_end'][] = $db->jdate($assoc['date_end']);
|
||||
$list[$rate_key]['dtotal_ttc'][] = $assoc['total_ttc'];
|
||||
$list[$rate_key]['dtype'][] = 'ExpenseReportPayment';
|
||||
$list[$rate_key]['datef'][] = $assoc['datef'];
|
||||
$list[$rate_key]['company_name'][] = '';
|
||||
$list[$rate_key]['company_id'][] = '';
|
||||
$list[$rate_key]['user_id'][] = $assoc['fk_user_author'];
|
||||
$list[$rate_key]['ddate_start'][] = $db->jdate($assoc['date_start']);
|
||||
$list[$rate_key]['ddate_end'][] = $db->jdate($assoc['date_end']);
|
||||
|
||||
$list[$assoc['rate']]['facid'][] = $assoc['facid'];
|
||||
$list[$assoc['rate']]['facnum'][] = $assoc['facnum'];
|
||||
$list[$assoc['rate']]['type'][] = $assoc['type'];
|
||||
$list[$assoc['rate']]['ftotal_ttc'][] = $assoc['ftotal_ttc'];
|
||||
$list[$assoc['rate']]['descr'][] = $assoc['descr'];
|
||||
$list[$rate_key]['facid'][] = $assoc['facid'];
|
||||
$list[$rate_key]['facnum'][] = $assoc['facnum'];
|
||||
$list[$rate_key]['type'][] = $assoc['type'];
|
||||
$list[$rate_key]['ftotal_ttc'][] = $assoc['ftotal_ttc'];
|
||||
$list[$rate_key]['descr'][] = $assoc['descr'];
|
||||
|
||||
$list[$assoc['rate']]['totalht_list'][] = $assoc['total_ht'];
|
||||
$list[$assoc['rate']]['vat_list'][] = $assoc['total_vat'];
|
||||
$list[$assoc['rate']]['localtax1_list'][] = $assoc['total_localtax1'];
|
||||
$list[$assoc['rate']]['localtax2_list'][] = $assoc['total_localtax2'];
|
||||
$list[$rate_key]['totalht_list'][] = $assoc['total_ht'];
|
||||
$list[$rate_key]['vat_list'][] = $assoc['total_vat'];
|
||||
$list[$rate_key]['localtax1_list'][] = $assoc['total_localtax1'];
|
||||
$list[$rate_key]['localtax2_list'][] = $assoc['total_localtax2'];
|
||||
|
||||
$list[$assoc['rate']]['pid'][] = $assoc['pid'];
|
||||
$list[$assoc['rate']]['pref'][] = $assoc['pref'];
|
||||
$list[$assoc['rate']]['ptype'][] = 'ExpenseReportPayment';
|
||||
$list[$rate_key]['pid'][] = $assoc['pid'];
|
||||
$list[$rate_key]['pref'][] = $assoc['pref'];
|
||||
$list[$rate_key]['ptype'][] = 'ExpenseReportPayment';
|
||||
|
||||
$list[$assoc['rate']]['payment_id'][] = $assoc['payment_id'];
|
||||
$list[$assoc['rate']]['payment_ref'][] = $assoc['payment_ref'];
|
||||
$list[$assoc['rate']]['payment_amount'][] = $assoc['payment_amount'];
|
||||
$list[$rate_key]['payment_id'][] = $assoc['payment_id'];
|
||||
$list[$rate_key]['payment_ref'][] = $assoc['payment_ref'];
|
||||
$list[$rate_key]['payment_amount'][] = $assoc['payment_amount'];
|
||||
|
||||
$rate = $assoc['rate'];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -575,7 +575,10 @@ class pdf_einstein extends ModelePDFCommandes
|
|||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
|
||||
}
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
|
||||
// Add line
|
||||
if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
|||
$arephoto = false;
|
||||
foreach ($pdir as $midir) {
|
||||
if (!$arephoto) {
|
||||
if ($conf->product->entity != $objphoto->entity) {
|
||||
if ($conf->entity != $objphoto->entity) {
|
||||
$dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities
|
||||
} else {
|
||||
$dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product
|
||||
|
|
@ -800,7 +800,10 @@ class pdf_eratosthene extends ModelePDFCommandes
|
|||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
|
||||
}
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
|
||||
// Add line
|
||||
if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
|
||||
|
|
|
|||
|
|
@ -749,9 +749,12 @@ class pdf_crabe extends ModelePDFFactures
|
|||
if (!isset($this->tva[$vatrate])) {
|
||||
$this->tva[$vatrate] = 0;
|
||||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$this->tva[$vatrate] += $tvaligne; // ->tva is abandonned, we use now ->tva_array that is more complete
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
|
||||
}
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) {
|
||||
$nexY = $posYAfterImage;
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ class pdf_sponge extends ModelePDFFactures
|
|||
$arephoto = false;
|
||||
foreach ($pdir as $midir) {
|
||||
if (!$arephoto) {
|
||||
if ($conf->product->entity != $objphoto->entity) {
|
||||
if ($conf->entity != $objphoto->entity) {
|
||||
$dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities
|
||||
} else {
|
||||
$dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product
|
||||
|
|
@ -887,9 +887,12 @@ class pdf_sponge extends ModelePDFFactures
|
|||
if (!isset($this->tva[$vatrate])) {
|
||||
$this->tva[$vatrate] = 0;
|
||||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$this->tva[$vatrate] += $tvaligne; // ->tva is abandonned, we use now ->tva_array that is more complete
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
|
||||
}
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
|
||||
$nexY = max($nexY, $posYAfterImage);
|
||||
|
||||
|
|
|
|||
|
|
@ -138,9 +138,8 @@ class mailing_contacts1 extends MailingTargets
|
|||
$sql .= " ORDER BY sp.poste";
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
$s .= $langs->trans("PostOrFunction").' ';
|
||||
$s .= '<select name="filter_jobposition" class="flat marginrightonly" placeholder="'.dol_escape_htmltag($langs->trans("PostOrFunction")).'">';
|
||||
$s .= '<option value="all"> </option>';
|
||||
$s .= '<select id="filter_jobposition_contact" name="filter_jobposition" class="flat" placeholder="'.dol_escape_htmltag($langs->trans("PostOrFunction")).'">';
|
||||
$s .= '<option value="-1">'.$langs->trans("PostOrFunction").'</option>';
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
|
@ -157,11 +156,10 @@ class mailing_contacts1 extends MailingTargets
|
|||
dol_print_error($this->db);
|
||||
}
|
||||
$s .= '</select>';
|
||||
|
||||
$s .= ajax_combobox("filter_jobposition_contact");
|
||||
$s .= ' ';
|
||||
|
||||
// Filter on contact category
|
||||
$s .= $langs->trans("ContactCategoriesShort").' ';
|
||||
$sql = "SELECT c.label, count(distinct(sp.email)) AS nb";
|
||||
$sql .= " FROM ";
|
||||
$sql .= " ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||
|
|
@ -176,8 +174,8 @@ class mailing_contacts1 extends MailingTargets
|
|||
$sql .= " ORDER BY c.label";
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
$s .= '<select name="filter_category" class="flat marginrightonly">';
|
||||
$s .= '<option value="all"> </option>';
|
||||
$s .= '<select id="filter_category_contact" name="filter_category" class="flat">';
|
||||
$s .= '<option value="-1">'.$langs->trans("ContactCategoriesShort").'</option>';
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num) {
|
||||
|
|
@ -194,12 +192,11 @@ class mailing_contacts1 extends MailingTargets
|
|||
dol_print_error($this->db);
|
||||
}
|
||||
$s .= '</select>';
|
||||
|
||||
$s .= ajax_combobox("filter_category_contact");
|
||||
$s .= '<br>';
|
||||
|
||||
// Add prospect of a particular level
|
||||
$s .= $langs->trans("NatureOfThirdParty").' ';
|
||||
$s .= '<select name="filter" class="flat marginrightonly">';
|
||||
$s .= '<select id="filter_contact" name="filter" class="flat">';
|
||||
$sql = "SELECT code, label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
||||
$sql .= " WHERE active > 0";
|
||||
|
|
@ -208,9 +205,9 @@ class mailing_contacts1 extends MailingTargets
|
|||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num) {
|
||||
$s .= '<option value="all"> </option>';
|
||||
$s .= '<option value="-1">'.$langs->trans("NatureOfThirdParty").'</option>';
|
||||
} else {
|
||||
$s .= '<option value="all">'.$langs->trans("ContactsAllShort").'</option>';
|
||||
$s .= '<option value="-1">'.$langs->trans("ContactsAllShort").'</option>';
|
||||
}
|
||||
$s .= '<option value="prospects">'.$langs->trans("ThirdPartyProspects").'</option>';
|
||||
|
||||
|
|
@ -231,11 +228,11 @@ class mailing_contacts1 extends MailingTargets
|
|||
//$s.='<option value="customersidprof">'.$langs->trans("ThirdPartyCustomersWithIdProf12",$langs->trans("ProfId1"),$langs->trans("ProfId2")).'</option>';
|
||||
$s .= '<option value="suppliers">'.$langs->trans("ThirdPartySuppliers").'</option>';
|
||||
$s .= '</select>';
|
||||
$s .= ajax_combobox("filter_contact");
|
||||
|
||||
$s .= ' ';
|
||||
|
||||
// Filter on thirdparty category
|
||||
$s .= $langs->trans("CustomersProspectsCategoriesShort").' ';
|
||||
$sql = "SELECT c.label, count(distinct(sp.email)) AS nb";
|
||||
$sql .= " FROM ";
|
||||
$sql .= " ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||
|
|
@ -250,8 +247,8 @@ class mailing_contacts1 extends MailingTargets
|
|||
$sql .= " ORDER BY c.label";
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
$s .= '<select name="filter_category_customer" class="flat marginrightonly maxwidth200">';
|
||||
$s .= '<option value="all"> </option>';
|
||||
$s .= '<select id="filter_category_customer_contact" name="filter_category_customer" class="flat maxwidth200">';
|
||||
$s .= '<option value="-1">'.$langs->trans("CustomersProspectsCategoriesShort").'</option>';
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num) {
|
||||
|
|
@ -268,11 +265,11 @@ class mailing_contacts1 extends MailingTargets
|
|||
dol_print_error($this->db);
|
||||
}
|
||||
$s .= '</select>';
|
||||
$s .= ajax_combobox("filter_category_customer_contact");
|
||||
|
||||
$s .= ' ';
|
||||
|
||||
// Filter on thirdparty category
|
||||
$s .= $langs->trans("SuppliersCategoriesShort").' ';
|
||||
$sql = "SELECT c.label, count(distinct(sp.email)) AS nb";
|
||||
$sql .= " FROM ";
|
||||
$sql .= " ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||
|
|
@ -287,8 +284,8 @@ class mailing_contacts1 extends MailingTargets
|
|||
$sql .= " ORDER BY c.label";
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
$s .= '<select name="filter_category_supplier" class="flat marginrightonly maxwidth200">';
|
||||
$s .= '<option value="all"> </option>';
|
||||
$s .= '<select id="filter_category_supplier_contact" name="filter_category_supplier" class="flat maxwidth200">';
|
||||
$s .= '<option value="-1">'.$langs->trans("SuppliersCategoriesShort").'</option>';
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num) {
|
||||
|
|
@ -305,7 +302,7 @@ class mailing_contacts1 extends MailingTargets
|
|||
dol_print_error($this->db);
|
||||
}
|
||||
$s .= '</select>';
|
||||
|
||||
$s .= ajax_combobox("filter_category_supplier_contact");
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
|
@ -366,22 +363,16 @@ class mailing_contacts1 extends MailingTargets
|
|||
$sql .= " s.nom as companyname";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
|
||||
if ($filter_category <> 'all') {
|
||||
if ($filter_category != 'all' && $filter_category != '-1') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie as c";
|
||||
}
|
||||
if ($filter_category <> 'all') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie_contact as cs";
|
||||
}
|
||||
if ($filter_category_customer <> 'all') {
|
||||
if ($filter_category_customer != 'all' && $filter_category_customer != '-1') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie as c2";
|
||||
}
|
||||
if ($filter_category_customer <> 'all') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie_societe as c2s";
|
||||
}
|
||||
if ($filter_category_supplier <> 'all') {
|
||||
if ($filter_category_supplier != 'all' && $filter_category_supplier != '-1') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie as c3";
|
||||
}
|
||||
if ($filter_category_supplier <> 'all') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as c3s";
|
||||
}
|
||||
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
|
||||
|
|
@ -391,34 +382,28 @@ class mailing_contacts1 extends MailingTargets
|
|||
$sql .= " AND sp.statut = 1";
|
||||
$sql .= " AND sp.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
|
||||
// Filter on category
|
||||
if ($filter_category <> 'all') {
|
||||
if ($filter_category != 'all' && $filter_category != '-1') {
|
||||
$sql .= " AND cs.fk_categorie = c.rowid AND cs.fk_socpeople = sp.rowid";
|
||||
}
|
||||
if ($filter_category <> 'all') {
|
||||
$sql .= " AND c.label = '".$this->db->escape($filter_category)."'";
|
||||
}
|
||||
if ($filter_category_customer <> 'all') {
|
||||
if ($filter_category_customer != 'all' && $filter_category_customer != '-1') {
|
||||
$sql .= " AND c2s.fk_categorie = c2.rowid AND c2s.fk_soc = sp.fk_soc";
|
||||
}
|
||||
if ($filter_category_customer <> 'all') {
|
||||
$sql .= " AND c2.label = '".$this->db->escape($filter_category_customer)."'";
|
||||
}
|
||||
if ($filter_category_supplier <> 'all') {
|
||||
if ($filter_category_supplier != 'all' && $filter_category_supplier != '-1') {
|
||||
$sql .= " AND c3s.fk_categorie = c3.rowid AND c3s.fk_soc = sp.fk_soc";
|
||||
}
|
||||
if ($filter_category_supplier <> 'all') {
|
||||
$sql .= " AND c3.label = '".$this->db->escape($filter_category_supplier)."'";
|
||||
}
|
||||
// Filter on nature
|
||||
$key = $filter;
|
||||
{
|
||||
//print "xx".$key;
|
||||
|
||||
//print "xx".$key;
|
||||
if ($key == 'prospects') {
|
||||
$sql .= " AND s.client=2";
|
||||
}
|
||||
foreach ($prospectlevel as $codelevel => $valuelevel) {
|
||||
if ($key == 'prospectslevel'.$codelevel) {
|
||||
$sql .= " AND s.fk_prospectlevel='".$this->db->escape($codelevel)."'";
|
||||
$sql .= " AND s.fk_prospectlevel = '".$this->db->escape($codelevel)."'";
|
||||
}
|
||||
}
|
||||
if ($key == 'customers') {
|
||||
|
|
@ -427,17 +412,18 @@ class mailing_contacts1 extends MailingTargets
|
|||
if ($key == 'suppliers') {
|
||||
$sql .= " AND s.fournisseur=1";
|
||||
}
|
||||
}
|
||||
|
||||
// Filter on job position
|
||||
$key = $filter_jobposition;
|
||||
if (!empty($key) && $key != 'all') {
|
||||
$sql .= " AND sp.poste ='".$this->db->escape($key)."'";
|
||||
$key = $filter_jobposition;
|
||||
if (!empty($key) && $key != 'all' && $key != '-1') {
|
||||
$sql .= " AND sp.poste = '".$this->db->escape($key)."'";
|
||||
}
|
||||
$sql .= " ORDER BY sp.email";
|
||||
|
||||
$sql .= " ORDER BY sp.email";
|
||||
//print "wwwwwwx".$sql;
|
||||
|
||||
// Stocke destinataires dans cibles
|
||||
$result = $this->db->query($sql);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
|
|
|
|||
|
|
@ -123,16 +123,16 @@ class mailing_fraise extends MailingTargets
|
|||
$s = '';
|
||||
|
||||
// Status
|
||||
$s .= $langs->trans("Status").': ';
|
||||
$s .= '<select name="filter" class="flat">';
|
||||
$s .= '<option value="none"> </option>';
|
||||
$s .= '<option value="-1">'.$langs->trans("MemberStatusDraft").'</option>';
|
||||
$s .= '<select id="filter_fraise" name="filter" class="flat">';
|
||||
$s .= '<option value="-1">'.$langs->trans("Status").'</option>';
|
||||
$s .= '<option value="draft">'.$langs->trans("MemberStatusDraft").'</option>';
|
||||
$s .= '<option value="1a">'.$langs->trans("MemberStatusActiveShort").' ('.$langs->trans("MemberStatusPaidShort").')</option>';
|
||||
$s .= '<option value="1b">'.$langs->trans("MemberStatusActiveShort").' ('.$langs->trans("MemberStatusActiveLateShort").')</option>';
|
||||
$s .= '<option value="0">'.$langs->trans("MemberStatusResiliatedShort").'</option>';
|
||||
$s .= '</select> ';
|
||||
$s .= $langs->trans("Type").': ';
|
||||
$s .= '<select name="filter_type" class="flat">';
|
||||
$s .= ajax_combobox("filter_fraise");
|
||||
|
||||
$s .= '<select id="filter_type_fraise" name="filter_type" class="flat">';
|
||||
$sql = "SELECT rowid, libelle as label, statut";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
||||
$sql .= " WHERE entity IN (".getEntity('member_type').")";
|
||||
|
|
@ -141,7 +141,7 @@ class mailing_fraise extends MailingTargets
|
|||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
$s .= '<option value="0"> </option>';
|
||||
$s .= '<option value="-1">'.$langs->trans("Type").'</option>';
|
||||
if (!$num) {
|
||||
$s .= '<option value="0" disabled="disabled">'.$langs->trans("NoCategoriesDefined").'</option>';
|
||||
}
|
||||
|
|
@ -154,16 +154,17 @@ class mailing_fraise extends MailingTargets
|
|||
$s .= '</option>';
|
||||
$i++;
|
||||
}
|
||||
$s .= ajax_combobox("filter_type");
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
$s .= '</select>';
|
||||
$s .= ajax_combobox("filter_type_fraise");
|
||||
|
||||
$s .= ' ';
|
||||
|
||||
$s .= $langs->trans("Category").': ';
|
||||
$s .= '<select name="filter_category" class="flat">';
|
||||
$s .= '<select id="filter_category_fraise" name="filter_category" class="flat">';
|
||||
|
||||
// Show categories
|
||||
$sql = "SELECT rowid, label, type, visible";
|
||||
|
|
@ -178,7 +179,7 @@ class mailing_fraise extends MailingTargets
|
|||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
$s .= '<option value="0"> </option>';
|
||||
$s .= '<option value="-1">'.$langs->trans("Category").'</option>';
|
||||
if (!$num) {
|
||||
$s .= '<option value="0" disabled>'.$langs->trans("NoCategoriesDefined").'</option>';
|
||||
}
|
||||
|
|
@ -191,6 +192,7 @@ class mailing_fraise extends MailingTargets
|
|||
$s .= '</option>';
|
||||
$i++;
|
||||
}
|
||||
$s .= ajax_combobox("filter_category_fraise");
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
|
@ -246,7 +248,7 @@ class mailing_fraise extends MailingTargets
|
|||
$sql .= " a.lastname, a.firstname,";
|
||||
$sql .= " a.datefin, a.civility as civility_id, a.login, a.societe"; // Other fields
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a";
|
||||
if (GETPOST('filter_category')) {
|
||||
if (GETPOST('filter_category', 'int') > 0) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."categorie_member as cm ON cm.fk_member = a.rowid";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."categorie as c ON c.rowid = cm.fk_categorie AND c.rowid = ".((int) GETPOST('filter_category', 'int'));
|
||||
}
|
||||
|
|
@ -254,16 +256,13 @@ class mailing_fraise extends MailingTargets
|
|||
$sql .= " WHERE a.entity IN (".getEntity('member').") AND a.email <> ''"; // Note that null != '' is false
|
||||
$sql .= " AND a.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
|
||||
// Filter on status
|
||||
if (GETPOST("filter") == '-1') {
|
||||
$sql .= " AND a.statut=-1";
|
||||
}
|
||||
if (GETPOST("filter", 'aZ09') == '1a') {
|
||||
if (GETPOST("filter", 'aZ09') == 'draft') {
|
||||
$sql .= " AND a.statut = -1";
|
||||
} elseif (GETPOST("filter", 'aZ09') == '1a') {
|
||||
$sql .= " AND a.statut=1 AND (a.datefin >= '".$this->db->idate($now)."' OR ta.subscription = 0)";
|
||||
}
|
||||
if (GETPOST("filter", 'aZ09') == '1b') {
|
||||
} elseif (GETPOST("filter", 'aZ09') == '1b') {
|
||||
$sql .= " AND a.statut=1 AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND ta.subscription = 1)";
|
||||
}
|
||||
if (GETPOST("filter", 'aZ09') === '0') {
|
||||
} elseif (GETPOST("filter", 'aZ09') === '0') {
|
||||
$sql .= " AND a.statut=0";
|
||||
}
|
||||
// Filter on date
|
||||
|
|
@ -276,7 +275,7 @@ class mailing_fraise extends MailingTargets
|
|||
$sql .= " AND a.fk_adherent_type = ta.rowid";
|
||||
// Filter on type
|
||||
if (GETPOST('filter_type', 'int') > 0) {
|
||||
$sql .= " AND ta.rowid='".$this->db->escape(GETPOST('filter_type', 'int'))."'";
|
||||
$sql .= " AND ta.rowid = ".((int) GETPOST('filter_type', 'int'));
|
||||
}
|
||||
$sql .= " ORDER BY a.email";
|
||||
//print $sql;
|
||||
|
|
|
|||
264
htdocs/core/modules/mailings/partnership.modules.php
Normal file
264
htdocs/core/modules/mailings/partnership.modules.php
Normal file
|
|
@ -0,0 +1,264 @@
|
|||
<?php
|
||||
/* Copyright (C) 2018-2018 Andre Schild <a.schild@aarboard.ch>
|
||||
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
*
|
||||
* This file is an example to follow to add your own email selector inside
|
||||
* the Dolibarr email tool.
|
||||
* Follow instructions given in README file to know what to change to build
|
||||
* your own emailing list selector.
|
||||
* Code that need to be changed in this file are marked by "CHANGE THIS" tag.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/mailings/partnership.modules.php
|
||||
* \ingroup mailing
|
||||
* \brief Example file to provide a list of recipients for mailing module
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage a list of personalised recipients for mailing feature
|
||||
*/
|
||||
class mailing_partnership extends MailingTargets
|
||||
{
|
||||
public $name = 'PartnershipThirdartiesOrMembers';
|
||||
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
|
||||
public $desc = "Thirdparties or members included into a partnership program";
|
||||
public $require_admin = 0;
|
||||
|
||||
public $require_module = array(); // This module allows to select by categories must be also enabled if category module is not activated
|
||||
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
*/
|
||||
public $picto = 'partnership';
|
||||
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
public $db;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$langs->load("companies");
|
||||
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* This is the main function that returns the array of emails
|
||||
*
|
||||
* @param int $mailing_id Id of mailing. No need to use it.
|
||||
* @return int <0 if error, number of emails added if ok
|
||||
*/
|
||||
public function add_to_target($mailing_id)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
|
||||
$cibles = array();
|
||||
$addDescription = '';
|
||||
|
||||
$sql = "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, pt.label as label, 'thirdparty' as source";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."partnership as p, ".MAIN_DB_PREFIX."c_partnership_type as pt";
|
||||
$sql .= " WHERE s.email <> ''";
|
||||
$sql .= " AND s.entity IN (".getEntity('societe').")";
|
||||
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
|
||||
$sql .= " AND p.fk_soc = s.rowid";
|
||||
$sql .= " AND pt.rowid = p.fk_type";
|
||||
if (GETPOST('filter', 'int') > 0) {
|
||||
$sql .= " AND pt.rowid=".((int) GETPOST('filter', 'int'));
|
||||
}
|
||||
|
||||
$sql .= " UNION ";
|
||||
|
||||
$sql .= "SELECT s.rowid as id, s.email as email, s.lastname as name, null as fk_contact, s.firstname as firstname, pt.label as label, 'member' as source";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as s, ".MAIN_DB_PREFIX."partnership as p, ".MAIN_DB_PREFIX."c_partnership_type as pt";
|
||||
$sql .= " WHERE s.email <> ''";
|
||||
$sql .= " AND s.entity IN (".getEntity('member').")";
|
||||
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
|
||||
$sql .= " AND p.fk_member = s.rowid";
|
||||
$sql .= " AND pt.rowid = p.fk_type";
|
||||
if (GETPOST('filter', 'int') > 0) {
|
||||
$sql .= " AND pt.rowid=".((int) GETPOST('filter', 'int'));
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY email";
|
||||
|
||||
// Stock recipients emails into targets table
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
$j = 0;
|
||||
|
||||
dol_syslog(get_class($this)."::add_to_target mailing ".$num." targets found");
|
||||
|
||||
$old = '';
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
if ($old <> $obj->email) {
|
||||
$otherTxt = ($obj->label ? $langs->transnoentities("PartnershipType").'='.$obj->label : '');
|
||||
if (strlen($addDescription) > 0 && strlen($otherTxt) > 0) {
|
||||
$otherTxt .= ";";
|
||||
}
|
||||
$otherTxt .= $addDescription;
|
||||
$cibles[$j] = array(
|
||||
'email' => $obj->email,
|
||||
'fk_contact' => $obj->fk_contact,
|
||||
'lastname' => $obj->name, // For a thirdparty, we must use name
|
||||
'firstname' => '', // For a thirdparty, lastname is ''
|
||||
'other' => $otherTxt,
|
||||
'source_url' => $this->url($obj->id, $obj->source),
|
||||
'source_id' => $obj->id,
|
||||
'source_type' => $obj->source
|
||||
);
|
||||
$old = $obj->email;
|
||||
$j++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_syslog($this->db->error());
|
||||
$this->error = $this->db->error();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return parent::addTargetsToDatabase($mailing_id, $cibles);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* On the main mailing area, there is a box with statistics.
|
||||
* If you want to add a line in this report you must provide an
|
||||
* array of SQL request that returns two field:
|
||||
* One called "label", One called "nb".
|
||||
*
|
||||
* @return array Array with SQL requests
|
||||
*/
|
||||
public function getSqlArrayForStats()
|
||||
{
|
||||
// CHANGE THIS: Optionnal
|
||||
|
||||
//var $statssql=array();
|
||||
//$this->statssql[0]="SELECT field1 as label, count(distinct(email)) as nb FROM mytable WHERE email IS NOT NULL";
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return here number of distinct emails returned by your selector.
|
||||
* For example if this selector is used to extract 500 different
|
||||
* emails from a text file, this function must return 500.
|
||||
*
|
||||
* @param string $sql Requete sql de comptage
|
||||
* @return int Nb of recipients
|
||||
*/
|
||||
public function getNbOfRecipients($sql = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT count(distinct(s.email)) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."partnership as p, ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " WHERE s.rowid = p.fk_soc AND s.email <> ''";
|
||||
$sql .= " AND s.entity IN (".getEntity('societe').")";
|
||||
|
||||
$sql .= " UNION ";
|
||||
|
||||
$sql .= "SELECT count(distinct(s.email)) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."partnership as p, ".MAIN_DB_PREFIX."adherent as s";
|
||||
$sql .= " WHERE s.rowid = p.fk_member AND s.email <> ''";
|
||||
$sql .= " AND s.entity IN (".getEntity('member').")";
|
||||
|
||||
//print $sql;
|
||||
|
||||
// La requete doit retourner un champ "nb" pour etre comprise
|
||||
// par parent::getNbOfRecipients
|
||||
return parent::getNbOfRecipients($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is to add a form filter to provide variant of selector
|
||||
* If used, the HTML select must be called "filter"
|
||||
*
|
||||
* @return string A html select zone
|
||||
*/
|
||||
public function formFilter()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->load("companies");
|
||||
|
||||
$s = '<select id="filter_partnership" name="filter" class="flat">';
|
||||
|
||||
// Show categories
|
||||
$sql = "SELECT rowid, label, code, active";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_partnership_type";
|
||||
$sql .= " WHERE active = 1";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$sql .= " ORDER BY label";
|
||||
|
||||
//print $sql;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
if (empty($conf->partnership->enabled)) {
|
||||
$num = 0; // Force empty list if category module is not enabled
|
||||
}
|
||||
|
||||
if ($num) {
|
||||
$s .= '<option value="-1">'.$langs->trans("PartnershipType").'</option>';
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$s .= '<option value="'.$obj->rowid.'">'.dol_escape_htmltag($obj->label);
|
||||
$s .= '</option>';
|
||||
$i++;
|
||||
}
|
||||
$s .= ajax_combobox("filter_partnership");
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
$s .= '</select> ';
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Can include an URL link on each record provided by selector shown on target page.
|
||||
*
|
||||
* @param int $id ID
|
||||
* @param string $sourcetype Source type
|
||||
* @return string Url link
|
||||
*/
|
||||
public function url($id, $sourcetype = 'thirdparty')
|
||||
{
|
||||
if ($sourcetype == 'thirparty') {
|
||||
return '<a href="'.DOL_URL_ROOT.'/societe/card.php?socid='.((int) $id).'">'.img_object('', "societe").'</a>';
|
||||
}
|
||||
if ($sourcetype == 'member') {
|
||||
return '<a href="'.DOL_URL_ROOT.'/adherent/card.php?id='.((int) $id).'">'.img_object('', "member").'</a>';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
|
@ -119,20 +119,20 @@ class mailing_pomme extends MailingTargets
|
|||
$langs->load("users");
|
||||
|
||||
$s = '';
|
||||
$s .= $langs->trans("Status").' ';
|
||||
$s .= '<select name="filter" class="flat marginrightonly">';
|
||||
$s .= '<option value="-1"> </option>';
|
||||
$s .= '<select id="filter_pomme"" name="filter" class="flat">';
|
||||
$s .= '<option value="-1">'.$langs->trans("Status").'</option>';
|
||||
$s .= '<option value="1">'.$langs->trans("Enabled").'</option>';
|
||||
$s .= '<option value="0">'.$langs->trans("Disabled").'</option>';
|
||||
$s .= '</select>';
|
||||
$s .= ajax_combobox("filter_pomme");
|
||||
|
||||
$s .= ' ';
|
||||
$s .= $langs->trans("Employee").' ';
|
||||
$s .= '<select name="filteremployee" class="flat marginrightonly">';
|
||||
$s .= '<option value="-1"> </option>';
|
||||
$s .= '<select id="filteremployee_pomme" name="filteremployee" class="flat">';
|
||||
$s .= '<option value="-1">'.$langs->trans("Employee").'</option>';
|
||||
$s .= '<option value="1">'.$langs->trans("Yes").'</option>';
|
||||
$s .= '<option value="0">'.$langs->trans("No").'</option>';
|
||||
$s .= '</select>';
|
||||
$s .= ajax_combobox("filteremployee_pomme");
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,9 @@ class mailing_thirdparties extends MailingTargets
|
|||
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
|
||||
$sql .= " AND cs.fk_soc = s.rowid";
|
||||
$sql .= " AND c.rowid = cs.fk_categorie";
|
||||
$sql .= " AND c.rowid=".((int) GETPOST('filter', 'int'));
|
||||
if (GETPOST('filter', 'int') > 0) {
|
||||
$sql .= " AND c.rowid=".((int) GETPOST('filter', 'int'));
|
||||
}
|
||||
$sql .= $addFilter;
|
||||
$sql .= " UNION ";
|
||||
$sql .= "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, c.label as label";
|
||||
|
|
@ -125,7 +127,9 @@ class mailing_thirdparties extends MailingTargets
|
|||
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
|
||||
$sql .= " AND cs.fk_soc = s.rowid";
|
||||
$sql .= " AND c.rowid = cs.fk_categorie";
|
||||
$sql .= " AND c.rowid=".((int) GETPOST('filter', 'int'));
|
||||
if (GETPOST('filter', 'int') > 0) {
|
||||
$sql .= " AND c.rowid=".((int) GETPOST('filter', 'int'));
|
||||
}
|
||||
$sql .= $addFilter;
|
||||
}
|
||||
$sql .= " ORDER BY email";
|
||||
|
|
@ -206,7 +210,7 @@ class mailing_thirdparties extends MailingTargets
|
|||
|
||||
$sql = "SELECT count(distinct(s.email)) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " WHERE s.email != ''";
|
||||
$sql .= " WHERE s.email <> ''";
|
||||
$sql .= " AND s.entity IN (".getEntity('societe').")";
|
||||
|
||||
// La requete doit retourner un champ "nb" pour etre comprise
|
||||
|
|
@ -226,8 +230,7 @@ class mailing_thirdparties extends MailingTargets
|
|||
|
||||
$langs->load("companies");
|
||||
|
||||
$s = $langs->trans("Categories").' ';
|
||||
$s .= '<select name="filter" class="flat marginrightonly">';
|
||||
$s = '<select id="filter_thirdparties" name="filter" class="flat">';
|
||||
|
||||
// Show categories
|
||||
$sql = "SELECT rowid, label, type, visible";
|
||||
|
|
@ -247,7 +250,7 @@ class mailing_thirdparties extends MailingTargets
|
|||
}
|
||||
|
||||
if ($num) {
|
||||
$s .= '<option value="0"> </option>';
|
||||
$s .= '<option value="-1">'.$langs->trans("Categories").'</option>';
|
||||
} else {
|
||||
$s .= '<option value="0">'.$langs->trans("ContactsAllShort").'</option>';
|
||||
}
|
||||
|
|
@ -270,14 +273,15 @@ class mailing_thirdparties extends MailingTargets
|
|||
$s .= '</option>';
|
||||
$i++;
|
||||
}
|
||||
$s .= ajax_combobox("filter_thirdparties");
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
$s .= '</select> ';
|
||||
$s .= $langs->trans('ProspectCustomer');
|
||||
$s .= ' <select name="filter_client" class="flat marginrightonly">';
|
||||
$s .= '<option value="-1"> </option>';
|
||||
|
||||
$s .= '<select id="filter_client_thirdparties" name="filter_client_thirdparties" class="flat">';
|
||||
$s .= '<option value="-1">'.$langs->trans('ProspectCustomer').'</option>';
|
||||
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
|
||||
$s .= '<option value="2">'.$langs->trans('Prospect').'</option>';
|
||||
}
|
||||
|
|
@ -290,13 +294,14 @@ class mailing_thirdparties extends MailingTargets
|
|||
$s .= '<option value="0">'.$langs->trans('NorProspectNorCustomer').'</option>';
|
||||
|
||||
$s .= '</select> ';
|
||||
$s .= ajax_combobox("filter_client_thirdparties");
|
||||
|
||||
$s .= $langs->trans("Status");
|
||||
$s .= ' <select name="filter_status" class="flat marginrightonly">';
|
||||
$s .= '<option value="-1"> </option>';
|
||||
$s .= '<option value="1" selected>'.$langs->trans("Enabled").'</option>';
|
||||
$s .= ' <select id="filter_status_thirdparties" name="filter_status" class="flat">';
|
||||
$s .= '<option value="-1">'.$langs->trans("Status").'</option>';
|
||||
$s .= '<option value="1">'.$langs->trans("Enabled").'</option>';
|
||||
$s .= '<option value="0">'.$langs->trans("Disabled").'</option>';
|
||||
$s .= '</select>';
|
||||
$s .= ajax_combobox("filter_status_thirdparties");
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -215,10 +215,9 @@ class mailing_thirdparties_services_expired extends MailingTargets
|
|||
{
|
||||
global $langs;
|
||||
|
||||
$s = $langs->trans("ProductOrService");
|
||||
$s .= '<select name="filter" class="flat">';
|
||||
$s .= '<select id="filter_services_expired" name="filter" class="flat">';
|
||||
if (count($this->arrayofproducts)) {
|
||||
$s .= '<option value="0"> </option>';
|
||||
$s .= '<option value="-1">'.$langs->trans("ProductOrService").'</option>';
|
||||
} else {
|
||||
$s .= '<option value="0">'.$langs->trans("ContactsAllShort").'</option>';
|
||||
}
|
||||
|
|
@ -226,6 +225,7 @@ class mailing_thirdparties_services_expired extends MailingTargets
|
|||
$s .= '<option value="'.$key.'">'.$val.'</option>';
|
||||
}
|
||||
$s .= '</select>';
|
||||
$s .= ajax_combobox("filter_services_expired");
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -350,8 +350,8 @@ class modAccounting extends DolibarrModules
|
|||
'b.fk_doc'=>'const-0',
|
||||
'b.fk_docdet'=>'const-0',
|
||||
'b.fk_user_author'=>'user->id',
|
||||
'b.montant'=>'rule-computeMontant',
|
||||
'b.sens'=>'rule-computeSens'
|
||||
'b.montant'=>'rule-computeAmount',
|
||||
'b.sens'=>'rule-computeDirection'
|
||||
); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
|
||||
$this->import_convertvalue_array[$r]=array(
|
||||
'b.numero_compte'=>array('rule'=>'accountingaccount'),
|
||||
|
|
|
|||
|
|
@ -179,18 +179,11 @@ class modFicheinter extends DolibarrModules
|
|||
'fd.rowid'=>'InterLineId',
|
||||
'fd.date'=>"InterLineDate", 'fd.duree'=>"InterLineDuration", 'fd.description'=>"InterLineDesc"
|
||||
);
|
||||
//$this->export_TypeFields_array[$r]=array(
|
||||
// 's.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label',
|
||||
// 's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text',
|
||||
// 's.code_compta_fournisseur'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.duree'=>"Duree",'f.fk_statut'=>'Statut','f.description'=>"Text",
|
||||
// 'f.datee'=>"Date",'f.dateo'=>"Date",'f.fulldayevent'=>"Boolean",'fd.date'=>"Date",'fd.duree'=>"Duree",'fd.description'=>"Text",
|
||||
// 'fd.total_ht'=>"Numeric"
|
||||
//);
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
's.rowid'=>"Numeric", 's.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 's.fk_pays'=>'List:c_country:label', 's.phone'=>'Text', 's.siren'=>'Text',
|
||||
's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text',
|
||||
'f.rowid'=>'Numeric', 'f.ref'=>"Text", 'f.datec'=>"Date",
|
||||
'f.duree'=>"Duree", 'f.fk_statut'=>'Numeric', 'f.description'=>"Text", 'f.datee'=>"Date", 'f.dateo'=>"Date", 'f.fulldayevent'=>"Boolean",
|
||||
'f.duree'=>"Duree", 'f.fk_statut'=>'Numeric', 'f.description'=>"Text", 'f.datee'=>"Date", 'f.dateo'=>"Date", 'f.fulldayevent'=>"Text",
|
||||
'pj.ref'=>'Text', 'pj.title'=>'Text',
|
||||
'fd.rowid'=>"Numeric", 'fd.date'=>"Date", 'fd.duree'=>"Duree", 'fd.description'=>"Text", 'fd.total_ht'=>"Numeric"
|
||||
);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class modReception extends DolibarrModules
|
|||
$this->module_position = '40';
|
||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->name = preg_replace('/^mod/i', '', get_class($this));
|
||||
$this->description = "Gestion des réceptions fournisseurs";
|
||||
$this->description = "ReceptionDescription";
|
||||
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = 'dolibarr';
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ class modUser extends DolibarrModules
|
|||
'u.accountancy_code'=>'Text',
|
||||
'u.address'=>"Text", 'u.zip'=>"Text", 'u.town'=>"Text",
|
||||
'u.office_phone'=>'Text', 'u.user_mobile'=>'Text', 'u.office_fax'=>'Text',
|
||||
'u.email'=>'Text', 'u.datec'=>"Date", 'u.tms'=>"Date", 'u.admin'=>"Boolean", 'u.statut'=>'Status', 'u.note'=>"Text", 'u.datelastlogin'=>'Date',
|
||||
'u.email'=>'Text', 'u.datec'=>"Date", 'u.tms'=>"Date", 'u.admin'=>"Boolean", 'u.statut'=>'Status', 'u.note'=>"Text", 'u.signature'=>"Text", 'u.datelastlogin'=>'Date',
|
||||
'u.fk_user'=>"List:user:login",
|
||||
'u.birth'=>'Date',
|
||||
'u.datepreviouslogin'=>'Date', 'u.fk_soc'=>"List:societe:nom:rowid", 'u.fk_member'=>"List:adherent:firstname",
|
||||
|
|
|
|||
|
|
@ -266,9 +266,10 @@ class pdf_azur extends ModelePDFPropales
|
|||
}
|
||||
|
||||
$arephoto = false;
|
||||
$realpath = '';
|
||||
foreach ($pdir as $midir) {
|
||||
if (!$arephoto) {
|
||||
if ($conf->product->entity != $objphoto->entity) {
|
||||
if ($conf->entity != $objphoto->entity) {
|
||||
$dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities
|
||||
} else {
|
||||
$dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product
|
||||
|
|
@ -685,7 +686,10 @@ class pdf_azur extends ModelePDFPropales
|
|||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
|
||||
}
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) {
|
||||
$nexY = $posYAfterImage;
|
||||
|
|
@ -915,6 +919,11 @@ class pdf_azur extends ModelePDFPropales
|
|||
}
|
||||
|
||||
$posxval = 52;
|
||||
if (!empty($conf->global->MAIN_PDF_DELIVERY_DATE_TEXT)) {
|
||||
$displaydate = "daytext";
|
||||
} else {
|
||||
$displaydate = "day";
|
||||
}
|
||||
|
||||
// Show shipping date
|
||||
if (!empty($object->delivery_date)) {
|
||||
|
|
@ -925,7 +934,7 @@ class pdf_azur extends ModelePDFPropales
|
|||
$pdf->MultiCell(80, 4, $titre, 0, 'L');
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true);
|
||||
$dlp = dol_print_date($object->delivery_date, $displaydate, false, $outputlangs, true);
|
||||
$pdf->MultiCell(80, 4, $dlp, 0, 'L');
|
||||
|
||||
$posy = $pdf->GetY() + 1;
|
||||
|
|
@ -1553,15 +1562,21 @@ class pdf_azur extends ModelePDFPropales
|
|||
}
|
||||
}
|
||||
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DatePropal")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R');
|
||||
if (!empty($conf->global->MAIN_PDF_DATE_TEXT)) {
|
||||
$displaydate = "daytext";
|
||||
} else {
|
||||
$displaydate = "day";
|
||||
}
|
||||
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEndPropal")." : ".dol_print_date($object->fin_validite, "day", false, $outputlangs, true), '', 'R');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DatePropal")." : ".dol_print_date($object->date, $displaydate, false, $outputlangs, true), '', 'R');
|
||||
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEndPropal")." : ".dol_print_date($object->fin_validite, $displaydate, false, $outputlangs, true), '', 'R');
|
||||
|
||||
if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && $object->thirdparty->code_client) {
|
||||
$posy += 4;
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ class pdf_cyan extends ModelePDFPropales
|
|||
$arephoto = false;
|
||||
foreach ($pdir as $midir) {
|
||||
if (!$arephoto) {
|
||||
if ($conf->product->entity != $objphoto->entity) {
|
||||
if ($conf->entity != $objphoto->entity) {
|
||||
$dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities
|
||||
} else {
|
||||
$dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product
|
||||
|
|
@ -810,7 +810,10 @@ class pdf_cyan extends ModelePDFPropales
|
|||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
|
||||
}
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) {
|
||||
$nexY = max($nexY, $posYAfterImage);
|
||||
|
|
@ -1035,6 +1038,11 @@ class pdf_cyan extends ModelePDFPropales
|
|||
}
|
||||
|
||||
$posxval = 52;
|
||||
if (!empty($conf->global->MAIN_PDF_DATE_TEXT)) {
|
||||
$displaydate = "daytext";
|
||||
} else {
|
||||
$displaydate = "day";
|
||||
}
|
||||
|
||||
// Show shipping date
|
||||
if (!empty($object->delivery_date)) {
|
||||
|
|
@ -1045,7 +1053,7 @@ class pdf_cyan extends ModelePDFPropales
|
|||
$pdf->MultiCell(80, 4, $titre, 0, 'L');
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true);
|
||||
$dlp = dol_print_date($object->delivery_date, $displaydate, false, $outputlangs, true);
|
||||
$pdf->MultiCell(80, 4, $dlp, 0, 'L');
|
||||
|
||||
$posy = $pdf->GetY() + 1;
|
||||
|
|
@ -1634,10 +1642,16 @@ class pdf_cyan extends ModelePDFPropales
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($conf->global->MAIN_PDF_DATE_TEXT)) {
|
||||
$displaydate = "daytext";
|
||||
} else {
|
||||
$displaydate = "day";
|
||||
}
|
||||
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R');
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date, $displaydate, false, $outputlangs, true), '', 'R');
|
||||
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
|
|
@ -1647,7 +1661,7 @@ class pdf_cyan extends ModelePDFPropales
|
|||
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) {
|
||||
$title .= ' - '.$outputlangsbis->transnoentities("DateEndPropal");
|
||||
}
|
||||
$pdf->MultiCell($w, 3, $title." : ".dol_print_date($object->fin_validite, "day", false, $outputlangs, true), '', 'R');
|
||||
$pdf->MultiCell($w, 3, $title." : ".dol_print_date($object->fin_validite, $displaydate, false, $outputlangs, true), '', 'R');
|
||||
|
||||
if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && $object->thirdparty->code_client) {
|
||||
$posy += 4;
|
||||
|
|
|
|||
|
|
@ -746,7 +746,10 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
|||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
|
||||
}
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) {
|
||||
$nexY = $posYAfterImage;
|
||||
|
|
|
|||
|
|
@ -625,7 +625,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
|||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
|
||||
}
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) {
|
||||
$nexY = $posYAfterImage;
|
||||
|
|
|
|||
|
|
@ -619,7 +619,10 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$vatcode = $object->lines[$i]->vat_src_code;
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=>$tvaligne);
|
||||
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
|
||||
}
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) {
|
||||
$nexY = $posYAfterImage;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user