ci-joint, le patch, et j'ai ré-écrit le buildpatch aussi

Le samedi 28 mai 2011, Daniel Tartavel a écrit :
> 
> ça serait plutôt un patch, car j'ai modifié les sources existants
> Donc, je suis en train de me palucher la doc :-)
> 
> 
> Le samedi 28 mai 2011, Cyrille de Lambert a écrit :
> > Deux possibilités :
> > 
> >     * Faire un patch CVS et le proposer pour qu'il soit intégré dans le
> >       core Dolibarr
> >     * Créer un module à diffuser sur Dolistor
> > 
> > Pour montrer les code, il est possible d'envoyer le code sur le liste 
> > (si ce n'est pas trop gros)
> > 
> > Cyrille
> > 
> > 
> > 
> > Le 28/05/2011 10:34, Daniel Tartavel a écrit :
> > >
> > > À qui dois-je montrer mon code ?
> > >
> > > Le samedi 28 mai 2011, Cyrille de Lambert a écrit :
> > >> Bonjour,
> > >>
> > >> Je pense que ça peux intéresser toutes les entreprises utilisant 
> > >> Dolibarr.
> > >>
> > >> Cyrille
> > >>
> > >> Le 28/05/2011 10:05, Daniel Tartavel a écrit :
> > >>> Bonjour,
> > >>>
> > >>> J'ai ouvert une boutique logiciels libres sur Lyon.
> > >>> J'ai connu Dolibarr à Solution Linux en 2010, et je l'utilise pour mon 
> > >>> entreprise.
> > >>> J'ai codé l'export des journaux en csv, est-ce que ça peut intéressé 
> > >>> quelqu'un ?
> > >>>
> > >>> Librement,
> > >>> Daniel Tartavel
> > >>> Animateur Diplômé en Technologies de l'Information et de la 
> > >>> Communication.
> > >>> Technicien de Maintenance en Informatique
> > >>>
> > >>> http://www.librepc.com
> > >>> siret : 511 210 858 RCS Lyon
> > >>>
> > >>>
> > >>> _______________________________________________
> > >>> Dolibarr-dev mailing list
> > >>> Dolibarr-dev@nongnu.org
> > >>> https://lists.nongnu.org/mailman/listinfo/dolibarr-dev
> > >
> > > Daniel Tartavel
> > > Animateur Diplômé en Technologies de l'Information et de la Communication.
> > > Technicien de Maintenance en Informatique
> > >
> > > http://www.librepc.com
> > > siret : 511 210 858 RCS Lyon
> > >
> > >
> > > _______________________________________________
> > > Dolibarr-dev mailing list
> > > Dolibarr-dev@nongnu.org
> > > https://lists.nongnu.org/mailman/listinfo/dolibarr-dev
> > 
> 
> 
> Daniel Tartavel 
> Animateur Diplômé en Technologies de l'Information et de la Communication.
> Technicien de Maintenance en Informatique
> 
> http://www.librepc.com
> siret : 511 210 858 RCS Lyon 
> 


Daniel Tartavel 
Animateur Diplômé en Technologies de l'Information et de la Communication.
Technicien de Maintenance en Informatique

http://www.librepc.com
siret : 511 210 858 RCS Lyon 
-- 
Je vous serais reconnaissant de ne pas m'envoyer de pièces jointes
aux formats Word, Excel, PowerPoint, RTF,  fichiers aux formats propriétaires.
Utilisez des formats universels et libres tels que texte, html,
OpenDocument, TeX, à la limite PDF. Merci.
Voir http://www.gnu.org/philosophy/no-word-attachments.fr.html
diff -BNaur '--exclude=CVS' '--exclude=*.patch' '--exclude=.#*' '--exclude=*~' '--exclude=*.rej' '--exclude=*.orig' '--exclude=*.bak' '--exclude=conf.php' '--exclude=documents' ./dolibarr/build/patch/buildpatch.ksh ./dolibarr3.0/build/patch/buildpatch.ksh
--- ./dolibarr/build/patch/buildpatch.ksh	2011-05-28 16:20:15.125168016 +0200
+++ ./dolibarr3.0/build/patch/buildpatch.ksh	2011-01-06 09:22:21.000000000 +0100
@@ -12,13 +12,12 @@
 #----------------------------------------------------------------------------
 
 # Put here full path of original and new dolibarr directories
+# Example: olddir=/mydirA1/mydirA2/dolibarrold
+# Example: newdir=/mydirB1/mydirB2/dolibarr
+export olddir=original_dir
+export newdir=modified_dir
 
+echo ----- Building patch file mypatch.patch -----
+echo Build patch between \"$olddir\" and \"$newdir\" 
+diff -BNaur --exclude=CVS --exclude="*.patch" --exclude=".#*" --exclude="*~" --exclude="*.rej" --exclude="*.orig" --exclude="*.bak" --exclude=conf.php --exclude=documents  $olddir  $newdir  > mypatch.patch
 
-#export olddir
-#export newdir=modified_dir
-if [ -z $1  ||  -z $2  ||  -z $3 ]
-then echo buildpatch.sh original_dir_path modified_dir_path patch_filename
-else echo ----- Building patch file mypatch.patch -----
- echo Build patch between \"$1\" and \"$2\" 
- diff -BNaur --exclude=CVS --exclude="*.patch" --exclude=".#*" --exclude="*~" --exclude="*.rej" --exclude="*.orig" --exclude="*.bak" --exclude=conf.php --exclude=documents  $1  $2  > $3
-fi
diff -BNaur '--exclude=CVS' '--exclude=*.patch' '--exclude=.#*' '--exclude=*~' '--exclude=*.rej' '--exclude=*.orig' '--exclude=*.bak' '--exclude=conf.php' '--exclude=documents' ./dolibarr/htdocs/compta/.directory ./dolibarr3.0/htdocs/compta/.directory
--- ./dolibarr/htdocs/compta/.directory	2011-05-28 11:53:56.764820297 +0200
+++ ./dolibarr3.0/htdocs/compta/.directory	2011-05-28 12:01:22.095326329 +0200
@@ -1,4 +1,5 @@
 [Dolphin]
 AdditionalInfo=31
-Timestamp=2011,5,28,11,53,56
+SortOrder=0
+Timestamp=2011,5,28,12,1,22
 ViewMode=1
diff -BNaur '--exclude=CVS' '--exclude=*.patch' '--exclude=.#*' '--exclude=*~' '--exclude=*.rej' '--exclude=*.orig' '--exclude=*.bak' '--exclude=conf.php' '--exclude=documents' ./dolibarr/htdocs/compta/journal/purchasesjournal.php ./dolibarr3.0/htdocs/compta/journal/purchasesjournal.php
--- ./dolibarr/htdocs/compta/journal/purchasesjournal.php	2011-01-05 16:15:20.000000000 +0100
+++ ./dolibarr3.0/htdocs/compta/journal/purchasesjournal.php	2011-05-28 12:45:49.365412540 +0200
@@ -25,6 +25,7 @@
 $langs->load("companies");
 $langs->load("other");
 $langs->load("compta");
+$langs->load("products");
 
 // Protection if external user
 if ($user->societe_id > 0)
@@ -48,33 +49,81 @@
  * Put here all code to build page
  ****************************************************/
 
-llxHeader('','','');
-
-$html=new Form($db);
-
+$exportlink="https://192.168.1.253:10081/dolibarr/htdocs/compta/journal/purchasesjournal.php";;
+$nom=$langs->trans("PurchasesJournal");
 $year_current = strftime("%Y",dol_now());
 $pastmonth = strftime("%m",dol_now()) - 1;
-$pastmonthyear = $year_current; 
-if ($pastmonth == 0) 
+$pastmonthyear = $year_current;
+if ($pastmonth == 0)
 {
 	$pastmonth = 12;
 	$pastmonthyear--;
 }
 
-$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]);
-$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
+if ($_REQUEST["yearid"] != NULL)
+{
+	$year=$_REQUEST["yearid"];
+}else
+{
+	$year=$year_current;
+}
+
+if ($_REQUEST["monthid"] != NULL)
+{
+	$month=$_REQUEST["monthid"];
+	$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]);
+	$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
+	$year=$_REQUEST["date_startyear"];
+
+}else
+{
+	$month=$pastmonth;
+	$date_start=dol_get_first_day($year_current,$month);
+	$date_end=dol_get_last_day($year_current,$month);
+	$year=$year_current;
+
+}
+
 
 if (empty($date_start) || empty($date_end)) // We define date_start and date_end
 {
 	$date_start=dol_get_first_day($pastmonthyear,$pastmonth,false); $date_end=dol_get_last_day($pastmonthyear,$pastmonth,false);
+	$date_end=dol_get_last_day($pastmonthyear,$pastmonth,false);
 }
 
