diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 166b9f9612c..72eb4c6935d 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -729,7 +729,7 @@ class Categorie extends CommonObject 'categorie_contact' => 'fk_categorie', 'categorie_fournisseur' => 'fk_categorie', 'categorie_knowledgemanagement' => array('field' => 'fk_categorie', 'enabled' => isModEnabled('knowledgemanagement')), - 'categorie_fichinter' => array('field' => 'fk_categorie', 'enabled' => isModEnabled('intervention')), + 'categorie_fichinter' => array('field' => 'fk_categorie', 'enabled' => false ), // not yet fully implemented (wait 22) isModEnabled('intervention')), 'categorie_member' => 'fk_categorie', 'categorie_user' => 'fk_categorie', 'categorie_product' => 'fk_categorie', diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 61e5caf6fd4..16d4ebc23e3 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1367,7 +1367,7 @@ if (empty($reshook)) { $tva_tx = 0; } - $object->addline($langs->trans('invoiceAvoirLineWithPaymentRestAmount'), $remain_to_pay, 1, $tva_tx, 0, 0, 0, 0, '', '', 0, 0, 0, 'TTC'); + $object->addline($langs->trans('invoiceAvoirLineWithPaymentRestAmount'), 0, 1, $tva_tx, 0, 0, 0, 0, '', '', 0, 0, 0, 'TTC', $remain_to_pay); } } diff --git a/htdocs/core/filemanagerdol/browser/default/frmupload.php b/htdocs/core/filemanagerdol/browser/default/frmupload.php index 17a2be8725b..7badd1763c3 100644 --- a/htdocs/core/filemanagerdol/browser/default/frmupload.php +++ b/htdocs/core/filemanagerdol/browser/default/frmupload.php @@ -134,7 +134,10 @@ function OnUploadCompleted( errorNumber, data ) alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + data + '"' ); break; case 202: - alert( 'Invalid file (Bad extension)' ); + alert( 'Invalid file (Bad extension reported by image_format_supported or other)' ); + break; + case 205: + alert( 'Invalid file (Bad file reported by DetectHtml)' ); break; default: alert( 'Error on file upload. Error number: ' + errorNumber ); diff --git a/htdocs/core/filemanagerdol/connectors/php/connector.lib.php b/htdocs/core/filemanagerdol/connectors/php/connector.lib.php index 3854d3f8b6e..91c93c531eb 100644 --- a/htdocs/core/filemanagerdol/connectors/php/connector.lib.php +++ b/htdocs/core/filemanagerdol/connectors/php/connector.lib.php @@ -323,6 +323,8 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') //$sFileName = SanitizeFileName($sFileName); $sFileName = dol_sanitizeFileName($sFileName); + dol_syslog("FileUpload sFileName=".$sFileName); + $sOriginalFileName = $sFileName; // Get the extension. @@ -339,7 +341,7 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') }*/ if (!$permissiontouploadmediaisok) { dol_syslog("connector.lib.php Try to upload a file with no permission"); - $sErrorNumber = '202'; + $sErrorNumber = '204'; } include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; @@ -397,9 +399,9 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') $detectHtml = DetectHtml($sFilePath); if ($detectHtml === true || $detectHtml == -1) { // Note that is is a simple test and not reliable. Security does not rely on this. - dol_syslog("connector.lib.php DetectHtml is ko"); + dol_syslog("connector.lib.php DetectHtml is ko detectHtml=".$detectHtml.", we delete the file."); @unlink($sFilePath); - $sErrorNumber = '202'; + $sErrorNumber = '205'; } } } @@ -964,13 +966,11 @@ function DetectHtml($filePath) { $fp = @fopen($filePath, 'rb'); - //open_basedir restriction, see #1906 - if ($fp === false || !flock($fp, LOCK_SH)) { + if ($fp === false) { return -1; } $chunk = fread($fp, 1024); - flock($fp, LOCK_UN); fclose($fp); $chunk = strtolower($chunk); diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 8fdb4816940..a149369ef61 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3584,7 +3584,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } } - if ($fuser->hasRight($modulepart, $lire) || $fuser->hasRight($modulepart, $read)) { + if (($fuser->hasRight($modulepart, $lire) || $fuser->hasRight($modulepart, $read)) || ($fuser->hasRight($modulepart, 'all', $lire) || $fuser->hasRight($modulepart, 'all', $read))) { $accessallowed = 1; } diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 4681cc0619f..9c076886fc9 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -80,7 +80,7 @@ function getListOfPossibleImageExt($acceptsvg = 0) * * @param string $file Filename * @param int $acceptsvg 0=Default (depends on setup), 1=Always accept SVG as image files - * @return int -1=Not image filename, 0=Image filename but format not supported for conversion by PHP, 1=Image filename with format supported by this PHP + * @return int -1=Not image filename, 0=Image filename but format not supported for conversion by PHP, 1=Image filename with format supported in conversion by this PHP */ function image_format_supported($file, $acceptsvg = 0) { diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 9bb097d10b2..d81f9fb6c26 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -433,7 +433,7 @@ create table llx_expedition_package rowid integer AUTO_INCREMENT PRIMARY KEY, fk_expedition integer NOT NULL, description varchar(255), --Description of goods in the package (required by the custom) - value double(24,8) DEFAULT 0,--Value (Price of the content, for insurance & custom) + value double(24,8) DEFAULT 0, --Value (Price of the content, for insurance & custom) fk_parcel_type integer, -- Type or package, linked to llx_c_shipment_parcel_type (eg: 1=enveloppe, 2=package, 3=palette, 4=other) height float, -- height width float, -- width @@ -593,4 +593,3 @@ create table llx_facturedet_rec_extrafields )ENGINE=innodb; ALTER TABLE llx_facturedet_rec_extrafields ADD INDEX idx_facturedet_rec_extrafields (fk_object); - diff --git a/htdocs/install/mysql/tables/llx_expedition_package.sql b/htdocs/install/mysql/tables/llx_expedition_package.sql index a4f372603ce..704e485e663 100644 --- a/htdocs/install/mysql/tables/llx_expedition_package.sql +++ b/htdocs/install/mysql/tables/llx_expedition_package.sql @@ -4,7 +4,7 @@ create table llx_expedition_package rowid integer AUTO_INCREMENT PRIMARY KEY, fk_expedition integer NOT NULL, description varchar(255), --Description of goods in the package (required by the custom) - value double(24,8) DEFAULT 0,--Value (Price of the content, for insurance & custom) + value double(24,8) DEFAULT 0, --Value (Price of the content, for insurance & custom) fk_package_type integer, -- Type or package, linked to llx_c_shipment_parcel_type (eg: 1=enveloppe, 2=package, 3=palette, 4=other) height float, -- height width float, -- width diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 4505e050091..ac1549ce0d2 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -232,6 +232,7 @@ if ($result || !($id > 0)) { } else { print ''; } + print ''; // Year print ''.$langs->trans("Year").''; @@ -267,6 +268,9 @@ if ($result || !($id > 0)) { if ($socid > 0) { $param .= '&socid='.((int) $socid); } + if (!empty($search_categ)) { + $param .= '&search_categ='.((int) $search_categ); + } // Choice of stats mode (byunit or bynumber) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 079c169d000..e8251ad1dd1 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -2558,34 +2558,36 @@ if ($action == 'create' || $action == 'adduserldap') { $type = $object->contact_id; } + $eventsCompanyContact = array(); + $eventsCompanyContact[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1&token='.currentToken(), 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); if ($object->socid > 0 && !($object->contact_id > 0)) { // external user but no link to a contact - print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company($object->socid, 'socid', '', ' ', 0, 0, array(), 0, 'maxwidth300'); + print img_picto('', 'company', 'class="pictofixedwidth"'); + print $form->select_company($object->socid, 'socid', '', ' ', 0, 0, $eventsCompanyContact, 0, 'maxwidth300'); print img_picto('', 'contact', 'class="pictofixedwidth"'); - //print $form->selectcontacts(0, 0, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1); print $form->select_contact(0, 0, 'contactid', 1, '', '', 1, 'minwidth100imp widthcentpercentminusxx maxwidth300', true, 1); if ($object->ldap_sid) { print ' ('.$langs->trans("DomainUser").')'; } } elseif ($object->socid > 0 && $object->contact_id > 0) { // external user with a link to a contact - print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company($object->socid, 'socid', '', ' ', 0, 0, array(), 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set + print img_picto('', 'company', 'class="pictofixedwidth"'); + print $form->select_company($object->socid, 'socid', '', ' ', 0, 0, $eventsCompanyContact, 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set print img_picto('', 'contact', 'class="pictofixedwidth"'); - //print $form->selectcontacts(0, $object->contact_id, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1); print $form->select_contact(0, $object->contact_id, 'contactid', 1, '', '', 1, 'minwidth100imp widthcentpercentminusxx maxwidth300', true, 1); if ($object->ldap_sid) { print ' ('.$langs->trans("DomainUser").')'; } } elseif (!($object->socid > 0) && $object->contact_id > 0) { // internal user with a link to a contact - print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company(0, 'socid', '', ' ', 0, 0, array(), 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set + print img_picto('', 'company', 'class="pictofixedwidth"'); + print $form->select_company(0, 'socid', '', ' ', 0, 0, $eventsCompanyContact, 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set print img_picto('', 'contact', 'class="pictofixedwidth"'); - //print $form->selectcontacts(0, $object->contact_id, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1); print $form->select_contact(0, $object->contact_id, 'contactid', 1, '', '', 1, 'minwidth100imp widthcentpercentminusxx maxwidth300', true, 1); if ($object->ldap_sid) { print ' ('.$langs->trans("DomainUser").')'; } } else { // $object->socid is not > 0 here - print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company(0, 'socid', '', ' ', 0, 0, array(), 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set + print img_picto('', 'company', 'class="pictofixedwidth"'); + print $form->select_company(0, 'socid', '', ' ', 0, 0, $eventsCompanyContact, 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set print img_picto('', 'contact', 'class="pictofixedwidth"'); - //print $form->selectcontacts(0, 0, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1); print $form->select_contact(0, 0, 'contactid', 1, '', '', 1, 'minwidth100imp widthcentpercentminusxx maxwidth300', true, 1); } } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 1ea16d01c17..b3b7be04327 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -876,6 +876,7 @@ class User extends CommonObject 'mo' => 'mrp', 'order' => 'commande', 'produit' => 'product', + 'productlot' => 'product', 'project' => 'projet', 'propale' => 'propal', 'shipping' => 'expedition',