This commit is contained in:
Laurent Destailleur 2012-01-08 00:52:07 +01:00
parent ad232fa38c
commit 2d67802938
19 changed files with 170 additions and 134 deletions

View File

@ -78,13 +78,13 @@
<!-- Tweaks to metrics --> <!-- Tweaks to metrics -->
<rule ref="Generic.Metrics.CyclomaticComplexity"> <rule ref="Generic.Metrics.CyclomaticComplexity">
<properties> <properties>
<property name="complexity" value="30" /> <property name="complexity" value="40" />
<property name="absoluteComplexity" value="100" /> <property name="absoluteComplexity" value="100" />
</properties> </properties>
</rule> </rule>
<rule ref="Generic.Metrics.NestingLevel"> <rule ref="Generic.Metrics.NestingLevel">
<properties> <properties>
<property name="nestingLevel" value="6" /> <property name="nestingLevel" value="9" />
<property name="absoluteNestingLevel" value="50" /> <property name="absoluteNestingLevel" value="50" />
</properties> </properties>
</rule> </rule>

View File

@ -78,13 +78,13 @@
<!-- Tweaks to metrics --> <!-- Tweaks to metrics -->
<rule ref="Generic.Metrics.CyclomaticComplexity"> <rule ref="Generic.Metrics.CyclomaticComplexity">
<properties> <properties>
<property name="complexity" value="30" /> <property name="complexity" value="40" />
<property name="absoluteComplexity" value="100" /> <property name="absoluteComplexity" value="100" />
</properties> </properties>
</rule> </rule>
<rule ref="Generic.Metrics.NestingLevel"> <rule ref="Generic.Metrics.NestingLevel">
<properties> <properties>
<property name="nestingLevel" value="6" /> <property name="nestingLevel" value="9" />
<property name="absoluteNestingLevel" value="50" /> <property name="absoluteNestingLevel" value="50" />
</properties> </properties>
</rule> </rule>

View File

@ -344,7 +344,7 @@ $formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/admin/security_other.php',$langs->trans("FormToTestFileUploadForm"),0,0,1); $formfile->form_attach_new_file(DOL_URL_ROOT.'/admin/security_other.php',$langs->trans("FormToTestFileUploadForm"),0,0,1);
$db->close();
llxFooter(); llxFooter();
$db->close();
?> ?>

View File