-$nom=$langs->trans("PurchasesJournal");
+if ($_REQUEST["action"] == $langs->trans("Export"))
+{
+	$export = TRUE;
+	 //date actuelle
+	$date = gmdate('D, d M Y H:i:s');
+
+
+	header("Content-Type: text/csv");
+	header('Content-Disposition: attachment; filename=' . $year . ($month < 10 ? "0".$month : $month) . "_" . str_replace(" ","_",$nom).".csv");
+	header('Last-Modified: '. $date . ' GMT');
+	header('Expires: ' . $date);
+
+	//header specifique IE :s parce que sinon il aime pas
+	if(preg_match('/msie|(microsoft internet explorer)/i', $_SERVER['HTTP_USER_AGENT']))
+	{
+		header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
+		header('Pragma: public');
+	}else
+	{
+		header('Pragma: no-cache');
+	}
+}else
+{
+	llxHeader('','','');
+	$html=new Form($db);
+	$period=$html->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,0,'',1,0,1) . "ou choisissez un mois et une ann&eacute;e" . $html->select_month($month,'monthid') . "-" . $html->select_year_b($year,'yearid',0, '10','0');
+
+}
+
+
 //$nomlink=;
 $builddate=time();
 $description=$langs->trans("DescPurchasesJournal");
-$period=$html->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,0,'',1,0,1);
-report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink);
 
 $p = explode(":", $conf->global->MAIN_INFO_SOCIETE_PAYS);
 $idpays = $p[0];
