Skip to content

Commit

Permalink
Qual : PHP Code_Sniffer
Browse files Browse the repository at this point in the history
  • Loading branch information
FHenry committed Apr 10, 2013
1 parent 2c51b51 commit 98ddd02
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 51 deletions.
1 change: 0 additions & 1 deletion htdocs/commande/class/commande.class.php
Expand Up @@ -2783,7 +2783,6 @@ function load_state_board()
* Update value of extrafields on the proposal
*
* @param User $user Object user that modify
* @param double $remise Amount discount
* @return int <0 if ko, >0 if ok
*/
function update_extrafields($user)
Expand Down
Expand Up @@ -175,6 +175,7 @@ function getSqlArrayForStats()
* For example if this selector is used to extract 500 different
* emails from a text file, this function must return 500.
*
* @param string $sql SQL request to get recipitien
* @param int $filter Filter
* @param string $option Option
* @return int Number of recipients
Expand Down
76 changes: 46 additions & 30 deletions htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php
Expand Up @@ -209,7 +209,7 @@ function get_substitutionarray_project_file($file,$outputlangs)
function get_substitutionarray_project_reference($refdetail,$outputlangs)
{
global $conf;

return array(
'projref_type'=>$refdetail['type'],
'projref_ref'=>$refdetail['ref'],
Expand All @@ -220,7 +220,7 @@ function get_substitutionarray_project_reference($refdetail,$outputlangs)
'projref_status'=>$refdetail['status']
);
}

