diff --git a/ChangeLog b/ChangeLog index 5c5ad383d7a..3a04104b128 100644 --- a/ChangeLog +++ b/ChangeLog @@ -64,14 +64,16 @@ For users: - New: Add field oustanding limit into thirdparty properties. - New: Can enter a vat payment of zero. - New: Add path to installed dir of external modules + Name and web of module provider. +- New: Add option to use a specific mask for uploaded filename - Qual: Implement same rule for return value of all command line scripts (0 when success, <>0 if error). - Fix: [ bug #992 ] Proforma invoices don't have a separated numeric count. - Fix: [ bug #1022 ] correct margin calculation for credit notes. +- Fix: Better management of using ajax for upload form (to solve problem when enabling ajax jquery multifile upload in some cases). For translators: - Qual: Normalized sort order of all languages files with english reference files. -- New: Add language code files for South Africa, France new caledonia. -- New: Translate the email to change password. +- New: Add language code files for South Africa, France new caledonia, Vietnam. +- New: Translate string for email to change password. For developers: - New: DolGraph can build graph with three lines. diff --git a/build/debian/README.howto b/build/debian/README.howto index 6f06f5ab91b..7108f0a381f 100644 --- a/build/debian/README.howto +++ b/build/debian/README.howto @@ -8,6 +8,9 @@ script to build a package, ready to be distributed, with format .DEB (for Debian, Ubuntu, ...). + +##### Prepare linux env to work + # To build a debian package, you need first # With Ubuntu 12.04 # apt-get install debhelper dpkg-source gpg lintian git-buildpackage pkg-php-tools schroot sbuild dh-linktree dh-make-php @@ -41,6 +44,9 @@ END * Ask to be included into project collab-maint: http://alioth.debian.org/projects/collab-maint/ + +##### Some interesting command to know + # To translate .po files # debconf-updatepo To run into po dir to regenate templates.pot # podebconf-report-po --from email@email.com To send email to ask translations @@ -66,9 +72,8 @@ END # gdebi package.deb Install a package + dependencies -########################################################## -To submit a package to Debian: +##### Global view of submit new package to Debian: - Post an ITP with reportbugs : > reportbug -B debian --email username@domain.tld wnpp @@ -90,19 +95,28 @@ http://bugs.debian.org/package -########################################################## - -To generate a package +##### Testing a package into unstable env Create a chroot called "unstable-amd64-sbuild" > sudo sbuild-createchroot --keyring= unstable /srv/chroot/unstable http://ftp.uk.debian.org/debian +Pour lister les env chroot +> schroot -l + Puis pour se connecter -> schroot +> schroot -c name_of_chroot + +Pour tester un package +> cp *.deb /srv/chroot/unstable/tmp +> schroot -c name_of_chroot +> dpkg -i dolibarr*.deb +> sudo apt-get install -f -########################################################## + + +##### Create/Maintain TCPDF package To update tcpdf package: @@ -128,7 +142,7 @@ from origin/upstream and origin/pristine. Note: If there was errors solved manually, you may need to make a git commit * Add an entry into debian/changelog -> dh "My comment" will add entry. +> dch -v x.y.z-1 "My comment" will add entry. For example: dch -v x.y.z-1 "New upstream release." for a new version Warning: Date must have format reported by "date -R" @@ -157,7 +171,8 @@ http://packages.qa.debian.org/t/tcpdf.html * Package will be into release when test will be moved as stable. -########################################################## + +##### Create/Maintain dolibarr package To update dolibarr debian package @@ -183,7 +198,7 @@ from origin/upstream and origin/pristine. Note: If there was errors solved manually after get-orig-sources.sh, you may need to make a git commit * Add an entry into debian/changelog -> dh "My comment" will add entry. +> dch -v x.y.z-1 "My comment" will add entry. For example: dch -v x.y.z-1 "New upstream release." for a new version Then modify changelog to replace "unstable" with "UNRELEASED". diff --git a/build/obs/README b/build/obs/README index c7dda9093f1..56589299b89 100644 --- a/build/obs/README +++ b/build/obs/README @@ -23,12 +23,13 @@ To submit a snapshot for building, we should have a service file with content www.dolibarr.org http - /files/stable/package_rpm_generic/dolibarr-3.3.2-3.src.rpm + /files/stable/package_rpm_generic/dolibarr-x.y.z-3.src.rpm -How to have such a service ? -Try to make "Add file" and select Remote URL and enter http://www.dolibarr.org/files/stable/package_rpm_generic/dolibarr-3.3.2-3.src.rpm +How to have such a service file created automatically ? +Click on "Add file", then select mode "Upload From: Remote URL" +Enter the Remote URL that should looks like this: http://www.dolibarr.org/files/stable/package_rpm_generic/dolibarr-x.y.v-3.src.rpm Then add into advanded - attributes OBS:Screenshots http://www.dolibarr.org/images/dolibarr_screenshot1.png diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index 2418698e12d..609a5d27158 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -464,7 +464,11 @@ echo Restart mysql server /sbin/service mysqld restart %else %if 0%{?suse_version} +if [ -f /etc/init.d/mysqld ]; then + /etc/init.d/mysqld restart +else /sbin/service mysql restart +fi %else if [ -f /etc/init.d/mysqld ]; then /etc/init.d/mysqld restart diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index bdfb0eab0af..692114e508b 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -288,7 +288,11 @@ fi # Restart mysql echo Restart mysql -/sbin/service mysql restart +if [ -f /etc/init.d/mysqld ]; then + /etc/init.d/mysqld restart +else + /sbin/service mysql restart +fi # Show result echo diff --git a/doc/images/dolibarr_screenshot1_300x188.png b/doc/images/dolibarr_screenshot1_300x188.png new file mode 100644 index 00000000000..51c949ee67e Binary files /dev/null and b/doc/images/dolibarr_screenshot1_300x188.png differ diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 9f0f9089e76..de9fb91a6f3 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -59,19 +59,23 @@ class FormFile * @param int $size Length of input file area * @param Object $object Object to use (when attachment is done on an element) * @param string $options Options - * @param boolean $useajax Use ajax if enabled + * @param boolean $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option). 2 should never be used. + * @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__' * @return int <0 if KO, >0 if OK */ - function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=true) + function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=1, $savingdocmask='') { global $conf,$langs, $hookmanager; $hookmanager->initHooks(array('formfile')); if (! empty($conf->browser->phone)) return 0; - if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) && $useajax) + if ((! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) && $useajax) || ($useajax==2)) { - return $this->_formAjaxFileUpload($object); + // TODO: Cheeck this works with 2 forms on same page + // TODO: Cheeck this works with GED module, otherwise, force useajax to 0 + // TODO: This does not support option savingdocmask + return $this->_formAjaxFileUpload($object); } else { @@ -133,6 +137,17 @@ class FormFile $out .= ' ('.$langs->trans("UploadDisabled").')'; } $out .= ""; + + if ($savingdocmask) + { + $out .= ''; + if (! empty($options)) $out .= ''.$options.''; + $out .= ''; + $out .= ' '.$langs->trans("SaveUploadedFileWithMask", preg_replace('/__file__/',$langs->transnoentitiesnoconv("OriginFileName"),$savingdocmask), $langs->transnoentitiesnoconv("OriginFileName")); + $out .= ''; + $out .= ''; + } + $out .= ""; $out .= ''; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 4494a5d1ff8..b2a19b2dfeb 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -994,18 +994,28 @@ function dol_init_file_process($pathtoscan='') * @param int $allowoverwrite 1=Allow overwrite existing file * @param int $donotupdatesession 1=Do no edit _SESSION variable * @param string $varfiles _FILES var name + * @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__' * @return void */ -function dol_add_file_process($upload_dir,$allowoverwrite=0,$donotupdatesession=0,$varfiles='addedfile') +function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesession=0, $varfiles='addedfile', $savingdocmask='') { global $db,$user,$conf,$langs; if (! empty($_FILES[$varfiles])) // For view $_FILES[$varfiles]['error'] { - dol_syslog('dol_add_file_process upload_dir='.$upload_dir.' allowoverwrite='.$allowoverwrite.' donotupdatesession='.$donotupdatesession, LOG_DEBUG); + dol_syslog('dol_add_file_process upload_dir='.$upload_dir.' allowoverwrite='.$allowoverwrite.' donotupdatesession='.$donotupdatesession.' savingdocmask='.$savingdocmask, LOG_DEBUG); if (dol_mkdir($upload_dir) >= 0) { - $resupload = dol_move_uploaded_file($_FILES[$varfiles]['tmp_name'], $upload_dir . "/" . $_FILES[$varfiles]['name'], $allowoverwrite, 0, $_FILES[$varfiles]['error'], 0, $varfiles); + // Define $destpath (path to file including filename) and $destfile (only filename) + $destpath=$upload_dir . "/" . $_FILES[$varfiles]['name']; + $destfile=$_FILES[$varfiles]['name']; + if ($savingdocmask) + { + $destpath=$upload_dir . "/" . preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask); + $destfile=preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask); + } + + $resupload = dol_move_uploaded_file($_FILES[$varfiles]['tmp_name'], $destpath, $allowoverwrite, 0, $_FILES[$varfiles]['error'], 0, $varfiles); if (is_numeric($resupload) && $resupload > 0) { include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; @@ -1013,16 +1023,16 @@ function dol_add_file_process($upload_dir,$allowoverwrite=0,$donotupdatesession= { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); - $formmail->add_attached_files($upload_dir . "/" . $_FILES[$varfiles]['name'],$_FILES[$varfiles]['name'],$_FILES[$varfiles]['type']); + $formmail->add_attached_files($destpath, $destfile, $_FILES[$varfiles]['type']); } - if (image_format_supported($upload_dir . "/" . $_FILES[$varfiles]['name']) == 1) + if (image_format_supported($destpath) == 1) { // Create small thumbs for image (Ratio is near 16/9) // Used on logon for example - $imgThumbSmall = vignette($upload_dir . "/" . $_FILES[$varfiles]['name'], 160, 120, '_small', 50, "thumbs"); + $imgThumbSmall = vignette($destpath, 160, 120, '_small', 50, "thumbs"); // Create mini thumbs for image (Ratio is near 16/9) // Used on menu or for setup page for example - $imgThumbMini = vignette($upload_dir . "/" . $_FILES[$varfiles]['name'], 160, 120, '_mini', 50, "thumbs"); + $imgThumbMini = vignette($destpath, 160, 120, '_mini', 50, "thumbs"); } setEventMessage($langs->trans("FileTransferComplete")); diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index 8ba991076f1..12daf37060c 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -74,8 +74,9 @@ if ($object->fetch($id, $ref)) // Envoi fichier if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) { - if ($object->id > 0) { - dol_add_file_process($upload_dir, 0, 1, 'userfile'); + if ($object->id > 0) + { + dol_add_file_process($upload_dir, 0, 1, 'userfile', GETPOST('savingdocmask')); } } @@ -197,9 +198,10 @@ if ($object->id > 0) print ''; print ''; + // Affiche formulaire upload $formfile=new FormFile($db); - $formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?facid='.$object->id,'',0,0,$user->rights->fournisseur->facture->creer, 50, $object); + $formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?facid='.$object->id, '', 0, 0, $user->rights->fournisseur->facture->creer, 50, $object, '', 0, dol_sanitizeFileName($object->ref.'_'.$object->ref_supplier.'___file__')); // List of document diff --git a/htdocs/includes/tcpdf/fonts/aealarabiya.ctg.z b/htdocs/includes/tcpdf/fonts/aealarabiya.ctg.z new file mode 100644 index 00000000000..b837d85bce0 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/aealarabiya.ctg.z differ diff --git a/htdocs/includes/tcpdf/fonts/aealarabiya.z b/htdocs/includes/tcpdf/fonts/aealarabiya.z new file mode 100644 index 00000000000..fc16a2a1f92 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/aealarabiya.z differ diff --git a/htdocs/includes/tcpdf/fonts/aefurat.ctg.z b/htdocs/includes/tcpdf/fonts/aefurat.ctg.z new file mode 100644 index 00000000000..1b5a507cc4b Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/aefurat.ctg.z differ diff --git a/htdocs/includes/tcpdf/fonts/aefurat.z b/htdocs/includes/tcpdf/fonts/aefurat.z new file mode 100644 index 00000000000..5089d15afd4 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/aefurat.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavuserifi.z b/htdocs/includes/tcpdf/fonts/dejavuserifi.z new file mode 100644 index 00000000000..7c1128490ae Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavuserifi.z differ diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 32c57d91c07..613598fa68f 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -658,6 +658,8 @@ from=from toward=toward Access=Access HelpCopyToClipboard=Use Ctrl+C to copy to clipboard +SaveUploadedFileWithMask=Save file on server with name "%s" (otherwise "%s") +OriginFileName=Nom d'origine # Week day Monday=Monday diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index bb015c0ebdf..d73598447ee 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -658,6 +658,8 @@ from=de toward=vers Access=Accès HelpCopyToClipboard=Utilisez Ctrl+C pour copier dans le presse-papier +SaveUploadedFileWithMask=Sauver le fichier sur le serveur sous le nom "%s" (sinon "%s") +OriginFileName=nom du fichier source # Week day Monday=Lundi