@@ -131,20 +180,30 @@
 else {
 	dol_print_error($db);
 }
-
+$db->close();
 /*
- * Show result array
+ * Show result array ... or not :-)
  */
-$i = 0;
-print "<table class=\"noborder\" width=\"100%\">";
-print "<tr class=\"liste_titre\">";
-///print "<td>".$langs->trans("JournalNum")."</td>";
-print "<td>".$langs->trans("Date")."</td>";
-print "<td>".$langs->trans("Piece").' ('.$langs->trans("InvoiceRef").")</td>";
-print "<td>".$langs->trans("Account")."</td>";
-print "<t><td>".$langs->trans("Type")."</td><td>".$langs->trans("Debit")."</td><td>".$langs->trans("Credit")."</td>";
-print "</tr>\n";
 
+if ($export == TRUE)
+{
+	print '"'.$langs->trans("Date").'","'.html_entity_decode($langs->trans("Piece"),3,'UTF-8').' ('.html_entity_decode($langs->trans("InvoiceRef"),3,'UTF-8').')","';
+	print html_entity_decode($langs->trans("Account"),3,'UTF-8').'","';
+	print html_entity_decode($langs->trans("Type"),3,'UTF-8').'","'.html_entity_decode($langs->trans("Debit"),3,'UTF-8').'","'.html_entity_decode($langs->trans("Credit"),3,'UTF-8').'"';
+	print "\n";
+}else
+{
+	report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink);
+	$i = 0;
+	print "<table class=\"noborder\" width=\"100%\">";
+	print "<tr class=\"liste_titre\">";
+	///print "<td>".$langs->trans("JournalNum")."</td>";
+	print "<td>".$langs->trans("Date")."</td>";
+	print "<td>".$langs->trans("Piece").' ('.$langs->trans("InvoiceRef").")</td>";
+	print "<td>".$langs->trans("Account")."</td>";
+	print "<t><td>".$langs->trans("Type")."</td><td>".$langs->trans("Debit")."</td><td>".$langs->trans("Credit")."</td>";
+	print "</tr>\n";
+}
 $var=true;
 $r='';
 
@@ -156,27 +215,50 @@
 	$invoicestatic->ref=$val["ref"];
 	$invoicestatic->type=$val["type"];
 
-	print "<tr ".$bc[$var]." >";
-	// third party
-	//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
-	print "<td>".$val["date"]."</td>";
-	print "<td>".$invoicestatic->getNomUrl(1)."</td>";
-
+	if ($export == TRUE)
+	{
+		print '"'.$val["date"].'",';
+		print '"'.$invoicestatic->ref.'",';
+	}else
+	{
+		print "<tr ".$bc[$var]." >";
+		// third party
+		//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
+		print "<td>".$val["date"]."</td>";
+		print "<td>".$invoicestatic->getNomUrl(1)."</td>";
+	}
 	foreach ($tabttc[$key] as $k => $mt)
 	{
-		print "<td>".$k."</td><td>".$langs->trans("ThirdParty")."</td><td>".($mt>=0?$mt:'')."</td><td>".($mt<0?-$mt:'')."</td>";
+		if ($export == TRUE)
+		{
+			print '"'.html_entity_decode($k,3,'UTF-8').'","'.$langs->trans("ThirdParty").'",'.($mt>=0?$mt:'0').','.($mt<0?-$mt:'0')."\n";
+		}else
+		{
+			print "<td>".$k."</td><td>".$langs->trans("ThirdParty")."</td><td>".($mt>=0?$mt:'')."</td><td>".($mt<0?-$mt:'')."</td>";
+		}
+	}
+	if ($export != TRUE)
+	{
+		print "</tr>";
 	}