/**
* Define array with couple substitution key => substitution value
*
Expand All @@ -242,7 +242,7 @@ function get_substitutionarray_tasksressource($taskressource,$outputlangs)
'taskressource_email'=>$taskressource['email']
);
}

/**
* Define array with couple substitution key => substitution value
*
Expand All @@ -254,7 +254,7 @@ function get_substitutionarray_taskstime($tasktime,$outputlangs)
{
global $conf;

return array(
return array(
'tasktime_rowid'=>$tasktime['rowid'],
'tasktime_task_date'=>dol_print_date($tasktime['task_date'],'day'),
'tasktime_task_duration'=>convertSecondToTime($tasktime['task_duration'],'all'),
Expand All @@ -265,7 +265,7 @@ function get_substitutionarray_taskstime($tasktime,$outputlangs)
'tasktime_fullcivname'=>$tasktime['fullcivname']
);
}

/**
* Define array with couple substitution key => substitution value
*
Expand All @@ -276,7 +276,7 @@ function get_substitutionarray_taskstime($tasktime,$outputlangs)
function get_substitutionarray_task_file($file,$outputlangs)
{
global $conf;

return array(
'tasksfile_name'=>$file['name'],
'tasksfile_date'=>dol_print_date($file['date'],'day'),
Expand Down Expand Up @@ -384,6 +384,14 @@ function write_file($object,$outputlangs,$srctemplatepath)
return -1;
}

// Add odtgeneration hook
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('odtgeneration'));
global $action;
if (! is_object($outputlangs)) $outputlangs=$langs;
$sav_charset_output=$outputlangs->charset_output;
$outputlangs->charset_output='UTF-8';
Expand Down Expand Up @@ -534,6 +542,9 @@ function write_file($object,$outputlangs,$srctemplatepath)
// Replace tags of object + external modules
$tmparray=$this->get_substitutionarray_object($object,$outputlangs);
complete_substitutions_array($tmparray, $outputlangs, $object);
// Call the ODTSubstitution hook
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
foreach($tmparray as $key=>$value)
{
try {
Expand Down Expand Up @@ -564,7 +575,7 @@ function write_file($object,$outputlangs,$srctemplatepath)
if (!empty($object->fk_soc)) $socid = $object->fk_soc;

$tasksarray=$taskstatic->getTasksArray(0, 0, $object->id, $socid, 0);



foreach ($tasksarray as $task)
Expand All @@ -584,10 +595,10 @@ function write_file($object,$outputlangs,$srctemplatepath)
{
}
}

$taskobj=new Task($this->db);
$taskobj->fetch($task->id);

// Replace tags of lines for contacts task
$sourcearray=array('internal','external');
$contact_arrray=array();
Expand All @@ -601,7 +612,7 @@ function write_file($object,$outputlangs,$srctemplatepath)
if ((is_array($contact_arrray) && count($contact_arrray) > 0))
{
$listlinestaskres = $listlines->__get('tasksressources');

foreach ($contact_arrray as $contact)
{
if ($contact['source']=='internal') {
Expand All @@ -611,15 +622,15 @@ function write_file($object,$outputlangs,$srctemplatepath)
} elseif ($contact['source']=='external') {
$objectdetail=new Contact($this->db);
$objectdetail->fetch($contact['id']);

$soc=new Societe($this->db);
$soc->fetch($contact['socid']);
$contact['socname']=$soc->name;
}
$contact['fullname']=$objectdetail->getFullName($outputlangs,1);

$tmparray=$this->get_substitutionarray_tasksressource($contact,$outputlangs);

foreach($tmparray as $key => $val)
{
try
Expand All @@ -645,7 +656,7 @@ function write_file($object,$outputlangs,$srctemplatepath)
$sql .= " WHERE t.fk_task =".$task->id;
$sql .= " AND t.fk_user = u.rowid";
$sql .= " ORDER BY t.task_date DESC";

$resql = $this->db->query($sql);
if ($resql)
{
Expand All @@ -663,9 +674,9 @@ function write_file($object,$outputlangs,$srctemplatepath)
} else {
$row['fullcivname']='';
}

$tmparray=$this->get_substitutionarray_taskstime($row,$outputlangs);

foreach($tmparray as $key => $val)
{
try
Expand All @@ -684,15 +695,15 @@ function write_file($object,$outputlangs,$srctemplatepath)
}
$this->db->free($resql);
}


// Replace tags of project files
$listtasksfiles = $listlines->__get('tasksfiles');

$upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref).'/'.dol_sanitizeFileName($task->ref);
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$','name',SORT_ASC,1);


foreach ($filearray as $filedetail)
{
$tmparray=$this->get_substitutionarray_task_file($filedetail,$outputlangs);
Expand Down Expand Up @@ -731,7 +742,7 @@ function write_file($object,$outputlangs,$srctemplatepath)
$upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref);
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$','name',SORT_ASC,1);


foreach ($filearray as $filedetail)
{
//dol_syslog(get_class($this).'::main $filedetail'.var_export($filedetail,true));
Expand Down Expand Up @@ -891,27 +902,27 @@ function write_file($object,$outputlangs,$srctemplatepath)
{
$ref_array=array();
$ref_array['type']=$langs->trans($classname);

$element = new $classname($this->db);
$element->fetch($elementarray[$i]);
$element->fetch_thirdparty();

//Ref object
$ref_array['ref']=$element->ref;

//Date object
$dateref=$element->date;
if (empty($dateref)) $dateref=$element->datep;
if (empty($dateref)) $dateref=$element->date_contrat;
$ref_array['date']=$dateref;

//Soc object
if (is_object($element->thirdparty)) {
$ref_array['socname']=$element->thirdparty->name;
} else {
$ref_array['socname']='';
}

//Amount object
if (empty($valueref['disableamount'])) {
if (!empty($element->total_ht)) {
Expand All @@ -925,9 +936,9 @@ function write_file($object,$outputlangs,$srctemplatepath)
$ref_array['amountht']='';
$ref_array['amountttc']='';
}

$ref_array['status']=html_entity_decode($element->getLibStatut(0));

$tmparray=$this->get_substitutionarray_project_reference($ref_array,$outputlangs);

foreach($tmparray as $key => $val)
Expand All @@ -945,7 +956,7 @@ function write_file($object,$outputlangs,$srctemplatepath)
}
$listlines->merge();
}

}
}
$odfHandler->mergeSegment($listlines);
Expand All @@ -958,6 +969,11 @@ function write_file($object,$outputlangs,$srctemplatepath)
return -1;
}

// Call the beforeODTSave hook
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks


// Write new file
$odfHandler->saveToDisk($file);

Expand Down
1 change: 1 addition & 0 deletions htdocs/fourn/class/fournisseur.product.class.php
Expand Up @@ -146,6 +146,7 @@ function remove_product_fournisseur_price($rowid)
* @param string $charges costs affering to product
* @param float $remise_percent Discount regarding qty (percent)
* @param float $remise Discount regarding qty (amount)
* @param float $newnpr new infobit tva npr
* @return int <0 if KO, >=0 if OK
*/
function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0)
Expand Down
2 changes: 1 addition & 1 deletion htdocs/opensurvey/adminstuds_preview.php
Expand Up @@ -202,7 +202,7 @@

//on rajoute la valeur dans les valeurs
$datesbase = explode(",",$object->sujet);
$taillebase = sizeof($datesbase);
$taillebase = count($datesbase);

