40require
'../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/lib/socialnetwork.lib.php';
52const DICT_FORME_JURIDIQUE = 1;
53const DICT_DEPARTEMENTS = 2;
54const DICT_REGIONS = 3;
55const DICT_COUNTRY = 4;
56const DICT_CIVILITY = 5;
57const DICT_ACTIONCOMM = 6;
58const DICT_CHARGESOCIALES = 7;
60const DICT_CURRENCIES = 9;
62const DICT_TYPE_CONTACT = 11;
63const DICT_PAYMENT_TERM = 12;
64const DICT_PAIEMENT = 13;
65const DICT_ECOTAXE = 14;
66const DICT_PAPER_FORMAT = 15;
67const DICT_PROSPECTLEVEL = 16;
68const DICT_TYPE_FEES = 17;
69const DICT_SHIPMENT_MODE = 18;
70const DICT_EFFECTIF = 19;
71const DICT_INPUT_METHOD = 20;
72const DICT_AVAILABILITY = 21;
73const DICT_INPUT_REASON = 22;
74const DICT_REVENUESTAMP = 23;
75const DICT_TYPE_RESOURCE = 24;
76const DICT_TYPE_CONTAINER = 25;
78const DICT_STCOMM = 27;
79const DICT_HOLIDAY_TYPES = 28;
80const DICT_LEAD_STATUS = 29;
81const DICT_FORMAT_CARDS = 30;
82const DICT_INVOICE_SUBTYPE = 31;
83const DICT_HRM_PUBLIC_HOLIDAY = 32;
84const DICT_HRM_DEPARTMENT = 33;
85const DICT_HRM_FUNCTION = 34;
86const DICT_EXP_TAX_CAT = 35;
87const DICT_EXP_TAX_RANGE = 36;
89const DICT_SOCIALNETWORKS = 38;
90const DICT_PROSPECTCONTACTLEVEL = 39;
91const DICT_STCOMMCONTACT = 40;
92const DICT_TRANSPORT_MODE = 41;
93const DICT_PRODUCT_NATURE = 42;
94const DICT_PRODUCTBATCH_QCSTATUS = 43;
95const DICT_ASSET_DISPOSAL_TYPE = 44;
107$langs->loadLangs(array(
"errors",
"admin",
"main",
"companies",
"resource",
"holiday",
"accountancy",
"hrm",
"orders",
"contracts",
"projects",
"propal",
"bills",
"interventions",
"ticket"));
109$action =
GETPOST(
'action',
'alpha') ?
GETPOST(
'action',
'alpha') :
'view';
110$confirm =
GETPOST(
'confirm',
'alpha');
113$rowid =
GETPOST(
'rowid',
'alpha');
114$entity =
GETPOST(
'entity',
'alpha');
115$code =
GETPOST(
'code',
'alpha');
116$from =
GETPOST(
'from',
'alpha');
120$acts[0] =
"activate";
122$actl[0] =
img_picto($langs->trans(
"Disabled"),
'switch_off',
'class="size15x"');
123$actl[1] =
img_picto($langs->trans(
"Activated"),
'switch_on',
'class="size15x"');
126$listoffset =
GETPOST(
'listoffset');
127$listlimit =
GETPOST(
'listlimit') > 0 ?
GETPOST(
'listlimit') : 1000;
128$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
129$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
131if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
135$offset = $listlimit * $page;
136$pageprev = $page - 1;
137$pagenext = $page + 1;
139$search_country_id =
GETPOST(
'search_country_id',
'int');
140$search_code =
GETPOST(
'search_code',
'alpha');
141$search_active =
GETPOST(
'search_active',
'alpha');
144if (!GETPOSTISSET(
'search_country_id') && $search_country_id ==
'' && ($id == DICT_DEPARTEMENTS || $id == DICT_REGIONS || $id == DICT_TVA)) {
145 $search_country_id =
$mysoc->country_id;
149$hookmanager->initHooks(array(
'admin',
'dictionaryadmin'));
151$allowed = $user->admin;
152if ($id == DICT_CHARGESOCIALES && $user->hasRight(
'accounting',
'chartofaccount')) {
155if ($id == DICT_TVA && $user->hasRight(
'accounting',
'chartofaccount')) {
158if ($id == DICT_TYPE_FEES && $user->hasRight(
'accounting',
'chartofaccount')) {
165$permissiontoadd = $allowed;
172$taborder = array(DICT_CURRENCIES, DICT_PAPER_FORMAT, DICT_FORMAT_CARDS, 0, DICT_COUNTRY, DICT_REGIONS, DICT_DEPARTEMENTS, 0, DICT_FORME_JURIDIQUE, DICT_TYPENT, DICT_EFFECTIF, DICT_PROSPECTLEVEL, DICT_PROSPECTCONTACTLEVEL, DICT_STCOMM, DICT_STCOMMCONTACT, DICT_SOCIALNETWORKS, 0, DICT_CIVILITY, DICT_TYPE_CONTACT, 0, DICT_ACTIONCOMM, DICT_TYPE_RESOURCE, 0, DICT_LEAD_STATUS, 0, DICT_HRM_DEPARTMENT, DICT_HRM_FUNCTION, DICT_HRM_PUBLIC_HOLIDAY, DICT_HOLIDAY_TYPES, DICT_TYPE_FEES, DICT_EXP_TAX_CAT, DICT_EXP_TAX_RANGE, 0, DICT_TVA, DICT_INVOICE_SUBTYPE, DICT_REVENUESTAMP, DICT_PAYMENT_TERM, DICT_PAIEMENT, DICT_CHARGESOCIALES, 0, DICT_ECOTAXE, 0, DICT_INPUT_REASON, DICT_INPUT_METHOD, DICT_SHIPMENT_MODE, DICT_AVAILABILITY, DICT_TRANSPORT_MODE, 0, DICT_UNITS, DICT_PRODUCT_NATURE, 0, DICT_PRODUCTBATCH_QCSTATUS, 0, DICT_TYPE_CONTAINER, 0, DICT_ASSET_DISPOSAL_TYPE, 0);
176$tabname[DICT_FORME_JURIDIQUE] =
"c_forme_juridique";
177$tabname[DICT_DEPARTEMENTS] =
"c_departements";
178$tabname[DICT_REGIONS] =
"c_regions";
179$tabname[DICT_COUNTRY] =
"c_country";
180$tabname[DICT_CIVILITY] =
"c_civility";
181$tabname[DICT_ACTIONCOMM] =
"c_actioncomm";
182$tabname[DICT_CHARGESOCIALES] =
"c_chargesociales";
183$tabname[DICT_TYPENT] =
"c_typent";
184$tabname[DICT_CURRENCIES] =
"c_currencies";
185$tabname[DICT_TVA] =
"c_tva";
186$tabname[DICT_TYPE_CONTACT] =
"c_type_contact";
187$tabname[DICT_PAYMENT_TERM] =
"c_payment_term";
188$tabname[DICT_PAIEMENT] =
"c_paiement";
189$tabname[DICT_ECOTAXE] =
"c_ecotaxe";
190$tabname[DICT_PAPER_FORMAT] =
"c_paper_format";
191$tabname[DICT_PROSPECTLEVEL] =
"c_prospectlevel";
192$tabname[DICT_TYPE_FEES] =
"c_type_fees";
193$tabname[DICT_SHIPMENT_MODE] =
"c_shipment_mode";
194$tabname[DICT_EFFECTIF] =
"c_effectif";
195$tabname[DICT_INPUT_METHOD] =
"c_input_method";
196$tabname[DICT_AVAILABILITY] =
"c_availability";
197$tabname[DICT_INPUT_REASON] =
"c_input_reason";
198$tabname[DICT_REVENUESTAMP] =
"c_revenuestamp";
199$tabname[DICT_TYPE_RESOURCE] =
"c_type_resource";
200$tabname[DICT_TYPE_CONTAINER] =
"c_type_container";
202$tabname[DICT_STCOMM] =
"c_stcomm";
203$tabname[DICT_HOLIDAY_TYPES] =
"c_holiday_types";
204$tabname[DICT_LEAD_STATUS] =
"c_lead_status";
205$tabname[DICT_FORMAT_CARDS] =
"c_format_cards";
206$tabname[DICT_INVOICE_SUBTYPE] =
"c_invoice_subtype";
207$tabname[DICT_HRM_PUBLIC_HOLIDAY] =
"c_hrm_public_holiday";
208$tabname[DICT_HRM_DEPARTMENT] =
"c_hrm_department";
209$tabname[DICT_HRM_FUNCTION] =
"c_hrm_function";
210$tabname[DICT_EXP_TAX_CAT] =
"c_exp_tax_cat";
211$tabname[DICT_EXP_TAX_RANGE] =
"c_exp_tax_range";
212$tabname[DICT_UNITS] =
"c_units";
213$tabname[DICT_SOCIALNETWORKS] =
"c_socialnetworks";
214$tabname[DICT_PROSPECTCONTACTLEVEL] =
"c_prospectcontactlevel";
215$tabname[DICT_STCOMMCONTACT] =
"c_stcommcontact";
216$tabname[DICT_TRANSPORT_MODE] =
"c_transport_mode";
217$tabname[DICT_PRODUCT_NATURE] =
"c_product_nature";
218$tabname[DICT_PRODUCTBATCH_QCSTATUS] =
"c_productbatch_qcstatus";
219$tabname[DICT_ASSET_DISPOSAL_TYPE] =
"c_asset_disposal_type";
223$tablib[DICT_FORME_JURIDIQUE] =
"DictionaryCompanyJuridicalType";
224$tablib[DICT_DEPARTEMENTS] =
"DictionaryCanton";
225$tablib[DICT_REGIONS] =
"DictionaryRegion";
226$tablib[DICT_COUNTRY] =
"DictionaryCountry";
227$tablib[DICT_CIVILITY] =
"DictionaryCivility";
228$tablib[DICT_ACTIONCOMM] =
"DictionaryActions";
229$tablib[DICT_CHARGESOCIALES] =
"DictionarySocialContributions";
230$tablib[DICT_TYPENT] =
"DictionaryCompanyType";
231$tablib[DICT_CURRENCIES] =
"DictionaryCurrency";
232$tablib[DICT_TVA] =
"DictionaryVAT";
233$tablib[DICT_TYPE_CONTACT] =
"DictionaryTypeContact";
234$tablib[DICT_PAYMENT_TERM] =
"DictionaryPaymentConditions";
235$tablib[DICT_PAIEMENT] =
"DictionaryPaymentModes";
236$tablib[DICT_ECOTAXE] =
"DictionaryEcotaxe";
237$tablib[DICT_PAPER_FORMAT] =
"DictionaryPaperFormat";
238$tablib[DICT_PROSPECTLEVEL] =
"DictionaryProspectLevel";
239$tablib[DICT_TYPE_FEES] =
"DictionaryFees";
240$tablib[DICT_SHIPMENT_MODE] =
"DictionarySendingMethods";
241$tablib[DICT_EFFECTIF] =
"DictionaryStaff";
242$tablib[DICT_INPUT_METHOD] =
"DictionaryOrderMethods";
243$tablib[DICT_AVAILABILITY] =
"DictionaryAvailability";
244$tablib[DICT_INPUT_REASON] =
"DictionarySource";
245$tablib[DICT_REVENUESTAMP] =
"DictionaryRevenueStamp";
246$tablib[DICT_TYPE_RESOURCE] =
"DictionaryResourceType";
247$tablib[DICT_TYPE_CONTAINER] =
"DictionaryTypeOfContainer";
249$tablib[DICT_STCOMM] =
"DictionaryProspectStatus";
250$tablib[DICT_HOLIDAY_TYPES] =
"DictionaryHolidayTypes";
251$tablib[DICT_LEAD_STATUS] =
"DictionaryOpportunityStatus";
252$tablib[DICT_FORMAT_CARDS] =
"DictionaryFormatCards";
253$tablib[DICT_INVOICE_SUBTYPE] =
"DictionaryInvoiceSubtype";
254$tablib[DICT_HRM_PUBLIC_HOLIDAY] =
"DictionaryPublicHolidays";
255$tablib[DICT_HRM_DEPARTMENT] =
"DictionaryDepartment";
256$tablib[DICT_HRM_FUNCTION] =
"DictionaryFunction";
257$tablib[DICT_EXP_TAX_CAT] =
"DictionaryExpenseTaxCat";
258$tablib[DICT_EXP_TAX_RANGE] =
"DictionaryExpenseTaxRange";
259$tablib[DICT_UNITS] =
"DictionaryMeasuringUnits";
260$tablib[DICT_SOCIALNETWORKS] =
"DictionarySocialNetworks";
261$tablib[DICT_PROSPECTCONTACTLEVEL] =
"DictionaryProspectContactLevel";
262$tablib[DICT_STCOMMCONTACT] =
"DictionaryProspectContactStatus";
263$tablib[DICT_TRANSPORT_MODE] =
"DictionaryTransportMode";
264$tablib[DICT_PRODUCT_NATURE] =
"DictionaryProductNature";
265$tablib[DICT_PRODUCTBATCH_QCSTATUS] =
"DictionaryBatchStatus";
266$tablib[DICT_ASSET_DISPOSAL_TYPE] =
"DictionaryAssetDisposalType";
270$tabsql[DICT_FORME_JURIDIQUE] =
"SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX.
"c_forme_juridique as f, ".MAIN_DB_PREFIX.
"c_country as c WHERE f.fk_pays=c.rowid";
271$tabsql[DICT_DEPARTEMENTS] =
"SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX.
"c_departements as d, ".MAIN_DB_PREFIX.
"c_regions as r, ".MAIN_DB_PREFIX.
"c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1";
272$tabsql[DICT_REGIONS] =
"SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX.
"c_regions as r, ".MAIN_DB_PREFIX.
"c_country as c WHERE r.fk_pays=c.rowid and c.active=1";
273$tabsql[DICT_COUNTRY] =
"SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite, c.eec, c.sepa FROM ".MAIN_DB_PREFIX.
"c_country AS c";
274$tabsql[DICT_CIVILITY] =
"SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX.
"c_civility AS c";
275$tabsql[DICT_ACTIONCOMM] =
"SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX.
"c_actioncomm AS a";
276$tabsql[DICT_CHARGESOCIALES] =
"SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX.
"c_chargesociales AS a, ".MAIN_DB_PREFIX.
"c_country as c WHERE a.fk_pays = c.rowid and c.active = 1";
277$tabsql[DICT_TYPENT] =
"SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.position, t.module, t.active FROM ".MAIN_DB_PREFIX.
"c_typent as t LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as c ON t.fk_country=c.rowid";
278$tabsql[DICT_CURRENCIES] =
"SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX.
"c_currencies AS c";
279$tabsql[DICT_TVA] =
"SELECT t.rowid, t.entity, t.code, t.type_vat, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.fk_department_buyer as department_buyer_id, db.nom as department_buyer, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy, t.use_default FROM ".MAIN_DB_PREFIX.
"c_tva as t INNER JOIN ".MAIN_DB_PREFIX.
"c_country as c ON t.fk_pays = c.rowid LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as db ON t.fk_department_buyer = db.rowid WHERE t.entity IN (".
getEntity($tabname[DICT_TVA]).
")";
280$tabsql[DICT_TYPE_CONTACT] =
"SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX.
"c_type_contact AS t";
281$tabsql[DICT_PAYMENT_TERM] =
"SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.deposit_percent, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX.
"c_payment_term AS c WHERE c.entity IN (".
getEntity($tabname[DICT_PAYMENT_TERM]).
")";
282$tabsql[DICT_PAIEMENT] =
"SELECT c.id as rowid, c.code, c.libelle, c.type, c.accountancy_code, c.active, c.entity FROM ".MAIN_DB_PREFIX.
"c_paiement AS c WHERE c.entity IN (".
getEntity($tabname[DICT_PAIEMENT]).
")";
283$tabsql[DICT_ECOTAXE] =
"SELECT e.rowid as rowid, e.code as code, e.label, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX.
"c_ecotaxe AS e, ".MAIN_DB_PREFIX.
"c_country as c WHERE e.fk_pays=c.rowid and c.active=1";
284$tabsql[DICT_PAPER_FORMAT] =
"SELECT t.rowid as rowid, t.code, t.label as libelle, t.width, t.height, t.unit, t.active FROM ".MAIN_DB_PREFIX.
"c_paper_format as t";
285$tabsql[DICT_PROSPECTLEVEL] =
"SELECT t.code, t.label as libelle, t.sortorder, t.active FROM ".MAIN_DB_PREFIX.
"c_prospectlevel as t";
286$tabsql[DICT_TYPE_FEES] =
"SELECT t.id as rowid, t.code, t.label, t.accountancy_code, t.active FROM ".MAIN_DB_PREFIX.
"c_type_fees as t";
287$tabsql[DICT_SHIPMENT_MODE] =
"SELECT t.rowid as rowid, t.code, t.libelle, t.tracking, t.active FROM ".MAIN_DB_PREFIX.
"c_shipment_mode as t";
288$tabsql[DICT_EFFECTIF] =
"SELECT t.id as rowid, t.code, t.libelle, t.active FROM ".MAIN_DB_PREFIX.
"c_effectif as t";
289$tabsql[DICT_INPUT_METHOD] =
"SELECT t.rowid as rowid, t.code, t.libelle, t.active FROM ".MAIN_DB_PREFIX.
"c_input_method as t";
290$tabsql[DICT_AVAILABILITY] =
"SELECT c.rowid as rowid, c.code, c.label, c.type_duration, c.qty, c.active, c.position FROM ".MAIN_DB_PREFIX.
"c_availability AS c";
291$tabsql[DICT_INPUT_REASON] =
"SELECT t.rowid as rowid, t.code, t.label, t.active FROM ".MAIN_DB_PREFIX.
"c_input_reason as t";
292$tabsql[DICT_REVENUESTAMP] =
"SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX.
"c_revenuestamp as t, ".MAIN_DB_PREFIX.
"c_country as c WHERE t.fk_pays=c.rowid";
293$tabsql[DICT_TYPE_RESOURCE] =
"SELECT t.rowid as rowid, t.code, t.label, t.active FROM ".MAIN_DB_PREFIX.
"c_type_resource as t";
294$tabsql[DICT_TYPE_CONTAINER] =
"SELECT t.rowid as rowid, t.code, t.label, t.active, t.module FROM ".MAIN_DB_PREFIX.
"c_type_container as t WHERE t.entity IN (".
getEntity($tabname[DICT_TYPE_CONTAINER]).
")";
296$tabsql[DICT_STCOMM] =
"SELECT t.id as rowid, t.code, t.libelle, t.picto, t.active FROM ".MAIN_DB_PREFIX.
"c_stcomm as t";
297$tabsql[DICT_HOLIDAY_TYPES] =
"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.block_if_negative, h.sortorder, 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 WHERE h.entity IN (".
getEntity($tabname[DICT_HOLIDAY_TYPES]).
")";
298$tabsql[DICT_LEAD_STATUS] =
"SELECT t.rowid as rowid, t.code, t.label, percent, t.position, t.active FROM ".MAIN_DB_PREFIX.
"c_lead_status as t";
299$tabsql[DICT_FORMAT_CARDS] =
"SELECT t.rowid, t.code, t.name, t.paper_size, t.orientation, t.metric, t.leftmargin, t.topmargin, t.nx, t.ny, t.spacex, t.spacey, t.width, t.height, t.font_size, t.custom_x, t.custom_y, t.active FROM ".MAIN_DB_PREFIX.
"c_format_cards as t";
300$tabsql[DICT_INVOICE_SUBTYPE] =
"SELECT t.rowid, t.code, t.label, c.label as country, c.code as country_code, t.fk_country as country_id, t.active FROM ".MAIN_DB_PREFIX.
"c_invoice_subtype as t, ".MAIN_DB_PREFIX.
"c_country as c WHERE t.fk_country = c.rowid";
301$tabsql[DICT_HRM_PUBLIC_HOLIDAY] =
"SELECT a.id as rowid, a.entity, a.code, a.fk_country as country_id, c.code as country_code, c.label as country, a.dayrule, a.day, a.month, a.year, a.active FROM ".MAIN_DB_PREFIX.
"c_hrm_public_holiday as a LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as c ON a.fk_country=c.rowid AND c.active=1 WHERE a.entity IN (".
getEntity($tabname[DICT_HRM_PUBLIC_HOLIDAY]).
")";
302$tabsql[DICT_HRM_DEPARTMENT] =
"SELECT t.rowid, t.pos, t.code, t.label, t.active FROM ".MAIN_DB_PREFIX.
"c_hrm_department as t";
303$tabsql[DICT_HRM_FUNCTION] =
"SELECT t.rowid, t.pos, t.code, t.label, t.c_level, t.active FROM ".MAIN_DB_PREFIX.
"c_hrm_function as t";
304$tabsql[DICT_EXP_TAX_CAT] =
"SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX.
"c_exp_tax_cat as c";
305$tabsql[DICT_EXP_TAX_RANGE] =
"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";
306$tabsql[DICT_UNITS] =
"SELECT r.rowid, r.code, r.sortorder, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX.
"c_units r";
307$tabsql[DICT_SOCIALNETWORKS] =
"SELECT s.rowid, s.entity, s.code, s.label, s.url, s.icon, s.active FROM ".MAIN_DB_PREFIX.
"c_socialnetworks as s WHERE s.entity IN (".
getEntity($tabname[DICT_SOCIALNETWORKS]).
")";
308$tabsql[DICT_PROSPECTCONTACTLEVEL] =
"SELECT t.code, t.label as libelle, t.sortorder, t.active FROM ".MAIN_DB_PREFIX.
"c_prospectcontactlevel as t";
309$tabsql[DICT_STCOMMCONTACT] =
"SELECT t.id as rowid, t.code, t.libelle, t.picto, t.active FROM ".MAIN_DB_PREFIX.
"c_stcommcontact as t";
310$tabsql[DICT_TRANSPORT_MODE] =
"SELECT t.rowid as rowid, t.code, t.label, t.active FROM ".MAIN_DB_PREFIX.
"c_transport_mode as t";
311$tabsql[DICT_PRODUCT_NATURE] =
"SELECT t.rowid as rowid, t.code, t.label, t.active FROM ".MAIN_DB_PREFIX.
"c_product_nature as t";
312$tabsql[DICT_PRODUCTBATCH_QCSTATUS] =
"SELECT t.rowid, t.code, t.label, t.active FROM ".MAIN_DB_PREFIX.
"c_productbatch_qcstatus as t";
313$tabsql[DICT_ASSET_DISPOSAL_TYPE] =
"SELECT t.rowid, t.code, t.label, t.active FROM ".MAIN_DB_PREFIX.
"c_asset_disposal_type as t";
316$tabsqlsort = array();
317$tabsqlsort[DICT_FORME_JURIDIQUE] =
"country ASC, code ASC";
318$tabsqlsort[DICT_DEPARTEMENTS] =
"country ASC, code ASC";
319$tabsqlsort[DICT_REGIONS] =
"country ASC, code ASC";
320$tabsqlsort[DICT_COUNTRY] =
"code ASC";
321$tabsqlsort[DICT_CIVILITY] =
"label ASC";
322$tabsqlsort[DICT_ACTIONCOMM] =
"a.type ASC, a.module ASC, a.position ASC, a.code ASC";
323$tabsqlsort[DICT_CHARGESOCIALES] =
"c.label ASC, a.code ASC, a.libelle ASC";
324$tabsqlsort[DICT_TYPENT] =
"country DESC,".(getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
' t.position ASC,' :
'').
" libelle ASC";
325$tabsqlsort[DICT_CURRENCIES] =
"label ASC";
326$tabsqlsort[DICT_TVA] =
"country ASC, department_buyer ASC, code ASC, taux ASC, recuperableonly ASC, localtax1 ASC, localtax2 ASC";
327$tabsqlsort[DICT_TYPE_CONTACT] =
"t.element ASC, t.source ASC, t.position ASC, t.code ASC";
328$tabsqlsort[DICT_PAYMENT_TERM] =
"sortorder ASC, code ASC";
329$tabsqlsort[DICT_PAIEMENT] =
"code ASC";
330$tabsqlsort[DICT_ECOTAXE] =
"country ASC, e.organization ASC, code ASC";
331$tabsqlsort[DICT_PAPER_FORMAT] =
"rowid ASC";
332$tabsqlsort[DICT_PROSPECTLEVEL] =
"sortorder ASC";
333$tabsqlsort[DICT_TYPE_FEES] =
"code ASC";
334$tabsqlsort[DICT_SHIPMENT_MODE] =
"code ASC, libelle ASC";
335$tabsqlsort[DICT_EFFECTIF] =
"id ASC";
336$tabsqlsort[DICT_INPUT_METHOD] =
"code ASC, libelle ASC";
337$tabsqlsort[DICT_AVAILABILITY] =
"position ASC, type_duration ASC, qty ASC";
338$tabsqlsort[DICT_INPUT_REASON] =
"code ASC, label ASC";
339$tabsqlsort[DICT_REVENUESTAMP] =
"country ASC, taux ASC";
340$tabsqlsort[DICT_TYPE_RESOURCE] =
"code ASC, label ASC";
341$tabsqlsort[DICT_TYPE_CONTAINER] =
"t.module ASC, t.code ASC, t.label ASC";
343$tabsqlsort[DICT_STCOMM] =
"code ASC";
344$tabsqlsort[DICT_HOLIDAY_TYPES] =
"sortorder ASC, country ASC, code ASC";
345$tabsqlsort[DICT_LEAD_STATUS] =
"position ASC";
346$tabsqlsort[DICT_FORMAT_CARDS] =
"code ASC";
347$tabsqlsort[DICT_INVOICE_SUBTYPE] =
"country ASC, code ASC";
348$tabsqlsort[DICT_HRM_PUBLIC_HOLIDAY] =
"country, year ASC, month ASC, day ASC";
349$tabsqlsort[DICT_HRM_DEPARTMENT] =
"code ASC";
350$tabsqlsort[DICT_HRM_FUNCTION] =
"code ASC";
351$tabsqlsort[DICT_EXP_TAX_CAT] =
"c.label ASC";
352$tabsqlsort[DICT_EXP_TAX_RANGE] =
"r.fk_c_exp_tax_cat ASC, r.range_ik ASC";
353$tabsqlsort[DICT_UNITS] =
"sortorder ASC";
354$tabsqlsort[DICT_SOCIALNETWORKS] =
"rowid, code ASC";
355$tabsqlsort[DICT_PROSPECTCONTACTLEVEL] =
"sortorder ASC";
356$tabsqlsort[DICT_STCOMMCONTACT] =
"code ASC";
357$tabsqlsort[DICT_TRANSPORT_MODE] =
"code ASC";
358$tabsqlsort[DICT_PRODUCT_NATURE] =
"code ASC";
359$tabsqlsort[DICT_PRODUCTBATCH_QCSTATUS] =
"code ASC";
360$tabsqlsort[DICT_ASSET_DISPOSAL_TYPE] =
"code ASC";
364$tabfield[DICT_FORME_JURIDIQUE] =
"code,libelle,country";
365$tabfield[DICT_DEPARTEMENTS] =
"code,libelle,region_id,region,country";
366$tabfield[DICT_REGIONS] =
"code,libelle,country_id,country";
367$tabfield[DICT_COUNTRY] =
"code,label";
368$tabfield[DICT_CIVILITY] =
"code,label";
369$tabfield[DICT_ACTIONCOMM] =
"code,libelle,type,color,position";
370$tabfield[DICT_CHARGESOCIALES] =
"code,libelle,country,accountancy_code";
371$tabfield[DICT_TYPENT] =
"code,libelle,module,country_id,country".(getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
',position' :
'');
372$tabfield[DICT_CURRENCIES] =
"code,label,unicode";
373$tabfield[DICT_TVA] =
"country_id,country,department_buyer_id,department_buyer,code,type_vat,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,use_default,note";
374$tabfield[DICT_TYPE_CONTACT] =
"element,source,code,libelle,position";
375$tabfield[DICT_PAYMENT_TERM] =
"code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder";
376$tabfield[DICT_PAIEMENT] =
"code,libelle,type,accountancy_code";
377$tabfield[DICT_ECOTAXE] =
"code,label,price,organization,country";
378$tabfield[DICT_PAPER_FORMAT] =
"code,libelle,width,height,unit";
379$tabfield[DICT_PROSPECTLEVEL] =
"code,libelle,sortorder";
380$tabfield[DICT_TYPE_FEES] =
"code,label,accountancy_code";
381$tabfield[DICT_SHIPMENT_MODE] =
"code,libelle,tracking";
382$tabfield[DICT_EFFECTIF] =
"code,libelle";
383$tabfield[DICT_INPUT_METHOD] =
"code,libelle";
384$tabfield[DICT_AVAILABILITY] =
"code,label,qty,type_duration,position";
385$tabfield[DICT_INPUT_REASON] =
"code,label";
386$tabfield[DICT_REVENUESTAMP] =
"country_id,country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
387$tabfield[DICT_TYPE_RESOURCE] =
"code,label";
388$tabfield[DICT_TYPE_CONTAINER] =
"code,label";
390$tabfield[DICT_STCOMM] =
"code,libelle,picto";
391$tabfield[DICT_HOLIDAY_TYPES] =
"code,label,affect,delay,newbymonth,country_id,country,block_if_negative,sortorder";
392$tabfield[DICT_LEAD_STATUS] =
"code,label,percent,position";
393$tabfield[DICT_FORMAT_CARDS] =
"code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
394$tabfield[DICT_INVOICE_SUBTYPE] =
"country_id,country,code,label";
395$tabfield[DICT_HRM_PUBLIC_HOLIDAY] =
"code,dayrule,year,month,day,country_id,country";
396$tabfield[DICT_HRM_DEPARTMENT] =
"code,label";
397$tabfield[DICT_HRM_FUNCTION] =
"code,label";
398$tabfield[DICT_EXP_TAX_CAT] =
"label";
399$tabfield[DICT_EXP_TAX_RANGE] =
"range_ik,fk_c_exp_tax_cat";
400$tabfield[DICT_UNITS] =
"code,label,short_label,unit_type,scale,sortorder";
401$tabfield[DICT_SOCIALNETWORKS] =
"code,label,url,icon";
402$tabfield[DICT_PROSPECTCONTACTLEVEL] =
"code,libelle,sortorder";
403$tabfield[DICT_STCOMMCONTACT] =
"code,libelle,picto";
404$tabfield[DICT_TRANSPORT_MODE] =
"code,label";
405$tabfield[DICT_PRODUCT_NATURE] =
"code,label";
406$tabfield[DICT_PRODUCTBATCH_QCSTATUS] =
"code,label";
407$tabfield[DICT_ASSET_DISPOSAL_TYPE] =
"code,label";
410$tabfieldvalue = array();
411$tabfieldvalue[DICT_FORME_JURIDIQUE] =
"code,libelle,country";
412$tabfieldvalue[DICT_DEPARTEMENTS] =
"code,libelle,region";
413$tabfieldvalue[DICT_REGIONS] =
"code,libelle,country";
414$tabfieldvalue[DICT_COUNTRY] =
"code,label";
415$tabfieldvalue[DICT_CIVILITY] =
"code,label";
416$tabfieldvalue[DICT_ACTIONCOMM] =
"code,libelle,type,color,position";
417$tabfieldvalue[DICT_CHARGESOCIALES] =
"code,libelle,country,accountancy_code";
418$tabfieldvalue[DICT_TYPENT] =
"code,libelle,country".(getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
',position' :
'');
419$tabfieldvalue[DICT_CURRENCIES] =
"code,label,unicode";
420$tabfieldvalue[DICT_TVA] =
"country,department_buyer_id,code,type_vat,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,use_default,note";
421$tabfieldvalue[DICT_TYPE_CONTACT] =
"element,source,code,libelle,position";
422$tabfieldvalue[DICT_PAYMENT_TERM] =
"code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder";
423$tabfieldvalue[DICT_PAIEMENT] =
"code,libelle,type,accountancy_code";
424$tabfieldvalue[DICT_ECOTAXE] =
"code,label,price,organization,country";
425$tabfieldvalue[DICT_PAPER_FORMAT] =
"code,libelle,width,height,unit";
426$tabfieldvalue[DICT_PROSPECTLEVEL] =
"code,libelle,sortorder";
427$tabfieldvalue[DICT_TYPE_FEES] =
"code,label,accountancy_code";
428$tabfieldvalue[DICT_SHIPMENT_MODE] =
"code,libelle,tracking";
429$tabfieldvalue[DICT_EFFECTIF] =
"code,libelle";
430$tabfieldvalue[DICT_INPUT_METHOD] =
"code,libelle";
431$tabfieldvalue[DICT_AVAILABILITY] =
"code,label,qty,type_duration,position";
432$tabfieldvalue[DICT_INPUT_REASON] =
"code,label";
433$tabfieldvalue[DICT_REVENUESTAMP] =
"country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
434$tabfieldvalue[DICT_TYPE_RESOURCE] =
"code,label";
435$tabfieldvalue[DICT_TYPE_CONTAINER] =
"code,label";
437$tabfieldvalue[DICT_STCOMM] =
"code,libelle,picto";
438$tabfieldvalue[DICT_HOLIDAY_TYPES] =
"code,label,affect,delay,newbymonth,country,block_if_negative,sortorder";
439$tabfieldvalue[DICT_LEAD_STATUS] =
"code,label,percent,position";
440$tabfieldvalue[DICT_FORMAT_CARDS] =
"code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
441$tabfieldvalue[DICT_INVOICE_SUBTYPE] =
"country,code,label";
442$tabfieldvalue[DICT_HRM_PUBLIC_HOLIDAY] =
"code,dayrule,day,month,year,country";
443$tabfieldvalue[DICT_HRM_DEPARTMENT] =
"code,label";
444$tabfieldvalue[DICT_HRM_FUNCTION] =
"code,label";
445$tabfieldvalue[DICT_EXP_TAX_CAT] =
"label";
446$tabfieldvalue[DICT_EXP_TAX_RANGE] =
"range_ik,fk_c_exp_tax_cat";
447$tabfieldvalue[DICT_UNITS] =
"code,label,short_label,unit_type,scale,sortorder";
448$tabfieldvalue[DICT_SOCIALNETWORKS] =
"code,label,url,icon";
449$tabfieldvalue[DICT_PROSPECTCONTACTLEVEL] =
"code,libelle,sortorder";
450$tabfieldvalue[DICT_STCOMMCONTACT] =
"code,libelle,picto";
451$tabfieldvalue[DICT_TRANSPORT_MODE] =
"code,label";
452$tabfieldvalue[DICT_PRODUCT_NATURE] =
"code,label";
453$tabfieldvalue[DICT_PRODUCTBATCH_QCSTATUS] =
"code,label";
454$tabfieldvalue[DICT_ASSET_DISPOSAL_TYPE] =
"code,label";
457$tabfieldinsert = array();
458$tabfieldinsert[DICT_FORME_JURIDIQUE] =
"code,libelle,fk_pays";
459$tabfieldinsert[DICT_DEPARTEMENTS] =
"code_departement,nom,fk_region";
460$tabfieldinsert[DICT_REGIONS] =
"code_region,nom,fk_pays";
461$tabfieldinsert[DICT_COUNTRY] =
"code,label";
462$tabfieldinsert[DICT_CIVILITY] =
"code,label";
463$tabfieldinsert[DICT_ACTIONCOMM] =
"code,libelle,type,color,position";
464$tabfieldinsert[DICT_CHARGESOCIALES] =
"code,libelle,fk_pays,accountancy_code";
465$tabfieldinsert[DICT_TYPENT] =
"code,libelle,fk_country".(getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
',position' :
'');
466$tabfieldinsert[DICT_CURRENCIES] =
"code_iso,label,unicode";
467$tabfieldinsert[DICT_TVA] =
"fk_pays,fk_department_buyer,code,type_vat,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,use_default,note,entity";
468$tabfieldinsert[DICT_TYPE_CONTACT] =
"element,source,code,libelle,position";
469$tabfieldinsert[DICT_PAYMENT_TERM] =
"code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder,entity";
470$tabfieldinsert[DICT_PAIEMENT] =
"code,libelle,type,accountancy_code,entity";
471$tabfieldinsert[DICT_ECOTAXE] =
"code,label,price,organization,fk_pays";
472$tabfieldinsert[DICT_PAPER_FORMAT] =
"code,label,width,height,unit";
473$tabfieldinsert[DICT_PROSPECTLEVEL] =
"code,label,sortorder";
474$tabfieldinsert[DICT_TYPE_FEES] =
"code,label,accountancy_code";
475$tabfieldinsert[DICT_SHIPMENT_MODE] =
"code,libelle,tracking";
476$tabfieldinsert[DICT_EFFECTIF] =
"code,libelle";
477$tabfieldinsert[DICT_INPUT_METHOD] =
"code,libelle";
478$tabfieldinsert[DICT_AVAILABILITY] =
"code,label,qty,type_duration,position";
479$tabfieldinsert[DICT_INPUT_REASON] =
"code,label";
480$tabfieldinsert[DICT_REVENUESTAMP] =
"fk_pays,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
481$tabfieldinsert[DICT_TYPE_RESOURCE] =
"code,label";
482$tabfieldinsert[DICT_TYPE_CONTAINER] =
"code,label,entity";
484$tabfieldinsert[DICT_STCOMM] =
"code,libelle,picto";
485$tabfieldinsert[DICT_HOLIDAY_TYPES] =
"code,label,affect,delay,newbymonth,fk_country,block_if_negative,sortorder,entity";
486$tabfieldinsert[DICT_LEAD_STATUS] =
"code,label,percent,position";
487$tabfieldinsert[DICT_FORMAT_CARDS] =
"code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
488$tabfieldinsert[DICT_INVOICE_SUBTYPE] =
"fk_country,code,label";
489$tabfieldinsert[DICT_HRM_PUBLIC_HOLIDAY] =
"code,dayrule,day,month,year,fk_country,entity";
490$tabfieldinsert[DICT_HRM_DEPARTMENT] =
"code,label";
491$tabfieldinsert[DICT_HRM_FUNCTION] =
"code,label";
492$tabfieldinsert[DICT_EXP_TAX_CAT] =
"label";
493$tabfieldinsert[DICT_EXP_TAX_RANGE] =
"range_ik,fk_c_exp_tax_cat";
494$tabfieldinsert[DICT_UNITS] =
"code,label,short_label,unit_type,scale,sortorder";
495$tabfieldinsert[DICT_SOCIALNETWORKS] =
"code,label,url,icon,entity";
496$tabfieldinsert[DICT_PROSPECTCONTACTLEVEL] =
"code,label,sortorder";
497$tabfieldinsert[DICT_STCOMMCONTACT] =
"code,libelle,picto";
498$tabfieldinsert[DICT_TRANSPORT_MODE] =
"code,label";
499$tabfieldinsert[DICT_PRODUCT_NATURE] =
"code,label";
500$tabfieldinsert[DICT_PRODUCTBATCH_QCSTATUS] =
"code,label";
501$tabfieldinsert[DICT_ASSET_DISPOSAL_TYPE] =
"code,label";
507$tabrowid[DICT_FORME_JURIDIQUE] =
"";
508$tabrowid[DICT_DEPARTEMENTS] =
"";
509$tabrowid[DICT_REGIONS] =
"";
510$tabrowid[DICT_COUNTRY] =
"rowid";
511$tabrowid[DICT_CIVILITY] =
"rowid";
512$tabrowid[DICT_ACTIONCOMM] =
"id";
513$tabrowid[DICT_CHARGESOCIALES] =
"id";
514$tabrowid[DICT_TYPENT] =
"id";
515$tabrowid[DICT_CURRENCIES] =
"code_iso";
516$tabrowid[DICT_TVA] =
"";
517$tabrowid[DICT_TYPE_CONTACT] =
"rowid";
518$tabrowid[DICT_PAYMENT_TERM] =
"";
519$tabrowid[DICT_PAIEMENT] =
"id";
520$tabrowid[DICT_ECOTAXE] =
"";
521$tabrowid[DICT_PAPER_FORMAT] =
"";
522$tabrowid[DICT_PROSPECTLEVEL] =
"code";
523$tabrowid[DICT_TYPE_FEES] =
"id";
524$tabrowid[DICT_SHIPMENT_MODE] =
"rowid";
525$tabrowid[DICT_EFFECTIF] =
"id";
526$tabrowid[DICT_INPUT_METHOD] =
"";
527$tabrowid[DICT_AVAILABILITY] =
"rowid";
528$tabrowid[DICT_INPUT_REASON] =
"rowid";
529$tabrowid[DICT_REVENUESTAMP] =
"";
530$tabrowid[DICT_TYPE_RESOURCE] =
"";
531$tabrowid[DICT_TYPE_CONTAINER] =
"";
533$tabrowid[DICT_STCOMM] =
"id";
534$tabrowid[DICT_HOLIDAY_TYPES] =
"";
535$tabrowid[DICT_LEAD_STATUS] =
"";
536$tabrowid[DICT_FORMAT_CARDS] =
"";
537$tabrowid[DICT_INVOICE_SUBTYPE] =
"";
538$tabrowid[DICT_HRM_PUBLIC_HOLIDAY] =
"id";
539$tabrowid[DICT_HRM_DEPARTMENT] =
"rowid";
540$tabrowid[DICT_HRM_FUNCTION] =
"rowid";
541$tabrowid[DICT_EXP_TAX_CAT] =
"";
542$tabrowid[DICT_EXP_TAX_RANGE] =
"";
543$tabrowid[DICT_UNITS] =
"";
544$tabrowid[DICT_SOCIALNETWORKS] =
"";
545$tabrowid[DICT_PROSPECTCONTACTLEVEL] =
"code";
546$tabrowid[DICT_STCOMMCONTACT] =
"id";
547$tabrowid[DICT_TRANSPORT_MODE] =
"";
548$tabrowid[DICT_PRODUCT_NATURE] =
"rowid";
549$tabrowid[DICT_PRODUCTBATCH_QCSTATUS] =
"rowid";
550$tabrowid[DICT_ASSET_DISPOSAL_TYPE] =
"rowid";
554$tabcond[DICT_FORME_JURIDIQUE] = (
isModEnabled(
"societe"));
555$tabcond[DICT_DEPARTEMENTS] =
true;
556$tabcond[DICT_REGIONS] =
true;
557$tabcond[DICT_COUNTRY] =
true;
562$tabcond[DICT_CURRENCIES] =
true;
563$tabcond[DICT_TVA] =
true;
568$tabcond[DICT_PAPER_FORMAT] =
true;
573$tabcond[DICT_INPUT_METHOD] =
isModEnabled(
"supplier_order");
576$tabcond[DICT_REVENUESTAMP] =
true;
591$tabcond[DICT_SOCIALNETWORKS] =
isModEnabled(
'socialnetworks');
594$tabcond[DICT_TRANSPORT_MODE] =
isModEnabled(
'intracommreport');
597$tabcond[DICT_ASSET_DISPOSAL_TYPE] =
isModEnabled(
'asset');
604 'c_forme_juridique' => array(
605 'picto' =>
'company',
606 'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))
608 'c_departements' => array(
610 'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))
612 'c_regions' => array(
614 'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))
616 'c_country' => array(
'picto' =>
'country',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
617 'c_civility' => array(
'picto' =>
'contact',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
618 'c_actioncomm' => array(
'picto' =>
'action',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'color' => $langs->trans(
"ColorFormat"),
'position' => $langs->trans(
"PositionIntoComboList"))),
619 'c_chargesociales' => array(
'picto' =>
'bill',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
620 'c_typent' => array(
'picto' =>
'company',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'position' => $langs->trans(
"PositionIntoComboList"))),
621 'c_currencies' => array(
'picto' =>
'multicurrency',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'unicode' => $langs->trans(
"UnicodeCurrency"))),
622 'c_tva' => array(
'picto' =>
'bill',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'taux' => $langs->trans(
"SellTaxRate"),
'recuperableonly' => $langs->trans(
"RecuperableOnly"),
'localtax1_type' => $langs->trans(
"LocalTaxDesc"),
'localtax2_type' => $langs->trans(
"LocalTaxDesc"))),
623 'c_type_contact' => array(
'picto' =>
'contact',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'position' => $langs->trans(
"PositionIntoComboList"))),
624 'c_payment_term' => array(
'picto' =>
'bill',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'type_cdr' => $langs->trans(
"TypeCdr", $langs->transnoentitiesnoconv(
"NbOfDays"), $langs->transnoentitiesnoconv(
"Offset"), $langs->transnoentitiesnoconv(
"NbOfDays"), $langs->transnoentitiesnoconv(
"Offset")))),
625 'c_paiement' => array(
'picto' =>
'bill',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
626 'c_ecotaxe' => array(
'picto' =>
'bill',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
627 'c_paper_format' => array(
'picto' =>
'generic',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
628 'c_prospectlevel' => array(
'picto' =>
'company',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
629 'c_type_fees' => array(
'picto' =>
'trip',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
630 'c_shipment_mode' => array(
'picto' =>
'shipment',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'tracking' => $langs->trans(
"UrlTrackingDesc"))),
631 'c_effectif' => array(
'picto' =>
'company',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
632 'c_input_method' => array(
'picto' =>
'order',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
633 'c_input_reason' => array(
'picto' =>
'order',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'position' => $langs->trans(
"PositionIntoComboList"))),
634 'c_availability' => array(
'picto' =>
'shipment',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
635 'c_revenuestamp' => array(
'picto' =>
'bill',
'help' => array(
'revenuestamp_type' => $langs->trans(
'FixedOrPercent'))),
636 'c_type_resource' => array(
'picto' =>
'resource',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
637 'c_type_container' => array(
'picto' =>
'website',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
638 'c_stcomm' => array(
'picto' =>
'company',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'picto' => $langs->trans(
"PictoHelp"))),
639 'c_holiday_types' => array(
'picto' =>
'holiday',
'help' => array(
'affect' => $langs->trans(
"FollowedByACounter"),
'delay' => $langs->trans(
"MinimumNoticePeriod"),
'newbymonth' => $langs->trans(
"NbAddedAutomatically"))),
640 'c_lead_status' => array(
'picto' =>
'project',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'percent' => $langs->trans(
"OpportunityPercent"),
'position' => $langs->trans(
"PositionIntoComboList"))),
641 'c_format_cards' => array(
'picto' =>
'generic',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'name' => $langs->trans(
"LabelName"),
'paper_size' => $langs->trans(
"LabelPaperSize"))),
642 'c_hrm_public_holiday' => array(
'picto' =>
'holiday',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'dayrule' =>
"Keep empty for a date defined with month and day (most common case).<br>Use a keyword like 'easter', 'eastermonday', ... for a date predefined by complex rules.",
'country' => $langs->trans(
"CountryIfSpecificToOneCountry"),
'year' => $langs->trans(
"ZeroMeansEveryYear"))),
643 'c_hrm_department' => array(
'picto' =>
'hrm',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
644 'c_hrm_function' => array(
'picto' =>
'hrm',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
645 'c_exp_tax_cat' => array(
'picto' =>
'expensereport',
'help' => array()),
646 'c_exp_tax_range' => array(
'picto' =>
'expensereport',
'help' => array(
'range_ik' => $langs->trans(
'PrevRangeToThisRange'))),
647 'c_units' => array(
'picto' =>
'product',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'unit_type' => $langs->trans(
'Measuringtype_durationDesc'),
'scale' => $langs->trans(
'MeasuringScaleDesc'))),
648 'c_socialnetworks' => array(
'picto' =>
'share-alt',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'url' => $langs->trans(
'UrlSocialNetworksDesc'),
'icon' => $langs->trans(
'FafaIconSocialNetworksDesc'))),
649 'c_prospectcontactlevel' => array(
'picto' =>
'company',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
650 'c_stcommcontact' => array(
'picto' =>
'company',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"),
'picto' => $langs->trans(
"PictoHelp"))),
651 'c_transport_mode' => array(
'picto' =>
'incoterm',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
652 'c_product_nature' => array(
'picto' =>
'product',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
653 'c_productbatch_qcstatus' => array(
'picto' =>
'lot',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
654 'c_asset_disposal_type' => array(
'picto' =>
'asset',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
655 'c_invoice_subtype' => array(
'picto' =>
'bill',
'help' => array(
'code' => $langs->trans(
"EnterAnyCode"))),
660complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabcomplete);
664foreach ($tabcomplete as $key => $value) {
667 if (!isset($tabcond[$i])) {
670 $tabcomplete[$key][
'id'] = $i;
673 $tabcomplete[$key][
'cond'] = $tabcond[$i];
674 $tabcomplete[$key][
'rowid'] = $tabrowid[$i];
675 $tabcomplete[$key][
'fieldinsert'] = $tabfieldinsert[$i];
676 $tabcomplete[$key][
'fieldvalue'] = $tabfieldvalue[$i];
677 $tabcomplete[$key][
'lib'] = $tablib[$i];
678 $tabcomplete[$key][
'sql'] = $tabsql[$i];
679 $tabcomplete[$key][
'sqlsort'] = $tabsqlsort[$i];
680 $tabcomplete[$key][
'field'] = $tabfield[$i];
687 $arrayofkeys = array_keys($tabcomplete);
688 if (array_key_exists($id - 1, $arrayofkeys)) {
689 $keytable = $arrayofkeys[
$id - 1];
694if (empty($sortfield)) {
695 $tmp1 = explode(
',', empty($tabcomplete[$keytable][
'sqlsort']) ?
'' : $tabcomplete[$keytable][
'sqlsort']);
696 $tmp2 = explode(
' ', $tmp1[0]);
697 $sortfield = preg_replace(
'/^.*\./',
'', $tmp2[0]);
698 $sortorder = (!empty($tmp2[1]) ? $tmp2[1] :
'');
703$elementList = array();
704$sourceList = array();
705if ($id == DICT_TYPE_CONTACT) {
706 $elementList = array(
708 'agenda' =>
img_picto(
'',
'action',
'class="pictofixedwidth"').$langs->trans(
'Agenda'),
709 'dolresource' =>
img_picto(
'',
'resource',
'class="pictofixedwidth"').$langs->trans(
'Resource'),
710 'societe' =>
img_picto(
'',
'company',
'class="pictofixedwidth"').$langs->trans(
'ThirdParty'),
711 'product' =>
img_picto(
'',
'product',
'class="pictofixedwidth"').$langs->trans(
'Product'),
717 'project' =>
img_picto(
'',
'project',
'class="pictofixedwidth"').$langs->trans(
'Project'),
718 'project_task' =>
img_picto(
'',
'projecttask',
'class="pictofixedwidth"').$langs->trans(
'Task'),
719 'propal' =>
img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
'Proposal'),
720 'commande' =>
img_picto(
'',
'order',
'class="pictofixedwidth"').$langs->trans(
'Order'),
721 'shipping' =>
img_picto(
'',
'dolly',
'class="pictofixedwidth"') . $langs->trans(
'Shipment'),
722 'facture' =>
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
'Bill'),
723 'fichinter' =>
img_picto(
'',
'intervention',
'class="pictofixedwidth"').$langs->trans(
'InterventionCard'),
724 'contrat' =>
img_picto(
'',
'contract',
'class="pictofixedwidth"').$langs->trans(
'Contract'),
725 'ticket' =>
img_picto(
'',
'ticket',
'class="pictofixedwidth"').$langs->trans(
'Ticket'),
726 'supplier_proposal' =>
img_picto(
'',
'supplier_proposal',
'class="pictofixedwidth"').$langs->trans(
'SupplierProposal'),
727 'order_supplier' =>
img_picto(
'',
'supplier_order',
'class="pictofixedwidth"').$langs->trans(
'SupplierOrder'),
728 'invoice_supplier' =>
img_picto(
'',
'supplier_invoice',
'class="pictofixedwidth"').$langs->trans(
'SupplierBill'),
729 'conferenceorbooth' =>
img_picto(
'',
'eventorganization',
'class="pictofixedwidth"').$langs->trans(
'ConferenceOrBooth'),
732 complete_elementList_with_modules($elementList);
736 'internal' => $langs->trans(
'Internal'),
737 'external' => $langs->trans(
'External')
742$type_vatList = array(
743 "0" => $langs->trans(
"Sell").
'+'.$langs->trans(
"Buy"),
744 "1" => $langs->trans(
"Sell"),
745 "2" => $langs->trans(
"Buy")
749$localtax_typeList = array(
750 "0" => $langs->trans(
"No"),
751 "1" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 1)",
752 "2" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 2)",
753 "3" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 3)",
754 "4" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 4)",
755 "5" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 5)",
756 "6" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 6)"
770 'confirm' => $confirm,
772 'taborder' => $taborder,
773 'tabname' => $tabname,
776 'tabsqlsort' => $tabsqlsort,
777 'tabfield' => $tabfield,
778 'tabfieldvalue' => $tabfieldvalue,
779 'tabfieldinsert' => $tabfieldinsert,
780 'tabrowid' => $tabrowid,
781 'tabcond' => $tabcond,
782 'tabhelp' => $tabhelp,
783 'tabcomplete' => $tabcomplete
785$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
790if (
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter_x',
'alpha')) {
791 $search_country_id =
'';
796if (empty($reshook)) {
799 $listfield = explode(
',', str_replace(
' ',
'', $tabfield[$id]));
800 $listfieldinsert = explode(
',', $tabfieldinsert[$id]);
801 $listfieldmodify = explode(
',', $tabfieldinsert[$id]);
802 $listfieldvalue = explode(
',', $tabfieldvalue[$id]);
806 foreach ($listfield as $f => $value) {
808 if ($value ==
'country_id' && in_array($tablib[$id], array(
'DictionaryPublicHolidays',
'DictionaryVAT',
'DictionaryInvoiceSubtype',
'DictionaryRegion',
'DictionaryCompanyType',
'DictionaryHolidayTypes',
'DictionaryRevenueStamp',
'DictionaryAccountancysystem',
'DictionaryAccountancyCategory'))) {
811 if ($value ==
'country' && in_array($tablib[$id], array(
'DictionaryPublicHolidays',
'DictionaryCanton',
'DictionaryCompanyType',
'DictionaryHolidayTypes',
'DictionaryRevenueStamp'))) {
815 if (
GETPOST(
'actionadd') && $value ==
'department_buyer_id' && $tablib[$id] ==
'DictionaryVAT') {
819 if ($value ==
'department_buyer' && $tablib[$id] ==
'DictionaryVAT') {
823 if ($value ==
'localtax1' && !
GETPOST(
'localtax1_type')) {
826 if ($value ==
'localtax2' && !
GETPOST(
'localtax2_type')) {
829 if ($value ==
'color' && !
GETPOST(
'color')) {
832 if ($value ==
'formula' && !
GETPOST(
'formula')) {
835 if ($value ==
'dayrule' && !
GETPOST(
'dayrule')) {
838 if ($value ==
'sortorder') {
841 if ((!GETPOSTISSET($value) ||
GETPOST($value) ==
'')
843 !in_array($value, array(
'decalage',
'module',
'accountancy_code',
'accountancy_code_sell',
'accountancy_code_buy',
'tracking',
'picto',
'deposit_percent'))
844 && ($id != DICT_TVA || ($value !=
'code' && $value !=
'note'))
848 $fieldnamekey = $value;
850 if ($fieldnamekey ==
'libelle' || ($fieldnamekey ==
'label')) {
851 $fieldnamekey =
'Label';
853 if ($fieldnamekey ==
'libelle_facture') {
854 $fieldnamekey =
'LabelOnDocuments';
856 if ($fieldnamekey ==
'deposit_percent') {
857 $fieldnamekey =
'DepositPercent';
859 if ($fieldnamekey ==
'nbjour') {
860 $fieldnamekey =
'NbOfDays';
862 if ($fieldnamekey ==
'decalage') {
863 $fieldnamekey =
'Offset';
865 if ($fieldnamekey ==
'module') {
866 $fieldnamekey =
'Module';
868 if ($fieldnamekey ==
'code') {
869 $fieldnamekey =
'Code';
871 if ($fieldnamekey ==
'note') {
872 $fieldnamekey =
'Note';
874 if ($fieldnamekey ==
'taux') {
875 $fieldnamekey =
'Rate';
877 if ($fieldnamekey ==
'type') {
878 $fieldnamekey =
'Type';
880 if ($fieldnamekey ==
'position') {
881 $fieldnamekey =
'Position';
883 if ($fieldnamekey ==
'unicode') {
884 $fieldnamekey =
'Unicode';
886 if ($fieldnamekey ==
'deductible') {
887 $fieldnamekey =
'Deductible';
889 if ($fieldnamekey ==
'sortorder') {
890 $fieldnamekey =
'SortOrder';
892 if ($fieldnamekey ==
'category_type') {
893 $fieldnamekey =
'Calculated';
895 if ($fieldnamekey ==
'revenuestamp_type') {
896 $fieldnamekey =
'TypeOfRevenueStamp';
898 if ($fieldnamekey ==
'use_default') {
899 $fieldnamekey =
'UseByDefault';
902 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->transnoentities($fieldnamekey)),
null,
'errors');
906 if (
GETPOST(
'actionadd') && $tabname[$id] ==
"c_actioncomm" && GETPOSTISSET(
"type") && in_array(
GETPOST(
"type"), array(
'system',
'systemauto'))) {
908 setEventMessages($langs->transnoentities(
'ErrorReservedTypeSystemSystemAuto'),
null,
'errors');
910 if (GETPOSTISSET(
"code")) {
913 setEventMessages($langs->transnoentities(
'ErrorCodeCantContainZero'),
null,
'errors');
916 if (GETPOSTISSET(
"country") && (
GETPOST(
"country") ==
'0') && ($id != DICT_DEPARTEMENTS)) {
917 if (in_array($tablib[$id], array(
'DictionaryCompanyType',
'DictionaryHolidayTypes'))) {
918 $_POST[
"country"] =
'';
921 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->transnoentities(
"Country")),
null,
'errors');
924 if (($id == DICT_REGIONS || $id == DICT_PRODUCT_NATURE) && !is_numeric(
GETPOST(
"code")) &&
GETPOST(
'actionadd')) {
926 setEventMessages($langs->transnoentities(
"ErrorFieldMustBeANumeric", $langs->transnoentities(
"Code")),
null,
'errors');
928 if ($id == DICT_COUNTRY && strlen(
GETPOST(
"code")) != 2) {
930 setEventMessages($langs->transnoentities(
"ErrorCountryCodeMustBe2Char", $langs->transnoentities(
"Code")),
null,
'errors');
932 if ($id == DICT_PAIEMENT && strlen(
GETPOST(
"code")) >= 6) {
934 setEventMessages($langs->transnoentities(
"ErrorFieldMustHaveLessThanXChar", $langs->transnoentities(
"Code"),
'6'),
null,
'errors');
939 $_POST[
"localtax1"] =
'0';
942 $_POST[
"localtax2"] =
'0';
944 if (
GETPOST(
'department_buyer_id') <= 0) {
945 $_POST[
'department_buyer_id'] =
'';
947 if (
GETPOST(
"accountancy_code") <= 0) {
948 $_POST[
"accountancy_code"] =
'';
950 if (
GETPOST(
"accountancy_code_sell") <= 0) {
951 $_POST[
"accountancy_code_sell"] =
'';
953 if (
GETPOST(
"accountancy_code_buy") <= 0) {
954 $_POST[
"accountancy_code_buy"] =
'';
956 if ($id == DICT_TVA && GETPOSTISSET(
"code")) {
957 $_POST[
"code"] = preg_replace(
'/[^a-zA-Z0-9_\-\+]/',
'',
GETPOST(
"code"));
960 $tablename = $tabname[
$id];
961 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
964 if ($ok &&
GETPOST(
'actionadd')) {
966 if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
968 $sql =
"SELECT MAX(".$tabrowid[
$id].
") as newid FROM ".MAIN_DB_PREFIX.$tablename;
969 $result = $db->query($sql);
971 $obj = $db->fetch_object($result);
972 $newid = ((int) $obj->newid) + 1;
979 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.$tablename.
" (";
981 if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
982 $sql .= $tabrowid[
$id].
",";
984 $sql .= $tabfieldinsert[
$id];
989 if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
993 foreach ($listfieldinsert as $f => $value) {
994 $keycode = (isset($listfieldvalue[$i]) ? $listfieldvalue[$i] :
'');
995 if (empty($keycode)) {
999 if ($value ==
'price' || preg_match(
'/^amount/i', $value)) {
1001 } elseif ($value ==
'taux' || $value ==
'localtax1') {
1003 } elseif ($value ==
'entity') {
1004 $_POST[$keycode] = (int)
getEntity($tablename, 0);
1011 if ($keycode ==
'sortorder') {
1013 } elseif (
GETPOST($keycode) ==
'' && !($keycode ==
'code' && $id == DICT_TVA)) {
1015 } elseif ($keycode ==
'content') {
1016 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
1017 } elseif (in_array($keycode, array(
'joinfile',
'private',
'pos',
'position',
'scale',
'use_default'))) {
1020 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
1028 $resql = $db->query($sql);
1030 setEventMessages($langs->transnoentities(
"RecordCreatedSuccessfully"),
null,
'mesgs');
1034 if ($db->type ==
'pgsql' && $tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
1035 $db->query(
"SELECT setval(pg_get_serial_sequence('".$db->escape(MAIN_DB_PREFIX.$db->sanitize($tablename)).
"', '".$db->escape($tabrowid[$id]).
"'), GREATEST((SELECT MAX(".$db->sanitize($tabrowid[$id]).
") FROM ".MAIN_DB_PREFIX.$db->sanitize($tablename).
"), 1))");
1039 if ($id == DICT_TVA &&
GETPOSTINT(
'country') > 0) {
1042 $_POST = array(
'id' => $id);
1044 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
1045 setEventMessages($langs->transnoentities(
"ErrorRecordAlreadyExists"),
null,
'errors');
1053 if ($ok &&
GETPOST(
'actionmodify')) {
1054 if ($tabrowid[$id]) {
1055 $rowidcol = $tabrowid[
$id];
1057 $rowidcol =
"rowid";
1061 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET ";
1063 if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify)) {
1064 $sql .= $tabrowid[
$id].
"=";
1065 $sql .=
"'".$db->escape($rowid).
"', ";
1068 foreach ($listfieldmodify as $field) {
1069 $keycode = empty($listfieldvalue[$i]) ?
'' : $listfieldvalue[$i];
1070 if (empty($keycode)) {
1074 if ($field ==
'price' || preg_match(
'/^amount/i', $field)) {
1076 } elseif ($field ==
'taux' || $field ==
'localtax1') {
1078 } elseif ($field ==
'entity') {
1079 $_POST[$keycode] = (int)
getEntity($tablename, 0);
1086 if ($keycode ==
'sortorder') {
1088 } elseif (
GETPOST($keycode) ==
'' && !($keycode ==
'code' && $id == DICT_TVA)) {
1090 } elseif ($keycode ==
'content') {
1091 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
1092 } elseif (in_array($keycode, array(
'joinfile',
'private',
'pos',
'position',
'scale',
'use_default'))) {
1095 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
1100 if (in_array($rowidcol, array(
'code',
'code_iso'))) {
1101 $sql .=
" WHERE ".$db->sanitize($rowidcol).
" = '".$db->escape($rowid).
"'";
1103 $sql .=
" WHERE ".$db->sanitize($rowidcol).
" = ".((int) $rowid);
1105 if (in_array(
'entity', $listfieldmodify)) {
1106 $sql .=
" AND entity = ".((int)
getEntity($tablename, 0));
1111 $resql = $db->query($sql);
1117 if (!$ok &&
GETPOST(
'actionadd')) {
1120 if (!$ok &&
GETPOST(
'actionmodify')) {
1125 if ($action ==
'confirm_delete' && $confirm ==
'yes') {
1126 if ($tabrowid[$id]) {
1127 $rowidcol = $tabrowid[
$id];
1129 $rowidcol =
"rowid";
1132 $tablename = $tabname[
$id];
1133 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1135 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.$tablename.
" WHERE ".$rowidcol.
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1138 $result = $db->query($sql);
1140 if ($db->errno() ==
'DB_ERROR_CHILD_EXISTS') {
1141 setEventMessages($langs->transnoentities(
"ErrorRecordIsUsedByChild"),
null,
'errors');
1149 if ($action == $acts[0]) {
1150 if ($tabrowid[$id]) {
1151 $rowidcol = $tabrowid[
$id];
1153 $rowidcol =
"rowid";
1156 $tablename = $tabname[
$id];
1157 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1160 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET active = 1 WHERE ".$db->escape($rowidcol).
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1162 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET active = 1 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1167 if ($sql !==
null) {
1168 $result = $db->query($sql);
1178 if ($action == $acts[1]) {
1179 if ($tabrowid[$id]) {
1180 $rowidcol = $tabrowid[
$id];
1182 $rowidcol =
"rowid";
1185 $tablename = $tabname[
$id];
1186 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1189 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET active = 0 WHERE ".$rowidcol.
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1191 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET active = 0 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1196 if ($sql !==
null) {
1197 $result = $db->query($sql);
1207 if ($action ==
'activate_favorite') {
1208 if ($tabrowid[$id]) {
1209 $rowidcol = $tabrowid[
$id];
1211 $rowidcol =
"rowid";
1214 $tablename = $tabname[
$id];
1215 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1218 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET favorite = 1 WHERE ".$rowidcol.
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1220 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET favorite = 1 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1225 if ($sql !==
null) {
1226 $result = $db->query($sql);
1236 if ($action ==
'disable_favorite') {
1237 if ($tabrowid[$id]) {
1238 $rowidcol = $tabrowid[
$id];
1240 $rowidcol =
"rowid";
1243 $tablename = $tabname[
$id];
1244 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1247 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET favorite = 0 WHERE ".$rowidcol.
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1249 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET favorite = 0 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1254 if ($sql !==
null) {
1255 $result = $db->query($sql);
1265 if ($action ==
'activate_eec') {
1266 if ($tabrowid[$id]) {
1267 $rowidcol = $tabrowid[
$id];
1269 $rowidcol =
"rowid";
1272 $tablename = $tabname[
$id];
1273 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1276 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET eec = 1 WHERE ".$rowidcol.
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1278 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET eec = 1 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1283 if ($sql !==
null) {
1284 $result = $db->query($sql);
1294 if ($action ==
'disable_eec') {
1295 if ($tabrowid[$id]) {
1296 $rowidcol = $tabrowid[
$id];
1298 $rowidcol =
"rowid";
1301 $tablename = $tabname[
$id];
1302 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1305 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET eec = 0 WHERE ".$rowidcol.
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1307 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET eec = 0 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1312 if ($sql !==
null) {
1313 $result = $db->query($sql);
1323 if ($action ==
'activate_sepa') {
1324 if ($tabrowid[$id]) {
1325 $rowidcol = $tabrowid[
$id];
1327 $rowidcol =
"rowid";
1330 $tablename = $tabname[
$id];
1331 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1334 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET sepa = 1 WHERE ".$rowidcol.
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1336 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET sepa = 1 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1341 if ($sql !==
null) {
1342 $result = $db->query($sql);
1352 if ($action ==
'disable_sepa') {
1353 if ($tabrowid[$id]) {
1354 $rowidcol = $tabrowid[
$id];
1356 $rowidcol =
"rowid";
1359 $tablename = $tabname[
$id];
1360 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1363 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET sepa = 0 WHERE ".$rowidcol.
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1365 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET sepa = 0 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1370 if ($sql !==
null) {
1371 $result = $db->query($sql);
1386$form =
new Form($db);
1388$title = $langs->trans(
"DictionarySetup");
1390llxHeader(
'', $title,
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-dict');
1392if (
GETPOSTINT(
'id') == DICT_SOCIALNETWORKS && $from ==
'socialnetworksetup') {
1393 $head = socialnetwork_prepare_head();
1399if ($id && empty($from)) {
1400 $title .=
' - '.$langs->trans($tablib[$id]);
1401 $linkback =
'<a href="'.$_SERVER[
'PHP_SELF'].
'">'.
img_picto($langs->trans(
"BackToDictionaryList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToDictionaryList").
'</span></a>';
1403$titlepicto =
'title_setup';
1404if ($id == DICT_TVA &&
GETPOST(
'from') ==
'accountancy') {
1405 $title = $langs->trans(
"MenuVatAccounts");
1406 $titlepicto =
'accountancy';
1408if ($id == DICT_CHARGESOCIALES &&
GETPOST(
'from') ==
'accountancy') {
1409 $title = $langs->trans(
"MenuTaxAccounts");
1410 $titlepicto =
'accountancy';
1413$param =
'&id='.urlencode((
string) ($id));
1414if ($search_country_id || GETPOSTISSET(
'page') ||
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter_x',
'alpha')) {
1415 $param .=
'&search_country_id='.urlencode((
string) ($search_country_id ? $search_country_id : -1));
1417if ($search_code !=
'') {
1418 $param .=
'&search_code='.urlencode($search_code);
1420if ($search_active !=
'') {
1421 $param .=
'&search_active='.urlencode($search_active);
1424 $param .=
'&entity='.(int) $entity;
1427 $param .=
'&from='.urlencode($from);
1429$paramwithsearch = $param;
1431 $paramwithsearch .=
'&sortorder='.urlencode($sortorder);
1434 $paramwithsearch .=
'&sortfield='.urlencode($sortfield);
1437 $paramwithsearch .=
'&from='.urlencode($from);
1442if ($action ==
'delete') {
1443 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?'.($page ?
'page='.$page.
'&' :
'').
'rowid='.urlencode($rowid).
'&code='.urlencode($code).$paramwithsearch, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_delete',
'', 0, 1);
1449 $sqlfields = $tabsql[
$id];
1451 $tablecode =
't.code';
1453 $tableprefixarray = array(
1454 DICT_FORME_JURIDIQUE =>
'f.code',
1455 DICT_DEPARTEMENTS =>
'd.code_departement',
1456 DICT_REGIONS =>
'r.code_region',
1457 DICT_COUNTRY =>
'c.code',
1458 DICT_CIVILITY =>
'c.code',
1459 DICT_ACTIONCOMM =>
'a.code',
1460 DICT_CHARGESOCIALES =>
'a.code',
1461 DICT_TYPENT =>
't.code',
1462 DICT_CURRENCIES =>
'c.code_iso',
1463 DICT_ECOTAXE =>
'e.code',
1464 DICT_HOLIDAY_TYPES =>
'h.code',
1465 DICT_HRM_PUBLIC_HOLIDAY =>
'a.code',
1466 DICT_UNITS =>
'r.code',
1467 DICT_SOCIALNETWORKS =>
's.code',
1473 if (!empty($tableprefixarray[$id])) {
1474 $tablecode = $tableprefixarray[
$id];
1475 $tableprefix = preg_replace(
'/\..*$/',
'.', $tablecode);
1478 if (empty($tableprefix) && preg_match(
'/SELECT ([a-z]\.)rowid/i', $sqlfields, $reg)) {
1479 $tableprefix = $reg[1];
1483 if (!preg_match(
'/ WHERE /', $sql)) {
1484 $sql .=
" WHERE 1 = 1";
1486 if ($search_country_id > 0) {
1487 if ($id == DICT_HRM_PUBLIC_HOLIDAY || $id == DICT_HOLIDAY_TYPES) {
1488 $sql .=
" AND (c.rowid IS NULL OR c.rowid = 0 OR c.rowid = ".((int) $search_country_id).
")";
1490 $sql .=
" AND c.rowid = ".((int) $search_country_id);
1493 if ($search_code !=
'') {
1496 if ($search_active ==
'yes') {
1497 $sql .=
" AND ".$db->sanitize($tableprefix).
"active = 1";
1498 } elseif ($search_active ==
'no') {
1499 $sql .=
" AND ".$db->sanitize($tableprefix).
"active = 0";
1503 $nbtotalofrecords =
'';
1506 $sqlforcount = preg_replace(
'/^.*\sFROM\s/',
'SELECT COUNT(*) as nbtotalofrecords FROM ', $sql);
1507 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1508 $resql = $db->query($sqlforcount);
1510 $objforcount = $db->fetch_object($resql);
1511 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1516 if (($page * $listlimit) > $nbtotalofrecords) {
1525 if ($sortfield ==
'country') {
1526 $sortfield =
'country_code';
1528 $sql .= $db->order($sortfield, $sortorder);
1531 $tabsqlsort[
$id] = preg_replace(
'/([a-z]+\.)?'.$sortfield.
' '.$sortorder.
',/i',
'', $tabsqlsort[$id]);
1532 $tabsqlsort[
$id] = preg_replace(
'/([a-z]+\.)?'.$sortfield.
',/i',
'', $tabsqlsort[$id]);
1534 $sql .=
" ORDER BY ";
1536 $sql .= $tabsqlsort[
$id];
1538 $sql .= $db->plimit($listlimit + 1, $offset);
1540 $resql = $db->query($sql);
1545 $num = $db->num_rows($resql);
1549 if (empty($tabfield[$id])) {
1553 $fieldlist = explode(
',', $tabfield[$id]);
1555 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST">';
1556 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1557 print
'<input type="hidden" name="from" value="'.dol_escape_htmltag($from).
'">';
1561 print
info_admin($langs->trans(
"VATIsUsedIsOff", $langs->transnoentities(
"Setup"), $langs->transnoentities(
"CompanyFoundation")));
1568 $resql = $db->query($sql);
1570 $num = $db->num_rows($resql);
1573 $massactionbutton = $linkback;
1575 $newcardbutton =
'';
1580 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/admin/dict.php?action=create'.$param.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
1582 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'tools', 0, $newcardbutton,
'', $listlimit, 1, 0, 1);
1585 if ($action ==
'create') {
1587 if ($tabname[$id]) {
1590 $fieldlist = explode(
',', $tabfield[$id]);
1592 print
'<div class="div-table-responsive-no-min">';
1593 print
'<table class="noborder centpercent">';
1596 print
'<!-- line title to add new entry -->';
1597 $tdsoffields =
'<tr class="liste_titre">';
1598 foreach ($fieldlist as $field => $value) {
1599 if ($value ==
'entity') {
1600 $withentity = (int)
getEntity($tabname[$id], 0);
1605 $valuetoshow = ucfirst($value);
1606 $valuetoshow = $langs->trans($valuetoshow);
1609 if ($value ==
'pos') {
1610 $valuetoshow = $langs->trans(
"Position");
1613 if ($value ==
'source') {
1614 $valuetoshow = $langs->trans(
"Contact");
1616 if ($value ==
'price') {
1617 $valuetoshow = $langs->trans(
"PriceUHT");
1619 if ($value ==
'taux') {
1620 if ($tabname[$id] !=
"c_revenuestamp") {
1621 $valuetoshow = $langs->trans(
"Rate");
1623 $valuetoshow = $langs->trans(
"Amount");
1627 if ($value ==
'localtax1_type') {
1628 $valuetoshow = $langs->trans(
"UseLocalTax").
" 2";
1632 if ($value ==
'localtax1') {
1633 $valuetoshow = $langs->trans(
"RateOfTaxN",
'2');
1634 $class =
"center minwidth75";
1636 if ($value ==
'localtax2_type') {
1637 $valuetoshow = $langs->trans(
"UseLocalTax").
" 3";
1641 if ($value ==
'localtax2') {
1642 $valuetoshow = $langs->trans(
"RateOfTaxN",
'3');
1643 $class =
"center minwidth75";
1645 if ($value ==
'type_vat') {
1646 $valuetoshow = $langs->trans(
"VATType");
1648 if ($value ==
'organization') {
1649 $valuetoshow = $langs->trans(
"Organization");
1651 if ($value ==
'lang') {
1652 $valuetoshow = $langs->trans(
"Language");
1654 if ($value ==
'type') {
1655 if ($tabname[$id] ==
"c_paiement") {
1656 $valuetoshow = $form->textwithtooltip($langs->trans(
"Type"), $langs->trans(
"TypePaymentDesc"), 2, 1,
img_help(1,
''));
1658 $valuetoshow = $langs->trans(
"Type");
1661 if ($value ==
'code') {
1662 $valuetoshow = $langs->trans(
"Code");
1663 $class =
'maxwidth100';
1665 if ($value ==
'libelle' || $value ==
'label') {
1666 $valuetoshow = $form->textwithtooltip($langs->trans(
"Label"), $langs->trans(
"LabelUsedByDefault"), 2, 1,
img_help(1,
''));
1668 if ($value ==
'libelle_facture') {
1669 $valuetoshow = $form->textwithtooltip($langs->trans(
"LabelOnDocuments"), $langs->trans(
"LabelUsedByDefault"), 2, 1,
img_help(1,
''));
1671 if ($value ==
'deposit_percent') {
1672 $valuetoshow = $langs->trans(
'DepositPercent');
1675 if ($value ==
'country') {
1676 if (in_array(
'region_id', $fieldlist)) {
1680 $valuetoshow = $langs->trans(
"Country");
1682 if ($value ==
'department_buyer') {
1685 if ($value ==
'recuperableonly') {
1686 $valuetoshow = $langs->trans(
"NPR");
1689 if ($value ==
'nbjour') {
1690 $valuetoshow = $langs->trans(
"NbOfDays");
1693 if ($value ==
'type_cdr') {
1694 $valuetoshow = $langs->trans(
"AtEndOfMonth");
1697 if ($value ==
'decalage') {
1698 $valuetoshow = $langs->trans(
"Offset");
1701 if ($value ==
'width' || $value ==
'nx') {
1702 $valuetoshow = $langs->trans(
"Width");
1704 if ($value ==
'height' || $value ==
'ny') {
1705 $valuetoshow = $langs->trans(
"Height");
1707 if ($value ==
'unit' || $value ==
'metric') {
1708 $valuetoshow = $langs->trans(
"MeasuringUnit");
1710 if ($value ==
'region_id' || $value ==
'country_id' || $value ==
'department_buyer_id') {
1713 if ($value ==
'accountancy_code') {
1714 $valuetoshow = $langs->trans(
"AccountancyCode");
1716 if ($value ==
'accountancy_code_sell') {
1717 $valuetoshow = $langs->trans(
"AccountancyCodeSell");
1719 if ($value ==
'accountancy_code_buy') {
1720 $valuetoshow = $langs->trans(
"AccountancyCodeBuy");
1722 if ($value ==
'pcg_version' || $value ==
'fk_pcg_version') {
1723 $valuetoshow = $langs->trans(
"Pcg_version");
1725 if ($value ==
'account_parent') {
1726 $valuetoshow = $langs->trans(
"Accountparent");
1728 if ($value ==
'pcg_type') {
1729 $valuetoshow = $langs->trans(
"Pcg_type");
1731 if ($value ==
'pcg_subtype') {
1732 $valuetoshow = $langs->trans(
"Pcg_subtype");
1734 if ($value ==
'sortorder') {
1735 $valuetoshow = $langs->trans(
"SortOrder");
1738 if ($value ==
'short_label') {
1739 $valuetoshow = $langs->trans(
"ShortLabel");
1741 if ($value ==
'fk_parent') {
1742 $valuetoshow = $langs->trans(
"ParentID");
1745 if ($value ==
'range_account') {
1746 $valuetoshow = $langs->trans(
"Range");
1748 if ($value ==
'sens') {
1749 $valuetoshow = $langs->trans(
"Sens");
1751 if ($value ==
'category_type') {
1752 $valuetoshow = $langs->trans(
"Calculated");
1754 if ($value ==
'formula') {
1755 $valuetoshow = $langs->trans(
"Formula");
1757 if ($value ==
'paper_size') {
1758 $valuetoshow = $langs->trans(
"PaperSize");
1760 if ($value ==
'orientation') {
1761 $valuetoshow = $langs->trans(
"Orientation");
1763 if ($value ==
'leftmargin') {
1764 $valuetoshow = $langs->trans(
"LeftMargin");
1766 if ($value ==
'topmargin') {
1767 $valuetoshow = $langs->trans(
"TopMargin");
1769 if ($value ==
'spacex') {
1770 $valuetoshow = $langs->trans(
"SpaceX");
1772 if ($value ==
'spacey') {
1773 $valuetoshow = $langs->trans(
"SpaceY");
1775 if ($value ==
'font_size') {
1776 $valuetoshow = $langs->trans(
"FontSize");
1778 if ($value ==
'custom_x') {
1779 $valuetoshow = $langs->trans(
"CustomX");
1781 if ($value ==
'custom_y') {
1782 $valuetoshow = $langs->trans(
"CustomY");
1784 if ($value ==
'percent') {
1785 $valuetoshow = $langs->trans(
"Percentage");
1787 if ($value ==
'affect') {
1788 $valuetoshow = $langs->trans(
"WithCounter");
1790 if ($value ==
'delay') {
1791 $valuetoshow = $langs->trans(
"NoticePeriod");
1793 if ($value ==
'newbymonth') {
1794 $valuetoshow = $langs->trans(
"NewByMonth");
1796 if ($value ==
'fk_tva') {
1797 $valuetoshow = $langs->trans(
"VAT");
1799 if ($value ==
'range_ik') {
1800 $valuetoshow = $langs->trans(
"RangeIk");
1802 if ($value ==
'fk_c_exp_tax_cat') {
1803 $valuetoshow = $langs->trans(
"CarCategory");
1805 if ($value ==
'revenuestamp_type') {
1806 $valuetoshow = $langs->trans(
'TypeOfRevenueStamp');
1808 if ($value ==
'use_default') {
1809 $valuetoshow = $langs->trans(
'Default');
1812 if ($value ==
'unit_type') {
1813 $valuetoshow = $langs->trans(
'TypeOfUnit');
1815 if ($value ==
'public' && $tablib[$id] ==
'TicketDictCategory') {
1816 $valuetoshow = $langs->trans(
'TicketGroupIsPublic');
1819 if ($value ==
'block_if_negative') {
1820 $valuetoshow = $langs->trans(
'BlockHolidayIfNegative');
1822 if ($value ==
'type_duration') {
1823 $valuetoshow = $langs->trans(
'Unit');
1826 if ($id == DICT_DEPARTEMENTS) {
1827 if ($value ==
'region_id') {
1828 $valuetoshow =
' ';
1831 if ($value ==
'region') {
1832 $valuetoshow = $langs->trans(
"Country").
'/'.$langs->trans(
"Region");
1837 if ($valuetoshow !=
'') {
1838 $tooltiphelp = (isset($tabcomplete[$tabname[$id]][
'help'][$value]) ? $tabcomplete[$tabname[
$id]][
'help'][$value] :
'');
1840 $tdsoffields .=
'<th'.($class ?
' class="'.$class.
'"' :
'').
'>';
1841 if ($tooltiphelp && preg_match(
'/^http(s*):/i', $tooltiphelp)) {
1842 $tdsoffields .=
'<a href="'.$tooltiphelp.
'" target="_blank">'.$valuetoshow.
' '.
img_help(1, $valuetoshow).
'</a>';
1843 } elseif ($tooltiphelp) {
1844 $tdsoffields .= $form->textwithpicto($valuetoshow, $tooltiphelp);
1846 $tdsoffields .= $valuetoshow;
1848 $tdsoffields .=
'</th>';
1852 if ($id == DICT_COUNTRY) {
1853 $tdsoffields .=
'<th></th>';
1854 $tdsoffields .=
'<th></th>';
1856 $tdsoffields .=
'<th>';
1857 $tdsoffields .=
'<input type="hidden" name="id" value="'.$id.
'">';
1858 if (!is_null($withentity)) {
1859 $tdsoffields .=
'<input type="hidden" name="entity" value="'.$withentity.
'">';
1861 $tdsoffields .=
'</th>';
1862 $tdsoffields .=
'<th style="min-width: 26px;"></th>';
1863 $tdsoffields .=
'<th style="min-width: 26px;"></th>';
1864 $tdsoffields .=
'</tr>';
1870 print
'<!-- line input to add new entry -->';
1871 print
'<tr class="oddeven nodrag nodrop nohover">';
1876 foreach ($fieldlist as $key => $val) {
1883 $tmpaction =
'create';
1884 $parameters = array(
'fieldlist' => $fieldlist,
'tabname' => $tabname[$id]);
1885 $reshook = $hookmanager->executeHooks(
'createDictionaryFieldlist', $parameters, $obj, $tmpaction);
1886 $error = $hookmanager->error;
1887 $errors = $hookmanager->errors;
1889 if ($id == DICT_REGIONS) {
1890 unset($fieldlist[2]);
1893 if (empty($reshook)) {
1897 if ($id == DICT_COUNTRY) {
1902 print
'<td colspan="3" class="center">';
1903 if ($action !=
'edit') {
1904 print
'<input type="submit" class="button button-add small" name="actionadd" value="'.$langs->trans(
"Add").
'">';
1906 print
'<input type="submit" class="button button-add small disabled" name="actionadd" value="'.$langs->trans(
"Add").
'">';
1918 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST">';
1919 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1920 print
'<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
1925 foreach ($fieldlist as $field => $value) {
1926 if ($value ==
'entity') {
1931 if ($value ==
'region_id' || $value ==
'country_id' || $value ==
'department_buyer_id') {
1936 if ($value ==
'country') {
1938 } elseif ($value ==
'code') {
1944 print
'<div class="div-table-responsive">';
1945 print
'<table class="noborder centpercent noborder">';
1950 print
'<!-- line title to search record -->'.
"\n";
1951 print
'<tr class="liste_titre_filter">';
1955 print
'<td class="liste_titre center">';
1957 $searchpicto = $form->showFilterAndCheckAddButtons(0);
1964 foreach ($fieldlist as $field => $value) {
1965 if ($value ==
'entity') {
1970 if ($value ==
'region_id' || $value ==
'country_id' || $value ==
'department_buyer_id') {
1975 if ($value ==
'country') {
1976 print
'<td class="liste_titre">';
1977 print $form->select_country($search_country_id,
'search_country_id',
'', 28,
'minwidth100 maxwidth150 maxwidthonsmartphone',
'',
' ');
1980 } elseif ($value ==
'code') {
1981 print
'<td class="liste_titre">';
1982 print
'<input type="text" class="maxwidth100" name="search_code" value="'.dol_escape_htmltag($search_code).
'">';
1985 } elseif ($value ==
'type_vat') {
1986 print
'<td class="liste_titre">';
1987 print $form->selectarray(
'search_'.$value, $type_vatList, (empty($obj->{$value}) ?
'' : $obj->{$value}), 1);
1991 print
'<td class="liste_titre">';
1997 if ($id == DICT_COUNTRY) {
2007 print
'<td class="liste_titre center parentonrightofpage">';
2008 print $form->selectyesno(
'search_active', $search_active, 0,
false, 1, 1,
'maxwidth100 onrightofpage',
'Activated',
'Disabled');
2014 print
'<td class="liste_titre center">';
2016 $searchpicto = $form->showFilterAndCheckAddButtons(0);
2027 print
'<!-- line title of record -->'.
"\n";
2028 print
'<tr class="liste_titre">';
2035 foreach ($fieldlist as $field => $value) {
2036 if ($value ==
'entity') {
2040 if (in_array($value, array(
'label',
'libelle',
'libelle_facture')) && empty($tabcomplete[$tabname[$id]][
'help'][$value])) {
2041 if (!isset($tabcomplete[$tabname[$id]][
'help']) || !is_array($tabcomplete[$tabname[$id]][
'help'])) {
2042 $tabcomplete[$tabname[
$id]][
'help'] = array();
2044 $tabcomplete[$tabname[
$id]][
'help'][$value] = $langs->trans(
'LabelUsedByDefault');
2052 $valuetoshow = ucfirst($value);
2053 $valuetoshow = $langs->trans($valuetoshow);
2056 if ($value ==
'source') {
2057 $valuetoshow = $langs->trans(
"Contact");
2059 if ($value ==
'price') {
2060 $valuetoshow = $langs->trans(
"PriceUHT");
2062 if ($value ==
'taux') {
2063 if ($tabname[$id] !=
"c_revenuestamp") {
2064 $valuetoshow = $langs->trans(
"Rate");
2066 $valuetoshow = $langs->trans(
"Amount");
2068 $cssprefix =
'center ';
2071 if ($value ==
'type_vat') {
2072 $valuetoshow = $langs->trans(
"VATType");
2073 $cssprefix =
"center minwidth75 ";
2076 if ($value ==
'localtax1_type') {
2077 $valuetoshow = $langs->trans(
"UseLocalTax").
" 2";
2078 $cssprefix =
"center minwidth75 ";
2081 if ($value ==
'localtax1') {
2082 $valuetoshow = $langs->trans(
"RateOfTaxN",
'2');
2083 $cssprefix =
"center minwidth75 ";
2086 if ($value ==
'localtax2_type') {
2087 $valuetoshow = $langs->trans(
"UseLocalTax").
" 3";
2088 $cssprefix =
"center minwidth75 ";
2091 if ($value ==
'localtax2') {
2092 $valuetoshow = $langs->trans(
"RateOfTaxN",
'3');
2093 $cssprefix =
"center minwidth75 ";
2096 if ($value ==
'organization') {
2097 $valuetoshow = $langs->trans(
"Organization");
2099 if ($value ==
'lang') {
2100 $valuetoshow = $langs->trans(
"Language");
2102 if ($value ==
'type') {
2103 $valuetoshow = $langs->trans(
"Type");
2105 if ($value ==
'code') {
2106 $valuetoshow = $langs->trans(
"Code");
2108 if (in_array($value, array(
'pos',
'position'))) {
2109 $valuetoshow = $langs->trans(
"Position");
2110 $cssprefix =
'right ';
2112 if ($value ==
'libelle' || $value ==
'label') {
2113 $valuetoshow = $langs->trans(
"Label");
2115 if ($value ==
'libelle_facture') {
2116 $valuetoshow = $langs->trans(
"LabelOnDocuments");
2118 if ($value ==
'deposit_percent') {
2119 $valuetoshow = $langs->trans(
'DepositPercent');
2120 $cssprefix =
'right ';
2122 if ($value ==
'country') {
2123 $valuetoshow = $langs->trans(
"Country");
2125 if ($value ==
'department_buyer') {
2126 $valuetoshow = $langs->trans(
'DepartmentBuyer');
2128 if ($value ==
'recuperableonly') {
2129 $valuetoshow = $langs->trans(
"NPR");
2130 $cssprefix =
"center ";
2132 if ($value ==
'nbjour') {
2133 $valuetoshow = $langs->trans(
"NbOfDays");
2134 $cssprefix =
'right ';
2136 if ($value ==
'type_cdr') {
2137 $valuetoshow = $langs->trans(
"AtEndOfMonth");
2138 $cssprefix =
"center ";
2140 if ($value ==
'decalage') {
2141 $valuetoshow = $langs->trans(
"Offset");
2142 $cssprefix =
'right ';
2144 if ($value ==
'width' || $value ==
'nx') {
2145 $valuetoshow = $langs->trans(
"Width");
2147 if ($value ==
'height' || $value ==
'ny') {
2148 $valuetoshow = $langs->trans(
"Height");
2150 if ($value ==
'unit' || $value ==
'metric') {
2151 $valuetoshow = $langs->trans(
"MeasuringUnit");
2153 if ($value ==
'accountancy_code') {
2154 $valuetoshow = $langs->trans(
"AccountancyCode");
2156 if ($value ==
'accountancy_code_sell') {
2157 $valuetoshow = $langs->trans(
"AccountancyCodeSell");
2160 if ($value ==
'accountancy_code_buy') {
2161 $valuetoshow = $langs->trans(
"AccountancyCodeBuy");
2164 if ($value ==
'fk_pcg_version') {
2165 $valuetoshow = $langs->trans(
"Pcg_version");
2167 if ($value ==
'account_parent') {
2168 $valuetoshow = $langs->trans(
"Accountsparent");
2170 if ($value ==
'pcg_type') {
2171 $valuetoshow = $langs->trans(
"Pcg_type");
2173 if ($value ==
'pcg_subtype') {
2174 $valuetoshow = $langs->trans(
"Pcg_subtype");
2176 if ($value ==
'sortorder') {
2177 $valuetoshow = $langs->trans(
"SortOrder");
2178 $cssprefix =
'center ';
2180 if ($value ==
'short_label') {
2181 $valuetoshow = $langs->trans(
"ShortLabel");
2183 if ($value ==
'fk_parent') {
2184 $valuetoshow = $langs->trans(
"ParentID");
2185 $cssprefix =
'center ';
2187 if ($value ==
'range_account') {
2188 $valuetoshow = $langs->trans(
"Range");
2190 if ($value ==
'sens') {
2191 $valuetoshow = $langs->trans(
"Sens");
2193 if ($value ==
'category_type') {
2194 $valuetoshow = $langs->trans(
"Calculated");
2196 if ($value ==
'formula') {
2197 $valuetoshow = $langs->trans(
"Formula");
2199 if ($value ==
'paper_size') {
2200 $valuetoshow = $langs->trans(
"PaperSize");
2202 if ($value ==
'orientation') {
2203 $valuetoshow = $langs->trans(
"Orientation");
2205 if ($value ==
'leftmargin') {
2206 $valuetoshow = $langs->trans(
"LeftMargin");
2208 if ($value ==
'topmargin') {
2209 $valuetoshow = $langs->trans(
"TopMargin");
2211 if ($value ==
'spacex') {
2212 $valuetoshow = $langs->trans(
"SpaceX");
2214 if ($value ==
'spacey') {
2215 $valuetoshow = $langs->trans(
"SpaceY");
2217 if ($value ==
'font_size') {
2218 $valuetoshow = $langs->trans(
"FontSize");
2220 if ($value ==
'custom_x') {
2221 $valuetoshow = $langs->trans(
"CustomX");
2223 if ($value ==
'custom_y') {
2224 $valuetoshow = $langs->trans(
"CustomY");
2226 if ($value ==
'percent') {
2227 $valuetoshow = $langs->trans(
"Percentage");
2229 if ($value ==
'affect') {
2230 $valuetoshow = $langs->trans(
"WithCounter");
2232 if ($value ==
'delay') {
2233 $valuetoshow = $langs->trans(
"NoticePeriod");
2235 if ($value ==
'newbymonth') {
2236 $valuetoshow = $langs->trans(
"NewByMonth");
2238 if ($value ==
'fk_tva') {
2239 $valuetoshow = $langs->trans(
"VAT");
2241 if ($value ==
'range_ik') {
2242 $valuetoshow = $langs->trans(
"RangeIk");
2244 if ($value ==
'fk_c_exp_tax_cat') {
2245 $valuetoshow = $langs->trans(
"CarCategory");
2247 if ($value ==
'revenuestamp_type') {
2248 $valuetoshow = $langs->trans(
'TypeOfRevenueStamp');
2250 if ($value ==
'use_default') {
2251 $valuetoshow = $langs->trans(
'Default');
2252 $cssprefix =
'center ';
2254 if ($value ==
'unit_type') {
2255 $valuetoshow = $langs->trans(
'TypeOfUnit');
2257 if ($value ==
'public' && $tablib[$id] ==
'TicketDictCategory') {
2258 $valuetoshow = $langs->trans(
'TicketGroupIsPublic');
2259 $cssprefix =
'center ';
2261 if ($value ==
'block_if_negative') {
2262 $valuetoshow = $langs->trans(
'BlockHolidayIfNegative');
2264 if ($value ==
'type_duration') {
2265 $valuetoshow = $langs->trans(
'Unit');
2268 if ($value ==
'region_id' || $value ==
'country_id' || $value ==
'department_buyer_id') {
2274 $tooltiphelp = (isset($tabcomplete[$tabname[$id]][
'help'][$value]) ? $tabcomplete[$tabname[
$id]][
'help'][$value] :
'');
2276 if ($tooltiphelp && preg_match(
'/^http(s*):/i', $tooltiphelp)) {
2277 $newvaluetoshow =
'<a href="'.$tooltiphelp.
'" target="_blank">'.$valuetoshow.
' '.
img_help(1, $valuetoshow).
'</a>';
2278 } elseif ($tooltiphelp) {
2279 $newvaluetoshow = $form->textwithpicto($valuetoshow, $tooltiphelp);
2281 $newvaluetoshow = $valuetoshow;
2284 print
getTitleFieldOfList($newvaluetoshow, 0, $_SERVER[
"PHP_SELF"], ($sortable ? $value :
''), ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder, $cssprefix);
2288 if ($id == DICT_COUNTRY) {
2289 print
getTitleFieldOfList($langs->trans(
"InEEC"), 0, $_SERVER[
"PHP_SELF"],
"eec", ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center ', 0, $langs->trans(
"CountryIsInEEC"));
2290 print
getTitleFieldOfList($langs->trans(
"InSepa"), 0, $_SERVER[
"PHP_SELF"],
"sepa", ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center ', 0, $langs->trans(
"CountryIsInSepa"));
2291 print
getTitleFieldOfList($langs->trans(
"Favorite"), 0, $_SERVER[
"PHP_SELF"],
"favorite", ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center ');
2295 print
getTitleFieldOfList($langs->trans(
"Status"), 0, $_SERVER[
"PHP_SELF"],
"active", ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center ');
2306 print
'<!-- lines of dict -->'.
"\n";
2308 $obj = $db->fetch_object($resql);
2313 if ($id == DICT_COUNTRY) {
2314 if ($obj->code ==
'') {
2324 if (isset($obj->code) && !in_array($id, array(DICT_TVA, DICT_PRODUCT_NATURE))) {
2325 if (($obj->code ==
'0' || $obj->code ==
'' || preg_match(
'/unknown/i', $obj->code))) {
2328 } elseif ($obj->code ==
'RECEP') {
2331 } elseif ($obj->code ==
'EF0') {
2336 if ($id == DICT_TYPE_CONTAINER && $obj->module ==
'system') {
2339 if (in_array($obj->code, array(
'banner'))) {
2343 if (isset($obj->type) && in_array($obj->type, array(
'system',
'systemauto'))) {
2346 if (in_array(empty($obj->code) ?
'' : $obj->code, array(
'AC_OTH',
'AC_OTH_AUTO')) || in_array(empty($obj->
type) ?
'' : $obj->
type, array(
'systemauto'))) {
2350 $canbemodified = $iserasable;
2352 if (!empty($obj->code) && $obj->code ==
'RECEP') {
2355 if ($tabname[$id] ==
"c_actioncomm") {
2359 if ($tabname[$id] ==
"c_product_nature" && in_array($obj->code, array(0, 1))) {
2365 $rowidcol = empty($tabrowid[$id]) ?
'rowid' : $tabrowid[
$id];
2367 if (empty($rowidcol) || in_array($id, array(DICT_ACTIONCOMM, DICT_CHARGESOCIALES, DICT_TYPENT, DICT_PAIEMENT, DICT_TYPE_FEES, DICT_EFFECTIF, DICT_STCOMM, DICT_HRM_PUBLIC_HOLIDAY))) {
2368 $rowidcol =
'rowid';
2370 $url = $_SERVER[
"PHP_SELF"].
'?'.($page ?
'page='.$page.
'&' :
'').
'sortfield='.urlencode($sortfield).
'&sortorder='.urlencode($sortorder);
2371 $url .=
'&rowid='.(isset($obj->$rowidcol) ? ((int) $obj->$rowidcol) : (!empty($obj->code) ? urlencode($obj->code) :
''));
2372 $url .=
'&code='.(!empty($obj->code) ? urlencode($obj->code) :
'');
2373 if (!empty($param)) {
2377 if (!is_null($withentity)) {
2378 $url .=
'&entity='.((int) $withentity);
2384 print
'<tr class="oddeven" id="rowid-'.(empty($obj->rowid) ?
'' : $obj->rowid).
'">';
2388 print
'<td class="center maxwidthsearch nowraponall">';
2390 if ($canbemodified) {
2391 print
'<a class="reposition editfielda marginleftonly paddingleft marginrightonly paddingright" href="'.$url.
'action=edit&token='.
newToken().
'">'.
img_edit().
'</a>';
2396 print
'<a class="reposition marginleftonly paddingleft marginrightonly paddingright" href="'.$url.
'action=delete&token='.
newToken().
'">'.
img_delete().
'</a>';
2405 if ($action ==
'edit' && ($rowid == (isset($obj->rowid) ? $obj->rowid : $obj->code))) {
2406 $tmpaction =
'edit';
2407 $parameters = array(
'fieldlist' => $fieldlist,
'tabname' => $tabname[$id]);
2408 $reshook = $hookmanager->executeHooks(
'editDictionaryFieldlist', $parameters, $obj, $tmpaction);
2409 $error = $hookmanager->error;
2410 $errors = $hookmanager->errors;
2413 if (empty($reshook)) {
2414 $withentity =
dictFieldList($fieldlist, $obj, $tabname[$id],
'edit');
2417 print
'<td colspan="3" class="center">';
2418 print
'<div name="'.(isset($obj->rowid) ? $obj->rowid : $obj->code).
'"></div>';
2419 print
'<input type="hidden" name="page" value="'.((int) $page).
'">';
2420 print
'<input type="hidden" name="rowid" value="'.dol_escape_htmltag($rowid).
'">';
2421 if (!is_null($withentity)) {
2422 print
'<input type="hidden" name="entity" value="'.$withentity.
'">';
2424 print
'<input type="submit" class="button button-edit smallpaddingimp" name="actionmodify" value="'.$langs->trans(
"Modify").
'">';
2425 print
'<input type="submit" class="button button-cancel smallpaddingimp" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
2428 $tmpaction =
'view';
2429 $parameters = array(
'fieldlist' => $fieldlist,
'tabname' => $tabname[$id]);
2430 $reshook = $hookmanager->executeHooks(
'viewDictionaryFieldlist', $parameters, $obj, $tmpaction);
2432 $error = $hookmanager->error;
2433 $errors = $hookmanager->errors;
2435 $langs->loadLangs(array(
"bills",
"agenda",
"propal"));
2437 if (empty($reshook)) {
2439 $TDurationTypes = $form->getDurationTypes($langs);
2441 foreach ($fieldlist as $field => $value) {
2445 $valuetoshow = empty($obj->$value) ?
'' : $obj->$value;
2448 if ($value ==
'entity') {
2449 $withentity = $valuetoshow;
2454 if ($value ==
'code' && $id == DICT_PRODUCT_NATURE) {
2455 $valuetoshow = (int) $valuetoshow;
2456 } elseif ($value ==
'element') {
2457 $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
2458 } elseif ($value ==
'source') {
2459 $valuetoshow = isset($sourceList[$valuetoshow]) ? $sourceList[$valuetoshow] : $valuetoshow;
2460 } elseif ($valuetoshow ==
'all') {
2461 $valuetoshow = $langs->trans(
'All');
2462 } elseif ($value ==
'country') {
2463 if (empty($obj->country_code)) {
2466 $key = $langs->trans(
"Country".strtoupper($obj->country_code));
2467 $valuetoshow = ($key !=
"Country".strtoupper($obj->country_code) ? $obj->country_code.
" - ".$key : $obj->country);
2469 } elseif ($value ==
'recuperableonly' || $value ==
'deductible' || $value ==
'category_type') {
2470 $valuetoshow =
yn($valuetoshow ? 1 : 0);
2472 } elseif ($value ==
'type_cdr') {
2473 if (empty($valuetoshow)) {
2474 $valuetoshow = $langs->trans(
'None');
2475 } elseif ($valuetoshow == 1) {
2476 $valuetoshow = $langs->trans(
'AtEndOfMonth');
2477 } elseif ($valuetoshow == 2) {
2478 $valuetoshow = $langs->trans(
'CurrentNext');
2480 $class =
"center tdoverflowmax125";
2481 } elseif ($value ==
'price' || preg_match(
'/^amount/i', $value)) {
2482 $valuetoshow =
price($valuetoshow);
2484 if (in_array($value, array(
'private',
'joinfile',
'use_default'))) {
2486 $valuetoshow =
yn($valuetoshow);
2488 } elseif ($value ==
'libelle_facture') {
2489 $key = $langs->trans(
"PaymentCondition".strtoupper($obj->code));
2490 $valuetoshow = ($obj->code && $key !=
"PaymentCondition".strtoupper($obj->code) ? $key : $obj->$value);
2491 $valuetoshow = nl2br($valuetoshow);
2492 $titletoshow = $valuetoshow;
2493 $class =
'small tdoverflowmax200';
2494 } elseif ($value ==
'label' && $tabname[$id] ==
'c_country') {
2495 $key = $langs->trans(
"Country".strtoupper($obj->code));
2496 $valuetoshow = ($obj->code && $key !=
"Country".strtoupper($obj->code) ? $key : $obj->$value);
2497 } elseif ($value ==
'label' && $tabname[$id] ==
'c_availability') {
2498 $key = $langs->trans(
"AvailabilityType".strtoupper($obj->code));
2499 $valuetoshow = ($obj->code && $key !=
"AvailabilityType".strtoupper($obj->code) ? $key : $obj->$value);
2500 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_actioncomm') {
2501 $key = $langs->trans(
"Action".strtoupper($obj->code));
2502 $valuetoshow = ($obj->code && $key !=
"Action".strtoupper($obj->code) ? $key : $obj->$value);
2503 } elseif (!empty($obj->code_iso) && $value ==
'label' && $tabname[$id] ==
'c_currencies') {
2504 $key = $langs->trans(
"Currency".strtoupper($obj->code_iso));
2505 $valuetoshow = ( $key !=
"Currency".strtoupper($obj->code_iso) ? $key : $obj->$value);
2506 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_typent') {
2507 $key = $langs->trans(strtoupper($obj->code));
2508 $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->$value);
2509 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_prospectlevel') {
2510 $key = $langs->trans(strtoupper($obj->code));
2511 $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->$value);
2512 } elseif ($value ==
'label' && $tabname[$id] ==
'c_civility') {
2513 $key = $langs->trans(
"Civility".strtoupper($obj->code));
2514 $valuetoshow = ($obj->code && $key !=
"Civility".strtoupper($obj->code) ? $key : $obj->$value);
2515 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_type_contact') {
2516 $key = $langs->trans(
"TypeContact_".$obj->element.
"_".$obj->source.
"_".strtoupper($obj->code));
2517 $valuetoshow = ($obj->code && $key !=
"TypeContact_".$obj->element.
"_".$obj->source.
"_".strtoupper($obj->code) ? $key : $obj->$value);
2518 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_payment_term') {
2519 $key = $langs->trans(
"PaymentConditionShort".strtoupper($obj->code));
2520 $valuetoshow = ($obj->code && $key !=
"PaymentConditionShort".strtoupper($obj->code) ? $key : $obj->$value);
2521 $titletoshow = $key;
2522 $class =
"tdoverflowmax150";
2523 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_paiement') {
2524 $key = $langs->trans(
"PaymentType".strtoupper($obj->code));
2525 $valuetoshow = $obj->$value;
2526 if ($obj->code && array_key_exists(
"PaymentType".strtoupper($obj->code), $langs->tab_translate)) {
2527 $htmltext = $form->textwithpicto($langs->trans(
"TranslationFound").
': '.$key, $langs->trans(
"TheTranslationIsSearchedFromKey",
"PaymentType".strtoupper($obj->code)));
2529 $htmltext = $form->textwithpicto($langs->trans(
"TranslationFound").
': '.$langs->trans(
"No"), $langs->trans(
"TheTranslationIsSearchedFromKey",
"PaymentType".strtoupper($obj->code)));
2532 $valuetoshow .=
'<br><span class="opacitymedium small">'.$htmltext.
'</span>';
2533 } elseif ($value ==
'type' && $tabname[$id] ==
'c_paiement') {
2534 $payment_type_list = array(0 => $langs->trans(
'PaymentTypeCustomer'), 1 => $langs->trans(
'PaymentTypeSupplier'), 2 => $langs->trans(
'PaymentTypeBoth'));
2535 $valuetoshow = $payment_type_list[$valuetoshow];
2536 } elseif ($value ==
'label' && $tabname[$id] ==
'c_input_reason') {
2537 $key = $langs->trans(
"DemandReasonType".strtoupper($obj->code));
2538 $valuetoshow = ($obj->code && $key !=
"DemandReasonType".strtoupper($obj->code) ? $key : $obj->$value);
2539 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_input_method') {
2540 $langs->load(
"orders");
2541 $key = $langs->trans($obj->code);
2542 $valuetoshow = ($obj->code && $key != $obj->code) ? $key : $obj->$value;
2543 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_shipment_mode') {
2544 $langs->load(
"sendings");
2545 $key = $langs->trans(
"SendingMethod".strtoupper($obj->code));
2546 $valuetoshow = ($obj->code && $key !=
"SendingMethod".strtoupper($obj->code) ? $key : $obj->$value);
2547 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_paper_format') {
2548 $key = $langs->trans(
'PaperFormat'.strtoupper($obj->code));
2549 $valuetoshow = ($obj->code && $key !=
'PaperFormat'.strtoupper($obj->code) ? $key : $obj->$value);
2550 } elseif ($value ==
'label' && $tabname[$id] ==
'c_type_fees') {
2551 $langs->load(
'trips');
2552 $key = $langs->trans(strtoupper($obj->code));
2553 $valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->$value);
2554 } elseif ($value ==
'region_id' || $value ==
'country_id' || $value ==
'department_buyer_id') {
2556 } elseif ($value ==
'unicode') {
2557 $valuetoshow = $langs->getCurrencySymbol($obj->code, 1);
2558 } elseif ($value ==
'label' && $tabname[
GETPOSTINT(
"id")] ==
'c_units') {
2559 $langs->load(
"products");
2560 $valuetoshow = $langs->trans($obj->$value);
2561 } elseif ($value ==
'short_label' && $tabname[
GETPOSTINT(
"id")] ==
'c_units') {
2562 $langs->load(
"products");
2563 $valuetoshow = $langs->trans($obj->$value);
2564 } elseif (($value ==
'unit') && ($tabname[$id] ==
'c_paper_format')) {
2565 $key = $langs->trans(
'SizeUnit'.strtolower($obj->unit));
2566 $valuetoshow = ($obj->code && $key !=
'SizeUnit'.strtolower($obj->unit) ? $key : $obj->$value);
2567 } elseif ($value ==
'localtax1' || $value ==
'localtax2') {
2569 } elseif ($value ==
'type_vat') {
2570 $valuetoshow = $type_vatList[(int) $valuetoshow];
2572 } elseif ($value ==
'localtax1_type') {
2573 if ($obj->localtax1 != 0) {
2574 $valuetoshow = $localtax_typeList[$valuetoshow];
2579 } elseif ($value ==
'localtax2_type') {
2580 if ($obj->localtax2 != 0) {
2581 $valuetoshow = $localtax_typeList[$valuetoshow];
2586 } elseif ($value ==
'taux') {
2587 $valuetoshow =
price($valuetoshow, 0, $langs, 0, 0);
2589 } elseif (in_array($value, array(
'recuperableonly'))) {
2591 } elseif ($value ==
'accountancy_code' || $value ==
'accountancy_code_sell' || $value ==
'accountancy_code_buy') {
2593 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
2595 $tmpaccountingaccount->fetch(0, $valuetoshow, 1);
2596 $titletoshow = $langs->transnoentitiesnoconv(
"Pcgtype").
': '.$tmpaccountingaccount->pcg_type;
2599 } elseif ($value ==
'fk_tva') {
2600 if (empty($form->cache_vatrates)) {
2601 $form->load_tva(
'cache_fk_tva',
'',
$mysoc,
new Societe($db), 0, 0,
'',
false, -1);
2603 foreach ($form->cache_vatrates as $key => $Tab) {
2604 if ($form->cache_vatrates[$key][
'rowid'] == $valuetoshow) {
2605 $valuetoshow = $form->cache_vatrates[$key][
'label'];
2609 } elseif ($value ==
'fk_c_exp_tax_cat') {
2610 $tmpid = $valuetoshow;
2612 $valuetoshow = $langs->trans($valuetoshow ? $valuetoshow : $tmpid);
2613 } elseif ($tabname[$id] ==
'c_exp_tax_cat') {
2614 $valuetoshow = $langs->trans($valuetoshow);
2615 } elseif ($value ==
'label' && $tabname[$id] ==
'c_units') {
2616 $langs->load(
'other');
2617 $key = $langs->trans($obj->label);
2618 $valuetoshow = ($obj->label && $key != strtoupper($obj->label) ? $key : $obj->{$value});
2619 } elseif ($value ==
'label' && $tabname[$id] ==
'c_product_nature') {
2620 $langs->load(
"products");
2621 $valuetoshow = $langs->trans($obj->{$value});
2622 } elseif ($fieldlist[$field] ==
'label' && $tabname[$id] ==
'c_productbatch_qcstatus') {
2623 $langs->load(
"productbatch");
2624 $valuetoshow = $langs->trans($obj->{$value});
2625 } elseif ($value ==
'block_if_negative') {
2626 $valuetoshow =
yn($obj->{$value});
2627 } elseif ($value ==
'icon') {
2628 $valuetoshow = $obj->{$value}.
" ".
img_picto(
"", preg_replace(
'/^fa-/',
'', $obj->{$value}));
2629 } elseif ($value ==
'type_duration') {
2630 if (!empty($obj->{$value}) && array_key_exists($obj->{$value}, $TDurationTypes)) {
2631 $valuetoshow = $TDurationTypes[$obj->{$value}];
2633 } elseif (in_array($value, array(
'leftmargin',
'topmargin',
'spacex',
'spacey',
'width',
'height',
'custom_x',
'custom_y'))) {
2635 } elseif ($value ==
'type' && $id == DICT_ACTIONCOMM && !empty($obj->module)) {
2636 $titletoshow = $langs->trans(
"Module").
' '.$obj->module;
2641 $class .= ($class ?
' ' :
'').
'tddict';
2642 if ($value ==
'name') {
2643 $class .=
' tdoverflowmax200';
2645 if ($value ==
'note' && $id == DICT_TVA) {
2646 $class .=
' tdoverflowmax200';
2648 if ($value ==
'tracking') {
2649 $class .=
' tdoverflowauto';
2651 if (in_array($value, array(
'nbjour',
'decalage',
'pos',
'position',
'deposit_percent'))) {
2654 if (in_array($value, array(
'icon',
'type_vat',
'localtax1_type',
'localtax2_type'))) {
2655 $class .=
' nowraponall';
2657 if (in_array($value, array(
'use_default',
'fk_parent',
'sortorder',
'public'))) {
2658 $class .=
' center';
2660 if (in_array($value, array(
'localtax1_type',
'localtax2_type',
'note',
'note_public',
'note_private'))) {
2665 print
'<!-- field value '. $value .
' --><td class="'.$class.
'"'.($titletoshow ?
' title="'.dolPrintHTMLForAttribute($titletoshow).
'"' :
'').
'>'.$valuetoshow.
'</td>';
2671 if ($id == DICT_COUNTRY) {
2672 print
'<td class="nowraponall center">';
2675 print
'<a class="reposition" href="'.$url.
'action='.$acts[$obj->eec].
'_eec&token='.
newToken().
'">'.$actl[$obj->eec].
'</a>';
2677 print
'<span class="opacitymedium">'.$langs->trans(
"AlwaysActive").
'</span>';
2680 print
'<td class="nowraponall center">';
2683 print
'<a class="reposition" href="'.$url.
'action='.$acts[$obj->sepa].
'_sepa&token='.
newToken().
'">'.$actl[$obj->sepa].
'</a>';
2685 print
'<span class="opacitymedium">'.$langs->trans(
"AlwaysActive").
'</span>';
2688 print
'<td class="nowraponall center">';
2691 print
'<a class="reposition" href="'.$url.
'action='.$acts[$obj->favorite].
'_favorite&token='.
newToken().
'">'.$actl[$obj->favorite].
'</a>';
2693 print
'<span class="opacitymedium">'.$langs->trans(
"AlwaysActive").
'</span>';
2700 print
'<td class="nowraponall center">';
2701 if ($canbedisabled) {
2702 print
'<a class="reposition" href="'.$url.
'action='.$acts[$obj->active].
'&token='.
newToken().
'">'.$actl[$obj->active].
'</a>';
2704 if (in_array($obj->code, array(
'AC_OTH',
'AC_OTH_AUTO'))) {
2705 print $langs->trans(
"AlwaysActive");
2706 } elseif (isset($obj->type) && in_array($obj->type, array(
'systemauto')) && empty($obj->active)) {
2707 print $langs->trans(
"Deprecated");
2708 } elseif (isset($obj->type) && in_array($obj->type, array(
'system')) && !empty($obj->active) && $obj->code !=
'AC_OTH') {
2709 print $langs->trans(
"UsedOnlyWithTypeOption");
2711 print
'<span class="opacitymedium">'.$langs->trans(
"AlwaysActive").
'</span>';
2718 print
'<td class="center maxwidthsearch nowraponall">';
2720 if ($canbemodified) {
2721 print
'<a class="reposition marginleftonly paddingleft marginrightonly paddingright editfielda" href="'.$url.
'action=edit&token='.
newToken().
'">'.
img_edit().
'</a>';
2726 print
'<a class="reposition marginleftonly paddingleft marginrightonly paddingright" href="'.$url.
'action=delete&token='.
newToken().
'">'.
img_delete().
'</a>';
2737 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2753 print
'<span class="opacitymedium">'.$langs->trans(
"DictionaryDesc");
2754 print
" ".$langs->trans(
"OnlyActiveElementsAreShown").
"<br>\n";
2755 print
'</span><br>';
2758 $lastlineisempty =
false;
2760 print
'<div class="div-table-responsive-no-min">';
2761 print
'<table class="noborder centpercent">';
2762 print
'<tr class="liste_titre">';
2763 print
'<td>'.$langs->trans(
"Dictionary").
'</td>';
2765 print
'<td class="hideonsmartphone"></td>';
2768 $showemptyline =
'';
2769 foreach ($taborder as $i) {
2770 if (isset($tabname[$i]) && empty($tabcond[$i])) {
2775 if ($showemptyline) {
2776 print
'<tr class="oddeven"><td></td><td></td><td class="hideonsmartphone"></td></tr>';
2781 $value = $tabname[$i];
2782 print
'<tr class="oddeven"><td class="minwidth200">';
2783 if (!empty($tabcond[$i])) {
2784 $tabnamenoprefix = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabname[$i]);
2785 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$i;
2786 if ($i == DICT_CHARGESOCIALES) {
2787 print
'&search_country_id='.$mysoc->country_id;
2790 if (!empty($tabcomplete[$tabnamenoprefix][
'picto'])) {
2791 print
img_picto(
'', $tabcomplete[$tabnamenoprefix][
'picto'],
'class="pictofixedwidth paddingrightonly"');
2793 print $langs->trans($tablib[$i]);
2796 print $langs->trans($tablib[$i]);
2800 print
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$i.
'">';
2804 print
'<td class="right hideonsmartphone">';
2805 print $form->textwithpicto(
'', $langs->trans(
"Table").
': '.MAIN_DB_PREFIX.$tabname[$i]);
2808 $lastlineisempty =
false;
2810 if (!$lastlineisempty) {
2812 $lastlineisempty =
true;
2840 global $langs, $db,
$mysoc;
2843 global $elementList, $sourceList, $localtax_typeList, $type_vatList;
2852 foreach ($fieldlist as $field => $value) {
2853 if ($value ==
'entity' && isset($obj->$value)) {
2854 $withentity = $obj->$value;
2858 if (in_array($value, array(
'code',
'libelle',
'type')) && $tabname ==
"c_actioncomm" && isset($obj->$value) && in_array($obj->type, array(
'system',
'systemauto'))) {
2860 $hidden = (!empty($obj->{$value}) ? $obj->{$value} :
'');
2862 print
'<input type="hidden" name="'. $value .
'" value="'.$hidden.
'">';
2863 print $langs->trans($hidden);
2865 } elseif ($value ==
'country') {
2866 if (in_array(
'region_id', $fieldlist)) {
2873 $selected = (!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country :
''));
2874 if (!GETPOSTISSET(
'code')) {
2875 $selected =
GETPOST(
'countryidforinsert');
2877 print $form->select_country($selected, $value,
'', 28,
'minwidth100 maxwidth150 maxwidthonsmartphone');
2879 } elseif ($value ==
'country_id') {
2880 if (!in_array(
'country', $fieldlist)) {
2881 $country_id = (!empty($obj->{$value}) ? $obj->{$value} : 0);
2882 print
'<td class="tdoverflowmax100">';
2883 print
'<input type="hidden" name="'. $value .
'" value="'.$country_id.
'">';
2886 } elseif ($value ==
'region') {
2888 $formcompany->select_region($region_id,
'region');
2890 } elseif ($value ==
'region_id') {
2891 $region_id = (!empty($obj->{$value}) ? $obj->{$value} : 0);
2893 print
'<input type="hidden" name="'. $value .
'" value="'.$region_id.
'">';
2895 } elseif ($value ==
'department_buyer') {
2897 print
'<td class="nowraponall">';
2899 $country_code = (!empty($obj->country_code) ? $obj->country_code :
'');
2900 $department_buyer_id = (!empty($obj->department_buyer_id) ? (int) $obj->department_buyer_id : 0);
2901 if ($country_code !=
'') {
2902 print $formcompany->select_state($department_buyer_id, $country_code,
'department_buyer_id',
'minwidth100 maxwidth150 maxwidthonsmartphone');
2906 } elseif ($value ==
'department_buyer_id') {
2907 if (!in_array(
'department_buyer', $fieldlist)) {
2908 $department_buyer_id = (!empty($obj->{$value}) ? $obj->{$value} : 0);
2909 print
'<td class="tdoverflowmax100">';
2910 print
'<input type="hidden" name="'.$value.
'" value="'.$department_buyer_id.
'">';
2913 } elseif ($value ==
'lang') {
2917 } elseif (in_array($value, array(
'element',
'source'))) {
2918 $tmparray = array();
2919 if ($value ==
'element') {
2920 $tmparray = $elementList;
2922 $tmparray = $sourceList;
2925 print $form->selectarray($value, $tmparray, (!empty($obj->{$value}) ? $obj->{$value} :
''), 0, 0, 0,
'', 0, 0, 0,
'',
'maxwidth250');
2927 } elseif (in_array($value, array(
'public',
'use_default'))) {
2929 print
'<td class="center">';
2931 print $form->selectyesno($value, (!empty($obj->{$value}) ? $obj->{$value} :
''), 1);
2933 } elseif ($value ==
'private') {
2936 print $form->selectyesno(
"private", (!empty($obj->{$value}) ? $obj->{$value} :
''));
2938 } elseif ($value ==
'type' && $tabname ==
"c_actioncomm") {
2939 $type = (!empty($obj->type) ? $obj->type :
'user');
2941 print $type.
'<input type="hidden" name="type" value="'.$type.
'">';
2943 } elseif ($value ==
'type' && $tabname ==
'c_paiement') {
2945 $select_list = array(0 => $langs->trans(
'PaymentTypeCustomer'), 1 => $langs->trans(
'PaymentTypeSupplier'), 2 => $langs->trans(
'PaymentTypeBoth'));
2946 print $form->selectarray($value, $select_list, (!empty($obj->{$value}) ? $obj->{$value} :
'2'));
2948 } elseif ($value ==
'recuperableonly' || $value ==
'type_cdr' || $value ==
'deductible' || $value ==
'category_type') {
2949 if ($value ==
'type_cdr') {
2950 print
'<td class="center">';
2954 if ($value ==
'type_cdr') {
2955 print $form->selectarray($value, array(0 => $langs->trans(
'None'), 1 => $langs->trans(
'AtEndOfMonth'), 2 => $langs->trans(
'CurrentNext')), (!empty($obj->{$value}) ? $obj->{$value} :
''));
2958 print $form->selectyesno($value, (!empty($obj->{$value}) ? $obj->{$value} :
''), 1);
2961 } elseif (in_array($value, array(
'nbjour',
'decalage',
'taux',
'localtax1',
'localtax2'))) {
2963 if (in_array($value, array(
'taux',
'localtax1',
'localtax2'))) {
2966 print
'<td class="'.$class.
'">';
2967 print
'<input type="text" class="flat" value="'.(isset($obj->{$value}) ? $obj->{$value} :
'').
'" size="3" name="'. $value .
'">';
2969 } elseif (in_array($value, array(
'libelle_facture'))) {
2974 if ($tabname ==
'c_payment_term') {
2975 $langs->load(
"bills");
2976 if (isset($obj->code) && !empty($obj->code)) {
2977 $transkey =
"PaymentCondition" . strtoupper($obj->code);
2978 if ($langs->trans($transkey) != $transkey) {
2980 print $form->textwithpicto($langs->trans($transkey), $langs->trans(
"GoIntoTranslationMenuToChangeThis"));
2985 print
'<textarea cols="30" rows="'.ROWS_2.
'" class="flat" name="'. $value .
'">'.(empty($obj->{$value}) ?
'' : $obj->{$value}).
'</textarea>';
2987 print
'<input type="hidden" name="'. $value .
'" value="'.$transkey.
'">';
2990 } elseif ($value ==
'price' || preg_match(
'/^amount/i', (
string) $value)) {
2991 print
'<td><input type="text" class="flat minwidth75" value="'.price((!empty($obj->{$value}) ? $obj->{$value} :
'')).
'" name="'. $value .
'"></td>';
2992 } elseif ($value ==
'code' && isset($obj->{$value})) {
2994 if ($tabname ==
'c_paiement' && in_array($obj->{$value}, array(
'LIQ',
'CB',
'CHQ',
'VIR'))) {
2996 print
'<input type="hidden" class="flat minwidth75 maxwidth100" value="'.(empty($obj->{$value}) ?
'' : $obj->{$value}).
'" name="'. $value .
'">';
2997 print $obj->{$value};
2999 print
'<input type="text" class="flat minwidth75 maxwidth100" value="'.(empty($obj->{$value}) ?
'' : $obj->{$value}).
'" name="'. $value .
'">';
3002 } elseif ($value ==
'unit') {
3005 'mm' => $langs->trans(
'SizeUnitmm'),
3006 'cm' => $langs->trans(
'SizeUnitcm'),
3007 'point' => $langs->trans(
'SizeUnitpoint'),
3008 'inch' => $langs->trans(
'SizeUnitinch')
3010 print $form->selectarray(
'unit', $units, (empty($obj->{$value}) ?
'' : $obj->{$value}), 0, 0, 0);
3012 } elseif ($value ==
'type_vat') {
3014 print
'<td class="center">';
3015 print $form->selectarray($value, $type_vatList, (empty($obj->{$value}) ?
'0' : $obj->{$value}));
3017 } elseif ($value ==
'localtax1_type' || $value ==
'localtax2_type') {
3019 print
'<td class="center">';
3020 print $form->selectarray($value, $localtax_typeList, (empty($obj->{$value}) ?
'' : $obj->{$value}));
3022 } elseif ($value ==
'accountancy_code' || $value ==
'accountancy_code_sell' || $value ==
'accountancy_code_buy') {
3025 $fieldname = $value;
3026 $accountancy_account = (empty($obj->$fieldname) ? 0 : $obj->$fieldname);
3027 print $formaccounting->select_account($accountancy_account,
'.'. $value, 1, array(), 1, 1,
'maxwidth125 maxwidthonsmartphone');
3029 $fieldname = $value;
3030 print
'<input type="text" class="flat minwidth100" value="'.(isset($obj->$fieldname) ? $obj->$fieldname :
'').
'" name="'. $value .
'">';
3033 } elseif ($value ==
'fk_tva') {
3035 print $form->load_tva(
'fk_tva', $obj->taux,
$mysoc,
new Societe($db), 0, 0,
'',
false, -1);
3037 } elseif ($value ==
'fk_c_exp_tax_cat') {
3039 print $form->selectExpenseCategories($obj->fk_c_exp_tax_cat);
3041 } elseif ($value ==
'fk_range') {
3043 print $form->selectExpenseRanges($obj->fk_range);
3045 } elseif ($value ==
'block_if_negative') {
3047 print $form->selectyesno(
"block_if_negative", (empty($obj->block_if_negative) ?
'' : $obj->block_if_negative), 1);
3049 } elseif ($value ==
'type_duration') {
3051 print $form->selectTypeDuration(
'', (empty($obj->type_duration) ?
'' : $obj->type_duration), [
's',
'i',
'h']);
3053 } elseif ($value ==
'color') {
3055 print $formother->selectColor((empty($obj->{$value}) ?
'' : $obj->{$value}),
'color');
3058 $fieldValue = isset($obj->{$value}) ? $obj->{$value} :
'';
3062 if ($value ==
'sortorder') {
3063 $fieldlist[$field] =
'position';
3066 if ($fieldlist[$field] ==
'code') {
3067 $class =
'maxwidth100';
3069 if (in_array($fieldlist[$field], array(
'deposit_percent'))) {
3071 $class =
'maxwidth50 right';
3073 if (in_array($fieldlist[$field], array(
'pos',
'position'))) {
3075 $class =
'maxwidth50 right';
3077 if (in_array($fieldlist[$field], array(
'dayrule',
'day',
'month',
'year',
'use_default',
'affect',
'delay',
'public',
'sortorder',
'sens',
'category_type',
'fk_parent'))) {
3078 $class =
'maxwidth50 center';
3080 if (in_array($fieldlist[$field], array(
'use_default',
'public',
'fk_parent'))) {
3081 $classtd =
'center';
3083 if (in_array($fieldlist[$field], array(
'libelle',
'label',
'tracking'))) {
3084 $class =
'quatrevingtpercent';
3087 if ($fieldlist[$field] ==
'fk_parent') {
3088 if (empty($fieldValue)) {
3095 if (in_array($fieldlist[$field], array(
'libelle',
'label'))) {
3098 case 'c_email_senderprofile':
3099 case 'c_forme_juridique':
3100 case 'c_holiday_types':
3101 case 'c_payment_term':
3102 case 'c_transport_mode':
3103 $maxlength =
' maxlength="255"';
3105 case 'c_email_templates':
3106 $maxlength =
' maxlength="180"';
3108 case 'c_socialnetworks':
3109 $maxlength =
' maxlength="150"';
3112 $maxlength =
' maxlength="128"';
3116 print
'<td class="'.$classtd.
'">';
3119 if (in_array($fieldlist[$field], array(
'label',
'libelle'))) {
3121 if ($tabname ==
'c_civility' && !empty($obj->code)) {
3122 $transkey =
"Civility".strtoupper($obj->code);
3124 if ($tabname ==
'c_payment_term' && !empty($obj->code)) {
3125 $langs->load(
"bills");
3126 $transkey =
"PaymentConditionShort".strtoupper($obj->code);
3128 if ($transkey && $langs->trans($transkey) != $transkey) {
3130 print $form->textwithpicto($langs->trans($transkey), $langs->trans(
"GoIntoTranslationMenuToChangeThis"));
3134 print
'<input type="text" class="flat'.($class ?
' '.$class :
'').
'"'.($maxlength ?
' '.$maxlength :
'').
' value="'.
dol_escape_htmltag($fieldValue).
'" name="'.$fieldlist[$field].
'">';
3136 print
'<input type="hidden" name="'.$fieldlist[$field].
'" value="'.$transkey.
'">';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage accounting accounts.
Class to manage third parties objects (customers, suppliers, prospects...)
dictFieldList($fieldlist, $obj=null, $tabname='', $context='')
Show fields in insert/edit mode.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_help($usehelpcursor=1, $usealttitle=1)
Show help logo with cursor "?".
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
getDictionaryValue($tablename, $field, $id, $checkentity=false, $rowidfield='rowid')
Return the value of a filed into a dictionary for the record $id.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
$context
@method int call_trigger(string $triggerName, ?User $user)
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.