-	print "</tr>";
-	// product
+		// product
 	foreach ($tabht[$key] as $k => $mt)
 	{
 		if ($mt)
 		{
-			print "<tr ".$bc[$var]." >";
-			//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
-			print "<td>".$val["date"]."</td>";
-			print "<td>".$invoicestatic->getNomUrl(1)."</td>";
-			print "<td>".$k."</td><td>".$langs->trans("Products")."</td><td>".($mt<0?-$mt:'')."</td><td>".($mt>=0?$mt:'')."</td></tr>";
+			if ($export == TRUE)
+			{
+				print '"'.$val["date"].'",';
+				print '"'.$invoicestatic->ref.'",';
+				print '"'.html_entity_decode($k,3,'UTF-8').'","'.$langs->trans("Products").'",'.($mt<0?-$mt:'0').','.($mt>=0?$mt:'0')."\n";
+			}else
+			{
+				print "<tr ".$bc[$var]." >";
+				//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
+				print "<td>".$val["date"]."</td>";
+				print "<td>".$invoicestatic->getNomUrl(1)."</td>";
+				print "<td>".$k."</td><td>".$langs->trans("Products")."</td><td>".($mt<0?-$mt:'')."</td><td>".($mt>=0?$mt:'')."</td></tr>";
+			}
 		}
 	}
 	// vat
@@ -185,21 +267,32 @@
 	{
 		if ($mt)
 		{
-			print "<tr ".$bc[$var]." >";
-			//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
-			print "<td>".$val["date"]."</td>";
-			print "<td>".$invoicestatic->getNomUrl(1)."</td>";
-			print "<td>".$k."</td><td>".$langs->trans("VAT")." ".$key."</td><td>".($mt<0?-$mt:'')."</td><td>".($mt>=0?$mt:'')."</td></tr>";
+			if ($export == TRUE)
+			{
+				print '"'.$val["date"].'",';
+				print '"'.$invoicestatic->ref.'",';
+				print '"'.html_entity_decode($k,3,'UTF-8').'","'.$langs->trans("VAT").'",'.($mt<0?-$mt:'0').','.($mt>=0?$mt:'0');
+			}else
+			{
+				print "<tr ".$bc[$var]." >";
+				//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
+				print "<td>".$val["date"]."</td>";
+				print "<td>".$invoicestatic->getNomUrl(1)."</td>";
+				print "<td>".$k."</td><td>".$langs->trans("VAT")." ".$key."</td><td>".($mt<0?-$mt:'')."</td><td>".($mt>=0?$mt:'')."</td></tr>";
+			}
+		}
+		if ($export == TRUE)
+		{
+			print "\n";
 		}
 	}
 
 	$var = !$var;
 }
-
-print "</table>";
-
-
+if ($export != TRUE)
+{
+	print "</table>";
+	llxFooter('$Date: 2011/01/05 15:15:20 $ - $Revision: 1.7 $');
+}
 // End of page
-$db->close();
-llxFooter('$Date: 2011/01/05 15:15:20 $ - $Revision: 1.7 $');
 ?>
\ Pas de fin de ligne à la fin du fichier.
diff -BNaur '--exclude=CVS' '--exclude=*.patch' '--exclude=.#*' '--exclude=*~' '--exclude=*.rej' '--exclude=*.orig' '--exclude=*.bak' '--exclude=conf.php' '--exclude=documents' ./dolibarr/htdocs/compta/journal/sellsjournal.php ./dolibarr3.0/htdocs/compta/journal/sellsjournal.php
--- ./dolibarr/htdocs/compta/journal/sellsjournal.php	2011-01-05 16:15:20.000000000 +0100
+++ ./dolibarr3.0/htdocs/compta/journal/sellsjournal.php	2011-05-28 12:48:49.682578282 +0200
@@ -32,6 +32,8 @@
 {
 	accessforbidden();
 }
+$nom=$langs->trans("SellsJournal");
+//$nomlink=;
 
 
 /*******************************************************************
@@ -47,36 +49,93 @@
 * Put here all code to build page
 ****************************************************/
 
-llxHeader('','','');
 
-$html=new Form($db);
 
 // Put here content of your page
 // ...
+$builddate=time();
+$description=$langs->trans("DescSellsJournal");
 
+$exportlink="https://192.168.1.253:10081/dolibarr/htdocs/compta/journal/sellsjournal.php";;
 $year_current = strftime("%Y",dol_now());
 $pastmonth = strftime("%m",dol_now()) - 1;
-$pastmonthyear = $year_current; 
-if ($pastmonth == 0) 
+$pastmonthyear = $year_current;
+
+if ($pastmonth == 0)
 {
 	$pastmonth = 12;
 	$pastmonthyear--;
 }
 
-$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]);
-$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
+if ($_REQUEST["yearid"] != NULL)
+{
+	$year=$_REQUEST["yearid"];
+}else
+{
+	$year=$year_current;
+}
+
+
+if ($_REQUEST["monthid"] != NULL)
+{
+	//echo "monthid non nul";
+	$month=$_REQUEST["monthid"];
+	$date_start=dol_get_first_day($year,$month);
+	$date_end=dol_get_last_day($year,$month);
+
+}else
+{
+	//echo "monthid nul";
+	$month=$pastmonth;
+	$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]);
+	$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
+	if (isset($_REQUEST["date_startyear"]))
+	{
+		$year=$_REQUEST["date_startyear"];
+	}
+
+}
+
 
 if (empty($date_start) || empty($date_end)) // We define date_start and date_end
 {
-	$date_start=dol_get_first_day($pastmonthyear,$pastmonth,false); $date_end=dol_get_last_day($pastmonthyear,$pastmonth,false);
+	$date_start=dol_get_first_day($pastmonthyear,$pastmonth,false);
+	$date_end=dol_get_last_day($pastmonthyear,$pastmonth,false);
 }
 
