| Conditions | 164 |
| Paths | > 20000 |
| Total Lines | 961 |
| Code Lines | 643 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 64 | public function index($executeActions = true): bool |
||
| 65 | { |
||
| 66 | global $conf; |
||
| 67 | global $db; |
||
| 68 | global $user; |
||
| 69 | global $hookmanager; |
||
| 70 | global $user; |
||
| 71 | global $menumanager; |
||
| 72 | global $langs; |
||
| 73 | global $mysoc; |
||
| 74 | |||
| 75 | $action = GETPOST('action', 'aZ09'); |
||
| 76 | $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'admincompany'; // To manage different context of search |
||
| 77 | $page_y = GETPOSTINT('page_y'); |
||
| 78 | |||
| 79 | $conf = \DoliCore\Base\Config::getConf(); |
||
| 80 | |||
| 81 | // Load translation files required by the page |
||
| 82 | $langs->loadLangs(['admin', 'companies', 'bills']); |
||
| 83 | |||
| 84 | if (!$user->admin) { |
||
| 85 | accessforbidden(); |
||
| 86 | } |
||
| 87 | |||
| 88 | $error = 0; |
||
| 89 | |||
| 90 | $tmparraysize = getDefaultImageSizes(); |
||
| 91 | $maxwidthsmall = $tmparraysize['maxwidthsmall']; |
||
| 92 | $maxheightsmall = $tmparraysize['maxheightsmall']; |
||
| 93 | $maxwidthmini = $tmparraysize['maxwidthmini']; |
||
| 94 | $maxheightmini = $tmparraysize['maxheightmini']; |
||
| 95 | $quality = $tmparraysize['quality']; |
||
| 96 | |||
| 97 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
||
| 98 | $hookmanager->initHooks(['admincompany', 'globaladmin']); |
||
| 99 | |||
| 100 | |||
| 101 | /* |
||
| 102 | * Actions |
||
| 103 | */ |
||
| 104 | |||
| 105 | $parameters = []; |
||
| 106 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
||
|
|
|||
| 107 | if ($reshook < 0) { |
||
| 108 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
||
| 109 | } |
||
| 110 | |||
| 111 | if ( |
||
| 112 | ($action == 'update' && !GETPOST("cancel", 'alpha')) |
||
| 113 | || ($action == 'updateedit') |
||
| 114 | ) { |
||
| 115 | $tmparray = getCountry(GETPOSTINT('country_id'), 'all', $db, $langs, 0); |
||
| 116 | if (!empty($tmparray['id'])) { |
||
| 117 | if ($tmparray['code'] == 'FR' && $tmparray['id'] != $mysoc->country_id) { |
||
| 118 | // For FR, default value of option to show profid SIREN is on by default |
||
| 119 | $res = dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", 1, 'chaine', 0, '', $conf->entity); |
||
| 120 | } |
||
| 121 | |||
| 122 | $mysoc->country_id = $tmparray['id']; |
||
| 123 | $mysoc->country_code = $tmparray['code']; |
||
| 124 | $mysoc->country_label = $tmparray['label']; |
||
| 125 | |||
| 126 | $s = $mysoc->country_id . ':' . $mysoc->country_code . ':' . $mysoc->country_label; |
||
| 127 | dolibarr_set_const($db, "MAIN_INFO_SOCIETE_COUNTRY", $s, 'chaine', 0, '', $conf->entity); |
||
| 128 | |||
| 129 | activateModulesRequiredByCountry($mysoc->country_code); |
||
| 130 | } |
||
| 131 | |||
| 132 | $tmparray = getState(GETPOSTINT('state_id'), 'all', $db, $langs, 0); |
||
| 133 | if (!empty($tmparray['id'])) { |
||
| 134 | $mysoc->state_id = $tmparray['id']; |
||
| 135 | $mysoc->state_code = $tmparray['code']; |
||
| 136 | $mysoc->state_label = $tmparray['label']; |
||
| 137 | |||
| 138 | $s = $mysoc->state_id . ':' . $mysoc->state_code . ':' . $mysoc->state_label; |
||
| 139 | dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", $s, 'chaine', 0, '', $conf->entity); |
||
| 140 | } else { |
||
| 141 | dolibarr_del_const($db, "MAIN_INFO_SOCIETE_STATE", $conf->entity); |
||
| 142 | } |
||
| 143 | |||
| 144 | $db->begin(); |
||
| 145 | |||
| 146 | dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("name", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 147 | dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("MAIN_INFO_SOCIETE_ADDRESS", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 148 | dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("MAIN_INFO_SOCIETE_TOWN", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 149 | dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("MAIN_INFO_SOCIETE_ZIP", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 150 | dolibarr_set_const($db, "MAIN_INFO_SOCIETE_REGION", GETPOST("region_code", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 151 | dolibarr_set_const($db, "MAIN_MONNAIE", GETPOST("currency", 'aZ09'), 'chaine', 0, '', $conf->entity); |
||
| 152 | dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL", GETPOST("phone", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 153 | dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MOBILE", GETPOST("phone_mobile", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 154 | dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX", GETPOST("fax", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 155 | dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL", GETPOST("mail", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 156 | dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB", GETPOST("web", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 157 | dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE", GETPOST("note", 'restricthtml'), 'chaine', 0, '', $conf->entity); |
||
| 158 | dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 159 | |||
| 160 | $dirforimage = $conf->mycompany->dir_output . '/logos/'; |
||
| 161 | |||
| 162 | $arrayofimages = ['logo', 'logo_squarred']; |
||
| 163 | //var_dump($_FILES); exit; |
||
| 164 | foreach ($arrayofimages as $varforimage) { |
||
| 165 | if ($_FILES[$varforimage]["name"] && !preg_match('/(\.jpeg|\.jpg|\.png)$/i', $_FILES[$varforimage]["name"])) { // Logo can be used on a lot of different places. Only jpg and png can be supported. |
||
| 166 | $langs->load("errors"); |
||
| 167 | setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); |
||
| 168 | break; |
||
| 169 | } |
||
| 170 | |||
| 171 | // Remove to check file size to large |
||
| 172 | /*if ($_FILES[$varforimage]["tmp_name"]) {*/ |
||
| 173 | $reg = []; |
||
| 174 | if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) { |
||
| 175 | $original_file = $reg[1]; |
||
| 176 | |||
| 177 | $isimage = image_format_supported($original_file); |
||
| 178 | if ($isimage >= 0) { |
||
| 179 | dol_syslog("Move file " . $_FILES[$varforimage]["tmp_name"] . " to " . $dirforimage . $original_file); |
||
| 180 | if (!is_dir($dirforimage)) { |
||
| 181 | dol_mkdir($dirforimage); |
||
| 182 | } |
||
| 183 | $result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage . $original_file, 1, 0, $_FILES[$varforimage]['error']); |
||
| 184 | |||
| 185 | if (is_numeric($result) && $result > 0) { |
||
| 186 | $constant = "MAIN_INFO_SOCIETE_LOGO"; |
||
| 187 | if ($varforimage == 'logo_squarred') { |
||
| 188 | $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED"; |
||
| 189 | } |
||
| 190 | |||
| 191 | dolibarr_set_const($db, $constant, $original_file, 'chaine', 0, '', $conf->entity); |
||
| 192 | |||
| 193 | // Create thumbs of logo (Note that PDF use original file and not thumbs) |
||
| 194 | if ($isimage > 0) { |
||
| 195 | // Create thumbs |
||
| 196 | //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retrieve value with get... |
||
| 197 | |||
| 198 | |||
| 199 | // Create small thumb, Used on logon for example |
||
| 200 | $imgThumbSmall = vignette($dirforimage . $original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality); |
||
| 201 | if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) { |
||
| 202 | $imgThumbSmall = $reg[1]; // Save only basename |
||
| 203 | dolibarr_set_const($db, $constant . "_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity); |
||
| 204 | } else { |
||
| 205 | dol_syslog($imgThumbSmall); |
||
| 206 | } |
||
| 207 | |||
| 208 | // Create mini thumb, Used on menu or for setup page for example |
||
| 209 | $imgThumbMini = vignette($dirforimage . $original_file, $maxwidthmini, $maxheightmini, '_mini', $quality); |
||
| 210 | if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg)) { |
||
| 211 | $imgThumbMini = $reg[1]; // Save only basename |
||
| 212 | dolibarr_set_const($db, $constant . "_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity); |
||
| 213 | } else { |
||
| 214 | dol_syslog($imgThumbMini); |
||
| 215 | } |
||
| 216 | } else { |
||
| 217 | dol_syslog("ErrorImageFormatNotSupported", LOG_WARNING); |
||
| 218 | } |
||
| 219 | } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) { |
||
| 220 | $error++; |
||
| 221 | $langs->load("errors"); |
||
| 222 | $tmparray = explode(':', $result); |
||
| 223 | setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors'); |
||
| 224 | } elseif (preg_match('/^ErrorFileSizeTooLarge/', $result)) { |
||
| 225 | $error++; |
||
| 226 | setEventMessages($langs->trans("ErrorFileSizeTooLarge"), null, 'errors'); |
||
| 227 | } else { |
||
| 228 | $error++; |
||
| 229 | setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); |
||
| 230 | } |
||
| 231 | } else { |
||
| 232 | $error++; |
||
| 233 | $langs->load("errors"); |
||
| 234 | setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); |
||
| 235 | } |
||
| 236 | } |
||
| 237 | /*}*/ |
||
| 238 | } |
||
| 239 | |||
| 240 | dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MANAGERS", GETPOST("MAIN_INFO_SOCIETE_MANAGERS", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 241 | dolibarr_set_const($db, "MAIN_INFO_GDPR", GETPOST("MAIN_INFO_GDPR", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 242 | dolibarr_set_const($db, "MAIN_INFO_CAPITAL", GETPOST("capital", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 243 | dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE", GETPOST("forme_juridique_code", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 244 | dolibarr_set_const($db, "MAIN_INFO_SIREN", GETPOST("siren", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 245 | dolibarr_set_const($db, "MAIN_INFO_SIRET", GETPOST("siret", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 246 | dolibarr_set_const($db, "MAIN_INFO_APE", GETPOST("ape", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 247 | dolibarr_set_const($db, "MAIN_INFO_RCS", GETPOST("rcs", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 248 | dolibarr_set_const($db, "MAIN_INFO_PROFID5", GETPOST("MAIN_INFO_PROFID5", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 249 | dolibarr_set_const($db, "MAIN_INFO_PROFID6", GETPOST("MAIN_INFO_PROFID6", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 250 | dolibarr_set_const($db, "MAIN_INFO_PROFID7", GETPOST("MAIN_INFO_PROFID7", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 251 | dolibarr_set_const($db, "MAIN_INFO_PROFID8", GETPOST("MAIN_INFO_PROFID8", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 252 | dolibarr_set_const($db, "MAIN_INFO_PROFID9", GETPOST("MAIN_INFO_PROFID9", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 253 | dolibarr_set_const($db, "MAIN_INFO_PROFID10", GETPOST("MAIN_INFO_PROFID10", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 254 | |||
| 255 | dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 256 | dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT", GETPOST("socialobject", 'alphanohtml'), 'chaine', 0, '', $conf->entity); |
||
| 257 | |||
| 258 | dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START", GETPOSTINT("SOCIETE_FISCAL_MONTH_START"), 'chaine', 0, '', $conf->entity); |
||
| 259 | |||
| 260 | // Sale tax options |
||
| 261 | $usevat = GETPOST("optiontva", 'aZ09'); |
||
| 262 | $uselocaltax1 = GETPOST("optionlocaltax1", 'aZ09'); |
||
| 263 | $uselocaltax2 = GETPOST("optionlocaltax2", 'aZ09'); |
||
| 264 | if ($uselocaltax1 == 'localtax1on' && !$usevat) { |
||
| 265 | setEventMessages($langs->trans("IfYouUseASecondTaxYouMustSetYouUseTheMainTax"), null, 'errors'); |
||
| 266 | $error++; |
||
| 267 | } |
||
| 268 | if ($uselocaltax2 == 'localtax2on' && !$usevat) { |
||
| 269 | setEventMessages($langs->trans("IfYouUseAThirdTaxYouMustSetYouUseTheMainTax"), null, 'errors'); |
||
| 270 | $error++; |
||
| 271 | } |
||
| 272 | |||
| 273 | dolibarr_set_const($db, "FACTURE_TVAOPTION", $usevat, 'chaine', 0, '', $conf->entity); |
||
| 274 | dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION", $uselocaltax1, 'chaine', 0, '', $conf->entity); |
||
| 275 | dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION", $uselocaltax2, 'chaine', 0, '', $conf->entity); |
||
| 276 | |||
| 277 | if (GETPOST("optionlocaltax1") == "localtax1on") { |
||
| 278 | if (!GETPOSTISSET('lt1')) { |
||
| 279 | dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", 0, 'chaine', 0, '', $conf->entity); |
||
| 280 | } else { |
||
| 281 | dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", GETPOST('lt1', 'aZ09'), 'chaine', 0, '', $conf->entity); |
||
| 282 | } |
||
| 283 | dolibarr_set_const($db, "MAIN_INFO_LOCALTAX_CALC1", GETPOST("clt1", 'aZ09'), 'chaine', 0, '', $conf->entity); |
||
| 284 | } |
||
| 285 | if (GETPOST("optionlocaltax2") == "localtax2on") { |
||
| 286 | if (!GETPOSTISSET('lt2')) { |
||
| 287 | dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", 0, 'chaine', 0, '', $conf->entity); |
||
| 288 | } else { |
||
| 289 | dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", GETPOST('lt2', 'aZ09'), 'chaine', 0, '', $conf->entity); |
||
| 290 | } |
||
| 291 | dolibarr_set_const($db, "MAIN_INFO_LOCALTAX_CALC2", GETPOST("clt2", 'aZ09'), 'chaine', 0, '', $conf->entity); |
||
| 292 | } |
||
| 293 | |||
| 294 | // Credentials for AADE webservices, applicable only for Greece |
||
| 295 | if ($mysoc->country_code == 'GR') { |
||
| 296 | dolibarr_set_const($db, "MYDATA_AADE_USER", GETPOST("MYDATA_AADE_USER", 'alpha'), 'chaine', 0, '', $conf->entity); |
||
| 297 | dolibarr_set_const($db, "MYDATA_AADE_KEY", GETPOST("MYDATA_AADE_KEY", 'alpha'), 'chaine', 0, '', $conf->entity); |
||
| 298 | dolibarr_set_const($db, "AADE_WEBSERVICE_USER", GETPOST("AADE_WEBSERVICE_USER", 'alpha'), 'chaine', 0, '', $conf->entity); |
||
| 299 | dolibarr_set_const($db, "AADE_WEBSERVICE_KEY", GETPOST("AADE_WEBSERVICE_KEY", 'alpha'), 'chaine', 0, '', $conf->entity); |
||
| 300 | } |
||
| 301 | |||
| 302 | // Remove constant MAIN_INFO_SOCIETE_SETUP_TODO_WARNING |
||
| 303 | dolibarr_del_const($db, "MAIN_INFO_SOCIETE_SETUP_TODO_WARNING", $conf->entity); |
||
| 304 | |||
| 305 | if (!$error) { |
||
| 306 | if (GETPOST('save')) { // To avoid to show message when we juste switch the country that resubmit the form. |
||
| 307 | setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
||
| 308 | } |
||
| 309 | $db->commit(); |
||
| 310 | } else { |
||
| 311 | $db->rollback(); |
||
| 312 | } |
||
| 313 | |||
| 314 | if ($action != 'updateedit' && !$error) { |
||
| 315 | header("Location: " . $_SERVER['PHP_SELF'] . ($page_y ? '?page_y=' . $page_y : '')); |
||
| 316 | exit; |
||
| 317 | } |
||
| 318 | } |
||
| 319 | |||
| 320 | if ($action == 'addthumb' || $action == 'addthumbsquarred') { // Regenerate thumbs |
||
| 321 | if (file_exists($conf->mycompany->dir_output . '/logos/' . $_GET["file"])) { |
||
| 322 | $isimage = image_format_supported($_GET["file"]); |
||
| 323 | |||
| 324 | // Create thumbs of logo |
||
| 325 | if ($isimage > 0) { |
||
| 326 | $constant = "MAIN_INFO_SOCIETE_LOGO"; |
||
| 327 | if ($action == 'addthumbsquarred') { |
||
| 328 | $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED"; |
||
| 329 | } |
||
| 330 | |||
| 331 | $reg = []; |
||
| 332 | |||
| 333 | // Create thumbs |
||
| 334 | //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retrieve value with get... |
||
| 335 | |||
| 336 | // Create small thumb. Used on logon for example |
||
| 337 | $imgThumbSmall = vignette($conf->mycompany->dir_output . '/logos/' . $_GET["file"], $maxwidthsmall, $maxheightsmall, '_small', $quality); |
||
| 338 | if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) { |
||
| 339 | $imgThumbSmall = $reg[1]; // Save only basename |
||
| 340 | dolibarr_set_const($db, $constant . "_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity); |
||
| 341 | } else { |
||
| 342 | dol_syslog($imgThumbSmall); |
||
| 343 | } |
||
| 344 | |||
| 345 | // Create mini thumbs. Used on menu or for setup page for example |
||
| 346 | $imgThumbMini = vignette($conf->mycompany->dir_output . '/logos/' . $_GET["file"], $maxwidthmini, $maxheightmini, '_mini', $quality); |
||
| 347 | if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg)) { |
||
| 348 | $imgThumbMini = $reg[1]; // Save only basename |
||
| 349 | dolibarr_set_const($db, $constant . "_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity); |
||
| 350 | } else { |
||
| 351 | dol_syslog($imgThumbMini); |
||
| 352 | } |
||
| 353 | |||
| 354 | header("Location: " . $_SERVER['PHP_SELF']); |
||
| 355 | exit; |
||
| 356 | } else { |
||
| 357 | $error++; |
||
| 358 | $langs->load("errors"); |
||
| 359 | setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); |
||
| 360 | dol_syslog($langs->transnoentities("ErrorBadImageFormat"), LOG_INFO); |
||
| 361 | } |
||
| 362 | } else { |
||
| 363 | $error++; |
||
| 364 | $langs->load("errors"); |
||
| 365 | setEventMessages($langs->trans("ErrorFileDoesNotExists", GETPOST("file")), null, 'errors'); |
||
| 366 | dol_syslog($langs->transnoentities("ErrorFileDoesNotExists", GETPOST("file")), LOG_WARNING); |
||
| 367 | } |
||
| 368 | } |
||
| 369 | |||
| 370 | |||
| 371 | if ($action == 'removelogo' || $action == 'removelogosquarred') { |
||
| 372 | $constant = "MAIN_INFO_SOCIETE_LOGO"; |
||
| 373 | if ($action == 'removelogosquarred') { |
||
| 374 | $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED"; |
||
| 375 | } |
||
| 376 | |||
| 377 | require_once BASE_PATH . '/../Dolibarr/Lib/Files.php'; |
||
| 378 | |||
| 379 | $logofilename = $mysoc->logo; |
||
| 380 | $logofilenamebis = $mysoc->logo_squarred; |
||
| 381 | if ($action == 'removelogosquarred') { |
||
| 382 | $logofilename = $mysoc->logo_squarred; |
||
| 383 | $logofilenamebis = $mysoc->logo; |
||
| 384 | } |
||
| 385 | |||
| 386 | $logofile = $conf->mycompany->dir_output . '/logos/' . $logofilename; |
||
| 387 | if ($logofilename != '' && $logofilename != $logofilenamebis) { |
||
| 388 | dol_delete_file($logofile); |
||
| 389 | } |
||
| 390 | dolibarr_del_const($db, $constant, $conf->entity); |
||
| 391 | if ($action == 'removelogosquarred') { |
||
| 392 | $mysoc->logo_squarred = ''; |
||
| 393 | } else { |
||
| 394 | $mysoc->logo = ''; |
||
| 395 | } |
||
| 396 | |||
| 397 | $logofilename = $mysoc->logo_small; |
||
| 398 | $logofilenamebis = $mysoc->logo_squarred_small; |
||
| 399 | if ($action == 'removelogosquarred') { |
||
| 400 | $logofilename = $mysoc->logo_squarred_small; |
||
| 401 | $logofilenamebis = $mysoc->logo_small; |
||
| 402 | } |
||
| 403 | |||
| 404 | $logosmallfile = $conf->mycompany->dir_output . '/logos/thumbs/' . $logofilename; |
||
| 405 | if ($logofilename != '' && $logofilename != $logofilenamebis) { |
||
| 406 | dol_delete_file($logosmallfile); |
||
| 407 | } |
||
| 408 | dolibarr_del_const($db, $constant . "_SMALL", $conf->entity); |
||
| 409 | if ($action == 'removelogosquarred') { |
||
| 410 | $mysoc->logo_squarred_small = ''; |
||
| 411 | } else { |
||
| 412 | $mysoc->logo_small = ''; |
||
| 413 | } |
||
| 414 | |||
| 415 | $logofilename = $mysoc->logo_mini; |
||
| 416 | $logofilenamebis = $mysoc->logo_squarred_mini; |
||
| 417 | if ($action == 'removelogosquarred') { |
||
| 418 | $logofilename = $mysoc->logo_squarred_mini; |
||
| 419 | $logofilenamebis = $mysoc->logo_mini; |
||
| 420 | } |
||
| 421 | |||
| 422 | $logominifile = $conf->mycompany->dir_output . '/logos/thumbs/' . $logofilename; |
||
| 423 | if ($logofilename != '' && $logofilename != $logofilenamebis) { |
||
| 424 | dol_delete_file($logominifile); |
||
| 425 | } |
||
| 426 | dolibarr_del_const($db, $constant . "_MINI", $conf->entity); |
||
| 427 | if ($action == 'removelogosquarred') { |
||
| 428 | $mysoc->logo_squarred_mini = ''; |
||
| 429 | } else { |
||
| 430 | $mysoc->logo_mini = ''; |
||
| 431 | } |
||
| 432 | } |
||
| 433 | |||
| 434 | |||
| 435 | /* |
||
| 436 | * View |
||
| 437 | */ |
||
| 438 | |||
| 439 | $wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; |
||
| 440 | llxHeader('', $langs->trans("Setup"), $wikihelp); |
||
| 441 | |||
| 442 | $form = new Form($db); |
||
| 443 | $formother = new FormOther($db); |
||
| 444 | $formcompany = new FormCompany($db); |
||
| 445 | |||
| 446 | $countrynotdefined = '<span class="error">' . $langs->trans("ErrorSetACountryFirst") . ' <a href="#trzipbeforecountry">(' . $langs->trans("SeeAbove") . ')</a></span>'; |
||
| 447 | |||
| 448 | print load_fiche_titre($langs->trans("CompanyFoundation"), '', 'title_setup'); |
||
| 449 | |||
| 450 | $head = company_admin_prepare_head(); |
||
| 451 | |||
| 452 | print dol_get_fiche_head($head, 'company', '', -1, ''); |
||
| 453 | |||
| 454 | print '<span class="opacitymedium">' . $langs->trans("CompanyFundationDesc", $langs->transnoentities("Save")) . "</span><br>\n"; |
||
| 455 | print "<br><br>\n"; |
||
| 456 | |||
| 457 | |||
| 458 | // Edit parameters |
||
| 459 | if (!empty($conf->use_javascript_ajax)) { |
||
| 460 | print "\n" . '<script type="text/javascript">'; |
||
| 461 | print '$(document).ready(function () { |
||
| 462 | $("#selectcountry_id").change(function() { |
||
| 463 | document.form_index.action.value="updateedit"; |
||
| 464 | document.form_index.submit(); |
||
| 465 | }); |
||
| 466 | });'; |
||
| 467 | print '</script>' . "\n"; |
||
| 468 | } |
||
| 469 | |||
| 470 | print '<form enctype="multipart/form-data" method="POST" action="' . $_SERVER['PHP_SELF'] . '" name="form_index">'; |
||
| 471 | print '<input type="hidden" name="token" value="' . newToken() . '">'; |
||
| 472 | print '<input type="hidden" name="action" value="update">'; |
||
| 473 | print '<input type="hidden" name="page_y" value="">'; |
||
| 474 | |||
| 475 | print '<table class="noborder centpercent editmode">'; |
||
| 476 | print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak">' . $langs->trans("CompanyInfo") . '</th><th></th></tr>' . "\n"; |
||
| 477 | |||
| 478 | // Name |
||
| 479 | print '<tr class="oddeven"><td class="fieldrequired wordbreak"><label for="name">' . $langs->trans("CompanyName") . '</label></td><td>'; |
||
| 480 | print '<input name="name" id="name" class="minwidth200" value="' . dol_escape_htmltag((GETPOSTISSET('name') ? GETPOST('name', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_NOM')))) . '"' . (!getDolGlobalString('MAIN_INFO_SOCIETE_NOM') ? ' autofocus="autofocus"' : '') . '></td></tr>' . "\n"; |
||
| 481 | |||
| 482 | // Address |
||
| 483 | print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ADDRESS">' . $langs->trans("CompanyAddress") . '</label></td><td>'; |
||
| 484 | print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="' . ROWS_3 . '">' . (GETPOSTISSET('MAIN_INFO_SOCIETE_ADDRESS') ? GETPOST('MAIN_INFO_SOCIETE_ADDRESS', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_ADDRESS'))) . '</textarea></td></tr>' . "\n"; |
||
| 485 | |||
| 486 | // Zip |
||
| 487 | print '<tr class="oddeven" id="trzipbeforecountry"><td><label for="MAIN_INFO_SOCIETE_ZIP">' . $langs->trans("CompanyZip") . '</label></td><td>'; |
||
| 488 | print '<input class="width100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="' . dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_ZIP') ? GETPOST('MAIN_INFO_SOCIETE_ZIP', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_ZIP')))) . '"></td></tr>' . "\n"; |
||
| 489 | |||
| 490 | print '<tr class="oddeven" id="trtownbeforecountry"><td><label for="MAIN_INFO_SOCIETE_TOWN">' . $langs->trans("CompanyTown") . '</label></td><td>'; |
||
| 491 | print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth200" id="MAIN_INFO_SOCIETE_TOWN" value="' . dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_TOWN') ? GETPOST('MAIN_INFO_SOCIETE_TOWN', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_TOWN')))) . '"></td></tr>' . "\n"; |
||
| 492 | |||
| 493 | // Country |
||
| 494 | print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">' . $langs->trans("Country") . '</label></td><td>'; |
||
| 495 | print img_picto('', 'globe-americas', 'class="pictofixedwidth"'); |
||
| 496 | print $form->select_country($mysoc->country_id, 'country_id', '', 0); |
||
| 497 | if ($user->admin) { |
||
| 498 | print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
||
| 499 | } |
||
| 500 | print '</td></tr>' . "\n"; |
||
| 501 | |||
| 502 | print '<tr class="oddeven"><td class="wordbreak"><label for="state_id">' . $langs->trans("State") . '</label></td><td>'; |
||
| 503 | $state_id = 0; |
||
| 504 | if (getDolGlobalString('MAIN_INFO_SOCIETE_STATE')) { |
||
| 505 | $tmp = explode(':', getDolGlobalString('MAIN_INFO_SOCIETE_STATE')); |
||
| 506 | $state_id = $tmp[0]; |
||
| 507 | } |
||
| 508 | print img_picto('', 'state', 'class="pictofixedwidth"'); |
||
| 509 | print $formcompany->select_state($state_id, $mysoc->country_code, 'state_id', 'maxwidth200onsmartphone minwidth300'); |
||
| 510 | print '</td></tr>' . "\n"; |
||
| 511 | |||
| 512 | // Currency |
||
| 513 | print '<tr class="oddeven"><td><label for="currency">' . $langs->trans("CompanyCurrency") . '</label></td><td>'; |
||
| 514 | print img_picto('', 'multicurrency', 'class="pictofixedwidth"'); |
||
| 515 | print $form->selectCurrency($conf->currency, "currency"); |
||
| 516 | print '</td></tr>' . "\n"; |
||
| 517 | |||
| 518 | // Phone |
||
| 519 | print '<tr class="oddeven"><td><label for="phone">' . $langs->trans("Phone") . '</label></td><td>'; |
||
| 520 | print img_picto('', 'object_phoning', '', false, 0, 0, '', 'pictofixedwidth'); |
||
| 521 | print '<input class="maxwidth150 widthcentpercentminusx" name="phone" id="phone" value="' . dol_escape_htmltag((GETPOSTISSET('phone') ? GETPOST('phone', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_TEL')))) . '"></td></tr>'; |
||
| 522 | print '</td></tr>' . "\n"; |
||
| 523 | |||
| 524 | // Phone mobile |
||
| 525 | print '<tr class="oddeven"><td><label for="phone">' . $langs->trans("PhoneMobile") . '</label></td><td>'; |
||
| 526 | print img_picto('', 'object_phoning_mobile', '', false, 0, 0, '', 'pictofixedwidth'); |
||
| 527 | print '<input class="maxwidth150 widthcentpercentminusx" name="phone_mobile" id="phone_mobile" value="' . dol_escape_htmltag((GETPOSTISSET('phone_mobile') ? GETPOST('phone_mobile', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_MOBILE')))) . '"></td></tr>'; |
||
| 528 | print '</td></tr>' . "\n"; |
||
| 529 | |||
| 530 | // Fax |
||
| 531 | print '<tr class="oddeven"><td><label for="fax">' . $langs->trans("Fax") . '</label></td><td>'; |
||
| 532 | print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'pictofixedwidth'); |
||
| 533 | print '<input class="maxwidth150" name="fax" id="fax" value="' . dol_escape_htmltag((GETPOSTISSET('fax') ? GETPOST('fax', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_FAX')))) . '"></td></tr>'; |
||
| 534 | print '</td></tr>' . "\n"; |
||
| 535 | |||
| 536 | |||
| 537 | print '<tr class="oddeven"><td><label for="email">' . $langs->trans("EMail") . '</label></td><td>'; |
||
| 538 | print img_picto('', 'object_email', '', false, 0, 0, '', 'pictofixedwidth'); |
||
| 539 | print '<input class="minwidth300 maxwidth500 widthcentpercentminusx" name="mail" id="email" value="' . dol_escape_htmltag((GETPOSTISSET('mail') ? GETPOST('mail', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') ? $conf->global->MAIN_INFO_SOCIETE_MAIL : ''))) . '"></td></tr>'; |
||
| 540 | print '</td></tr>' . "\n"; |
||
| 541 | |||
| 542 | // Web |
||
| 543 | print '<tr class="oddeven"><td><label for="web">' . $langs->trans("Web") . '</label></td><td>'; |
||
| 544 | print img_picto('', 'globe', '', false, 0, 0, '', 'pictofixedwidth'); |
||
| 545 | print '<input class="maxwidth300 widthcentpercentminusx" name="web" id="web" value="' . dol_escape_htmltag((GETPOSTISSET('web') ? GETPOST('web', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_WEB') ? $conf->global->MAIN_INFO_SOCIETE_WEB : ''))) . '"></td></tr>'; |
||
| 546 | print '</td></tr>' . "\n"; |
||
| 547 | |||
| 548 | // Barcode |
||
| 549 | if (isModEnabled('barcode')) { |
||
| 550 | print '<tr class="oddeven"><td>'; |
||
| 551 | print '<label for="barcode">' . $langs->trans("Gencod") . '</label></td><td>'; |
||
| 552 | print '<span class="fa fa-barcode pictofixedwidth"></span>'; |
||
| 553 | print '<input name="barcode" id="barcode" class="minwidth150 widthcentpercentminusx maxwidth300" value="' . dol_escape_htmltag(GETPOSTISSET('barcode') ? GETPOST('barcode', 'alphanohtml') : getDolGlobalString('MAIN_INFO_SOCIETE_GENCOD', '')) . '"></td></tr>'; |
||
| 554 | print '</td></tr>'; |
||
| 555 | } |
||
| 556 | |||
| 557 | // Tooltip for both Logo and LogSquarred |
||
| 558 | $tooltiplogo = $langs->trans('AvailableFormats') . ' : png, jpg, jpeg'; |
||
| 559 | $maxfilesizearray = getMaxFileSizeArray(); |
||
| 560 | $maxmin = $maxfilesizearray['maxmin']; |
||
| 561 | $tooltiplogo .= ($maxmin > 0) ? '<br>' . $langs->trans('MaxSize') . ' : ' . $maxmin . ' ' . $langs->trans('Kb') : ''; |
||
| 562 | |||
| 563 | // Logo |
||
| 564 | print '<tr class="oddeven"><td><label for="logo">' . $form->textwithpicto($langs->trans("Logo"), $tooltiplogo) . '</label></td><td>'; |
||
| 565 | print '<div class="centpercent nobordernopadding valignmiddle "><div class="inline-block marginrightonly">'; |
||
| 566 | if ($maxmin > 0) { |
||
| 567 | print '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">'; // MAX_FILE_SIZE must precede the field type=file |
||
| 568 | } |
||
| 569 | print '<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="logo" id="logo" accept="image/*">'; |
||
| 570 | print '</div>'; |
||
| 571 | if (!empty($mysoc->logo_small)) { |
||
| 572 | print '<div class="inline-block valignmiddle marginrightonly">'; |
||
| 573 | print '<a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=removelogo&token=' . newToken() . '">' . img_delete($langs->trans("Delete"), '', 'marginleftonly') . '</a>'; |
||
| 574 | print '</div>'; |
||
| 575 | if (file_exists($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small)) { |
||
| 576 | print '<div class="inline-block valignmiddle">'; |
||
| 577 | print '<img style="max-height: 80px; max-width: 200px;" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&file=' . urlencode('logos/thumbs/' . $mysoc->logo_small) . '">'; |
||
| 578 | print '</div>'; |
||
| 579 | } elseif (!empty($mysoc->logo)) { |
||
| 580 | if (!file_exists($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_mini)) { |
||
| 581 | $imgThumbMini = vignette($conf->mycompany->dir_output . '/logos/' . $mysoc->logo, $maxwidthmini, $maxheightmini, '_mini', $quality); |
||
| 582 | } |
||
| 583 | $imgThumbSmall = vignette($conf->mycompany->dir_output . '/logos/' . $mysoc->logo, $maxwidthmini, $maxheightmini, '_small', $quality); |
||
| 584 | print '<div class="inline-block valignmiddle">'; |
||
| 585 | print '<img style="max-height: 80px; max-width: 200px;" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&file=' . urlencode('logos/thumbs/' . basename($imgThumbSmall)) . '">'; |
||
| 586 | print '</div>'; |
||
| 587 | } |
||
| 588 | } elseif (!empty($mysoc->logo)) { |
||
| 589 | if (file_exists($conf->mycompany->dir_output . '/logos/' . $mysoc->logo)) { |
||
| 590 | print '<div class="inline-block valignmiddle">'; |
||
| 591 | print '<img style="max-height: 80px" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&file=' . urlencode('logos/' . $mysoc->logo) . '">'; |
||
| 592 | print '</div>'; |
||
| 593 | print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=removelogo&token=' . newToken() . '">' . img_delete($langs->trans("Delete"), '', 'marginleftonly') . '</a></div>'; |
||
| 594 | } else { |
||
| 595 | print '<div class="inline-block valignmiddle">'; |
||
| 596 | print '<img height="80" src="' . DOL_URL_ROOT . '/public/theme/common/nophoto.png" title="File has been removed from disk">'; |
||
| 597 | print '</div>'; |
||
| 598 | } |
||
| 599 | } |
||
| 600 | print '</div>'; |
||
| 601 | print '</td></tr>'; |
||
| 602 | |||
| 603 | // Logo (squarred) |
||
| 604 | print '<tr class="oddeven"><td><label for="logo_squarred">' . $form->textwithpicto($langs->trans("LogoSquarred"), $tooltiplogo) . '</label></td><td>'; |
||
| 605 | print '<div class="centpercent nobordernopadding valignmiddle"><div class="inline-block marginrightonly">'; |
||
| 606 | $maxfilesizearray = getMaxFileSizeArray(); |
||
| 607 | $maxmin = $maxfilesizearray['maxmin']; |
||
| 608 | if ($maxmin > 0) { |
||
| 609 | print '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">'; // MAX_FILE_SIZE must precede the field type=file |
||
| 610 | } |
||
| 611 | print '<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="logo_squarred" id="logo_squarred" accept="image/*">'; |
||
| 612 | print '</div>'; |
||
| 613 | if (!empty($mysoc->logo_squarred_small)) { |
||
| 614 | print '<div class="inline-block valignmiddle marginrightonly">'; |
||
| 615 | print '<a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=removelogosquarred&token=' . newToken() . '">' . img_delete($langs->trans("Delete"), '', 'marginleftonly') . '</a>'; |
||
| 616 | print '</div>'; |
||
| 617 | if (file_exists($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_squarred_small)) { |
||
| 618 | print '<div class="inline-block valignmiddle marginrightonly">'; |
||
| 619 | print '<img style="max-height: 80px" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&file=' . urlencode('logos/thumbs/' . $mysoc->logo_squarred_small) . '">'; |
||
| 620 | print '</div>'; |
||
| 621 | } elseif (!empty($mysoc->logo_squarred)) { |
||
| 622 | if (!file_exists($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_squarred_mini)) { |
||
| 623 | $imgThumbMini = vignette($conf->mycompany->dir_output . '/logos/' . $mysoc->logo_squarred, $maxwidthmini, $maxheightmini, '_mini', $quality); |
||
| 624 | } |
||
| 625 | $imgThumbSmall = vignette($conf->mycompany->dir_output . '/logos/' . $mysoc->logo_squarred, $maxwidthmini, $maxheightmini, '_small', $quality); |
||
| 626 | print '<div class="inline-block valignmiddle">'; |
||
| 627 | print '<img style="max-height: 80px" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&file=' . urlencode('logos/thumbs/' . basename($imgThumbSmall)) . '">'; |
||
| 628 | print '</div>'; |
||
| 629 | } |
||
| 630 | } elseif (!empty($mysoc->logo_squarred)) { |
||
| 631 | if (file_exists($conf->mycompany->dir_output . '/logos/' . $mysoc->logo_squarred)) { |
||
| 632 | print '<div class="inline-block valignmiddle">'; |
||
| 633 | print '<img style="max-height: 80px" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&file=' . urlencode('logos/' . $mysoc->logo_squarred) . '">'; |
||
| 634 | print '</div>'; |
||
| 635 | print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=removelogosquarred&token=' . newToken() . '">' . img_delete($langs->trans("Delete"), '', 'marginleftonly') . '</a></div>'; |
||
| 636 | } else { |
||
| 637 | print '<div class="inline-block valignmiddle">'; |
||
| 638 | print '<img height="80" src="' . DOL_URL_ROOT . '/public/theme/common/nophoto.png" title="File has been removed from disk">'; |
||
| 639 | print '</div>'; |
||
| 640 | } |
||
| 641 | } |
||
| 642 | print '</div>'; |
||
| 643 | print '</td></tr>'; |
||
| 644 | |||
| 645 | // Note |
||
| 646 | print '<tr class="oddeven"><td class="tdtop"><label for="note">' . $langs->trans("Note") . '</label></td><td>'; |
||
| 647 | print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="' . ROWS_5 . '">' . (GETPOSTISSET('note') ? GETPOST('note', 'restricthtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_NOTE') ? $conf->global->MAIN_INFO_SOCIETE_NOTE : '')) . '</textarea></td></tr>'; |
||
| 648 | print '</td></tr>'; |
||
| 649 | |||
| 650 | print '</table>'; |
||
| 651 | |||
| 652 | print $form->buttonsSaveCancel("Save", '', [], false, 'reposition'); |
||
| 653 | |||
| 654 | print '<br><br>'; |
||
| 655 | |||
| 656 | |||
| 657 | // IDs of the company (country-specific) |
||
| 658 | print '<div class="div-table-responsive-no-min">'; |
||
| 659 | print '<table class="noborder centpercent editmode">'; |
||
| 660 | print '<tr class="liste_titre"><td class="titlefieldcreate wordbreak">' . $langs->trans("CompanyIds") . '</td><td></td></tr>'; |
||
| 661 | |||
| 662 | $langs->load("companies"); |
||
| 663 | |||
| 664 | // Managing Director(s) |
||
| 665 | print '<tr class="oddeven"><td><label for="director">' . $langs->trans("ManagingDirectors") . '</label></td><td>'; |
||
| 666 | print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="directors" class="minwidth300" value="' . dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_MANAGERS') ? GETPOST('MAIN_INFO_SOCIETE_MANAGERS', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_MANAGERS') ? $conf->global->MAIN_INFO_SOCIETE_MANAGERS : ''))) . '"></td></tr>'; |
||
| 667 | |||
| 668 | // GDPR contact |
||
| 669 | print '<tr class="oddeven"><td>'; |
||
| 670 | print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc")); |
||
| 671 | print '</td><td>'; |
||
| 672 | print '<input name="MAIN_INFO_GDPR" id="infodirector" class="minwidth300" value="' . dol_escape_htmltag((GETPOSTISSET("MAIN_INFO_GDPR") ? GETPOST("MAIN_INFO_GDPR", 'alphanohtml') : (getDolGlobalString('MAIN_INFO_GDPR') ? $conf->global->MAIN_INFO_GDPR : ''))) . '"></td></tr>'; |
||
| 673 | |||
| 674 | // Capital |
||
| 675 | print '<tr class="oddeven"><td><label for="capital">' . $langs->trans("Capital") . '</label></td><td>'; |
||
| 676 | print '<input name="capital" id="capital" class="maxwidth100" value="' . dol_escape_htmltag((GETPOSTISSET('capital') ? GETPOST('capital', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_CAPITAL') ? $conf->global->MAIN_INFO_CAPITAL : ''))) . '"></td></tr>'; |
||
| 677 | |||
| 678 | // Juridical Status |
||
| 679 | print '<tr class="oddeven"><td><label for="forme_juridique_code">' . $langs->trans("JuridicalStatus") . '</label></td><td>'; |
||
| 680 | if ($mysoc->country_code) { |
||
| 681 | print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE ?? '', $mysoc->country_code, '', 'forme_juridique_code'); |
||
| 682 | } else { |
||
| 683 | print $countrynotdefined; |
||
| 684 | } |
||
| 685 | print '</td></tr>'; |
||
| 686 | |||
| 687 | // ProfId1 |
||
| 688 | if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') { |
||
| 689 | print '<tr class="oddeven"><td><label for="profid1">' . $langs->transcountry("ProfId1", $mysoc->country_code) . '</label></td><td>'; |
||
| 690 | if (!empty($mysoc->country_code)) { |
||
| 691 | print '<input name="siren" id="profid1" class="minwidth200" value="' . dol_escape_htmltag(getDolGlobalString('MAIN_INFO_SIREN') ? $conf->global->MAIN_INFO_SIREN : '') . '">'; |
||
| 692 | } else { |
||
| 693 | print $countrynotdefined; |
||
| 694 | } |
||
| 695 | print '</td></tr>'; |
||
| 696 | } |
||
| 697 | |||
| 698 | // ProfId2 |
||
| 699 | if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') { |
||
| 700 | print '<tr class="oddeven"><td><label for="profid2">' . $langs->transcountry("ProfId2", $mysoc->country_code) . '</label></td><td>'; |
||
| 701 | if (!empty($mysoc->country_code)) { |
||
| 702 | print '<input name="siret" id="profid2" class="minwidth200" value="' . dol_escape_htmltag(getDolGlobalString('MAIN_INFO_SIRET') ? $conf->global->MAIN_INFO_SIRET : '') . '">'; |
||
| 703 | } else { |
||
| 704 | print $countrynotdefined; |
||
| 705 | } |
||
| 706 | print '</td></tr>'; |
||
| 707 | } |
||
| 708 | |||
| 709 | // ProfId3 |
||
| 710 | if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') { |
||
| 711 | print '<tr class="oddeven"><td><label for="profid3">' . $langs->transcountry("ProfId3", $mysoc->country_code) . '</label></td><td>'; |
||
| 712 | if (!empty($mysoc->country_code)) { |
||
| 713 | print '<input name="ape" id="profid3" class="minwidth200" value="' . dol_escape_htmltag(getDolGlobalString('MAIN_INFO_APE') ? $conf->global->MAIN_INFO_APE : '') . '">'; |
||
| 714 | } else { |
||
| 715 | print $countrynotdefined; |
||
| 716 | } |
||
| 717 | print '</td></tr>'; |
||
| 718 | } |
||
| 719 | |||
| 720 | // ProfId4 |
||
| 721 | if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') { |
||
| 722 | print '<tr class="oddeven"><td><label for="profid4">' . $langs->transcountry("ProfId4", $mysoc->country_code) . '</label></td><td>'; |
||
| 723 | if (!empty($mysoc->country_code)) { |
||
| 724 | print '<input name="rcs" id="profid4" class="minwidth200" value="' . dol_escape_htmltag(getDolGlobalString('MAIN_INFO_RCS') ? $conf->global->MAIN_INFO_RCS : '') . '">'; |
||
| 725 | } else { |
||
| 726 | print $countrynotdefined; |
||
| 727 | } |
||
| 728 | print '</td></tr>'; |
||
| 729 | } |
||
| 730 | |||
| 731 | // ProfId5 |
||
| 732 | if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') { |
||
| 733 | print '<tr class="oddeven"><td><label for="profid5">' . $langs->transcountry("ProfId5", $mysoc->country_code) . '</label></td><td>'; |
||
| 734 | if (!empty($mysoc->country_code)) { |
||
| 735 | print '<input name="MAIN_INFO_PROFID5" id="profid5" class="minwidth200" value="' . dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID5') ? $conf->global->MAIN_INFO_PROFID5 : '') . '">'; |
||
| 736 | } else { |
||
| 737 | print $countrynotdefined; |
||
| 738 | } |
||
| 739 | print '</td></tr>'; |
||
| 740 | } |
||
| 741 | |||
| 742 | // ProfId6 |
||
| 743 | if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') { |
||
| 744 | print '<tr class="oddeven"><td><label for="profid6">' . $langs->transcountry("ProfId6", $mysoc->country_code) . '</label></td><td>'; |
||
| 745 | if (!empty($mysoc->country_code)) { |
||
| 746 | print '<input name="MAIN_INFO_PROFID6" id="profid6" class="minwidth200" value="' . dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID6') ? $conf->global->MAIN_INFO_PROFID6 : '') . '">'; |
||
| 747 | } else { |
||
| 748 | print $countrynotdefined; |
||
| 749 | } |
||
| 750 | print '</td></tr>'; |
||
| 751 | } |
||
| 752 | |||
| 753 | // ProfId7 |
||
| 754 | if ($langs->transcountry("ProfId7", $mysoc->country_code) != '-') { |
||
| 755 | print '<tr class="oddeven"><td><label for="profid7">' . $langs->transcountry("profid7", $mysoc->country_code) . '</label></td><td>'; |
||
| 756 | if (!empty($mysoc->country_code)) { |
||
| 757 | print '<input name="MAIN_INFO_PROFID7" id="profid7" class="minwidth200" value="' . dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID7') ? $conf->global->MAIN_INFO_PROFID7 : '') . '">'; |
||
| 758 | } else { |
||
| 759 | print $countrynotdefined; |
||
| 760 | } |
||
| 761 | print '</td></tr>'; |
||
| 762 | } |
||
| 763 | |||
| 764 | // ProfId8 |
||
| 765 | if ($langs->transcountry("ProfId8", $mysoc->country_code) != '-') { |
||
| 766 | print '<tr class="oddeven"><td><label for="profid8">' . $langs->transcountry("profid8", $mysoc->country_code) . '</label></td><td>'; |
||
| 767 | if (!empty($mysoc->country_code)) { |
||
| 768 | print '<input name="MAIN_INFO_PROFID8" id="profid8" class="minwidth200" value="' . dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID8') ? $conf->global->MAIN_INFO_PROFID8 : '') . '">'; |
||
| 769 | } else { |
||
| 770 | print $countrynotdefined; |
||
| 771 | } |
||
| 772 | print '</td></tr>'; |
||
| 773 | } |
||
| 774 | |||
| 775 | // ProfId9 |
||
| 776 | if ($langs->transcountry("ProfId9", $mysoc->country_code) != '-') { |
||
| 777 | print '<tr class="oddeven"><td><label for="profid9">' . $langs->transcountry("profid9", $mysoc->country_code) . '</label></td><td>'; |
||
| 778 | if (!empty($mysoc->country_code)) { |
||
| 779 | print '<input name="MAIN_INFO_PROFID9" id="profid9" class="minwidth200" value="' . dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID9') ? $conf->global->MAIN_INFO_PROFID9 : '') . '">'; |
||
| 780 | } else { |
||
| 781 | print $countrynotdefined; |
||
| 782 | } |
||
| 783 | print '</td></tr>'; |
||
| 784 | } |
||
| 785 | |||
| 786 | // ProfId10 |
||
| 787 | if ($langs->transcountry("ProfId10", $mysoc->country_code) != '-') { |
||
| 788 | print '<tr class="oddeven"><td><label for="profid10">' . $langs->transcountry("profid10", $mysoc->country_code) . '</label></td><td>'; |
||
| 789 | if (!empty($mysoc->country_code)) { |
||
| 790 | print '<input name="MAIN_INFO_PROFID10" id="profid10" class="minwidth200" value="' . dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID10') ? $conf->global->MAIN_INFO_PROFID10 : '') . '">'; |
||
| 791 | } else { |
||
| 792 | print $countrynotdefined; |
||
| 793 | } |
||
| 794 | print '</td></tr>'; |
||
| 795 | } |
||
| 796 | |||
| 797 | // Intra-community VAT number |
||
| 798 | print '<tr class="oddeven"><td><label for="intra_vat">' . $langs->trans("VATIntra") . '</label></td><td>'; |
||
| 799 | print '<input name="tva" id="intra_vat" class="minwidth200" value="' . dol_escape_htmltag(getDolGlobalString('MAIN_INFO_TVAINTRA') ? $conf->global->MAIN_INFO_TVAINTRA : '') . '">'; |
||
| 800 | print '</td></tr>'; |
||
| 801 | |||
| 802 | // Object of the company |
||
| 803 | print '<tr class="oddeven"><td><label for="socialobject">' . $langs->trans("CompanyObject") . '</label></td><td>'; |
||
| 804 | print '<textarea class="flat quatrevingtpercent" name="socialobject" id="socialobject" rows="' . ROWS_5 . '">' . (getDolGlobalString('MAIN_INFO_SOCIETE_OBJECT') ? $conf->global->MAIN_INFO_SOCIETE_OBJECT : '') . '</textarea></td></tr>'; |
||
| 805 | print '</td></tr>'; |
||
| 806 | |||
| 807 | print '</table>'; |
||
| 808 | print '</div>'; |
||
| 809 | |||
| 810 | |||
| 811 | // Fiscal year start |
||
| 812 | print '<br>'; |
||
| 813 | print '<table class="noborder centpercent editmode">'; |
||
| 814 | print '<tr class="liste_titre">'; |
||
| 815 | print '<td class="titlefieldcreate">' . $langs->trans("FiscalYearInformation") . '</td><td></td>'; |
||
| 816 | print "</tr>\n"; |
||
| 817 | |||
| 818 | print '<tr class="oddeven"><td><label for="SOCIETE_FISCAL_MONTH_START">' . $langs->trans("FiscalMonthStart") . '</label></td><td>'; |
||
| 819 | print $formother->select_month(getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? $conf->global->SOCIETE_FISCAL_MONTH_START : '', 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100') . '</td></tr>'; |
||
| 820 | |||
| 821 | print "</table>"; |
||
| 822 | |||
| 823 | print $form->buttonsSaveCancel("Save", '', [], false, 'reposition'); |
||
| 824 | |||
| 825 | print '<br>'; |
||
| 826 | |||
| 827 | |||
| 828 | // Sales taxes (VAT, IRPF, ...) |
||
| 829 | print load_fiche_titre($langs->trans("TypeOfSaleTaxes"), '', 'object_payment'); |
||
| 830 | |||
| 831 | print '<table class="noborder centpercent editmode">'; |
||
| 832 | print '<tr class="liste_titre">'; |
||
| 833 | print '<td class="titlefieldcreate">' . $langs->trans("VATManagement") . '</td><td></td>'; |
||
| 834 | print '<td class="right"> </td>'; |
||
| 835 | print "</tr>\n"; |
||
| 836 | |||
| 837 | // Main tax |
||
| 838 | print '<tr class="oddeven"><td><label><input type="radio" name="optiontva" id="use_vat" value="1"' . (!getDolGlobalString('FACTURE_TVAOPTION') ? "" : " checked") . "> " . $langs->trans("VATIsUsed") . "</label></td>"; |
||
| 839 | print '<td colspan="2">'; |
||
| 840 | $tooltiphelp = ''; |
||
| 841 | if ($mysoc->country_code == 'FR') { |
||
| 842 | $tooltiphelp = '<i>' . $langs->trans("Example") . ': ' . $langs->trans("VATIsUsedExampleFR") . "</i>"; |
||
| 843 | } |
||
| 844 | print '<label for="use_vat">' . $form->textwithpicto($langs->trans("VATIsUsedDesc"), $tooltiphelp) . "</label>"; |
||
| 845 | print "</td></tr>\n"; |
||
| 846 | |||
| 847 | |||
| 848 | print '<tr class="oddeven"><td width="140"><label><input type="radio" name="optiontva" id="no_vat" value="0"' . (!getDolGlobalString('FACTURE_TVAOPTION') ? " checked" : "") . "> " . $langs->trans("VATIsNotUsed") . "</label></td>"; |
||
| 849 | print '<td colspan="2">'; |
||
| 850 | $tooltiphelp = ''; |
||
| 851 | if ($mysoc->country_code == 'FR') { |
||
| 852 | $tooltiphelp = "<i>" . $langs->trans("Example") . ': ' . $langs->trans("VATIsNotUsedExampleFR") . "</i>\n"; |
||
| 853 | } |
||
| 854 | print '<label for="no_vat">' . $form->textwithpicto($langs->trans("VATIsNotUsedDesc"), $tooltiphelp) . "</label>"; |
||
| 855 | print "</td></tr>\n"; |
||
| 856 | |||
| 857 | print "</table>"; |
||
| 858 | |||
| 859 | // Second tax |
||
| 860 | print '<br>'; |
||
| 861 | print '<table class="noborder centpercent editmode">'; |
||
| 862 | print '<tr class="liste_titre">'; |
||
| 863 | print '<td class="titlefieldcreate">' . $form->textwithpicto($langs->transcountry("LocalTax1Management", $mysoc->country_code), $langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code)) . '</td><td></td>'; |
||
| 864 | print '<td class="right"> </td>'; |
||
| 865 | print "</tr>\n"; |
||
| 866 | |||
| 867 | if ($mysoc->useLocalTax(1)) { |
||
| 868 | // Note: When option is not set, it must not appears as set on on, because there is no default value for this option |
||
| 869 | print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax1" id="lt1" value="localtax1on"' . ((getDolGlobalString('FACTURE_LOCAL_TAX1_OPTION') == '1' || getDolGlobalString('FACTURE_LOCAL_TAX1_OPTION') == "localtax1on") ? " checked" : "") . '> <label for="lt1">' . $langs->transcountry("LocalTax1IsUsed", $mysoc->country_code) . "</label></td>"; |
||
| 870 | print '<td colspan="2">'; |
||
| 871 | print '<div class="nobordernopadding">'; |
||
| 872 | $tooltiphelp = $langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code); |
||
| 873 | $tooltiphelp = ($tooltiphelp != "LocalTax1IsUsedExample" ? "<i>" . $langs->trans("Example") . ': ' . $langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code) . "</i>\n" : ""); |
||
| 874 | print $form->textwithpicto($langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code), $tooltiphelp); |
||
| 875 | if (!isOnlyOneLocalTax(1)) { |
||
| 876 | print '<br><label for="lt1">' . $langs->trans("LTRate") . '</label>: '; |
||
| 877 | $formcompany->select_localtax(1, $conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1"); |
||
| 878 | } |
||
| 879 | |||
| 880 | $opcions = [$langs->trans("CalcLocaltax1") . ' ' . $langs->trans("CalcLocaltax1Desc"), $langs->trans("CalcLocaltax2") . ' - ' . $langs->trans("CalcLocaltax2Desc"), $langs->trans("CalcLocaltax3") . ' - ' . $langs->trans("CalcLocaltax3Desc")]; |
||
| 881 | |||
| 882 | print '<br><label for="clt1">' . $langs->trans("CalcLocaltax") . '</label>: '; |
||
| 883 | print $form->selectarray("clt1", $opcions, getDolGlobalString('MAIN_INFO_LOCALTAX_CALC1')); |
||
| 884 | print "</div>"; |
||
| 885 | print "</td></tr>\n"; |
||
| 886 | |||
| 887 | print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax1" id="nolt1" value="localtax1off"' . ((!getDolGlobalString('FACTURE_LOCAL_TAX1_OPTION') || getDolGlobalString('FACTURE_LOCAL_TAX1_OPTION') == "localtax1off") ? " checked" : "") . '> <label for="nolt1">' . $langs->transcountry("LocalTax1IsNotUsed", $mysoc->country_code) . "</label></td>"; |
||
| 888 | print '<td colspan="2">'; |
||
| 889 | $tooltiphelp = $langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code); |
||
| 890 | $tooltiphelp = ($tooltiphelp != "LocalTax1IsNotUsedExample" ? "<i>" . $langs->trans("Example") . ': ' . $langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code) . "</i>\n" : ""); |
||
| 891 | print $form->textwithpicto($langs->transcountry("LocalTax1IsNotUsedDesc", $mysoc->country_code), $tooltiphelp); |
||
| 892 | print "</td></tr>\n"; |
||
| 893 | } else { |
||
| 894 | if (empty($mysoc->country_code)) { |
||
| 895 | print '<tr class="oddeven nohover"><td class="">' . $countrynotdefined . '</td><td></td><td></td></tr>'; |
||
| 896 | } else { |
||
| 897 | print '<tr class="oddeven nohover"><td class="" colspan="3"><span class="opacitymedium">' . $langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax1Management")) . '</span></td></tr>'; |
||
| 898 | } |
||
| 899 | } |
||
| 900 | |||
| 901 | print "</table>"; |
||
| 902 | |||
| 903 | // Third tax system |
||
| 904 | print '<br>'; |
||
| 905 | print '<table class="noborder centpercent editmode">'; |
||
| 906 | print '<tr class="liste_titre">'; |
||
| 907 | print '<td class="titlefieldcreate">' . $form->textwithpicto($langs->transcountry("LocalTax2Management", $mysoc->country_code), $langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)) . '</td><td></td>'; |
||
| 908 | print '<td class="right"> </td>'; |
||
| 909 | print "</tr>\n"; |
||
| 910 | |||
| 911 | if ($mysoc->useLocalTax(2)) { |
||
| 912 | // Note: When option is not set, it must not appears as set on on, because there is no default value for this option |
||
| 913 | print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax2" id="lt2" value="localtax2on"' . ((getDolGlobalString('FACTURE_LOCAL_TAX2_OPTION') == '1' || getDolGlobalString('FACTURE_LOCAL_TAX2_OPTION') == "localtax2on") ? " checked" : "") . '> <label for="lt2">' . $langs->transcountry("LocalTax2IsUsed", $mysoc->country_code) . "</label></td>"; |
||
| 914 | print '<td colspan="2">'; |
||
| 915 | print '<div class="nobordernopadding">'; |
||
| 916 | print '<label for="lt2">' . $langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code) . "</label>"; |
||
| 917 | $tooltiphelp = $langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code); |
||
| 918 | $tooltiphelp = ($tooltiphelp != "LocalTax2IsUsedExample" ? "<i>" . $langs->trans("Example") . ': ' . $langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code) . "</i>\n" : ""); |
||
| 919 | if (!isOnlyOneLocalTax(2)) { |
||
| 920 | print '<br><label for="lt2">' . $langs->trans("LTRate") . '</label>: '; |
||
| 921 | $formcompany->select_localtax(2, $conf->global->MAIN_INFO_VALUE_LOCALTAX2 ?? '', "lt2"); |
||
| 922 | } |
||
| 923 | print '<br><label for="clt2">' . $langs->trans("CalcLocaltax") . '</label>: '; |
||
| 924 | print $form->selectarray("clt2", $opcions, getDolGlobalString('MAIN_INFO_LOCALTAX_CALC2')); |
||
| 925 | print "</div>"; |
||
| 926 | print "</td></tr>\n"; |
||
| 927 | |||
| 928 | print '<tr class="oddeven"><td><input type="radio" name="optionlocaltax2" id="nolt2" value="localtax2off"' . ((!getDolGlobalString('FACTURE_LOCAL_TAX2_OPTION') || getDolGlobalString('FACTURE_LOCAL_TAX2_OPTION') == "localtax2off") ? " checked" : "") . '> <label for="nolt2">' . $langs->transcountry("LocalTax2IsNotUsed", $mysoc->country_code) . "</label></td>"; |
||
| 929 | print '<td colspan="2">'; |
||
| 930 | print "<div>"; |
||
| 931 | $tooltiphelp = $langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code); |
||
| 932 | $tooltiphelp = ($tooltiphelp != "LocalTax2IsNotUsedExample" ? "<i>" . $langs->trans("Example") . ': ' . $langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code) . "</i>\n" : ""); |
||
| 933 | print "<label for=\"nolt2\">" . $form->textwithpicto($langs->transcountry("LocalTax2IsNotUsedDesc", $mysoc->country_code), $tooltiphelp) . "</label>"; |
||
| 934 | print "</div>"; |
||
| 935 | print "</td></tr>\n"; |
||
| 936 | } else { |
||
| 937 | if (empty($mysoc->country_code)) { |
||
| 938 | print '<tr class="oddeven nohover"><td class="">' . $countrynotdefined . '</td><td></td><td></td></tr>'; |
||
| 939 | } else { |
||
| 940 | print '<tr class="oddeven nohover"><td class="" colspan="3"><span class="opacitymedium">' . $langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax2Management")) . '</span></td></tr>'; |
||
| 941 | } |
||
| 942 | } |
||
| 943 | |||
| 944 | print "</table>"; |
||
| 945 | |||
| 946 | |||
| 947 | // Tax stamp |
||
| 948 | print '<br>'; |
||
| 949 | print '<table class="noborder centpercent editmode">'; |
||
| 950 | print '<tr class="liste_titre">'; |
||
| 951 | print '<td>' . $form->textwithpicto($langs->trans("RevenueStamp"), $langs->trans("RevenueStampDesc")) . '</td><td></td>'; |
||
| 952 | print '<td class="right"> </td>'; |
||
| 953 | print "</tr>\n"; |
||
| 954 | if ($mysoc->useRevenueStamp()) { |
||
| 955 | // Note: When option is not set, it must not appears as set on on, because there is no default value for this option |
||
| 956 | print '<tr class="oddeven"><td>'; |
||
| 957 | print $langs->trans("UseRevenueStamp"); |
||
| 958 | print "</td>"; |
||
| 959 | print '<td colspan="2">'; |
||
| 960 | print $langs->trans("UseRevenueStampExample", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryRevenueStamp")); |
||
| 961 | print "</td></tr>\n"; |
||
| 962 | } else { |
||
| 963 | if (empty($mysoc->country_code)) { |
||
| 964 | print '<tr class="oddeven nohover"><td class="">' . $countrynotdefined . '</td><td></td><td></td></tr>'; |
||
| 965 | } else { |
||
| 966 | print '<tr class="oddeven nohover"><td class="" colspan="3"><span class="opacitymedium">' . $langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryRevenueStamp"), $langs->transnoentitiesnoconv("RevenueStamp")) . '</span></td></tr>'; |
||
| 967 | } |
||
| 968 | } |
||
| 969 | |||
| 970 | print "</table>"; |
||
| 971 | |||
| 972 | // AADE webservices credentials, applicable only for Greece |
||
| 973 | if ($mysoc->country_code == 'GR') { |
||
| 974 | print load_fiche_titre($langs->trans("AADEWebserviceCredentials"), '', ''); |
||
| 975 | print '<table class="noborder centpercent editmode">'; |
||
| 976 | print '<tr class="liste_titre">'; |
||
| 977 | print '<td>' . $langs->trans("AccountParameter") . '</td>'; |
||
| 978 | print '<td>' . $langs->trans("Value") . '</td>'; |
||
| 979 | print '<td></td>'; |
||
| 980 | print "</tr>\n"; |
||
| 981 | |||
| 982 | print '<tr class="oddeven"><td>'; |
||
| 983 | print '<span class="titlefield fieldrequired">' . $langs->trans("MYDATA_AADE_USER") . '</span></td><td>'; |
||
| 984 | print '<input class="minwidth300" type="text" name="MYDATA_AADE_USER" value="' . getDolGlobalString('MYDATA_AADE_USER') . '"'; |
||
| 985 | print '</td><td></td></tr>'; |
||
| 986 | |||
| 987 | print '<tr class="oddeven"><td>'; |
||
| 988 | print '<span class="titlefield fieldrequired">' . $langs->trans("MYDATA_AADE_KEY") . '</span></td><td>'; |
||
| 989 | print '<input class="minwidth300" type="text" name="MYDATA_AADE_KEY" value="' . getDolGlobalString('MYDATA_AADE_KEY') . '"'; |
||
| 990 | print '</td><td></td></tr>'; |
||
| 991 | |||
| 992 | print '<tr class="oddeven"><td>'; |
||
| 993 | print '<span class="titlefield fieldrequired">' . $langs->trans("AADE_WEBSERVICE_USER") . '</span></td><td>'; |
||
| 994 | print '<input class="minwidth300" type="text" name="AADE_WEBSERVICE_USER" value="' . getDolGlobalString('AADE_WEBSERVICE_USER') . '"'; |
||
| 995 | print '</td><td></td></tr>'; |
||
| 996 | |||
| 997 | print '<tr class="oddeven"><td>'; |
||
| 998 | print '<span class="titlefield fieldrequired">' . $langs->trans("AADE_WEBSERVICE_KEY") . '</span></td><td>'; |
||
| 999 | print '<input class="minwidth300" type="text" name="AADE_WEBSERVICE_KEY" value="' . getDolGlobalString('AADE_WEBSERVICE_KEY') . '"'; |
||
| 1000 | print '</td><td></td></tr>'; |
||
| 1001 | |||
| 1002 | print '<br>'; |
||
| 1003 | |||
| 1004 | print "</table>"; |
||
| 1005 | } |
||
| 1006 | |||
| 1007 | print $form->buttonsSaveCancel("Save", '', [], false, 'reposition'); |
||
| 1008 | |||
| 1009 | print '</form>'; |
||
| 1010 | |||
| 1011 | |||
| 1012 | // End of page |
||
| 1013 | llxFooter(); |
||
| 1014 | $db->close(); |
||
| 1015 | |||
| 1016 | |||
| 1017 | /* |
||
| 1018 | * View |
||
| 1019 | */ |
||
| 1020 | require_once realpath(BASE_PATH . '/../Dolibarr/Modules/Admin/Views/admin_menu.php'); |
||
| 1021 | |||
| 1022 | $db->close(); |
||
| 1023 | |||
| 1024 | return true; |
||
| 1025 | } |
||
| 1027 |