37 require
'../main.inc.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
47 $langs->loadLangs(array(
"errors",
"admin",
"main",
"companies",
"resource",
"holiday",
"accountancy",
"hrm",
"orders",
"contracts",
"projects",
"propal",
"bills",
"interventions",
"ticket"));
49 $action =
GETPOST(
'action',
'alpha') ?
GETPOST(
'action',
'alpha') :
'view';
50 $confirm =
GETPOST(
'confirm',
'alpha');
52 $rowid =
GETPOST(
'rowid',
'alpha');
53 $entity =
GETPOST(
'entity',
'int');
54 $code =
GETPOST(
'code',
'alpha');
56 $allowed = $user->admin;
57 if ($id == 7 && !empty($user->rights->accounting->chartofaccount)) {
60 if ($id == 10 && !empty($user->rights->accounting->chartofaccount)) {
63 if ($id == 17 && !empty($user->rights->accounting->chartofaccount)) {
70 $acts = array(); $actl = array();
71 $acts[0] =
"activate";
73 $actl[0] =
img_picto($langs->trans(
"Disabled"),
'switch_off',
'class="size15x"');
74 $actl[1] =
img_picto($langs->trans(
"Activated"),
'switch_on',
'class="size15x"');
76 $listoffset =
GETPOST(
'listoffset');
77 $listlimit =
GETPOST(
'listlimit') > 0 ?
GETPOST(
'listlimit') : 1000;
80 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
81 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
83 if (empty($page) || $page == -1) {
86 $offset = $listlimit * $page;
87 $pageprev = $page - 1;
88 $pagenext = $page + 1;
90 $search_country_id =
GETPOST(
'search_country_id',
'int');
91 if (!
GETPOSTISSET(
'search_country_id') && $search_country_id ==
'' && ($id == 2 || $id == 3 || $id == 10)) {
92 $search_country_id = $mysoc->country_id;
94 $search_code =
GETPOST(
'search_code',
'alpha');
97 $hookmanager->initHooks(array(
'admin',
'dictionaryadmin'));
103 $taborder = array(9, 15, 30, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 6, 24, 0, 29, 0, 33, 34, 32, 28, 17, 35, 36, 0, 10, 23, 12, 13, 7, 0, 14, 0, 22, 20, 18, 21, 41, 0, 37, 42, 0, 43, 0, 25, 0, 44, 0);
107 $tabname[1] =
"c_forme_juridique";
108 $tabname[2] =
"c_departements";
109 $tabname[3] =
"c_regions";
110 $tabname[4] =
"c_country";
111 $tabname[5] =
"c_civility";
112 $tabname[6] =
"c_actioncomm";
113 $tabname[7] =
"c_chargesociales";
114 $tabname[8] =
"c_typent";
115 $tabname[9] =
"c_currencies";
116 $tabname[10] =
"c_tva";
117 $tabname[11] =
"c_type_contact";
118 $tabname[12] =
"c_payment_term";
119 $tabname[13] =
"c_paiement";
120 $tabname[14] =
"c_ecotaxe";
121 $tabname[15] =
"c_paper_format";
122 $tabname[16] =
"c_prospectlevel";
123 $tabname[17] =
"c_type_fees";
124 $tabname[18] =
"c_shipment_mode";
125 $tabname[19] =
"c_effectif";
126 $tabname[20] =
"c_input_method";
127 $tabname[21] =
"c_availability";
128 $tabname[22] =
"c_input_reason";
129 $tabname[23] =
"c_revenuestamp";
130 $tabname[24] =
"c_type_resource";
131 $tabname[25] =
"c_type_container";
133 $tabname[27] =
"c_stcomm";
134 $tabname[28] =
"c_holiday_types";
135 $tabname[29] =
"c_lead_status";
136 $tabname[30] =
"c_format_cards";
138 $tabname[32] =
"c_hrm_public_holiday";
139 $tabname[33] =
"c_hrm_department";
140 $tabname[34] =
"c_hrm_function";
141 $tabname[35] =
"c_exp_tax_cat";
142 $tabname[36] =
"c_exp_tax_range";
143 $tabname[37] =
"c_units";
144 $tabname[38] =
"c_socialnetworks";
145 $tabname[39] =
"c_prospectcontactlevel";
146 $tabname[40] =
"c_stcommcontact";
147 $tabname[41] =
"c_transport_mode";
148 $tabname[42] =
"c_product_nature";
149 $tabname[43] =
"c_productbatch_qcstatus";
150 $tabname[44] =
"c_asset_disposal_type";
154 $tablib[1] =
"DictionaryCompanyJuridicalType";
155 $tablib[2] =
"DictionaryCanton";
156 $tablib[3] =
"DictionaryRegion";
157 $tablib[4] =
"DictionaryCountry";
158 $tablib[5] =
"DictionaryCivility";
159 $tablib[6] =
"DictionaryActions";
160 $tablib[7] =
"DictionarySocialContributions";
161 $tablib[8] =
"DictionaryCompanyType";
162 $tablib[9] =
"DictionaryCurrency";
163 $tablib[10] =
"DictionaryVAT";
164 $tablib[11] =
"DictionaryTypeContact";
165 $tablib[12] =
"DictionaryPaymentConditions";
166 $tablib[13] =
"DictionaryPaymentModes";
167 $tablib[14] =
"DictionaryEcotaxe";
168 $tablib[15] =
"DictionaryPaperFormat";
169 $tablib[16] =
"DictionaryProspectLevel";
170 $tablib[17] =
"DictionaryFees";
171 $tablib[18] =
"DictionarySendingMethods";
172 $tablib[19] =
"DictionaryStaff";
173 $tablib[20] =
"DictionaryOrderMethods";
174 $tablib[21] =
"DictionaryAvailability";
175 $tablib[22] =
"DictionarySource";
176 $tablib[23] =
"DictionaryRevenueStamp";
177 $tablib[24] =
"DictionaryResourceType";
178 $tablib[25] =
"DictionaryTypeOfContainer";
180 $tablib[27] =
"DictionaryProspectStatus";
181 $tablib[28] =
"DictionaryHolidayTypes";
182 $tablib[29] =
"DictionaryOpportunityStatus";
183 $tablib[30] =
"DictionaryFormatCards";
185 $tablib[32] =
"DictionaryPublicHolidays";
186 $tablib[33] =
"DictionaryDepartment";
187 $tablib[34] =
"DictionaryFunction";
188 $tablib[35] =
"DictionaryExpenseTaxCat";
189 $tablib[36] =
"DictionaryExpenseTaxRange";
190 $tablib[37] =
"DictionaryMeasuringUnits";
191 $tablib[38] =
"DictionarySocialNetworks";
192 $tablib[39] =
"DictionaryProspectContactLevel";
193 $tablib[40] =
"DictionaryProspectContactStatus";
194 $tablib[41] =
"DictionaryTransportMode";
195 $tablib[42] =
"DictionaryProductNature";
196 $tablib[43] =
"DictionaryBatchStatus";
197 $tablib[44] =
"DictionaryAssetDisposalType";
201 $tabsql[1] =
"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";
202 $tabsql[2] =
"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";
203 $tabsql[3] =
"SELECT r.rowid as rowid, r.code_region as state_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";
204 $tabsql[4] =
"SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite, c.eec FROM ".MAIN_DB_PREFIX.
"c_country AS c";
205 $tabsql[5] =
"SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX.
"c_civility AS c";
206 $tabsql[6] =
"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";
207 $tabsql[7] =
"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";
208 $tabsql[8] =
"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.active FROM ".MAIN_DB_PREFIX.
"c_typent as t LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as c ON t.fk_country=c.rowid";
209 $tabsql[9] =
"SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX.
"c_currencies AS c";
210 $tabsql[10] =
"SELECT t.rowid, t.code, 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.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX.
"c_tva as t, ".MAIN_DB_PREFIX.
"c_country as c WHERE t.fk_pays=c.rowid";
211 $tabsql[11] =
"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";
212 $tabsql[12] =
"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 = ".
getEntity($tabname[12]);
213 $tabsql[13] =
"SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM ".MAIN_DB_PREFIX.
"c_paiement AS c WHERE c.entity = ".
getEntity($tabname[13]);
214 $tabsql[14] =
"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";
215 $tabsql[15] =
"SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX.
"c_paper_format";
216 $tabsql[16] =
"SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX.
"c_prospectlevel";
217 $tabsql[17] =
"SELECT id as rowid, code, label, accountancy_code, active FROM ".MAIN_DB_PREFIX.
"c_type_fees";
218 $tabsql[18] =
"SELECT rowid as rowid, code, libelle, tracking, active FROM ".MAIN_DB_PREFIX.
"c_shipment_mode";
219 $tabsql[19] =
"SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX.
"c_effectif";
220 $tabsql[20] =
"SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX.
"c_input_method";
221 $tabsql[21] =
"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";
222 $tabsql[22] =
"SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX.
"c_input_reason";
223 $tabsql[23] =
"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";
224 $tabsql[24] =
"SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX.
"c_type_resource";
225 $tabsql[25] =
"SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX.
"c_type_container as t WHERE t.entity = ".
getEntity($tabname[25]);
227 $tabsql[27] =
"SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX.
"c_stcomm";
228 $tabsql[28] =
"SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.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";
229 $tabsql[29] =
"SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX.
"c_lead_status";
230 $tabsql[30] =
"SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX.
"c_format_cards";
232 $tabsql[32] =
"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";
233 $tabsql[33] =
"SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX.
"c_hrm_department";
234 $tabsql[34] =
"SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX.
"c_hrm_function";
235 $tabsql[35] =
"SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX.
"c_exp_tax_cat c";
236 $tabsql[36] =
"SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX.
"c_exp_tax_range r";
237 $tabsql[37] =
"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";
238 $tabsql[38] =
"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 = ".
getEntity($tabname[38]);
239 $tabsql[39] =
"SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX.
"c_prospectcontactlevel";
240 $tabsql[40] =
"SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX.
"c_stcommcontact";
241 $tabsql[41] =
"SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX.
"c_transport_mode";
242 $tabsql[42] =
"SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX.
"c_product_nature";
243 $tabsql[43] =
"SELECT rowid, code, label, active FROM ".MAIN_DB_PREFIX.
"c_productbatch_qcstatus";
244 $tabsql[44] =
"SELECT rowid, code, label, active FROM ".MAIN_DB_PREFIX.
"c_asset_disposal_type";
247 $tabsqlsort = array();
248 $tabsqlsort[1] =
"country ASC, code ASC";
249 $tabsqlsort[2] =
"country ASC, code ASC";
250 $tabsqlsort[3] =
"country ASC, code ASC";
251 $tabsqlsort[4] =
"code ASC";
252 $tabsqlsort[5] =
"label ASC";
253 $tabsqlsort[6] =
"a.type ASC, a.module ASC, a.position ASC, a.code ASC";
254 $tabsqlsort[7] =
"c.label ASC, a.code ASC, a.libelle ASC";
255 $tabsqlsort[8] =
"country DESC,".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
' t.position ASC,' :
'').
" libelle ASC";
256 $tabsqlsort[9] =
"label ASC";
257 $tabsqlsort[10] =
"country ASC, code ASC, taux ASC, recuperableonly ASC, localtax1 ASC, localtax2 ASC";
258 $tabsqlsort[11] =
"t.element ASC, t.source ASC, t.position ASC, t.code ASC";
259 $tabsqlsort[12] =
"sortorder ASC, code ASC";
260 $tabsqlsort[13] =
"code ASC";
261 $tabsqlsort[14] =
"country ASC, e.organization ASC, code ASC";
262 $tabsqlsort[15] =
"rowid ASC";
263 $tabsqlsort[16] =
"sortorder ASC";
264 $tabsqlsort[17] =
"code ASC";
265 $tabsqlsort[18] =
"code ASC, libelle ASC";
266 $tabsqlsort[19] =
"id ASC";
267 $tabsqlsort[20] =
"code ASC, libelle ASC";
268 $tabsqlsort[21] =
"position ASC, type_duration ASC, qty ASC";
269 $tabsqlsort[22] =
"code ASC, label ASC";
270 $tabsqlsort[23] =
"country ASC, taux ASC";
271 $tabsqlsort[24] =
"code ASC, label ASC";
272 $tabsqlsort[25] =
"t.module ASC, t.code ASC, t.label ASC";
274 $tabsqlsort[27] =
"code ASC";
275 $tabsqlsort[28] =
"sortorder ASC, country ASC, code ASC";
276 $tabsqlsort[29] =
"position ASC";
277 $tabsqlsort[30] =
"code ASC";
279 $tabsqlsort[32] =
"country, year ASC, month ASC, day ASC";
280 $tabsqlsort[33] =
"code ASC";
281 $tabsqlsort[34] =
"code ASC";
282 $tabsqlsort[35] =
"c.label ASC";
283 $tabsqlsort[36] =
"r.fk_c_exp_tax_cat ASC, r.range_ik ASC";
284 $tabsqlsort[37] =
"sortorder ASC";
285 $tabsqlsort[38] =
"rowid, code ASC";
286 $tabsqlsort[39] =
"sortorder ASC";
287 $tabsqlsort[40] =
"code ASC";
288 $tabsqlsort[41] =
"code ASC";
289 $tabsqlsort[42] =
"code ASC";
290 $tabsqlsort[43] =
"code ASC";
291 $tabsqlsort[44] =
"code ASC";
295 $tabfield[1] =
"code,libelle,country";
296 $tabfield[2] =
"code,libelle,region_id,region,country";
297 $tabfield[3] =
"code,libelle,country_id,country";
298 $tabfield[4] =
"code,label";
299 $tabfield[5] =
"code,label";
300 $tabfield[6] =
"code,libelle,type,color,position";
301 $tabfield[7] =
"code,libelle,country,accountancy_code";
302 $tabfield[8] =
"code,libelle,country_id,country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
',position' :
'');
303 $tabfield[9] =
"code,label,unicode";
304 $tabfield[10] =
"country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
305 $tabfield[11] =
"element,source,code,libelle,position";
306 $tabfield[12] =
"code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder,entity";
307 $tabfield[13] =
"code,libelle,type,entity";
308 $tabfield[14] =
"code,label,price,organization,country";
309 $tabfield[15] =
"code,libelle,width,height,unit";
310 $tabfield[16] =
"code,libelle,sortorder";
311 $tabfield[17] =
"code,label,accountancy_code";
312 $tabfield[18] =
"code,libelle,tracking";
313 $tabfield[19] =
"code,libelle";
314 $tabfield[20] =
"code,libelle";
315 $tabfield[21] =
"code,label,qty,type_duration,position";
316 $tabfield[22] =
"code,label";
317 $tabfield[23] =
"country_id,country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
318 $tabfield[24] =
"code,label";
319 $tabfield[25] =
"code,label";
321 $tabfield[27] =
"code,libelle,picto";
322 $tabfield[28] =
"code,label,affect,delay,newbymonth,country_id,country,block_if_negative,sortorder";
323 $tabfield[29] =
"code,label,percent,position";
324 $tabfield[30] =
"code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
326 $tabfield[32] =
"code,dayrule,year,month,day,country_id,country";
327 $tabfield[33] =
"code,label";
328 $tabfield[34] =
"code,label";
329 $tabfield[35] =
"label";
330 $tabfield[36] =
"range_ik,fk_c_exp_tax_cat";
331 $tabfield[37] =
"code,label,short_label,unit_type,scale,sortorder";
332 $tabfield[38] =
"code,label,url,icon,entity";
333 $tabfield[39] =
"code,libelle,sortorder";
334 $tabfield[40] =
"code,libelle,picto";
335 $tabfield[41] =
"code,label";
336 $tabfield[42] =
"code,label";
337 $tabfield[43] =
"code,label";
338 $tabfield[44] =
"code,label";
341 $tabfieldvalue = array();
342 $tabfieldvalue[1] =
"code,libelle,country";
343 $tabfieldvalue[2] =
"code,libelle,region";
344 $tabfieldvalue[3] =
"code,libelle,country";
345 $tabfieldvalue[4] =
"code,label";
346 $tabfieldvalue[5] =
"code,label";
347 $tabfieldvalue[6] =
"code,libelle,type,color,position";
348 $tabfieldvalue[7] =
"code,libelle,country,accountancy_code";
349 $tabfieldvalue[8] =
"code,libelle,country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
',position' :
'');
350 $tabfieldvalue[9] =
"code,label,unicode";
351 $tabfieldvalue[10] =
"country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
352 $tabfieldvalue[11] =
"element,source,code,libelle,position";
353 $tabfieldvalue[12] =
"code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder";
354 $tabfieldvalue[13] =
"code,libelle,type";
355 $tabfieldvalue[14] =
"code,label,price,organization,country";
356 $tabfieldvalue[15] =
"code,libelle,width,height,unit";
357 $tabfieldvalue[16] =
"code,libelle,sortorder";
358 $tabfieldvalue[17] =
"code,label,accountancy_code";
359 $tabfieldvalue[18] =
"code,libelle,tracking";
360 $tabfieldvalue[19] =
"code,libelle";
361 $tabfieldvalue[20] =
"code,libelle";
362 $tabfieldvalue[21] =
"code,label,qty,type_duration,position";
363 $tabfieldvalue[22] =
"code,label";
364 $tabfieldvalue[23] =
"country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
365 $tabfieldvalue[24] =
"code,label";
366 $tabfieldvalue[25] =
"code,label";
368 $tabfieldvalue[27] =
"code,libelle,picto";
369 $tabfieldvalue[28] =
"code,label,affect,delay,newbymonth,country,block_if_negative,sortorder";
370 $tabfieldvalue[29] =
"code,label,percent,position";
371 $tabfieldvalue[30] =
"code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
373 $tabfieldvalue[32] =
"code,dayrule,day,month,year,country";
374 $tabfieldvalue[33] =
"code,label";
375 $tabfieldvalue[34] =
"code,label";
376 $tabfieldvalue[35] =
"label";
377 $tabfieldvalue[36] =
"range_ik,fk_c_exp_tax_cat";
378 $tabfieldvalue[37] =
"code,label,short_label,unit_type,scale,sortorder";
379 $tabfieldvalue[38] =
"code,label,url,icon";
380 $tabfieldvalue[39] =
"code,libelle,sortorder";
381 $tabfieldvalue[40] =
"code,libelle,picto";
382 $tabfieldvalue[41] =
"code,label";
383 $tabfieldvalue[42] =
"code,label";
384 $tabfieldvalue[43] =
"code,label";
385 $tabfieldvalue[44] =
"code,label";
388 $tabfieldinsert = array();
389 $tabfieldinsert[1] =
"code,libelle,fk_pays";
390 $tabfieldinsert[2] =
"code_departement,nom,fk_region";
391 $tabfieldinsert[3] =
"code_region,nom,fk_pays";
392 $tabfieldinsert[4] =
"code,label";
393 $tabfieldinsert[5] =
"code,label";
394 $tabfieldinsert[6] =
"code,libelle,type,color,position";
395 $tabfieldinsert[7] =
"code,libelle,fk_pays,accountancy_code";
396 $tabfieldinsert[8] =
"code,libelle,fk_country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
',position' :
'');
397 $tabfieldinsert[9] =
"code_iso,label,unicode";
398 $tabfieldinsert[10] =
"fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
399 $tabfieldinsert[11] =
"element,source,code,libelle,position";
400 $tabfieldinsert[12] =
"code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder,entity";
401 $tabfieldinsert[13] =
"code,libelle,type,entity";
402 $tabfieldinsert[14] =
"code,label,price,organization,fk_pays";
403 $tabfieldinsert[15] =
"code,label,width,height,unit";
404 $tabfieldinsert[16] =
"code,label,sortorder";
405 $tabfieldinsert[17] =
"code,label,accountancy_code";
406 $tabfieldinsert[18] =
"code,libelle,tracking";
407 $tabfieldinsert[19] =
"code,libelle";
408 $tabfieldinsert[20] =
"code,libelle";
409 $tabfieldinsert[21] =
"code,label,qty,type_duration,position";
410 $tabfieldinsert[22] =
"code,label";
411 $tabfieldinsert[23] =
"fk_pays,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
412 $tabfieldinsert[24] =
"code,label";
413 $tabfieldinsert[25] =
"code,label";
415 $tabfieldinsert[27] =
"code,libelle,picto";
416 $tabfieldinsert[28] =
"code,label,affect,delay,newbymonth,fk_country,block_if_negative,sortorder";
417 $tabfieldinsert[29] =
"code,label,percent,position";
418 $tabfieldinsert[30] =
"code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
421 $tabfieldinsert[32] =
"code,dayrule,day,month,year,fk_country";
422 $tabfieldinsert[33] =
"code,label";
423 $tabfieldinsert[34] =
"code,label";
424 $tabfieldinsert[35] =
"label";
425 $tabfieldinsert[36] =
"range_ik,fk_c_exp_tax_cat";
426 $tabfieldinsert[37] =
"code,label,short_label,unit_type,scale,sortorder";
427 $tabfieldinsert[38] =
"code,label,url,icon,entity";
428 $tabfieldinsert[39] =
"code,label,sortorder";
429 $tabfieldinsert[40] =
"code,libelle,picto";
430 $tabfieldinsert[41] =
"code,label";
431 $tabfieldinsert[42] =
"code,label";
432 $tabfieldinsert[43] =
"code,label";
433 $tabfieldinsert[44] =
"code,label";
442 $tabrowid[4] =
"rowid";
443 $tabrowid[5] =
"rowid";
447 $tabrowid[9] =
"code_iso";
449 $tabrowid[11] =
"rowid";
451 $tabrowid[13] =
"id";
454 $tabrowid[16] =
"code";
455 $tabrowid[17] =
"id";
456 $tabrowid[18] =
"rowid";
457 $tabrowid[19] =
"id";
459 $tabrowid[21] =
"rowid";
460 $tabrowid[22] =
"rowid";
465 $tabrowid[27] =
"id";
470 $tabrowid[32] =
"id";
471 $tabrowid[33] =
"rowid";
472 $tabrowid[34] =
"rowid";
477 $tabrowid[39] =
"code";
478 $tabrowid[40] =
"id";
480 $tabrowid[42] =
"rowid";
481 $tabrowid[43] =
"rowid";
482 $tabrowid[44] =
"rowid";
486 $tabcond[1] = (!empty($conf->societe->enabled));
490 $tabcond[5] = (!empty($conf->societe->enabled) || !empty($conf->adherent->enabled));
492 $tabcond[7] = !empty($conf->tax->enabled);
493 $tabcond[8] = !empty($conf->societe->enabled);
496 $tabcond[11] = (!empty($conf->societe->enabled));
497 $tabcond[12] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled) ||
isModEnabled(
'facture') || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled) || !empty($conf->supplier_order->enabled));
498 $tabcond[13] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled) ||
isModEnabled(
'facture') || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled) || !empty($conf->supplier_order->enabled));
499 $tabcond[14] = (!empty($conf->product->enabled) && (!empty($conf->ecotax->enabled) || !empty($conf->global->MAIN_SHOW_ECOTAX_DICTIONNARY)));
501 $tabcond[16] = (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS));
502 $tabcond[17] = (!empty($conf->deplacement->enabled) || !empty($conf->expensereport->enabled));
503 $tabcond[18] = !empty($conf->expedition->enabled) || !empty($conf->reception->enabled);
504 $tabcond[19] = !empty($conf->societe->enabled);
505 $tabcond[20] = (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled);
506 $tabcond[21] = !empty($conf->propal->enabled);
507 $tabcond[22] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled));
509 $tabcond[24] = !empty($conf->resource->enabled);
510 $tabcond[25] = !empty($conf->website->enabled);
512 $tabcond[27] = !empty($conf->societe->enabled);
513 $tabcond[28] = !empty($conf->holiday->enabled);
514 $tabcond[29] = !empty($conf->project->enabled);
517 $tabcond[32] = (!empty($conf->holiday->enabled) || !empty($conf->hrm->enabled));
518 $tabcond[33] = !empty($conf->hrm->enabled);
519 $tabcond[34] = !empty($conf->hrm->enabled);
520 $tabcond[35] = !empty($conf->expensereport->enabled) && !empty($conf->global->MAIN_USE_EXPENSE_IK);
521 $tabcond[36] = !empty($conf->expensereport->enabled) && !empty($conf->global->MAIN_USE_EXPENSE_IK);
522 $tabcond[37] = !empty($conf->product->enabled);
523 $tabcond[38] = !empty($conf->socialnetworks->enabled);
524 $tabcond[39] = (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && !empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES));
525 $tabcond[40] = (!empty($conf->societe->enabled) && !empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES));
526 $tabcond[41] = !empty($conf->intracommreport->enabled);
527 $tabcond[42] = !empty($conf->product->enabled);
528 $tabcond[43] = !empty($conf->product->enabled) && !empty($conf->productbatch->enabled) && $conf->global->MAIN_FEATURES_LEVEL >= 2;
529 $tabcond[44] = !empty($conf->asset->enabled);
535 $tabcomplete = array(
536 'c_forme_juridique'=>array(
'picto'=>
'company',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
537 'c_departements'=>array(
'picto'=>
'state',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
538 'c_regions'=>array(
'picto'=>
'region',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
539 'c_country'=>array(
'picto'=>
'country',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
540 'c_civility'=>array(
'picto'=>
'contact',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
541 'c_actioncomm'=>array(
'picto'=>
'action',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"),
'color'=>$langs->trans(
"ColorFormat"),
'position'=>$langs->trans(
"PositionIntoComboList"))),
542 'c_chargesociales'=>array(
'picto'=>
'bill',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
543 'c_typent'=>array(
'picto'=>
'company',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"),
'position'=>$langs->trans(
"PositionIntoComboList"))),
544 'c_currencies'=>array(
'picto'=>
'multicurrency',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"),
'unicode'=>$langs->trans(
"UnicodeCurrency"))),
545 '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"))),
546 'c_type_contact'=>array(
'picto'=>
'contact',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"),
'position'=>$langs->trans(
"PositionIntoComboList"))),
547 '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")))),
548 'c_paiement'=>array(
'picto'=>
'bill',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
549 'c_ecotaxe'=>array(
'picto'=>
'bill',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
550 'c_paper_format'=>array(
'picto'=>
'generic',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
551 'c_prospectlevel'=>array(
'picto'=>
'company',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
552 'c_type_fees'=>array(
'picto'=>
'trip',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
553 'c_shipment_mode'=>array(
'picto'=>
'shipment',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"),
'tracking'=>$langs->trans(
"UrlTrackingDesc"))),
554 'c_effectif'=>array(
'picto'=>
'company',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
555 'c_input_method'=>array(
'picto'=>
'order',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
556 'c_input_reason'=>array(
'picto'=>
'order',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"),
'position'=>$langs->trans(
"PositionIntoComboList"))),
557 'c_availability'=>array(
'picto'=>
'shipment',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
558 'c_revenuestamp'=>array(
'picto'=>
'bill',
'help'=>array(
'revenuestamp_type'=>$langs->trans(
'FixedOrPercent'))),
559 'c_type_resource'=>array(
'picto'=>
'resource',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
560 'c_type_container'=>array(
'picto'=>
'website',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
561 'c_stcomm'=>array(
'picto'=>
'company',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"),
'picto'=>$langs->trans(
"PictoHelp"))),
562 'c_holiday_types'=>array(
'picto'=>
'holiday',
'help'=>array(
'affect'=>$langs->trans(
"FollowedByACounter"),
'delay'=>$langs->trans(
"MinimumNoticePeriod"),
'newbymonth'=>$langs->trans(
"NbAddedAutomatically"))),
563 'c_lead_status'=>array(
'picto'=>
'project',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"),
'percent'=>$langs->trans(
"OpportunityPercent"),
'position'=>$langs->trans(
"PositionIntoComboList"))),
564 'c_format_cards'=>array(
'picto'=>
'generic',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"),
'name'=>$langs->trans(
"LabelName"),
'paper_size'=>$langs->trans(
"LabelPaperSize"))),
565 '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"))),
566 'c_hrm_department'=>array(
'picto'=>
'hrm',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
567 'c_hrm_function'=>array(
'picto'=>
'hrm',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
568 'c_exp_tax_cat'=>array(
'picto'=>
'expensereport',
'help'=>array()),
569 'c_exp_tax_range'=>array(
'picto'=>
'expensereport',
'help'=>array(
'range_ik'=>$langs->trans(
'PrevRangeToThisRange'))),
570 'c_units'=>array(
'picto'=>
'product',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"),
'unit_type' => $langs->trans(
'Measuringtype_durationDesc'),
'scale' => $langs->trans(
'MeasuringScaleDesc'))),
571 'c_socialnetworks'=>array(
'picto'=>
'share-alt',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"),
'url' => $langs->trans(
'UrlSocialNetworksDesc'),
'icon' => $langs->trans(
'FafaIconSocialNetworksDesc'))),
572 'c_prospectcontactlevel'=>array(
'picto'=>
'company',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
573 'c_stcommcontact'=>array(
'picto'=>
'company',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"),
'picto'=>$langs->trans(
"PictoHelp"))),
574 'c_transport_mode'=>array(
'picto'=>
'incoterm',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
575 'c_product_nature'=>array(
'picto'=>
'product',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
576 'c_productbatch_qcstatus'=>array(
'picto'=>
'lot',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
577 'c_asset_disposal_type'=>array(
'picto'=>
'asset',
'help'=>array(
'code'=>$langs->trans(
"EnterAnyCode"))),
582 complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabcomplete);
586 foreach ($tabcomplete as $key => $value) {
589 if (!isset($tabcond[$i])) {
592 $tabcomplete[$key][
'id'] = $i;
593 $tabcomplete[$key][
'cond'] = $tabcond[$i];
594 $tabcomplete[$key][
'rowid'] = $tabrowid[$i];
595 $tabcomplete[$key][
'fieldinsert'] = $tabfieldinsert[$i];
596 $tabcomplete[$key][
'fieldvalue'] = $tabfieldvalue[$i];
597 $tabcomplete[$key][
'lib'] = $tablib[$i];
598 $tabcomplete[$key][
'sql'] = $tabsql[$i];
599 $tabcomplete[$key][
'sqlsort'] = $tabsqlsort[$i];
600 $tabcomplete[$key][
'field'] = $tabfield[$i];
605 $arrayofkeys = array_keys($tabcomplete);
606 $keytable = $arrayofkeys[$id - 1];
610 if (empty($sortfield)) {
611 $tmp1 = explode(
',', empty($tabcomplete[$keytable][
'sqlsort']) ?
'' : $tabcomplete[$keytable][
'sqlsort']);
612 $tmp2 = explode(
' ', $tmp1[0]);
613 $sortfield = preg_replace(
'/^.*\./',
'', $tmp2[0]);
614 $sortorder = (!empty($tmp2[1]) ? $tmp2[1] :
'');
620 $elementList = array();
621 $sourceList = array();
623 $elementList = array(
625 'agenda' =>
img_picto(
'',
'action',
'class="pictofixedwidth"').$langs->trans(
'Agenda'),
626 'dolresource' =>
img_picto(
'',
'resource',
'class="pictofixedwidth"').$langs->trans(
'Resource'),
627 'societe' =>
img_picto(
'',
'company',
'class="pictofixedwidth"').$langs->trans(
'ThirdParty'),
633 'project' =>
img_picto(
'',
'project',
'class="pictofixedwidth"').$langs->trans(
'Project'),
634 'project_task' =>
img_picto(
'',
'projecttask',
'class="pictofixedwidth"').$langs->trans(
'Task'),
635 'propal' =>
img_picto(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
'Proposal'),
636 'commande' =>
img_picto(
'',
'order',
'class="pictofixedwidth"').$langs->trans(
'Order'),
637 'facture' =>
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
'Bill'),
638 'fichinter' =>
img_picto(
'',
'intervention',
'class="pictofixedwidth"').$langs->trans(
'InterventionCard'),
639 'contrat' =>
img_picto(
'',
'contract',
'class="pictofixedwidth"').$langs->trans(
'Contract'),
640 'ticket' =>
img_picto(
'',
'ticket',
'class="pictofixedwidth"').$langs->trans(
'Ticket'),
641 'supplier_proposal' =>
img_picto(
'',
'supplier_proposal',
'class="pictofixedwidth"').$langs->trans(
'SupplierProposal'),
642 'order_supplier' =>
img_picto(
'',
'supplier_order',
'class="pictofixedwidth"').$langs->trans(
'SupplierOrder'),
643 'invoice_supplier' =>
img_picto(
'',
'supplier_invoice',
'class="pictofixedwidth"').$langs->trans(
'SupplierBill'),
645 if (!empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 2) {
646 $elementList[
'conferenceorbooth'] =
img_picto(
'',
'eventorganization',
'class="pictofixedwidth"').$langs->trans(
'ConferenceOrBooth');
653 'internal' => $langs->trans(
'Internal'),
654 'external' => $langs->trans(
'External')
659 $localtax_typeList = array(
660 "0" => $langs->trans(
"No"),
661 "1" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 1)",
662 "2" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 2)",
663 "3" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 3)",
664 "4" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 4)",
665 "5" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 5)",
666 "6" => $langs->trans(
"Yes").
' ('.$langs->trans(
"Type").
" 6)"
674 $object =
new stdClass();
679 'confirm' =>$confirm,
681 'taborder' =>$taborder,
682 'tabname' =>$tabname,
685 'tabsqlsort' =>$tabsqlsort,
686 'tabfield' =>$tabfield,
687 'tabfieldvalue' =>$tabfieldvalue,
688 'tabfieldinsert'=>$tabfieldinsert,
689 'tabrowid' =>$tabrowid,
690 'tabcond' =>$tabcond,
691 'tabhelp' =>$tabhelp,
692 'tabcomplete' =>$tabcomplete
694 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
699 if (
GETPOST(
'button_removefilter',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter_x',
'alpha')) {
700 $search_country_id =
'';
704 if (empty($reshook)) {
707 $listfield = explode(
',', str_replace(
' ',
'', $tabfield[$id]));
708 $listfieldinsert = explode(
',', $tabfieldinsert[$id]);
709 $listfieldmodify = explode(
',', $tabfieldinsert[$id]);
710 $listfieldvalue = explode(
',', $tabfieldvalue[$id]);
714 foreach ($listfield as $f => $value) {
716 if ($value ==
'country_id' && in_array($tablib[$id], array(
'DictionaryPublicHolidays',
'DictionaryVAT',
'DictionaryRegion',
'DictionaryCompanyType',
'DictionaryHolidayTypes',
'DictionaryRevenueStamp',
'DictionaryAccountancysystem',
'DictionaryAccountancyCategory'))) {
719 if ($value ==
'country' && in_array($tablib[$id], array(
'DictionaryPublicHolidays',
'DictionaryCanton',
'DictionaryCompanyType',
'DictionaryHolidayTypes',
'DictionaryRevenueStamp'))) {
723 if ($value ==
'localtax1' && !
GETPOST(
'localtax1_type')) {
726 if ($value ==
'localtax2' && !
GETPOST(
'localtax2_type')) {
729 if ($value ==
'color' && !
GETPOST(
'color')) {
732 if ($value ==
'formula' && !
GETPOST(
'formula')) {
735 if ($value ==
'dayrule' && !
GETPOST(
'dayrule')) {
738 if ($value ==
'sortorder') {
742 && (!in_array($value, array(
'decalage',
'module',
'accountancy_code',
'accountancy_code_sell',
'accountancy_code_buy',
'tracking',
'picto',
'deposit_percent'))
743 && ($id != 10 || ($value !=
'code' && $value !=
'note'))
747 $fieldnamekey = $value;
749 if ($fieldnamekey ==
'libelle' || ($fieldnamekey ==
'label')) {
750 $fieldnamekey =
'Label';
752 if ($fieldnamekey ==
'libelle_facture') {
753 $fieldnamekey =
'LabelOnDocuments';
755 if ($fieldnamekey ==
'deposit_percent') {
756 $fieldnamekey =
'DepositPercent';
758 if ($fieldnamekey ==
'nbjour') {
759 $fieldnamekey =
'NbOfDays';
761 if ($fieldnamekey ==
'decalage') {
762 $fieldnamekey =
'Offset';
764 if ($fieldnamekey ==
'module') {
765 $fieldnamekey =
'Module';
767 if ($fieldnamekey ==
'code') {
768 $fieldnamekey =
'Code';
770 if ($fieldnamekey ==
'note') {
771 $fieldnamekey =
'Note';
773 if ($fieldnamekey ==
'taux') {
774 $fieldnamekey =
'Rate';
776 if ($fieldnamekey ==
'type') {
777 $fieldnamekey =
'Type';
779 if ($fieldnamekey ==
'position') {
780 $fieldnamekey =
'Position';
782 if ($fieldnamekey ==
'unicode') {
783 $fieldnamekey =
'Unicode';
785 if ($fieldnamekey ==
'deductible') {
786 $fieldnamekey =
'Deductible';
788 if ($fieldnamekey ==
'sortorder') {
789 $fieldnamekey =
'SortOrder';
791 if ($fieldnamekey ==
'category_type') {
792 $fieldnamekey =
'Calculated';
794 if ($fieldnamekey ==
'revenuestamp_type') {
795 $fieldnamekey =
'TypeOfRevenueStamp';
797 if ($fieldnamekey ==
'use_default') {
798 $fieldnamekey =
'UseByDefault';
801 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->transnoentities($fieldnamekey)),
null,
'errors');
805 if (
GETPOST(
'actionadd') && $tabname[$id] ==
"c_actioncomm" &&
GETPOSTISSET(
"type") && in_array(
GETPOST(
"type"), array(
'system',
'systemauto'))) {
807 setEventMessages($langs->transnoentities(
'ErrorReservedTypeSystemSystemAuto'),
null,
'errors');
812 setEventMessages($langs->transnoentities(
'ErrorCodeCantContainZero'),
null,
'errors');
816 if (in_array($tablib[$id], array(
'DictionaryCompanyType',
'DictionaryHolidayTypes'))) {
817 $_POST[
"country"] =
'';
820 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->transnoentities(
"Country")),
null,
'errors');
823 if (($id == 3 || $id == 42) && !is_numeric(
GETPOST(
"code"))) {
825 setEventMessages($langs->transnoentities(
"ErrorFieldMustBeANumeric", $langs->transnoentities(
"Code")),
null,
'errors');
830 $_POST[
"localtax1"] =
'0';
833 $_POST[
"localtax2"] =
'0';
835 if (
GETPOST(
"accountancy_code") <= 0) {
836 $_POST[
"accountancy_code"] =
'';
838 if (
GETPOST(
"accountancy_code_sell") <= 0) {
839 $_POST[
"accountancy_code_sell"] =
'';
841 if (
GETPOST(
"accountancy_code_buy") <= 0) {
842 $_POST[
"accountancy_code_buy"] =
'';
845 $_POST[
"code"] = preg_replace(
'/[^a-zA-Z0-9\-\+]/',
'',
GETPOST(
"code"));
848 $tablename = $tabname[$id];
849 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
852 if ($ok &&
GETPOST(
'actionadd')) {
853 if ($tabrowid[$id]) {
856 $sql =
"SELECT MAX(".$tabrowid[$id].
") as newid FROM ".MAIN_DB_PREFIX.$tablename;
857 $result = $db->query($sql);
859 $obj = $db->fetch_object($result);
860 $newid = ($obj->newid + 1);
867 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.$tablename.
" (";
869 if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
870 $sql .= $tabrowid[$id].
",";
872 $sql .= $tabfieldinsert[$id];
877 if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
881 foreach ($listfieldinsert as $f => $value) {
882 $keycode = $listfieldvalue[$i];
883 if (empty($keycode)) {
887 if ($value ==
'price' || preg_match(
'/^amount/i', $value)) {
889 } elseif ($value ==
'taux' || $value ==
'localtax1') {
891 } elseif ($value ==
'entity') {
892 $_POST[$keycode] =
getEntity($tablename);
899 if ($keycode ==
'sortorder') {
900 $sql .= (int)
GETPOST(
'position',
'int');
901 } elseif (
GETPOST($keycode) ==
'' && !($keycode ==
'code' && $id == 10)) {
903 } elseif ($keycode ==
'content') {
904 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
905 } elseif (in_array($keycode, array(
'joinfile',
'private',
'pos',
'position',
'scale',
'use_default'))) {
906 $sql .= (int)
GETPOST($keycode,
'int');
908 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
916 $resql = $db->query($sql);
918 setEventMessages($langs->transnoentities(
"RecordCreatedSuccessfully"),
null,
'mesgs');
921 if ($id == 10 &&
GETPOST(
'country',
'int') > 0) {
922 $search_country_id =
GETPOST(
'country',
'int');
924 $_POST = array(
'id'=>$id);
926 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
927 setEventMessages($langs->transnoentities(
"ErrorRecordAlreadyExists"),
null,
'errors');
935 if ($ok &&
GETPOST(
'actionmodify')) {
936 if ($tabrowid[$id]) {
937 $rowidcol = $tabrowid[$id];
943 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET ";
945 if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify)) {
946 $sql .= $tabrowid[$id].
"=";
947 $sql .=
"'".$db->escape($rowid).
"', ";
950 foreach ($listfieldmodify as $field) {
951 $keycode = $listfieldvalue[$i];
952 if (empty($keycode)) {
956 if ($field ==
'price' || preg_match(
'/^amount/i', $field)) {
958 } elseif ($field ==
'taux' || $field ==
'localtax1') {
960 } elseif ($field ==
'entity') {
961 $_POST[$keycode] =
getEntity($tablename);
968 if ($listfieldvalue[$i] ==
'sortorder') {
969 $sql .= (int)
GETPOST(
'position',
'int');
970 } elseif (
GETPOST($keycode) ==
'' && !($keycode ==
'code' && $id == 10)) {
972 } elseif ($keycode ==
'content') {
973 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
974 } elseif (in_array($keycode, array(
'joinfile',
'private',
'pos',
'position',
'scale',
'use_default'))) {
975 $sql .= (int)
GETPOST($keycode,
'int');
977 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
982 if (in_array($rowidcol, array(
'code',
'code_iso'))) {
983 $sql .=
" WHERE ".$rowidcol.
" = '".$db->escape($rowid).
"'";
985 $sql .=
" WHERE ".$rowidcol.
" = ".((int) $rowid);
987 if (in_array(
'entity', $listfieldmodify)) {
988 $sql .=
" AND entity = ".((int)
getEntity($tablename, 0));
993 $resql = $db->query($sql);
1000 if ($action ==
'confirm_delete' && $confirm ==
'yes') {
1001 if ($tabrowid[$id]) {
1002 $rowidcol = $tabrowid[$id];
1004 $rowidcol =
"rowid";
1007 $tablename = $tabname[$id];
1008 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1010 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.$tablename.
" WHERE ".$rowidcol.
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1013 $result = $db->query($sql);
1015 if ($db->errno() ==
'DB_ERROR_CHILD_EXISTS') {
1016 setEventMessages($langs->transnoentities(
"ErrorRecordIsUsedByChild"),
null,
'errors');
1024 if ($action == $acts[0]) {
1025 if ($tabrowid[$id]) {
1026 $rowidcol = $tabrowid[$id];
1028 $rowidcol =
"rowid";
1031 $tablename = $tabname[$id];
1032 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1035 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET active = 1 WHERE ".$rowidcol.
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1037 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET active = 1 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1040 $result = $db->query($sql);
1047 if ($action == $acts[1]) {
1048 if ($tabrowid[$id]) {
1049 $rowidcol = $tabrowid[$id];
1051 $rowidcol =
"rowid";
1054 $tablename = $tabname[$id];
1055 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1058 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET active = 0 WHERE ".$rowidcol.
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1060 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET active = 0 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1063 $result = $db->query($sql);
1070 if ($action ==
'activate_favorite') {
1071 if ($tabrowid[$id]) {
1072 $rowidcol = $tabrowid[$id];
1074 $rowidcol =
"rowid";
1077 $tablename = $tabname[$id];
1078 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1081 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET favorite = 1 WHERE ".$rowidcol.
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1083 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET favorite = 1 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1086 $result = $db->query($sql);
1093 if ($action ==
'disable_favorite') {
1094 if ($tabrowid[$id]) {
1095 $rowidcol = $tabrowid[$id];
1097 $rowidcol =
"rowid";
1100 $tablename = $tabname[$id];
1101 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1104 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET favorite = 0 WHERE ".$rowidcol.
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1106 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET favorite = 0 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1109 $result = $db->query($sql);
1116 if ($action ==
'activate_eec') {
1117 if ($tabrowid[$id]) {
1118 $rowidcol = $tabrowid[$id];
1120 $rowidcol =
"rowid";
1123 $tablename = $tabname[$id];
1124 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1127 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET eec = 1 WHERE ".$rowidcol.
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1129 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET eec = 1 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1132 $result = $db->query($sql);
1139 if ($action ==
'disable_eec') {
1140 if ($tabrowid[$id]) {
1141 $rowidcol = $tabrowid[$id];
1143 $rowidcol =
"rowid";
1146 $tablename = $tabname[$id];
1147 $tablename = preg_replace(
'/^'.preg_quote(MAIN_DB_PREFIX,
'/').
'/',
'', $tablename);
1150 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET eec = 0 WHERE ".$rowidcol.
" = '".$db->escape($rowid).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1152 $sql =
"UPDATE ".MAIN_DB_PREFIX.$tablename.
" SET eec = 0 WHERE code = '".$db->escape(
dol_escape_htmltag($code)).
"'".($entity !=
'' ?
" AND entity = ".(int) $entity :
'');
1155 $result = $db->query($sql);
1170 $title = $langs->trans(
"DictionarySetup");
1176 $title .=
' - '.$langs->trans($tablib[$id]);
1177 $linkback =
'<a href="'.$_SERVER[
'PHP_SELF'].
'">'.$langs->trans(
"BackToDictionaryList").
'</a>';
1179 $titlepicto =
'title_setup';
1180 if ($id == 10 &&
GETPOST(
'from') ==
'accountancy') {
1181 $title = $langs->trans(
"MenuVatAccounts");
1182 $titlepicto =
'accountancy';
1184 if ($id == 7 &&
GETPOST(
'from') ==
'accountancy') {
1185 $title = $langs->trans(
"MenuTaxAccounts");
1186 $titlepicto =
'accountancy';
1192 print
'<span class="opacitymedium">'.$langs->trans(
"DictionaryDesc");
1193 print
" ".$langs->trans(
"OnlyActiveElementsAreShown").
"<br>\n";
1194 print
'</span><br>';
1198 $param =
'&id='.urlencode($id);
1199 if ($search_country_id > 0) {
1200 $param .=
'&search_country_id='.urlencode($search_country_id);
1202 if ($search_code !=
'') {
1203 $param .=
'&search_code='.urlencode($search_country_id);
1205 if ($entity !=
'') {
1206 $param .=
'&entity='.(int) $entity;
1208 $paramwithsearch = $param;
1210 $paramwithsearch .=
'&sortorder='.urlencode($sortorder);
1213 $paramwithsearch .=
'&sortfield='.urlencode($sortfield);
1216 $paramwithsearch .=
'&from='.urlencode(
GETPOST(
'from',
'alpha'));
1221 if ($action ==
'delete') {
1222 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);
1231 $sql = $tabsql[$id];
1233 if (!preg_match(
'/ WHERE /', $sql)) {
1234 $sql .=
" WHERE 1 = 1";
1236 if ($search_country_id > 0) {
1237 $sql .=
" AND c.rowid = ".((int) $search_country_id);
1239 if ($search_code !=
'' && $id == 9) {
1241 } elseif ($search_code !=
'' && $id == 28) {
1243 } elseif ($search_code !=
'' && ($id == 7 || $id == 32)) {
1245 } elseif ($search_code !=
'' && $id == 3) {
1247 } elseif ($search_code !=
'' && ($id == 8 || $id == 10)) {
1249 } elseif ($search_code !=
'' && $id == 1) {
1251 } elseif ($search_code !=
'' && $id == 2) {
1253 } elseif ($search_code !=
'' && $id == 14) {
1255 } elseif ($search_code !=
'' && $id != 9) {
1261 if ($sortfield ==
'country') {
1262 $sortfield =
'country_code';
1264 $sql .= $db->order($sortfield, $sortorder);
1267 $tabsqlsort[$id] = preg_replace(
'/([a-z]+\.)?'.$sortfield.
' '.$sortorder.
',/i',
'', $tabsqlsort[$id]);
1268 $tabsqlsort[$id] = preg_replace(
'/([a-z]+\.)?'.$sortfield.
',/i',
'', $tabsqlsort[$id]);
1270 $sql .=
" ORDER BY ";
1272 $sql .= $tabsqlsort[$id];
1273 $sql .= $db->plimit($listlimit + 1, $offset);
1276 if (empty($tabfield[$id])) {
1277 dol_print_error($db,
'The table with id '.$id.
' has no array tabfield defined');
1280 $fieldlist = explode(
',', $tabfield[$id]);
1282 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'" method="POST">';
1283 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1284 print
'<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
1286 if ($id == 10 && empty($conf->global->FACTURE_TVAOPTION)) {
1287 print
info_admin($langs->trans(
"VATIsUsedIsOff", $langs->transnoentities(
"Setup"), $langs->transnoentities(
"CompanyFoundation")));
1292 if ($tabname[$id]) {
1295 $fieldlist = explode(
',', $tabfield[$id]);
1297 print
'<div class="div-table-responsive-no-min">';
1298 print
'<table class="noborder centpercent">';
1301 print
'<!-- line title to add new entry -->';
1302 $tdsoffields =
'<tr class="liste_titre">';
1303 foreach ($fieldlist as $field => $value) {
1304 if ($value ==
'entity') {
1310 $valuetoshow = ucfirst($value);
1311 $valuetoshow = $langs->trans($valuetoshow);
1314 if ($value ==
'pos') {
1315 $valuetoshow = $langs->trans(
"Position"); $class =
'right';
1317 if ($value ==
'source') {
1318 $valuetoshow = $langs->trans(
"Contact");
1320 if ($value ==
'price') {
1321 $valuetoshow = $langs->trans(
"PriceUHT");
1323 if ($value ==
'taux') {
1324 if ($tabname[$id] !=
"c_revenuestamp") {
1325 $valuetoshow = $langs->trans(
"Rate");
1327 $valuetoshow = $langs->trans(
"Amount");
1331 if ($value ==
'localtax1_type') {
1332 $valuetoshow = $langs->trans(
"UseLocalTax").
" 2"; $class =
"center"; $sortable = 0;
1334 if ($value ==
'localtax1') {
1335 $valuetoshow = $langs->trans(
"RateOfTaxN",
'2'); $class =
"center";
1337 if ($value ==
'localtax2_type') {
1338 $valuetoshow = $langs->trans(
"UseLocalTax").
" 3"; $class =
"center"; $sortable = 0;
1340 if ($value ==
'localtax2') {
1341 $valuetoshow = $langs->trans(
"RateOfTaxN",
'3'); $class =
"center";
1343 if ($value ==
'organization') {
1344 $valuetoshow = $langs->trans(
"Organization");
1346 if ($value ==
'lang') {
1347 $valuetoshow = $langs->trans(
"Language");
1349 if ($value ==
'type') {
1350 if ($tabname[$id] ==
"c_paiement") {
1351 $valuetoshow =
$form->textwithtooltip($langs->trans(
"Type"), $langs->trans(
"TypePaymentDesc"), 2, 1,
img_help(1,
''));
1353 $valuetoshow = $langs->trans(
"Type");
1356 if ($value ==
'code') {
1357 $valuetoshow = $langs->trans(
"Code"); $class =
'maxwidth100';
1359 if ($value ==
'libelle' || $value ==
'label') {
1360 $valuetoshow =
$form->textwithtooltip($langs->trans(
"Label"), $langs->trans(
"LabelUsedByDefault"), 2, 1,
img_help(1,
''));
1362 if ($value ==
'libelle_facture') {
1363 $valuetoshow =
$form->textwithtooltip($langs->trans(
"LabelOnDocuments"), $langs->trans(
"LabelUsedByDefault"), 2, 1,
img_help(1,
''));
1365 if ($value ==
'deposit_percent') {
1366 $valuetoshow = $langs->trans(
'DepositPercent');
1369 if ($value ==
'country') {
1370 if (in_array(
'region_id', $fieldlist)) {
1371 print
'<td> </td>';
continue;
1373 $valuetoshow = $langs->trans(
"Country");
1375 if ($value ==
'recuperableonly') {
1376 $valuetoshow = $langs->trans(
"NPR"); $class =
"center";
1378 if ($value ==
'nbjour') {
1379 $valuetoshow = $langs->trans(
"NbOfDays");
1382 if ($value ==
'type_cdr') {
1383 $valuetoshow = $langs->trans(
"AtEndOfMonth"); $class =
"center";
1385 if ($value ==
'decalage') {
1386 $valuetoshow = $langs->trans(
"Offset");
1389 if ($value ==
'width' || $value ==
'nx') {
1390 $valuetoshow = $langs->trans(
"Width");
1392 if ($value ==
'height' || $value ==
'ny') {
1393 $valuetoshow = $langs->trans(
"Height");
1395 if ($value ==
'unit' || $value ==
'metric') {
1396 $valuetoshow = $langs->trans(
"MeasuringUnit");
1398 if ($value ==
'region_id' || $value ==
'country_id') {
1401 if ($value ==
'accountancy_code') {
1402 $valuetoshow = $langs->trans(
"AccountancyCode");
1404 if ($value ==
'accountancy_code_sell') {
1405 $valuetoshow = $langs->trans(
"AccountancyCodeSell");
1407 if ($value ==
'accountancy_code_buy') {
1408 $valuetoshow = $langs->trans(
"AccountancyCodeBuy");
1410 if ($value ==
'pcg_version' || $value ==
'fk_pcg_version') {
1411 $valuetoshow = $langs->trans(
"Pcg_version");
1413 if ($value ==
'account_parent') {
1414 $valuetoshow = $langs->trans(
"Accountparent");
1416 if ($value ==
'pcg_type') {
1417 $valuetoshow = $langs->trans(
"Pcg_type");
1419 if ($value ==
'pcg_subtype') {
1420 $valuetoshow = $langs->trans(
"Pcg_subtype");
1422 if ($value ==
'sortorder') {
1423 $valuetoshow = $langs->trans(
"SortOrder");
1426 if ($value ==
'short_label') {
1427 $valuetoshow = $langs->trans(
"ShortLabel");
1429 if ($value ==
'fk_parent') {
1430 $valuetoshow = $langs->trans(
"ParentID"); $class =
'center';
1432 if ($value ==
'range_account') {
1433 $valuetoshow = $langs->trans(
"Range");
1435 if ($value ==
'sens') {
1436 $valuetoshow = $langs->trans(
"Sens");
1438 if ($value ==
'category_type') {
1439 $valuetoshow = $langs->trans(
"Calculated");
1441 if ($value ==
'formula') {
1442 $valuetoshow = $langs->trans(
"Formula");
1444 if ($value ==
'paper_size') {
1445 $valuetoshow = $langs->trans(
"PaperSize");
1447 if ($value ==
'orientation') {
1448 $valuetoshow = $langs->trans(
"Orientation");
1450 if ($value ==
'leftmargin') {
1451 $valuetoshow = $langs->trans(
"LeftMargin");
1453 if ($value ==
'topmargin') {
1454 $valuetoshow = $langs->trans(
"TopMargin");
1456 if ($value ==
'spacex') {
1457 $valuetoshow = $langs->trans(
"SpaceX");
1459 if ($value ==
'spacey') {
1460 $valuetoshow = $langs->trans(
"SpaceY");
1462 if ($value ==
'font_size') {
1463 $valuetoshow = $langs->trans(
"FontSize");
1465 if ($value ==
'custom_x') {
1466 $valuetoshow = $langs->trans(
"CustomX");
1468 if ($value ==
'custom_y') {
1469 $valuetoshow = $langs->trans(
"CustomY");
1471 if ($value ==
'percent') {
1472 $valuetoshow = $langs->trans(
"Percentage");
1474 if ($value ==
'affect') {
1475 $valuetoshow = $langs->trans(
"WithCounter");
1477 if ($value ==
'delay') {
1478 $valuetoshow = $langs->trans(
"NoticePeriod");
1480 if ($value ==
'newbymonth') {
1481 $valuetoshow = $langs->trans(
"NewByMonth");
1483 if ($value ==
'fk_tva') {
1484 $valuetoshow = $langs->trans(
"VAT");
1486 if ($value ==
'range_ik') {
1487 $valuetoshow = $langs->trans(
"RangeIk");
1489 if ($value ==
'fk_c_exp_tax_cat') {
1490 $valuetoshow = $langs->trans(
"CarCategory");
1492 if ($value ==
'revenuestamp_type') {
1493 $valuetoshow = $langs->trans(
'TypeOfRevenueStamp');
1495 if ($value ==
'use_default') {
1496 $valuetoshow = $langs->trans(
'Default'); $class =
'center';
1498 if ($value ==
'unit_type') {
1499 $valuetoshow = $langs->trans(
'TypeOfUnit');
1501 if ($value ==
'public' && $tablib[$id] ==
'TicketDictCategory') {
1502 $valuetoshow = $langs->trans(
'TicketGroupIsPublic'); $class =
'center';
1504 if ($value ==
'block_if_negative') {
1505 $valuetoshow = $langs->trans(
'BlockHolidayIfNegative');
1507 if ($value ==
'type_duration') {
1508 $valuetoshow = $langs->trans(
'Unit');
1512 if ($value ==
'region_id') {
1513 $valuetoshow =
' '; $showfield = 1;
1515 if ($value ==
'region') {
1516 $valuetoshow = $langs->trans(
"Country").
'/'.$langs->trans(
"Region"); $showfield = 1;
1520 if ($valuetoshow !=
'') {
1521 $tooltiphelp = (isset($tabcomplete[$tabname[$id]][
'help'][$value]) ? $tabcomplete[$tabname[$id]][
'help'][$value] :
'');
1523 $tdsoffields .=
'<th'.($class ?
' class="'.$class.
'"' :
'').
'>';
1524 if ($tooltiphelp && preg_match(
'/^http(s*):/i', $tooltiphelp)) {
1525 $tdsoffields .=
'<a href="'.$tooltiphelp.
'" target="_blank">'.$valuetoshow.
' '.
img_help(1, $valuetoshow).
'</a>';
1526 } elseif ($tooltiphelp) {
1527 $tdsoffields .=
$form->textwithpicto($valuetoshow, $tooltiphelp);
1529 $tdsoffields .= $valuetoshow;
1531 $tdsoffields .=
'</th>';
1536 $tdsoffields .=
'<th></th>';
1537 $tdsoffields .=
'<th></th>';
1539 $tdsoffields .=
'<th>';
1540 $tdsoffields .=
'<input type="hidden" name="id" value="'.$id.
'">';
1541 if (!is_null($withentity)) {
1542 $tdsoffields .=
'<input type="hidden" name="entity" value="'.$withentity.
'">';
1544 $tdsoffields .=
'</th>';
1545 $tdsoffields .=
'<th style="min-width: 26px;"></th>';
1546 $tdsoffields .=
'<th style="min-width: 26px;"></th>';
1547 $tdsoffields .=
'</tr>';
1553 print
'<!-- line input to add new entry -->';
1554 print
'<tr class="oddeven nodrag nodrop nohover">';
1556 $obj =
new stdClass();
1559 foreach ($fieldlist as $key => $val) {
1566 $tmpaction =
'create';
1567 $parameters = array(
'fieldlist'=>$fieldlist,
'tabname'=>$tabname[$id]);
1568 $reshook = $hookmanager->executeHooks(
'createDictionaryFieldlist', $parameters, $obj, $tmpaction);
1569 $error = $hookmanager->error; $errors = $hookmanager->errors;
1572 unset($fieldlist[2]);
1576 if (empty($reshook)) {
1577 fieldList($fieldlist, $obj, $tabname[$id],
'add');
1584 print
'<td colspan="3" class="center">';
1585 if ($action !=
'edit') {
1586 print
'<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans(
"Add").
'">';
1602 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'" method="POST">';
1603 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1604 print
'<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
1609 $resql = $db->query($sql);
1611 $num = $db->num_rows(
$resql);
1615 if ($num > $listlimit || $page) {
1616 print_fleche_navigation($page, $_SERVER[
"PHP_SELF"], $paramwithsearch, ($num > $listlimit),
'<li class="pagination"><span>'.$langs->trans(
"Page").
' '.($page + 1).
'</span></li>');
1617 print
'<div class="clearboth"></div>';
1620 print
'<div class="div-table-responsive">';
1621 print
'<table class="noborder centpercent">';
1624 print
'<!-- line title to search record -->'.
"\n";
1625 print
'<tr class="liste_titre_filter">';
1627 foreach ($fieldlist as $field => $value) {
1628 if ($value ==
'entity') {
1634 if ($value ==
'region_id' || $value ==
'country_id') {
1639 if ($value ==
'country') {
1640 print
'<td class="liste_titre">';
1641 print
$form->select_country($search_country_id,
'search_country_id',
'', 28,
'maxwidth150 maxwidthonsmartphone');
1644 } elseif ($value ==
'code') {
1645 print
'<td class="liste_titre">';
1646 print
'<input type="text" class="maxwidth100" name="search_code" value="'.dol_escape_htmltag($search_code).
'">';
1650 print
'<td class="liste_titre">';
1659 print
'<td class="liste_titre"></td>';
1660 print
'<td class="liste_titre right" colspan="2">';
1662 $searchpicto =
$form->showFilterAndCheckAddButtons(0);
1669 print
'<!-- line title of record -->'.
"\n";
1670 print
'<tr class="liste_titre">';
1671 foreach ($fieldlist as $field => $value) {
1672 if ($value ==
'entity') {
1676 if (in_array($value, array(
'label',
'libelle',
'libelle_facture')) && empty($tabcomplete[$tabname[$id]][
'help'][$value])) {
1677 $tabcomplete[$tabname[$id]][
'help'][$value] = $langs->trans(
'LabelUsedByDefault');
1685 $valuetoshow = ucfirst($value);
1686 $valuetoshow = $langs->trans($valuetoshow);
1689 if ($value ==
'source') {
1690 $valuetoshow = $langs->trans(
"Contact");
1692 if ($value ==
'price') {
1693 $valuetoshow = $langs->trans(
"PriceUHT");
1695 if ($value ==
'taux') {
1696 if ($tabname[$id] !=
"c_revenuestamp") {
1697 $valuetoshow = $langs->trans(
"Rate");
1699 $valuetoshow = $langs->trans(
"Amount");
1701 $cssprefix =
'center ';
1704 if ($value ==
'localtax1_type') {
1705 $valuetoshow = $langs->trans(
"UseLocalTax").
" 2"; $cssprefix =
"center "; $sortable = 0;
1707 if ($value ==
'localtax1') {
1708 $valuetoshow = $langs->trans(
"RateOfTaxN",
'2'); $cssprefix =
"center "; $sortable = 0;
1710 if ($value ==
'localtax2_type') {
1711 $valuetoshow = $langs->trans(
"UseLocalTax").
" 3"; $cssprefix =
"center "; $sortable = 0;
1713 if ($value ==
'localtax2') {
1714 $valuetoshow = $langs->trans(
"RateOfTaxN",
'3'); $cssprefix =
"center "; $sortable = 0;
1716 if ($value ==
'organization') {
1717 $valuetoshow = $langs->trans(
"Organization");
1719 if ($value ==
'lang') {
1720 $valuetoshow = $langs->trans(
"Language");
1722 if ($value ==
'type') {
1723 $valuetoshow = $langs->trans(
"Type");
1725 if ($value ==
'code') {
1726 $valuetoshow = $langs->trans(
"Code");
1728 if (in_array($value, array(
'pos',
'position'))) {
1729 $valuetoshow = $langs->trans(
"Position"); $cssprefix =
'right ';
1731 if ($value ==
'libelle' || $value ==
'label') {
1732 $valuetoshow = $langs->trans(
"Label");
1734 if ($value ==
'libelle_facture') {
1735 $valuetoshow = $langs->trans(
"LabelOnDocuments");
1737 if ($value ==
'deposit_percent') {
1738 $valuetoshow = $langs->trans(
'DepositPercent');
1739 $cssprefix =
'right ';
1741 if ($value ==
'country') {
1742 $valuetoshow = $langs->trans(
"Country");
1744 if ($value ==
'recuperableonly') {
1745 $valuetoshow = $langs->trans(
"NPR"); $cssprefix =
"center ";
1747 if ($value ==
'nbjour') {
1748 $valuetoshow = $langs->trans(
"NbOfDays");
1749 $cssprefix =
'right ';
1751 if ($value ==
'type_cdr') {
1752 $valuetoshow = $langs->trans(
"AtEndOfMonth"); $cssprefix =
"center ";
1754 if ($value ==
'decalage') {
1755 $valuetoshow = $langs->trans(
"Offset");
1756 $cssprefix =
'right ';
1758 if ($value ==
'width' || $value ==
'nx') {
1759 $valuetoshow = $langs->trans(
"Width");
1761 if ($value ==
'height' || $value ==
'ny') {
1762 $valuetoshow = $langs->trans(
"Height");
1764 if ($value ==
'unit' || $value ==
'metric') {
1765 $valuetoshow = $langs->trans(
"MeasuringUnit");
1767 if ($value ==
'accountancy_code') {
1768 $valuetoshow = $langs->trans(
"AccountancyCode");
1770 if ($value ==
'accountancy_code_sell') {
1771 $valuetoshow = $langs->trans(
"AccountancyCodeSell"); $sortable = 0;
1773 if ($value ==
'accountancy_code_buy') {
1774 $valuetoshow = $langs->trans(
"AccountancyCodeBuy"); $sortable = 0;
1776 if ($value ==
'fk_pcg_version') {
1777 $valuetoshow = $langs->trans(
"Pcg_version");
1779 if ($value ==
'account_parent') {
1780 $valuetoshow = $langs->trans(
"Accountsparent");
1782 if ($value ==
'pcg_type') {
1783 $valuetoshow = $langs->trans(
"Pcg_type");
1785 if ($value ==
'pcg_subtype') {
1786 $valuetoshow = $langs->trans(
"Pcg_subtype");
1788 if ($value ==
'sortorder') {
1789 $valuetoshow = $langs->trans(
"SortOrder");
1790 $cssprefix =
'center ';
1792 if ($value ==
'short_label') {
1793 $valuetoshow = $langs->trans(
"ShortLabel");
1795 if ($value ==
'fk_parent') {
1796 $valuetoshow = $langs->trans(
"ParentID"); $cssprefix =
'center ';
1798 if ($value ==
'range_account') {
1799 $valuetoshow = $langs->trans(
"Range");
1801 if ($value ==
'sens') {
1802 $valuetoshow = $langs->trans(
"Sens");
1804 if ($value ==
'category_type') {
1805 $valuetoshow = $langs->trans(
"Calculated");
1807 if ($value ==
'formula') {
1808 $valuetoshow = $langs->trans(
"Formula");
1810 if ($value ==
'paper_size') {
1811 $valuetoshow = $langs->trans(
"PaperSize");
1813 if ($value ==
'orientation') {
1814 $valuetoshow = $langs->trans(
"Orientation");
1816 if ($value ==
'leftmargin') {
1817 $valuetoshow = $langs->trans(
"LeftMargin");
1819 if ($value ==
'topmargin') {
1820 $valuetoshow = $langs->trans(
"TopMargin");
1822 if ($value ==
'spacex') {
1823 $valuetoshow = $langs->trans(
"SpaceX");
1825 if ($value ==
'spacey') {
1826 $valuetoshow = $langs->trans(
"SpaceY");
1828 if ($value ==
'font_size') {
1829 $valuetoshow = $langs->trans(
"FontSize");
1831 if ($value ==
'custom_x') {
1832 $valuetoshow = $langs->trans(
"CustomX");
1834 if ($value ==
'custom_y') {
1835 $valuetoshow = $langs->trans(
"CustomY");
1837 if ($value ==
'percent') {
1838 $valuetoshow = $langs->trans(
"Percentage");
1840 if ($value ==
'affect') {
1841 $valuetoshow = $langs->trans(
"WithCounter");
1843 if ($value ==
'delay') {
1844 $valuetoshow = $langs->trans(
"NoticePeriod");
1846 if ($value ==
'newbymonth') {
1847 $valuetoshow = $langs->trans(
"NewByMonth");
1849 if ($value ==
'fk_tva') {
1850 $valuetoshow = $langs->trans(
"VAT");
1852 if ($value ==
'range_ik') {
1853 $valuetoshow = $langs->trans(
"RangeIk");
1855 if ($value ==
'fk_c_exp_tax_cat') {
1856 $valuetoshow = $langs->trans(
"CarCategory");
1858 if ($value ==
'revenuestamp_type') {
1859 $valuetoshow = $langs->trans(
'TypeOfRevenueStamp');
1861 if ($value ==
'use_default') {
1862 $valuetoshow = $langs->trans(
'Default'); $cssprefix =
'center ';
1864 if ($value ==
'unit_type') {
1865 $valuetoshow = $langs->trans(
'TypeOfUnit');
1867 if ($value ==
'public' && $tablib[$id] ==
'TicketDictCategory') {
1868 $valuetoshow = $langs->trans(
'TicketGroupIsPublic'); $cssprefix =
'center ';
1870 if ($value ==
'block_if_negative') {
1871 $valuetoshow = $langs->trans(
'BlockHolidayIfNegative');
1873 if ($value ==
'type_duration') {
1874 $valuetoshow = $langs->trans(
'Unit');
1877 if ($value ==
'region_id' || $value ==
'country_id') {
1883 $tooltiphelp = (isset($tabcomplete[$tabname[$id]][
'help'][$value]) ? $tabcomplete[$tabname[$id]][
'help'][$value] :
'');
1885 if ($tooltiphelp && preg_match(
'/^http(s*):/i', $tooltiphelp)) {
1886 $newvaluetoshow =
'<a href="'.$tooltiphelp.
'" target="_blank">'.$valuetoshow.
' '.
img_help(1, $valuetoshow).
'</a>';
1887 } elseif ($tooltiphelp) {
1888 $newvaluetoshow =
$form->textwithpicto($valuetoshow, $tooltiphelp);
1890 $newvaluetoshow = $valuetoshow;
1893 print
getTitleFieldOfList($newvaluetoshow, 0, $_SERVER[
"PHP_SELF"], ($sortable ? $value :
''), ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder, $cssprefix);
1898 print
getTitleFieldOfList($langs->trans(
"InEEC"), 0, $_SERVER[
"PHP_SELF"],
"eec", ($page ?
'page='.$page.
'&' :
''), $param,
'align="center"', $sortfield, $sortorder,
'', 0, $langs->trans(
"CountryIsInEEC"));
1899 print
getTitleFieldOfList($langs->trans(
"Favorite"), 0, $_SERVER[
"PHP_SELF"],
"favorite", ($page ?
'page='.$page.
'&' :
''), $param,
'align="center"', $sortfield, $sortorder);
1902 print
getTitleFieldOfList($langs->trans(
"Status"), 0, $_SERVER[
"PHP_SELF"],
"active", ($page ?
'page='.$page.
'&' :
''), $param,
'align="center"', $sortfield, $sortorder);
1910 $obj = $db->fetch_object(
$resql);
1912 print
'<tr class="oddeven" id="rowid-'.(empty($obj->rowid) ?
'' : $obj->rowid).
'">';
1913 if ($action ==
'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
1914 $tmpaction =
'edit';
1915 $parameters = array(
'fieldlist'=>$fieldlist,
'tabname'=>$tabname[$id]);
1916 $reshook = $hookmanager->executeHooks(
'editDictionaryFieldlist', $parameters, $obj, $tmpaction);
1917 $error = $hookmanager->error; $errors = $hookmanager->errors;
1920 if (empty($reshook)) {
1921 $withentity =
fieldList($fieldlist, $obj, $tabname[$id],
'edit');
1924 print
'<td colspan="3" class="center">';
1925 print
'<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).
'"></div>';
1926 print
'<input type="hidden" name="page" value="'.dol_escape_htmltag($page).
'">';
1927 print
'<input type="hidden" name="rowid" value="'.dol_escape_htmltag($rowid).
'">';
1928 if (!is_null($withentity)) {
1929 print
'<input type="hidden" name="entity" value="'.$withentity.
'">';
1931 print
'<input type="submit" class="button button-edit" name="actionmodify" value="'.$langs->trans(
"Modify").
'">';
1932 print
'<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
1935 $tmpaction =
'view';
1936 $parameters = array(
'fieldlist'=>$fieldlist,
'tabname'=>$tabname[$id]);
1937 $reshook = $hookmanager->executeHooks(
'viewDictionaryFieldlist', $parameters, $obj, $tmpaction);
1939 $error = $hookmanager->error; $errors = $hookmanager->errors;
1941 if (empty($reshook)) {
1944 foreach ($fieldlist as $field => $value) {
1948 $valuetoshow = empty($obj->{$value}) ?
'' : $obj->{$value};
1951 if ($value ==
'entity') {
1952 $withentity = $valuetoshow;
1956 if ($value ==
'element') {
1957 $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
1958 } elseif ($value ==
'source') {
1959 $valuetoshow = isset($sourceList[$valuetoshow]) ? $sourceList[$valuetoshow] : $valuetoshow;
1960 } elseif ($valuetoshow ==
'all') {
1961 $valuetoshow = $langs->trans(
'All');
1962 } elseif ($value ==
'country') {
1963 if (empty($obj->country_code)) {
1966 $key = $langs->trans(
"Country".strtoupper($obj->country_code));
1967 $valuetoshow = ($key !=
"Country".strtoupper($obj->country_code) ? $obj->country_code.
" - ".$key : $obj->country);
1969 } elseif ($value ==
'recuperableonly' || $value ==
'deductible' || $value ==
'category_type') {
1970 $valuetoshow =
yn($valuetoshow ? 1 : 0);
1972 } elseif ($value ==
'type_cdr') {
1973 if (empty($valuetoshow)) {
1974 $valuetoshow = $langs->trans(
'None');
1975 } elseif ($valuetoshow == 1) {
1976 $valuetoshow = $langs->trans(
'AtEndOfMonth');
1977 } elseif ($valuetoshow == 2) {
1978 $valuetoshow = $langs->trans(
'CurrentNext');
1981 } elseif ($value ==
'price' || preg_match(
'/^amount/i', $value)) {
1982 $valuetoshow =
price($valuetoshow);
1984 if ($value ==
'private') {
1985 $valuetoshow =
yn($valuetoshow);
1986 } elseif ($value ==
'libelle_facture') {
1987 $langs->load(
"bills");
1988 $key = $langs->trans(
"PaymentCondition".strtoupper($obj->code));
1989 $valuetoshow = ($obj->code && $key !=
"PaymentCondition".strtoupper($obj->code) ? $key : $obj->{$value});
1990 $valuetoshow = nl2br($valuetoshow);
1991 } elseif ($value ==
'label' && $tabname[$id] ==
'c_country') {
1992 $key = $langs->trans(
"Country".strtoupper($obj->code));
1993 $valuetoshow = ($obj->code && $key !=
"Country".strtoupper($obj->code) ? $key : $obj->{$value});
1994 } elseif ($value ==
'label' && $tabname[$id] ==
'c_availability') {
1995 $langs->load(
"propal");
1996 $key = $langs->trans(
"AvailabilityType".strtoupper($obj->code));
1997 $valuetoshow = ($obj->code && $key !=
"AvailabilityType".strtoupper($obj->code) ? $key : $obj->{$value});
1998 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_actioncomm') {
1999 $key = $langs->trans(
"Action".strtoupper($obj->code));
2000 $valuetoshow = ($obj->code && $key !=
"Action".strtoupper($obj->code) ? $key : $obj->{$value});
2001 } elseif (!empty($obj->code_iso) && $value ==
'label' && $tabname[$id] ==
'c_currencies') {
2002 $key = $langs->trans(
"Currency".strtoupper($obj->code_iso));
2003 $valuetoshow = ($obj->code_iso && $key !=
"Currency".strtoupper($obj->code_iso) ? $key : $obj->{$value});
2004 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_typent') {
2005 $key = $langs->trans(strtoupper($obj->code));
2006 $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->{$value});
2007 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_prospectlevel') {
2008 $key = $langs->trans(strtoupper($obj->code));
2009 $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->{$value});
2010 } elseif ($value ==
'label' && $tabname[$id] ==
'c_civility') {
2011 $key = $langs->trans(
"Civility".strtoupper($obj->code));
2012 $valuetoshow = ($obj->code && $key !=
"Civility".strtoupper($obj->code) ? $key : $obj->{$value});
2013 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_type_contact') {
2014 $langs->load(
'agenda');
2015 $key = $langs->trans(
"TypeContact_".$obj->element.
"_".$obj->source.
"_".strtoupper($obj->code));
2016 $valuetoshow = ($obj->code && $key !=
"TypeContact_".$obj->element.
"_".$obj->source.
"_".strtoupper($obj->code) ? $key : $obj->{$value});
2017 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_payment_term') {
2018 $langs->load(
"bills");
2019 $key = $langs->trans(
"PaymentConditionShort".strtoupper($obj->code));
2020 $valuetoshow = ($obj->code && $key !=
"PaymentConditionShort".strtoupper($obj->code) ? $key : $obj->{$value});
2021 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_paiement') {
2022 $langs->load(
"bills");
2023 $key = $langs->trans(
"PaymentType".strtoupper($obj->code));
2024 $valuetoshow = ($obj->code && $key !=
"PaymentType".strtoupper($obj->code) ? $key : $obj->{$value});
2025 } elseif ($value ==
'type' && $tabname[$id] ==
'c_paiement') {
2026 $payment_type_list = array(0=>$langs->trans(
'PaymentTypeCustomer'), 1=>$langs->trans(
'PaymentTypeSupplier'), 2=>$langs->trans(
'PaymentTypeBoth'));
2027 $valuetoshow = $payment_type_list[$valuetoshow];
2028 } elseif ($value ==
'label' && $tabname[$id] ==
'c_input_reason') {
2029 $key = $langs->trans(
"DemandReasonType".strtoupper($obj->code));
2030 $valuetoshow = ($obj->code && $key !=
"DemandReasonType".strtoupper($obj->code) ? $key : $obj->{$value});
2031 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_input_method') {
2032 $langs->load(
"orders");
2033 $key = $langs->trans($obj->code);
2034 $valuetoshow = ($obj->code && $key != $obj->code) ? $key : $obj->{$value};
2035 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_shipment_mode') {
2036 $langs->load(
"sendings");
2037 $key = $langs->trans(
"SendingMethod".strtoupper($obj->code));
2038 $valuetoshow = ($obj->code && $key !=
"SendingMethod".strtoupper($obj->code) ? $key : $obj->{$value});
2039 } elseif ($value ==
'libelle' && $tabname[$id] ==
'c_paper_format') {
2040 $key = $langs->trans(
'PaperFormat'.strtoupper($obj->code));
2041 $valuetoshow = ($obj->code && $key !=
'PaperFormat'.strtoupper($obj->code) ? $key : $obj->{$value});
2042 } elseif ($value ==
'label' && $tabname[$id] ==
'c_type_fees') {
2043 $langs->load(
'trips');
2044 $key = $langs->trans(strtoupper($obj->code));
2045 $valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->{$value});
2046 } elseif ($value ==
'region_id' || $value ==
'country_id') {
2048 } elseif ($value ==
'unicode') {
2049 $valuetoshow = $langs->getCurrencySymbol($obj->code, 1);
2050 } elseif ($value ==
'label' && $tabname[
GETPOST(
"id",
'int')] ==
'c_units') {
2051 $langs->load(
"products");
2052 $valuetoshow = $langs->trans($obj->{$value});
2053 } elseif ($value ==
'short_label' && $tabname[
GETPOST(
"id",
'int')] ==
'c_units') {
2054 $langs->load(
"products");
2055 $valuetoshow = $langs->trans($obj->{$value});
2056 } elseif (($value ==
'unit') && ($tabname[$id] ==
'c_paper_format')) {
2057 $key = $langs->trans(
'SizeUnit'.strtolower($obj->unit));
2058 $valuetoshow = ($obj->code && $key !=
'SizeUnit'.strtolower($obj->unit) ? $key : $obj->{$value});
2059 } elseif ($value ==
'localtax1' || $value ==
'localtax2') {
2061 } elseif ($value ==
'localtax1_type') {
2062 if ($obj->localtax1 != 0) {
2063 $valuetoshow = $localtax_typeList[$valuetoshow];
2068 } elseif ($value ==
'localtax2_type') {
2069 if ($obj->localtax2 != 0) {
2070 $valuetoshow = $localtax_typeList[$valuetoshow];
2075 } elseif ($value ==
'taux') {
2076 $valuetoshow =
price($valuetoshow, 0, $langs, 0, 0);
2078 } elseif (in_array($value, array(
'recuperableonly'))) {
2080 } elseif ($value ==
'accountancy_code' || $value ==
'accountancy_code_sell' || $value ==
'accountancy_code_buy') {
2081 if (!empty($conf->accounting->enabled)) {
2082 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
2084 $tmpaccountingaccount->fetch(0, $valuetoshow, 1);
2085 $titletoshow = $langs->transnoentitiesnoconv(
"Pcgtype").
': '.$tmpaccountingaccount->pcg_type;
2088 } elseif ($value ==
'fk_tva') {
2089 foreach (
$form->cache_vatrates as $key => $Tab) {
2090 if (
$form->cache_vatrates[$key][
'rowid'] == $valuetoshow) {
2091 $valuetoshow =
$form->cache_vatrates[$key][
'label'];
2095 } elseif ($value ==
'fk_c_exp_tax_cat') {
2096 $tmpid = $valuetoshow;
2098 $valuetoshow = $langs->trans($valuetoshow ? $valuetoshow : $tmpid);
2099 } elseif ($tabname[$id] ==
'c_exp_tax_cat') {
2100 $valuetoshow = $langs->trans($valuetoshow);
2101 } elseif ($value ==
'label' && $tabname[$id] ==
'c_units') {
2102 $langs->load(
'other');
2103 $key = $langs->trans($obj->label);
2104 $valuetoshow = ($obj->label && $key != strtoupper($obj->label) ? $key : $obj->{$value});
2105 } elseif ($value ==
'code' && $id == 3) {
2106 $valuetoshow = $obj->state_code;
2107 } elseif ($value ==
'label' && $tabname[$id] ==
'c_product_nature') {
2108 $langs->load(
"products");
2109 $valuetoshow = $langs->trans($obj->{$value});
2110 } elseif ($fieldlist[$field] ==
'label' && $tabname[$id] ==
'c_productbatch_qcstatus') {
2111 $langs->load(
"productbatch");
2112 $valuetoshow = $langs->trans($obj->{$value});
2113 } elseif ($value ==
'block_if_negative') {
2114 $valuetoshow =
yn($obj->{$value});
2115 } elseif ($value ==
'icon') {
2116 $valuetoshow = $obj->{$value}.
" ".
img_picto(
"", $obj->{$value});
2117 } elseif ($value ==
'type_duration') {
2118 $TDurationTypes = array(
'y'=>$langs->trans(
'Years'),
'm'=>$langs->trans(
'Month'),
'w'=>$langs->trans(
'Weeks'),
'd'=>$langs->trans(
'Days'),
'h'=>$langs->trans(
'Hours'),
'i'=>$langs->trans(
'Minutes'));
2119 $valuetoshow =$TDurationTypes[$obj->{$value}];
2121 $class .= ($class ?
' ' :
'').
'tddict';
2122 if ($value ==
'note' && $id == 10) {
2123 $class .=
' tdoverflowmax200';
2125 if ($value ==
'tracking') {
2126 $class .=
' tdoverflowauto';
2128 if (in_array($value, array(
'nbjour',
'decalage',
'pos',
'position',
'deposit_percent'))) {
2131 if (in_array($value, array(
'localtax1_type',
'localtax2_type'))) {
2132 $class .=
' nowrap';
2134 if (in_array($value, array(
'use_default',
'fk_parent',
'sortorder'))) {
2135 $class .=
' center';
2137 if ($value ==
'public') {
2138 $class .=
' center';
2142 print
'<!-- '. $value .
' --><td class="'.$class.
'"'.($titletoshow ?
' title="'.dol_escape_htmltag($titletoshow).
'"' :
'').
'>'.$valuetoshow.
'</td>';
2152 if (isset($obj->code) && $id != 10 && $id != 42) {
2153 if (($obj->code ==
'0' || $obj->code ==
'' || preg_match(
'/unknown/i', $obj->code))) {
2154 $iserasable = 0; $canbedisabled = 0;
2155 } elseif ($obj->code ==
'RECEP') {
2156 $iserasable = 0; $canbedisabled = 0;
2157 } elseif ($obj->code ==
'EF0') {
2158 $iserasable = 0; $canbedisabled = 0;
2161 if ($id == 25 && in_array($obj->code, array(
'banner',
'blogpost',
'other',
'page'))) {
2162 $iserasable = 0; $canbedisabled = 0;
2163 if (in_array($obj->code, array(
'banner'))) {
2167 if (isset($obj->type) && in_array($obj->type, array(
'system',
'systemauto'))) {
2170 if (in_array(empty($obj->code) ?
'' : $obj->code, array(
'AC_OTH',
'AC_OTH_AUTO')) || in_array(empty($obj->type) ?
'' : $obj->type, array(
'systemauto'))) {
2171 $canbedisabled = 0; $canbedisabled = 0;
2173 $canbemodified = $iserasable;
2175 if (!empty($obj->code) && $obj->code ==
'RECEP') {
2178 if ($tabname[$id] ==
"c_actioncomm") {
2183 $rowidcol = $tabrowid[$id];
2185 if (empty($rowidcol) || in_array($id, array(6, 7, 8, 13, 17, 19, 27, 32))) {
2186 $rowidcol =
'rowid';
2188 $url = $_SERVER[
"PHP_SELF"].
'?'.($page ?
'page='.$page.
'&' :
'').
'sortfield='.$sortfield.
'&sortorder='.$sortorder.
'&rowid='.(isset($obj->{$rowidcol}) ? $obj->{$rowidcol} : (!empty($obj->code) ? urlencode($obj->code) :
'')).
'&code='.(!empty($obj->
code) ?urlencode($obj->
code) :
'');
2189 if (!empty($param)) {
2192 if (!is_null($withentity)) {
2193 $url .=
'&entity='.$withentity;
2200 print
'<td class="nowrap center">';
2203 print
'<a class="reposition" href="'.$url.
'action='.$acts[$obj->eec].
'_eec&token='.
newToken().
'">'.$actl[$obj->eec].
'</a>';
2205 print
'<span class="opacitymedium">'.$langs->trans(
"AlwaysActive").
'</span>';
2208 print
'<td class="nowrap center">';
2211 print
'<a class="reposition" href="'.$url.
'action='.$acts[$obj->favorite].
'_favorite&token='.
newToken().
'">'.$actl[$obj->favorite].
'</a>';
2213 print
'<span class="opacitymedium">'.$langs->trans(
"AlwaysActive").
'</span>';
2219 print
'<td class="nowrap center">';
2220 if ($canbedisabled) {
2221 print
'<a class="reposition" href="'.$url.
'action='.$acts[$obj->active].
'&token='.
newToken().
'">'.$actl[$obj->active].
'</a>';
2223 if (in_array($obj->code, array(
'AC_OTH',
'AC_OTH_AUTO'))) {
2224 print $langs->trans(
"AlwaysActive");
2225 } elseif (isset($obj->type) && in_array($obj->type, array(
'systemauto')) && empty($obj->active)) {
2226 print $langs->trans(
"Deprecated");
2227 } elseif (isset($obj->type) && in_array($obj->type, array(
'system')) && !empty($obj->active) && $obj->code !=
'AC_OTH') {
2228 print $langs->trans(
"UsedOnlyWithTypeOption");
2230 print
'<span class="opacitymedium">'.$langs->trans(
"AlwaysActive").
'</span>';
2236 if ($canbemodified) {
2237 print
'<td align="center"><a class="reposition editfielda" href="'.$url.
'action=edit&token='.
newToken().
'">'.
img_edit().
'</a></td>';
2239 print
'<td> </td>';
2244 print
'<td class="center">';
2246 print
'<a class="reposition" href="'.$url.
'action=delete&token='.
newToken().
'">'.
img_delete().
'</a>';
2251 print
'<td> </td>';
2272 $lastlineisempty =
false;
2274 print
'<div class="div-table-responsive-no-min">';
2275 print
'<table class="noborder centpercent">';
2276 print
'<tr class="liste_titre">';
2277 print
'<td colspan="2">'.$langs->trans(
"Dictionary").
'</td>';
2281 $showemptyline =
'';
2282 foreach ($taborder as $i) {
2283 if (isset($tabname[$i]) && empty($tabcond[$i])) {
2288 if ($showemptyline) {
2289 print
'<tr class="oddeven"><td width="50%"> </td><td> </td><td> </td></tr>';
2294 $value = $tabname[$i];
2295 print
'<tr class="oddeven"><td width="50%">';
2296 if (!empty($tabcond[$i])) {
2297 $tabnamenoprefix = preg_replace(
'/'.MAIN_DB_PREFIX.
'/',
'', $tabname[$i]);
2298 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$i.
'">';
2299 if (!empty($tabcomplete[$tabnamenoprefix][
'picto'])) {
2300 print
img_picto(
'', $tabcomplete[$tabnamenoprefix][
'picto'],
'class="pictofixedwidth paddingrightonly"');
2302 print $langs->trans($tablib[$i]);
2305 print $langs->trans($tablib[$i]);
2309 print
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$i.
'">';
2313 print
'<td class="right">';
2314 print
$form->textwithpicto(
'', $langs->trans(
"Table").
': '.MAIN_DB_PREFIX.$tabname[$i]);
2317 $lastlineisempty =
false;
2319 if (!$lastlineisempty) {
2321 $lastlineisempty =
true;
2345 function fieldList($fieldlist, $obj =
'', $tabname =
'', $context =
'')
2347 global $conf, $langs, $db, $mysoc;
2350 global $elementList, $sourceList, $localtax_typeList;
2358 foreach ($fieldlist as $field => $value) {
2359 if ($value ==
'entity') {
2360 $withentity = $obj->{$value};
2364 if (in_array($value, array(
'code',
'libelle',
'type')) && $tabname ==
"c_actioncomm" && in_array($obj->type, array(
'system',
'systemauto'))) {
2365 $hidden = (!empty($obj->{$value}) ? $obj->{$value}:
'');
2367 print
'<input type="hidden" name="'. $value .
'" value="'.$hidden.
'">';
2368 print $langs->trans($hidden);
2370 } elseif ($value ==
'country') {
2371 if (in_array(
'region_id', $fieldlist)) {
2377 $fieldname =
'country';
2378 print
$form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country :
'')), $fieldname,
'', 28,
'maxwidth150 maxwidthonsmartphone');
2380 } elseif ($value ==
'country_id') {
2381 if (!in_array(
'country', $fieldlist)) {
2382 $country_id = (!empty($obj->{$value}) ? $obj->{$value} : 0);
2383 print
'<td class="tdoverflowmax100">';
2384 print
'<input type="hidden" name="'. $value .
'" value="'.$country_id.
'">';
2387 } elseif ($value ==
'region') {
2389 $formcompany->select_region($region_id,
'region');
2391 } elseif ($value ==
'region_id') {
2392 $region_id = (!empty($obj->{$value}) ? $obj->{$value}:0);
2394 print
'<input type="hidden" name="'. $value .
'" value="'.$region_id.
'">';
2396 } elseif ($value ==
'lang') {
2398 print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,
'lang');
2400 } elseif (in_array($value, array(
'element',
'source'))) {
2401 $tmparray = array();
2402 if ($value ==
'element') {
2403 $tmparray = $elementList;
2405 $tmparray = $sourceList;
2408 print
$form->selectarray($value, $tmparray, (!empty($obj->{$value}) ? $obj->{$value}:
''), 0, 0, 0,
'', 0, 0, 0,
'',
'maxwidth250');
2410 } elseif (in_array($value, array(
'public',
'use_default'))) {
2412 print
'<td class="center">';
2413 print
$form->selectyesno($value, (!empty($obj->{$value}) ? $obj->{$value}:
''), 1);
2415 } elseif ($value ==
'private') {
2418 print
$form->selectyesno(
"private", (!empty($obj->{$value}) ? $obj->{$value}:
''));
2420 } elseif ($value ==
'type' && $tabname ==
"c_actioncomm") {
2421 $type = (!empty($obj->type) ? $obj->type :
'user');
2423 print $type.
'<input type="hidden" name="type" value="'.$type.
'">';
2425 } elseif ($value ==
'type' && $tabname ==
'c_paiement') {
2427 $select_list = array(0=>$langs->trans(
'PaymentTypeCustomer'), 1=>$langs->trans(
'PaymentTypeSupplier'), 2=>$langs->trans(
'PaymentTypeBoth'));
2428 print
$form->selectarray($value, $select_list, (!empty($obj->{$value}) ? $obj->{$value}:
'2'));
2430 } elseif ($value ==
'recuperableonly' || $value ==
'type_cdr' || $value ==
'deductible' || $value ==
'category_type') {
2431 if ($value ==
'type_cdr') {
2432 print
'<td class="center">';
2436 if ($value ==
'type_cdr') {
2437 print
$form->selectarray($value, array(0=>$langs->trans(
'None'), 1=>$langs->trans(
'AtEndOfMonth'), 2=>$langs->trans(
'CurrentNext')), (!empty($obj->{$value}) ? $obj->{$value}:
''));
2439 print
$form->selectyesno($value, (!empty($obj->{$value}) ? $obj->{$value}:
''), 1);
2442 } elseif (in_array($value, array(
'nbjour',
'decalage',
'taux',
'localtax1',
'localtax2'))) {
2444 if (in_array($value, array(
'taux',
'localtax1',
'localtax2'))) {
2447 print
'<td class="'.$class.
'">';
2448 print
'<input type="text" class="flat" value="'.(isset($obj->{$value}) ? $obj->{$value} :
'').
'" size="3" name="'. $value .
'">';
2450 } elseif (in_array($value, array(
'libelle_facture'))) {
2455 if ($tabname ==
'c_payment_term') {
2456 $langs->load(
"bills");
2457 $transkey =
"PaymentCondition".strtoupper($obj->code);
2458 if ($langs->trans($transkey) != $transkey) {
2460 print
$form->textwithpicto($langs->trans($transkey), $langs->trans(
"GoIntoTranslationMenuToChangeThis"));
2464 print
'<textarea cols="30" rows="'.ROWS_2.
'" class="flat" name="'. $value .
'">'.(!empty($obj->{$value}) ? $obj->{$value}:
'').
'</textarea>';
2466 print
'<input type="hidden" name="'. $value .
'" value="'.$transkey.
'">';
2469 } elseif ($value ==
'price' || preg_match(
'/^amount/i', $value)) {
2470 print
'<td><input type="text" class="flat minwidth75" value="'.price((!empty($obj->{$value}) ? $obj->{$value}:
'')).
'" name="'. $value .
'"></td>';
2471 } elseif ($value ==
'code' && isset($obj->{$value})) {
2472 print
'<td><input type="text" class="flat minwidth75 maxwidth100" value="'.(!empty($obj->{$value}) ? $obj->{$value}:
'').
'" name="'. $value .
'"></td>';
2473 } elseif ($value ==
'unit') {
2476 'mm' => $langs->trans(
'SizeUnitmm'),
2477 'cm' => $langs->trans(
'SizeUnitcm'),
2478 'point' => $langs->trans(
'SizeUnitpoint'),
2479 'inch' => $langs->trans(
'SizeUnitinch')
2481 print
$form->selectarray(
'unit', $units, (!empty($obj->{$value}) ? $obj->{$value}:
''), 0, 0, 0);
2483 } elseif ($value ==
'localtax1_type' || $value ==
'localtax2_type') {
2485 print
'<td class="center">';
2486 print
$form->selectarray($value, $localtax_typeList, (!empty($obj->{$value}) ? $obj->{$value}:
''));
2488 } elseif ($value ==
'accountancy_code' || $value ==
'accountancy_code_sell' || $value ==
'accountancy_code_buy') {
2490 if (!empty($conf->accounting->enabled)) {
2491 $fieldname = $value;
2492 $accountancy_account = (!empty($obj->$fieldname) ? $obj->$fieldname : 0);
2493 print $formaccounting->select_account($accountancy_account,
'.'. $value, 1,
'', 1, 1,
'maxwidth200 maxwidthonsmartphone');
2495 $fieldname = $value;
2496 print
'<input type="text" size="10" class="flat" value="'.(isset($obj->$fieldname) ? $obj->$fieldname :
'').
'" name="'. $value .
'">';
2499 } elseif ($value ==
'fk_tva') {
2501 print
$form->load_tva(
'fk_tva', $obj->taux, $mysoc,
new Societe($db), 0, 0,
'',
false, -1);
2503 } elseif ($value ==
'fk_c_exp_tax_cat') {
2505 print
$form->selectExpenseCategories($obj->fk_c_exp_tax_cat);
2507 } elseif ($value ==
'fk_range') {
2509 print
$form->selectExpenseRanges($obj->fk_range);
2511 } elseif ($value ==
'block_if_negative') {
2513 print
$form->selectyesno(
"block_if_negative", (!empty($obj->{$value}) ? $obj->{$value}:
''), 1);
2515 } elseif ($value ==
'type_duration') {
2517 print
$form->selectTypeDuration(
'', $obj->{$value}, array(
'i',
'h'));
2520 $fieldValue = isset($obj->{$value}) ? $obj->{$value}:
'';
2521 $classtd =
''; $class =
'';
2523 if ($value ==
'sortorder') {
2524 $fieldlist[$field] =
'position';
2527 if ($fieldlist[$field] ==
'code') {
2528 $class =
'maxwidth100';
2530 if (in_array($fieldlist[$field], array(
'deposit_percent'))) {
2531 $classtd =
'right'; $class =
'maxwidth50 right';
2533 if (in_array($fieldlist[$field], array(
'pos',
'position'))) {
2534 $classtd =
'center'; $class =
'maxwidth50 center';
2536 if (in_array($fieldlist[$field], array(
'dayrule',
'day',
'month',
'year',
'use_default',
'affect',
'delay',
'public',
'sortorder',
'sens',
'category_type',
'fk_parent'))) {
2537 $class =
'maxwidth50 center';
2539 if (in_array($fieldlist[$field], array(
'use_default',
'public',
'fk_parent'))) {
2540 $classtd =
'center';
2542 if (in_array($fieldlist[$field], array(
'libelle',
'label',
'tracking'))) {
2543 $class =
'quatrevingtpercent';
2546 if ($fieldlist[$field] ==
'fk_parent') {
2547 if (empty($fieldValue)) {
2554 if (in_array($fieldlist[$field], array(
'libelle',
'label'))) {
2556 case 'c_accounting_category':
2558 case 'c_email_senderprofile':
2559 case 'c_forme_juridique':
2560 case 'c_holiday_types':
2561 case 'c_payment_term':
2562 case 'c_transport_mode':
2563 $maxlength =
' maxlength="255"';
2565 case 'c_email_templates':
2566 $maxlength =
' maxlength="180"';
2568 case 'c_socialnetworks':
2569 $maxlength =
' maxlength="150"';
2572 $maxlength =
' maxlength="128"';
2576 print
'<td class="'.$classtd.
'">';
2579 if (in_array($fieldlist[$field], array(
'label',
'libelle'))) {
2581 if ($tabname ==
'c_civility' && !empty($obj->code)) {
2582 $transkey =
"Civility".strtoupper($obj->code);
2584 if ($tabname ==
'c_payment_term' && !empty($obj->code)) {
2585 $langs->load(
"bills");
2586 $transkey =
"PaymentConditionShort".strtoupper($obj->code);
2588 if ($transkey && $langs->trans($transkey) != $transkey) {
2590 print
$form->textwithpicto($langs->trans($transkey), $langs->trans(
"GoIntoTranslationMenuToChangeThis"));
2594 print
'<input type="text" class="flat'.($class ?
' '.$class :
'').
'"'.($maxlength ?
' '.$maxlength :
'').
' value="'.
dol_escape_htmltag($fieldValue).
'" name="'.$fieldlist[$field].
'">';
2596 print
'<input type="hidden" name="'.$fieldlist[$field].
'" value="'.$transkey.
'">';