//recherche de l'endroit de l'insertion de la nouvelle date dans les dates deja entrées dans le tableau
if ($nouvelledate < $datesbase[0]) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/opensurvey/fonctions.php
Expand Up @@ -120,7 +120,7 @@ function get_server_name()
/**
* is_error
*
* @param unknown_type $cerr
* @param unknown_type $cerr error number
* @return boolean
*/
function is_error($cerr)
Expand Down
6 changes: 3 additions & 3 deletions htdocs/opensurvey/public/choix_date.php
Expand Up @@ -257,9 +257,9 @@

// Si le test est passé, alors on insere la valeur dans la variable de session qui contient les dates
if ($journeuf && issetAndNoEmpty('choixjourajout') === true) {
array_push ($_SESSION["totalchoixjour"],mktime (0,0,0, $_SESSION["mois"], $_POST["choixjourajout"][0], $_SESSION["annee"]));
sort ($_SESSION["totalchoixjour"]);
$cle=array_search (mktime (0,0,0, $_SESSION["mois"], $_POST["choixjourajout"][0], $_SESSION["annee"]), $_SESSION["totalchoixjour"]);
array_push($_SESSION["totalchoixjour"],mktime (0,0,0, $_SESSION["mois"], $_POST["choixjourajout"][0], $_SESSION["annee"]));
sort($_SESSION["totalchoixjour"]);
$cle=array_search(mktime (0,0,0, $_SESSION["mois"], $_POST["choixjourajout"][0], $_SESSION["annee"]), $_SESSION["totalchoixjour"]);

//On sauvegarde les heures deja entrées
for ($i = 0; $i < $cle; $i++) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/opensurvey/public/create_survey.php
Expand Up @@ -162,7 +162,7 @@

print '<br>'."\n";

#affichage du cochage par défaut
//affichage du cochage par défaut
$cocheplus='';
if ($_SESSION["canedit"]) $cocheplus="checked";

Expand Down
12 changes: 6 additions & 6 deletions htdocs/opensurvey/public/exportcsv.php
Expand Up @@ -64,7 +64,7 @@

$nbcolonnes=substr_count($object->sujet,',')+1;
$toutsujet=explode(",",$object->sujet);
#$toutsujet=str_replace("°","'",$toutsujet);
//$toutsujet=str_replace("°","'",$toutsujet);

// affichage des sujets du sondage
$input.=$langs->trans("Name").";";
Expand Down Expand Up @@ -139,15 +139,15 @@
else dol_print_error($db);


$filesize = strlen( $input );
$filesize = strlen($input);
$filename=$numsondage."_".dol_print_date($now,'%Y%m%d%H%M').".csv";



header( 'Content-Type: text/csv; charset=utf-8' );
header( 'Content-Length: '.$filesize );
header( 'Content-Disposition: attachment; filename="'.$filename.'"' );
header( 'Cache-Control: max-age=10' );
header('Content-Type: text/csv; charset=utf-8');
header('Content-Length: '.$filesize);
header('Content-Disposition: attachment; filename="'.$filename.'"');
header('Cache-Control: max-age=10');
echo $input;

exit;
Expand Down
3 changes: 1 addition & 2 deletions htdocs/public/paybox/paymentko.php
Expand Up @@ -73,8 +73,7 @@
'New subscription payed',
$sendto,
$from,
'New subscription payed '.$fulltag
);
'New subscription payed '.$fulltag);

$result=$mailfile->sendfile();
if ($result)
Expand Down
3 changes: 1 addition & 2 deletions htdocs/public/paybox/paymentok.php
Expand Up @@ -103,8 +103,7 @@
'New subscription payed',
$sendto,
$from,
'New subscription payed '.$fulltag
);
'New subscription payed '.$fulltag);

$result=$mailfile->sendfile();
if ($result)
Expand Down
3 changes: 1 addition & 2 deletions htdocs/public/paypal/paymentko.php
Expand Up @@ -81,8 +81,7 @@
'New subscription payed',
$sendto,
$from,
'New subscription payed '.$fulltag
);
'New subscription payed '.$fulltag);

$result=$mailfile->sendfile();
if ($result)
Expand Down
3 changes: 1 addition & 2 deletions htdocs/public/paypal/paymentok.php
Expand Up @@ -140,8 +140,7 @@
'New subscription payed',
$sendto,
$from,
'New subscription payed '.$fulltag
);
'New subscription payed '.$fulltag);

$result=$mailfile->sendfile();
if ($result)
Expand Down

0 comments on commit 98ddd02

Please sign in to comment.