This commit is contained in:
Laurent Destailleur 2013-04-14 11:22:00 +02:00
parent d7d30f8fc9
commit 3cec5bfc40
6 changed files with 92 additions and 61 deletions

View File

@ -1,28 +1,28 @@
<?php
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@ope-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
* Copyright (C) 2013 Florian Henry <florian.henry@ope-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
* \ingroup project
* \brief File of class to build ODT documents for third parties
*/
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
@ -369,14 +369,14 @@ class doc_generic_project_odt extends ModelePDFProjects
/**
* Function to build a document on disk using the generic odt module.
*
* @param Commande $object Object source to build document
* @param Project $object Object source to build document
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @return int 1 if OK, <=0 if KO
*/
function write_file($object,$outputlangs,$srctemplatepath)
{
global $user,$langs,$conf,$mysoc;
global $user,$langs,$conf,$mysoc,$hookmanager;
if (empty($srctemplatepath))
{
@ -392,6 +392,7 @@ class doc_generic_project_odt extends ModelePDFProjects
}
$hookmanager->initHooks(array('odtgeneration'));
global $action;
if (! is_object($outputlangs)) $outputlangs=$langs;
$sav_charset_output=$outputlangs->charset_output;
$outputlangs->charset_output='UTF-8';
@ -577,7 +578,6 @@ class doc_generic_project_odt extends ModelePDFProjects
$tasksarray=$taskstatic->getTasksArray(0, 0, $object->id, $socid, 0);
foreach ($tasksarray as $task)
{
$tmparray=$this->get_substitutionarray_tasks($task,$outputlangs);
@ -742,7 +742,6 @@ class doc_generic_project_odt extends ModelePDFProjects
$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));
@ -878,7 +877,7 @@ class doc_generic_project_odt extends ModelePDFProjects
'test'=>$conf->agenda->enabled)
);
//Inser refenrence
//Insert reference
try
{
$listlines = $odfHandler->setSegment('projectrefs');

View File

@ -225,7 +225,8 @@ if (isset($_POST["ajoutercolonne"]) && ($object->format == "D" || $object->forma
array_splice($datesbase, $cleinsertion, 0, $nouvelledate);
$cle = array_search($nouvelledate, $datesbase);
$dateinsertion = '';
for ($i = 0; $i < count($datesbase); $i++) {
$nbofdates=count($datesbase);
for ($i = 0; $i < $nbofdates; $i++) {
$dateinsertion.=",";
$dateinsertion.=$datesbase[$i];
}
@ -511,7 +512,9 @@ if (GETPOST('ajoutsujet'))
print '<select name="nouvelleannee"> '."\n";
print '<OPTION VALUE="vide"></OPTION>'."\n";
for ($i = date("Y"); $i < (date("Y") + 5); $i++) {
$maxyear=date("Y")+5;
for ($i = date("Y"); $i < $maxyear; $i++)
{
print '<OPTION VALUE="'.$i.'">'.$i.'</OPTION>'."\n";
}
print '</SELECT>'."\n";
@ -618,7 +621,8 @@ if ($object->format=="D"||$object->format=="D+")
//affichage des années
$colspan=1;
for ($i=0;$i<count($toutsujet);$i++)
$nbofsujet=count($toutsujet);
for ($i=0;$i<$nbofsujet;$i++)
{
$current = $toutsujet[$i];
@ -648,7 +652,7 @@ if ($object->format=="D"||$object->format=="D+")
//affichage des mois
$colspan = 1;
for ($i = 0; $i < count($toutsujet); $i++) {
for ($i = 0; $i < $nbofsujet; $i++) {
$cur = intval($toutsujet[$i]); // intval() est utiliser pour supprimer le suffixe @* qui déplaît logiquement à strftime()
if (isset($toutsujet[$i+1]) === false) {
@ -674,7 +678,7 @@ if ($object->format=="D"||$object->format=="D+")
//affichage des jours
$colspan = 1;
for ($i = 0; $i < count($toutsujet); $i++) {
for ($i = 0; $i < $nbofsujet; $i++) {
$cur = intval($toutsujet[$i]);
if (isset($toutsujet[$i+1]) === false) {
$next = false;

View File

@ -39,8 +39,10 @@ $origin=GETPOST('origin','alpha');
if (GETPOST('confirmation') || GETPOST('confirmation_x'))
{
if (is_array($_SESSION['totalchoixjour']))
{
for ($i = 0; $i < count($_SESSION["totalchoixjour"]); $i++) {
{
$nbofchoice=count($_SESSION["totalchoixjour"]);
for ($i = 0; $i < $nbofchoice; $i++)
{
if ($_SESSION["horaires$i"][0] == "" && $_SESSION["horaires$i"][1] == "" && $_SESSION["horaires$i"][2] == "" && $_SESSION["horaires$i"][3] == "" && $_SESSION["horaires$i"][4] == "") {
$choixdate.=",";
$choixdate .= $_SESSION["totalchoixjour"][$i];
@ -65,7 +67,8 @@ if (GETPOST('confirmation') || GETPOST('confirmation_x'))
// Reset days
if (GETPOST('reset')) {
for ($i = 0; $i < count($_SESSION["totalchoixjour"]); $i++) {
$nbofchoice=count($_SESSION["totalchoixjour"]);
for ($i = 0; $i < $nbofchoice; $i++) {
for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) {
unset($_SESSION["horaires$i"][$j]);
}
@ -128,8 +131,10 @@ if (issetAndNoEmpty('moisavant') || issetAndNoEmpty('moisavant_x')) {
}
//On sauvegarde les heures deja entrées
if (issetAndNoEmpty('totalchoixjour', $_SESSION) === true) {
for ($i = 0; $i < count($_SESSION["totalchoixjour"]); $i++) {
if (issetAndNoEmpty('totalchoixjour', $_SESSION) === true)
{
$nbofchoice=count($_SESSION["totalchoixjour"]);
for ($i = 0; $i < $nbofchoice; $i++) {
//affichage des 5 cases horaires
for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) {
$_SESSION["horaires$i"][$j] = $_POST["horaires$i"][$j];
@ -148,8 +153,11 @@ if (issetAndNoEmpty('moisapres') || issetAndNoEmpty('moisapres_x')) {
}
//On sauvegarde les heures deja entrées
if (issetAndNoEmpty('totalchoixjour', $_SESSION) === true) {
for ($i = 0; $i < count($_SESSION["totalchoixjour"]); $i++) {
if (issetAndNoEmpty('totalchoixjour', $_SESSION) === true)
{
$nbofchoice=count($_SESSION["totalchoixjour"]);
for ($i = 0; $i < $nbofchoice; $i++)
{
//affichage des 5 cases horaires
for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) {
$_SESSION["horaires$i"][$j] = $_POST["horaires$i"][$j];
@ -163,8 +171,10 @@ if (issetAndNoEmpty('anneeavant') || issetAndNoEmpty('anneeavant_x')) {
$_SESSION["annee"] -= 1;
//On sauvegarde les heures deja entrées
if (issetAndNoEmpty('totalchoixjour', $_SESSION) === true) {
for ($i = 0; $i < count($_SESSION["totalchoixjour"]); $i++) {
if (issetAndNoEmpty('totalchoixjour', $_SESSION) === true)
{
$nbofchoice=count($_SESSION["totalchoixjour"]);
for ($i = 0; $i < $nbofchoice; $i++) {
//affichage des 5 cases horaires
for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) {
$_SESSION["horaires$i"][$j] = $_POST["horaires$i"][$j];
@ -178,8 +188,10 @@ if (issetAndNoEmpty('anneeapres') || issetAndNoEmpty('anneeapres_x')) {
$_SESSION["annee"] += 1;
//On sauvegarde les heures deja entrées
if (issetAndNoEmpty('totalchoixjour', $_SESSION) === true) {
for ($i = 0; $i < count($_SESSION["totalchoixjour"]); $i++) {
if (issetAndNoEmpty('totalchoixjour', $_SESSION) === true)
{
$nbofchoice=count($_SESSION["totalchoixjour"]);
for ($i = 0; $i < $nbofchoice; $i++) {
//affichage des 5 cases horaires
for ($j = 0;$j < $_SESSION["nbrecaseshoraires"]; $j++) {
$_SESSION["horaires$i"][$j] = $_POST["horaires$i"][$j];
@ -247,8 +259,10 @@ if (issetAndNoEmpty('choixjourajout')) {
// Test pour éviter les doublons dans la variable qui contient toutes les dates
$journeuf = true;
if (issetAndNoEmpty('totalchoixjour', $_SESSION) === true && issetAndNoEmpty('choixjourajout') === true) {
for ($i = 0; $i < count($_SESSION["totalchoixjour"]); $i++) {
if (issetAndNoEmpty('totalchoixjour', $_SESSION) === true && issetAndNoEmpty('choixjourajout') === true)
{
$nbofchoice=count($_SESSION["totalchoixjour"]);
for ($i = 0; $i < $nbofchoice; $i++) {
if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], $_POST["choixjourajout"][0], $_SESSION["annee"])) {
$journeuf=false;
}
@ -270,7 +284,8 @@ if (issetAndNoEmpty('choixjourajout')) {
}
}
for ($i = $cle; $i < count($_SESSION["totalchoixjour"]); $i++) {
$nbofchoice=count($_SESSION["totalchoixjour"]);
for ($i = $cle; $i < $nbofchoice; $i++) {
$k = $i + 1;
if (issetAndNoEmpty('horaires'.$i) === true && issetAndNoEmpty($i, $_POST['horaires'.$i]) === true) {
for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) {
@ -286,16 +301,19 @@ if (issetAndNoEmpty('choixjourajout')) {
//retrait d'une entrée dans la variable de session qui contient toutes les dates
if (issetAndNoEmpty('choixjourretrait')) {
//On sauvegarde les heures deja entrées
for ($i = 0; $i < count($_SESSION["totalchoixjour"]); $i++) {
$nbofchoice=count($_SESSION["totalchoixjour"]);
for ($i = 0; $i < $nbofchoice; $i++) {
//affichage des 5 cases horaires
for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) {
$_SESSION["horaires$i"][$j] = $_POST["horaires$i"][$j];
}
}
for ($i = 0; $i < count($_SESSION["totalchoixjour"]); $i++) {
if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], $_POST["choixjourretrait"][0], $_SESSION["annee"])) {
for ($j = $i; $j < count($_SESSION["totalchoixjour"]); $j++) {
for ($i = 0; $i < $nbofchoice; $i++)
{
if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], $_POST["choixjourretrait"][0], $_SESSION["annee"]))
{
for ($j = $i; $j < $nbofchoice; $j++) {
$k = $j+1;
$_SESSION["horaires$j"] = $_SESSION["horaires$k"];
}
@ -308,7 +326,8 @@ if (issetAndNoEmpty('choixjourretrait')) {
//report des horaires dans toutes les cases
if (issetAndNoEmpty('reporterhoraires')) {
$_SESSION["horaires0"] = $_POST["horaires0"];
for ($i = 0; $i < count($_SESSION["totalchoixjour"]); $i++) {
$nbofchoice=count($_SESSION["totalchoixjour"]);
for ($i = 0; $i < $nbofchoice; $i++) {
$j = $i+1;
$_SESSION["horaires$j"] = $_SESSION["horaires$i"];
}
@ -316,7 +335,8 @@ if (issetAndNoEmpty('reporterhoraires')) {
//report des horaires dans toutes les cases
if (issetAndNoEmpty('resethoraires')) {
for ($i = 0; $i < count($_SESSION["totalchoixjour"]); $i++) {
$nbofchoice=count($_SESSION["totalchoixjour"]);
for ($i = 0; $i < $nbofchoice; $i++) {
unset ($_SESSION["horaires$i"]);
}
}
@ -336,8 +356,10 @@ for ($i = 0; $i < $nbrejourmois + $premierjourmois; $i++) {
if ($i < $premierjourmois) {
print '<td class="avant"></td>'."\n";
} else {
if (issetAndNoEmpty('totalchoixjour', $_SESSION) === true) {
for ($j = 0; $j < count($_SESSION["totalchoixjour"]); $j++) {
if (issetAndNoEmpty('totalchoixjour', $_SESSION) === true)
{
$nbofchoice=count($_SESSION["totalchoixjour"]);
for ($j = 0; $j < $nbofchoice; $j++) {
//affichage des boutons ROUGES
if (date("j", $_SESSION["totalchoixjour"][$j]) == $numerojour && date("n", $_SESSION["totalchoixjour"][$j]) == $_SESSION["mois"] && date("Y", $_SESSION["totalchoixjour"][$j]) == $_SESSION["annee"]) {
print '<td align="center" class="choisi"><input type="submit" class="bouton OFF" name="choixjourretrait[]" value="'.$numerojour.'"></td>'."\n";
@ -367,8 +389,10 @@ print '</div></center>'."\n";
$errheure = $erreur = false;
if (issetAndNoEmpty('choixheures') || issetAndNoEmpty('choixheures_x')) {
//On sauvegarde les heures deja entrées
if (issetAndNoEmpty('totalchoixjour', $_SESSION) === true && issetAndNoEmpty('nbrecaseshoraires', $_SESSION) === true) {
for ($i = 0; $i < count($_SESSION["totalchoixjour"]); $i++) {
if (issetAndNoEmpty('totalchoixjour', $_SESSION) === true && issetAndNoEmpty('nbrecaseshoraires', $_SESSION) === true)
{
$nbofchoice=count($_SESSION["totalchoixjour"]);
for ($i = 0; $i < $nbofchoice; $i++) {
//affichage des 5 cases horaires
for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) {
$_SESSION["horaires$i"][$j] = $_POST["horaires$i"][$j];
@ -377,8 +401,10 @@ if (issetAndNoEmpty('choixheures') || issetAndNoEmpty('choixheures_x')) {
}
//affichage des horaires
if (issetAndNoEmpty('totalchoixjour', $_SESSION) === true && issetAndNoEmpty('nbrecaseshoraires', $_SESSION) === true) {
for ($i = 0; $i < count($_SESSION["totalchoixjour"]); $i++) {
if (issetAndNoEmpty('totalchoixjour', $_SESSION) === true && issetAndNoEmpty('nbrecaseshoraires', $_SESSION) === true)
{
$nbofchoice=count($_SESSION["totalchoixjour"]);
for ($i = 0; $i < $nbofchoice; $i++) {
//affichage des 5 cases horaires
for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) {
$case = $j + 1;
@ -487,7 +513,8 @@ if (issetAndNoEmpty('totalchoixjour', $_SESSION) && (!issetAndNoEmpty('choixheur
print '</tr>'."\n";
//affichage de la liste des jours choisis
for ($i=0;$i<count($_SESSION["totalchoixjour"]);$i++)
$nbofchoice=count($_SESSION["totalchoixjour"]);
for ($i=0; $i<$nbofchoice; $i++)
{
print '<tr>'."\n";
print '<td>'.dol_print_date($_SESSION["totalchoixjour"][$i], 'daytext').' ('.dol_print_date($_SESSION["totalchoixjour"][$i], '%A').')</td>';

View File

@ -293,7 +293,8 @@ if ($object->format=="D"||$object->format=="D+")
//affichage des années
$colspan=1;
for ($i=0;$i<count($toutsujet);$i++)
$nbofsujet=count($toutsujet);
for ($i=0;$i<$nbofsujet;$i++)
{
if (isset($toutsujet[$i+1]) && date('Y', intval($toutsujet[$i])) == date('Y', intval($toutsujet[$i+1]))) {
$colspan++;
@ -309,7 +310,7 @@ if ($object->format=="D"||$object->format=="D+")
//affichage des mois
$colspan=1;
for ($i=0;$i<count($toutsujet);$i++) {
for ($i=0;$i<$nbofsujet;$i++) {
$cur = intval($toutsujet[$i]); // intval() est utiliser pour supprimer le suffixe @* qui déplaît logiquement à strftime()
if (isset($toutsujet[$i+1]) === false) {
@ -332,7 +333,7 @@ if ($object->format=="D"||$object->format=="D+")
//affichage des jours
$colspan=1;
for ($i=0;$i<count($toutsujet);$i++) {
for ($i=0;$i<$nbofsujet;$i++) {
$cur = intval($toutsujet[$i]);
if (isset($toutsujet[$i+1]) === false) {
$next = false;

View File

@ -6,14 +6,14 @@
<body>
<div data-role="page">
<div>
<!-- <div data-role="header" data-theme="b">
<h1>Introduction</h1>
<a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
</div>
-->
<div data-role="content">
<div>
<h1>Error</h1>

View File

@ -6,14 +6,14 @@
<body>
<div data-role="page">
<div>
<!-- <div data-role="header" data-theme="b">
<h1>Introduction</h1>
<a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
</div>
-->
<div data-role="content">
<div>
<h2>Error</h2>