-$nom=$langs->trans("SellsJournal");
-//$nomlink=;
-$builddate=time();
-$description=$langs->trans("DescSellsJournal");
-$period=$html->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,0,'',1,0,1);
-report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink);
+if ($_REQUEST["action"] == $langs->trans("Export"))
+{
+	$export = TRUE;
+	 //date actuelle
+	$date = gmdate('D, d M Y H:i:s');
+
+
+	header("Content-Type: text/csv");
+	header('Content-Disposition: attachment; filename=' . $year . ($month < 10 ? "0".$month : $month) . "_" . str_replace(" ","_",$nom).".csv");
+	header('Last-Modified: '. $date . ' GMT');
+	header('Expires: ' . $date);
+	//header specifique IE :s parce que sinon il aime pas
+	if(preg_match('/msie|(microsoft internet explorer)/i', $_SERVER['HTTP_USER_AGENT']))
+	{
+		header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
+		header('Pragma: public');
+	}else
+	{
+		header('Pragma: no-cache');
+	}
+}else
+{
+	llxHeader('','','');
+	$html=new Form($db);
+	$period=$html->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,0,'',1,0,1) . "ou choisissez un mois et une ann&eacute;e" . $html->select_month($month,'monthid') . "-" . $html->select_year_b($year,'yearid',0, '10','0');
+
+}
+
+/*if ( $export != TRUE )
+{
+	$period=$html->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,0,'',1,0,1) .  $html->select_month($month,$htmlname='monthid',$useempty=0);
+
+}*/
 
 $p = explode(":", $conf->global->MAIN_INFO_SOCIETE_PAYS);
 $idpays = $p[0];
@@ -90,7 +149,7 @@
 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '".$idpays."'";
 $sql .= " WHERE f.fk_statut > 0 AND f.entity IN (0,".$conf->entity.")";
 if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
-$sql .= " order by f.rowid";
+$sql .= " order by f.datef";
 
 $result = $db->query($sql);
 if ($result)
@@ -138,16 +196,24 @@
  * Show result array
  */
 
-
-$i = 0;
-print "<table class=\"noborder\" width=\"100%\">";
-print "<tr class=\"liste_titre\">";
-//print "<td>".$langs->trans("JournalNum")."</td>";
-print "<td>".$langs->trans("Date")."</td><td>".$langs->trans("Piece").' ('.$langs->trans("InvoiceRef").")</td>";
-print "<td>".$langs->trans("Account")."</td>";
-print "<t><td>".$langs->trans("Type")."</td><td>".$langs->trans("Debit")."</td><td>".$langs->trans("Credit")."</td>";
-print "</tr>\n";
-
+if ($export == TRUE)
+{
+	print '"'.$langs->trans("Date").'","'.html_entity_decode($langs->trans("Piece"),3,'UTF-8').' ('.html_entity_decode($langs->trans("InvoiceRef"),3,'UTF-8').')","';
+	print html_entity_decode($langs->trans("Account"),3,'UTF-8').'","';
+	print html_entity_decode($langs->trans("Type"),3,'UTF-8').'","'.html_entity_decode($langs->trans("Debit"),3,'UTF-8').'","'.html_entity_decode($langs->trans("Credit"),3,'UTF-8').'"';
+	print "\n";
+}else
+{
+	report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink);
+	$i = 0;
+	print "<table class=\"noborder\" width=\"100%\">";
+	print "<tr class=\"liste_titre\">";
+	//print "<td>".$langs->trans("JournalNum")."</td>";
+	print "<td>".$langs->trans("Date")."</td><td>".$langs->trans("Piece").' ('.$langs->trans("InvoiceRef").")</td>";
+	print "<td>".$langs->trans("Account")."</td>";
+	print "<t><td>".$langs->trans("Type")."</td><td>".$langs->trans("Debit")."</td><td>".$langs->trans("Credit")."</td>";
+	print "</tr>\n";
+}
 $var=true;
 $r='';
 
@@ -158,50 +224,93 @@
 	$invoicestatic->id=$key;
 	$invoicestatic->ref=$val["ref"];
 	$invoicestatic->type=$val["type"];
