@@ -167,17 +167,17 @@ discard block |
||
167 | 167 | 'label' => array('type' => 'varchar(128)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 0, 'visible' => -1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1, 'comment' => "contains hash of file content"), |
168 | 168 | 'share' => array('type' => 'varchar(128)', 'label' => 'Share', 'enabled' => 1, 'position' => 40, 'notnull' => 0, 'visible' => -1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1, 'comment' => "contains hash for file sharing"), |
169 | 169 | 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 50, 'index' => 1), |
170 | - 'filepath' => array('type' => 'varchar(255)', 'label' => 'FilePath', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 0, 'searchall' => 0, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1,'comment' => "relative to dolibarr document dir. Example module/def"), |
|
171 | - 'filename' => array('type' => 'varchar(255)', 'label' => 'FileName', 'enabled' => 1, 'position' => 70, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1,'comment' => "file name only without any directory"), |
|
172 | - 'src_object_type' => array('type' => 'varchar(64)', 'label' => 'SourceType', 'enabled' => 1, 'position' => 80, 'notnull' => 0, 'visible' => 0, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1,'comment' => "Source object type ('proposal', 'invoice', ...)"), |
|
170 | + 'filepath' => array('type' => 'varchar(255)', 'label' => 'FilePath', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 0, 'searchall' => 0, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1, 'comment' => "relative to dolibarr document dir. Example module/def"), |
|
171 | + 'filename' => array('type' => 'varchar(255)', 'label' => 'FileName', 'enabled' => 1, 'position' => 70, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1, 'comment' => "file name only without any directory"), |
|
172 | + 'src_object_type' => array('type' => 'varchar(64)', 'label' => 'SourceType', 'enabled' => 1, 'position' => 80, 'notnull' => 0, 'visible' => 0, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1, 'comment' => "Source object type ('proposal', 'invoice', ...)"), |
|
173 | 173 | 'src_object_id' => array('type' => 'integer', 'label' => 'SourceID', 'default' => '1', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 90, 'index' => 1, 'comment' => "Source object id"), |
174 | - 'fullpath_orig' => array('type' => 'varchar(750)', 'label' => 'FullPathOrig', 'enabled' => 1, 'position' => 100, 'notnull' => 0, 'visible' => 0, 'searchall' => 0, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1,'comment' => "full path of original filename, when file is uploaded from a local computer"), |
|
174 | + 'fullpath_orig' => array('type' => 'varchar(750)', 'label' => 'FullPathOrig', 'enabled' => 1, 'position' => 100, 'notnull' => 0, 'visible' => 0, 'searchall' => 0, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1, 'comment' => "full path of original filename, when file is uploaded from a local computer"), |
|
175 | 175 | 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'visible' => 0, 'position' => 110), |
176 | - 'keywords' => array('type' => 'varchar(750)', 'label' => 'Keywords', 'enabled' => 1, 'position' => 120, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1,'comment' => "list of keywords, separated with comma. Must be limited to most important keywords."), |
|
177 | - 'content' => array('type' => 'html', 'label' => 'Content', 'enabled' => 'getDolGlobalString("MAIN_SAVE_FILE_CONTENT_AS_TEXT")', 'position' => 120, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'csslist' => 'tdoverflowmax200', 'help' => "Text content of file", 'showoncombobox' => 2, 'validate' => 1,'comment' => "Text content if option to store txt content was set."), |
|
176 | + 'keywords' => array('type' => 'varchar(750)', 'label' => 'Keywords', 'enabled' => 1, 'position' => 120, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1, 'comment' => "list of keywords, separated with comma. Must be limited to most important keywords."), |
|
177 | + 'content' => array('type' => 'html', 'label' => 'Content', 'enabled' => 'getDolGlobalString("MAIN_SAVE_FILE_CONTENT_AS_TEXT")', 'position' => 120, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'csslist' => 'tdoverflowmax200', 'help' => "Text content of file", 'showoncombobox' => 2, 'validate' => 1, 'comment' => "Text content if option to store txt content was set."), |
|
178 | 178 | 'cover' => array('type' => 'text', 'label' => 'Cover', 'enabled' => 1, 'visible' => 0, 'position' => 130, 'comment' => "is this file a file to use for a cover"), |
179 | 179 | 'position' => array('type' => 'integer', 'label' => 'Position', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 140, 'index' => 1, 'comment' => "position of file among others"), |
180 | - 'gen_or_uploaded' => array('type' => 'varchar(12)', 'label' => 'GenOrUpload', 'enabled' => 1, 'position' => 150, 'notnull' => 0, 'visible' => -1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1,'comment' => "'generated' or 'uploaded'"), |
|
180 | + 'gen_or_uploaded' => array('type' => 'varchar(12)', 'label' => 'GenOrUpload', 'enabled' => 1, 'position' => 150, 'notnull' => 0, 'visible' => -1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1, 'comment' => "'generated' or 'uploaded'"), |
|
181 | 181 | 'extraparams' => array('type' => 'varchar(255)', 'label' => 'ExtraParams', 'enabled' => 1, 'position' => 160, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1, 'comment' => "for stocking other parameters with json format"), |
182 | 182 | 'date_c' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 170), |
183 | 183 | 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 175), |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { |
949 | 949 | return ['optimize' => $langs->trans("ShowFile")]; |
950 | 950 | } |
951 | - $datas['picto'] = img_picto('', $this->picto, '', 0, 0, 0, '', 'paddingrightonly') . '<u>' . $langs->trans("File") . '</u>'; |
|
951 | + $datas['picto'] = img_picto('', $this->picto, '', 0, 0, 0, '', 'paddingrightonly').'<u>'.$langs->trans("File").'</u>'; |
|
952 | 952 | if (!empty($this->filename)) { |
953 | 953 | $datas['name'] = '<br><b>'.$langs->trans('Name').':</b> '.basename($this->filename); |
954 | 954 | } |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | $result .= $linkstart.$this->filename.$linkend; |
1045 | 1045 | |
1046 | 1046 | global $action; |
1047 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
1047 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
1048 | 1048 | $parameters = array('id' => $this->id, 'getnomurl' => &$result); |
1049 | 1049 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
1050 | 1050 | if ($reshook > 0) { |
@@ -1080,8 +1080,8 @@ discard block |
||
1080 | 1080 | $sql .= ", '".$this->db->escape($this->ip)."'"; |
1081 | 1081 | if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { |
1082 | 1082 | $sql .= ", ".(empty($this->vat_reverse_charge) ? '0' : '1'); |
1083 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
1084 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
1083 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
1084 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
1085 | 1085 | } |
1086 | 1086 | $sql .= ")"; |
1087 | 1087 | |
@@ -1134,7 +1134,7 @@ discard block |
||
1134 | 1134 | } |
1135 | 1135 | |
1136 | 1136 | if ($ret >= 0) { |
1137 | - if (! $notrigger) { |
|
1137 | + if (!$notrigger) { |
|
1138 | 1138 | // Call trigger |
1139 | 1139 | $result = $this->call_trigger('COMPANY_CREATE', $user); |
1140 | 1140 | if ($result < 0) { |
@@ -1212,7 +1212,7 @@ discard block |
||
1212 | 1212 | $this->setUpperOrLowerCase(); |
1213 | 1213 | $contact->phone_pro = $this->phone; |
1214 | 1214 | if (getDolGlobalString('CONTACTS_DEFAULT_ROLES')) { |
1215 | - $contact->roles = explode(',', getDolGlobalString('CONTACTS_DEFAULT_ROLES')); |
|
1215 | + $contact->roles = explode(',', getDolGlobalString('CONTACTS_DEFAULT_ROLES')); |
|
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | $contactId = $contact->create($user, $notrigger); |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) { |
1386 | 1386 | $langs->loadLangs(array("errors", 'compta')); |
1387 | 1387 | $error++; |
1388 | - $this->errors[] = $langs->trans('CustomerAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')'; |
|
1388 | + $this->errors[] = $langs->trans('CustomerAccountancyCodeShort')." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')'; |
|
1389 | 1389 | } |
1390 | 1390 | } |
1391 | 1391 | |
@@ -1393,7 +1393,7 @@ discard block |
||
1393 | 1393 | if (getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_MANDATORY') && (!isset($vallabel) || trim($vallabel) === '')) { |
1394 | 1394 | $langs->loadLangs(array("errors", 'compta')); |
1395 | 1395 | $error++; |
1396 | - $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('CustomerAccountancyCodeShort')) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')'; |
|
1396 | + $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('CustomerAccountancyCodeShort')).' ('.$langs->trans("ForbiddenBySetupRules").')'; |
|
1397 | 1397 | } |
1398 | 1398 | } elseif ($key == 'ACCOUNTANCY_CODE_SUPPLIER' && !empty($this->fournisseur)) { |
1399 | 1399 | // Check for unicity |
@@ -1401,7 +1401,7 @@ discard block |
||
1401 | 1401 | if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) { |
1402 | 1402 | $langs->loadLangs(array("errors", 'compta')); |
1403 | 1403 | $error++; |
1404 | - $this->errors[] = $langs->trans('SupplierAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')'; |
|
1404 | + $this->errors[] = $langs->trans('SupplierAccountancyCodeShort')." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')'; |
|
1405 | 1405 | } |
1406 | 1406 | } |
1407 | 1407 | |
@@ -1409,7 +1409,7 @@ discard block |
||
1409 | 1409 | if (getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_SUPPLIER_MANDATORY') && (!isset($vallabel) || trim($vallabel) === '')) { |
1410 | 1410 | $langs->loadLangs(array("errors", 'compta')); |
1411 | 1411 | $error++; |
1412 | - $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('SupplierAccountancyCodeShort')) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')'; |
|
1412 | + $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('SupplierAccountancyCodeShort')).' ('.$langs->trans("ForbiddenBySetupRules").')'; |
|
1413 | 1413 | } |
1414 | 1414 | } |
1415 | 1415 | } |
@@ -1451,17 +1451,17 @@ discard block |
||
1451 | 1451 | $now = dol_now(); |
1452 | 1452 | |
1453 | 1453 | // Clean parameters |
1454 | - $this->id = $id; |
|
1455 | - $this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity); |
|
1454 | + $this->id = $id; |
|
1455 | + $this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity); |
|
1456 | 1456 | $this->name = $this->name ? trim($this->name) : trim((string) $this->nom); |
1457 | 1457 | $this->nom = $this->name; // For backward compatibility |
1458 | - $this->name_alias = trim((string) $this->name_alias); |
|
1458 | + $this->name_alias = trim((string) $this->name_alias); |
|
1459 | 1459 | $this->ref_ext = (empty($this->ref_ext) ? '' : trim($this->ref_ext)); |
1460 | 1460 | $this->address = trim((string) $this->address); |
1461 | 1461 | $this->zip = trim((string) $this->zip); |
1462 | 1462 | $this->town = trim((string) $this->town); |
1463 | - $this->state_id = (is_numeric($this->state_id)) ? (int) $this->state_id : 0; |
|
1464 | - $this->country_id = ($this->country_id > 0) ? $this->country_id : 0; |
|
1463 | + $this->state_id = (is_numeric($this->state_id)) ? (int) $this->state_id : 0; |
|
1464 | + $this->country_id = ($this->country_id > 0) ? $this->country_id : 0; |
|
1465 | 1465 | $this->phone = trim((string) $this->phone); |
1466 | 1466 | $this->phone = preg_replace("/\s/", "", $this->phone); |
1467 | 1467 | $this->phone = preg_replace("/\./", "", $this->phone); |
@@ -1471,7 +1471,7 @@ discard block |
||
1471 | 1471 | $this->fax = trim((string) $this->fax); |
1472 | 1472 | $this->fax = preg_replace("/\s/", "", $this->fax); |
1473 | 1473 | $this->fax = preg_replace("/\./", "", $this->fax); |
1474 | - $this->email = trim((string) $this->email); |
|
1474 | + $this->email = trim((string) $this->email); |
|
1475 | 1475 | $this->url = $this->url ? clean_url($this->url, 0) : ''; |
1476 | 1476 | $this->note_private = (empty($this->note_private) ? '' : trim($this->note_private)); |
1477 | 1477 | $this->note_public = (empty($this->note_public) ? '' : trim($this->note_public)); |
@@ -1481,14 +1481,14 @@ discard block |
||
1481 | 1481 | $this->idprof4 = trim((string) $this->idprof4); |
1482 | 1482 | $this->idprof5 = (!empty($this->idprof5) ? trim($this->idprof5) : ''); |
1483 | 1483 | $this->idprof6 = (!empty($this->idprof6) ? trim($this->idprof6) : ''); |
1484 | - $this->prefix_comm = trim((string) $this->prefix_comm); |
|
1484 | + $this->prefix_comm = trim((string) $this->prefix_comm); |
|
1485 | 1485 | $this->outstanding_limit = price2num($this->outstanding_limit); |
1486 | 1486 | $this->order_min_amount = price2num($this->order_min_amount); |
1487 | 1487 | $this->supplier_order_min_amount = price2num($this->supplier_order_min_amount); |
1488 | 1488 | |
1489 | 1489 | $this->tva_assuj = (is_numeric($this->tva_assuj)) ? (int) trim((string) $this->tva_assuj) : 0; |
1490 | 1490 | $this->tva_intra = dol_sanitizeFileName($this->tva_intra, ''); |
1491 | - $this->vat_reverse_charge = empty($this->vat_reverse_charge) ? 0 : 1; |
|
1491 | + $this->vat_reverse_charge = empty($this->vat_reverse_charge) ? 0 : 1; |
|
1492 | 1492 | if (empty($this->status)) { |
1493 | 1493 | $this->status = 0; |
1494 | 1494 | } |
@@ -1640,7 +1640,7 @@ discard block |
||
1640 | 1640 | $sql .= ",tva_assuj = ".($this->tva_assuj != '' ? "'".$this->db->escape($this->tva_assuj)."'" : "null"); |
1641 | 1641 | $sql .= ",tva_intra = '".$this->db->escape($this->tva_intra)."'"; |
1642 | 1642 | if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { |
1643 | - $sql .= ",vat_reverse_charge = " . ($this->vat_reverse_charge != '' ? "'" . $this->db->escape($this->vat_reverse_charge) . "'" : 0); |
|
1643 | + $sql .= ",vat_reverse_charge = ".($this->vat_reverse_charge != '' ? "'".$this->db->escape($this->vat_reverse_charge)."'" : 0); |
|
1644 | 1644 | } |
1645 | 1645 | $sql .= ",status = ".((int) $this->status); |
1646 | 1646 | |
@@ -1701,8 +1701,8 @@ discard block |
||
1701 | 1701 | $sql .= ",supplier_order_min_amount= ".($this->supplier_order_min_amount != '' ? $this->supplier_order_min_amount : 'null'); |
1702 | 1702 | $sql .= ",fk_prospectlevel='".$this->db->escape($this->fk_prospectlevel)."'"; |
1703 | 1703 | if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { |
1704 | - $sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
1705 | - $sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
1704 | + $sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
1705 | + $sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
1706 | 1706 | if ($customer) { |
1707 | 1707 | $sql .= ", accountancy_code_customer_general = ".(!empty($this->accountancy_code_customer_general) ? "'".$this->db->escape($this->accountancy_code_customer_general)."'" : "null"); |
1708 | 1708 | $sql .= ", code_compta = ".(!empty($this->code_compta_client) ? "'".$this->db->escape($this->code_compta_client)."'" : "null"); |
@@ -2100,7 +2100,7 @@ discard block |
||
2100 | 2100 | $this->vat_reverse_charge = 0; |
2101 | 2101 | } |
2102 | 2102 | |
2103 | - $this->status = $obj->status; |
|
2103 | + $this->status = $obj->status; |
|
2104 | 2104 | |
2105 | 2105 | // Local Taxes |
2106 | 2106 | $this->localtax1_assuj = $obj->localtax1_assuj; |
@@ -2127,7 +2127,7 @@ discard block |
||
2127 | 2127 | |
2128 | 2128 | $this->mode_reglement_id = $obj->mode_reglement; |
2129 | 2129 | $this->cond_reglement_id = $obj->cond_reglement; |
2130 | - $this->deposit_percent = $obj->deposit_percent; |
|
2130 | + $this->deposit_percent = $obj->deposit_percent; |
|
2131 | 2131 | $this->transport_mode_id = $obj->transport_mode; |
2132 | 2132 | $this->mode_reglement_supplier_id = $obj->mode_reglement_supplier; |
2133 | 2133 | $this->cond_reglement_supplier_id = $obj->cond_reglement_supplier; |
@@ -2697,10 +2697,10 @@ discard block |
||
2697 | 2697 | $reparray[$i]['firstname'] = $obj->firstname; |
2698 | 2698 | $reparray[$i]['email'] = $obj->email; |
2699 | 2699 | $reparray[$i]['phone'] = $obj->office_phone; |
2700 | - $reparray[$i]['office_phone'] = $obj->office_phone; // Pro phone |
|
2700 | + $reparray[$i]['office_phone'] = $obj->office_phone; // Pro phone |
|
2701 | 2701 | $reparray[$i]['office_fax'] = $obj->office_fax; |
2702 | - $reparray[$i]['user_mobile'] = $obj->user_mobile; // Pro mobile |
|
2703 | - $reparray[$i]['personal_mobile'] = $obj->personal_mobile; // Personal mobile |
|
2702 | + $reparray[$i]['user_mobile'] = $obj->user_mobile; // Pro mobile |
|
2703 | + $reparray[$i]['personal_mobile'] = $obj->personal_mobile; // Personal mobile |
|
2704 | 2704 | $reparray[$i]['job'] = $obj->job; |
2705 | 2705 | $reparray[$i]['statut'] = $obj->status; // deprecated |
2706 | 2706 | $reparray[$i]['status'] = $obj->status; |
@@ -2913,7 +2913,7 @@ discard block |
||
2913 | 2913 | $datas['status'] = ' '.$this->getLibStatut(5); |
2914 | 2914 | } |
2915 | 2915 | if (isset($this->client) && isset($this->fournisseur)) { |
2916 | - $datas['type'] = ' ' . $this->getTypeUrl(1); |
|
2916 | + $datas['type'] = ' '.$this->getTypeUrl(1); |
|
2917 | 2917 | } |
2918 | 2918 | $datas['name'] = '<br><b>'.$langs->trans('Name').':</b> '.dol_escape_htmltag(dol_string_nohtmltag($this->name)); |
2919 | 2919 | if (!empty($this->name_alias) && empty($noaliasinname)) { |
@@ -2981,9 +2981,9 @@ discard block |
||
2981 | 2981 | } |
2982 | 2982 | // show categories for this record only in ajax to not overload lists |
2983 | 2983 | if (!$nofetch && isModEnabled('category') && $this->client) { |
2984 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
2984 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
2985 | 2985 | $form = new Form($this->db); |
2986 | - $datas['categories_customer'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1, 1); |
|
2986 | + $datas['categories_customer'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1, 1); |
|
2987 | 2987 | } |
2988 | 2988 | if (!empty($this->code_fournisseur) && $this->fournisseur) { |
2989 | 2989 | $datas['suppliercode'] = '<br><b>'.$langs->trans('SupplierCode').':</b> '.$this->code_fournisseur; |
@@ -2994,9 +2994,9 @@ discard block |
||
2994 | 2994 | } |
2995 | 2995 | // show categories for this record only in ajax to not overload lists |
2996 | 2996 | if (!$nofetch && isModEnabled('category') && $this->fournisseur) { |
2997 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
2997 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
2998 | 2998 | $form = new Form($this->db); |
2999 | - $datas['categories_supplier'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_SUPPLIER, 1, 1); |
|
2999 | + $datas['categories_supplier'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_SUPPLIER, 1, 1); |
|
3000 | 3000 | } |
3001 | 3001 | |
3002 | 3002 | $datas['divclose'] = '</div>'; |
@@ -3536,7 +3536,7 @@ discard block |
||
3536 | 3536 | { |
3537 | 3537 | // phpcs:enable |
3538 | 3538 | require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; |
3539 | - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib WHERE type = 'ban' AND default_rib = 1 AND fk_soc = ". (int) $this->id; |
|
3539 | + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib WHERE type = 'ban' AND default_rib = 1 AND fk_soc = ".(int) $this->id; |
|
3540 | 3540 | $resql = $this->db->query($sql); |
3541 | 3541 | if (!$resql) { |
3542 | 3542 | $this->error = $this->db->lasterror(); |
@@ -3926,7 +3926,7 @@ discard block |
||
3926 | 3926 | global $langs; |
3927 | 3927 | |
3928 | 3928 | if ($company_id > 0) { |
3929 | - $sql = "SELECT parent FROM " . MAIN_DB_PREFIX . "societe WHERE rowid = ".((int) $company_id); |
|
3929 | + $sql = "SELECT parent FROM ".MAIN_DB_PREFIX."societe WHERE rowid = ".((int) $company_id); |
|
3930 | 3930 | $resql = $this->db->query($sql); |
3931 | 3931 | if ($resql) { |
3932 | 3932 | if ($obj = $this->db->fetch_object($resql)) { |
@@ -4542,7 +4542,7 @@ discard block |
||
4542 | 4542 | $country_code = $country_label = ''; |
4543 | 4543 | if (getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY')) { |
4544 | 4544 | $tmp = explode(':', getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY')); |
4545 | - $country_id = (is_numeric($tmp[0])) ? (int) $tmp[0] : 0; |
|
4545 | + $country_id = (is_numeric($tmp[0])) ? (int) $tmp[0] : 0; |
|
4546 | 4546 | if (!empty($tmp[1])) { // If $conf->global->MAIN_INFO_SOCIETE_COUNTRY is "id:code:label" |
4547 | 4547 | $country_code = $tmp[1]; |
4548 | 4548 | $country_label = $tmp[2]; |
@@ -5417,7 +5417,7 @@ discard block |
||
5417 | 5417 | if (method_exists($this, 'getLibStatut')) { |
5418 | 5418 | $return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>'; |
5419 | 5419 | } |
5420 | - $return .= '</div>'; // end info-box-content |
|
5420 | + $return .= '</div>'; // end info-box-content |
|
5421 | 5421 | $return .= '</div>'; |
5422 | 5422 | $return .= '</div>'; |
5423 | 5423 | |
@@ -5521,7 +5521,7 @@ discard block |
||
5521 | 5521 | global $conf, $langs, $hookmanager, $user, $action; |
5522 | 5522 | |
5523 | 5523 | $error = 0; |
5524 | - $soc_origin = new Societe($this->db); // The thirdparty that we will delete |
|
5524 | + $soc_origin = new Societe($this->db); // The thirdparty that we will delete |
|
5525 | 5525 | |
5526 | 5526 | dol_syslog("mergeCompany merge thirdparty id=".$soc_origin_id." (will be deleted) into the thirdparty id=".$this->id); |
5527 | 5527 |
@@ -88,21 +88,21 @@ discard block |
||
88 | 88 | { |
89 | 89 | // To provide debug information on line number processed |
90 | 90 | global $count; |
91 | - if (empty($count)) $count=1; |
|
91 | + if (empty($count)) $count = 1; |
|
92 | 92 | else $count++; |
93 | 93 | |
94 | - if (empty($this->savxml)) $this->savxml = $this->xml; // Sav content of line at first line merged, so we will reuse original for next steps |
|
94 | + if (empty($this->savxml)) $this->savxml = $this->xml; // Sav content of line at first line merged, so we will reuse original for next steps |
|
95 | 95 | $this->xml = $this->savxml; |
96 | - $tmpvars = $this->vars; // Store into $tmpvars so we won't modify this->vars when completing data with empty values |
|
96 | + $tmpvars = $this->vars; // Store into $tmpvars so we won't modify this->vars when completing data with empty values |
|
97 | 97 | |
98 | 98 | // Search all tags fou into condition to complete $tmpvars, so we will proceed all tests even if not defined |
99 | - $reg='@\[!--\sIF\s([{}a-zA-Z0-9\.\,_]+)\s--\]@smU'; |
|
99 | + $reg = '@\[!--\sIF\s([{}a-zA-Z0-9\.\,_]+)\s--\]@smU'; |
|
100 | 100 | $matches = array(); |
101 | 101 | preg_match_all($reg, $this->xml, $matches, PREG_SET_ORDER); |
102 | 102 | //var_dump($tmpvars);exit; |
103 | 103 | foreach ($matches as $match) { // For each match, if there is no entry into this->vars, we add it |
104 | - if (! empty($match[1]) && ! isset($tmpvars[$match[1]])) { |
|
105 | - $tmpvars[$match[1]] = ''; // Not defined, so we set it to '', we just need entry into this->vars for next loop |
|
104 | + if (!empty($match[1]) && !isset($tmpvars[$match[1]])) { |
|
105 | + $tmpvars[$match[1]] = ''; // Not defined, so we set it to '', we just need entry into this->vars for next loop |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | // Remove the IF tag |
115 | 115 | $this->xml = str_replace('[!-- IF '.$key.' --]', '', $this->xml); |
116 | 116 | // Remove everything between the ELSE tag (if it exists) and the ENDIF tag |
117 | - $reg = '@(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
|
117 | + $reg = '@(\[!--\sELSE\s'.preg_quote($key, '@').'\s--\](.*))?\[!--\sENDIF\s'.preg_quote($key, '@').'\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
|
118 | 118 | $this->xml = preg_replace($reg, '', $this->xml); |
119 | 119 | } |
120 | 120 | // Else the value is false, then two cases: no ELSE and we're done, or there is at least one place where there is an ELSE clause, then we replace it |
121 | 121 | else { |
122 | 122 | // Find all conditional blocks for this variable: from IF to ELSE and to ENDIF |
123 | - $reg = '@\[!--\sIF\s' . preg_quote($key, '@') . '\s--\](.*)(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
|
123 | + $reg = '@\[!--\sIF\s'.preg_quote($key, '@').'\s--\](.*)(\[!--\sELSE\s'.preg_quote($key, '@').'\s--\](.*))?\[!--\sENDIF\s'.preg_quote($key, '@').'\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
|
124 | 124 | preg_match_all($reg, $this->xml, $matches, PREG_SET_ORDER); |
125 | 125 | foreach ($matches as $match) { // For each match, if there is an ELSE clause, we replace the whole block by the value in the ELSE clause |
126 | 126 | if (!empty($match[3])) $this->xml = str_replace($match[0], $match[3], $this->xml); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $this->xmlParsed .= str_replace(array_keys($tmpvars), array_values($tmpvars), $this->xml); |
134 | 134 | if ($this->hasChildren()) { |
135 | 135 | foreach ($this->children as $child) { |
136 | - $this->xmlParsed = str_replace($child->xml, ($child->xmlParsed=="")?$child->merge():$child->xmlParsed, $this->xmlParsed); |
|
136 | + $this->xmlParsed = str_replace($child->xml, ($child->xmlParsed == "") ? $child->merge() : $child->xmlParsed, $this->xmlParsed); |
|
137 | 137 | $child->xmlParsed = ''; |
138 | 138 | } |
139 | 139 | } |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | $this->xmlParsed = $this->macroReplace($this->xmlParsed); |
144 | 144 | $this->file->open($this->odf->getTmpfile()); |
145 | 145 | foreach ($this->images as $imageKey => $imageValue) { |
146 | - if ($this->file->getFromName('Pictures/' . $imageValue) === false) { |
|
146 | + if ($this->file->getFromName('Pictures/'.$imageValue) === false) { |
|
147 | 147 | // Add the image inside the ODT document |
148 | - $this->file->addFile($imageKey, 'Pictures/' . $imageValue); |
|
148 | + $this->file->addFile($imageKey, 'Pictures/'.$imageValue); |
|
149 | 149 | // Add the image to the Manifest (which maintains a list of images, necessary to avoid "Corrupt ODT file. Repair?" when opening the file with LibreOffice) |
150 | 150 | $this->odf->addImageToManifest($imageValue); |
151 | 151 | } |
@@ -176,16 +176,16 @@ discard block |
||
176 | 176 | $dateinonemontharray = dol_get_next_month($hoy['mon'], $hoy['year']); |
177 | 177 | $nextMonth = $dateinonemontharray['month']; |
178 | 178 | |
179 | - $patterns=array( '/__CURRENTDAY__/u','/__CURENTWEEKDAY__/u', |
|
180 | - '/__CURRENTMONTH__/u','/__CURRENTMONTHLONG__/u', |
|
181 | - '/__NEXTMONTH__/u','/__NEXTMONTHLONG__/u', |
|
182 | - '/__CURRENTYEAR__/u','/__NEXTYEAR__/u' ); |
|
183 | - $values=array( $hoy['mday'], $langs->transnoentitiesnoconv($hoy['wday']), |
|
179 | + $patterns = array('/__CURRENTDAY__/u', '/__CURENTWEEKDAY__/u', |
|
180 | + '/__CURRENTMONTH__/u', '/__CURRENTMONTHLONG__/u', |
|
181 | + '/__NEXTMONTH__/u', '/__NEXTMONTHLONG__/u', |
|
182 | + '/__CURRENTYEAR__/u', '/__NEXTYEAR__/u'); |
|
183 | + $values = array($hoy['mday'], $langs->transnoentitiesnoconv($hoy['wday']), |
|
184 | 184 | $hoy['mon'], monthArray($langs)[$hoy['mon']], |
185 | 185 | $nextMonth, monthArray($langs)[$nextMonth], |
186 | - $hoy['year'], $hoy['year']+1 ); |
|
186 | + $hoy['year'], $hoy['year'] + 1); |
|
187 | 187 | |
188 | - $text=preg_replace($patterns, $values, $text); |
|
188 | + $text = preg_replace($patterns, $values, $text); |
|
189 | 189 | |
190 | 190 | return $text; |
191 | 191 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | public function setVars($key, $value, $encode = true, $charset = 'ISO-8859') |
225 | 225 | { |
226 | - $tag = $this->odf->getConfig('DELIMITER_LEFT') . $key . $this->odf->getConfig('DELIMITER_RIGHT'); |
|
226 | + $tag = $this->odf->getConfig('DELIMITER_LEFT').$key.$this->odf->getConfig('DELIMITER_RIGHT'); |
|
227 | 227 | |
228 | 228 | if (strpos($this->xml, $tag) === false) { |
229 | 229 | //throw new SegmentException("var $key not found in {$this->getName()}"); |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | if (array_key_exists($prop, $this->children)) { |
278 | 278 | return $this->children[$prop]; |
279 | 279 | } else { |
280 | - throw new SegmentException('child ' . $prop . ' does not exist'); |
|
280 | + throw new SegmentException('child '.$prop.' does not exist'); |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | /** |
@@ -88,10 +88,16 @@ discard block |
||
88 | 88 | { |
89 | 89 | // To provide debug information on line number processed |
90 | 90 | global $count; |
91 | - if (empty($count)) $count=1; |
|
92 | - else $count++; |
|
91 | + if (empty($count)) { |
|
92 | + $count=1; |
|
93 | + } else { |
|
94 | + $count++; |
|
95 | + } |
|
93 | 96 | |
94 | - if (empty($this->savxml)) $this->savxml = $this->xml; // Sav content of line at first line merged, so we will reuse original for next steps |
|
97 | + if (empty($this->savxml)) { |
|
98 | + $this->savxml = $this->xml; |
|
99 | + } |
|
100 | + // Sav content of line at first line merged, so we will reuse original for next steps |
|
95 | 101 | $this->xml = $this->savxml; |
96 | 102 | $tmpvars = $this->vars; // Store into $tmpvars so we won't modify this->vars when completing data with empty values |
97 | 103 | |
@@ -123,7 +129,9 @@ discard block |
||
123 | 129 | $reg = '@\[!--\sIF\s' . preg_quote($key, '@') . '\s--\](.*)(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
124 | 130 | preg_match_all($reg, $this->xml, $matches, PREG_SET_ORDER); |
125 | 131 | foreach ($matches as $match) { // For each match, if there is an ELSE clause, we replace the whole block by the value in the ELSE clause |
126 | - if (!empty($match[3])) $this->xml = str_replace($match[0], $match[3], $this->xml); |
|
132 | + if (!empty($match[3])) { |
|
133 | + $this->xml = str_replace($match[0], $match[3], $this->xml); |
|
134 | + } |
|
127 | 135 | } |
128 | 136 | // Cleanup the other conditional blocks (all the others where there were no ELSE clause, we can just remove them altogether) |
129 | 137 | $this->xml = preg_replace($reg, '', $this->xml); |
@@ -78,7 +78,10 @@ discard block |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | $md5uniqid = md5(uniqid()); |
81 | - if ($this->config['PATH_TO_TMP']) $this->tmpdir = preg_replace('|[\/]$|', '', $this->config['PATH_TO_TMP']); // Remove last \ or / |
|
81 | + if ($this->config['PATH_TO_TMP']) { |
|
82 | + $this->tmpdir = preg_replace('|[\/]$|', '', $this->config['PATH_TO_TMP']); |
|
83 | + } |
|
84 | + // Remove last \ or / |
|
82 | 85 | $this->tmpdir .= ($this->tmpdir?'/':'').$md5uniqid; |
83 | 86 | $this->tmpfile = $this->tmpdir.'/'.$md5uniqid.'.odt'; // We keep .odt extension to allow OpenOffice usage during debug. |
84 | 87 | |
@@ -94,7 +97,9 @@ discard block |
||
94 | 97 | |
95 | 98 | // Load zip proxy |
96 | 99 | $zipHandler = $this->config['ZIP_PROXY']; |
97 | - if (!defined('PCLZIP_TEMPORARY_DIR')) define('PCLZIP_TEMPORARY_DIR', $this->tmpdir); |
|
100 | + if (!defined('PCLZIP_TEMPORARY_DIR')) { |
|
101 | + define('PCLZIP_TEMPORARY_DIR', $this->tmpdir); |
|
102 | + } |
|
98 | 103 | include_once 'zip/'.$zipHandler.'.php'; |
99 | 104 | if (! class_exists($this->config['ZIP_PROXY'])) { |
100 | 105 | throw new OdfException($this->config['ZIP_PROXY'] . ' class not found - check your php settings'); |
@@ -236,8 +241,12 @@ discard block |
||
236 | 241 | */ |
237 | 242 | private function _replaceHtmlWithOdtTag($tags, &$customStyles, &$fontDeclarations, $encode = false, $charset = '') |
238 | 243 | { |
239 | - if ($customStyles == null) $customStyles = array(); |
|
240 | - if ($fontDeclarations == null) $fontDeclarations = array(); |
|
244 | + if ($customStyles == null) { |
|
245 | + $customStyles = array(); |
|
246 | + } |
|
247 | + if ($fontDeclarations == null) { |
|
248 | + $fontDeclarations = array(); |
|
249 | + } |
|
241 | 250 | |
242 | 251 | $odtResult = ''; |
243 | 252 | |
@@ -556,10 +565,15 @@ discard block |
||
556 | 565 | */ |
557 | 566 | private function _parse($type = 'content') |
558 | 567 | { |
559 | - if ($type == 'content') $xml = &$this->contentXml; |
|
560 | - elseif ($type == 'styles') $xml = &$this->stylesXml; |
|
561 | - elseif ($type == 'meta') $xml = &$this->metaXml; |
|
562 | - else return; |
|
568 | + if ($type == 'content') { |
|
569 | + $xml = &$this->contentXml; |
|
570 | + } elseif ($type == 'styles') { |
|
571 | + $xml = &$this->stylesXml; |
|
572 | + } elseif ($type == 'meta') { |
|
573 | + $xml = &$this->metaXml; |
|
574 | + } else { |
|
575 | + return; |
|
576 | + } |
|
563 | 577 | |
564 | 578 | // Search all tags found into condition to complete $this->vars, so we will proceed all tests even if not defined |
565 | 579 | $reg='@\[!--\sIF\s([\[\]{}a-zA-Z0-9\.\,_]+)\s--\]@smU'; |
@@ -600,7 +614,9 @@ discard block |
||
600 | 614 | $reg = '@\[!--\sIF\s' . preg_quote($key, '@') . '\s--\](.*)(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
601 | 615 | preg_match_all($reg, $xml, $matches, PREG_SET_ORDER); |
602 | 616 | foreach ($matches as $match) { // For each match, if there is an ELSE clause, we replace the whole block by the value in the ELSE clause |
603 | - if (!empty($match[3])) $xml = str_replace($match[0], $match[3], $xml); |
|
617 | + if (!empty($match[3])) { |
|
618 | + $xml = str_replace($match[0], $match[3], $xml); |
|
619 | + } |
|
604 | 620 | } |
605 | 621 | // Cleanup the other conditional blocks (all the others where there were no ELSE clause, we can just remove them altogether) |
606 | 622 | $xml = preg_replace($reg, '', $xml); |
@@ -754,7 +770,9 @@ discard block |
||
754 | 770 | */ |
755 | 771 | public function setMetaData() |
756 | 772 | { |
757 | - if (empty($this->creator)) $this->creator=''; |
|
773 | + if (empty($this->creator)) { |
|
774 | + $this->creator=''; |
|
775 | + } |
|
758 | 776 | |
759 | 777 | $this->metaXml = preg_replace('/<dc:date>.*<\/dc:date>/', '<dc:date>'.gmdate("Y-m-d\TH:i:s").'</dc:date>', $this->metaXml); |
760 | 778 | $this->metaXml = preg_replace('/<dc:creator>.*<\/dc:creator>/', '<dc:creator>'.htmlspecialchars($this->creator).'</dc:creator>', $this->metaXml); |
@@ -822,7 +840,9 @@ discard block |
||
822 | 840 | { |
823 | 841 | global $conf; |
824 | 842 | |
825 | - if ( $name == "" ) $name = "temp".md5(uniqid()); |
|
843 | + if ( $name == "" ) { |
|
844 | + $name = "temp".md5(uniqid()); |
|
845 | + } |
|
826 | 846 | |
827 | 847 | dol_syslog(get_class($this).'::exportAsAttachedPDF $name='.$name, LOG_DEBUG); |
828 | 848 | $this->saveToDisk($name); |
@@ -31,18 +31,18 @@ discard block |
||
31 | 31 | class Odf |
32 | 32 | { |
33 | 33 | protected $config = array( |
34 | - 'ZIP_PROXY' => 'PclZipProxy', // PclZipProxy, PhpZipProxy |
|
34 | + 'ZIP_PROXY' => 'PclZipProxy', // PclZipProxy, PhpZipProxy |
|
35 | 35 | 'DELIMITER_LEFT' => '{', |
36 | 36 | 'DELIMITER_RIGHT' => '}', |
37 | 37 | 'PATH_TO_TMP' => '/tmp' |
38 | 38 | ); |
39 | 39 | protected $file; |
40 | - protected $contentXml; // To store content of content.xml file |
|
41 | - protected $metaXml; // To store content of meta.xml file |
|
42 | - protected $stylesXml; // To store content of styles.xml file |
|
43 | - protected $manifestXml; // To store content of META-INF/manifest.xml file |
|
40 | + protected $contentXml; // To store content of content.xml file |
|
41 | + protected $metaXml; // To store content of meta.xml file |
|
42 | + protected $stylesXml; // To store content of styles.xml file |
|
43 | + protected $manifestXml; // To store content of META-INF/manifest.xml file |
|
44 | 44 | protected $tmpfile; |
45 | - protected $tmpdir=''; |
|
45 | + protected $tmpdir = ''; |
|
46 | 46 | protected $images = array(); |
47 | 47 | protected $vars = array(); |
48 | 48 | protected $segments = array(); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | public $creator; |
51 | 51 | public $title; |
52 | 52 | public $subject; |
53 | - public $userdefined=array(); |
|
53 | + public $userdefined = array(); |
|
54 | 54 | |
55 | 55 | const PIXEL_TO_CM = 0.026458333; |
56 | 56 | const FIND_TAGS_REGEX = '/<([A-Za-z0-9]+)(?:\s([A-Za-z]+(?:\-[A-Za-z]+)?(?:=(?:".*?")|(?:[0-9]+))))*(?:(?:\s\/>)|(?:>(.*)<\/\1>))/s'; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | { |
69 | 69 | clearstatcache(); |
70 | 70 | |
71 | - if (! is_array($config)) { |
|
71 | + if (!is_array($config)) { |
|
72 | 72 | throw new OdfException('Configuration data must be provided as array'); |
73 | 73 | } |
74 | 74 | foreach ($config as $configKey => $configValue) { |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | $md5uniqid = md5(uniqid()); |
81 | - if ($this->config['PATH_TO_TMP']) $this->tmpdir = preg_replace('|[\/]$|', '', $this->config['PATH_TO_TMP']); // Remove last \ or / |
|
82 | - $this->tmpdir .= ($this->tmpdir?'/':'').$md5uniqid; |
|
83 | - $this->tmpfile = $this->tmpdir.'/'.$md5uniqid.'.odt'; // We keep .odt extension to allow OpenOffice usage during debug. |
|
81 | + if ($this->config['PATH_TO_TMP']) $this->tmpdir = preg_replace('|[\/]$|', '', $this->config['PATH_TO_TMP']); // Remove last \ or / |
|
82 | + $this->tmpdir .= ($this->tmpdir ? '/' : '').$md5uniqid; |
|
83 | + $this->tmpfile = $this->tmpdir.'/'.$md5uniqid.'.odt'; // We keep .odt extension to allow OpenOffice usage during debug. |
|
84 | 84 | |
85 | 85 | // A working directory is required for some zip proxy like PclZipProxy |
86 | - if (in_array($this->config['ZIP_PROXY'], array('PclZipProxy')) && ! is_dir($this->config['PATH_TO_TMP'])) { |
|
86 | + if (in_array($this->config['ZIP_PROXY'], array('PclZipProxy')) && !is_dir($this->config['PATH_TO_TMP'])) { |
|
87 | 87 | throw new OdfException('Temporary directory '.$this->config['PATH_TO_TMP'].' must exists'); |
88 | 88 | } |
89 | 89 | |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | $zipHandler = $this->config['ZIP_PROXY']; |
97 | 97 | if (!defined('PCLZIP_TEMPORARY_DIR')) define('PCLZIP_TEMPORARY_DIR', $this->tmpdir); |
98 | 98 | include_once 'zip/'.$zipHandler.'.php'; |
99 | - if (! class_exists($this->config['ZIP_PROXY'])) { |
|
100 | - throw new OdfException($this->config['ZIP_PROXY'] . ' class not found - check your php settings'); |
|
99 | + if (!class_exists($this->config['ZIP_PROXY'])) { |
|
100 | + throw new OdfException($this->config['ZIP_PROXY'].' class not found - check your php settings'); |
|
101 | 101 | } |
102 | 102 | $this->file = new $zipHandler($this->tmpdir); |
103 | 103 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function setVars($key, $value, $encode = true, $charset = 'ISO-8859') |
146 | 146 | { |
147 | - $tag = $this->config['DELIMITER_LEFT'] . $key . $this->config['DELIMITER_RIGHT']; |
|
147 | + $tag = $this->config['DELIMITER_LEFT'].$key.$this->config['DELIMITER_RIGHT']; |
|
148 | 148 | |
149 | 149 | // TODO Warning string may be: |
150 | 150 | // <text:span text:style-name="T13">{</text:span><text:span text:style-name="T12">aaa</text:span><text:span text:style-name="T13">}</text:span> |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | |
180 | 180 | // Check if the value includes html tags |
181 | 181 | if ($this->_hasHtmlTag($value) === true) { |
182 | - $value = strip_tags($value, '<br><strong><b><i><em><u><s><sub><sup><span>'); // remove html tags except the one into the list in second parameter |
|
182 | + $value = strip_tags($value, '<br><strong><b><i><em><u><s><sub><sup><span>'); // remove html tags except the one into the list in second parameter |
|
183 | 183 | |
184 | 184 | // Default styles for strong/b, i/em, u, s, sub & sup |
185 | 185 | $automaticStyles = array( |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $convertedValue = $this->_replaceHtmlWithOdtTag($this->_getDataFromHtml($value), $customStyles, $fontDeclarations, $encode, $charset); |
198 | 198 | |
199 | 199 | foreach ($customStyles as $key => $val) { |
200 | - array_push($automaticStyles, '<style:style style:name="customStyle' . $key . '" style:family="text">' . $val . '</style:style>'); |
|
200 | + array_push($automaticStyles, '<style:style style:name="customStyle'.$key.'" style:family="text">'.$val.'</style:style>'); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | // Join the styles and add them to the content xml |
@@ -207,16 +207,16 @@ discard block |
||
207 | 207 | $styles .= $style; |
208 | 208 | } |
209 | 209 | } |
210 | - $this->contentXml = str_replace('</office:automatic-styles>', $styles . '</office:automatic-styles>', $this->contentXml); |
|
210 | + $this->contentXml = str_replace('</office:automatic-styles>', $styles.'</office:automatic-styles>', $this->contentXml); |
|
211 | 211 | |
212 | 212 | // Join the font declarations and add them to the content xml |
213 | 213 | $fonts = ''; |
214 | 214 | foreach ($fontDeclarations as $font) { |
215 | - if (strpos($this->contentXml, 'style:name="' . $font . '"') === false) { |
|
216 | - $fonts .= '<style:font-face style:name="' . $font . '" svg:font-family="\'' . $font . '\'" />'; |
|
215 | + if (strpos($this->contentXml, 'style:name="'.$font.'"') === false) { |
|
216 | + $fonts .= '<style:font-face style:name="'.$font.'" svg:font-family="\''.$font.'\'" />'; |
|
217 | 217 | } |
218 | 218 | } |
219 | - $this->contentXml = str_replace('</office:font-face-decls>', $fonts . '</office:font-face-decls>', $this->contentXml); |
|
219 | + $this->contentXml = str_replace('</office:font-face-decls>', $fonts.'</office:font-face-decls>', $this->contentXml); |
|
220 | 220 | } else { |
221 | 221 | $convertedValue = $this->encode_chars($convertedValue, $encode, $charset); |
222 | 222 | $convertedValue = preg_replace('/(\r\n|\r|\n)/i', "<text:line-break/>", $convertedValue); |
@@ -253,23 +253,23 @@ discard block |
||
253 | 253 | break; |
254 | 254 | case 'strong': |
255 | 255 | case 'b': |
256 | - $odtResult .= '<text:span text:style-name="boldText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>'; |
|
256 | + $odtResult .= '<text:span text:style-name="boldText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>'; |
|
257 | 257 | break; |
258 | 258 | case 'i': |
259 | 259 | case 'em': |
260 | - $odtResult .= '<text:span text:style-name="italicText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>'; |
|
260 | + $odtResult .= '<text:span text:style-name="italicText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>'; |
|
261 | 261 | break; |
262 | 262 | case 'u': |
263 | - $odtResult .= '<text:span text:style-name="underlineText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>'; |
|
263 | + $odtResult .= '<text:span text:style-name="underlineText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>'; |
|
264 | 264 | break; |
265 | 265 | case 's': |
266 | - $odtResult .= '<text:span text:style-name="strikethroughText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>'; |
|
266 | + $odtResult .= '<text:span text:style-name="strikethroughText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>'; |
|
267 | 267 | break; |
268 | 268 | case 'sub': |
269 | - $odtResult .= '<text:span text:style-name="subText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>'; |
|
269 | + $odtResult .= '<text:span text:style-name="subText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>'; |
|
270 | 270 | break; |
271 | 271 | case 'sup': |
272 | - $odtResult .= '<text:span text:style-name="supText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>'; |
|
272 | + $odtResult .= '<text:span text:style-name="supText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>'; |
|
273 | 273 | break; |
274 | 274 | case 'span': |
275 | 275 | if (isset($tag['attributes']['style'])) { |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | if (!in_array($fontName, $fontDeclarations)) { |
285 | 285 | array_push($fontDeclarations, $fontName); |
286 | 286 | } |
287 | - $odtStyles .= '<style:text-properties style:font-name="' . $fontName . '" />'; |
|
287 | + $odtStyles .= '<style:text-properties style:font-name="'.$fontName.'" />'; |
|
288 | 288 | break; |
289 | 289 | case 'font-size': |
290 | 290 | if (preg_match('/([0-9]+)\s?(px|pt)/', $styleValue, $matches)) { |
@@ -292,21 +292,21 @@ discard block |
||
292 | 292 | if ($matches[2] == 'px') { |
293 | 293 | $fontSize = round($fontSize * 0.75); |
294 | 294 | } |
295 | - $odtStyles .= '<style:text-properties fo:font-size="' . $fontSize . 'pt" style:font-size-asian="' . $fontSize . 'pt" style:font-size-complex="' . $fontSize . 'pt" />'; |
|
295 | + $odtStyles .= '<style:text-properties fo:font-size="'.$fontSize.'pt" style:font-size-asian="'.$fontSize.'pt" style:font-size-complex="'.$fontSize.'pt" />'; |
|
296 | 296 | } |
297 | 297 | break; |
298 | 298 | case 'color': |
299 | 299 | if (preg_match('/#[0-9A-Fa-f]{3}(?:[0-9A-Fa-f]{3})?/', $styleValue)) { |
300 | - $odtStyles .= '<style:text-properties fo:color="' . $styleValue . '" />'; |
|
300 | + $odtStyles .= '<style:text-properties fo:color="'.$styleValue.'" />'; |
|
301 | 301 | } |
302 | 302 | break; |
303 | 303 | } |
304 | 304 | } |
305 | 305 | if (strlen($odtStyles) > 0) { |
306 | 306 | // Generate a unique id for the style (using microtime and random because some CPUs are really fast...) |
307 | - $key = str_replace('.', '', (string) microtime(true)) . uniqid(mt_rand()); |
|
307 | + $key = str_replace('.', '', (string) microtime(true)).uniqid(mt_rand()); |
|
308 | 308 | $customStyles[$key] = $odtStyles; |
309 | - $odtResult .= '<text:span text:style-name="customStyle' . $key . '">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>'; |
|
309 | + $odtResult .= '<text:span text:style-name="customStyle'.$key.'">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>'; |
|
310 | 310 | } |
311 | 311 | } |
312 | 312 | break; |
@@ -443,24 +443,24 @@ discard block |
||
443 | 443 | public function htmlToUTFAndPreOdf($value) |
444 | 444 | { |
445 | 445 | // We decode into utf8, entities |
446 | - $value=dol_html_entity_decode($value, ENT_QUOTES|ENT_HTML5); |
|
446 | + $value = dol_html_entity_decode($value, ENT_QUOTES | ENT_HTML5); |
|
447 | 447 | |
448 | 448 | // We convert html tags |
449 | - $ishtml=dol_textishtml($value); |
|
449 | + $ishtml = dol_textishtml($value); |
|
450 | 450 | if ($ishtml) { |
451 | 451 | // If string is "MYPODUCT - Desc <strong>bold</strong> with é accent<br />\n<br />\nUn texto en español ?" |
452 | 452 | // Result after clean must be "MYPODUCT - Desc bold with é accent\n\nUn texto en español ?" |
453 | 453 | |
454 | 454 | // We want to ignore \n and we want all <br> to be \n |
455 | - $value=preg_replace('/(\r\n|\r|\n)/i', '', $value); |
|
456 | - $value=preg_replace('/<br>/i', "\n", $value); |
|
457 | - $value=preg_replace('/<br\s+[^<>\/]*>/i', "\n", $value); |
|
458 | - $value=preg_replace('/<br\s+[^<>\/]*\/>/i', "\n", $value); |
|
455 | + $value = preg_replace('/(\r\n|\r|\n)/i', '', $value); |
|
456 | + $value = preg_replace('/<br>/i', "\n", $value); |
|
457 | + $value = preg_replace('/<br\s+[^<>\/]*>/i', "\n", $value); |
|
458 | + $value = preg_replace('/<br\s+[^<>\/]*\/>/i', "\n", $value); |
|
459 | 459 | |
460 | 460 | //$value=preg_replace('/<strong>/','__lt__text:p text:style-name=__quot__bold__quot____gt__',$value); |
461 | 461 | //$value=preg_replace('/<\/strong>/','__lt__/text:p__gt__',$value); |
462 | 462 | |
463 | - $value=dol_string_nohtmltag($value, 0); |
|
463 | + $value = dol_string_nohtmltag($value, 0); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | return $value; |
@@ -536,10 +536,10 @@ discard block |
||
536 | 536 | $balise = str_replace('row.', '', $matches2[1]); |
537 | 537 | // Move segment tags around the row |
538 | 538 | $replace = array( |
539 | - '[!-- BEGIN ' . $matches2[1] . ' --]' => '', |
|
540 | - '[!-- END ' . $matches2[1] . ' --]' => '', |
|
541 | - '<table:table-row' => '[!-- BEGIN ' . $balise . ' --]<table:table-row', |
|
542 | - '</table:table-row>' => '</table:table-row>[!-- END ' . $balise . ' --]' |
|
539 | + '[!-- BEGIN '.$matches2[1].' --]' => '', |
|
540 | + '[!-- END '.$matches2[1].' --]' => '', |
|
541 | + '<table:table-row' => '[!-- BEGIN '.$balise.' --]<table:table-row', |
|
542 | + '</table:table-row>' => '</table:table-row>[!-- END '.$balise.' --]' |
|
543 | 543 | ); |
544 | 544 | $replacedXML = str_replace(array_keys($replace), array_values($replace), $matches[0][$i]); |
545 | 545 | $this->contentXml = str_replace($matches[0][$i], $replacedXML, $this->contentXml); |
@@ -562,14 +562,14 @@ discard block |
||
562 | 562 | else return; |
563 | 563 | |
564 | 564 | // Search all tags found into condition to complete $this->vars, so we will proceed all tests even if not defined |
565 | - $reg='@\[!--\sIF\s([\[\]{}a-zA-Z0-9\.\,_]+)\s--\]@smU'; |
|
565 | + $reg = '@\[!--\sIF\s([\[\]{}a-zA-Z0-9\.\,_]+)\s--\]@smU'; |
|
566 | 566 | $matches = array(); |
567 | 567 | preg_match_all($reg, $xml, $matches, PREG_SET_ORDER); |
568 | 568 | |
569 | 569 | //var_dump($this->vars);exit; |
570 | 570 | foreach ($matches as $match) { // For each match, if there is no entry into this->vars, we add it |
571 | - if (! empty($match[1]) && ! isset($this->vars[$match[1]])) { |
|
572 | - $this->vars[$match[1]] = ''; // Not defined, so we set it to '', we just need entry into this->vars for next loop |
|
571 | + if (!empty($match[1]) && !isset($this->vars[$match[1]])) { |
|
572 | + $this->vars[$match[1]] = ''; // Not defined, so we set it to '', we just need entry into this->vars for next loop |
|
573 | 573 | } |
574 | 574 | } |
575 | 575 | //var_dump($this->vars);exit; |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | // Remove the IF tag |
585 | 585 | $xml = str_replace('[!-- IF '.$key.' --]', '', $xml); |
586 | 586 | // Remove everything between the ELSE tag (if it exists) and the ENDIF tag |
587 | - $reg = '@(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
|
587 | + $reg = '@(\[!--\sELSE\s'.preg_quote($key, '@').'\s--\](.*))?\[!--\sENDIF\s'.preg_quote($key, '@').'\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
|
588 | 588 | $xml = preg_replace($reg, '', $xml); |
589 | 589 | /*if ($sav != $xml) |
590 | 590 | { |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | //dol_syslog("Var ".$key." is not defined, we remove the IF, ELSE and ENDIF "); |
598 | 598 | //$sav=$xml; |
599 | 599 | // Find all conditional blocks for this variable: from IF to ELSE and to ENDIF |
600 | - $reg = '@\[!--\sIF\s' . preg_quote($key, '@') . '\s--\](.*)(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
|
600 | + $reg = '@\[!--\sIF\s'.preg_quote($key, '@').'\s--\](.*)(\[!--\sELSE\s'.preg_quote($key, '@').'\s--\](.*))?\[!--\sENDIF\s'.preg_quote($key, '@').'\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
|
601 | 601 | preg_match_all($reg, $xml, $matches, PREG_SET_ORDER); |
602 | 602 | foreach ($matches as $match) { // For each match, if there is an ELSE clause, we replace the whole block by the value in the ELSE clause |
603 | 603 | if (!empty($match[3])) $xml = str_replace($match[0], $match[3], $xml); |
@@ -625,12 +625,12 @@ discard block |
||
625 | 625 | */ |
626 | 626 | public function mergeSegment(Segment $segment) |
627 | 627 | { |
628 | - if (! array_key_exists($segment->getName(), $this->segments)) { |
|
629 | - throw new OdfException($segment->getName() . 'cannot be parsed, has it been set yet ?'); |
|
628 | + if (!array_key_exists($segment->getName(), $this->segments)) { |
|
629 | + throw new OdfException($segment->getName().'cannot be parsed, has it been set yet ?'); |
|
630 | 630 | } |
631 | 631 | $string = $segment->getName(); |
632 | 632 | // $reg = '@<text:p[^>]*>\[!--\sBEGIN\s' . $string . '\s--\](.*)\[!--.+END\s' . $string . '\s--\]<\/text:p>@smU'; |
633 | - $reg = '@\[!--\sBEGIN\s' . $string . '\s--\](.*)\[!--.+END\s' . $string . '\s--\]@smU'; |
|
633 | + $reg = '@\[!--\sBEGIN\s'.$string.'\s--\](.*)\[!--.+END\s'.$string.'\s--\]@smU'; |
|
634 | 634 | $this->contentXml = preg_replace($reg, $segment->getXmlParsed(), $this->contentXml); |
635 | 635 | return $this; |
636 | 636 | } |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | */ |
643 | 643 | public function printVars() |
644 | 644 | { |
645 | - return print_r('<pre>' . print_r($this->vars, true) . '</pre>', true); |
|
645 | + return print_r('<pre>'.print_r($this->vars, true).'</pre>', true); |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | /** |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | */ |
664 | 664 | public function printDeclaredSegments() |
665 | 665 | { |
666 | - return '<pre>' . print_r(implode(' ', array_keys($this->segments)), true) . '</pre>'; |
|
666 | + return '<pre>'.print_r(implode(' ', array_keys($this->segments)), true).'</pre>'; |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | /** |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | { |
700 | 700 | if ($file !== null && is_string($file)) { |
701 | 701 | if (file_exists($file) && !(is_file($file) && is_writable($file))) { |
702 | - throw new OdfException('Permission denied : can\'t create ' . $file); |
|
702 | + throw new OdfException('Permission denied : can\'t create '.$file); |
|
703 | 703 | } |
704 | 704 | $this->_save(); |
705 | 705 | copy($this->tmpfile, $file); |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | */ |
717 | 717 | private function _save() |
718 | 718 | { |
719 | - $res=$this->file->open($this->tmpfile); // tmpfile is odt template |
|
719 | + $res = $this->file->open($this->tmpfile); // tmpfile is odt template |
|
720 | 720 | $this->_parse('content'); |
721 | 721 | $this->_parse('styles'); |
722 | 722 | $this->_parse('meta'); |
@@ -724,23 +724,23 @@ discard block |
||
724 | 724 | $this->setMetaData(); |
725 | 725 | //print $this->metaXml;exit; |
726 | 726 | |
727 | - if (! $this->file->addFromString('content.xml', $this->contentXml)) { |
|
727 | + if (!$this->file->addFromString('content.xml', $this->contentXml)) { |
|
728 | 728 | throw new OdfException('Error during file export addFromString content'); |
729 | 729 | } |
730 | - if (! $this->file->addFromString('meta.xml', $this->metaXml)) { |
|
730 | + if (!$this->file->addFromString('meta.xml', $this->metaXml)) { |
|
731 | 731 | throw new OdfException('Error during file export addFromString meta'); |
732 | 732 | } |
733 | - if (! $this->file->addFromString('styles.xml', $this->stylesXml)) { |
|
733 | + if (!$this->file->addFromString('styles.xml', $this->stylesXml)) { |
|
734 | 734 | throw new OdfException('Error during file export addFromString styles'); |
735 | 735 | } |
736 | 736 | |
737 | 737 | foreach ($this->images as $imageKey => $imageValue) { |
738 | 738 | // Add the image inside the ODT document |
739 | - $this->file->addFile($imageKey, 'Pictures/' . $imageValue); |
|
739 | + $this->file->addFile($imageKey, 'Pictures/'.$imageValue); |
|
740 | 740 | // Add the image to the Manifest (which maintains a list of images, necessary to avoid "Corrupt ODT file. Repair?" when opening the file with LibreOffice) |
741 | 741 | $this->addImageToManifest($imageValue); |
742 | 742 | } |
743 | - if (! $this->file->addFromString('META-INF/manifest.xml', $this->manifestXml)) { |
|
743 | + if (!$this->file->addFromString('META-INF/manifest.xml', $this->manifestXml)) { |
|
744 | 744 | throw new OdfException('Error during file export: manifest.xml'); |
745 | 745 | } |
746 | 746 | $this->file->close(); |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | */ |
755 | 755 | public function setMetaData() |
756 | 756 | { |
757 | - if (empty($this->creator)) $this->creator=''; |
|
757 | + if (empty($this->creator)) $this->creator = ''; |
|
758 | 758 | |
759 | 759 | $this->metaXml = preg_replace('/<dc:date>.*<\/dc:date>/', '<dc:date>'.gmdate("Y-m-d\TH:i:s").'</dc:date>', $this->metaXml); |
760 | 760 | $this->metaXml = preg_replace('/<dc:creator>.*<\/dc:creator>/', '<dc:creator>'.htmlspecialchars($this->creator).'</dc:creator>', $this->metaXml); |
@@ -800,8 +800,8 @@ discard block |
||
800 | 800 | throw new OdfException("headers already sent ($filename at $linenum)"); |
801 | 801 | } |
802 | 802 | |
803 | - if ( $name == "" ) { |
|
804 | - $name = md5(uniqid()) . ".odt"; |
|
803 | + if ($name == "") { |
|
804 | + $name = md5(uniqid()).".odt"; |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | header('Content-type: application/vnd.oasis.opendocument.text'); |
@@ -822,18 +822,18 @@ discard block |
||
822 | 822 | { |
823 | 823 | global $conf; |
824 | 824 | |
825 | - if ( $name == "" ) $name = "temp".md5(uniqid()); |
|
825 | + if ($name == "") $name = "temp".md5(uniqid()); |
|
826 | 826 | |
827 | 827 | dol_syslog(get_class($this).'::exportAsAttachedPDF $name='.$name, LOG_DEBUG); |
828 | 828 | $this->saveToDisk($name); |
829 | 829 | |
830 | - $execmethod=(empty($conf->global->MAIN_EXEC_USE_POPEN)?1:2); // 1 or 2 |
|
830 | + $execmethod = (empty($conf->global->MAIN_EXEC_USE_POPEN) ? 1 : 2); // 1 or 2 |
|
831 | 831 | // Method 1 sometimes hang the server. |
832 | 832 | |
833 | 833 | |
834 | 834 | // Export to PDF using LibreOffice |
835 | 835 | if (getDolGlobalString('MAIN_ODT_AS_PDF') == 'libreoffice') { |
836 | - dol_mkdir($conf->user->dir_temp); // We must be sure the directory exists and is writable |
|
836 | + dol_mkdir($conf->user->dir_temp); // We must be sure the directory exists and is writable |
|
837 | 837 | |
838 | 838 | // We delete and recreate a subdir because the soffice may have change pemrissions on it |
839 | 839 | dol_delete_dir_recursive($conf->user->dir_temp.'/odtaspdf'); |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | // using windows libreoffice that must be in path |
844 | 844 | // using linux/mac libreoffice that must be in path |
845 | 845 | // Note PHP Config "fastcgi.impersonate=0" must set to 0 - Default is 1 |
846 | - $command ='soffice --headless -env:UserInstallation=file:'.(getDolGlobalString('MAIN_ODT_ADD_SLASH_FOR_WINDOWS') ? '///' : '').'\''.$conf->user->dir_temp.'/odtaspdf\' --convert-to pdf --outdir '. escapeshellarg(dirname($name)). " ".escapeshellarg($name); |
|
846 | + $command = 'soffice --headless -env:UserInstallation=file:'.(getDolGlobalString('MAIN_ODT_ADD_SLASH_FOR_WINDOWS') ? '///' : '').'\''.$conf->user->dir_temp.'/odtaspdf\' --convert-to pdf --outdir '.escapeshellarg(dirname($name))." ".escapeshellarg($name); |
|
847 | 847 | } elseif (preg_match('/unoconv/', getDolGlobalString('MAIN_ODT_AS_PDF'))) { |
848 | 848 | // If issue with unoconv, see https://github.com/dagwieers/unoconv/issues/87 |
849 | 849 | |
@@ -873,13 +873,13 @@ discard block |
||
873 | 873 | //$command = '/usr/bin/unoconv -vvv '.escapeshellcmd($name); |
874 | 874 | } else { |
875 | 875 | // deprecated old method using odt2pdf.sh (native, jodconverter, ...) |
876 | - $tmpname=preg_replace('/\.odt/i', '', $name); |
|
876 | + $tmpname = preg_replace('/\.odt/i', '', $name); |
|
877 | 877 | |
878 | 878 | if (getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT')) { |
879 | - $command = getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT').'/scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF'))?'jodconverter':getDolGlobalString('MAIN_ODT_AS_PDF')); |
|
879 | + $command = getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT').'/scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF')) ? 'jodconverter' : getDolGlobalString('MAIN_ODT_AS_PDF')); |
|
880 | 880 | } else { |
881 | 881 | dol_syslog(get_class($this).'::exportAsAttachedPDF is used but the constant MAIN_DOL_SCRIPTS_ROOT with path to script directory was not defined.', LOG_WARNING); |
882 | - $command = '../../scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF'))?'jodconverter':getDolGlobalString('MAIN_ODT_AS_PDF')); |
|
882 | + $command = '../../scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF')) ? 'jodconverter' : getDolGlobalString('MAIN_ODT_AS_PDF')); |
|
883 | 883 | } |
884 | 884 | } |
885 | 885 | |
@@ -892,14 +892,14 @@ discard block |
||
892 | 892 | // $result = $utils->executeCLI($command, $outputfile); and replace test on $execmethod. |
893 | 893 | // $retval will be $result['result'] |
894 | 894 | // $errorstring will be $result['output'] |
895 | - $retval=0; $output_arr=array(); |
|
895 | + $retval = 0; $output_arr = array(); |
|
896 | 896 | if ($execmethod == 1) { |
897 | 897 | exec($command, $output_arr, $retval); |
898 | 898 | } |
899 | 899 | if ($execmethod == 2) { |
900 | 900 | $outputfile = DOL_DATA_ROOT.'/odt2pdf.log'; |
901 | 901 | |
902 | - $ok=0; |
|
902 | + $ok = 0; |
|
903 | 903 | $handle = fopen($outputfile, 'w'); |
904 | 904 | if ($handle) { |
905 | 905 | dol_syslog(get_class($this)."Run command ".$command, LOG_DEBUG); |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | while (!feof($handlein)) { |
909 | 909 | $read = fgets($handlein); |
910 | 910 | fwrite($handle, $read); |
911 | - $output_arr[]=$read; |
|
911 | + $output_arr[] = $read; |
|
912 | 912 | } |
913 | 913 | pclose($handlein); |
914 | 914 | fclose($handle); |
@@ -918,7 +918,7 @@ discard block |
||
918 | 918 | |
919 | 919 | if ($retval == 0) { |
920 | 920 | dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG); |
921 | - $filename=''; $linenum=0; |
|
921 | + $filename = ''; $linenum = 0; |
|
922 | 922 | |
923 | 923 | if (php_sapi_name() != 'cli') { // If we are in a web context (not into CLI context) |
924 | 924 | if (headers_sent($filename, $linenum)) { |
@@ -926,7 +926,7 @@ discard block |
||
926 | 926 | } |
927 | 927 | |
928 | 928 | if (!empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { |
929 | - $name=preg_replace('/\.od(x|t)/i', '', $name); |
|
929 | + $name = preg_replace('/\.od(x|t)/i', '', $name); |
|
930 | 930 | header('Content-type: application/pdf'); |
931 | 931 | header('Content-Disposition: attachment; filename="'.basename($name).'.pdf"'); |
932 | 932 | readfile($name.".pdf"); |
@@ -941,13 +941,13 @@ discard block |
||
941 | 941 | dol_syslog(get_class($this).'::exportAsAttachedPDF $output_arr='.var_export($output_arr, true), LOG_DEBUG); |
942 | 942 | |
943 | 943 | if ($retval == 126) { |
944 | - throw new OdfException('Permission execute convert script : ' . $command); |
|
944 | + throw new OdfException('Permission execute convert script : '.$command); |
|
945 | 945 | } else { |
946 | - $errorstring=''; |
|
946 | + $errorstring = ''; |
|
947 | 947 | foreach ($output_arr as $line) { |
948 | - $errorstring.= $line."<br>"; |
|
948 | + $errorstring .= $line."<br>"; |
|
949 | 949 | } |
950 | - throw new OdfException('ODT to PDF convert fail (option MAIN_ODT_AS_PDF is '.$conf->global->MAIN_ODT_AS_PDF.', command was '.$command.', retval='.$retval.') : ' . $errorstring); |
|
950 | + throw new OdfException('ODT to PDF convert fail (option MAIN_ODT_AS_PDF is '.$conf->global->MAIN_ODT_AS_PDF.', command was '.$command.', retval='.$retval.') : '.$errorstring); |
|
951 | 951 | } |
952 | 952 | } |
953 | 953 | } |
@@ -1001,11 +1001,11 @@ discard block |
||
1001 | 1001 | if ($handle = opendir($dir)) { |
1002 | 1002 | while (($file = readdir($handle)) !== false) { |
1003 | 1003 | if ($file != '.' && $file != '..') { |
1004 | - if (is_dir($dir . '/' . $file)) { |
|
1005 | - $this->_rrmdir($dir . '/' . $file); |
|
1006 | - rmdir($dir . '/' . $file); |
|
1004 | + if (is_dir($dir.'/'.$file)) { |
|
1005 | + $this->_rrmdir($dir.'/'.$file); |
|
1006 | + rmdir($dir.'/'.$file); |
|
1007 | 1007 | } else { |
1008 | - unlink($dir . '/' . $file); |
|
1008 | + unlink($dir.'/'.$file); |
|
1009 | 1009 | } |
1010 | 1010 | } |
1011 | 1011 | } |
@@ -1021,7 +1021,7 @@ discard block |
||
1021 | 1021 | */ |
1022 | 1022 | public function getvalue($valuename) |
1023 | 1023 | { |
1024 | - $searchreg="/\\[".$valuename."\\](.*)\\[\\/".$valuename."\\]/"; |
|
1024 | + $searchreg = "/\\[".$valuename."\\](.*)\\[\\/".$valuename."\\]/"; |
|
1025 | 1025 | $matches = array(); |
1026 | 1026 | preg_match($searchreg, $this->contentXml, $matches); |
1027 | 1027 | $this->contentXml = preg_replace($searchreg, "", $this->contentXml); |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | } |
199 | 199 | if (GETPOSTISSET('supplier_invoice_id')) { |
200 | 200 | $object->fields['supplier_invoice_id'] = array('type' => 'integer:FactureFournisseur:fourn/class/fournisseur.facture.class.php:1:entity IN (__SHARED_ENTITIES__)', 'label' => 'SupplierInvoice', 'enabled' => '1', 'noteditable' => 1, 'position' => 280, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'validate' => '1',); |
201 | - print '<input type="hidden" name="supplier_invoice_id" value="' . GETPOSTINT('supplier_invoice_id') . '">'; |
|
201 | + print '<input type="hidden" name="supplier_invoice_id" value="'.GETPOSTINT('supplier_invoice_id').'">'; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | print dol_get_fiche_head(array(), ''); |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | array('type' => 'checkbox', 'name' => 'disposal_depreciated', 'label' => $langs->trans("AssetDisposalDepreciated"), 'value' => $disposal_depreciated), |
300 | 300 | array('type' => 'checkbox', 'name' => 'disposal_subject_to_vat', 'label' => $langs->trans("AssetDisposalSubjectToVat"), 'value' => $disposal_subject_to_vat), |
301 | 301 | ); |
302 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('AssetDisposal'), $langs->trans('AssetConfirmDisposalAsk', $object->ref . ' - ' . $object->label), 'confirm_disposal', $formquestion, 'yes', 1); |
|
302 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('AssetDisposal'), $langs->trans('AssetConfirmDisposalAsk', $object->ref.' - '.$object->label), 'confirm_disposal', $formquestion, 'yes', 1); |
|
303 | 303 | } elseif ($action == 'reopen') { |
304 | 304 | // Re-open |
305 | 305 | // Create an array for form |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | print '<table class="border centpercent tableforfield">'."\n"; |
344 | 344 | |
345 | 345 | // Common attributes |
346 | - $keyforbreak='date_acquisition'; // We change column just before this field |
|
346 | + $keyforbreak = 'date_acquisition'; // We change column just before this field |
|
347 | 347 | //unset($object->fields['fk_project']); // Hide field already shown in banner |
348 | 348 | //unset($object->fields['fk_soc']); // Hide field already shown in banner |
349 | 349 | include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | |
362 | 362 | // Buttons for actions |
363 | 363 | if ($action != 'presend' && $action != 'editline') { |
364 | - print '<div class="tabsAction">' . "\n"; |
|
364 | + print '<div class="tabsAction">'."\n"; |
|
365 | 365 | $parameters = array(); |
366 | 366 | $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
367 | 367 | if ($reshook < 0) { |
@@ -371,26 +371,26 @@ discard block |
||
371 | 371 | if (empty($reshook)) { |
372 | 372 | // Send |
373 | 373 | if (empty($user->socid)) { |
374 | - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init&token=' . newToken() . '#formmailbeforetitle'); |
|
374 | + print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle'); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | if ($object->status == $object::STATUS_DRAFT) { |
378 | - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken(), '', $permissiontoadd); |
|
378 | + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | // Clone |
382 | 382 | //print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=clone&token=' . newToken(), '', false && $permissiontoadd); |
383 | 383 | |
384 | 384 | if ($object->status == $object::STATUS_DRAFT) { |
385 | - print dolGetButtonAction($langs->trans('AssetDisposal'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=disposal&token=' . newToken(), '', $permissiontoadd); |
|
385 | + print dolGetButtonAction($langs->trans('AssetDisposal'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=disposal&token='.newToken(), '', $permissiontoadd); |
|
386 | 386 | } else { |
387 | - print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=reopen&token=' . newToken(), '', $permissiontoadd); |
|
387 | + print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen&token='.newToken(), '', $permissiontoadd); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | // Delete (need delete permission, or if draft, just need create/modify permission) |
391 | - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=delete&token=' . newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); |
|
391 | + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); |
|
392 | 392 | } |
393 | - print '</div>' . "\n"; |
|
393 | + print '</div>'."\n"; |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | // Select mail models is same action as presend |
@@ -27,8 +27,8 @@ |
||
27 | 27 | // Load Dolibarr environment |
28 | 28 | require '../main.inc.php'; |
29 | 29 | |
30 | -require_once DOL_DOCUMENT_ROOT . '/eventorganization/class/conferenceorboothattendee.class.php'; |
|
31 | -require_once DOL_DOCUMENT_ROOT . '/eventorganization/lib/eventorganization_conferenceorbooth.lib.php'; |
|
30 | +require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php'; |
|
31 | +require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php'; |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @var Conf $conf |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | $this->ref_supplier = $obj->ref_supplier; |
545 | 545 | $this->socid = $obj->fk_soc; |
546 | 546 | $this->fourn_id = $obj->fk_soc; |
547 | - $this->statut = $obj->status; // deprecated |
|
547 | + $this->statut = $obj->status; // deprecated |
|
548 | 548 | $this->status = $obj->status; |
549 | 549 | $this->billed = $obj->billed; |
550 | 550 | $this->user_author_id = $obj->user_author_id; |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | $this->fk_project = $obj->fk_project; |
576 | 576 | $this->cond_reglement_id = $obj->fk_cond_reglement; |
577 | 577 | $this->cond_reglement_code = $obj->cond_reglement_code; |
578 | - $this->cond_reglement = $obj->cond_reglement_label; // deprecated |
|
578 | + $this->cond_reglement = $obj->cond_reglement_label; // deprecated |
|
579 | 579 | $this->cond_reglement_label = $obj->cond_reglement_label; |
580 | 580 | $this->cond_reglement_doc = $obj->cond_reglement_doc; |
581 | 581 | $this->fk_account = $obj->fk_account; |
@@ -708,10 +708,10 @@ discard block |
||
708 | 708 | $sqlsearchpackage .= ' WHERE entity IN ('.getEntity('product_fournisseur_price').")"; |
709 | 709 | $sqlsearchpackage .= " AND fk_product = ".((int) $objp->fk_product); |
710 | 710 | $sqlsearchpackage .= " AND ref_fourn = '".$this->db->escape($objp->ref_supplier)."'"; |
711 | - $sqlsearchpackage .= " AND quantity <= ".((float) $objp->qty); // required to be qualified |
|
712 | - $sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= ".((float) $objp->qty).")"; // required to be qualified |
|
711 | + $sqlsearchpackage .= " AND quantity <= ".((float) $objp->qty); // required to be qualified |
|
712 | + $sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= ".((float) $objp->qty).")"; // required to be qualified |
|
713 | 713 | $sqlsearchpackage .= " AND fk_soc = ".((int) $this->socid); |
714 | - $sqlsearchpackage .= " ORDER BY packaging ASC"; // Take the smaller package first |
|
714 | + $sqlsearchpackage .= " ORDER BY packaging ASC"; // Take the smaller package first |
|
715 | 715 | $sqlsearchpackage .= " LIMIT 1"; |
716 | 716 | |
717 | 717 | $resqlsearchpackage = $this->db->query($sqlsearchpackage); |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | $line->multicurrency_total_tva = $objp->multicurrency_total_tva; |
740 | 740 | $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; |
741 | 741 | |
742 | - $line->info_bits = $objp->info_bits; |
|
742 | + $line->info_bits = $objp->info_bits; |
|
743 | 743 | $line->special_code = $objp->special_code; |
744 | 744 | $line->fk_parent_line = $objp->fk_parent_line; |
745 | 745 | |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | if (!$error) { |
867 | 867 | $result = 1; |
868 | 868 | $this->status = self::STATUS_VALIDATED; |
869 | - $this->statut = self::STATUS_VALIDATED; // deprecated |
|
869 | + $this->statut = self::STATUS_VALIDATED; // deprecated |
|
870 | 870 | $this->ref = $num; |
871 | 871 | } |
872 | 872 | |
@@ -1109,7 +1109,7 @@ discard block |
||
1109 | 1109 | } |
1110 | 1110 | |
1111 | 1111 | global $action; |
1112 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
1112 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
1113 | 1113 | $parameters = array('id' => $this->id, 'getnomurl' => &$result); |
1114 | 1114 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
1115 | 1115 | if ($reshook > 0) { |
@@ -1600,7 +1600,7 @@ discard block |
||
1600 | 1600 | } |
1601 | 1601 | |
1602 | 1602 | // We set order into draft status |
1603 | - $this->statut = self::STATUS_DRAFT; // deprecated |
|
1603 | + $this->statut = self::STATUS_DRAFT; // deprecated |
|
1604 | 1604 | $this->status = self::STATUS_DRAFT; |
1605 | 1605 | |
1606 | 1606 | $sql = "INSERT INTO ".$this->db->prefix()."commande_fournisseur ("; |
@@ -1686,10 +1686,10 @@ discard block |
||
1686 | 1686 | $line->date_end, |
1687 | 1687 | $line->array_options, |
1688 | 1688 | $line->fk_unit, |
1689 | - $line->multicurrency_subprice, // pu_ht_devise |
|
1690 | - $line->origin, // origin |
|
1691 | - $line->origin_id, // origin_id |
|
1692 | - $line->rang, // rang |
|
1689 | + $line->multicurrency_subprice, // pu_ht_devise |
|
1690 | + $line->origin, // origin |
|
1691 | + $line->origin_id, // origin_id |
|
1692 | + $line->rang, // rang |
|
1693 | 1693 | $line->special_code |
1694 | 1694 | ); |
1695 | 1695 | if ($result < 0) { |
@@ -2063,7 +2063,7 @@ discard block |
||
2063 | 2063 | $this->db->begin(); |
2064 | 2064 | |
2065 | 2065 | $product_type = $type; |
2066 | - $label = ''; // deprecated |
|
2066 | + $label = ''; // deprecated |
|
2067 | 2067 | |
2068 | 2068 | if ($fk_product > 0) { |
2069 | 2069 | if (getDolGlobalInt('SUPPLIER_ORDER_WITH_PREDEFINED_PRICES_ONLY') == 1) { // Not the common case |
@@ -2125,7 +2125,7 @@ discard block |
||
2125 | 2125 | if ($qty < $prod->packaging) { |
2126 | 2126 | $qty = $prod->packaging; |
2127 | 2127 | } else { |
2128 | - if (!empty($prod->packaging) && (fmod((float) $qty, $prod->packaging) > 0.000001)) { |
|
2128 | + if (!empty($prod->packaging) && (fmod((float) $qty, $prod->packaging) > 0.000001)) { |
|
2129 | 2129 | $coeff = intval((float) $qty / $prod->packaging) + 1; |
2130 | 2130 | $qty = (float) $prod->packaging * $coeff; |
2131 | 2131 | setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); |
@@ -2206,7 +2206,7 @@ discard block |
||
2206 | 2206 | $this->line->total_localtax2 = (float) $total_localtax2; |
2207 | 2207 | $this->line->total_ttc = (float) $total_ttc; |
2208 | 2208 | $this->line->product_type = $type; |
2209 | - $this->line->special_code = (!empty($special_code) ? $special_code : 0); |
|
2209 | + $this->line->special_code = (!empty($special_code) ? $special_code : 0); |
|
2210 | 2210 | $this->line->origin = $origin; |
2211 | 2211 | $this->line->origin_id = $origin_id; |
2212 | 2212 | $this->line->fk_unit = $fk_unit; |
@@ -2217,8 +2217,8 @@ discard block |
||
2217 | 2217 | // Multicurrency |
2218 | 2218 | $this->line->fk_multicurrency = $this->fk_multicurrency; |
2219 | 2219 | $this->line->multicurrency_code = $this->multicurrency_code; |
2220 | - $this->line->multicurrency_subprice = (float) $pu_ht_devise; |
|
2221 | - $this->line->multicurrency_total_ht = (float) $multicurrency_total_ht; |
|
2220 | + $this->line->multicurrency_subprice = (float) $pu_ht_devise; |
|
2221 | + $this->line->multicurrency_total_ht = (float) $multicurrency_total_ht; |
|
2222 | 2222 | $this->line->multicurrency_total_tva = (float) $multicurrency_total_tva; |
2223 | 2223 | $this->line->multicurrency_total_ttc = (float) $multicurrency_total_ttc; |
2224 | 2224 | |
@@ -3415,7 +3415,7 @@ discard block |
||
3415 | 3415 | global $conf, $langs; |
3416 | 3416 | |
3417 | 3417 | if (!dol_strlen($modele)) { |
3418 | - $modele = ''; // No doc template/generation by default |
|
3418 | + $modele = ''; // No doc template/generation by default |
|
3419 | 3419 | |
3420 | 3420 | if (!empty($this->model_pdf)) { |
3421 | 3421 | $modele = $this->model_pdf; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | $out .= '<div class="centpercent nobordernopadding valignmiddle"><div class="inline-block marginrightonly">'; |
112 | 112 | if ($maxmin > 0) { |
113 | - $out .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
|
113 | + $out .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
|
114 | 114 | } |
115 | 115 | $out .= '<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="'.$htmlname.'" id="'.$htmlname.'" accept="image/*">'; |
116 | 116 | $out .= '</div>'; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $maxphptoshow = $maxfilesizearray['maxphptoshow']; |
241 | 241 | $maxphptoshowparam = $maxfilesizearray['maxphptoshowparam']; |
242 | 242 | if ($maxmin > 0) { |
243 | - $out .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
|
243 | + $out .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
|
244 | 244 | } |
245 | 245 | $out .= '<input class="flat minwidth400 maxwidth200onsmartphone" type="file"'; |
246 | 246 | $out .= ((getDolGlobalString('MAIN_DISABLE_MULTIPLE_FILEUPLOAD') || $disablemulti) ? ' name="userfile"' : ' name="userfile[]" multiple'); |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | |
957 | 957 | // Loop on each file found |
958 | 958 | if (is_array($file_list)) { |
959 | - '@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string}> $file_list'; // phan limitations loose typing information with empty() tests, etc. Force again. |
|
959 | + '@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string}> $file_list'; // phan limitations loose typing information with empty() tests, etc. Force again. |
|
960 | 960 | // Defined relative dir to DOL_DATA_ROOT |
961 | 961 | $relativedir = ''; |
962 | 962 | if ($filedir) { |
@@ -975,7 +975,7 @@ discard block |
||
975 | 975 | } |
976 | 976 | } |
977 | 977 | |
978 | - require_once DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php'; |
|
978 | + require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; |
|
979 | 979 | |
980 | 980 | $i = 0; |
981 | 981 | foreach ($file_list as $file) { |
@@ -1241,7 +1241,7 @@ discard block |
||
1241 | 1241 | |
1242 | 1242 | $this->infofiles['nboffiles']++; |
1243 | 1243 | $this->infofiles['files'][] = $file['fullname']; |
1244 | - $ext = (string) pathinfo($file['name'], PATHINFO_EXTENSION); // pathinfo returns a string here (cast for static analysis) |
|
1244 | + $ext = (string) pathinfo($file['name'], PATHINFO_EXTENSION); // pathinfo returns a string here (cast for static analysis) |
|
1245 | 1245 | if (!array_key_exists($ext, $this->infofiles['extensions'])) { |
1246 | 1246 | $this->infofiles['extensions'][$ext] = 1; |
1247 | 1247 | } else { |
@@ -1525,7 +1525,7 @@ discard block |
||
1525 | 1525 | $modulepart = basename(dirname($file['path'])); |
1526 | 1526 | } |
1527 | 1527 | if (empty($relativepath)) { |
1528 | - $relativepath = preg_replace('/\/(.+)/', '', $filepath) . '/'; |
|
1528 | + $relativepath = preg_replace('/\/(.+)/', '', $filepath).'/'; |
|
1529 | 1529 | } |
1530 | 1530 | |
1531 | 1531 | $editline = 0; |
@@ -1804,7 +1804,7 @@ discard block |
||
1804 | 1804 | |
1805 | 1805 | if ($nboflines > 1 && is_object($object)) { |
1806 | 1806 | if (!empty($conf->use_javascript_ajax) && $permtoeditline) { |
1807 | - $table_element_line = 'ecm_files'; // used by ajaxrow.tpl.php |
|
1807 | + $table_element_line = 'ecm_files'; // used by ajaxrow.tpl.php |
|
1808 | 1808 | include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
1809 | 1809 | } |
1810 | 1810 | } |
@@ -46,7 +46,7 @@ |
||
46 | 46 | /** |
47 | 47 | * @var string[] |
48 | 48 | * |
49 | - */ |
|
49 | + */ |
|
50 | 50 | public $require_module = array('partnership'); // This module allows to select by categories must be also enabled if category module is not activated |
51 | 51 | |
52 | 52 | /** |