diff --git a/dev/skeletons/skeleton_script.php b/dev/skeletons/skeleton_script.php index 3cd7bfc440b..b397e6c0123 100644 --- a/dev/skeletons/skeleton_script.php +++ b/dev/skeletons/skeleton_script.php @@ -40,6 +40,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') { // Include Dolibarr environment require_once($path."../../htdocs/master.inc.php"); // After this $db is an opened handler to database. We close it at end of file. +require_once(DOL_DOCUMENT_ROOT."/cron/functions_cron.lib.php"); + // Load main language strings $langs->load("main"); @@ -63,6 +65,12 @@ if (! isset($argv[1])) { print 'Argument 1='.$argv[1]."\n"; print 'Argument 2='.$argv[2]."\n"; +print '--- start'."\n"; + + +// Start of transaction +$db->begin(); + // Examples for manipulating class skeleton_class require_once(DOL_DOCUMENT_ROOT."/../dev/skeletons/skeleton_class.class.php"); @@ -143,6 +151,17 @@ else // -------------------- END OF YOUR CODE -------------------- +if (! $error) +{ + $db->commit(); + print '--- end ok'."\n"; +} +else +{ + print '--- end error code='.$error."\n"; + $db->rollback(); +} + $db->close(); return $error; diff --git a/htdocs/conf/conf.class.php b/htdocs/conf/conf.class.php index 88cd5bdec2a..ac3f01a1aec 100644 --- a/htdocs/conf/conf.class.php +++ b/htdocs/conf/conf.class.php @@ -196,6 +196,7 @@ class Conf $this->don->dir_temp =DOL_DATA_ROOT."/dons/temp"; // Module fournisseur $this->fournisseur->dir_output=DOL_DATA_ROOT."/fournisseur"; + $this->fournisseur->dir_temp=DOL_DATA_ROOT."/fournisseur/temp"; $this->fournisseur->commande->dir_output=DOL_DATA_ROOT."/fournisseur/commande"; $this->fournisseur->commande->dir_temp =DOL_DATA_ROOT."/fournisseur/commande/temp"; $this->fournisseur->facture->dir_output =DOL_DATA_ROOT."/fournisseur/facture"; diff --git a/htdocs/fourn/fiche-stats.php b/htdocs/fourn/fiche-stats.php index 4cab8d213e9..a42167eda66 100644 --- a/htdocs/fourn/fiche-stats.php +++ b/htdocs/fourn/fiche-stats.php @@ -82,7 +82,7 @@ if ( $societe->fetch($socid) ) print ''; $file = get_exdir($societe->id, 3) . "ca_genere-".$societe->id.".png"; - if (file_exists($file)) + if (file_exists($conf->fournisseur->dir_temp.'/'.$file)) { $url=DOL_URL_ROOT.'/viewimage.php?modulepart=graph_fourn&file='.$file; print 'CA genere'; @@ -95,7 +95,7 @@ if ( $societe->fetch($socid) ) print ''; $file = get_exdir($societe->id, 3) . "ca_achat-".$societe->id.".png"; - if (file_exists($file)) + if (file_exists($conf->fournisseur->dir_temp.'/'.$file)) { $url=DOL_URL_ROOT.'/viewimage.php?modulepart=graph_fourn&file='.$file; print 'CA'; diff --git a/scripts/cron/batch_fournisseur_buildgraph.php b/scripts/cron/batch_fournisseur_buildgraph.php index 6b72019a484..548e8d758a5 100644 --- a/scripts/cron/batch_fournisseur_buildgraph.php +++ b/scripts/cron/batch_fournisseur_buildgraph.php @@ -66,8 +66,7 @@ for ($i = 1 ; $i < sizeof($argv) ; $i++) } } - -$dir = DOL_DATA_ROOT."/fournisseur/temp"; +$dir = $conf->fournisseur->dir_temp; $result=create_exdir($dir); if ($result < 0) { diff --git a/scripts/cron/batch_fournisseur_statsinvoice.php b/scripts/cron/batch_fournisseur_updatestatsinvoice.php similarity index 100% rename from scripts/cron/batch_fournisseur_statsinvoice.php rename to scripts/cron/batch_fournisseur_updatestatsinvoice.php