-	
-	print "<tr ".$bc[$var].">";
-	// third party
-	//print "<td>".$conf->global->COMPTA_JOURNAL_SELL."</td>";
-	print "<td>".$val["date"]."</td>";
-	print "<td>".$invoicestatic->getNomUrl(1)."</td>";
+	$date_a = substr($val["date"],8,2) . '/' . substr($val["date"],5,2) .'/'. substr($val["date"],0,4);
+	if ($export == TRUE)
+	{
+		print '"'.$date_a.'","';
+		print $invoicestatic->ref . '",';
+	}else
+	{
+		print "<tr ".$bc[$var].">";
+		print "<td>".$date_a."</td>";
+		print "<td>".$invoicestatic->getNomUrl(1)."</td>";
+	}
 	foreach ($tabttc[$key] as $k => $mt)
 	{
-		print "<td>".$k."</td><td>".$langs->trans("ThirdParty")."</td><td>".($mt>=0?$mt:'')."</td><td>".($mt<0?-$mt:'')."</td>";
+		if ($export == TRUE)
+		{
+			print '"'.html_entity_decode($k,3,'UTF-8').'","'.$langs->trans("ThirdParty").'",'.($mt>=0?$mt:'0').','.($mt<0?-$mt:'0');
+		}else
+		{
+			print "<td>".$k."</td><td>".$langs->trans("ThirdParty")."</td><td>".($mt>=0?$mt:'')."</td><td>".($mt<0?-$mt:'')."</td>";
+		}
 	}
-	print "</tr>";
+	if ($export != TRUE)
+		{
+			print "</tr>";
+		}else
+		{
+			print "\n";
+		}
 	// product
 	foreach ($tabht[$key] as $k => $mt)
 	{
 		if ($mt)
 		{
-			print "<tr ".$bc[$var].">";
-			//print "<td>".$conf->global->COMPTA_JOURNAL_SELL."</td>";
-			print "<td>".$val["date"]."</td>";
-			print "<td>".$invoicestatic->getNomUrl(1)."</td>";
-			print "<td>".$k."</td><td>".$langs->trans("Products")."</td><td>".($mt<0?-$mt:'')."</td><td>".($mt>=0?$mt:'')."</td></tr>";
+			if ($export == TRUE)
+			{
+				print '"'.$date_a.'","';
+				//print $invoicestatic->getNomUrl(1).'","';
+				print $invoicestatic->ref . '",';
+				print '"'.html_entity_decode($k,3,'UTF-8').'","'.$langs->trans("Products").'",'.($mt<0?-$mt:'0').','.($mt>=0?$mt:'0')."\n";
+			}else
+			{
+				print "<tr ".$bc[$var].">";
+				//print "<td>".$conf->global->COMPTA_JOURNAL_SELL."</td>";
+				print "<td>".$date_a."</td>";
+				print "<td>".$invoicestatic->getNomUrl(1)."</td>";
+				print "<td>".$k."</td><td>".$langs->trans("Products")."</td><td>".($mt<0?-$mt:'')."</td><td>".($mt>=0?$mt:'')."</td></tr>";
+			}
 		}
 	}
 	// vat
 	//var_dump($tabtva);
 	foreach ($tabtva[$key] as $k => $mt)
 	{
-	    if ($mt)
-	    {
-    		print "<tr ".$bc[$var].">";
-    		//print "<td>".$conf->global->COMPTA_JOURNAL_SELL."</td>";
-    		print "<td>".$val["date"]."</td>";
-    		print "<td>".$invoicestatic->getNomUrl(1)."</td>";
-    		print "<td>".$k."</td><td>".$langs->trans("VAT")." ".$key."</td><td>".($mt<0?-$mt:'')."</td><td>".($mt>=0?$mt:'')."</td></tr>";
-	    }
+		if ($mt)
+		{
+			if ($export == TRUE)
+			{
+				print '"'.$date_a.'","';
+				print $invoicestatic->ref . '",';
+				print '"'.html_entity_decode($k,3,'UTF-8').'","'.$langs->trans("VAT").'",'.($mt<0?-$mt:'0').','.($mt>=0?$mt:'0');
+
+			}else
+			{
+				print "<tr ".$bc[$var].">";
+				//print "<td>".$conf->global->COMPTA_JOURNAL_SELL."</td>";
+				print "<td>".$date_a."</td>";
+				print "<td>".$invoicestatic->getNomUrl(1)."</td>";
+				print "<td>".$k."</td><td>".$langs->trans("VAT")." ".$key."</td><td>".($mt<0?-$mt:'')."</td><td>".($mt>=0?$mt:'')."</td></tr>";
+			}
+		}
+		if ($export == TRUE)
+		{
+			print "\n";
+		}
 	}
-
 	$var = !$var;
+
+}
+$db->close();
+if ($export != TRUE)
+{
+	print "</table>";
+	llxFooter('$Date: 2011/01/05 15:15:20 $ - $Revision: 1.7 $');
 }
 
