diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index d6dd90b1e4d..857a2216652 100644 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -108,9 +108,8 @@ if ($ENV{"DESTI"}) { $DESTI = $ENV{"DESTI"}; } # Force output dir if env DESTI print "Makepack version $VERSION\n"; print "Building package name: $PROJECT\n"; print "Building package version: $MAJOR.$MINOR.$BUILD\n"; -print "Source directory: $SOURCE\n"; -print "Target directory: $DESTI\n"; - +print "Source directory (SOURCE): $SOURCE\n"; +print "Target directory (DESTI) : $DESTI\n"; # Choose package targets diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index e7b3e95e757..60bc466a907 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -78,6 +78,7 @@ class modMyModule extends DolibarrModules // 'substitutions' => 0, // Set this to 1 if module has its own substitution function file // 'menus' => 0, // Set this to 1 if module has its own menus handler directory // 'barcode' => 0, // Set this to 1 if module has its own barcode directory + // 'models' => 0, // Set this to 1 if module has its own models directory // 'css' => '/mymodule/css/mymodule.css.php', // Set this to relative path of css if module has its own css file // 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module // ); diff --git a/dev/translation/autotranslator.class.php b/dev/translation/autotranslator.class.php index 944b6556920..b6fbe202ba1 100644 --- a/dev/translation/autotranslator.class.php +++ b/dev/translation/autotranslator.class.php @@ -301,7 +301,7 @@ class autoTranslator // Example: https://www.googleapis.com/language/translate/v2?key=APIKEY&q=Setup%20area&source=en_US&target=fr_FR // Send request - print "Url to translate: ".$url."\n"; + //print "Url to translate: ".$url."\n"; if (! function_exists("curl_init")) { @@ -315,18 +315,19 @@ class autoTranslator curl_setopt($ch, CURLOPT_REFERER, "Mozilla"); $body = curl_exec($ch); curl_close($ch); - sleep(6); // This is to avoid to overload server. Best value is 6. + //sleep(1); // This is to avoid to overload server. // now, process the JSON string $json = json_decode($body, true); - if ($json['responseStatus'] != 200) + if ((! empty($json['responseStatus']) && $json['responseStatus'] != 200) + || count($json['data']['translations']) == 0) { - print "Error: ".$json['responseStatus']." ".$url."\n"; + print "Error: ".$json['responseStatus']." ".$url."\n"; return false; } - $rep=$json['responseData']['translatedText']; + $rep=$json['data']['translations'][0]['translatedText']; $rep=preg_replace('/SSSSS/i','%s',$rep); $rep=preg_replace('/NNNNN/i','\n\n',$rep); $rep=preg_replace('/'/i','\'',$rep); diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 7f41578058c..c54e34e8588 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -38,8 +38,8 @@ $langs->load("errors"); if (! $user->admin) accessforbidden(); -$action = GETPOST("action"); -$value = GETPOST("value"); +$action = GETPOST('action','alpha'); +$value = GETPOST('value','alpha'); /* * Actions @@ -71,31 +71,40 @@ if ($action == 'specimen') $commande = new Commande($db); $commande->initAsSpecimen(); - // Charge le modele - $dir = "/core/modules/commande/doc/"; - $file = "pdf_".$modele.".modules.php"; - $file = dol_buildpath($dir.$file); - if (file_exists($file)) + // Search template files + $file=''; $classname=''; $filefound=0; + $dirmodels=array_merge(array('/'),$conf->modules_parts['models']); + foreach($dirmodels as $reldir) + { + $file=dol_buildpath($reldir."core/modules/commande/doc/pdf_".$modele.".modules.php",0); + if (file_exists($file)) + { + $filefound=1; + $classname = "pdf_".$modele; + break; + } + } + + if ($filefound) { - $classname = "pdf_".$modele; require_once($file); - $obj = new $classname($db); + $module = new $classname($db); - if ($obj->write_file($commande,$langs) > 0) + if ($module->write_file($commande,$langs) > 0) { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande&file=SPECIMEN.pdf"); return; } else { - $mesg='