From 513413da164f33c0e5522f868c78ed7013c9952d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 May 2012 11:53:53 +0200 Subject: [PATCH 1/3] Checkstyle --- htdocs/core/lib/date.lib.php | 6 +++--- htdocs/core/lib/functions.lib.php | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 2f5b983c468..bba1f48a48b 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -642,21 +642,21 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR') date("m", $date_paques), date("d", $date_paques) + 38, date("Y", $date_paques) - ); + ); $jour_ascension = date("d", $date_ascension); $mois_ascension = date("m", $date_ascension); if($jour_ascension == $jour && $mois_ascension == $mois) $ferie=true; //Ascension // Calcul de Pentecote (11 jours apres Paques) - $date_pentecote = mktime( + $date_pentecote = mktime( date("H", $date_ascension), date("i", $date_ascension), date("s", $date_ascension), date("m", $date_ascension), date("d", $date_ascension) + 11, date("Y", $date_ascension) - ); + ); $jour_pentecote = date("d", $date_pentecote); $mois_pentecote = date("m", $date_pentecote); if($jour_pentecote == $jour && $mois_pentecote == $mois) $ferie=true; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d683a09bd75..d63104c5fe6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -373,18 +373,18 @@ function dol_string_unaccent($str) { $string = strtr( $str, - "\xC0\xC1\xC2\xC3\xC5\xC7 - \xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1 - \xD2\xD3\xD4\xD5\xD8\xD9\xDA\xDB\xDD - \xE0\xE1\xE2\xE3\xE5\xE7\xE8\xE9\xEA\xEB - \xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF8 - \xF9\xFA\xFB\xFD\xFF", - "AAAAAC - EEEEIIIIDN - OOOOOUUUY - aaaaaceeee - iiiidnooooo - uuuyy" + "\xC0\xC1\xC2\xC3\xC5\xC7 + \xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1 + \xD2\xD3\xD4\xD5\xD8\xD9\xDA\xDB\xDD + \xE0\xE1\xE2\xE3\xE5\xE7\xE8\xE9\xEA\xEB + \xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF8 + \xF9\xFA\xFB\xFD\xFF", + "AAAAAC + EEEEIIIIDN + OOOOOUUUY + aaaaaceeee + iiiidnooooo + uuuyy" ); $string = strtr($string, array("\xC4"=>"Ae", "\xC6"=>"AE", "\xD6"=>"Oe", "\xDC"=>"Ue", "\xDE"=>"TH", "\xDF"=>"ss", "\xE4"=>"ae", "\xE6"=>"ae", "\xF6"=>"oe", "\xFC"=>"ue", "\xFE"=>"th")); return $string; From 2c21700933634534c5717056e93b84e26faeef44 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 May 2012 11:54:19 +0200 Subject: [PATCH 2/3] Checkstyle --- htdocs/core/lib/functions.lib.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d63104c5fe6..47f13598291 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -449,7 +449,6 @@ function dol_escape_htmltag($stringtoescape,$keepb=0) * this, use logging to files instead of syslog (see setup of module). * Note: If SYSLOG_FILE_NO_ERROR defined, we never output any error message when writing to log fails. * Note: You can get log message into html sources by adding parameter &logtohtml=1 (constant MAIN_LOGTOHTML must be set) - * * This function works only if syslog module is enabled. * This must not use any call to other function calling dol_syslog (avoid infinite loop). * From 516be434048fdf4725245ba309fbb5e8952328f9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 25 May 2012 20:49:45 +0200 Subject: [PATCH 3/3] Fix: jquery fileupload broken feature --- htdocs/adherents/document.php | 2 +- htdocs/comm/propal/document.php | 2 +- htdocs/commande/document.php | 2 +- htdocs/compta/facture/document.php | 2 +- htdocs/contrat/document.php | 2 +- htdocs/core/ajax/fileupload.php | 20 ++++++++++++-------- htdocs/core/class/html.formfile.class.php | 3 ++- htdocs/fichinter/document.php | 2 +- htdocs/fourn/commande/document.php | 2 +- htdocs/fourn/facture/document.php | 2 +- htdocs/product/document.php | 2 +- htdocs/projet/document.php | 2 +- htdocs/projet/tasks/document.php | 2 +- 13 files changed, 25 insertions(+), 20 deletions(-) diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 5552cc84bd4..e500c5e8804 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -209,7 +209,7 @@ if ($id > 0) // Affiche formulaire upload $formfile=new FormFile($db); - $formfile->form_attach_new_file(DOL_URL_ROOT.'/adherents/document.php?id='.$member->id,'',0,0,$user->rights->adherent->creer); + $formfile->form_attach_new_file(DOL_URL_ROOT.'/adherents/document.php?id='.$member->id,'',0,0,$user->rights->adherent->creer,50,$object); // List of document diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 4a2ea5d326d..d7dcaa4c548 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -187,7 +187,7 @@ if ($id > 0 || ! empty($ref)) // Affiche formulaire upload $formfile=new FormFile($db); - $formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id,'',0,0,$user->rights->propale->creer); + $formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id,'',0,0,$user->rights->propale->creer,50,$object); // List of document diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index fabaa069a9b..58cbe37ede0 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -172,7 +172,7 @@ if ($id > 0 || ! empty($ref)) // Affiche formulaire upload $formfile=new FormFile($db); - $formfile->form_attach_new_file(DOL_URL_ROOT.'/commande/document.php?id='.$object->id,'',0,0,$user->rights->commande->creer); + $formfile->form_attach_new_file(DOL_URL_ROOT.'/commande/document.php?id='.$object->id,'',0,0,$user->rights->commande->creer,50,$object); // List of document diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 0d6edf0db5f..6a940988dfc 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -202,7 +202,7 @@ if ($id > 0 || ! empty($ref)) // Affiche formulaire upload $formfile=new FormFile($db); - $formfile->form_attach_new_file(DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id,'',0,0,$user->rights->facture->creer); + $formfile->form_attach_new_file(DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id,'',0,0,$user->rights->facture->creer,50,$object); // List of document diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 2aab133d065..cb270c042d8 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -156,7 +156,7 @@ if ($contrat->id) // Affiche formulaire upload $formfile=new FormFile($db); - $formfile->form_attach_new_file(DOL_URL_ROOT.'/contrat/document.php?id='.$contrat->id,'',0,0,$user->rights->contrat->creer); + $formfile->form_attach_new_file(DOL_URL_ROOT.'/contrat/document.php?id='.$contrat->id,'',0,0,$user->rights->contrat->creer,50,$object); // List of document diff --git a/htdocs/core/ajax/fileupload.php b/htdocs/core/ajax/fileupload.php index 76ac6499cfa..ca06febbf13 100644 --- a/htdocs/core/ajax/fileupload.php +++ b/htdocs/core/ajax/fileupload.php @@ -43,8 +43,9 @@ error_reporting(E_ALL | E_STRICT); //print_r($_GET); //print 'upload_dir='.GETPOST('upload_dir'); -$fk_element = GETPOST('fk_element'); -$element = GETPOST('element'); +$fk_element = GETPOST('fk_element','int'); +$element = GETPOST('element','alpha'); +$element_ref=GETPOST('element_ref','alpha'); /** @@ -56,6 +57,7 @@ class UploadHandler private $_options; private $_fk_element; private $_element; + private $_element_ref; /** @@ -64,19 +66,21 @@ class UploadHandler * @param array $options Options array * @param int $fk_element fk_element * @param string $element element + * @param string $element_ref element ref */ - function __construct($options=null,$fk_element=null,$element=null) + function __construct($options=null,$fk_element=null,$element=null,$element_ref=null) { global $conf; $this->_fk_element=$fk_element; $this->_element=$element; + $this->_element_ref=$element_ref; $this->_options = array( 'script_url' => $_SERVER['PHP_SELF'], - 'upload_dir' => $conf->$element->dir_output . '/' . $fk_element . '/', - 'upload_url' => DOL_URL_ROOT.'/document.php?modulepart='.$element.'&attachment=1&file=/'.$fk_element.'/', + 'upload_dir' => $conf->$element->dir_output . '/' . $element_ref . '/', + 'upload_url' => DOL_URL_ROOT.'/document.php?modulepart='.$element.'&attachment=1&file=/'.$element_ref.'/', 'param_name' => 'files', // The php.ini settings upload_max_filesize and post_max_size // take precedence over the following max_file_size setting: @@ -96,8 +100,8 @@ class UploadHandler ), */ 'thumbs' => array( - 'upload_dir' => $conf->$element->dir_output . '/' . $fk_element . '/thumbs/', - 'upload_url' => DOL_URL_ROOT.'/document.php?modulepart='.$element.'&attachment=1&file=/'.$fk_element.'/thumbs/' + 'upload_dir' => $conf->$element->dir_output . '/' . $element_ref . '/thumbs/', + 'upload_url' => DOL_URL_ROOT.'/document.php?modulepart='.$element.'&attachment=1&file=/'.$element_ref.'/thumbs/' ) ) ); @@ -380,7 +384,7 @@ class UploadHandler * View */ -$upload_handler = new UploadHandler(null,$fk_element,$element); +$upload_handler = new UploadHandler(null,$fk_element,$element,$element_ref); header('Pragma: no-cache'); header('Cache-Control: private, no-cache'); diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index b6b47143a30..472e99cb05e 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -839,7 +839,7 @@ class FormFile // Load existing files: // TODO do not delete if (1 == 2) { - $.getJSON($("#fileupload form").prop("action"), { fk_element: "'.$object->id.'", element: "'.$object->element.'"}, function (files) { + $.getJSON($("#fileupload form").prop("action"), { fk_element: "'.$object->id.'", element: "'.$object->element.'", element_ref: "'.$object->ref.'"}, function (files) { var fu = $("#fileupload").data("fileupload"); fu._adjustMaxNumberOfFiles(-files.length); fu._renderDownload(files) @@ -867,6 +867,7 @@ class FormFile print '
'; print ''; print ''; + print ''; print '
'; print ''; print '