-print "</table>";
+// End of page
 
 
-// End of page
-$db->close();
-llxFooter('$Date: 2011/01/05 15:15:20 $ - $Revision: 1.7 $');
-?>
\ Pas de fin de ligne à la fin du fichier.
+
+?>
diff -BNaur '--exclude=CVS' '--exclude=*.patch' '--exclude=.#*' '--exclude=*~' '--exclude=*.rej' '--exclude=*.orig' '--exclude=*.bak' '--exclude=conf.php' '--exclude=documents' ./dolibarr/htdocs/core/class/.directory ./dolibarr3.0/htdocs/core/class/.directory
--- ./dolibarr/htdocs/core/class/.directory	1970-01-01 01:00:00.000000000 +0100
+++ ./dolibarr3.0/htdocs/core/class/.directory	2011-05-28 13:27:59.760158041 +0200
@@ -0,0 +1,5 @@
+[Dolphin]
+AdditionalInfo=31
+SortOrder=0
+Timestamp=2011,5,28,13,27,59
+ViewMode=1
diff -BNaur '--exclude=CVS' '--exclude=*.patch' '--exclude=.#*' '--exclude=*~' '--exclude=*.rej' '--exclude=*.orig' '--exclude=*.bak' '--exclude=conf.php' '--exclude=documents' ./dolibarr/htdocs/core/class/html.form.class.php ./dolibarr3.0/htdocs/core/class/html.form.class.php
--- ./dolibarr/htdocs/core/class/html.form.class.php	2011-05-25 18:53:40.000000000 +0200
+++ ./dolibarr3.0/htdocs/core/class/html.form.class.php	2011-05-28 15:50:58.000000000 +0200
@@ -3081,6 +3081,83 @@
         return;
     }
 
+
+     /**
+     *    	\brief      Return HTML combo list of month
+     *    	\param      selected          Preselected value
+     *    	\param      htmlname          Nom de la zone select
+     *    	\param      useempty          Affiche valeur vide dans liste
+     * 		TODO Move into html.formother
+     */
+    function select_month($selected='',$htmlname='monthid',$useempty=0, $nooutput=0)
+    {
+        $month = monthArrayOrSelected(-1);	// Get array
+
+        $select_month = '<select class="flat" name="'.$htmlname.'">';
+        if ($useempty)
+        {
+            $select_month .= '<option value="0">&nbsp;</option>';
+        }
+        foreach ($month as $key => $val)
+        {
+            if ($selected == $key)
+            {
+                $select_month .= '<option value="'.$key.'" selected="selected">';
+            }
+            else
+            {
+                $select_month .= '<option value="'.$key.'">';
+            }
+            $select_month .= $val;
+        }
+        $select_month .= '</select>';
+        if ($nooutput != 1)
+        {
+			print $select_month;
+        }
+        return $select_month;
+    }
+
+   /**
+     *    	\brief      Return HTML combo list of years
+     *    	\param      selected          Preselected value (''=current year, -1=none, year otherwise)
+     *    	\param      htmlname          Name of HTML select object
+     *    	\param      useempty          Affiche valeur vide dans liste
+     *    	\param      $min_year         Offset of minimum year into list (by default current year -10)
+     *    	\param      $max_year         Offset of maximum year into list (by default current year + 5)
+     * 		TODO Move into html.formother
+     */
+	function select_year($selected='',$htmlname='yearid',$useempty=0, $min_year=10, $max_year=5, $nooutput=0)
+    {
+        $currentyear = date("Y");
+    	$max_year = $currentyear+$max_year;
+        $min_year = $currentyear-$min_year;
+        if(empty($selected)) $selected = $currentyear;
+
+        $output= '<select class="flat" name="' . $htmlname . '">';
+        if($useempty)
+        {
+            if ($selected == '') $selected_html = ' selected="selected"';
+            $output .= '<option value=""' . $selected_html . '>&nbsp;</option>';
+        }
+        for ($y = $max_year; $y >= $min_year; $y--)
+        {
+            $selected_html='';
+            if ($selected > 0 && $y == $selected) $selected_html = ' selected="selected"';
+            $output .= '<option value="'.$y.'"'.$selected_html.' >'.$y.'</option>';
+        }
+        $output .= "</select>\n";
+        if ($nooutput != 1)
+        {
+			print $output;
+        }
+        return $output;
+    }
+
+
+
+
+
     /**
      *	Function to show a form to select a duration on a page
      *	@param		prefix   	prefix
diff -BNaur '--exclude=CVS' '--exclude=*.patch' '--exclude=.#*' '--exclude=*~' '--exclude=*.rej' '--exclude=*.orig' '--exclude=*.bak' '--exclude=conf.php' '--exclude=documents' ./dolibarr/htdocs/.directory ./dolibarr3.0/htdocs/.directory
--- ./dolibarr/htdocs/.directory	1970-01-01 01:00:00.000000000 +0100
+++ ./dolibarr3.0/htdocs/.directory	2011-05-28 13:25:51.213680363 +0200
@@ -0,0 +1,5 @@
+[Dolphin]
+AdditionalInfo=31
+SortOrder=0
+Timestamp=2011,5,28,13,25,51
+ViewMode=1
diff -BNaur '--exclude=CVS' '--exclude=*.patch' '--exclude=.#*' '--exclude=*~' '--exclude=*.rej' '--exclude=*.orig' '--exclude=*.bak' '--exclude=conf.php' '--exclude=documents' ./dolibarr/htdocs/langs/fr_FR/compta.lang ./dolibarr3.0/htdocs/langs/fr_FR/compta.lang
--- ./dolibarr/htdocs/langs/fr_FR/compta.lang	2011-05-18 21:28:01.000000000 +0200
+++ ./dolibarr3.0/htdocs/langs/fr_FR/compta.lang	2011-05-28 12:33:50.046848095 +0200
@@ -77,6 +77,7 @@
 ByThirdParties=Par tiers
 ByUserAuthorOfInvoice=Par auteur de la facture
 AccountancyExport=Export comptable
+Export=Exporter
 ErrorWrongAccountancyCodeForCompany=Code compta client incorrect pour %s
 SuppliersProductsSellSalesTurnover=Chiffre d'affaires généré par la vente des produits des fournisseurs
 CheckReceipt=Bordereau de remise de chèques
diff -BNaur '--exclude=CVS' '--exclude=*.patch' '--exclude=.#*' '--exclude=*~' '--exclude=*.rej' '--exclude=*.orig' '--exclude=*.bak' '--exclude=conf.php' '--exclude=documents' ./dolibarr/htdocs/langs/fr_FR/.directory ./dolibarr3.0/htdocs/langs/fr_FR/.directory
--- ./dolibarr/htdocs/langs/fr_FR/.directory	1970-01-01 01:00:00.000000000 +0100
+++ ./dolibarr3.0/htdocs/langs/fr_FR/.directory	2011-05-28 13:26:01.787048692 +0200
@@ -0,0 +1,5 @@
+[Dolphin]
+AdditionalInfo=31
+SortOrder=0
+Timestamp=2011,5,28,13,26,1
+ViewMode=1
diff -BNaur '--exclude=CVS' '--exclude=*.patch' '--exclude=.#*' '--exclude=*~' '--exclude=*.rej' '--exclude=*.orig' '--exclude=*.bak' '--exclude=conf.php' '--exclude=documents' ./dolibarr/htdocs/lib/.directory ./dolibarr3.0/htdocs/lib/.directory
--- ./dolibarr/htdocs/lib/.directory	1970-01-01 01:00:00.000000000 +0100
+++ ./dolibarr3.0/htdocs/lib/.directory	2011-05-28 13:25:39.184261306 +0200
@@ -0,0 +1,5 @@
+[Dolphin]
+AdditionalInfo=31
+SortOrder=0
+Timestamp=2011,5,28,13,25,39
+ViewMode=1
diff -BNaur '--exclude=CVS' '--exclude=*.patch' '--exclude=.#*' '--exclude=*~' '--exclude=*.rej' '--exclude=*.orig' '--exclude=*.bak' '--exclude=conf.php' '--exclude=documents' ./dolibarr/htdocs/lib/report.lib.php ./dolibarr3.0/htdocs/lib/report.lib.php
--- ./dolibarr/htdocs/lib/report.lib.php	2011-01-10 23:36:34.000000000 +0100
+++ ./dolibarr3.0/htdocs/lib/report.lib.php	2011-05-28 12:36:50.896018947 +0200
@@ -34,7 +34,7 @@
 *    @param      builddate       Date generation
 *    @param      exportlink      Link for export or ''
 */
