";
$ret.=th(_("Date"));
$ret.=th(_("Libellé"));
- $ret.=th(_("Num Pièce"));
$ret.=th("");
$ret.=th("");
$i=0;
@@ -325,16 +325,10 @@ class Anc_Operation
$ret.="";
$ret.=td($row['str_date']);
$ret.=td(h($row['oa_description']));
- $ret.=td(h($row['jr_pj_number']));
$js="anc_remove_operation(".$gDossier.",".$oldgroup.")";
$ret.="| ".HtmlInput::image_click("trash-24.gif", $js, _("Effacer"))." | ";
- if ( $row['jr_id'] != "") {
- $js="viewOperation({$row['jr_id']},{$gDossier})";
-
- } else {
- $js="anc_detail_op({$row['oa_group']},{$gDossier})";
- }
+ $js="anc_detail_op({$row['oa_group']},{$gDossier})";
$ret .= "". HtmlInput::image_click("crayon-mod-b24.png", $js, _("Modifier"))." | ";
$ret.="
";
}
diff --git a/include/class/package_repository.class.php b/include/class/package_repository.class.php
index d78af3aba..cfb3026ac 100644
--- a/include/class/package_repository.class.php
+++ b/include/class/package_repository.class.php
@@ -42,9 +42,17 @@ class Package_Repository
*/
function __construct()
{
- $content=file_get_contents(NOALYSS_PACKAGE_REPOSITORY."/web.xml");
+ // Check we can resolve the name
+ $host=parse_url(NOALYSS_PACKAGE_REPOSITORY,PHP_URL_HOST);
+
+ if (gethostbyname($host) != $host)
+ {
+ $content=file_get_contents(NOALYSS_PACKAGE_REPOSITORY."/web.xml");
+ $this->content=simplexml_load_string($content);
+ } else {
+ $this->content=NULL;
+ }
- $this->content=simplexml_load_string($content);
}
public function getContent()
@@ -72,6 +80,9 @@ class Package_Repository
function display_noalyss_info()
{
global $g_user;
+ if ( $this->content == NULL ) {
+ throw new Exception(_("Problème réseau"),10);
+ }
switch ($g_user->lang)
{
case 'fr_FR.utf8':
@@ -94,6 +105,9 @@ class Package_Repository
*/
function find_plugin($p_code)
{
+ if ( $this->content == NULL ) {
+ throw new Exception(_("Problème réseau"),10);
+ }
$a_plugin=$this->content->xpath('//plugins/plugin');
$nb_plugin=count($a_plugin);
for ($i=0; $i<$nb_plugin; $i++)
@@ -114,6 +128,9 @@ class Package_Repository
*/
function find_template($p_code)
{
+ if ( $this->content == NULL ) {
+ throw new Exception(_("Problème réseau"),10);
+ }
$a_template=$this->content->xpath('//database_template/dbtemplate');
$nb_template=count($a_template);
for ($i=0; $i<$nb_template; $i++)
@@ -128,6 +145,9 @@ class Package_Repository
function make_object($p_type, $p_id)
{
+ if ( $this->content == NULL ) {
+ throw new Exception(_("Problème réseau"),10);
+ }
switch ($p_type)
{
case "core":
diff --git a/include/class/print_ledger.class.php b/include/class/print_ledger.class.php
index ac3bf4a4a..ef43f9ea7 100644
--- a/include/class/print_ledger.class.php
+++ b/include/class/print_ledger.class.php
@@ -83,8 +83,14 @@ class Print_Ledger {
return $pdf;
}
}
- else
+ elseif ($jrn_type=='FIN')
+ {
+ $pdf=new Print_Ledger_Financial($cn, $p_ledger);
+ return $pdf;
+ } else
+ {
return new Print_Ledger_Detail($cn, $p_ledger);
+ }
break;
case 'L':
@@ -141,7 +147,7 @@ class Print_Ledger {
$jrn_type=$p_ledger->get_type();
if ($jrn_type=='FIN')
{
- $pdf=new Print_Ledger_Financial($cn, $p_ledger);
+ $pdf=new Print_Ledger_Detail($cn, $p_ledger);
return $pdf;
;
}
diff --git a/include/class/print_ledger_misc.class.php b/include/class/print_ledger_misc.class.php
index 8534f8be7..72910b4e6 100644
--- a/include/class/print_ledger_misc.class.php
+++ b/include/class/print_ledger_misc.class.php
@@ -40,12 +40,12 @@ class Print_Ledger_Misc extends PDF
//Line break
$this->Ln(20);
$this->SetFont('DejaVu', 'B', 7);
- $this->Cell(30,6,'Piece');
- $this->Cell(10,6,'Date');
- $this->Cell(20,6,'Interne');
- $this->Cell(25,6,'Tiers');
- $this->Cell(80,6,'Commentaire');
- $this->Cell(15,6,'Montant');
+ $this->Cell(10,6,_('Date'));
+ $this->Cell(30,6,_('Piece'));
+ $this->Cell(20,6,_('Interne'));
+ $this->Cell(25,6,_('Tiers'));
+ $this->Cell(80,6,_('Commentaire'));
+ $this->Cell(15,6,_('Montant'));
$this->Ln(6);
}
@@ -78,8 +78,8 @@ class Print_Ledger_Misc extends PDF
{
$row=$a_jrn[$i];
- $this->LongLine(30,5,$row['jr_pj_number']);
$this->write_cell(10,5, smaller_date($row['date']));
+ $this->LongLine(30,5,$row['jr_pj_number']);
$this->write_cell(20,5,$row['jr_internal']);
$type=$this->cn->get_value("select jrn_def_type from jrn_def where jrn_def_id=$1",array($a_jrn[$i]['jr_def_id']));
$other=mb_substr($this->ledger->get_tiers($type,$a_jrn[$i]['jr_id']),0,25);
diff --git a/include/export/export_ledger_csv.php b/include/export/export_ledger_csv.php
index 73e8008cd..7e43512ee 100644
--- a/include/export/export_ledger_csv.php
+++ b/include/export/export_ledger_csv.php
@@ -106,7 +106,7 @@ if ( $get_option=="E")
{
if ($jrn_type=='FIN')
{
- $get_option='L';
+ $get_option='A';
}
elseif ($jrn_type=='ODS'||$Jrn->id==0)
{
@@ -178,6 +178,91 @@ if ($get_option=='A')
$acc_ledger_history->export_csv();
exit;
}
+/**
+ * Mode list for ODS , FIN and GL
+ */
+if ($get_option=="L" && ($jrn_type=='ODS'||$jrn_type=='FIN'||$jrn_type=='GL') )
+{
+ if ( $get_jrn==0) {
+ $Row=$Jrn->get_rowSimple($get_from_periode, $get_to_periode, $a_jrn);
+ }else {
+ $Row=$Jrn->get_rowSimple($get_from_periode, $get_to_periode);
+ }
+ $cn->prepare('reconcile_date_csv',
+ 'select *
+ from
+ jrn
+ where
+ jr_id in
+ (select
+ jra_concerned
+ from
+ jrn_rapt
+ where jr_id = $1
+ union all
+ select
+ jr_id
+ from jrn_rapt
+ where jra_concerned=$1)');
+ $title=array();
+ $title[]=_("operation");
+ $title[]=_("Date");
+ $title[]=_("N° Pièce");
+ $title[]=_("QuickCode");
+ $title[]=_("Tiers");
+ $title[]=_("commentaire");
+ $title[]=_("internal");
+ $title[]=_("montant");
+ $export->write_header($title);
+ foreach ($Row as $line)
+ {
+ $tiers_id=$Jrn->get_tiers_id($line['jrn_def_type'], $line['jr_id']);
+ $fiche_tiers=new Fiche($cn, $tiers_id);
+ $tiers=$fiche_tiers->strAttribut(ATTR_DEF_NAME, 0)." ".$fiche_tiers->strAttribut(ATTR_DEF_FIRST_NAME,
+ 0);
+
+ $export->add($line['num']);
+ $export->add($line['date']);
+ $export->add($line['jr_pj_number']);
+ $export->add($fiche_tiers->get_quick_code());
+ $export->add($tiers);
+ $export->add($line['comment']);
+ $export->add($line['jr_internal']);
+ // echo "".$line['pj'].";";
+ // If the ledger is financial :
+ // the credit must be negative and written in red
+ // Get the jrn type
+ if ($line['jrn_def_type']=='FIN')
+ {
+ $positive=$cn->get_value("select qf_amount from quant_fin ".
+ " where jr_id=$1", array($line['jr_id']));
+
+ $export->add($positive, "number");
+ $export->add("");
+ }
+ else
+ {
+ $export->add($line['montant'], "number");
+ }
+ //------ Add reconcilied operation ---------------
+ $ret_reconcile=$cn->execute('reconcile_date_csv',
+ array($line['jr_id']));
+ $max=Database::num_row($ret_reconcile);
+ if ($max>0)
+ {
+ for ($e=0; $e<$max; $e++)
+ {
+ $row=Database::fetch_array($ret_reconcile, $e);
+ $export->add($row['jr_date']);
+ $export->add($row['jr_internal']);
+ $export->add($row['jr_pj_number']);
+ }
+ }
+ $export->write();
+ }
+ return;
+}
+
//-----------------------------------------------------------------------------
// Detail printing for ACH or VEN : 1 row resume the situation with VAT, DNA
// for Misc the amount
@@ -187,87 +272,20 @@ if ($get_option=="L" || $get_option == 'D')
{
//-----------------------------------------------------
- if ($jrn_type=='ODS'||$jrn_type=='FIN'||$jrn_type=='GL')
+ if ($jrn_type=='ODS'||$jrn_type=='FIN'||$jrn_type=='GL')
{
- if ( $get_jrn==0) {
- $Row=$Jrn->get_rowSimple($get_from_periode, $get_to_periode, $a_jrn);
- }else {
- $Row=$Jrn->get_rowSimple($get_from_periode, $get_to_periode);
- }
- $cn->prepare('reconcile_date_csv',
- 'select *
- from
- jrn
- where
- jr_id in
- (select
- jra_concerned
- from
- jrn_rapt
- where jr_id = $1
- union all
- select
- jr_id
- from jrn_rapt
- where jra_concerned=$1)');
- $title=array();
- $title[]=_("operation");
- $title[]=_("Date");
- $title[]=_("N° Pièce");
- $title[]=_("QuickCode");
- $title[]=_("Tiers");
- $title[]=_("commentaire");
- $title[]=_("internal");
- $title[]=_("montant");
- $export->write_header($title);
- foreach ($Row as $line)
+ if ($get_jrn == 0 )
{
- $tiers_id=$Jrn->get_tiers_id($line['jrn_def_type'], $line['jr_id']);
- $fiche_tiers=new Fiche($cn, $tiers_id);
- $tiers=$fiche_tiers->strAttribut(ATTR_DEF_NAME, 0)." ".$fiche_tiers->strAttribut(ATTR_DEF_FIRST_NAME,
- 0);
+ $acc_ledger_history=new Acc_Ledger_History_Generic($cn, $a_jrn,
+ $get_from_periode, $get_to_periode, 'D');
+ } else {
+ $acc_ledger_history=new Acc_Ledger_History_Generic($cn, array($a_jrn),
+ $get_from_periode, $get_to_periode, 'D');
- $export->add($line['num']);
- $export->add($line['date']);
- $export->add($line['jr_pj_number']);
- $export->add($fiche_tiers->get_quick_code());
- $export->add($tiers);
- $export->add($line['comment']);
- $export->add($line['jr_internal']);
- // echo " | ".$line['pj'].";";
- // If the ledger is financial :
- // the credit must be negative and written in red
- // Get the jrn type
- if ($line['jrn_def_type']=='FIN')
- {
- $positive=$cn->get_value("select qf_amount from quant_fin ".
- " where jr_id=$1", array($line['jr_id']));
-
- $export->add($positive, "number");
- $export->add("");
- }
- else
- {
- $export->add($line['montant'], "number");
- }
- //------ Add reconcilied operation ---------------
- $ret_reconcile=$cn->execute('reconcile_date_csv',
- array($line['jr_id']));
- $max=Database::num_row($ret_reconcile);
- if ($max>0)
- {
- for ($e=0; $e<$max; $e++)
- {
- $row=Database::fetch_array($ret_reconcile, $e);
- $export->add($row['jr_date']);
- $export->add($row['jr_internal']);
- $export->add($row['jr_pj_number']);
- }
- }
- $export->write();
}
+ $acc_ledger_history->export_csv();
+ return;
}
-
//------------------------------------------------------------------------------
// One line summary with tiers, amount VAT, DNA, tva code ....
//
diff --git a/include/history_operation.inc.php b/include/history_operation.inc.php
index 6fb364684..20113ba9f 100644
--- a/include/history_operation.inc.php
+++ b/include/history_operation.inc.php
@@ -42,6 +42,7 @@ switch($ledger_type)
{
case 'ACH':
$ask_pay=1;
+ $p_array['ledger_type']='ACH';
break;
case 'ODS':
$ask_pay=0;
@@ -53,9 +54,11 @@ switch($ledger_type)
break;
case 'VEN':
$ask_pay=1;
+ $p_array['ledger_type']='VEN';
break;
case 'FIN':
$ask_pay=0;
+ $p_array['ledger_type']='FIN';
break;
}
@@ -95,7 +98,9 @@ if (!isset($p_array['date_start']))
}
else
{
- $msg=''._("Période ").$_GET['date_start']._(" au ").$_GET['date_end'].'';
+ $date_start=$http->get("date_start","string","");
+ $date_end=$http->get("date_end","string","");
+ $msg=''.sprintf(_("Période %s au %s "),$date_start,$date_end) .'';
}
/* compute the sql stmt */
@@ -118,7 +123,22 @@ echo dossier::hidden();
list($count, $html) = $Ledger->list_operation($sql, $offset, $ask_pay);
echo $html;
echo $bar;
-$r = HtmlInput::get_to_hidden(array('l', 'date_start', 'date_end', 'desc', 'amount_min', 'amount_max', 'qcode', 'accounting', 'unpaid', 'gDossier', 'ledger_type', 'p_action'));
+$r = HtmlInput::get_to_hidden(array('search_opnb_jrn',
+ 'search_opqcode',
+ 'l',
+ 'date_start',
+ 'date_end',
+ 'date_paid_start',
+ 'date_paid_end',
+ 'desc',
+ 'amount_min',
+ 'amount_max',
+ 'qcode',
+ 'accounting',
+ 'unpaid',
+ 'gDossier',
+ 'ledger_type',
+ 'p_action'));
if (isset($_GET['r_jrn']))
{
foreach ($_GET['r_jrn'] as $k => $v)
@@ -145,7 +165,8 @@ echo '';
echo '';
diff --git a/include/template/acc_ledger_history_financial_oneline.php b/include/template/acc_ledger_history_financial_oneline.php
index 67929719b..bdcff150b 100644
--- a/include/template/acc_ledger_history_financial_oneline.php
+++ b/include/template/acc_ledger_history_financial_oneline.php
@@ -28,7 +28,9 @@ if (!defined('ALLOWED'))
?>
+ | = _('Date') ?> |
= _('Banque') ?> |
+ =_('Pièce')?> |
= _("Tiers") ?> |
= _("Libellé") ?> |
= _("Montant") ?> |
@@ -41,9 +43,15 @@ if (!defined('ALLOWED'))
$class=($i%2==0)?' class="even" ':' class="odd" ';
?>
>
+ |
+ =$this->data[$i]['str_date']?>
+ |
= $this->data[$i]['bk_qcode']; ?>
|
+
+ = $this->data[$i]['jr_pj_number']; ?>
+ |
data[$i]['tiers_f_id'],
diff --git a/include/template/acc_ledger_history_purchase_detail.php b/include/template/acc_ledger_history_purchase_detail.php
index ea39c3fc7..d563af211 100644
--- a/include/template/acc_ledger_history_purchase_detail.php
+++ b/include/template/acc_ledger_history_purchase_detail.php
@@ -79,8 +79,8 @@ foreach ($this->data as $line) {
echo " | " . h($line['jr_pj_number']) . " | ";
// Date
- echo "" . smaller_date($line['jr_date']) . " | ";
- echo "" . smaller_date($line['jr_date_paid']) . " | ";
+ echo "" . smaller_date($line['str_date']) . " | ";
+ echo "" . smaller_date($line['str_date_paid']) . " | ";
// Internal with detail
echo "" . HtmlInput::detail_op($line['jr_id'], $line['jr_internal']) . " | ";
diff --git a/include/template/acc_ledger_history_purchase_extended.php b/include/template/acc_ledger_history_purchase_extended.php
index a30de3321..8f7b4eec1 100644
--- a/include/template/acc_ledger_history_purchase_extended.php
+++ b/include/template/acc_ledger_history_purchase_extended.php
@@ -69,10 +69,10 @@ for ($i=0;$i<$nb_data;$i++):
?>
>
|
- =$this->data[$i]['jr_date']?>
+ =$this->data[$i]['str_date']?>
|
- =$this->data[$i]['jr_date_paid']?>
+ =$this->data[$i]['str_date_paid']?>
|
=$this->data[$i]['jr_pj_number']?>
diff --git a/include/template/acc_ledger_history_purchase_oneline.php b/include/template/acc_ledger_history_purchase_oneline.php
index 3a6d78320..f60544d97 100644
--- a/include/template/acc_ledger_history_purchase_oneline.php
+++ b/include/template/acc_ledger_history_purchase_oneline.php
@@ -84,10 +84,10 @@ for ($i=0;$i<$nb_data;$i++):
?>
| >
|
- =$this->data[$i]['jr_date']?>
+ =$this->data[$i]['str_date']?>
|
- =$this->data[$i]['jr_date_paid']?>
+ =$this->data[$i]['str_date_paid']?>
|
=$this->data[$i]['jr_pj_number']?>
diff --git a/include/template/acc_ledger_history_sale_detail.php b/include/template/acc_ledger_history_sale_detail.php
index a48516380..e747884a3 100644
--- a/include/template/acc_ledger_history_sale_detail.php
+++ b/include/template/acc_ledger_history_sale_detail.php
@@ -77,8 +77,8 @@ foreach ($this->data as $line) {
echo " | " . h($line['jr_pj_number']) . " | ";
// Date
- echo "" . smaller_date($line['jr_date']) . " | ";
- echo "" . smaller_date($line['jr_date_paid']) . " | ";
+ echo "" . smaller_date($line['str_date']) . " | ";
+ echo "" . smaller_date($line['str_date_paid']) . " | ";
// Internal with detail
echo "" . HtmlInput::detail_op($line['jr_id'], $line['jr_internal']) . " | ";
diff --git a/include/template/acc_ledger_history_sale_extended.php b/include/template/acc_ledger_history_sale_extended.php
index effaf4365..4e7fa1856 100644
--- a/include/template/acc_ledger_history_sale_extended.php
+++ b/include/template/acc_ledger_history_sale_extended.php
@@ -69,10 +69,10 @@ for ($i=0;$i<$nb_data;$i++):
?>
>
|
- =$this->data[$i]['jr_date']?>
+ =$this->data[$i]['str_date']?>
|
- =$this->data[$i]['jr_date_paid']?>
+ =$this->data[$i]['str_date_paid']?>
|
=$this->data[$i]['jr_pj_number']?>
diff --git a/include/template/acc_ledger_history_sale_oneline.php b/include/template/acc_ledger_history_sale_oneline.php
index 45e1294b5..a24b9ee11 100644
--- a/include/template/acc_ledger_history_sale_oneline.php
+++ b/include/template/acc_ledger_history_sale_oneline.php
@@ -70,10 +70,10 @@ for ($i=0;$i<$nb_data;$i++):
?>
| >
|
- =$this->data[$i]['jr_date']?>
+ =$this->data[$i]['str_date']?>
|
- =$this->data[$i]['jr_date_paid']?>
+ =$this->data[$i]['str_date_paid']?>
|
=$this->data[$i]['jr_pj_number']?>
diff --git a/include/upgrade-core.php b/include/upgrade-core.php
index db2997c1d..8ccd967fd 100644
--- a/include/upgrade-core.php
+++ b/include/upgrade-core.php
@@ -32,6 +32,18 @@ printf (_(" La version de votre installation est %s "),$version_noalyss);
$core=new Package_Repository();
$xml=$core->getContent();
+/*
+ * If xml is null , it means it was not possible to get the file , could be
+ * a network problem or a misconfiguration
+ */
+if ( $xml == NULL) {
+ echo '';
+ printf (_("Désolé , impossible de se connecter au serveur %s"),
+ NOALYSS_PACKAGE_REPOSITORY);
+ echo '';
+ return;
+
+}
printf(h1(_("Version %s du %s")),$xml->core->version,$xml->core->date);
echo '';
echo $xml->core->description;
diff --git a/include/upgrade-plugin.php b/include/upgrade-plugin.php
index 554df6e2f..d557e7cdf 100644
--- a/include/upgrade-plugin.php
+++ b/include/upgrade-plugin.php
@@ -35,6 +35,18 @@ require_once NOALYSS_INCLUDE.'/class/extension.class.php';
*/
$package_repository=new Package_Repository();
$xml=$package_repository->getContent();
+/*
+ * If xml is null , it means it was not possible to get the file , could be
+ * a network problem or a misconfiguration
+ */
+if ( $xml == NULL) {
+ echo ' ';
+ printf (_("Désolé , impossible de se connecter au serveur %s"),
+ NOALYSS_PACKAGE_REPOSITORY);
+ echo '';
+ return;
+
+}
$a_plugin=$xml->xpath('//plugins/plugin');
$nb_plugin=count($a_plugin);
diff --git a/include/upgrade-template.php b/include/upgrade-template.php
index 93732055a..3176d32fc 100644
--- a/include/upgrade-template.php
+++ b/include/upgrade-template.php
@@ -30,6 +30,18 @@ require_once NOALYSS_INCLUDE.'/class/extension.class.php';
$package_repository=new Package_Repository();
$xml=$package_repository->getContent();
+/*
+ * If xml is null , it means it was not possible to get the file , could be
+ * a network problem or a misconfiguration
+ */
+if ( $xml == NULL) {
+ echo '';
+ printf (_("Désolé , impossible de se connecter au serveur %s"),
+ NOALYSS_PACKAGE_REPOSITORY);
+ echo '';
+ return;
+
+}
$a_template=$xml->xpath('//database_template/dbtemplate');
| |