Merge branch 'develop' of github.com:Dolibarr/dolibarr into develop_declinaison_price_multiple_merge

This commit is contained in:
John Botella 2020-08-12 10:39:21 +02:00
commit 41cbe6db12
259 changed files with 4888 additions and 2063 deletions

View File

@ -5,6 +5,7 @@
# We use dist: xenial to have php 5.6+ available
os: linux
dist: xenial
#dist: bionic
sudo: required
language: php

View File

@ -4,7 +4,7 @@ English Dolibarr ChangeLog
***** ChangeLog for 13.0.0 compared to 12.0.0 *****
For users:
NEW: Add module Credit transfer SEPA to manage payment of supplier using bank credit transfer SEPA files
WARNING:
@ -14,6 +14,68 @@ Following changes may create regressions for some external modules, but were nec
***** ChangeLog for 12.0.2 compared to 12.0.1 *****
FIX: computation of the bottom margin of <body> returns NaN because body is not loaded yet
FIX: DebugBar hides content at page bottom
FIX: allow more harmless html tags
FIX: Bad back to link
FIX: Bad param
FIX: Can go on page even when module is disabled
FIX: Change position of line in BOM
FIX: Checkbox "drop table" was not checked when using php method to generate backup dump
FIX: ClickToDial tab of users has disappeared
FIX: CSS
FIX: date in supplier price log tooltip.
FIX: Debug module direct debit order. Solve conflict with credit transfer
FIX: Debug setup of receipt printer module
FIX: dolGetElementUrl and agenda page for external modules
FIX: DO not erase variable $key and $label during output of extrafields
FIX: duration fields size with firefox
FIX: Edit extrafield of type long text loose carriage returns
FIX: Fails to retraive accounting code of social contribution sometimes
FIX: Filter too large for extrafields with type text or html
FIX: If using a rounding step, localtax1+2 not included in total
FIX: input field of extrafields must keep data if form submit fails.
FIX: Label of opportunities in graph with special chars badly encoded
FIX: locataxes lost on lines when cloning a vendor invoice
FIX: Look and feel v12
FIX: Missing PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE conf support in supplier order
FIX: Navigation in object fails to find the next ref in some cases
FIX: null required
FIX: order by amount ht uses wrong column
FIX: Order by amount in product propal stats must be done on d.total_ht and not p.total
FIX: page for confirmation of payments is empty
FIX: Param of fetch_name_optionals_label must be object->table_element
FIX: Picto of HRM module
FIX: product label and desc were never updated when modifying translation
FIX: redirect on contact card from main search
FIX: Reposition and nav
FIX: search warehouse list
FIX: Setup of clicktodial hang on smartphone
FIX: Setup of currency limit and accuracy
FIX: shipping creation: checks not done on weight and sizes
FIX: Should not be able to edit qty on shipment when no stock available
FIX: Size of image on the help popup of modules
FIX: Sql error on stat by referring entries of a product
FIX: Warning if no bank account defined
FIX: We need to see unit line on PDF even though it's an option
FIX: wrong element var for fetch_name_optionals_label function with expeditions
FIX: wrong link to third invoice templates
FIX: Disable svg as supported image by default (can contains javascript). Set MAIN_ALLOW_SVG_FILES_AS_IMAGES to 1 to have svg accepted
FIX: #14076
FIX: #14146
FIX: #14209
FIX: #14222
FIX: #14236
FIX: #14241 Mysql 8 compatibility
FIX: #14253
FIX: #14256
FIX: #14259
FIX: #14279
FIX: #14291
FIX: #14292
FIX: #14336
***** ChangeLog for 12.0.1 compared to 12.0.0 *****
FIX: reposition was broken if url end with #anchor
FIX: $_POST must be GETPOST

View File

@ -1,2 +1,8 @@
Spec for credit transfer:
https://docs.oracle.com/cd/E39124_01/doc.91/e60210/fields_sepa_pay_file_appx.htm#EOAEL00515
To validate a SEPA file:
xmllint --schema pain.001.001.03.xsd T200801.xml --noout
To test a SEPA file:
https://www.mesfluxdepaiement.fr/testez-vos-fichiers-sepa

View File

@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
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/lib/date.lib.php';
// Load translation files required by the page
@ -78,6 +79,7 @@ if ($sortfield == "") $sortfield = "t.doc_date,t.rowid";
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new BookKeeping($db);
$formfile = new FormFile($db);
$hookmanager->initHooks(array('bookkeepingbyaccountlist'));
$formaccounting = new FormAccounting($db);
@ -543,7 +545,7 @@ while ($i < min($num, $limit))
// Show the break account
print "<tr>";
print '<td colspan="'.$totalarray['nbfield'].'" style="font-weight:bold; border-bottom: 1pt solid black;">';
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 9).'" style="font-weight:bold; border-bottom: 1pt solid black;">';
if ($line->numero_compte != "" && $line->numero_compte != '-1') print length_accountg($line->numero_compte).' : '.$object->get_compte_desc($line->numero_compte);
else print '<span class="error">'.$langs->trans("Unknown").'</span>';
print '</td>';

View File