-function report_header($nom,$variante='',$period,$periodlink,$description,$builddate,$exportlink='')
+function report_header($nom,$variante='',$period,$periodlink,$description,$builddate,$exportlink='',$exportbutton='')
 {
 	global $langs;
 
@@ -77,14 +77,18 @@
 	// Ligne d'export
 	print '<tr>';
 	print '<td>'.$langs->trans("GeneratedOn").'</td>';
-	if (! $exportlink) print '<td colspan="3">';
-	else print '<td>';
-	print dol_print_date($builddate);
-	if ($exportlink) print '</td><td>'.$langs->trans("Export").'</td><td>'.$exportlink;
-	print '</td></tr>';
+	print '<td colspan="3">' . dol_print_date($builddate) .'</td>';
+	print '</tr>';
+
+	print '<tr><td></td>';
+	print '<td colspan="' . ($exportlink ? 2 : 2 ) . '" align="center">';
+	print '<input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></td>';
+	if ($exportlink)
+	{
+		print '<td colspan="1" align="center">';
+		print '<input type="submit" class="button" name="action" value="'.$langs->trans("Export").'"></td>';
+	}
 
-	print '<tr>';
-	print '<td colspan="4" align="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></td>';
 	print '</tr>';
 
 	print '</table>';

Attachment: buildpatch.sh
Description: application/shellscript

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Dolibarr-dev mailing list
Dolibarr-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/dolibarr-dev

Répondre à