@ -467,7 +467,8 @@ class ActionComm extends CommonObject
* @param int $socid Filter by thirdparty * @param int $socid Filter by thirdparty
* @param int $fk_element Id of element action is linked to * @param int $fk_element Id of element action is linked to
* @param string $elementtype Type of element action is linked to * @param string $elementtype Type of element action is linked to
* @param filter Other filter * @param string $filter Other filter
* @return int <0 if KO, >0 if OK
*/ */
function getActions($socid=0, $fk_element=0, $elementtype='', $filter='') function getActions($socid=0, $fk_element=0, $elementtype='', $filter='')
{ {
@ -732,7 +733,7 @@ class ActionComm extends CommonObject
* @param string $type 'event' or 'journal' * @param string $type 'event' or 'journal'
* @param int $cachedelay Do not rebuild file if date older than cachedelay seconds * @param int $cachedelay Do not rebuild file if date older than cachedelay seconds
* @param string $filename Force filename * @param string $filename Force filename
* @param filters Array of filters * @param array $filters Array of filters
* @return int <0 if error, nb of events in new file if ok * @return int <0 if error, nb of events in new file if ok
*/ */
function build_exportfile($format,$type,$cachedelay,$filename,$filters) function build_exportfile($format,$type,$cachedelay,$filename,$filters)

View File

@ -160,6 +160,7 @@ class ical
* @param string $type Type * @param string $type Type
* @param string $key Key * @param string $key Key
* @param string $value Value * @param string $value Value
* @return void
*/ */
function add_to_array($type, $key, $value) function add_to_array($type, $key, $value)
{ {

View File

@ -798,12 +798,13 @@ llxFooter();
* @param int $year Year * @param int $year Year
* @param int $monthshown Current month shown in calendar view * @param int $monthshown Current month shown in calendar view
* @param string $style Style to use for this day * @param string $style Style to use for this day
* @param array $eventarray Array of events * @param array &$eventarray Array of events
* @param int $maxPrint Nb of actions to show each day on month view (0 means non limit) * @param int $maxPrint Nb of actions to show each day on month view (0 means non limit)
* @param int $maxnbofchar Nb of characters to show for event line * @param int $maxnbofchar Nb of characters to show for event line
* @param string $newparam Parameters on current URL * @param string $newparam Parameters on current URL
* @param int $showinfo Add extended information (used by day view) * @param int $showinfo Add extended information (used by day view)
* @param int $minheight Minimum height for each event. 60px by default. * @param int $minheight Minimum height for each event. 60px by default.
* @return void
*/ */
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxPrint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60) function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxPrint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60)
{ {

View File

@ -48,7 +48,8 @@ $element = GETPOST('element');
/** /**
* * \file htdocs/core/ajax/fileupload.php
* \brief This class is used to manage file upload using ajax
*/ */
class UploadHandler class UploadHandler
{ {
@ -56,6 +57,7 @@ class UploadHandler
private $fk_elment; private $fk_elment;
private $element; private $element;
/** /**
* Constructor * Constructor
* *
@ -107,7 +109,7 @@ class UploadHandler
/** /**
* Enter description here ... * Enter description here ...
* *
* @param string $file_name * @param string $file_name Filename
* @return stdClass|NULL * @return stdClass|NULL
*/ */
private function get_file_object($file_name) private function get_file_object($file_name)
@ -136,18 +138,20 @@ class UploadHandler
/** /**
* Enter description here ... * Enter description here ...
*
* @return void
*/ */
private function get_file_objects() private function get_file_objects()
{ {
return array_values(array_filter(array_map( return array_values(array_filter(array_map(array($this, 'get_file_object'), scandir($this->options['upload_dir']))));
array($this, 'get_file_object'),
scandir($this->options['upload_dir'])
)));
} }
/** /**
* Create thumbs * Create thumbs
* options is array('max_width', 'max_height') *
* @param string $file_name Filename
* @param string $options is array('max_width', 'max_height')
* @return void
*/ */
private function create_scaled_image($file_name, $options) private function create_scaled_image($file_name, $options)
{ {
@ -177,9 +181,9 @@ class UploadHandler
/** /**
* Enter description here ... * Enter description here ...
* *
* @param unknown_type $uploaded_file * @param string $uploaded_file Uploade file
* @param unknown_type $file * @param string $file File
* @param unknown_type $error * @param string $error Error
* @return unknown|string * @return unknown|string
*/ */
private function has_error($uploaded_file, $file, $error) private function has_error($uploaded_file, $file, $error)
@ -216,11 +220,11 @@ class UploadHandler
/** /**
* Enter description here ... * Enter description here ...
* *
* @param unknown_type $uploaded_file * @param string $uploaded_file Uploade file
* @param unknown_type $name * @param string $name Name
* @param unknown_type $size * @param int $size Size
* @param unknown_type $type * @param string $type Type
* @param unknown_type $error * @param string $error Error
* @return stdClass * @return stdClass
*/ */
private function handle_file_upload($uploaded_file, $name, $size, $type, $error) private function handle_file_upload($uploaded_file, $name, $size, $type, $error)
@ -284,7 +288,9 @@ class UploadHandler
} }
/** /**
* Enter description here ... * Output data
*
* @return void
*/ */
public function get() public function get()
{ {
@ -300,7 +306,9 @@ class UploadHandler
} }
/** /**
* Enter description here ... * Output data
*
* @return void
*/ */
public function post() public function post()
{ {
@ -317,24 +325,18 @@ class UploadHandler
foreach ($upload['tmp_name'] as $index => $value) { foreach ($upload['tmp_name'] as $index => $value) {
$info[] = $this->handle_file_upload( $info[] = $this->handle_file_upload(
$upload['tmp_name'][$index], $upload['tmp_name'][$index],
isset($_SERVER['HTTP_X_FILE_NAME']) ? isset($_SERVER['HTTP_X_FILE_NAME']) ? $_SERVER['HTTP_X_FILE_NAME'] : $upload['name'][$index],
$_SERVER['HTTP_X_FILE_NAME'] : $upload['name'][$index], isset($_SERVER['HTTP_X_FILE_SIZE']) ? $_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'][$index],
isset($_SERVER['HTTP_X_FILE_SIZE']) ? isset($_SERVER['HTTP_X_FILE_TYPE']) ? $_SERVER['HTTP_X_FILE_TYPE'] : $upload['type'][$index],
$_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'][$index],
isset($_SERVER['HTTP_X_FILE_TYPE']) ?
$_SERVER['HTTP_X_FILE_TYPE'] : $upload['type'][$index],
$upload['error'][$index] $upload['error'][$index]
); );
} }
} else { } else {
$info[] = $this->handle_file_upload( $info[] = $this->handle_file_upload(
$upload['tmp_name'], $upload['tmp_name'],
isset($_SERVER['HTTP_X_FILE_NAME']) ? isset($_SERVER['HTTP_X_FILE_NAME']) ? $_SERVER['HTTP_X_FILE_NAME'] : $upload['name'],
$_SERVER['HTTP_X_FILE_NAME'] : $upload['name'], isset($_SERVER['HTTP_X_FILE_SIZE']) ? $_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'],
isset($_SERVER['HTTP_X_FILE_SIZE']) ? isset($_SERVER['HTTP_X_FILE_TYPE']) ? $_SERVER['HTTP_X_FILE_TYPE'] : $upload['type'],
$_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'],
isset($_SERVER['HTTP_X_FILE_TYPE']) ?
$_SERVER['HTTP_X_FILE_TYPE'] : $upload['type'],
$upload['error'] $upload['error']
); );
} }
@ -349,7 +351,9 @@ class UploadHandler
} }
/** /**
* Enter description here ... * Delete uploaded file
*
* @return void
*/ */
public function delete() public function delete()
{ {

View File

@ -116,7 +116,7 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town']))
$row_array['value'] = $row['town']; $row_array['value'] = $row['town'];
$row_array['zipcode'] = $row['zip']; $row_array['zipcode'] = $row['zip'];
} }
$row_array['departement_id'] = $row['fk_county']; // TODO deprecated $row_array['departement_id'] = $row['fk_county']; // deprecated
$row_array['selectcountry_id'] = $row['fk_country']; $row_array['selectcountry_id'] = $row['fk_country'];
$row_array['state_id'] = $row['fk_county']; $row_array['state_id'] = $row['fk_county'];

View File

@ -58,12 +58,19 @@ class FormFile
* @param int $sectionid If upload must be done inside a particular ECM section * @param int $sectionid If upload must be done inside a particular ECM section
* @param int $perm Value of permission to allow upload * @param int $perm Value of permission to allow upload
* @param int $size Length of input file area * @param int $size Length of input file area
* @param Object $object Object to use (when attachment is done on an element)
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50) function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='')
{ {
global $conf,$langs; global $conf,$langs;
if ($conf->global->MAIN_USE_JQUERY_FILEUPLOAD)
{
return $this->_form_ajaxfileupload($object);
}
else
{
$maxlength=$size; $maxlength=$size;
print "\n\n<!-- Start form attach new file -->\n"; print "\n\n<!-- Start form attach new file -->\n";
@ -126,6 +133,7 @@ class FormFile
return 1; return 1;
} }
}
/** /**
* Show the box with list of available documents for object * Show the box with list of available documents for object
@ -723,12 +731,13 @@ class FormFile
} }
/** /**
* Show form to upload a new file with jquery fileupload * Show form to upload a new file with jquery fileupload.
* This form use the fileupload.php file.
* *
* @param Object $object Object to use * @param Object $object Object to use
* @return void * @return void
*/ */
function form_ajaxfileupload($object) private function _form_ajaxfileupload($object)
{ {
global $langs; global $langs;

View File

@ -51,7 +51,7 @@ class Expedition extends CommonObject
var $origin; var $origin;
var $origin_id; var $origin_id;
var $lines=array(); var $lines=array();
var $expedition_method_id; // TODO deprecated var $expedition_method_id; // deprecated
var $shipping_method_id; var $shipping_method_id;
var $tracking_number; var $tracking_number;
var $tracking_url; var $tracking_url;

View File

@ -69,11 +69,12 @@ class Export
{ {
global $langs,$conf,$mysoc; global $langs,$conf,$mysoc;
dol_syslog("Export::load_arrays user=".$user->id." filter=".$filter); dol_syslog(get_class($this)."::load_arrays user=".$user->id." filter=".$filter);
$var=true; $var=true;
$i=0; $i=0;
// Define list of modules directories into modulesdir
foreach ($conf->file->dol_document_root as $type => $dirroot) foreach ($conf->file->dol_document_root as $type => $dirroot)
{ {
$modulesdir[] = $dirroot . "/core/modules/"; $modulesdir[] = $dirroot . "/core/modules/";
@ -188,7 +189,7 @@ class Export
$this->array_export_sql_end[$i]=$module->export_sql_end[$r]; $this->array_export_sql_end[$i]=$module->export_sql_end[$r];
//$this->array_export_sql[$i]=$module->export_sql[$r]; //$this->array_export_sql[$i]=$module->export_sql[$r];
dol_syslog("Export loaded for module ".$modulename." with index ".$i.", dataset=".$module->export_code[$r].", nb of fields=".count($module->export_fields_code[$r])); dol_syslog(get_class($this)."::load_arrays loaded for module ".$modulename." with index ".$i.", dataset=".$module->export_code[$r].", nb of fields=".count($module->export_fields_code[$r]));
$i++; $i++;
// } // }
} }

View File

@ -800,8 +800,9 @@ llxFooter();
/** /**
* Return table name of an alias. For this, we look for the "tablename as alias" in sql string. * Return table name of an alias. For this, we look for the "tablename as alias" in sql string.
* *
* @param code Alias.Fieldname * @param string $code Alias.Fieldname
* @param sqlmaxforexport SQL request to parse * @param string $sqlmaxforexport SQL request to parse
* @return string Table name of field
*/ */
function getablenamefromfield($code,$sqlmaxforexport) function getablenamefromfield($code,$sqlmaxforexport)
{ {

View File

@ -207,9 +207,9 @@ class Fichinter extends CommonObject
/** /**
* Fetch a intervention * Fetch a intervention
* *
* @param int $id Id of intervention * @param int $rowid Id of intervention
* @param string $ref Ref of intervention * @param string $ref Ref of intervention
* @return int <0 if ko, >0 if ok * @return int <0 if KO, >0 if OK
*/ */
function fetch($rowid,$ref='') function fetch($rowid,$ref='')
{ {
@ -389,6 +389,7 @@ class Fichinter extends CommonObject
/** /**
* Returns the label status * Returns the label status
*
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label * @return string Label
*/ */
@ -445,7 +446,7 @@ class Fichinter extends CommonObject
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only * @param int $withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto=0) function getNomUrl($withpicto=0)
@ -520,7 +521,8 @@ class Fichinter extends CommonObject
/** /**
* Information sur l'objet fiche intervention * Information sur l'objet fiche intervention
* *
* @param int $id id de la fiche d'intervention * @param int $id Id de la fiche d'intervention
* @return void
*/ */
function info($id) function info($id)
{ {
@ -570,7 +572,8 @@ class Fichinter extends CommonObject
/** /**
* Delete intervetnion * Delete intervetnion
* *
* @param User $user Object user who deletes * @param User $user Object user who delete
* @return int <0 if KO, >0 if OK
*/ */
function delete($user) function delete($user)
{ {
@ -875,8 +878,9 @@ class FichinterLigne
/** /**
* Constructeur d'objets ligne d'intervention * Constructor
* @param DoliDB $DB handler d'acces base de donnee *
* @param DoliDB $DB Database handler
*/ */
function FichinterLigne($DB) function FichinterLigne($DB)
{ {
@ -886,7 +890,8 @@ class FichinterLigne
/** /**
* Retrieve the line of intervention * Retrieve the line of intervention
* *
* @param int $rowid line id * @param int $rowid Line id
* @return int <0 if KO, >0 if OK
*/ */
function fetch($rowid) function fetch($rowid)
{ {

View File

@ -36,7 +36,17 @@ define("NOLOGIN",1); // This means this output page does not require to be logg
define("NOCSRFCHECK",1); // We accept to go on this page from external web site. define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
// C'est un wrapper, donc header vierge // C'est un wrapper, donc header vierge
/**
* Header function
*
* @return void
*/
function llxHeaderVierge() { print '<html><title>Export agenda cal</title><body>'; } function llxHeaderVierge() { print '<html><title>Export agenda cal</title><body>'; }
/**
* Footer function
*
* @return void
*/
function llxFooterVierge() { print '</body></html>'; } function llxFooterVierge() { print '</body></html>'; }
require("../../main.inc.php"); require("../../main.inc.php");

View File

@ -340,8 +340,8 @@ llxFooterVierge();
/** /**
* Show header for demo * Show header for demo
* *
* @param string $title * @param string $title Title
* @param string $head * @param string $head Head string
* @return void * @return void
*/ */
function llxHeaderVierge($title, $head = "") function llxHeaderVierge($title, $head = "")

View File

@ -25,7 +25,17 @@ define("NOLOGIN",1); // This means this output page does not require to be logg
define("NOCSRFCHECK",1); // We accept to go on this page from external web site. define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
// C'est un wrapper, donc header vierge // C'est un wrapper, donc header vierge
/**
* Header function
*
* @return void
*/
function llxHeaderVierge() { print '<html><title>Export agenda cal</title><body>'; } function llxHeaderVierge() { print '<html><title>Export agenda cal</title><body>'; }
/**
* Header function
*
* @return void
*/
function llxFooterVierge() { print '</body></html>'; } function llxFooterVierge() { print '</body></html>'; }
require("../../main.inc.php"); require("../../main.inc.php");

View File

@ -211,14 +211,7 @@ if ($socid > 0)
$formfile=new FormFile($db); $formfile=new FormFile($db);
// Show upload form // Show upload form
if ($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) $formfile->form_attach_new_file($_SERVER["PHP_SELF"].'?socid='.$socid,'',0,0,$user->rights->societe->creer,50,$object);
{
$formfile->form_ajaxfileupload($object);
}
else
{
$formfile->form_attach_new_file($_SERVER["PHP_SELF"].'?socid='.$socid,'',0,0,$user->rights->societe->creer);
}
// List of document // List of document
$param='&socid='.$object->id; $param='&socid='.$object->id;