@ -88,6 +88,7 @@ if ($action == 'update' || $action == 'add') {
$constnote = (GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'none') : GETPOST('constnote'));
$typetouse = empty($oldtypetonewone[$consttype]) ? $consttype : $oldtypetonewone[$consttype];
$constvalue = preg_replace('/:member$/', '', $constvalue);
$res = dolibarr_set_const($db, $constname, $constvalue, $typetouse, 0, $constnote, $conf->entity);
@ -100,23 +101,6 @@ if ($action == 'update' || $action == 'add') {
}
}
// Action to enable a submodule of the adherent module
if ($action == 'set') {
$result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
if ($result < 0) {
print $db->error();
}
}
// Action to disable a submodule of the adherent module
if ($action == 'unset') {
$result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity);
if ($result < 0) {
print $db->error();
}
}
/*
* View

View File

@ -890,7 +890,10 @@ if ($rowid > 0) {
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) {
$prodtmp = new Product($db);
$prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
$result = $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
if ($result < 0) {
setEventMessage($prodtmp->error, 'errors');
}
print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product
}
print '<br>';
@ -912,7 +915,10 @@ if ($rowid > 0) {
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) {
$prodtmp = new Product($db);
$prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
$result = $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
if ($result < 0) {
setEventMessage($prodtmp->error, 'errors');
}
print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product
}
print '<br>';

View File

@ -109,6 +109,12 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
foreach ($arrayofimages as $varforimage)
{
if ($_FILES[$varforimage]["name"] && ! preg_match('/(\.jpeg|\.jpg|\.png)$/i', $_FILES[$varforimage]["name"])) { // Logo can be used on a lot of different places. Only jpg and png can be supported.
$langs->load("errors");
setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
break;
}
if ($_FILES[$varforimage]["tmp_name"])
{
$reg = array();
@ -473,10 +479,17 @@ if (!empty($mysoc->logo_mini)) {
print '</div>';
}
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
} else {
print '<div class="inline-block valignmiddle">';
print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
print '</div>';
} elseif (!empty($mysoc->logo)) {
if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
print '<div class="inline-block valignmiddle">';
print '<img style="max-height: 60px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo).'">';
print '</div>';
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
} else {
print '<div class="inline-block valignmiddle">';
print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
print '</div>';
}
}
print '</div>';
print '</td></tr>';
@ -493,10 +506,18 @@ if (!empty($mysoc->logo_squarred_mini)) {
print '</div>';
}
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
} else {
print '<div class="inline-block valignmiddle">';
print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
print '</div>';
} elseif (!empty($mysoc->logo_squarred)) {
if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred)) {
print '<div class="inline-block valignmiddle">';
print '<img style="max-height: 60px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo_squarred).'">';
print '</div>';
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
}
else {
print '<div class="inline-block valignmiddle">';
print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
print '</div>';
}
}
print '</div>';
print '</td></tr>';

View File

@ -12,6 +12,7 @@
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 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
@ -90,7 +91,11 @@ $hookmanager->initHooks(array('admin'));
// Put here declaration of dictionaries properties
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
$taborder = array(9, 0, 4, 3, 2, 0, 1, 8, 19, 16, 27, 38, 0, 5, 11, 0, 32, 33, 34, 0, 6, 0, 29, 0, 7, 24, 28, 17, 35, 36, 0, 10, 23, 12, 13, 0, 14, 0, 22, 20, 18, 21, 0, 15, 30, 0, 37, 0, 25, 0);
if (! empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) {
$taborder = array(9, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 32, 33, 34, 0, 6, 0, 29, 0, 7, 24, 28, 17, 35, 36, 0, 10, 23, 12, 13, 0, 14, 0, 22, 20, 18, 21, 0, 15, 30, 0, 37, 0, 25, 0);
} else {
$taborder = array(9, 0, 4, 3, 2, 0, 1, 8, 19, 16, 27, 38, 0, 5, 11, 0, 32, 33, 34, 0, 6, 0, 29, 0, 7, 24, 28, 17, 35, 36, 0, 10, 23, 12, 13, 0, 14, 0, 22, 20, 18, 21, 0, 15, 30, 0, 37, 0, 25, 0);
}
// Name of SQL tables of dictionaries
$tabname = array();
@ -133,6 +138,8 @@ $tabname[35] = MAIN_DB_PREFIX."c_exp_tax_cat";
$tabname[36] = MAIN_DB_PREFIX."c_exp_tax_range";
$tabname[37] = MAIN_DB_PREFIX."c_units";
$tabname[38] = MAIN_DB_PREFIX."c_socialnetworks";
$tabname[39] = MAIN_DB_PREFIX."c_prospectcontactlevel";
$tabname[40] = MAIN_DB_PREFIX."c_stcommcontact";
// Dictionary labels
$tablib = array();
@ -174,6 +181,8 @@ $tablib[35] = "DictionaryExpenseTaxCat";
$tablib[36] = "DictionaryExpenseTaxRange";
$tablib[37] = "DictionaryMeasuringUnits";
$tablib[38] = "DictionarySocialNetworks";
$tablib[39] = "DictionaryProspectContactLevel";
$tablib[40] = "DictionaryProspectContactStatus";
// Requests to extract data
$tabsql = array();
@ -203,7 +212,7 @@ $tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as
$tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity('c_type_container').")";
//$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
$tabsql[27] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_stcomm";
$tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm";
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
$tabsql[29] = "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
$tabsql[30] = "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
@ -215,6 +224,8 @@ $tabsql[35] = "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX
$tabsql[36] = "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
$tabsql[37] = "SELECT r.rowid, r.code, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
$tabsql[38] = "SELECT rowid, entity, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
$tabsql[39] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel";
$tabsql[40] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcommcontact";
// Criteria to sort dictionaries
$tabsqlsort = array();
@ -256,6 +267,8 @@ $tabsqlsort[35] = "c.label ASC";
$tabsqlsort[36] = "r.fk_c_exp_tax_cat ASC, r.range_ik ASC";
$tabsqlsort[37] = "r.unit_type ASC, r.scale ASC, r.code ASC";
$tabsqlsort[38] = "rowid, code ASC";
$tabsqlsort[39] = "sortorder ASC";
$tabsqlsort[40] = "code ASC";
// Field names in select result for dictionary display
$tabfield = array();
@ -285,7 +298,7 @@ $tabfield[23] = "country_id,country,taux,revenuestamp_type,accountancy_code_sell
$tabfield[24] = "code,label";
$tabfield[25] = "code,label";
//$tabfield[26]= "code,label,short_label";
$tabfield[27] = "code,libelle";
$tabfield[27] = "code,libelle,picto";
$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country";
$tabfield[29] = "code,label,percent,position";
$tabfield[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
@ -297,6 +310,8 @@ $tabfield[35] = "label";
$tabfield[36] = "range_ik,fk_c_exp_tax_cat";
$tabfield[37] = "code,label,short_label,unit_type,scale";
$tabfield[38] = "code,label,url,icon,entity";
$tabfield[39] = "code,libelle,sortorder";
$tabfield[40] = "code,libelle,picto";
// Edit field names for editing a record
$tabfieldvalue = array();
@ -326,7 +341,7 @@ $tabfieldvalue[23] = "country,taux,revenuestamp_type,accountancy_code_sell,accou
$tabfieldvalue[24] = "code,label";
$tabfieldvalue[25] = "code,label";
//$tabfieldvalue[26]= "code,label,short_label";
$tabfieldvalue[27] = "code,libelle";
$tabfieldvalue[27] = "code,libelle,picto";
$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country";
$tabfieldvalue[29] = "code,label,percent,position";
$tabfieldvalue[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
@ -338,6 +353,8 @@ $tabfieldvalue[35] = "label";
$tabfieldvalue[36] = "range_ik,fk_c_exp_tax_cat";
$tabfieldvalue[37] = "code,label,short_label,unit_type,scale";
$tabfieldvalue[38] = "code,label,url,icon";
$tabfieldvalue[39] = "code,libelle,sortorder";
$tabfieldvalue[40] = "code,libelle,picto";
// Field names in the table for inserting a record
$tabfieldinsert = array();
@ -367,7 +384,7 @@ $tabfieldinsert[23] = "fk_pays,taux,revenuestamp_type,accountancy_code_sell,acco
$tabfieldinsert[24] = "code,label";
$tabfieldinsert[25] = "code,label";
//$tabfieldinsert[26]= "code,label,short_label";
$tabfieldinsert[27] = "code,libelle";
$tabfieldinsert[27] = "code,libelle,picto";
$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country";
$tabfieldinsert[29] = "code,label,percent,position";
$tabfieldinsert[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
@ -380,6 +397,8 @@ $tabfieldinsert[35] = "label";
$tabfieldinsert[36] = "range_ik,fk_c_exp_tax_cat";
$tabfieldinsert[37] = "code,label,short_label,unit_type,scale";
$tabfieldinsert[38] = "code,label,url,icon,entity";
$tabfieldinsert[39] = "code,label,sortorder";
$tabfieldinsert[40] = "code,libelle,picto";
// Rowid name of field depending if field is autoincrement on or off..
// Use "" if id field is "rowid" and has autoincrement on
@ -423,6 +442,8 @@ $tabrowid[35] = "";
$tabrowid[36] = "";
$tabrowid[37] = "";
$tabrowid[38] = "";
$tabrowid[39] = "code";
$tabrowid[40] = "id";
// Condition to show dictionary in setup page
$tabcond = array();
@ -464,6 +485,8 @@ $tabcond[35] = !empty($conf->expensereport->enabled);
$tabcond[36] = !empty($conf->expensereport->enabled);
$tabcond[37] = !empty($conf->product->enabled);
$tabcond[38] = !empty($conf->socialnetworks->enabled);
$tabcond[39] = (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS));
$tabcond[40] = ! empty($conf->societe->enabled);
// List of help for fields
$tabhelp = array();
@ -493,7 +516,7 @@ $tabhelp[23] = array('revenuestamp_type'=>'FixedOrPercent');
$tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[25] = array('code'=>$langs->trans('EnterAnyCode'));
//$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"),'picto'=>$langs->trans("PictoHelp"));
$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"), 'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically"));
$tabhelp[29] = array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[30] = array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->trans("LabelName"), 'paper_size'=>$langs->trans("LabelPaperSize"));
@ -505,6 +528,8 @@ $tabhelp[35] = array();
$tabhelp[36] = array('range_ik'=>$langs->trans('PrevRangeToThisRange'));
$tabhelp[37] = array('code'=>$langs->trans("EnterAnyCode"), 'unit_type' => $langs->trans('MeasuringUnitTypeDesc'), 'scale' => $langs->trans('MeasuringScaleDesc'));
$tabhelp[38] = array('code'=>$langs->trans("EnterAnyCode"), 'url' => $langs->trans('UrlSocialNetworksDesc'), 'icon' => $langs->trans('FafaIconSocialNetworksDesc'));
$tabhelp[39] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[40] = array('code'=>$langs->trans("EnterAnyCode"),'picto'=>$langs->trans("PictoHelp"));
// List of check for fields (NOT USED YET)
$tabfieldcheck = array();
@ -546,6 +571,8 @@ $tabfieldcheck[35] = array();
$tabfieldcheck[36] = array();
$tabfieldcheck[37] = array();
$tabfieldcheck[38] = array();
$tabfieldcheck[39] = array();
$tabfieldcheck[40] = array();
// Complete all arrays with entries found into modules
complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabfieldcheck);
@ -647,7 +674,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
if ($value == 'dayrule' && empty($_POST['dayrule'])) continue;
if ($value == 'sortorder') continue; // For a column name 'sortorder', we use the field name 'position'
if ((!isset($_POST[$value]) || $_POST[$value] == '')
&& (!in_array($listfield[$f], array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking')) // Fields that are not mandatory
&& (!in_array($listfield[$f], array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto')) // Fields that are not mandatory
&& (!($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10
)
) {

View File

@ -153,20 +153,20 @@ $sourceList = array();
// We save list of template email Dolibarr can manage. This list can found by a grep into code on "->param['models']"
$elementList = array();
if ($conf->propal->enabled) $elementList['propal_send'] = $langs->trans('MailToSendProposal');
if ($conf->commande->enabled) $elementList['order_send'] = $langs->trans('MailToSendOrder');
if ($conf->facture->enabled) $elementList['facture_send'] = $langs->trans('MailToSendInvoice');
if ($conf->propal->enabled && $user->rights->propal->lire) $elementList['propal_send'] = $langs->trans('MailToSendProposal');
if ($conf->commande->enabled && $user->rights->commande->lire) $elementList['order_send'] = $langs->trans('MailToSendOrder');
if ($conf->facture->enabled && $user->rights->facture->lire) $elementList['facture_send'] = $langs->trans('MailToSendInvoice');
if ($conf->expedition->enabled) $elementList['shipping_send'] = $langs->trans('MailToSendShipment');
if ($conf->reception->enabled) $elementList['reception_send'] = $langs->trans('MailToSendReception');
if ($conf->ficheinter->enabled) $elementList['fichinter_send'] = $langs->trans('MailToSendIntervention');
if ($conf->supplier_proposal->enabled) $elementList['supplier_proposal_send'] = $langs->trans('MailToSendSupplierRequestForQuotation');
if ($conf->fournisseur->enabled && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled) $elementList['order_supplier_send'] = $langs->trans('MailToSendSupplierOrder');
if ($conf->fournisseur->enabled && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_invoice->enabled) $elementList['invoice_supplier_send'] = $langs->trans('MailToSendSupplierInvoice');
if ($conf->societe->enabled) $elementList['thirdparty'] = $langs->trans('MailToThirdparty');
if ($conf->adherent->enabled) $elementList['member'] = $langs->trans('MailToMember');
if ($conf->contrat->enabled) $elementList['contract'] = $langs->trans('MailToSendContract');
if (($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || ($conf->supplier_order->enabled && $user->rights->supplier_order->lire)) $elementList['order_supplier_send'] = $langs->trans('MailToSendSupplierOrder');
if (($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || ($conf->supplier_invoice->enabled && $user->rights->supplier_invoice->lire)) $elementList['invoice_supplier_send'] = $langs->trans('MailToSendSupplierInvoice');
if ($conf->societe->enabled && $user->rights->societe->lire) $elementList['thirdparty'] = $langs->trans('MailToThirdparty');
if ($conf->adherent->enabled && $user->rights->adherent->lire) $elementList['member'] = $langs->trans('MailToMember');
if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementList['contract'] = $langs->trans('MailToSendContract');
if ($conf->projet->enabled) $elementList['project'] = $langs->trans('MailToProject');
if ($conf->ticket->enabled) $elementList['ticket_send'] = $langs->trans('MailToTicket');
if ($conf->ticket->enabled && $user->rights->ticket->read) $elementList['ticket_send'] = $langs->trans('MailToTicket');
$elementList['user'] = $langs->trans('MailToUser');
$parameters = array('elementList'=>$elementList);
@ -544,6 +544,7 @@ if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $fieldsforco
foreach ($fieldsforcontent as $tmpfieldlist)
{
print '<tr class="impair nodrag nodrop nohover"><td colspan="6" class="nobottom">';
// Label
if ($tmpfieldlist == 'topic')
{
@ -557,6 +558,7 @@ foreach ($fieldsforcontent as $tmpfieldlist)
print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
if ($tmpfieldlist == 'content_lines')
print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
// Input field
if ($tmpfieldlist == 'topic') {
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
@ -633,30 +635,34 @@ if ($resql)
// Title line with search boxes
print '<tr class="liste_titre">';
$filterfound = 0;
foreach ($fieldlist as $field => $value)
{
if ($value == 'label') print '<td class="liste_titre"><input type="text" name="search_label" class="maxwidth100" value="'.dol_escape_htmltag($search_label).'"></td>';
elseif ($value == 'lang')
{
if ($value == 'label') {
print '<td class="liste_titre"><input type="text" name="search_label" class="maxwidth100" value="'.dol_escape_htmltag($search_label).'"></td>';
} elseif ($value == 'lang') {
print '<td class="liste_titre">';
print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth100');
print '</td>';
} elseif ($value == 'fk_user')
{
} elseif ($value == 'fk_user') {
print '<td class="liste_titre">';
$restrictid = array();
if (!$user->admin) $restrictid = array($user->id);
//var_dump($restrictid);
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth100');
print '</td>';
} elseif ($value == 'topic') print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
elseif ($value == 'type_template')
{
} elseif ($value == 'topic') {
print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
} elseif ($value == 'type_template') {
print '<td class="liste_titre">'.$form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100 maxwidth100onsmartphone').'</td>';
} elseif (!in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>';
} elseif (!in_array($value, array('content', 'content_lines'))) {
print '<td class="liste_titre"></td>';
}
}
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>';
// Action column
print '<td class="liste_titre right" width="64">';
$searchpicto = $form->showFilterButtons();

View File

@ -262,7 +262,7 @@ print '<div class="centpercent">';
$picto = 'object_'.$objMod->picto;
print load_fiche_titre(($modulename ? $modulename : $moduledesc), $moreinfo, $picto);
print load_fiche_titre(($modulename ? $modulename : $moduledesc), $moreinfo, $picto, 0, '', 'titlemodulehelp');
print '<br>';
dol_fiche_head($head, $mode, '', -1);

View File

@ -506,10 +506,10 @@ if ($mode == 'common' || $mode == 'commonkanban')
$moreforfilter .= '<div class="floatright center marginrightonly hideonsmartphone" style="padding-top: 3px"><span class="">'.$moreinfo.'</span><br><b class="largenumber">'.$moreinfo2.'</b></div>';
$moreforfilter .= '<div class="colorbacktimesheet float valignmiddle">';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= '<div class="divsearchfield paddingtop">';
$moreforfilter .= $langs->trans('Keyword').': <input type="text" id="search_keyword" name="search_keyword" class="maxwidth100" value="'.dol_escape_htmltag($search_keyword).'">';
$moreforfilter .= '</div>';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= '<div class="divsearchfield paddingtop">';
$moreforfilter .= $langs->trans('Origin').': '.$form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
$moreforfilter .= '</div>';
if (!empty($conf->global->MAIN_FEATURES_LEVEL))
@ -518,11 +518,11 @@ if ($mode == 'common' || $mode == 'commonkanban')
if ($conf->global->MAIN_FEATURES_LEVEL < 0) $array_version['deprecated'] = $langs->trans("Deprecated");
if ($conf->global->MAIN_FEATURES_LEVEL > 0) $array_version['experimental'] = $langs->trans("Experimental");
if ($conf->global->MAIN_FEATURES_LEVEL > 1) $array_version['development'] = $langs->trans("Development");
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= '<div class="divsearchfield paddingtop">';
$moreforfilter .= $langs->trans('Version').': '.$form->selectarray('search_version', $array_version, $search_version, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
$moreforfilter .= '</div>';
}
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= '<div class="divsearchfield paddingtop">';
$moreforfilter .= $langs->trans('Status').': '.$form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
$moreforfilter .= '</div>';
$moreforfilter .= ' ';

View File

@ -65,13 +65,13 @@ if (!function_exists('gzdecode')) {
}
}
/*
* Action
*/
if ($action == 'addprinter' && $user->admin) {
$error = 0;
$db->begin();
if (empty($printername)) {
$error++;
setEventMessages($langs->trans("PrinterNameEmpty"), null, 'errors');
@ -82,7 +82,8 @@ if ($action == 'addprinter' && $user->admin) {
}
if (!$error) {
$result = $printer->addPrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter);
$db->begin();
$result = $printer->addPrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter);
if ($result > 0) $error++;
if (!$error)
@ -99,14 +100,14 @@ if ($action == 'addprinter' && $user->admin) {
if ($action == 'deleteprinter' && $user->admin) {
$error = 0;
$db->begin();
if (empty($printerid)) {
$error++;
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
}
if (!$error) {
$result = $printer->deletePrinter($printerid);
$db->begin();
$result = $printer->deletePrinter($printerid);
if ($result > 0) $error++;
if (!$error)
@ -123,14 +124,14 @@ if ($action == 'deleteprinter' && $user->admin) {
if ($action == 'updateprinter' && $user->admin) {
$error = 0;
$db->begin();
if (empty($printerid)) {
$error++;
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
}
if (!$error) {
$result = $printer->updatePrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter, $printerid);
$db->begin();
$result = $printer->updatePrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter, $printerid);
if ($result > 0) $error++;
if (!$error) {
@ -189,14 +190,14 @@ if ($action == 'testtemplate' && $user->admin) {
if ($action == 'updatetemplate' && $user->admin) {
$error = 0;
$db->begin();
if (empty($templateid)) {
$error++;
setEventMessages($langs->trans("TemplateIdEmpty"), null, 'errors');
}
if (!$error) {
$result = $printer->updateTemplate($templatename, $template, $templateid);
$db->begin();
$result = $printer->updateTemplate($templatename, $template, $templateid);
if ($result > 0) $error++;
if (!$error) {
@ -212,14 +213,14 @@ if ($action == 'updatetemplate' && $user->admin) {
if ($action == 'addtemplate' && $user->admin) {
$error = 0;
$db->begin();
if (empty($templatename)) {
$error++;
setEventMessages($langs->trans("TemplateNameEmpty"), null, 'errors');
}
if (!$error) {
$result = $printer->addTemplate($templatename, $template);
$db->begin();
$result = $printer->addTemplate($templatename, $template);
if ($result > 0) $error++;
if (!$error) {
@ -233,6 +234,29 @@ if ($action == 'addtemplate' && $user->admin) {
$action = '';
}
if ($action == 'deletetemplate' && $user->admin) {
$error = 0;
if (empty($templateid)) {
$error++;
setEventMessages($langs->trans("TemplateIdEmpty"), null, 'errors');
}
if (!$error) {
$db->begin();
$result = $printer->deleteTemplate($templateid);
if ($result > 0) $error++;
if (!$error) {
$db->commit();
setEventMessages($langs->trans("TemplateDeleted", $templatename), null);
} else {
$db->rollback();
dol_print_error($db);
}
}
$action = '';
}
/*
* View
@ -247,6 +271,7 @@ print load_fiche_titre($langs->trans("ReceiptPrinterSetup"), $linkback, 'title_s
$head = receiptprinteradmin_prepare_head($mode);
// mode = config
if ($mode == 'config' && $user->admin) {
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=config" autocomplete="off">';
print '<input type="hidden" name="token" value="'.newToken().'">';
@ -259,7 +284,7 @@ if ($mode == 'config' && $user->admin) {
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), -1, 'technic');
print $langs->trans("ReceiptPrinterDesc")."<br><br>\n";
print '<span class="opacitymedium">'.$langs->trans("ReceiptPrinterDesc")."</span><br><br>\n";
print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre">';
@ -272,6 +297,22 @@ if ($mode == 'config' && $user->admin) {
$ret = $printer->listprinters();
$nbofprinters = count($printer->listprinters);
if ($action != 'editprinter') {
print '<tr>';
print '<td><input size="50" type="text" name="printername"></td>';
$ret = $printer->selectTypePrinter();
print '<td>'.$printer->resprint.'</td>';
$ret = $printer->selectProfilePrinter();
print '<td>'.$printer->profileresprint.'</td>';
print '<td><input size="60" type="text" name="parameter"></td>';
print '<td class="right">';
if ($action != 'editprinter') {
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
}
print '</td>';
print '</tr>';
}
if ($ret > 0) {
setEventMessages($printer->error, $printer->errors, 'errors');
} else {
@ -285,7 +326,9 @@ if ($mode == 'config' && $user->admin) {
$ret = $printer->selectProfilePrinter($printer->listprinters[$line]['fk_profile']);
print '<td>'.$printer->profileresprint.'</td>';
print '<td><input size="60" type="text" name="parameter" value="'.$printer->listprinters[$line]['parameter'].'"></td>';
print '<td></td>';
print '<td>';
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
print '</td>';
print '</tr>';
} else {
print '<td>'.$printer->listprinters[$line]['name'].'</td>';
@ -293,15 +336,15 @@ if ($mode == 'config' && $user->admin) {
print '<td>'.$langs->trans($printer->listprinters[$line]['fk_profile_name']).'</td>';
print '<td>'.$printer->listprinters[$line]['parameter'].'</td>';
// edit icon
print '<td><a href="'.$_SERVER['PHP_SELF'].'?mode=config&amp;action=editprinter&amp;printerid='.$printer->listprinters[$line]['rowid'].'">';
print '<td class="right"><a class="editfielda marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&amp;action=editprinter&amp;printerid='.$printer->listprinters[$line]['rowid'].'">';
print img_picto($langs->trans("Edit"), 'edit');
print '</a>';
// delete icon
print '<a href="'.$_SERVER['PHP_SELF'].'?mode=config&amp;action=deleteprinter&amp;printerid='.$printer->listprinters[$line]['rowid'].'&amp;printername='.$printer->listprinters[$line]['name'].'">';
print '<a class="marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&amp;action=deleteprinter&amp;printerid='.$printer->listprinters[$line]['rowid'].'&amp;printername='.$printer->listprinters[$line]['name'].'">';
print img_picto($langs->trans("Delete"), 'delete');
print '</a>';
// test icon
print '<a href="'.$_SERVER['PHP_SELF'].'?mode=config&amp;action=testprinter&amp;printerid='.$printer->listprinters[$line]['rowid'].'&amp;printername='.$printer->listprinters[$line]['name'].'">';
print '<a class="marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&amp;action=testprinter&amp;printerid='.$printer->listprinters[$line]['rowid'].'&amp;printername='.$printer->listprinters[$line]['name'].'">';
print img_picto($langs->trans("TestPrinter"), 'printer');
print '</a></td>';
print '</tr>';
@ -309,38 +352,10 @@ if ($mode == 'config' && $user->admin) {
}
}
if ($action != 'editprinter') {
if ($nbofprinters > 0) {
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Name").'</th>';
print '<th>'.$langs->trans("Type").'</th>';
print '<th>'.$langs->trans("Profile").'</th>';
print '<th>'.$langs->trans("Parameters").'</th>';
print '<th></th>';
print "</tr>\n";
}
print '<tr>';
print '<td><input size="50" type="text" name="printername"></td>';
$ret = $printer->selectTypePrinter();
print '<td>'.$printer->resprint.'</td>';
$ret = $printer->selectProfilePrinter();
print '<td>'.$printer->profileresprint.'</td>';
print '<td><input size="60" type="text" name="parameter"></td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
print '</tr>';
}
print '</table>';
dol_fiche_end();
if ($action != 'editprinter') {
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
} else {
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
}
print '</form>';
print '<br>';
@ -370,8 +385,11 @@ if ($mode == 'config' && $user->admin) {
print '</table>';
}
// mode = template
if ($mode == 'template' && $user->admin) {
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=template" autocomplete="off">';
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), -1, 'technic');
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=template" autocomplete="off">';
print '<input type="hidden" name="token" value="'.newToken().'">';
if ($action != 'edittemplate') {
print '<input type="hidden" name="action" value="addtemplate">';
@ -379,16 +397,11 @@ if ($mode == 'template' && $user->admin) {
print '<input type="hidden" name="action" value="updatetemplate">';
}
print load_fiche_titre($langs->trans("ReceiptPrinterTemplateDesc"), '', '')."<br><br>\n";
print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Name").'</th>';
print '<th>'.$langs->trans("Template").'</th>';
print '<th></th>';
print '<th></th>';
print '<th></th>';
print "</tr>\n";
$ret = $printer->listPrintersTemplates();
//print '<pre>'.print_r($printer->listprinterstemplates, true).'</pre>';
@ -401,22 +414,23 @@ if ($mode == 'template' && $user->admin) {
if ($action == 'edittemplate' && $printer->listprinterstemplates[$line]['rowid'] == $templateid) {
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>';
print '<td><textarea name="template" wrap="soft" cols="120" rows="12">'.$printer->listprinterstemplates[$line]['template'].'</textarea>';
print '<td>';
print '<textarea name="template" wrap="soft" cols="120" rows="12">'.$printer->listprinterstemplates[$line]['template'].'</textarea>';
print '</td>';
print '<td></td>';
} else {
print '<td>'.$printer->listprinterstemplates[$line]['name'].'</td>';
print '<td>'.nl2br(htmlentities($printer->listprinterstemplates[$line]['template'])).'</td>';
// edit icon
print '<td><a class="editfielda paddingleftonly paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&amp;action=edittemplate&amp;templateid='.$printer->listprinterstemplates[$line]['rowid'].'">';
print '<td><a class="editfielda paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&amp;action=edittemplate&amp;templateid='.$printer->listprinterstemplates[$line]['rowid'].'">';
print img_picto($langs->trans("Edit"), 'edit');
print '</a>';
// delete icon
print '<a class="paddingleftonly paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&amp;action=deletetemplate&amp;templateid='.$printer->listprinterstemplates[$line]['rowid'].'&amp;templatename='.$printer->listprinterstemplates[$line]['name'].'">';
print '<a class="paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&amp;action=deletetemplate&amp;templateid='.$printer->listprinterstemplates[$line]['rowid'].'&amp;templatename='.$printer->listprinterstemplates[$line]['name'].'">';
print img_picto($langs->trans("Delete"), 'delete');
print '</a>';
// test icon
print '<a class="paddingleftonly paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&amp;action=testtemplate&amp;templateid='.$printer->listprinterstemplates[$line]['rowid'].'&amp;templatename='.$printer->listprinterstemplates[$line]['name'].'">';
print '<a class="paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&amp;action=testtemplate&amp;templateid='.$printer->listprinterstemplates[$line]['rowid'].'&amp;templatename='.$printer->listprinterstemplates[$line]['name'].'">';
print img_picto($langs->trans("TestPrinterTemplate"), 'printer');
print '</a></td>';
}
@ -424,20 +438,30 @@ if ($mode == 'template' && $user->admin) {
}
}
print '</table>';
if ($action != 'edittemplate') {
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
print '<tr>';
print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>';
print '<td><textarea name="template" wrap="soft" cols="120" rows="12">'.$printer->listprinterstemplates[$line]['template'].'</textarea>';
print '<td>';
print '<textarea name="template" wrap="soft" cols="120" rows="12">';
print GETPOSTISSET('template') ? GETPOST('template', 'alpha') : $printer->listprinterstemplates[$line]['template'];
print '</textarea>';
print '</td>';
print '<td></td>';
print '</tr>';
}
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
print '</table>';
if ($action != 'edittemplate') {
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
} else {
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
}
print '</form>';
dol_fiche_end();
print '<br>';
print '<table class="noborder centpercent">'."\n";

View File

@ -28,21 +28,27 @@ require '../../main.inc.php';
$langs->load("admin");
if (!$user->admin)
if (!$user->admin) {
accessforbidden();
}
$action = GETPOST('action', 'alpha');
if ($action == 'convert')
{
$sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." ENGINE=INNODB";
$sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." ENGINE=INNODB";
$db->query($sql);
}
if ($action == 'convertutf8')
{
$sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." CHARACTER SET utf8 COLLATE utf8_unicode_ci";
$db->query($sql);
$sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." CHARACTER SET utf8 COLLATE utf8_unicode_ci";
$db->query($sql);
}
if ($action == 'convertdynamic')
{
$sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." ROW_FORMAT=DYNAMIC;";
$db->query($sql);
}
@ -82,8 +88,8 @@ if (!$base)
} else {
if ($base == 1)
{
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("TableName").'</td>';
print '<td colspan="2">'.$langs->trans("Type").'</td>';
@ -112,13 +118,17 @@ if (!$base)
print '<td><a href="dbtable.php?table='.$obj->Name.'">'.$obj->Name.'</a></td>';
print '<td>'.$obj->Engine.'</td>';
if (isset($obj->Engine) && $obj->Engine == "MyISAM")
{
if (isset($obj->Engine) && $obj->Engine == "MyISAM") {
print '<td><a class="reposition" href="database-tables.php?action=convert&amp;table='.$obj->Name.'">'.$langs->trans("Convert").' InnoDb</a></td>';
} else {
print '<td>&nbsp;</td>';
}
print '<td>'.$obj->Row_format.'</td>';
print '<td>';
print $obj->Row_format;
if (isset($obj->Row_format) && (in_array($obj->Row_format, array("Compact")))) {
print '<br><a class="reposition" href="database-tables.php?action=convertdynamic&amp;table='.$obj->Name.'">'.$langs->trans("Convert").' Dynamic</a>';
}
print '</td>';
print '<td align="right">'.$obj->Rows.'</td>';
print '<td align="right">'.$obj->Avg_row_length.'</td>';
print '<td align="right">'.$obj->Data_length.'</td>';
@ -127,9 +137,8 @@ if (!$base)
print '<td align="right">'.$obj->Auto_increment.'</td>';
print '<td align="right">'.$obj->Check_time.'</td>';
print '<td align="right">'.$obj->Collation;
if (isset($obj->Collation) && (in_array($obj->Collation, array("utf8mb4_general_ci", "utf8mb4_unicode_ci", "latin1_swedish_ci"))))
{
print '<br><a class="reposition" href="database-tables.php?action=convertutf8&amp;table='.$obj->Name.'">'.$langs->trans("Convert").' UTF8</a>';
if (isset($obj->Collation) && (in_array($obj->Collation, array("utf8mb4_general_ci", "utf8mb4_unicode_ci", "latin1_swedish_ci")))) {
print '<br><a class="reposition" href="database-tables.php?action=convertutf8&amp;table='.$obj->Name.'">'.$langs->trans("Convert").' UTF8</a>';
}
print '</td>';
print '</tr>';
@ -142,8 +151,8 @@ if (!$base)
if ($base == 2)
{
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("TableName").'</td>';
print '<td>Nb of tuples</td>';
@ -182,8 +191,8 @@ if (!$base)
if ($base == 4)
{
// Sqlite by PDO or by Sqlite3
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("TableName").'</td>';
print '<td>'.$langs->trans("NbOfRecord").'</td>';

View File

@ -419,8 +419,10 @@ class Documents extends DolibarrApi
$object = new Product($this->db);
$result = $object->fetch($id, $ref);
if (!$result) {
if ($result==0) {
throw new RestException(404, 'Product not found');
} elseif ($result<0) {
throw new RestException(500, 'Error while fetching object: '.$object->error);
}
$upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref);
@ -630,7 +632,7 @@ class Documents extends DolibarrApi
}
elseif ($result < 0)
{
throw new RestException(500, 'Error while fetching object.');
throw new RestException(500, 'Error while fetching object: '.$object->error);
}
}

View File

@ -57,9 +57,11 @@ $thirdpartytmp = new Societe($db);
if (GETPOST('submitproduct') && GETPOST('submitproduct'))
{
$action = ''; // We reset because we don't want to build doc
if (GETPOST('productid') > 0)
{
$producttmp->fetch(GETPOST('productid'));
if (GETPOST('productid') > 0) {
$result = $producttmp->fetch(GETPOST('productid'));
if ($result < 0) {
setEventMessage($producttmp->error, 'errors');
}
$forbarcode = $producttmp->barcode;
$fk_barcode_type = $producttmp->barcode_type;

View File

@ -130,7 +130,7 @@ if ($object->id > 0)
// Object card
// ------------------------------------------------------------
$linkback = '<a href="'.dol_buildpath('/bom/myobject_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.dol_buildpath('/bom/bom_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
/*

View File

@ -929,6 +929,7 @@ class BOM extends CommonObject
global $conf, $langs;
$langs->load("mrp");
$outputlangs->load("products");
if (!dol_strlen($modele)) {
$modele = 'standard';
@ -1004,7 +1005,11 @@ class BOM extends CommonObject
foreach ($this->lines as &$line) {
$tmpproduct = new Product($this->db);
$tmpproduct->fetch($line->fk_product);
$result= $tmpproduct->fetch($line->fk_product);
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)

View File

@ -52,8 +52,15 @@ foreach ($linkedObjectBlock as $key => $objectlink)
}
echo '</td>';
echo '<td class="linkedcol-name nowraponall" >'.$objectlink->getNomUrl(1).'</td>';
$product_static->fetch($objectlink->fk_product);
echo '<td class="linkedcol-ref" align="center">'.$product_static->getNomUrl(1).'</td>';
echo '<td class="linkedcol-ref" align="center">';
$result=$product_static->fetch($objectlink->fk_product);
if ($result<0) {
setEventMessage($product_static->error, 'errors');
} elseif ($result>0) {
$product_static->getNomUrl(1);
}
print '</td>';
echo '<td class="linkedcol-date" align="center">'.dol_print_date($objectlink->date_creation, 'day').'</td>';
echo '<td class="linkedcol-amount right">';
if ($user->rights->commande->lire) {

View File

@ -145,6 +145,7 @@ if ($action == 'create')
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print load_fiche_titre($langs->trans("NewBookmark"));

View File

@ -154,7 +154,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create', '', !empty($user->rights->bookmark->creer));
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create&backtopage='.urlencode(DOL_URL_ROOT.'/bookmarks/list.php'), '', !empty($user->rights->bookmark->creer));
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bookmark', 0, $newcardbutton, '', $limit, 0, 0, 1);

View File

@ -1213,7 +1213,8 @@ class Categorie extends CommonObject
//print 'Result for id_categ='.$id_categ.' : '.$this->cats[$id_categ]['fullpath'].'<br>'."\n";
// We count number of _ to have level
$this->cats[$id_categ]['level'] = dol_strlen(preg_replace('/[^_]/i', '', $this->cats[$id_categ]['fullpath']));
$nbunderscore = substr_count($this->cats[$id_categ]['fullpath'], '_');
$this->cats[$id_categ]['level'] = ($nbunderscore ? $nbunderscore : null);
return;
}
@ -2009,4 +2010,25 @@ class Categorie extends CommonObject
return "";
}
}
/**
* Count all categories
*
* @return int Number of categories, -1 on error
*/
public function countNbOfCategories()
{
dol_syslog(get_class($this)."::count_all_categories", LOG_DEBUG);
$sql = "SELECT COUNT(rowid) FROM ".MAIN_DB_PREFIX."categorie";
$sql .= " WHERE entity IN (".getEntity('category').")";
$res = $this->db->query($sql);
if ($res) {
$obj = $this->db->fetch_object($res);
return $obj->count;
} else {
dol_print_error($this->db);
return -1;
}
}
}

View File

@ -9,6 +9,7 @@
* Copyright (C) 2013 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2020 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
@ -526,6 +527,7 @@ if ($object->id > 0)
print "</table>";
// Prospection level and status
if ($object->client == 2 || $object->client == 3)
{
print '<br>';
@ -533,12 +535,12 @@ if ($object->id > 0)
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Level of prospect
// Level of prospection
print '<tr><td class="titlefield nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('ProspectLevel');
print '<td>';
if ($action != 'editlevel' && $user->rights->societe->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editlevel&amp;socid='.$object->id.'">'.img_edit($langs->trans('Modify'), 1).'</a></td>';
if ($action != 'editlevel' && $user->rights->societe->creer) print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editlevel&amp;socid='.$object->id.'">'.img_edit($langs->trans('Modify'), 1).'</a></td>';
print '</tr></table>';
print '</td><td>';
if ($action == 'editlevel')
@ -550,17 +552,17 @@ if ($object->id > 0)
print "</td>";
print '</tr>';
// Status
// Status of prospection
$object->loadCacheOfProspStatus();
print '<tr><td>'.$langs->trans("StatusProsp").'</td><td>'.$object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']);
print ' &nbsp; &nbsp; ';
print '<div class="floatright">';
foreach ($object->cacheprospectstatus as $key => $val)
{
$titlealt = 'default';
if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt = $val['label'];
if ($object->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&stcomm='.$val['code'].'&action=setstcomm">'.img_action($titlealt, $val['code']).'</a>';
}
$titlealt = 'default';
if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt = $val['label'];
if ($object->stcomm_id != $val['id']) print '<a class="pictosubstatus reposition" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&stcomm='.$val['code'].'&action=setstcomm">'.img_action($titlealt, $val['code'], $val['picto']).'</a>';
}
print '</div></td></tr>';
print "</table>";
}
@ -1127,7 +1129,7 @@ if ($object->id > 0)
}
/*
* Last invoices
* Latest invoices
*/
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
{

View File

@ -3664,6 +3664,7 @@ class Propal extends CommonObject
global $conf, $langs;
$langs->load("propale");
$outputlangs->load("products");
if (!dol_strlen($modele)) {
$modele = 'azur';

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2020 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
@ -71,7 +72,7 @@ if (!empty($conf->propal->enabled))
*
*/
$sql = "SELECT count(*) as cc, st.libelle, st.id";
$sql = "SELECT count(*) as cc, st.libelle, st.picto, st.id";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."c_stcomm as st ";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -98,7 +99,7 @@ if ($resql)
print '<tr class="oddeven"><td>';
print '<a href="prospects.php?page=0&amp;stcomm='.$obj->id.'">';
print img_action($langs->trans("Show"), $obj->id).' ';
print img_action($langs->trans("Show"), $obj->id, $obj->picto).' ';
print $langs->trans("StatusProspect".$obj->id);
print '</a></td><td class="right">'.$obj->cc.'</td></tr>';
$i++;

View File

@ -3859,6 +3859,7 @@ class Commande extends CommonOrder
global $conf, $langs;
$langs->load("orders");
$outputlangs->load("products");
if (!dol_strlen($modele)) {
$modele = 'einstein';

View File

@ -116,7 +116,7 @@ $hookmanager->initHooks(array('orderlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label('commande');
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// List of fields to search into when doing a "search in all"

View File

@ -469,7 +469,7 @@ class Account extends CommonObject
* Add an entry into table ".MAIN_DB_PREFIX."bank
*
* @param int $date Date operation
* @param string $oper 1,2,3,4... (deprecated) or 'TYP','VIR','PRE','LIQ','VAD','CB','CHQ'...
* @param string $oper 'VIR','PRE','LIQ','VAD','CB','CHQ'...
* @param string $label Descripton
* @param float $amount Amount
* @param string $num_chq Numero cheque ou virement

View File

@ -4296,6 +4296,7 @@ class Facture extends CommonInvoice
global $conf, $langs;
$langs->load("bills");
$outputlangs->load("products");
if (!dol_strlen($modele))
{

View File

@ -108,7 +108,7 @@ $hookmanager->initHooks(array('invoicereclist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label('facture_rec');
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');

View File

@ -150,7 +150,7 @@ $hookmanager->initHooks(array('invoicelist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label('facture');
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
@ -830,12 +830,15 @@ if ($resql)
{
print '<td class="liste_titre center">';
print '<div class="nowrap">';
/*
print $langs->trans('From').' ';
print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1);
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to').' ';
print $langs->trans('to').' ';*/
print $langs->trans("Before").' ';
print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1);
print '<br><input type="checkbox" name="search_option" value="late"'.($option == 'late' ? ' checked' : '').'> '.$langs->trans("Alert");
print '</div>';
print '</td>';
}
@ -1442,7 +1445,7 @@ if ($resql)
{
$userstatic->id = $obj->fk_user_author;
$userstatic->login = $obj->login;
print '<td align="center">';
print '<td class="center tdoverflowmax100">';
if ($userstatic->id) print $userstatic->getLoginUrl(1);
else print '&nbsp;';
print "</td>\n";

View File

@ -68,7 +68,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
$thirdpartystatic = new Societe($db);
$invoicestatic = new Facture($db);
$invoicestatic = new FactureFournisseur($db);
$bprev = new BonPrelevement($db);
print '<div class="div-table-responsive-no-min">';

View File

@ -86,7 +86,11 @@ if (empty($reshook))
$res = $object->delete($user);
if ($res > 0)
{
header("Location: index.php");
if ($object->type == 'bank-transfer') {
header("Location: ".DOL_URL_ROOT.'/compta/paymentbybanktransfer/index.php');
} else {
header("Location: ".DOL_URL_ROOT.'/compta/prelevement/index.php');
}
exit;
}
}
@ -142,11 +146,9 @@ if (empty($reshook))
$dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$error = $object->set_infocredit($user, $dt);
if ($error)
{
header("Location: card.php?id=".$id."&error=$error");
exit;
setEventMessages($object->error, $object->errors, 'errors');
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -59,7 +59,7 @@ class LignePrelevement
$langs->load("withdrawals");
$this->statuts[0] = $langs->trans("StatusWaiting");
$this->statuts[2] = $langs->trans("StatusCredited");
$this->statuts[2] = $langs->trans("StatusPaid");
$this->statuts[3] = $langs->trans("StatusRefused");
}

View File

@ -88,11 +88,9 @@ if (empty($reshook))
// $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty (we don't use them anymore)
$result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate, 0, $type);
if ($result < 0)
{
if ($result < 0) {
setEventMessages($bprev->error, $bprev->errors, 'errors');
} elseif ($result == 0)
{
} elseif ($result == 0) {
$mesg = $langs->trans("NoInvoiceCouldBeWithdrawed", $format);
setEventMessages($mesg, null, 'errors');
$mesg .= '<br>'."\n";
@ -370,10 +368,15 @@ if ($resql)
// RUM
print '<td>';
print $thirdpartystatic->display_rib('rum');
$format = $thirdpartystatic->display_rib('format');
if ($type != 'bank-transfer') {
if ($format) print ' ('.$format.')';
$rumtoshow = $thirdpartystatic->display_rib('rum');
if ($rumtoshow) {
print $rumtoshow;
$format = $thirdpartystatic->display_rib('format');
if ($type != 'bank-transfer') {
if ($format) print ' ('.$format.')';
}
} else {
print img_warning($langs->trans("NoBankAccount"));
}
print '</td>';
// Amount

View File

@ -105,14 +105,17 @@ if ($type != 'bank-transfer') {
llxHeader('', $title);
$thirdpartystatic = new Societe($db);
$invoicestatic = new Facture($db);
if ($type == 'bank-transfer') {
$invoicestatic = new FactureFournisseur($db);
} else {
$invoicestatic = new Facture($db);
}
// List of requests
$sql = "SELECT f.ref, f.rowid, f.total_ttc,";
$sql .= " s.nom as name, s.rowid as socid,";
$sql .= " pfd.date_demande as date_demande,";
$sql .= " pfd.fk_user_demande";
$sql .= " pfd.date_demande as date_demande, pfd.amount, pfd.fk_user_demande";
if ($type != 'bank-transfer') {
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
} else {
@ -126,6 +129,7 @@ $sql .= " AND f.entity IN (".getEntity('invoice').")";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($socid) $sql .= " AND f.fk_soc = ".$socid;
if (!$status) $sql .= " AND pfd.traite = 0";
$sql .= " AND pfd.ext_payment_id IS NULL";
if ($status) $sql .= " AND pfd.traite = ".$status;
$sql .= " AND f.total_ttc > 0";
if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
@ -141,7 +145,6 @@ if ($search_facture) $sql .= natural_search("f.ref", $search_facture);
if ($search_societe) $sql .= natural_search("s.nom", $search_societe);
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
@ -173,9 +176,9 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
$newcardbutton = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/index.php">'.$langs->trans("Back").'</a>';
$newcardbutton = '<a class="marginrightonly" href="'.DOL_URL_ROOT.'/compta/prelevement/index.php">'.$langs->trans("Back").'</a>';
if ($type == 'bank-transfer') {
$newcardbutton = '<a href="'.DOL_URL_ROOT.'/compta/paymentbybanktransfer/index.php">'.$langs->trans("Back").'</a>';
$newcardbutton = '<a class="marginrightonly" href="'.DOL_URL_ROOT.'/compta/paymentbybanktransfer/index.php">'.$langs->trans("Back").'</a>';
}
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" id="searchFormList" name="searchFormList">';
@ -205,7 +208,7 @@ print '<table class="liste centpercent">';
print '<tr class="liste_titre">';
print_liste_field_titre("Bill", $_SERVER["PHP_SELF"]);
print_liste_field_titre("Company", $_SERVER["PHP_SELF"]);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'right ');
print_liste_field_titre("AmountRequested", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'right ');
print_liste_field_titre("DateRequest", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center ');
print_liste_field_titre('');
print '</tr>';
@ -228,12 +231,12 @@ while ($i < min($num, $limit))
$obj = $db->fetch_object($resql);
if (empty($obj)) break; // Should not happen
$invoicestatic->fetch($obj->rowid);
print '<tr class="oddeven">';
// Ref facture
print '<td>';
$invoicestatic->id = $obj->rowid;
$invoicestatic->ref = $obj->ref;
print $invoicestatic->getNomUrl(1, 'withdraw');
print '</td>';
@ -243,7 +246,9 @@ while ($i < min($num, $limit))
print $thirdpartystatic->getNomUrl(1, 'customer');
print '</td>';
print '<td class="right">'.price($obj->total_ttc).'</td>';
print '<td class="right">';
print price($obj->amount, 1, $langs, 1, -1, -1, $conf->currency).' / '.price($obj->total_ttc, 1, $langs, 1, -1, -1, $conf->currency);
print '</td>';
print '<td class="center">'.dol_print_date($db->jdate($obj->date_demande), 'day').'</td>';

View File

@ -105,7 +105,7 @@ if ($id > 0 || $ref)
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
print dol_print_date($object->date_trans, 'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getFullName($langs).'</td></tr>';
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
print $object->methodes_trans[$object->method_trans];
print '</td></tr>';
@ -158,7 +158,7 @@ if ($id > 0 || $ref)
// List of invoices
$sql = "SELECT pf.rowid,";
$sql = "SELECT pf.rowid, p.type,";
$sql .= " f.rowid as facid, f.ref as ref, f.total_ttc,";
$sql .= " s.rowid as socid, s.nom as name, pl.statut, pl.amount as amount_requested";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
@ -191,8 +191,8 @@ $sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
@ -202,10 +202,10 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$sql .= $db->plimit($limit + 1, $offset);
$result = $db->query($sql);
if ($result)
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($result);
$num = $db->num_rows($resql);
$i = 0;
$param = "&id=".$id;
@ -234,22 +234,28 @@ if ($result)
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("AmountInvoice", $_SERVER["PHP_SELF"], "f.total_ttc", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("AmountRequested", $_SERVER["PHP_SELF"], "pl.amount", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("StatusDebitCredit", $_SERVER["PHP_SELF"], "", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre('');
print "</tr>\n";
$totalinvoices = 0;
$totalamount_requested = 0;
$invoicetmpcustomer = new Facture($db);
$invoicetmpsupplier = new FactureFournisseur($db);
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
$obj = $db->fetch_object($resql);
$invoicetmp->id = $obj->facid;
$invoicetmp->ref = $obj->ref;
if ($obj->type == 'bank-transfer') {
$invoicetmp = $invoicetmpsupplier;
} else {
$invoicetmp = $invoicetmpcustomer;
}
$invoicetmp->fetch($obj->facid);
$thirdpartytmp->id = $obj->socid;
$thirdpartytmp->name = $obj->name;
$thirdpartytmp->fetch($obj->socid);
print '<tr class="oddeven">';
@ -270,14 +276,15 @@ if ($result)
// Status of requests
print '<td class="center">';
if ($obj->statut == 0)
{
if ($obj->statut == 0) {
print '-';
} elseif ($obj->statut == 2)
{
print $langs->trans("StatusCredited");
} elseif ($obj->statut == 3)
{
} elseif ($obj->statut == 2) {
if ($obj->type == 'bank-transfer') {
print $langs->trans("StatusDebited");
} else {
print $langs->trans("StatusCredited");
}
} elseif ($obj->statut == 3) {
print '<b>'.$langs->trans("StatusRefused").'</b>';
}

View File

@ -99,7 +99,7 @@ if ($prev_id > 0 || $ref)
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
print dol_print_date($object->date_trans, 'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getFullName($langs).'</td></tr>';
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
print $object->methodes_trans[$object->method_trans];
print '</td></tr>';
@ -230,7 +230,7 @@ if ($resql)
$i++;
}
} else {
print '<tr><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
print '<tr><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
if ($num > 0)

View File

@ -98,7 +98,7 @@ if ($prev_id > 0 || $ref)
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
print dol_print_date($object->date_trans, 'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getFullName($langs).'</td></tr>';
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
print $object->methodes_trans[$object->method_trans];
print '</td></tr>';

View File

@ -10,6 +10,7 @@
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2020 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
@ -458,6 +459,23 @@ if (empty($reshook))
}
}
if ($action == 'setprospectcontactlevel' && $user->rights->societe->contact->creer)
{
$object->fetch($id);
$object->fk_prospectlevel = GETPOST('prospect_contact_level_id', 'alpha');
$result = $object->update($object->id, $user);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
// set communication status
if ($action == 'setstcomm')
{
$object->fetch($id);
$object->stcomm_id = dol_getIdFromCode($db, GETPOST('stcomm', 'alpha'), 'c_stcommcontact');
$result = $object->update($object->id, $user);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
// Actions to send emails
$triggersendname = 'CONTACT_SENTBYMAIL';
$paramname = 'id';
@ -1333,8 +1351,51 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '</td></tr>';
print '</table>';
print '</div>';
$object->fetch_thirdparty();
if (! empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) {
if ($object->thirdparty->client == 2 || $object->thirdparty->client == 3)
{
print '<br>';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Level of prospect
print '<tr><td class="titlefield nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('ProspectLevel');
print '<td>';
if ($action != 'editlevel' && $user->rights->societe->contact->creer) print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editlevel&amp;id=' . $object->id . '">' . img_edit($langs->trans('Modify'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td>';
if ($action == 'editlevel') {
$formcompany->formProspectContactLevel($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_prospectlevel, 'prospect_contact_level_id', 1);
} else {
print $object->getLibProspLevel();
}
print "</td>";
print '</tr>';
// Status of prospection
$object->loadCacheOfProspStatus();
print '<tr><td>' . $langs->trans("StatusProsp") . '</td><td>' . $object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']);
print ' &nbsp; &nbsp; ';
print '<div class="floatright">';
foreach ($object->cacheprospectstatus as $key => $val) {
$titlealt = 'default';
if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt = $val['label'];
if ($object->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&stcomm=' . $val['code'] . '&action=setstcomm">' . img_action($titlealt, $val['code'], $val['picto']) . '</a>';
}
print '</div></td></tr>';
print "</table>";
print '</div>';
}
}
print '<div class="fichehalfright"><div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';

View File

@ -10,6 +10,7 @@
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2020 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
@ -89,6 +90,8 @@ class Contact extends CommonObject
'socialnetworks' =>array('type'=>'text', 'label'=>'SocialNetworks', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
'photo' =>array('type'=>'varchar(255)', 'label'=>'Photo', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
'priv' =>array('type'=>'smallint(6)', 'label'=>'Private', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>175),
'fk_stcomm' =>array('type'=>'integer', 'label'=>'Fk stcommcontact', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220),
'fk_prospectlevel' =>array('type'=>'varchar(12)', 'label'=>'ProspectLevel', 'enabled'=>1, 'visible'=>-1, 'position'=>255),
'no_email' =>array('type'=>'smallint(6)', 'label'=>'No email', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>180),
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
@ -209,6 +212,11 @@ class Contact extends CommonObject
public $roles = array();
public $cacheprospectstatus = array();
public $fk_prospectlevel;
public $stcomm_id;
public $statut_commercial;
public $stcomm_picto;
/**
* Constructor
@ -224,6 +232,10 @@ class Contact extends CommonObject
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0;
if (empty($conf->mailing->enabled)) $this->fields['no_email']['enabled'] = 0;
if (!empty($conf->global->SOCIETE_DISABLE_CONTACTS)) $this->fields['thirdparty']['enabled'] = 0;
if (empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) { // Default behaviour
$this->field['fk_stcomm']['enabled'] = 0;
$this->field['fk_prospectlevel']['enabled'] = 0;
}
$this->statut = 1; // By default, status is enabled
// Unset fields that are disabled
@ -328,6 +340,7 @@ class Contact extends CommonObject
$sql .= ", firstname";
$sql .= ", fk_user_creat";
$sql .= ", priv";
$sql.= ", fk_stcommcontact";
$sql .= ", statut";
$sql .= ", canvas";
$sql .= ", entity";
@ -341,6 +354,7 @@ class Contact extends CommonObject
$sql .= "'".$this->db->escape($this->firstname)."',";
$sql .= " ".($user->id > 0 ? "'".$this->db->escape($user->id)."'" : "null").",";
$sql .= " ".$this->db->escape($this->priv).",";
$sql.= " 0,";
$sql .= " ".$this->db->escape($this->statut).",";
$sql .= " ".(!empty($this->canvas) ? "'".$this->db->escape($this->canvas)."'" : "null").",";
$sql .= " ".$this->db->escape($this->entity).",";
@ -465,6 +479,11 @@ class Contact extends CommonObject
$sql .= ", phone_perso = ".(isset($this->phone_perso) ? "'".$this->db->escape($this->phone_perso)."'" : "null");
$sql .= ", phone_mobile = ".(isset($this->phone_mobile) ? "'".$this->db->escape($this->phone_mobile)."'" : "null");
$sql .= ", priv = '".$this->db->escape($this->priv)."'";
$sql .= ", fk_prospectcontactlevel = '".$this->db->escape($this->fk_prospectlevel)."'";
if (isset($this->stcomm_id))
{
$sql .= ", fk_stcommcontact = ".($this->stcomm_id > 0 || $this->stcomm_id == -1 ? $this->stcomm_id : "0");
}
$sql .= ", statut = ".$this->db->escape($this->statut);
$sql .= ", fk_user_modif=".($user->id > 0 ? "'".$this->db->escape($user->id)."'" : "NULL");
$sql .= ", default_lang=".($this->default_lang ? "'".$this->db->escape($this->default_lang)."'" : "NULL");
@ -818,6 +837,7 @@ class Contact extends CommonObject
$sql .= " c.socialnetworks,";
$sql .= " c.photo,";
$sql .= " c.priv, c.note_private, c.note_public, c.default_lang, c.canvas,";
$sql.= " c.fk_prospectcontactlevel, c.fk_stcommcontact, st.libelle as stcomm, st.picto as stcomm_picto,";
$sql .= " c.import_key,";
$sql .= " c.datec as date_creation, c.tms as date_modification,";
$sql .= " co.label as country, co.code as country_code,";
@ -829,6 +849,7 @@ class Contact extends CommonObject
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON c.fk_departement = d.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON c.rowid = u.fk_socpeople";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_stcommcontact as st ON c.fk_stcommcontact = st.id';
if ($id) $sql .= " WHERE c.rowid = ".$id;
else {
$sql .= " WHERE c.entity IN (".getEntity($this->element).")";
@ -884,6 +905,14 @@ class Contact extends CommonObject
$this->poste = $obj->poste;
$this->statut = $obj->statut;
$this->fk_prospectlevel = $obj->fk_prospectcontactlevel;
$transcode=$langs->trans('StatusProspect'.$obj->fk_stcommcontact);
$libelle=($transcode!='StatusProspect'.$obj->fk_stcommcontact?$transcode:$obj->stcomm);
$this->stcomm_id = $obj->fk_stcommcontact; // id statut commercial
$this->statut_commercial = $libelle; // libelle statut commercial
$this->stcomm_picto = $obj->stcomm_picto; // Picto statut commercial
$this->phone_pro = trim($obj->phone);
$this->fax = trim($obj->fax);
$this->phone_perso = trim($obj->phone_perso);
@ -1701,4 +1730,137 @@ class Contact extends CommonObject
return $error * -1;
}
}
/**
* Load array of prospect status
*
* @param int $active 1=Active only, 0=Not active only, -1=All
* @return int <0 if KO, >0 if OK
*/
public function loadCacheOfProspStatus($active = 1)
{
global $langs;
$sql = "SELECT id, code, libelle as label, picto FROM " . MAIN_DB_PREFIX . "c_stcommcontact";
if ($active >= 0) $sql .= " WHERE active = " . $active;
$resql = $this->db->query($sql);
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
$this->cacheprospectstatus[$obj->id] = array('id' => $obj->id, 'code' => $obj->code, 'label' => ($langs->trans("ST_" . strtoupper($obj->code)) == "ST_" . strtoupper($obj->code)) ? $obj->label : $langs->trans("ST_" . strtoupper($obj->code)), 'picto' => $obj->picto);
$i++;
}
return 1;
}
/**
* Return prostect level
*
* @return string Libelle
*/
public function getLibProspLevel()
{
return $this->libProspLevel($this->fk_prospectlevel);
}
/**
* Return label of prospect level
*
* @param int $fk_prospectlevel Prospect level
* @return string label of level
*/
public function libProspLevel($fk_prospectlevel)
{
global $langs;
$lib = $langs->trans("ProspectLevel" . $fk_prospectlevel);
// If lib not found in language file, we get label from cache/databse
if ($lib == $langs->trans("ProspectLevel" . $fk_prospectlevel))
{
$lib = $langs->getLabelFromKey($this->db, $fk_prospectlevel, 'c_prospectlevel', 'code', 'label');
}
return $lib;
}
/**
* Set prospect level
*
* @param User $user Utilisateur qui definie la remise
* @return int <0 if KO, >0 if OK
* @deprecated Use update function instead
*/
public function setProspectLevel(User $user)
{
return $this->update($this->id, $user);
}
/**
* Return status of prospect
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @param string $label Label to use for status for added status
* @return string Libelle
*/
public function getLibProspCommStatut($mode = 0, $label = '')
{
return $this->libProspCommStatut($this->stcomm_id, $mode, $label, $this->stcomm_picto);
}
/**
* Return label of a given status
*
* @param int|string $statut Id or code for prospection status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @param string $label Label to use for status for added status
* @param string $picto Name of image file to show ('filenew', ...)
* If no extension provided, we use '.png'. Image must be stored into theme/xxx/img directory.
* Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img
* Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)
* @return string Libelle du statut
*/
public function libProspCommStatut($statut, $mode = 0, $label = '', $picto = '')
{
global $langs;
$langs->load('customers');
if ($mode == 2)
{
if ($statut == '-1' || $statut == 'ST_NO') return img_action($langs->trans("StatusProspect-1"), -1, $picto) . ' ' . $langs->trans("StatusProspect-1");
elseif ($statut == '0' || $statut == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0, $picto) . ' ' . $langs->trans("StatusProspect0");
elseif ($statut == '1' || $statut == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1, $picto) . ' ' . $langs->trans("StatusProspect1");
elseif ($statut == '2' || $statut == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2, $picto) . ' ' . $langs->trans("StatusProspect2");
elseif ($statut == '3' || $statut == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3, $picto) . ' ' . $langs->trans("StatusProspect3");
else {
return img_action(($langs->trans("StatusProspect" . $statut) != "StatusProspect" . $statut) ? $langs->trans("StatusProspect" . $statut) : $label, 0, $picto) . ' ' . (($langs->trans("StatusProspect" . $statut) != "StatusProspect" . $statut) ? $langs->trans("StatusProspect" . $statut) : $label);
}
}
if ($mode == 3)
{
if ($statut == '-1' || $statut == 'ST_NO') return img_action($langs->trans("StatusProspect-1"), -1, $picto);
elseif ($statut == '0' || $statut == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0, $picto);
elseif ($statut == '1' || $statut == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1, $picto);
elseif ($statut == '2' || $statut == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2, $picto);
elseif ($statut == '3' || $statut == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3, $picto);
else {
return img_action(($langs->trans("StatusProspect" . $statut) != "StatusProspect" . $statut) ? $langs->trans("StatusProspect" . $statut) : $label, 0, $picto);
}
}
if ($mode == 4)
{
if ($statut == '-1' || $statut == 'ST_NO') return img_action($langs->trans("StatusProspect-1"), -1, $picto) . ' ' . $langs->trans("StatusProspect-1");
elseif ($statut == '0' || $statut == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0, $picto) . ' ' . $langs->trans("StatusProspect0");
elseif ($statut == '1' || $statut == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1, $picto) . ' ' . $langs->trans("StatusProspect1");
elseif ($statut == '2' || $statut == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2, $picto) . ' ' . $langs->trans("StatusProspect2");
elseif ($statut == '3' || $statut == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3, $picto) . ' ' . $langs->trans("StatusProspect3");
else {
return img_action(($langs->trans("StatusProspect" . $statut) != "StatusProspect" . $statut) ? $langs->trans("StatusProspect" . $statut) : $label, 0, $picto) . ' ' . (($langs->trans("StatusProspect" . $statut) != "StatusProspect" . $statut) ? $langs->trans("StatusProspect" . $statut) : $label);
}
}
return "Error, mode/status not found";
}
}

View File

@ -11,6 +11,7 @@
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2020 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
@ -91,6 +92,8 @@ $search_town = GETPOST('search_town', 'alpha');
$search_import_key = GETPOST("search_import_key", "alpha");
$search_country = GETPOST("search_country", 'intcomma');
$search_roles = GETPOST("search_roles", 'array');
$search_level = GETPOST("search_level", "array");
$search_stcomm = GETPOST('search_stcomm', 'int');
if ($search_status == '') $search_status = 1; // always display active customer first
@ -141,7 +144,7 @@ $hookmanager->initHooks(array('contactlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label('contact');
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
@ -181,6 +184,11 @@ $arrayfields = array(
'p.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
'p.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100),
);
if (! empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) {
$arrayfields['p.fk_prospectcontactlevel'] = array('label'=>"ProspectLevelShort", 'checked'=>1, 'position'=>210);
$arrayfields['p.fk_stcommcontact'] = array('label'=>"StatusProsp", 'checked'=>1, 'position'=>215);
}
if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) {
if ($value['active']) {
@ -256,6 +264,8 @@ if (empty($reshook))
}
}
$search_priv = "";
$search_stcomm='';
$search_level='';
$search_status = -1;
$search_categ = '';
$search_categ_thirdparty = '';
@ -273,6 +283,17 @@ if (empty($reshook))
$permissiontodelete = $user->rights->societe->supprimer;
$uploaddir = $conf->societe->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
if ($action == 'setstcomm')
{
$object = new Contact($db);
$result = $object->fetch(GETPOST('stcommcontactid'));
$object->stcomm_id = dol_getIdFromCode($db, GETPOST('stcomm', 'alpha'), 'c_stcommcontact');
$result = $object->update($object->id, $user);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
$action = '';
}
}
if ($search_priv < 0) $search_priv = '';
@ -287,12 +308,36 @@ $formother = new FormOther($db);
$formcompany = new FormCompany($db);
$contactstatic = new Contact($db);
if (! empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) {
$contactstatic->loadCacheOfProspStatus();
}
$title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
// Select every potentiels, and note each potentiels which fit in search parameters
$tab_level = array();
$sql = "SELECT code, label, sortorder";
$sql.= " FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel";
$sql.= " WHERE active > 0";
$sql.= " ORDER BY sortorder";
$resql = $db->query($sql);
if ($resql)
{
while ($obj = $db->fetch_object($resql))
{
// Compute level text
$level=$langs->trans($obj->code);
if ($level == $obj->code) $level=$langs->trans($obj->label);
$tab_level[$obj->code] = $level;
}
}
else dol_print_error($db);
$sql = "SELECT s.rowid as socid, s.nom as name,";
$sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.no_email,";
$sql .= " p.socialnetworks, p.photo,";
$sql .= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,";
$sql.= " st.libelle as stcomm, st.picto as stcomm_picto, p.fk_stcommcontact as stcomm_id, p.fk_prospectcontactlevel,";
$sql .= " co.label as country, co.code as country_code";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
@ -306,6 +351,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = p.fk_pays";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_stcommcontact as st ON st.id = p.fk_stcommcontact";
if (!empty($search_categ)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_contact as cc ON p.rowid = cc.fk_socpeople"; // We need this table joined to the select in order to filter by categ
if (!empty($search_categ_thirdparty)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
if (!empty($search_categ_supplier)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs2 ON s.rowid = cs2.fk_soc"; // We need this table joined to the select in order to filter by categ
@ -319,6 +365,8 @@ if (!empty($userid)) // propre au commercial
{
$sql .= " AND p.fk_user_creat=".$db->escape($userid);
}
if ($search_level) $sql .= natural_search("p.fk_prospectcontactlevel", join(',', $search_level), 3);
if ($search_stcomm != '' && $search_stcomm != -2) $sql .= natural_search("p.fk_stcommcontact", $search_stcomm, 2);
// Filter to exclude not owned private contacts
if ($search_priv != '0' && $search_priv != '1')
@ -461,8 +509,14 @@ if ($search_email != '') $param .= '&amp;search_email='.urlencode($search_email)
if ($search_no_email != '') $param .= '&amp;search_no_email='.urlencode($search_no_email);
if ($search_status != '') $param .= '&amp;search_status='.urlencode($search_status);
if ($search_priv == '0' || $search_priv == '1') $param .= "&amp;search_priv=".urlencode($search_priv);
if ($search_stcomm != '') $param.='&search_stcomm='.urlencode($search_stcomm);
if (is_array($search_level) && count($search_level)) {
foreach ($search_level as $slevel) {
$param.='&search_level[]='.urlencode($slevel);
}
}
if ($search_import_key != '') $param .= '&amp;search_import_key='.urlencode($search_import_key);
if ($optioncss != '') $param .= '&amp;optioncss='.$optioncss;
if ($optioncss != '') $param .= '&amp;optioncss='.urlencode($optioncss);
if (count($search_roles) > 0) $param .= implode('&search_roles[]=', $search_roles);
// Add $param from extra fields
@ -678,6 +732,25 @@ if (!empty($arrayfields['p.priv']['checked']))
print $form->selectarray('search_priv', $selectarray, $search_priv, 1);
print '</td>';
}
// Prospect level
if (! empty($arrayfields['p.fk_prospectcontactlevel']['checked']))
{
print '<td class="liste_titre center">';
print $form->multiselectarray('search_level', $tab_level, $search_level, 0, 0, 'width75', 0, 0, '', '', '', 2);
print '</td>';
}
// Prospect status
if (! empty($arrayfields['p.fk_stcommcontact']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone center">';
$arraystcomm=array();
foreach ($contactstatic->cacheprospectstatus as $key => $val)
{
$arraystcomm[$val['id']]=($langs->trans("StatusProspect".$val['id']) != "StatusProspect".$val['id'] ? $langs->trans("StatusProspect".$val['id']) : $val['label']);
}
print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2, 0, 0, '', 0, 0, 0, '', 'nowrap ');
print '</td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
@ -746,6 +819,8 @@ if (!empty($conf->socialnetworks->enabled)) {
}
if (!empty($arrayfields['p.thirdparty']['checked'])) print_liste_field_titre($arrayfields['p.thirdparty']['label'], $_SERVER["PHP_SELF"], "s.nom", $begin, $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['p.priv']['checked'])) print_liste_field_titre($arrayfields['p.priv']['label'], $_SERVER["PHP_SELF"], "p.priv", $begin, $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['p.fk_prospectcontactlevel']['checked'])) print_liste_field_titre($arrayfields['p.fk_prospectcontactlevel']['label'], $_SERVER["PHP_SELF"], "p.fk_prospectcontactlevel", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['p.fk_stcommcontact']['checked'])) print_liste_field_titre($arrayfields['p.fk_stcommcontact']['label'], $_SERVER["PHP_SELF"], "p.fk_stcommcontact", "", $param, '', $sortfield, $sortorder, 'center ');
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
@ -796,6 +871,8 @@ while ($i < min($num, $limit))
$contactstatic->country_code = $obj->country_code;
$contactstatic->photo = $obj->photo;
$contactstatic->fk_prospectlevel=$obj->fk_prospectcontactlevel;
print '<tr class="oddeven">';
// ID
@ -924,6 +1001,30 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['p.fk_prospectcontactlevel']['checked']))
{
// Prospect level
print '<td class="center">';
print $contactstatic->getLibProspLevel();
print "</td>";
if (!$i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['p.fk_stcommcontact']['checked']))
{
// Prospect status
print '<td class="center nowrap"><div class="nowrap">';
print '<div class="inline-block">' . $contactstatic->libProspCommStatut($obj->stcomm_id, 2, $contactstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
print '</div> - <div class="inline-block">';
foreach ($contactstatic->cacheprospectstatus as $key => $val) {
$titlealt = 'default';
if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt = $val['label'];
if ($obj->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="' . $_SERVER["PHP_SELF"] . '?stcommcontactid=' . $obj->rowid . '&stcomm=' . $val['code'] . '&action=setstcomm' . $param . ($page ? '&page=' . urlencode($page) : '') . '">' . img_action($titlealt, $val['code'], $val['picto']) . '</a>';
}
print '</div></div></td>';
if (!$i) $totalarray['nbfield']++;
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook

View File

@ -2393,6 +2393,7 @@ class Contrat extends CommonObject
global $conf, $langs;
$langs->load("contracts");
$outputlangs->load("products");
if (!dol_strlen($modele)) {
$modele = 'strato';

View File

@ -100,7 +100,7 @@ $hookmanager->initHooks(array('contractlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label('contrat');
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// List of fields to search into when doing a "search in all"

View File

@ -84,7 +84,7 @@ $hookmanager->initHooks(array('contractservicelist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label('contratdet');
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');

View File

@ -156,7 +156,7 @@ if ($action == 'update' && !empty($permissiontoadd))
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
$value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup
} elseif ($object->fields[$key]['type'] == 'boolean') {
$value = (GETPOST($key) == 'on' ? 1 : 0);
$value = ((GETPOST($key, 'aZ09') == 'on' || GETPOST($key, 'aZ09') == '1') ? 1 : 0);
} else {
$value = GETPOST($key, 'alpha');
}
@ -206,7 +206,7 @@ if ($action == "update_extras" && !empty($permissiontoadd))
$object->array_options['options_'.$attributekey] = dol_mktime(GETPOST($attributekeylong.'hour', 'int'), GETPOST($attributekeylong.'min', 'int'), GETPOST($attributekeylong.'sec', 'int'), GETPOST($attributekeylong.'month', 'int'), GETPOST($attributekeylong.'day', 'int'), GETPOST($attributekeylong.'year', 'int'));
//var_dump(dol_print_date($object->array_options['options_'.$attributekey]));exit;
} else {
$object->array_options['options_'.$attributekey] = GETPOST($attributekeylong, ' alpha');
$object->array_options['options_'.$attributekey] = GETPOST($attributekeylong, 'alpha');
}
$result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user);
@ -285,18 +285,20 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd)
// Define output language
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$model = $object->modelpdf;
$ret = $object->fetch($id); // Reload to get new records
if (method_exists($object, 'generateDocument')) {
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$model = $object->modelpdf;
$ret = $object->fetch($id); // Reload to get new records
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
}
} else {
setEventMessages($object->error, $object->errors, 'errors');

View File

@ -268,6 +268,28 @@ class CMailFile
}
}
$this->addr_to = $to;
$this->addr_cc = $addr_cc;
$this->addr_bcc = $addr_bcc;
$this->reply_to = $replyto;
$this->addr_from = $from;
$this->subject = $subject;
$this->errors_to = $errors_to;
$this->deliveryreceipt = $deliveryreceipt;
$this->trackid = $trackid;
if (!empty($conf->global->MAIN_MAIL_FORCE_SENDTO))
{
$this->addr_to = $conf->global->MAIN_MAIL_FORCE_SENDTO;
$this->addr_cc = '';
$this->addr_bcc = '';
}
// Add autocopy to (Note: Adding bcc for specific modules are also done from pages)
if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) {
$addr_bcc.=($addr_bcc?', ':'').$conf->global->MAIN_MAIL_AUTOCOPY_TO;
}
// We set all data according to choosed sending method.
// We also set a value for ->msgid
if ($this->sendmode == 'mail')
@ -327,16 +349,16 @@ class CMailFile
$smtps->setCharSet($conf->file->character_set_client);
// Encode subject if required.
$subjecttouse = $subject;
$subjecttouse = $this->subject;
if (!ascii_check($subjecttouse)) {
$subjecttouse = $this->encodetorfc2822($subjecttouse);
}
$smtps->setSubject($subjecttouse);
$smtps->setTO($this->getValidAddress($to, 0, 1));
$smtps->setFrom($this->getValidAddress($from, 0, 1));
$smtps->setTrackId($trackid);
$smtps->setReplyTo($this->getValidAddress($replyto, 0, 1));
$smtps->setTO($this->getValidAddress($this->to, 0, 1));
$smtps->setFrom($this->getValidAddress($this->from, 0, 1));
$smtps->setTrackId($this->trackid);
$smtps->setReplyTo($this->getValidAddress($this->replyto, 0, 1));
if (!empty($moreinheader)) $smtps->setMoreInHeader($moreinheader);
@ -374,17 +396,16 @@ class CMailFile
}
}
$smtps->setCC($addr_cc);
$smtps->setBCC($addr_bcc);
$smtps->setErrorsTo($errors_to);
$smtps->setDeliveryReceipt($deliveryreceipt);
$smtps->setCC($this->addr_cc);
$smtps->setBCC($this->addr_bcc);
$smtps->setErrorsTo($this->errors_to);
$smtps->setDeliveryReceipt($this->deliveryreceipt);
$host = dol_getprefix('email');
$this->msgid = time().'.SMTPs-dolibarr-'.$trackid.'@'.$host;
$this->smtps = $smtps;
} elseif ($this->sendmode == 'swiftmailer')
{
} elseif ($this->sendmode == 'swiftmailer') {
// Use Swift Mailer library
$host = dol_getprefix('email');
@ -401,8 +422,8 @@ class CMailFile
//$this->message = new Swift_SignedMessage();
// Adding a trackid header to a message
$headers = $this->message->getHeaders();
$headers->addTextHeader('X-Dolibarr-TRACKID', $trackid.'@'.$host);
$this->msgid = time().'.swiftmailer-dolibarr-'.$trackid.'@'.$host;
$headers->addTextHeader('X-Dolibarr-TRACKID', $this->trackid.'@'.$host);
$this->msgid = time().'.swiftmailer-dolibarr-'.$this->trackid.'@'.$host;
$headerID = $this->msgid;
$msgid = $headers->get('Message-ID');
$msgid->setId($headerID);
@ -411,14 +432,14 @@ class CMailFile
// Give the message a subject
try {
$result = $this->message->setSubject($subject);
$result = $this->message->setSubject($this->subject);
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
// Set the From address with an associative array
//$this->message->setFrom(array('john@doe.com' => 'John Doe'));
if (!empty($from)) {
if (! empty($this->addr_from)) {
try {
if (! empty($conf->global->MAIN_FORCE_DISABLE_MAIL_SPOOFING)) {
// Prevent email spoofing for smtp server with a strict configuration
@ -429,10 +450,10 @@ class CMailFile
{
$result = $this->message->setFrom($conf->global->MAIN_MAIL_SMTPS_ID);
} else {
$result = $this->message->setFrom($this->getArrayAddress($from));
$result = $this->message->setFrom($this->getArrayAddress($this->addr_from));
}
} else {
$result = $this->message->setFrom($this->getArrayAddress($from));
$result = $this->message->setFrom($this->getArrayAddress($this->addr_from));
}
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
@ -440,17 +461,17 @@ class CMailFile
}
// Set the To addresses with an associative array
if (!empty($to)) {
if (! empty($this->addr_to)) {
try {
$result = $this->message->setTo($this->getArrayAddress($to));
$result = $this->message->setTo($this->getArrayAddress($this->addr_to));
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
}
if (!empty($replyto)) {
if (! empty($this->reply_to)) {
try {
$result = $this->message->SetReplyTo($this->getArrayAddress($replyto));
$result = $this->message->SetReplyTo($this->getArrayAddress($this->reply_to));
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
@ -504,10 +525,10 @@ class CMailFile
}
}
if (!empty($addr_cc)) $this->message->setCc($this->getArrayAddress($addr_cc));
if (!empty($addr_bcc)) $this->message->setBcc($this->getArrayAddress($addr_bcc));
if (! empty($this->addr_cc)) $this->message->setCc($this->getArrayAddress($this->addr_cc));
if (! empty($this->addr_bcc)) $this->message->setBcc($this->getArrayAddress($this->addr_bcc));
//if (! empty($errors_to)) $this->message->setErrorsTo($this->getArrayAddress($errors_to);
if (isset($deliveryreceipt) && $deliveryreceipt == 1) $this->message->setReadReceiptTo($this->getArrayAddress($from));
if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) $this->message->setReadReceiptTo($this->getArrayAddress($this->addr_from));
} else {
// Send mail method not correctly defined
// --------------------------------------
@ -624,13 +645,6 @@ class CMailFile
$keyforstarttls = 'MAIN_MAIL_EMAIL_STARTTLS_EMAILING';
}
if (!empty($conf->global->MAIN_MAIL_FORCE_SENDTO))
{
$this->addr_to = $conf->global->MAIN_MAIL_FORCE_SENDTO;
$this->addr_cc = '';
$this->addr_bcc = '';
}
// Action according to choosed sending method
if ($this->sendmode == 'mail')
{

View File

@ -2847,12 +2847,14 @@ abstract class CommonObject
dol_syslog(get_class($this)."::update_note Parameter suffix must be empty, '_private' or '_public'", LOG_ERR);
return -2;
}
$newsuffix = $suffix;
// Special cas
//var_dump($this->table_element);exit;
if ($this->table_element == 'product') $suffix = '';
if ($this->table_element == 'product' && $newsuffix == '_private') $newsuffix = '';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= " SET note".$suffix." = ".(!empty($note) ? ("'".$this->db->escape($note)."'") : "NULL");
$sql .= " SET note".$newsuffix." = ".(!empty($note) ? ("'".$this->db->escape($note)."'") : "NULL");
$sql .= " ,".(in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment')) ? "fk_user_mod" : "fk_user_modif")." = ".$user->id;
$sql .= " WHERE rowid =".$this->id;
@ -5309,11 +5311,12 @@ abstract class CommonObject
$new_array_options[$key] = null;
}
break;
case 'double':
case 'price':
case 'double':
$value = price2num($value);
if (!is_numeric($value) && $value != '')
{
dol_syslog($langs->trans("ExtraFieldHasWrongValue")." sur ".$attributeLabel."(".$value."is not '".$attributeType."')", LOG_DEBUG);
dol_syslog($langs->trans("ExtraFieldHasWrongValue")." for ".$attributeLabel."(".$value."is not '".$attributeType."')", LOG_DEBUG);
$this->errors[] = $langs->trans("ExtraFieldHasWrongValue", $attributeLabel);
return -1;
} elseif ($value == '')
@ -5361,9 +5364,6 @@ abstract class CommonObject
$new_array_options[$key] = $this->array_options[$key];
}
break;
case 'price':
$new_array_options[$key] = price2num($this->array_options[$key]);
break;
case 'date':
case 'datetime':
// If data is a string instead of a timestamp, we convert it
@ -5455,7 +5455,7 @@ abstract class CommonObject
{
if (!isset($extrafields->attributes[$this->table_element]['type'][$tmpkey])) // If field not already added previously
{
if (in_array($tmpval, array('int', 'double'))) $sql .= ", 0";
if (in_array($tmpval, array('int', 'double', 'price'))) $sql .= ", 0";
else $sql .= ", ''";
}
}
@ -6731,7 +6731,7 @@ abstract class CommonObject
if (is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label']) > 0)
{
$out .= "\n";
$out .= '<!-- showOptionalsInput --> ';
$out .= '<!-- showOptionals --> ';
$out .= "\n";
$extrafields_collapse_num = '';
@ -6865,7 +6865,7 @@ abstract class CommonObject
// HTML, select, integer and text add default value
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'select', 'int')))
{
if ($action == 'create') $value = $extrafields->attributes[$this->table_element]['default'][$key];
if ($action == 'create') $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) ? GETPOST($keyprefix.'options_'.$key.$keysuffix, 'none', 3) : $extrafields->attributes[$this->table_element]['default'][$key];
else $value = $this->array_options['options_'.$key];
}
@ -6951,7 +6951,7 @@ abstract class CommonObject
</script>'."\n";
}
$out .= '<!-- /showOptionalsInput --> '."\n";
$out .= '<!-- /showOptionals --> '."\n";
}
}
@ -7618,11 +7618,11 @@ abstract class CommonObject
if (array_key_exists('ref', $fieldvalues)) $fieldvalues['ref'] = dol_string_nospecial($fieldvalues['ref']); // If field is a ref, we sanitize data
$keys = array();
$values = array();
$values = array(); // Array to store string forged for SQL syntax
foreach ($fieldvalues as $k => $v) {
$keys[$k] = $k;
$value = $this->fields[$k];
$values[$k] = $this->quote($v, $value);
$values[$k] = $this->quote($v, $value); // May return string 'NULL' if $value is null
}
// Clean and check mandatory
@ -7632,8 +7632,7 @@ abstract class CommonObject
if (preg_match('/^integer:/i', $this->fields[$key]['type']) && $values[$key] == '-1') $values[$key] = '';
if (!empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key] = '';
//var_dump($key.'-'.$values[$key].'-'.($this->fields[$key]['notnull'] == 1));
if (isset($this->fields[$key]['notnull']) && $this->fields[$key]['notnull'] == 1 && !isset($values[$key]) && is_null($this->fields[$key]['default']))
if (isset($this->fields[$key]['notnull']) && $this->fields[$key]['notnull'] == 1 && (!isset($values[$key]) || $values[$key] === 'NULL') && is_null($this->fields[$key]['default']))
{
$error++;
$this->errors[] = $langs->trans("ErrorFieldRequired", $this->fields[$key]['label']);

View File

@ -50,6 +50,16 @@ abstract class CommonObjectLine extends CommonObject
public $fk_unit;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
$this->db = $db;
}
/**
* Returns the translation key from units dictionary.
* A langs->trans() must be called on result to get translated value.
@ -74,12 +84,12 @@ abstract class CommonObjectLine extends CommonObject
$label_type = 'short_label';
}
$sql = 'select '.$label_type.' from '.MAIN_DB_PREFIX.'c_units where rowid='.$this->fk_unit;
$sql = 'select '.$label_type.',code from '.MAIN_DB_PREFIX.'c_units where rowid='.$this->fk_unit;
$resql = $this->db->query($sql);
if ($resql && $this->db->num_rows($resql) > 0)
{
$res = $this->db->fetch_array($resql);
$label = $res[$label_type];
$label = ($label_type == 'short' ? $res[$label_type] : 'unit'.$res['code']);
$this->db->free($resql);
return $label;
} else {

View File

@ -467,6 +467,26 @@ class dolReceiptPrinter extends Printer
return $error;
}
/**
* Function to delete a printer template in db
*
* @param int $templateid Template ID
* @return int 0 if OK; >0 if KO
*/
public function deleteTemplate($templateid)
{
global $conf;
$error = 0;
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'printer_receipt_template';
$sql .= " WHERE rowid = ".((int) $this->db->escape($templateid));
$sql .= " AND entity = ".$conf->entity;
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = $this->db->lasterror;
}
return $error;
}
/**
* Function to Update a printer template in db

View File

@ -154,8 +154,8 @@ class ExtraFields
public static $type2label = array(
'varchar'=>'String',
'text'=>'TextLong',
'varchar'=>'String1Line',
'text'=>'TextLongNLines',
'html'=>'HtmlText',
'int'=>'Int',
'double'=>'Float',
@ -807,7 +807,7 @@ class ExtraFields
/**
* Load array this->attributes, or old this->attribute_xxx like attribute_label, attribute_type, ...
*
* @param string $elementtype Type of element ('' = all, 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
* @param string $elementtype Type of element ('' = all or $object->table_element like 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
* @param boolean $forceload Force load of extra fields whatever is status of cache.
* @return array Array of attributes keys+label for all extra fields.
*/
@ -821,6 +821,7 @@ class ExtraFields
if ($elementtype == 'thirdparty') $elementtype = 'societe';
if ($elementtype == 'contact') $elementtype = 'socpeople';
if ($elementtype == 'order_supplier') $elementtype = 'commande_fournisseur';
if ($elementtype == 'stock_mouvement') $elementtype = 'movement';
$array_name_label = array();
@ -2025,6 +2026,8 @@ class ExtraFields
$value_key = price2num($value_arr);
} elseif (in_array($key_type, array('html'))) {
$value_key = GETPOST("options_".$key, 'alpha');
} elseif (in_array($key_type, array('text'))) {
$value_key = GETPOST("options_".$key, 'alphanohtml');
} else {
$value_key = GETPOST("options_".$key);
if (in_array($key_type, array('link')) && $value_key == '-1') $value_key = '';

View File

@ -2641,9 +2641,9 @@ class Form
$outval .= ' - '.$langs->transnoentities("VirtualStock").':';
if ($virtualstock > 0) {
$outval .= ' - <span class="product_line_stock_ok">';
$outval .= '<span class="product_line_stock_ok">';
} elseif ($virtualstock <= 0) {
$outval .= ' - <span class="product_line_stock_too_low">';
$outval .= '<span class="product_line_stock_too_low">';
}
$outval .= $virtualstock;
$outval .= '</span>';

View File

@ -3,6 +3,7 @@
* Copyright (C) 2008-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2020 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
@ -172,6 +173,58 @@ class FormCompany extends Form
print '</form>';
}
/**
* Affiche formulaire de selection des niveau de prospection pour les contacts
*
* @param int $page Page
* @param int $selected Id or code preselected
* @param string $htmlname Nom du formulaire select
* @param int $empty Add empty value in list
* @return void
*/
public function formProspectContactLevel($page, $selected = '', $htmlname = 'prospect_contact_level_id', $empty = 0)
{
global $user, $langs;
print '<form method="post" action="' . $page . '">';
print '<input type="hidden" name="action" value="setprospectcontactlevel">';
print '<input type="hidden" name="token" value="' . newToken() . '">';
dol_syslog(__METHOD__, LOG_DEBUG);
$sql = "SELECT code, label";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_prospectcontactlevel";
$sql .= " WHERE active > 0";
$sql .= " ORDER BY sortorder";
$resql = $this->db->query($sql);
if ($resql)
{
$options = array();
if ($empty)
{
$options[''] = '';
}
while ($obj = $this->db->fetch_object($resql))
{
$level = $langs->trans($obj->code);
if ($level == $obj->code)
{
$level = $langs->trans($obj->label);
}
$options[$obj->code] = $level;
}
print Form::selectarray($htmlname, $options, $selected);
}
else dol_print_error($this->db);
if (!empty($htmlname) && $user->admin) print ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
print '</form>';
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns the drop-down list of departments/provinces/cantons for all countries or for a given country.

View File

@ -539,7 +539,10 @@ class Translate
{
global $conf, $db;
if (!is_string($key)) return 'ErrorBadValueForParamNotAString'; // Avoid multiple errors with code not using function correctly.
if (!is_string($key)) {
//xdebug_print_function_stack('ErrorBadValueForParamNotAString');
return 'ErrorBadValueForParamNotAString'; // Avoid multiple errors with code not using function correctly.
}
$newstr = $key;
if (preg_match('/^Civility([0-9A-Z]+)$/i', $key, $reg))

View File

@ -15,6 +15,7 @@
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Thibault Foucart <support@ptibogxiv.net>
* Copyright (C) 2020 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
@ -591,7 +592,7 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals
$out = str_replace(array('"', '../'), '', trim($out));
$out = dol_string_nohtmltag($out, 1);
$out = dol_string_nohtmltag($out, 0);
}
break;
case 'restricthtml': // Recommended for most html textarea
@ -3012,7 +3013,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
'accountancy', 'address', 'bank_account', 'barcode', 'bank', 'bill', 'bookmark', 'bom', 'building',
'cash-register', 'category', 'check', 'clock', 'close_title', 'company', 'contact', 'contract', 'cubes',
'delete', 'dolly', 'dollyrevert', 'edit', 'ellipsis-h', 'external-link-alt', 'external-link-square-alt',
'delete', 'dolly', 'dollyrevert', 'edit', 'ellipsis-h', 'email', 'external-link-alt', 'external-link-square-alt',
'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title', 'help',
'intervention', 'label', 'language', 'list', 'listlight', 'lot',
'map-marker-alt', 'money-bill-alt', 'mrp', 'note',
@ -3306,9 +3307,14 @@ function img_picto_common($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0
*
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param string $numaction Action id or code to show
* @param string $picto Name of image file to show ('filenew', ...)
* If no extension provided, we use '.png'. Image must be stored into theme/xxx/img directory.
* Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img
* Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)
* @return string Return an img tag
*/
function img_action($titlealt, $numaction)
function img_action($titlealt, $numaction, $picto = '')
{
global $langs;
@ -3336,7 +3342,7 @@ function img_action($titlealt, $numaction)
}
if (!is_numeric($numaction)) $numaction = 0;
return img_picto($titlealt, 'stcomm'.$numaction.'.png');
return img_picto($titlealt, !empty($picto) ? $picto : 'stcomm'.$numaction.'.png');
}
/**
@ -5465,7 +5471,7 @@ function picto_required()
* @param integer $strip_tags 0=Use internal strip, 1=Use strip_tags() php function (bugged when text contains a < char that is not for a html tag)
* @return string String cleaned
*
* @see dol_escape_htmltag() strip_tags() dol_string_onlythesehtmltags() dol_string_neverthesehtmltags()
* @see dol_escape_htmltag() strip_tags() dol_string_onlythesehtmltags() dol_string_neverthesehtmltags(), dolStripPhpCode()
*/
function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto = 'UTF-8', $strip_tags = 0)
{
@ -5501,12 +5507,13 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto =
* Clean a string to keep only desirable HTML tags.
*
* @param string $stringtoclean String to clean
* @param string $cleanalsosomestyles Clean also some tags
* @param boolean $cleanalsosomestyles Remove absolute/fixed positioning from inline styles
* @param boolean $removeclassattribute Remove the class attribute from tags
* @return string String cleaned
*
* @see dol_escape_htmltag() strip_tags() dol_string_nohtmltag() dol_string_neverthesehtmltags()
*/
function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1)
function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1, $removeclassattribute = 1)
{
$allowed_tags = array(
"html", "head", "meta", "body", "article", "a", "abbr", "b", "blockquote", "br", "cite", "div", "dl", "dd", "dt", "em", "font", "img", "ins", "hr", "i", "li", "link",
@ -5518,7 +5525,10 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1)
$allowed_tags_string = '<'.$allowed_tags_string.'>';
if ($cleanalsosomestyles) {
$stringtoclean = preg_replace('/position\s*:\s*(absolute|fixed)\s*!\s*important/', '', $stringtoclean); // Note: If hacker try to introduce css comment into string to bypass this regex, the string must also be encoded by the dol_htmlentitiesbr during output so it become harmless
$stringtoclean = preg_replace('/position\s*:\s*(absolute|fixed)\s*!\s*important/i', '', $stringtoclean); // Note: If hacker try to introduce css comment into string to bypass this regex, the string must also be encoded by the dol_htmlentitiesbr during output so it become harmless
}
if ($removeclassattribute) {
$stringtoclean = preg_replace('/(<[^>]+)\s+class=((["\']).*?\\3|\\w*)/i', '\\1', $stringtoclean);
}
$temp = strip_tags($stringtoclean, $allowed_tags_string);
@ -8215,14 +8225,13 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
}
// TODO : add a hook
if ($displayMode == 0) {
$return = !empty($html) ? $html : $statusLabel;
$return = !empty($html) ? $html : (empty($conf->dol_optimize_smallscreen) ? $statusLabel : (empty($statusLabelShort) ? $statusLabel : $statusLabelShort));
} elseif ($displayMode == 1) {
$return = !empty($html) ? $html : (!empty($statusLabelShort) ? $statusLabelShort : $statusLabel);
$return = !empty($html) ? $html : (empty($statusLabelShort) ? $statusLabel : $statusLabelShort);
} // Use status with images (for backward compatibility)
elseif (!empty($conf->global->MAIN_STATUS_USES_IMAGES)) {
$return = '';
$return = '';
$htmlLabel = (in_array($displayMode, array(1, 2, 5)) ? '<span class="hideonsmartphone">' : '').(!empty($html) ? $html : $statusLabel).(in_array($displayMode, array(1, 2, 5)) ? '</span>' : '');
$htmlLabelShort = (in_array($displayMode, array(1, 2, 5)) ? '<span class="hideonsmartphone">' : '').(!empty($html) ? $html : (!empty($statusLabelShort) ? $statusLabelShort : $statusLabel)).(in_array($displayMode, array(1, 2, 5)) ? '</span>' : '');
@ -8267,17 +8276,17 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
}
} // Use new badge
elseif (empty($conf->global->MAIN_STATUS_USES_IMAGES) && !empty($displayMode)) {
$statusLabelShort = !empty($statusLabelShort) ? $statusLabelShort : $statusLabel;
$statusLabelShort = (empty($statusLabelShort) ? $statusLabel : $statusLabelShort);
$dolGetBadgeParams['attr']['class'] = 'badge-status';
$dolGetBadgeParams['attr']['title'] = $statusLabel;
if ($displayMode == 3) {
$return = dolGetBadge($statusLabel, '', $statusType, 'dot', $url, $dolGetBadgeParams);
$return = dolGetBadge((empty($conf->dol_optimize_smallscreen) ? $statusLabel : (empty($statusLabelShort) ? $statusLabel : $statusLabelShort)), '', $statusType, 'dot', $url, $dolGetBadgeParams);
} elseif ($displayMode === 5) {
$return = dolGetBadge($statusLabelShort, $html, $statusType, '', $url, $dolGetBadgeParams);
} else {
$return = dolGetBadge($statusLabel, $html, $statusType, '', $url, $dolGetBadgeParams);
$return = dolGetBadge((empty($conf->dol_optimize_smallscreen) ? $statusLabel : (empty($statusLabelShort) ? $statusLabel : $statusLabelShort)), $html, $statusType, '', $url, $dolGetBadgeParams);
}
}

View File

@ -24,23 +24,23 @@
/**
* Function to return number in text.
* Function to return a number into a text.
* May use module NUMBERWORDS if found.
*
* @param float $num Number to convert
* @param float $num Number to convert (must be a numeric value, like reported by price2num())
* @param Translate $langs Language
* @param boolean $currency 0=number to translate | 1=currency to translate
* @param boolean $centimes 0=no centimes | 1=centimes to translate
* @param boolean $centimes 0=no cents/centimes | 1=there is cents/centimes to translate
* @return string|false Text of the number
*/
function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
{
global $conf;
$num = str_replace(array(',', ' '), '', trim($num));
if (!$num) {
return false;
}
//$num = str_replace(array(',', ' '), '', trim($num)); This should be useless since $num MUST be a php numeric value
if (!$num) {
return false;
}
if ($centimes && strlen($num) == 1) {
$num = $num * 10;
@ -57,78 +57,79 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
return $concatWords;
} else {
$TNum = explode('.', $num);
$num = (int) $TNum[0];
$words = array();
$list1 = array(
'',
$langs->transnoentitiesnoconv('one'),
$langs->transnoentitiesnoconv('two'),
$langs->transnoentitiesnoconv('three'),
$langs->transnoentitiesnoconv('four'),
$langs->transnoentitiesnoconv('five'),
$langs->transnoentitiesnoconv('six'),
$langs->transnoentitiesnoconv('seven'),
$langs->transnoentitiesnoconv('eight'),
$langs->transnoentitiesnoconv('nine'),
$langs->transnoentitiesnoconv('ten'),
$langs->transnoentitiesnoconv('eleven'),
$langs->transnoentitiesnoconv('twelve'),
$langs->transnoentitiesnoconv('thirteen'),
$langs->transnoentitiesnoconv('fourteen'),
$langs->transnoentitiesnoconv('fifteen'),
$langs->transnoentitiesnoconv('sixteen'),
$langs->transnoentitiesnoconv('seventeen'),
$langs->transnoentitiesnoconv('eighteen'),
$langs->transnoentitiesnoconv('nineteen')
);
$list2 = array(
'',
$langs->transnoentitiesnoconv('ten'),
$langs->transnoentitiesnoconv('twenty'),
$langs->transnoentitiesnoconv('thirty'),
$langs->transnoentitiesnoconv('forty'),
$langs->transnoentitiesnoconv('fifty'),
$langs->transnoentitiesnoconv('sixty'),
$langs->transnoentitiesnoconv('seventy'),
$langs->transnoentitiesnoconv('eighty'),
$langs->transnoentitiesnoconv('ninety'),
$langs->transnoentitiesnoconv('hundred')
);
$list3 = array(
'',
$langs->transnoentitiesnoconv('thousand'),
$langs->transnoentitiesnoconv('million'),
$langs->transnoentitiesnoconv('billion'),
$langs->transnoentitiesnoconv('trillion'),
$langs->transnoentitiesnoconv('quadrillion')
);
$num_length = strlen($num);
$levels = (int) (($num_length + 2) / 3);
$max_length = $levels * 3;
$num = substr('00'.$num, -$max_length);
$num_levels = str_split($num, 3);
$nboflevels = count($num_levels);
for ($i = 0; $i < $nboflevels; $i++) {
$levels--;
$hundreds = (int) ($num_levels[$i] / 100);
$hundreds = ($hundreds ? ' '.$list1[$hundreds].' '.$langs->transnoentities('hundred').($hundreds == 1 ? '' : 's').' ' : '');
$tens = (int) ($num_levels[$i] % 100);
$singles = '';
if ($tens < 20) {
$tens = ($tens ? ' '.$list1[$tens].' ' : '');
} else {
$tens = (int) ($tens / 10);
$tens = ' '.$list2[$tens].' ';
$singles = (int) ($num_levels[$i] % 10);
$singles = ' '.$list1[$singles].' ';
}
$words[] = $hundreds.$tens.$singles.(($levels && (int) ($num_levels[$i])) ? ' '.$list3[$levels].' ' : '');
} //end for loop
$commas = count($words);
if ($commas > 1) {
$commas = $commas - 1;
}
$num = (int) $TNum[0];
$words = array();
$list1 = array(
'',
$langs->transnoentitiesnoconv('one'),
$langs->transnoentitiesnoconv('two'),
$langs->transnoentitiesnoconv('three'),
$langs->transnoentitiesnoconv('four'),
$langs->transnoentitiesnoconv('five'),
$langs->transnoentitiesnoconv('six'),
$langs->transnoentitiesnoconv('seven'),
$langs->transnoentitiesnoconv('eight'),
$langs->transnoentitiesnoconv('nine'),
$langs->transnoentitiesnoconv('ten'),
$langs->transnoentitiesnoconv('eleven'),
$langs->transnoentitiesnoconv('twelve'),
$langs->transnoentitiesnoconv('thirteen'),
$langs->transnoentitiesnoconv('fourteen'),
$langs->transnoentitiesnoconv('fifteen'),
$langs->transnoentitiesnoconv('sixteen'),
$langs->transnoentitiesnoconv('seventeen'),
$langs->transnoentitiesnoconv('eighteen'),
$langs->transnoentitiesnoconv('nineteen')
);
$list2 = array(
'',
$langs->transnoentitiesnoconv('ten'),
$langs->transnoentitiesnoconv('twenty'),
$langs->transnoentitiesnoconv('thirty'),
$langs->transnoentitiesnoconv('forty'),
$langs->transnoentitiesnoconv('fifty'),
$langs->transnoentitiesnoconv('sixty'),
$langs->transnoentitiesnoconv('seventy'),
$langs->transnoentitiesnoconv('eighty'),
$langs->transnoentitiesnoconv('ninety'),
$langs->transnoentitiesnoconv('hundred')
);
$list3 = array(
'',
$langs->transnoentitiesnoconv('thousand'),
$langs->transnoentitiesnoconv('million'),
$langs->transnoentitiesnoconv('billion'),
$langs->transnoentitiesnoconv('trillion'),
$langs->transnoentitiesnoconv('quadrillion')
);
$num_length = strlen($num);
$levels = (int) (($num_length + 2) / 3);
$max_length = $levels * 3;
$num = substr('00'.$num, -$max_length);
$num_levels = str_split($num, 3);
$nboflevels = count($num_levels);
for ($i = 0; $i < $nboflevels; $i++) {
$levels--;
$hundreds = (int) ($num_levels[$i] / 100);
$hundreds = ($hundreds ? ' '.$list1[$hundreds].' '.$langs->transnoentities('hundred').($hundreds == 1 ? '' : 's').' ' : '');
$tens = (int) ($num_levels[$i] % 100);
$singles = '';
if ($tens < 20) {
$tens = ($tens ? ' '.$list1[$tens].' ' : '');
} else {
$tens = (int) ($tens / 10);
$tens = ' '.$list2[$tens].' ';
$singles = (int) ($num_levels[$i] % 10);
$singles = ' '.$list1[$singles].' ';
}
$words[] = $hundreds.$tens.$singles.(($levels && (int) ($num_levels[$i])) ? ' '.$list3[$levels].' ' : '');
} //end for loop
$commas = count($words);
if ($commas > 1) {
$commas = $commas - 1;
}
$concatWords = implode(' ', $words);
// Delete multi whitespaces
$concatWords = trim(preg_replace('/[ ]+/', ' ', $concatWords));
@ -138,12 +139,16 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
}
// If we need to write cents call again this function for cents
if (!empty($TNum[1])) {
$decimalpart = $TNum[1];
$decimalpart = preg_replace('/0+$/', '', $decimalpart);
if ($decimalpart) {
if (!empty($currency)) $concatWords .= ' '.$langs->transnoentities('and');
$concatWords .= ' '.dol_convertToWord($TNum[1], $langs, $currency, true);
$concatWords .= ' '.dol_convertToWord($decimalpart, $langs, '', true);
if (!empty($currency)) $concatWords .= ' '.$langs->transnoentities('centimes');
}
return $concatWords;
return $concatWords;
}
}
@ -159,10 +164,12 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
*/
function dolNumberToWord($numero, $langs, $numorcurrency = 'number')
{
// If the number is negative convert to positive and return -1 if is too long
// If the number is negative convert to positive and return -1 if it is too long
if ($numero < 0) $numero *= -1;
if ($numero >= 1000000000001)
if ($numero >= 1000000000001) {
return -1;
}
// Get 2 decimals to cents, another functions round or truncate
$strnumber = number_format($numero, 10);
$len = strlen($strnumber);

View File

@ -33,11 +33,17 @@ $quality = 80;
* Return if a filename is file name of a supported image format
*
* @param string $file Filename
* @param int $acceptsvg 0=Default (depends on setup), 1=Always accept SVG as image files
* @return int -1=Not image filename, 0=Image filename but format not supported for conversion by PHP, 1=Image filename with format supported by this PHP
*/
function image_format_supported($file)
function image_format_supported($file, $acceptsvg = 0)
{
$regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.webp|\.xpm|\.xbm|\.svg'; // See also into product.class.php
global $conf;
$regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.webp|\.xpm|\.xbm'; // See also into product.class.php
if ($acceptsvg || ! empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES)) {
$regeximgext .= '|\.svg'; // Not allowed by default. SVG can contains javascript
}
// Case filename is not a format image
$reg = array();

View File

@ -207,11 +207,12 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
* @param string $objectname Name of object
* @param string $newmask New mask
* @param string $readdir Directory source (use $destdir when not defined)
* @param Object $object If object was already loaded/known, it is pass to avaoid another include and new.
* @param Object $object If object was already loaded/known, it is pass to avoid another include and new.
* @param string $moduletype 'external' or 'internal'
* @return int <=0 if KO, >0 if OK
* @see rebuildObjectClass()
*/
function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '', $object = null)
function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '', $object = null, $moduletype = 'external')
{
global $db, $langs;
@ -223,8 +224,14 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
$pathoffiletoclasssrc = $readdir.'/class/'.strtolower($objectname).'.class.php';
// Edit .sql file
$pathoffiletoeditsrc = $readdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql';
$pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : '');
if ($moduletype == 'internal') {
$pathoffiletoeditsrc = $readdir.'/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql';
$pathoffiletoedittarget = $destdir.'/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : '');
} else {
$pathoffiletoeditsrc = $readdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql';
$pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : '');
}
if (!dol_is_file($pathoffiletoeditsrc))
{
$langs->load("errors");
@ -293,8 +300,13 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
}
// Edit .key.sql file
$pathoffiletoeditsrc = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql';
$pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : '');
if ($moduletype == 'internal') {
$pathoffiletoeditsrc = $readdir.'/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql';
$pathoffiletoedittarget = $destdir.'/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : '');
} else {
$pathoffiletoeditsrc = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql';
$pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : '');
}
$contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r');

View File

@ -234,12 +234,14 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
!empty($conf->ficheinter->enabled)
) ? 1 : 0,
'perms'=>(!empty($user->rights->propal->lire) ||
!empty($user->rights->commande->lire) ||
!empty($user->rights->fournisseur->lire) ||
!empty($user->rights->supplier_proposal->lire) ||
!empty($user->rights->supplier_order->lire) ||
!empty($user->rights->contrat->lire) ||
!empty($user->rights->ficheinter->lire)
!empty($user->rights->commande->lire) ||
!empty($user->rights->fournisseur->lire) ||
!empty($user->rights->supplier_proposal->lire) ||
!empty($user->rights->supplier_order->lire) ||
!empty($user->rights->contrat->lire) ||
!empty($user->rights->ficheinter->lire) ||
!empty($user->rights->supplier_order->lire) ||
!empty($user->rights->fournisseur->commande->lire)
),
'module'=>'propal|commande|supplier_proposal|supplier_order|contrat|ficheinter'
);

View File

@ -2217,10 +2217,16 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($this)));
$version = $this->getVersion(0);
$versiontrans = '';
if (preg_match('/development/i', $version)) $versiontrans .= 'warning';
if (preg_match('/experimental/i', $version)) $versiontrans .= 'warning';
if (preg_match('/deprecated/i', $version)) $versiontrans .= 'warning';
print '
<div class="box-flex-item info-box-module'.(empty($conf->global->$const_name) ? ' info-box-module-disabled' : '').($this->isCoreOrExternalModule() == 'external' ? ' info-box-module-external' : '').'">
<div class="info-box info-box-sm info-box-module">
<div class="info-box-icon">';
<div class="info-box-icon'.(empty($conf->global->$const_name) ? '' : ' info-box-icon-module-enabled'.($versiontrans ? ' info-box-icon-module-warning' : '')).'">';
$alttext = '';
//if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
@ -2233,39 +2239,19 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
print img_object($alttext, 'generic', 'class="inline-block valignmiddle"');
}
$version = $this->getVersion(0);
$versiontrans = '';
if (preg_match('/development/i', $version)) $versiontrans .= 'warning';
if (preg_match('/experimental/i', $version)) $versiontrans .= 'warning';
if (preg_match('/deprecated/i', $version)) $versiontrans .= 'warning';
if ($this->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) {
print '<span class="info-box-icon-version'.($versiontrans ? ' '.$versiontrans : '').'" title="'.$langs->trans("Version").' '.$this->getVersion(1).'">';
print $this->getVersion(1);
print '</span>';
}
/*print '<span class="info-box-icon-action">';
print '<div class="valignmiddle inline-block">';
print '<div class="valignmiddle inline-block">';
print $codeenabledisable;
print '</div>';
print '<div class="valignmiddle inline-block marginleftonly">';
print $codetoconfig;
print '</div>';
print '</div>';
print '</span>';
*/
print '</div>
<div class="info-box-content info-box-text-module">
<div class="info-box-content info-box-text-module'.(empty($conf->global->$const_name) ? '' : ' info-box-module-enabled'.($versiontrans ? ' info-box-content-warning' : '')).'">
<span class="info-box-title">'.$this->getName().'</span>
<span class="info-box-desc twolinesmax opacitymedium" title="'.dol_escape_htmltag($this->getDesc()).'">'.nl2br($this->getDesc()).'</span>';
/*print '<span class="info-box-icon-version" title="'.$langs->trans("Version").' '.$this->getVersion(1).'">';
print $this->getVersion(1);
print '</span>'; */
print '<div class="valignmiddle inline-block info-box-more">';
//if ($versiontrans) print img_warning($langs->trans("Version").' '.$this->getVersion(1)).' ';
print '<a class="valignmiddle inline-block" href="javascript:document_preview(\''.DOL_URL_ROOT.'/admin/modulehelp.php?id='.$this->numero.'\',\'text/html\',\''.dol_escape_js($langs->trans("Module")).'\')">'.img_picto(($this->isCoreOrExternalModule() == 'external' ? $langs->trans("ExternalModule").' - ' : '').$langs->trans("ClickToShowDescription"), $imginfo).'</a>';
print '</div><br>';

View File

@ -292,7 +292,7 @@ class pdf_ban extends ModeleBankAccountDoc
/**
* Show top header of page.
*
* @param PDF $pdf Object PDF
* @param TCPDF $pdf Object PDF
* @param Project $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
@ -377,7 +377,7 @@ class pdf_ban extends ModeleBankAccountDoc
/**
* Show footer of page. Need this->emetteur object
*
* @param PDF $pdf PDF
* @param TCPDF $pdf PDF
* @param Project $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text

View File

@ -213,7 +213,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
/**
* Generate Header
*
* @param PDF $pdf Pdf object
* @param TCPDF $pdf Pdf object
* @param int $page Current page number
* @param int $pages Total number of pages
* @param Translate $outputlangs Object language for output
@ -321,7 +321,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
/**
* Output array
*
* @param PDF $pdf PDF object
* @param TCPDF $pdf PDF object
* @param int $pagenb Page nb
* @param int $pages Pages
* @param Translate $outputlangs Object lang
@ -390,7 +390,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
/**
* Show footer of page. Need this->emetteur object
*
* @param PDF $pdf PDF
* @param TCPDF $pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text

View File

@ -438,7 +438,7 @@ class pdf_merou extends ModelePdfExpedition
/**
* Show table for lines
*
* @param PDF $pdf Object PDF
* @param TCPDF $pdf Object PDF
* @param string $tab_top Top position of table
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
@ -480,7 +480,7 @@ class pdf_merou extends ModelePdfExpedition
/**
* Show footer of page. Need this->emetteur object
*
* @param PDF $pdf PDF
* @param TCPDF $pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
@ -509,7 +509,7 @@ class pdf_merou extends ModelePdfExpedition
/**
* Show top header of page.
*
* @param PDF $pdf Object PDF
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output

View File

@ -662,7 +662,7 @@ class pdf_rouget extends ModelePdfExpedition
/**
* Show total to pay
*
* @param PDF $pdf Object PDF
* @param TCPDF $pdf Object PDF
* @param Facture $object Object invoice
* @param int $deja_regle Montant deja regle
* @param int $posy Position depart
@ -769,7 +769,7 @@ class pdf_rouget extends ModelePdfExpedition
/**
* Show table for lines
*
* @param PDF $pdf Object PDF
* @param TCPDF $pdf Object PDF
* @param string $tab_top Top position of table
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
@ -857,7 +857,7 @@ class pdf_rouget extends ModelePdfExpedition
/**
* Show top header of page.
*
* @param PDF $pdf Object PDF
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
@ -1100,7 +1100,7 @@ class pdf_rouget extends ModelePdfExpedition
/**
* Show footer of page. Need this->emetteur object
*
* @param PDF $pdf PDF
* @param TCPDF $pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text

View File

@ -381,7 +381,7 @@ class pdf_standard extends ModeleExpenseReport
$pdf->setPage($pageposafter + 1);
$showpricebeforepagebreak = 1;
$nexY = $tab_top_newpage;
$nexY += ($pdf->getFontSize() * 1.3); // Passe espace entre les lignes
$nexY += ($pdf->getFontSize() * 1.3); // Add space between lines
$pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage
$pdf->SetTextColor(0, 0, 0);

View File

@ -780,7 +780,7 @@ class pdf_crabe extends ModelePDFFactures
/**
* Show payments table
*
* @param PDF $pdf Object PDF
* @param TCPDF $pdf Object PDF
* @param Object $object Object invoice
* @param int $posy Position y in PDF
* @param Translate $outputlangs Object langs for output
@ -965,7 +965,7 @@ class pdf_crabe extends ModelePDFFactures
/**
* Show miscellaneous information (payment mode, payment term, ...)
*
* @param PDF $pdf Object PDF
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param int $posy Y
* @param Translate $outputlangs Langs object
@ -1139,7 +1139,7 @@ class pdf_crabe extends ModelePDFFactures
/**
* Show total to pay
*
* @param PDF $pdf Object PDF
* @param TCPDF $pdf Object PDF
* @param Facture $object Object invoice
* @param int $deja_regle Amount already paid (in the currency of invoice)
* @param int $posy Position depart
@ -1464,7 +1464,7 @@ class pdf_crabe extends ModelePDFFactures
/**
* Show table for lines
*
* @param PDF $pdf Object PDF
* @param TCPDF $pdf Object PDF
* @param string $tab_top Top position of table
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y (not used)
@ -1586,7 +1586,7 @@ class pdf_crabe extends ModelePDFFactures
/**
* Show top header of page.
*
* @param PDF $pdf Object PDF
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
@ -1889,7 +1889,7 @@ class pdf_crabe extends ModelePDFFactures
/**
* Show footer of page. Need this->emetteur object
*
* @param PDF $pdf PDF
* @param TCPDF $pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text

View File

@ -54,7 +54,7 @@ class modPaymentByBankTransfer extends DolibarrModules
$this->description = "Management of payment by bank transfer";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'development';
$this->version = 'dolibarr';
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Name of png file (without png) used for this module

View File

@ -62,7 +62,7 @@ class modRecruitment extends DolibarrModules
// Used only if file README.md and README-LL.md not found.
$this->descriptionlong = "Manage and follow recruitment campaign for new job positions";
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
$this->version = 'development';
$this->version = 'experimental';
// Url to the file with your last numberversion of this module
//$this->url_last_version = 'http://www.example.com/versionmodule.txt';

View File

@ -59,7 +59,7 @@ class modGeneratePassStandard extends ModeleGenPassword
public function __construct($db, $conf, $langs, $user)
{
$this->id = "standard";
$this->length = 8;
$this->length = 10;
$this->db = $db;
$this->conf = $conf;

View File

@ -183,7 +183,7 @@ class pdf_stdmovement extends ModelePDFMovement
/**
* Function to build a document on disk using the generic odt module.
*
* @param StockMovements $object Object source to build document
* @param MouvementStock $object Object source to build document
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details

View File

@ -552,7 +552,6 @@ class pdf_standard extends ModelePDFSuppliersPayments
$pdf->MultiCell(35, 4, str_pad(price($object->amount).' '.$currency, 18, '*', STR_PAD_LEFT), 0, 'R', 1);
$posy += 10;
// City
$pdf->SetXY($this->page_largeur - $this->marge_droite - 30, $posy);
$pdf->MultiCell(150, 4, $mysoc->town, 0, 'L', 1);
@ -592,9 +591,9 @@ class pdf_standard extends ModelePDFSuppliersPayments
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$titre = strtoupper($mysoc->town).', le '.date("d").' '.$outputlangs->transnoentitiesnoconv(date("F")).' '.date("Y");
/*$titre = strtoupper($mysoc->town).' - '.dol_print_date(dol_now(), 'day', 'tzserver', $outputlangs);
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3) - 60, $tab_top - 6);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);*/
$titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top);
@ -754,7 +753,9 @@ class pdf_standard extends ModelePDFSuppliersPayments
$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $mysoc, ((!empty($object->contact)) ? $object->contact : null), $usecontact, 'target', $object);
$usecontact = 0;
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ((!empty($object->contact)) ? $object->contact : null), $usecontact, 'target', $object);
// Show recipient
$widthrecbox = 90;

View File

@ -185,8 +185,10 @@ if ((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_a
?>
<!-- Label -->
<tr><td class="titlefield fieldrequired"><?php echo $langs->trans("LabelOrTranslationKey"); ?></td><td class="valeur"><input type="text" name="label" size="40" value="<?php echo $label; ?>"></td></tr>
<!-- Code -->
<tr><td class="fieldrequired"><?php echo $langs->trans("AttributeCode"); ?></td><td class="valeur"><?php echo $attrname; ?></td></tr>
<!-- Type -->
<tr><td class="fieldrequired"><?php echo $langs->trans("Type"); ?></td><td class="valeur">
<?php
@ -203,6 +205,10 @@ $typewecanchangeinto = array(
'phone'=>array('varchar', 'phone', 'mail', 'url', 'select'),
'select'=>array('varchar', 'phone', 'mail', 'url', 'select')
);
/* Disabled because text is text on several lines, when varchar is text on 1 line, we should not be able to convert
if ($size <= 255 && in_array($type, array('text', 'html'))) {
$typewecanchangeinto['text'][] = 'varchar';
}*/
if (in_array($type, array_keys($typewecanchangeinto)))
{
@ -222,8 +228,10 @@ if (in_array($type, array_keys($typewecanchangeinto)))
}
?>
</td></tr>
<!-- Size -->
<tr class="extra_size"><td class="fieldrequired"><?php echo $langs->trans("Size"); ?></td><td><input id="size" type="text" name="size" size="5" value="<?php echo $size; ?>"></td></tr>
<!-- Value (for some fields like password, select list, radio, ...) -->
<tr id="value_choice">
<td>
@ -244,33 +252,44 @@ if (in_array($type, array_keys($typewecanchangeinto)))
</table>
</td>
</tr>
<!-- Position -->
<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo dol_escape_htmltag($pos); ?>"></td></tr>
<!-- Language file -->
<tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag($langfile); ?>"></td></tr>
<!-- Computed value -->
<?php if (empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) { ?>
<tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?></td><td class="valeur"><input id="computed_value" class="quatrevingtpercent" type="text" name="computed_value" value="<?php echo dol_escape_htmltag($computed); ?>"></td></tr>
<?php } else { ?>
<tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc")).$form->textwithpicto($langs->trans("Computedpersistent"), $langs->trans("ComputedpersistentDesc"), 1, 'warning'); ?></td><td class="valeur"><input id="computed_value" class="quatrevingtpercent" type="text" name="computed_value" value="<?php echo dol_escape_htmltag($computed); ?>"></td></tr>
<?php } ?>
<!-- Default Value (at sql setup level) -->
<tr class="extra_default_value"><td><?php echo $langs->trans("DefaultValue").' ('.$langs->trans("Database").')'; ?></td><td class="valeur"><input id="default_value" type="text" name="default_value" size="5" value="<?php echo dol_escape_htmltag($default); ?>"></td></tr>
<!-- Unique -->
<tr class="extra_unique"><td><?php echo $langs->trans("Unique"); ?></td><td class="valeur"><input id="unique" type="checkbox" name="unique"<?php echo ($unique ? ' checked' : ''); ?>></td></tr>
<!-- Required -->
<tr class="extra_required"><td><?php echo $langs->trans("Required"); ?></td><td class="valeur"><input id="required" type="checkbox" name="required"<?php echo ($required ? ' checked' : ''); ?>></td></tr>
<!-- Always editable -->
<tr class="extra_alwayseditable"><td><?php echo $langs->trans("AlwaysEditable"); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable"<?php echo ($alwayseditable ? ' checked' : ''); ?>></td></tr>
<!-- Visibility -->
<tr><td class="extra_list"><?php echo $form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc")); ?>
</td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo ($list != '' ? $list : '1'); ?>"></td></tr>
<!-- Visibility for PDF-->
<tr><td class="extra_pdf"><?php echo $form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")); ?>
</td><td class="valeur"><input id="printable" class="minwidth100" type="text" name="printable" value="<?php echo dol_escape_htmltag($printable); ?>"></td></tr>
<tr class="extra_totalizable"><td><?php echo $form->textwithpicto($langs->trans("Totalizable"), $langs->trans("TotalizableDesc")); ?></td><td class="valeur"><input id="totalizable" type="checkbox" name="totalizable"<?php echo ($totalizable ? ' checked' : ''); ?>></td></tr>
<!-- Help tooltip -->
<tr class="help"><td><?php echo $form->textwithpicto($langs->trans("HelpOnTooltip"), $langs->trans("HelpOnTooltipDesc")); ?></td><td class="valeur"><input id="help" class="quatrevingtpercent" type="text" name="help" value="<?php echo dol_escape_htmltag($help); ?>"></td></tr>
<?php if ($conf->multicompany->enabled) { ?>
<!-- Multicompany entity -->
<tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (empty($entitycurrentorall) ? ' checked' : ''); ?>></td></tr>

View File

@ -40,7 +40,7 @@ if (!empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_e
} else {
// for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid')
$morecss = '';
if (in_array($typeofextrafield, array('link', 'sellist'))) $morecss = 'maxwidth200';
if (in_array($typeofextrafield, array('link', 'sellist', 'text', 'html'))) $morecss = 'maxwidth200';
echo $extrafields->showInputField($key, $search_array_options[$search_options_pattern.$tmpkey], '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1);
}
print '</td>';

View File

@ -27,6 +27,10 @@ if (!empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_e
if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') {
print '<th class="liste_titre thseparator"></th>';
} else {
if (! empty($extrafields->attributes[$extrafieldsobjectkey]['langfile'][$key]) && is_object($langs)) {
$langs->load($extrafields->attributes[$extrafieldsobjectkey]['langfile'][$key]);
}
$tooltip = empty($extrafields->attributes[$extrafieldsobjectkey]['help'][$key]) ? '' : $extrafields->attributes[$extrafieldsobjectkey]['help'][$key];
print getTitleFieldOfList($extrafields->attributes[$extrafieldsobjectkey]['label'][$key], 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align ? 'align="'.$align.'" data-titlekey="'.$key.'"' : 'data-titlekey="'.$key.'"'), $sortfield, $sortorder, '', $disablesortlink, $tooltip)."\n";

View File

@ -87,17 +87,14 @@ else $typeofdata = 'textarea:12:95%';
print '<!-- BEGIN PHP TEMPLATE NOTES -->'."\n";
print '<div class="tagtable border table-border tableforfield centpercent">'."\n";
if ($module != 'product') {
// No public note yet on products
print '<div class="tagtr table-border-row">'."\n";
print '<div class="tagtd tagtdnote tdtop sensiblehtmlcontent table-key-border-col'.(empty($cssclass) ? '' : ' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
print $form->editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0);
print '</div>'."\n";
print '<div class="tagtd table-val-border-col sensiblehtmlcontent">'."\n";
print $form->editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam, 1)."\n";
print '</div>'."\n";
print '</div>'."\n";
}
print '<div class="tagtr table-border-row">'."\n";
print '<div class="tagtd tagtdnote tdtop sensiblehtmlcontent table-key-border-col'.(empty($cssclass) ? '' : ' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
print $form->editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0);
print '</div>'."\n";
print '<div class="tagtd table-val-border-col sensiblehtmlcontent">'."\n";
print $form->editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam, 1)."\n";
print '</div>'."\n";
print '</div>'."\n";
if (empty($user->socid)) {
// Private notes (always hidden to external users)
print '<div class="tagtr table-border-row">'."\n";

View File

@ -2463,6 +2463,7 @@ class Expedition extends CommonObject
global $conf, $langs;
$langs->load("sendings");
$outputlangs->load("products");
if (!dol_strlen($modele)) {
$modele = 'rouget';

View File

@ -109,7 +109,7 @@ $hookmanager->initHooks(array('expensereportlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label('expensereport');
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');

View File

@ -197,8 +197,6 @@ class FichinterRec extends Fichinter
*/
$num = count($fichintsrc->lines);
for ($i = 0; $i < $num; $i++) {
//$result=$fichintlignesrc->fetch($fichintsrc->lines[$i]->id);
//var_dump($fichintsrc->lines[$i]);
$result_insert = $this->addline(
$fichintsrc->lines[$i]->desc,
@ -243,7 +241,7 @@ class FichinterRec extends Fichinter
/**
* Recupere l'objet facture et ses lignes de factures
* Get the template of intervention object and lines
*
* @param int $rowid Id of object to load
* @param string $ref Reference of fichinter
@ -295,9 +293,7 @@ class FichinterRec extends Fichinter
$this->brouillon = 1;
/*
* Lines
*/
// Lines
$result = $this->fetch_lines();
if ($result < 0) {
$this->error = $this->db->error();
@ -318,9 +314,9 @@ class FichinterRec extends Fichinter
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Recupere les lignes de factures predefinies dans this->lines
* @param int $sall sall
* Load all lines of template of intervention into this->lines
*
* @param int $sall sall
* @return int 1 if OK, < 0 if KO
*/
public function fetch_lines($sall = 0)
@ -441,15 +437,15 @@ class FichinterRec extends Fichinter
* @param integer $duration Durée
* @param string $datei Date
* @param int $rang Position of line
* @param double $pu_ht Prix unitaire HT (> 0 even for credit note)
* @param double $qty Quantite
* @param double $txtva Taux de tva force, sinon -1
* @param int $fk_product Id du produit/service predefini
* @param double $remise_percent Pourcentage de remise de la ligne
* @param double $pu_ht Unit price without tax (> 0 even for credit note)
* @param double $qty Quantity
* @param double $txtva Forced VAT rate, otherwise -1
* @param int $fk_product Id of predefined product/service
* @param double $remise_percent Percentage of discount on line
* @param string $price_base_type HT or TTC
* @param int $info_bits Bits de type de lignes
* @param int $fk_remise_except Id remise
* @param double $pu_ttc Prix unitaire TTC (> 0 even for credit note)
* @param int $info_bits Bits for type of lines
* @param int $fk_remise_except Id discount
* @param double $pu_ttc Unit price with tax (> 0 even for credit note)
* @param int $type Type of line (0=product, 1=service)
* @param int $special_code Special code
* @param string $label Label of the line

View File

@ -85,7 +85,7 @@ $hookmanager->initHooks(array('interventionlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label('fichinter');
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');

View File

@ -293,9 +293,9 @@ class SupplierInvoices extends DolibarrApi
}
/**
* Validate an order
* Validate an invoice
*
* @param int $id Order ID
* @param int $id Invoice ID
* @param int $idwarehouse Warehouse ID
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
*
@ -325,7 +325,7 @@ class SupplierInvoices extends DolibarrApi
$result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger);
if ($result == 0) {
throw new RestException(304, 'Error nothing done. May be object is already validated');
throw new RestException(304, 'Error nothing done. The invoice is already validated');
}
if ($result < 0) {
throw new RestException(500, 'Error when validating Invoice: '.$this->invoice->error);
@ -454,6 +454,7 @@ class SupplierInvoices extends DolibarrApi
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
$paiement->paiementid = $paiementid;
$paiement->paiementcode = dol_getIdFromCode($this->db, $paiementid, 'c_paiement', 'id', 'code', 1);
$paiement->oper = $paiement->paiementcode; // For backward compatibility
$paiement->num_payment = $num_payment;
$paiement->note_public = $comment;

View File

@ -187,6 +187,8 @@ class SupplierOrders extends DolibarrApi
/**
* Create supplier order object
*
* Example: {"ref": "auto", "ref_supplier": "1234", "socid": "1", "multicurrency_code": "SEK", "multicurrency_tx": 1, "tva_tx": 25, "note": "Imported via the REST API"}
*
* @param array $request_data Request datas
* @return int ID of supplier order
*/

View File

@ -2966,6 +2966,7 @@ class CommandeFournisseur extends CommonOrder
global $conf, $langs;
$langs->load("suppliers");
$outputlangs->load("products");
if (!dol_strlen($modele)) {
$modele = 'muscadet';

View File

@ -290,7 +290,9 @@ class CommandeFournisseurDispatch extends CommonObject
$this->batch = $obj->batch;
$this->eatby = $this->db->jdate($obj->eatby);
$this->sellby = $this->db->jdate($obj->sellby);
$this->fetch_optionals();
$this->fk_reception = $obj->fk_reception;
$this->fetch_optionals();
}
$this->db->free($resql);

View File

@ -1259,7 +1259,7 @@ class FactureFournisseur extends CommonInvoice
$this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn';
$sql .= ' SET paye = 1, fk_statut=2';
$sql .= ' SET paye = 1, fk_statut = '.self::STATUS_CLOSED;
$sql .= ' WHERE rowid = '.$this->id;
dol_syslog("FactureFournisseur::set_paid", LOG_DEBUG);
@ -2267,7 +2267,8 @@ class FactureFournisseur extends CommonInvoice
$result = '';
if ($option == 'document') $url = DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$this->id;
if ($option == 'withdraw') $url = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$this->id.'&type=bank-transfer';
elseif ($option == 'document') $url = DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$this->id;
else $url = DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$this->id;
if ($short) return $url;
@ -2641,6 +2642,7 @@ class FactureFournisseur extends CommonInvoice
global $conf, $user, $langs;
$langs->load("suppliers");
$outputlangs->load("products");
// Set the model on the model name to use
if (empty($modele))

View File

@ -463,11 +463,26 @@ if (empty($reshook))
if ($idprod > 0)
{
$label = $productsupplier->label;
// Define output language
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
$outputlangs = $langs;
$newlang = '';
if (empty($newlang) && GETPOST('lang_id', 'aZ09'))
$newlang = GETPOST('lang_id', 'aZ09');
if (empty($newlang))
$newlang = $object->thirdparty->default_lang;
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$desc = (!empty($productsupplier->multilangs [$outputlangs->defaultlang] ["description"])) ? $productsupplier->multilangs [$outputlangs->defaultlang] ["description"] : $productsupplier->description;
} else {
$desc = $productsupplier->description;
}
// if we use supplier description of the products
if (!empty($productsupplier->desc_supplier) && !empty($conf->global->PRODUIT_FOURN_TEXTS)) {
$desc = $productsupplier->desc_supplier;
} else $desc = $productsupplier->description;
}
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION));

View File

@ -743,7 +743,8 @@ if ($id > 0 || !empty($ref)) {
print '<td class="right">'.$langs->trans("SupplierRef").'</td>';
print '<td class="right">'.$langs->trans("QtyOrdered").'</td>';
print '<td class="right">'.$langs->trans("QtyDispatchedShort").'</td>';
print '<td class="right">'.$langs->trans("QtyToDispatchShort").'</td>';
print ' <td class="right">'.$langs->trans("QtyToDispatchShort");
print '<br><a href="#" id="autoreset">'.$langs->trans("Reset").'</a></td>';
print '<td width="32"></td>';
if (!empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) {
@ -971,7 +972,7 @@ if ($id > 0 || !empty($ref)) {
// Discount
print '<td class="right">';
print '<input id="pu'.$suffix.'" name="dto'.$suffix.'" type="text" size="8" value="'.(GETPOST('dto'.$suffix) != '' ? GETPOST('dto'.$suffix) : '').'">';
print '<input id="dto' . $suffix . '" name="dto' . $suffix . '" type="text" size="8" value="' . (GETPOST('dto' . $suffix) != '' ? GETPOST('dto' . $suffix) : '') . '">';
print '</td>';
// Save price
@ -1068,7 +1069,16 @@ if ($id > 0 || !empty($ref)) {
$("select[name=fk_default_warehouse]").change(function() {
var fk_default_warehouse = $("option:selected", this).val();
$("select[name^=entrepot_]").val(fk_default_warehouse).change();
});
});
jQuery("#autoreset").click(function() {';
$i = 0;
while ($i < $nbproduct) {
print ' jQuery("#qty_0_'.$i.'").val("");';
$i++;
}
print '
});
});
</script>';

View File

@ -120,7 +120,7 @@ $hookmanager->initHooks(array('supplierorderlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label('commande_fournisseur');
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');

View File

@ -1724,6 +1724,9 @@ if ($action == 'create')
$mode_reglement_id = GETPOST("mode_reglement_id");
}
$note_public = $object->getDefaultCreateValueFor('note_public', ((! empty($origin) && ! empty($originid) && is_object($objectsrc) && !empty($conf->global->FACTUREFOURN_REUSE_NOTES_ON_CREATE_FROM))?$objectsrc->note_public:null));
$note_private = $object->getDefaultCreateValueFor('note_private', ((! empty($origin) && ! empty($originid) && is_object($objectsrc) && !empty($conf->global->FACTUREFOURN_REUSE_NOTES_ON_CREATE_FROM))?$objectsrc->note_private:null));
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
@ -2048,8 +2051,6 @@ if ($action == 'create')
// Public note
print '<tr><td>'.$langs->trans('NotePublic').'</td>';
print '<td>';
$note_public = $object->getDefaultCreateValueFor('note_public');
if (empty($note_public))$note_public = $objectsrc->note_public;
$doleditor = new DolEditor('note_public', (GETPOSTISSET('note_public') ?GETPOST('note_public', 'none') : $note_public), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1);
print '</td>';
@ -2059,9 +2060,6 @@ if ($action == 'create')
// Private note
print '<tr><td>'.$langs->trans('NotePrivate').'</td>';
print '<td>';
$note_private = $object->getDefaultCreateValueFor('note_private');
if (empty($note_private))$note_private = $objectsrc->note_private;
$doleditor = new DolEditor('note_private', (GETPOSTISSET('note_private') ?GETPOST('note_private', 'none') : $note_private), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1);
print '</td>';

View File

@ -27,10 +27,10 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
$langs->loadLangs(array('bills', 'banks', 'companies', 'suppliers'));

View File

@ -356,7 +356,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$dashboardlines[$board->element] = $board->load_board($user);
}
// Number of commercial proposals opened (expired)
// Number of commercial proposals open (expired)
if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$board = new Propal($db);
@ -365,7 +365,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$dashboardlines[$board->element.'_signed'] = $board->load_board($user, "signed");
}
// Number of commercial proposals opened (expired)
// Number of commercial proposals open (expired)
if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) {
include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
$board = new SupplierProposal($db);
@ -407,14 +407,14 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
//$dashboardlines[$board->element.'_active'] = $board->load_board($user, "active");
}
// Number of invoices customers (has paid)
// Number of invoices customers (paid)
if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$board = new Facture($db);
$dashboardlines[$board->element] = $board->load_board($user);
}
// Number of supplier invoices (has paid)
// Number of supplier invoices (paid)
if (!empty($conf->supplier_invoice->enabled) && !empty($user->rights->fournisseur->facture->lire)) {
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$board = new FactureFournisseur($db);
@ -715,21 +715,35 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$textLate = '';
if ($board->nbtodolate > 0) {
$textLate .= ' <span title="'.dol_htmlentities($textLateTitle).'" class="classfortooltip badge badge-warning">';
$textLate .= '<span title="'.dol_htmlentities($textLateTitle).'" class="classfortooltip badge badge-warning">';
$textLate .= '<i class="fa fa-exclamation-triangle"></i> '.$board->nbtodolate;
$textLate .= '</span>';
}
$openedDashBoard .= '<div class="info-box-line">';
$nbtodClass = '';
if ($board->nbtodo > 0) {
$nbtodClass = 'badge badge-info';
}
$openedDashBoard .= ' <a href="'.$board->url.'" class="info-box-text">'.$infoName.' : <span class="'.$nbtodClass.' classfortooltip" title="'.$board->label.'" >'.$board->nbtodo.'</span>'.$textLate.'</a>'."\n";
$openedDashBoard .= ' <a href="'.$board->url.'" class="info-box-text info-box-text-a">'.$infoName.' : <span class="'.$nbtodClass.' classfortooltip" title="'.$board->label.'" >'.$board->nbtodo.'</span>';
if ($textLate) {
if ($board->url_late) {
$openedDashBoard .= '</a>';
$openedDashBoard .= ' <a href="'.$board->url_late.'" class="info-box-text info-box-text-a paddingleft">';
} else {
$openedDashBoard .= ' ';
}
$openedDashBoard .= $textLate;
}
$openedDashBoard .= '</a>'."\n";
if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) {
$openedDashBoard .= '<a href="'.$board->url.'" class="info-box-text">'.$langs->trans('Total').' : '.price($board->total).'</a>';
}
$openedDashBoard .= '</div>';
}
$openedDashBoard .= ' </div><!-- /.info-box-content -->'."\n";

View File

@ -0,0 +1,31 @@
-- Copyright (C) 2020 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
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
--
--
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
-- de l'install et tous les sigles '--' sont supprimés.
--
--
-- Prospect level for contacts
--
--delete from llx_c_prospectcontactlevel;
insert into llx_c_prospectcontactlevel (code,label,sortorder) values ('PL_NONE', 'None', 1);
insert into llx_c_prospectcontactlevel (code,label,sortorder) values ('PL_LOW', 'Low', 2);
insert into llx_c_prospectcontactlevel (code,label,sortorder) values ('PL_MEDIUM', 'Medium', 3);
insert into llx_c_prospectcontactlevel (code,label,sortorder) values ('PL_HIGH', 'High', 4);

View File

@ -0,0 +1,32 @@
-- Copyright (C) 2020 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
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
--
--
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
-- de l'install et tous les sigles '--' sont supprimés.
--
--
-- Types action st for contacts
--
delete from llx_c_stcommcontact;
insert into llx_c_stcommcontact (id,code,libelle) values (-1, 'ST_NO', 'Do not contact');
insert into llx_c_stcommcontact (id,code,libelle) values ( 0, 'ST_NEVER', 'Never contacted');
insert into llx_c_stcommcontact (id,code,libelle) values ( 1, 'ST_TODO', 'To contact');
insert into llx_c_stcommcontact (id,code,libelle) values ( 2, 'ST_PEND', 'Contact in progress');
insert into llx_c_stcommcontact (id,code,libelle) values ( 3, 'ST_DONE', 'Contacted');

View File

@ -98,7 +98,7 @@ ALTER TABLE llx_bom_bomline ADD COLUMN position integer NOT NULL DEFAULT 0;
ALTER TABLE llx_bom_bomline ADD COLUMN qty_frozen smallint DEFAULT 0;
ALTER TABLE llx_bom_bomline ADD COLUMN disable_stock_change smallint DEFAULT 0;
ALTER TABLE llx_bom_bomline DROP COLUMN rank;
ALTER TABLE llx_bom_bomline DROP COLUMN `rank`;
create table llx_categorie_warehouse
(

View File

@ -305,7 +305,6 @@ ALTER TABLE llx_categorie ADD COLUMN fk_user_modif integer;
ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_commandefourndet FOREIGN KEY (fk_commandefourndet) REFERENCES llx_commande_fournisseurdet (rowid);
-- VMYSQL4.3 ALTER TABLE llx_prelevement_facture_demande MODIFY COLUMN fk_facture INTEGER NULL;
-- VPGSQL8.2 ALTER TABLE llx_prelevement_facture_demande ALTER COLUMN fk_facture DROP NOT NULL;
ALTER TABLE llx_prelevement_facture_demande ADD COLUMN fk_facture_fourn INTEGER NULL;

View File

@ -81,6 +81,7 @@ ALTER TABLE llx_c_incoterms ADD COLUMN label varchar(100) NULL;
CREATE TABLE llx_recruitment_recruitmentjobposition(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
ref varchar(128) DEFAULT '(PROV)' NOT NULL,
entity INTEGER DEFAULT 1 NOT NULL,
label varchar(255) NOT NULL,
qty integer DEFAULT 1 NOT NULL,
fk_soc integer,
@ -89,6 +90,7 @@ CREATE TABLE llx_recruitment_recruitmentjobposition(
fk_user_supervisor integer,
fk_establishment integer,
date_planned date,
remuneration_suggested varchar(255),
description text,
note_public text,
note_private text,
@ -112,6 +114,10 @@ ALTER TABLE llx_recruitment_recruitmentjobposition ADD CONSTRAINT llx_recruitmen
ALTER TABLE llx_recruitment_recruitmentjobposition ADD CONSTRAINT llx_recruitment_recruitmentjobposition_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
ALTER TABLE llx_recruitment_recruitmentjobposition ADD INDEX idx_recruitment_recruitmentjobposition_status (status);
ALTER TABLE llx_recruitment_recruitmentjobposition ADD COLUMN email_recruiter varchar(255);
ALTER TABLE llx_recruitment_recruitmentjobposition ADD COLUMN entity INTEGER DEFAULT 1 NOT NULL;
ALTER TABLE llx_recruitment_recruitmentjobposition ADD COLUMN remuneration_suggested varchar(255);
create table llx_recruitment_recruitmentjobposition_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
@ -123,6 +129,52 @@ create table llx_recruitment_recruitmentjobposition_extrafields
ALTER TABLE llx_recruitment_recruitmentjobposition_extrafields ADD INDEX idx_fk_object(fk_object);
CREATE TABLE llx_recruitment_recruitmentcandidature(
-- BEGIN MODULEBUILDER FIELDS
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
fk_recruitmentjobposition INTEGER NOT NULL,
ref varchar(128) DEFAULT '(PROV)' NOT NULL,
description text,
note_public text,
note_private text,
date_creation datetime NOT NULL,
tms timestamp,
fk_user_creat integer NOT NULL,
fk_user_modif integer,
import_key varchar(14),
model_pdf varchar(255),
status smallint NOT NULL,
firstname varchar(128),
lastname varchar(128),
remuneration_requested integer,
remuneration_proposed integer,
fk_recruitment_origin INTEGER NULL
-- END MODULEBUILDER FIELDS
) ENGINE=innodb;
ALTER TABLE llx_recruitment_recruitmentcandidature ADD COLUMN fk_recruitment_origin INTEGER NULL;
ALTER TABLE llx_recruitment_recruitmentcandidature ADD INDEX idx_recruitment_recruitmentcandidature_rowid (rowid);
ALTER TABLE llx_recruitment_recruitmentcandidature ADD INDEX idx_recruitment_recruitmentcandidature_ref (ref);
ALTER TABLE llx_recruitment_recruitmentcandidature ADD CONSTRAINT llx_recruitment_recruitmentcandidature_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
ALTER TABLE llx_recruitment_recruitmentcandidature ADD INDEX idx_recruitment_recruitmentcandidature_status (status);
create table llx_recruitment_recruitmentcandidature_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;
ALTER TABLE llx_recruitment_recruitmentcandidature_extrafields ADD INDEX idx_fk_object(fk_object);
CREATE TABLE llx_product_attribute_combination_price_level
(
rowid INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT,
@ -133,3 +185,47 @@ CREATE TABLE llx_product_attribute_combination_price_level
)ENGINE=innodb;
ALTER TABLE llx_product_attribute_combination_price_level ADD UNIQUE( fk_product_attribute_combination, fk_price_level);
-- Add dictionary for prospect level and action commercial on contacts (Using this is not recommanded)
create table llx_c_prospectcontactlevel
(
code varchar(12) PRIMARY KEY,
label varchar(30),
sortorder smallint,
active smallint DEFAULT 1 NOT NULL,
module varchar(32) NULL
) ENGINE=innodb;
insert into llx_c_prospectcontactlevel (code,label,sortorder) values ('PL_NONE', 'None', 1);
insert into llx_c_prospectcontactlevel (code,label,sortorder) values ('PL_LOW', 'Low', 2);
insert into llx_c_prospectcontactlevel (code,label,sortorder) values ('PL_MEDIUM', 'Medium', 3);
insert into llx_c_prospectcontactlevel (code,label,sortorder) values ('PL_HIGH', 'High', 4);
create table llx_c_stcommcontact
(
id integer PRIMARY KEY,
code varchar(12) NOT NULL,
libelle varchar(30),
picto varchar(128),
active tinyint default 1 NOT NULL
)ENGINE=innodb;
ALTER TABLE llx_c_stcommcontact ADD UNIQUE INDEX uk_c_stcommcontact(code);
insert into llx_c_stcommcontact (id,code,libelle) values (-1, 'ST_NO', 'Do not contact');
insert into llx_c_stcommcontact (id,code,libelle) values ( 0, 'ST_NEVER', 'Never contacted');
insert into llx_c_stcommcontact (id,code,libelle) values ( 1, 'ST_TODO', 'To contact');
insert into llx_c_stcommcontact (id,code,libelle) values ( 2, 'ST_PEND', 'Contact in progress');
insert into llx_c_stcommcontact (id,code,libelle) values ( 3, 'ST_DONE', 'Contacted');
ALTER TABLE llx_socpeople ADD COLUMN fk_prospectcontactlevel varchar(12) AFTER priv;
ALTER TABLE llx_socpeople ADD COLUMN fk_stcommcontact integer DEFAULT 0 NOT NULL AFTER fk_prospectcontactlevel;
create table llx_c_recruitment_origin
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
code varchar(32) NOT NULL,
label varchar(64) NOT NULL,
active tinyint DEFAULT 1 NOT NULL
)ENGINE=innodb;

View File

@ -0,0 +1,27 @@
-- ===================================================================
-- Copyright (C) 2020 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
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ===================================================================
create table llx_c_prospectcontactlevel
(
code varchar(12) PRIMARY KEY,
label varchar(30),
sortorder smallint,
active smallint DEFAULT 1 NOT NULL,
module varchar(32) NULL
) ENGINE=innodb;

View File

@ -0,0 +1,33 @@
-- ========================================================================
-- Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
--
-- Defini les types de contact d'un element sert de reference pour
-- la table llx_element_contact
--
-- element est le nom de la table utilisant le type de contact.
-- i.e. contact, facture, projet, societe (sans le llx_ devant).
-- Libelle est un texte decrivant le type de contact.
-- active precise si cette valeur est 'active' ou 'archive'.
--
-- ========================================================================
create table llx_c_recruitment_origin
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
code varchar(32) NOT NULL,
label varchar(64) NOT NULL,
active tinyint DEFAULT 1 NOT NULL
)ENGINE=innodb;

View File

@ -0,0 +1,19 @@
-- ========================================================================
-- Copyright (C) 2020 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
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ========================================================================
ALTER TABLE llx_c_stcommcontact ADD UNIQUE INDEX uk_c_stcommcontact(code);

View File

@ -0,0 +1,27 @@
-- ========================================================================
-- Copyright (C) 2020 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
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ========================================================================
create table llx_c_stcommcontact
(
id integer PRIMARY KEY,
code varchar(12) NOT NULL,
libelle varchar(30),
picto varchar(128),
active tinyint default 1 NOT NULL
)ENGINE=innodb;

View File

@ -0,0 +1,27 @@
-- Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.
-- BEGIN MODULEBUILDER INDEXES
ALTER TABLE llx_recruitment_recruitmentcandidature ADD INDEX idx_recruitment_recruitmentcandidature_rowid (rowid);
ALTER TABLE llx_recruitment_recruitmentcandidature ADD INDEX idx_recruitment_recruitmentcandidature_ref (ref);
ALTER TABLE llx_recruitment_recruitmentcandidature ADD CONSTRAINT llx_recruitment_recruitmentcandidature_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
ALTER TABLE llx_recruitment_recruitmentcandidature ADD INDEX idx_recruitment_recruitmentcandidature_status (status);
-- END MODULEBUILDER INDEXES
--ALTER TABLE llx_mymodule_myobject ADD UNIQUE INDEX uk_mymodule_myobject_fieldxy(fieldx, fieldy);
--ALTER TABLE llx_mymodule_myobject ADD CONSTRAINT llx_mymodule_myobject_fk_field FOREIGN KEY (fk_field) REFERENCES llx_mymodule_myotherobject(rowid);

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