Fix: Checkstyle

This commit is contained in:
Laurent Destailleur 2012-12-19 20:59:08 +01:00
parent 78a1354a52
commit e39ec132e5
9 changed files with 162 additions and 123 deletions

View File

@ -528,6 +528,7 @@ class ActionComm extends CommonObject
/**
* Load all objects with filters
*
* @param DoliDb $db Database handler
* @param int $socid Filter by thirdparty
* @param int $fk_element Id of element action is linked to
* @param string $elementtype Type of element action is linked to

View File

@ -25,27 +25,27 @@
function GetFolders( $resourceType, $currentFolder )
{
// Map the virtual path to the local server path.
$sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFolders' );
$sServerDir = ServerMapFolder($resourceType, $currentFolder, 'GetFolders');
// Array that will hold the folders names.
$aFolders = array();
$oCurrentFolder = @opendir( $sServerDir );
$oCurrentFolder = @opendir($sServerDir);
if ($oCurrentFolder !== false)
{
while ( $sFile = readdir( $oCurrentFolder ) )
while ( $sFile = readdir($oCurrentFolder) )
{
if ( $sFile != '.' && $sFile != '..' && is_dir( $sServerDir . $sFile ) )
$aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ;
if ( $sFile != '.' && $sFile != '..' && is_dir($sServerDir . $sFile) )
$aFolders[] = '<Folder name="' . ConvertToXmlAttribute($sFile) . '" />' ;
}
closedir( $oCurrentFolder );
closedir($oCurrentFolder);
}
// Open the "Folders" node.
echo "<Folders>" ;
natcasesort( $aFolders );
natcasesort($aFolders);
foreach ( $aFolders as $sFolder )
echo $sFolder ;
@ -56,44 +56,44 @@ function GetFolders( $resourceType, $currentFolder )
function GetFoldersAndFiles( $resourceType, $currentFolder )
{
// Map the virtual path to the local server path.
$sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFoldersAndFiles' );
$sServerDir = ServerMapFolder($resourceType, $currentFolder, 'GetFoldersAndFiles');
// Arrays that will hold the folders and files names.
$aFolders = array();
$aFiles = array();
$oCurrentFolder = @opendir( $sServerDir );
$oCurrentFolder = @opendir($sServerDir);
if ($oCurrentFolder !== false)
{
while ( $sFile = readdir( $oCurrentFolder ) )
while ( $sFile = readdir($oCurrentFolder) )
{
if ( $sFile != '.' && $sFile != '..' )
{
if ( is_dir( $sServerDir . $sFile ) )
$aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ;
if ( is_dir($sServerDir . $sFile) )
$aFolders[] = '<Folder name="' . ConvertToXmlAttribute($sFile) . '" />' ;
else
{
$iFileSize = @filesize( $sServerDir . $sFile );
$iFileSize = @filesize($sServerDir . $sFile);
if ( !$iFileSize ) {
$iFileSize = 0 ;
}
if ( $iFileSize > 0 )
{
$iFileSize = round( $iFileSize / 1024 );
$iFileSize = round($iFileSize / 1024);
if ( $iFileSize < 1 )
$iFileSize = 1 ;
}
$aFiles[] = '<File name="' . ConvertToXmlAttribute( $sFile ) . '" size="' . $iFileSize . '" />' ;
$aFiles[] = '<File name="' . ConvertToXmlAttribute($sFile) . '" size="' . $iFileSize . '" />' ;
}
}
}
closedir( $oCurrentFolder );
closedir($oCurrentFolder);
}
// Send the folders
natcasesort( $aFolders );
natcasesort($aFolders);
echo '<Folders>' ;
foreach ( $aFolders as $sFolder )
@ -102,7 +102,7 @@ function GetFoldersAndFiles( $resourceType, $currentFolder )
echo '</Folders>' ;
// Send the files
natcasesort( $aFiles );
natcasesort($aFiles);
echo '<Files>' ;
foreach ( $aFiles as $sFiles )
@ -122,20 +122,20 @@ function CreateFolder( $resourceType, $currentFolder )
if ( isset( $_GET['NewFolderName'] ) )
{
$sNewFolderName = $_GET['NewFolderName'] ;
$sNewFolderName = SanitizeFolderName( $sNewFolderName );
$sNewFolderName = SanitizeFolderName($sNewFolderName);
if ( strpos( $sNewFolderName, '..' ) !== FALSE )
if (strpos($sNewFolderName, '..') !== FALSE)
$sErrorNumber = '102' ; // Invalid folder name.
else
{
// Map the virtual path to the local server path of the current folder.
$sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'CreateFolder' );
$sServerDir = ServerMapFolder($resourceType, $currentFolder, 'CreateFolder');
if ( is_writable( $sServerDir ) )
if ( is_writable($sServerDir) )
{
$sServerDir .= $sNewFolderName ;
$sErrorMsg = CreateServerFolder( $sServerDir );
$sErrorMsg = CreateServerFolder($sServerDir);
switch ( $sErrorMsg )
{
@ -172,8 +172,8 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
$sErrorNumber = '0' ;
$sFileName = '' ;
if ( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] )
# This is for the QuickUpload tab box
if ( isset( $_FILES['NewFile'] ) && !is_null($_FILES['NewFile']['tmp_name'])
// This is for the QuickUpload tab box
or (isset($_FILES['upload']) and !is_null($_FILES['upload']['tmp_name'])))
{
global $Config ;
@ -181,21 +181,21 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
$oFile = isset($_FILES['NewFile']) ? $_FILES['NewFile'] : $_FILES['upload'];
// Map the virtual path to the local server path.
$sServerDir = ServerMapFolder( $resourceType, $currentFolder, $sCommand );
$sServerDir = ServerMapFolder($resourceType, $currentFolder, $sCommand);
// Get the uploaded file name.
$sFileName = $oFile['name'] ;
$sFileName = SanitizeFileName( $sFileName );
$sFileName = SanitizeFileName($sFileName);
$sOriginalFileName = $sFileName ;
// Get the extension.
$sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) );
$sExtension = strtolower( $sExtension );
$sExtension = substr($sFileName, (strrpos($sFileName, '.') + 1));
$sExtension = strtolower($sExtension);
if ( isset( $Config['SecureImageUploads'] ) )
{
if ( ( $isImageValid = IsImageValid( $oFile['tmp_name'], $sExtension ) ) === false )
if ( ( $isImageValid = IsImageValid($oFile['tmp_name'], $sExtension) ) === false )
{
$sErrorNumber = '202' ;
}
@ -203,15 +203,15 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
if ( isset( $Config['HtmlExtensions'] ) )
{
if ( !IsHtmlExtension( $sExtension, $Config['HtmlExtensions'] ) &&
( $detectHtml = DetectHtml( $oFile['tmp_name'] ) ) === true )
if (!IsHtmlExtension($sExtension, $Config['HtmlExtensions']) &&
($detectHtml = DetectHtml($oFile['tmp_name'])) === true)
{
$sErrorNumber = '202' ;
}
}
// Check if it is an allowed extension.
if ( !$sErrorNumber && IsAllowedExt( $sExtension, $resourceType ) )
if ( !$sErrorNumber && IsAllowedExt($sExtension, $resourceType) )
{
$iCounter = 0 ;
@ -219,17 +219,17 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
{
$sFilePath = $sServerDir . $sFileName ;
if ( is_file( $sFilePath ) )
if ( is_file($sFilePath) )
{
$iCounter++ ;
$sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ;
$sFileName = RemoveExtension($sOriginalFileName) . '(' . $iCounter . ').' . $sExtension ;
$sErrorNumber = '201' ;
}
else
{
move_uploaded_file( $oFile['tmp_name'], $sFilePath );
move_uploaded_file($oFile['tmp_name'], $sFilePath);
if ( is_file( $sFilePath ) )
if ( is_file($sFilePath) )
{
if ( isset( $Config['ChmodOnUpload'] ) && !$Config['ChmodOnUpload'] )
{
@ -244,25 +244,25 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
}
$oldumask = umask(0);
chmod( $sFilePath, $permissions );
umask( $oldumask );
chmod($sFilePath, $permissions);
umask($oldumask);
}
break ;
}
}
if ( file_exists( $sFilePath ) )
if ( file_exists($sFilePath) )
{
//previous checks failed, try once again
if ( isset( $isImageValid ) && $isImageValid === -1 && IsImageValid( $sFilePath, $sExtension ) === false )
if ( isset( $isImageValid ) && $isImageValid === -1 && IsImageValid($sFilePath, $sExtension) === false )
{
@unlink( $sFilePath );
@unlink($sFilePath);
$sErrorNumber = '202' ;
}
else if ( isset( $detectHtml ) && $detectHtml === -1 && DetectHtml( $sFilePath ) === true )
else if ( isset( $detectHtml ) && $detectHtml === -1 && DetectHtml($sFilePath) === true )
{
@unlink( $sFilePath );
@unlink($sFilePath);
$sErrorNumber = '202' ;
}
}
@ -274,8 +274,8 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
$sErrorNumber = '202' ;
$sFileUrl = CombinePaths( GetResourceTypePath( $resourceType, $sCommand ) , $currentFolder );
$sFileUrl = CombinePaths( $sFileUrl, $sFileName );
$sFileUrl = CombinePaths(GetResourceTypePath($resourceType, $sCommand), $currentFolder);
$sFileUrl = CombinePaths($sFileUrl, $sFileName);
// DOL_CHANGE
@ -283,18 +283,18 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
if($CKEcallback == '')
{
// this line already exists so wrap the if block around it
SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName );
SendUploadResults($sErrorNumber, $sFileUrl, $sFileName);
}
else
{
//issue the CKEditor Callback
SendCKEditorResults (
$CKEcallback,
$sFileUrl,
($sErrorNumber != 0 ? 'Error '. $sErrorNumber. ' upload failed.' : 'Upload Successful')
);
}
{
//issue the CKEditor Callback
SendCKEditorResults(
$CKEcallback,
$sFileUrl,
($sErrorNumber != 0 ? 'Error '. $sErrorNumber. ' upload failed.' : 'Upload Successful')
);
}
exit ;
exit;
}
?>

View File

@ -22,13 +22,27 @@
* Utility functions for the File Manager Connector for PHP.
*/
function RemoveFromStart( $sourceString, $charToRemove )
/**
* RemoveFromStart
*
* @param string $sourceString Source
* @param string $charToRemove Char to remove
* @return string Result
*/
function RemoveFromStart($sourceString, $charToRemove)
{
$sPattern = '|^' . $charToRemove . '+|' ;
return preg_replace($sPattern, '', $sourceString);
}
function RemoveFromEnd( $sourceString, $charToRemove)
/**
* RemoveFromEnd
*
* @param string $sourceString Source
* @param string $charToRemove Rhar to remove
* @return string Result
*/
function RemoveFromEnd($sourceString, $charToRemove)
{
$sPattern = '|' . $charToRemove . '+$|' ;
return preg_replace($sPattern, '', $sourceString);
@ -37,12 +51,12 @@ function RemoveFromEnd( $sourceString, $charToRemove)
/**
* FindBadUtf8
*
* @param unknown_type $string String
* @param unknown_type $string String
* @return boolean
*/
function FindBadUtf8( $string )
function FindBadUtf8($string)
{
$regex =
'([\x00-\x7F]'.
$regex = '([\x00-\x7F]'.
'|[\xC2-\xDF][\x80-\xBF]'.
'|\xE0[\xA0-\xBF][\x80-\xBF]'.
'|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'.
@ -65,11 +79,12 @@ function FindBadUtf8( $string )
/**
* ConvertToXmlAttribute
*
* @param unknown_type $value
* @param string $value Value
* @return string
*/
function ConvertToXmlAttribute( $value )
{
if ( defined( 'PHP_OS' ) )
if ( defined('PHP_OS') )
{
$os = PHP_OS ;
}
@ -78,35 +93,35 @@ function ConvertToXmlAttribute( $value )
$os = php_uname();
}
if ( strtoupper( substr( $os, 0, 3 ) ) === 'WIN' || FindBadUtf8( $value ) )
if (strtoupper(substr($os, 0, 3)) === 'WIN' || FindBadUtf8($value))
{
return ( utf8_encode( htmlspecialchars( $value ) ) );
return (utf8_encode(htmlspecialchars($value)));
}
else
{
return ( htmlspecialchars( $value ) );
return (htmlspecialchars($value));
}
}
/**
* Check whether given extension is in html etensions list
*
* @param string $ext
* @param array $formExtensions
* @return boolean
* @param string $ext Extension
* @param array $formExtensions Array of extensions
* @return boolean
*/
function IsHtmlExtension( $ext, $formExtensions )
{
if ( !$formExtensions || !is_array( $formExtensions ) )
if (!$formExtensions || !is_array($formExtensions) )
{
return false ;
}
$lcaseHtmlExtensions = array();
foreach ( $formExtensions as $key => $val )
{
$lcaseHtmlExtensions[$key] = strtolower( $val );
$lcaseHtmlExtensions[$key] = strtolower($val);
}
return in_array( $ext, $lcaseHtmlExtensions );
return in_array($ext, $lcaseHtmlExtensions);
}
/**
@ -119,28 +134,28 @@ function IsHtmlExtension( $ext, $formExtensions )
*/
function DetectHtml( $filePath )
{
$fp = @fopen( $filePath, 'rb' );
$fp = @fopen($filePath, 'rb');
//open_basedir restriction, see #1906
if ( $fp === false || !flock( $fp, LOCK_SH ) )
if ( $fp === false || !flock($fp, LOCK_SH) )
{
return -1 ;
}
$chunk = fread( $fp, 1024 );
flock( $fp, LOCK_UN );
fclose( $fp );
$chunk = fread($fp, 1024);
flock($fp, LOCK_UN);
fclose($fp);
$chunk = strtolower( $chunk );
$chunk = strtolower($chunk);
if (!$chunk)
{
return false ;
}
$chunk = trim( $chunk );
$chunk = trim($chunk);
if ( preg_match( "/<!DOCTYPE\W*X?HTML/sim", $chunk ) )
if ( preg_match("/<!DOCTYPE\W*X?HTML/sim", $chunk) )
{
return true;
}
@ -149,14 +164,14 @@ function DetectHtml( $filePath )
foreach( $tags as $tag )
{
if( false !== strpos( $chunk, $tag ) )
if( false !== strpos($chunk, $tag) )
{
return true ;
}
}
//type = javascript
if ( preg_match( '!type\s*=\s*[\'"]?\s*(?:\w*/)?(?:ecma|java)!sim', $chunk ) )
if ( preg_match('!type\s*=\s*[\'"]?\s*(?:\w*/)?(?:ecma|java)!sim', $chunk) )
{
return true ;
}
@ -164,13 +179,13 @@ function DetectHtml( $filePath )
//href = javascript
//src = javascript
//data = javascript
if ( preg_match( '!(?:href|src|data)\s*=\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk ) )
if ( preg_match('!(?:href|src|data)\s*=\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk) )
{
return true ;
}
//url(javascript
if ( preg_match( '!url\s*\(\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk ) )
if ( preg_match('!url\s*\(\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk) )
{
return true ;
}
@ -196,16 +211,16 @@ function IsImageValid( $filePath, $extension )
$imageCheckExtensions = array('gif', 'jpeg', 'jpg', 'png', 'swf', 'psd', 'bmp', 'iff');
// version_compare is available since PHP4 >= 4.0.7
if ( function_exists( 'version_compare' ) ) {
if ( function_exists('version_compare') ) {
$sCurrentVersion = phpversion();
if ( version_compare( $sCurrentVersion, "4.2.0" ) >= 0 ) {
if ( version_compare($sCurrentVersion, "4.2.0") >= 0 ) {
$imageCheckExtensions[] = "tiff";
$imageCheckExtensions[] = "tif";
}
if ( version_compare( $sCurrentVersion, "4.3.0" ) >= 0 ) {
if ( version_compare($sCurrentVersion, "4.3.0") >= 0 ) {
$imageCheckExtensions[] = "swc";
}
if ( version_compare( $sCurrentVersion, "4.3.2" ) >= 0 ) {
if ( version_compare($sCurrentVersion, "4.3.2") >= 0 ) {
$imageCheckExtensions[] = "jpc";
$imageCheckExtensions[] = "jp2";
$imageCheckExtensions[] = "jpx";

View File

@ -129,6 +129,13 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
*/
class FPDI_DolExtended extends FPDI
{
/**
* __call
*
* @param string $method Method
* @param mixed $args Arguments
* @return void
*/
public function __call($method, $args)
{
if (isset($this->$method)) {
@ -137,6 +144,22 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
}
}
/**
* writeHTMLCell
*
* @param unknown_type $w Width
* @param unknown_type $h Height
* @param unknown_type $x X
* @param unknown_type $y Y
* @param unknown_type $html Html
* @param unknown_type $border Border
* @param unknown_type $ln Ln
* @param unknown_type $fill Fill
* @param unknown_type $reseth Reseth
* @param unknown_type $align Align
* @param unknown_type $autopadding Autopadding
* @return void
*/
public function writeHTMLCell($w, $h, $x, $y, $html = '', $border = 0, $ln = 0, $fill = false, $reseth = true, $align = '', $autopadding = true)
{
$this->SetXY($x,$y);

View File

@ -107,7 +107,6 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
* Export the message
*
* @param array $content Array containing the info about the message
* @param int $ident 1=Increase ident of 1, -1=Decrease ident of 1
* @return void
*/
public function export($content)

View File

@ -53,7 +53,7 @@ $now=dol_now();
if ($action == 'create')
{
$cp = new Holiday($db);
// Si pas le droit de créer une demande
if(!$user->rights->holiday->write)
{
@ -69,7 +69,7 @@ if ($action == 'create')
if ($starthalfday == 'afternoon' && $endhalfday == 'morning') $halfday=2;
else if ($starthalfday == 'afternoon') $halfday=-1;
else if ($endhalfday == 'morning') $halfday=1;
$valideur = GETPOST('valideur');
$description = trim(GETPOST('description'));
$userID = GETPOST('userID');
@ -124,7 +124,7 @@ if ($action == 'create')
$cp->date_fin = $date_fin;
$cp->fk_validator = $valideur;
$cp->halfday = $halfday;
$verif = $cp->create($user_id);
// Si pas d'erreur SQL on redirige vers la fiche de la demande
@ -152,7 +152,7 @@ if ($action == 'update')
if ($starthalfday == 'afternoon' && $endhalfday == 'morning') $halfday=2;
else if ($starthalfday == 'afternoon') $halfday=-1;
else if ($endhalfday == 'morning') $halfday=1;
// Si pas le droit de modifier une demande
if(!$user->rights->holiday->write)
{
@ -209,7 +209,7 @@ if ($action == 'update')
$cp->date_fin = $date_fin;
$cp->fk_validator = $valideur;
$cp->halfday = $halfday;
// Update
$verif = $cp->update($user->id);
if ($verif > 0)
@ -636,9 +636,9 @@ if (empty($id) || $action == 'add' || $action == 'request')
print '<script type="text/javascript">
function valider()
{
if(document.demandeCP.date_debut_.value != "")
if(document.demandeCP.date_debut_.value != "")
{
if(document.demandeCP.date_fin_.value != "")
if(document.demandeCP.date_fin_.value != "")
{
if(document.demandeCP.valideur.value != "-1") {
return true;
@ -648,13 +648,13 @@ if (empty($id) || $action == 'add' || $action == 'request')
return false;
}
}
else
else
{
alert("'.dol_escape_js($langs->transnoentities('NoDateFin')).'");
return false;
}
}
else
else
{
alert("'.dol_escape_js($langs->transnoentities('NoDateDebut')).'");
return false;
@ -698,7 +698,7 @@ if (empty($id) || $action == 'add' || $action == 'request')
$tmpdate = dol_mktime(0, 0, 0, GETPOST('datefmonth'), GETPOST('datefday'), GETPOST('datefyear'));
$form->select_date($tmpdate,'date_fin_');
}
print ' &nbsp; &nbsp; ';
print ' &nbsp; &nbsp; ';
print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday')?GETPOST('endhalfday'):'afternoon'));
print '</td>';
print '</tr>';
@ -828,7 +828,7 @@ else
if ($action == 'refuse' && $cp->statut == 2 && $userID == $cp->fk_validator)
{
$array_input = array(array('type'=>"text",'label'=>"Entrez ci-dessous un motif de refus :",'name'=>"detail_refuse",'size'=>"50",'value'=>""));
$ret=$form->form_confirm("fiche.php?id=".$id."&action=confirm_refuse",$langs->trans("TitleRefuseCP"),"","confirm_refuse", $array_input, 1 ,0);
$ret=$form->form_confirm("fiche.php?id=".$id."&action=confirm_refuse", $langs->trans("TitleRefuseCP"), "", "confirm_refuse", $array_input, 1, 0);
if ($ret == 'html') print '<br />';
}
@ -855,7 +855,7 @@ else
print '<tbody>';
$linkback='';
print '<tr>';
print '<td width="25%">'.$langs->trans("Ref").'</td>';
print '<td>';
@ -865,7 +865,7 @@ else
$starthalfday=($cp->halfday == -1 || $cp->halfday == 2)?'afternoon':'morning';
$endhalfday=($cp->halfday == 1 || $cp->halfday == 2)?'morning':'afternoon';
if(!$edit) {
print '<tr>';
print '<td>'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>';
@ -885,7 +885,7 @@ else
print '</tr>';
}
if (!$edit)
if (!$edit)
{
print '<tr>';
print '<td>'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>';
@ -914,7 +914,7 @@ else
print '<td>'.$langs->trans('StatutCP').'</td>';
print '<td>'.$cp->getLibStatut(2).'</td>';
print '</tr>';
if ($cp->statut == 5)
if ($cp->statut == 5)
{
print '<tr>';
print '<td>'.$langs->trans('DetailRefusCP').'</td>';
@ -923,14 +923,14 @@ else
}
// Description
if (!$edit)
if (!$edit)
{
print '<tr>';
print '<td>'.$langs->trans('DescCP').'</td>';
print '<td>'.nl2br($cp->description).'</td>';
print '</tr>';
}
else
else
{
print '<tr>';
print '<td>'.$langs->trans('DescCP').'</td>';
@ -1030,7 +1030,7 @@ else
{
print '<a href="fiche.php?id='.$_GET['id'].'&action=delete" class="butActionDelete">'.$langs->trans("DeleteCP").'</a>';
}
// Si le statut est en attente de validation et que le valideur est connecté
if ($userID == $cp->fk_validator && $cp->statut == 2)
{
@ -1042,7 +1042,7 @@ else
{
print '<a href="fiche.php?id='.$_GET['id'].'&action=cancel" class="butAction">'.$langs->trans("ActionCancelCP").'</a>';
}
print '</div>';
}

View File

@ -276,7 +276,7 @@ if (! empty($holiday->holiday))
{
$userstatic = new User($db);
$approbatorstatic = new User($db);
foreach($holiday->holiday as $infos_CP)
{
$var=!$var;
@ -290,7 +290,7 @@ if (! empty($holiday->holiday))
$approbatorstatic->id=$infos_CP['fk_validator'];
$approbatorstatic->lastname=$infos_CP['validator_lastname'];
$approbatorstatic->firstname=$infos_CP['validator_firstname'];
$date = $infos_CP['date_create'];
print '<tr '.$bc[$var].'>';
@ -305,7 +305,7 @@ if (! empty($holiday->holiday))
print '<td align="center">'.dol_print_date($infos_CP['date_debut'],'day').'</td>';
print '<td align="center">'.dol_print_date($infos_CP['date_fin'],'day').'</td>';
print '<td align="right">';
$nbopenedday=num_open_day($infos_CP['date_debut'], $infos_CP['date_fin'] ,0, 1, $infos_CP['halfday']);
$nbopenedday=num_open_day($infos_CP['date_debut'], $infos_CP['date_fin'], 0, 1, $infos_CP['halfday']);
print $nbopenedday;
print '<td align="right">'.$holidaystatic->LibStatut($infos_CP['statut'],5).'</td>';
print '</tr>'."\n";

View File

@ -228,8 +228,6 @@ $server->register(
*
* @param array $authentication Array of authentication information
* @param int $id Id of object
* @param string $ref Ref of object
* @param ref_ext $ref_ext Ref external of object
* @return mixed
*/
function getActionComm($authentication,$id)
@ -262,7 +260,7 @@ function getActionComm($authentication,$id)
$result=$actioncomm->fetch($id);
if ($result > 0)
{
$actioncomm_result_fields=array(
'id' => $actioncomm->id,
'ref'=> $actioncomm->ref,
@ -289,19 +287,19 @@ function getActionComm($authentication,$id)
'projectid'=> $actioncomm->fk_project,
'fk_element'=> $actioncomm->fk_element,
'elementtype'=> $actioncomm->elementtype);
//Retreive all extrafield for actioncomm
// fetch optionals attributes and labels
$extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('actioncomm');
//Get extrafield values
$actioncomm->fetch_optionals($actioncomm->id,$extralabels);
foreach($extrafields->attribute_label as $key=>$label)
{
$actioncomm_result_fields=array_merge($actioncomm_result_fields,array('options_'.$key => $actioncomm->array_options['options_'.$key]));
}
// Create
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
@ -363,11 +361,11 @@ function getListActionCommType($authentication)
foreach($cactioncomm->liste_array as $code=>$libeller) {
$resultarray[]=array('code'=>$code,'libelle'=>$libeller);
}
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'actioncommtypes'=>$resultarray);
}
else
{
@ -433,8 +431,8 @@ function createActionComm($authentication,$actioncomm)
$newobject->fulldayevent=$actioncomm['fulldayevent'];
$newobject->location=$actioncomm['location'];
$newobject->fk_element=$actioncomm['fk_element'];
$newobject->elementtype=$actioncomm['elementtype'];
$newobject->elementtype=$actioncomm['elementtype'];
//Retreive all extrafield for actioncomm
// fetch optionals attributes and labels
$extrafields=new ExtraFields($db);
@ -444,7 +442,7 @@ function createActionComm($authentication,$actioncomm)
$key='options_'.$key;
$newobject->array_options[$key]=$actioncomm[$key];
}
$db->begin();
$result=$newobject->add($fuser);

View File

@ -444,6 +444,7 @@ function getOrder($authentication,$id='',$ref='',$ref_ext='')
/**
* Get list of orders for third party
*
* @param array $authentication Array of authentication information
* @param int $idthirdparty Id of thirdparty
* @return array Array result
@ -604,6 +605,7 @@ function getOrdersForThirdParty($authentication,$idthirdparty)
/**
* Create order
*
* @param array $authentication Array of authentication information
* @param array $order Order info
* @return int Id of new order
@ -701,6 +703,7 @@ function createOrder($authentication,$order)
/**
* Valid an order
*
* @param array $authentication Array of authentication information
* @param int $id Id of order to validate
* @return array Array result