diff --git a/htdocs/comm/askpricesupplier.php b/htdocs/comm/askpricesupplier.php
index 855f84a72d8..ca34e84fb30 100644
--- a/htdocs/comm/askpricesupplier.php
+++ b/htdocs/comm/askpricesupplier.php
@@ -1285,7 +1285,7 @@ if ($action == 'create')
// Third party
print '
';
- print '| ' . $langs->trans('Customer') . ' | ';
+ print '' . $langs->trans('Supplier') . ' | ';
if ($socid > 0) {
print '';
print $soc->getNomUrl(1);
@@ -1293,7 +1293,7 @@ if ($action == 'create')
print ' | ';
} else {
print '';
- print $form->select_company('', 'socid', 's.client = 1 OR s.client = 2 OR s.client = 3', 1);
+ print $form->select_company('', 'socid', 's.fournisseur = 1', 1);
print ' | ';
}
print '
' . "\n";
@@ -2186,14 +2186,14 @@ if ($action == 'create')
* Documents generes
*/
$filename = dol_sanitizeFileName($object->ref);
- $filedir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref);
+ $filedir = $conf->askpricesupplier->dir_output . "/" . dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
$genallowed = $user->rights->askpricesupplier->creer;
$delallowed = $user->rights->askpricesupplier->supprimer;
$var = true;
- $somethingshown = $formfile->show_documents('propal', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
+ $somethingshown = $formfile->show_documents('askpricesupplier', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
/*
* Linked object block
diff --git a/htdocs/core/modules/modAskPriceSupplier.class.php b/htdocs/core/modules/modAskPriceSupplier.class.php
index f0cf2a7a40f..593ac749b1a 100644
--- a/htdocs/core/modules/modAskPriceSupplier.class.php
+++ b/htdocs/core/modules/modAskPriceSupplier.class.php
@@ -48,7 +48,7 @@ class modAskPriceSupplier extends DolibarrModules
$this->db = $db;
$this->numero = 999999;
- $this->family = "products";
+ $this->family = "crm";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "askpricesupplierDESC";
@@ -220,11 +220,33 @@ class modAskPriceSupplier extends DolibarrModules
*/
function init($options='')
{
- //global $conf,$langs;
+ global $conf,$langs;
- /*CREATE IF NOT EXISTS llx_askpricesupplier (rowid int auto_increment);*/
-
- $sql = array();
+ // Remove permissions and default values
+ $this->remove($options);
+
+ //ODT template
+ $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/askpricesupplier/template_askpricesupplier.odt';
+ $dirodt=DOL_DATA_ROOT.'/doctemplates/askpricesupplier';
+ $dest=$dirodt.'/template_askpricesupplier.odt';
+
+ if (file_exists($src) && ! file_exists($dest))
+ {
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+ dol_mkdir($dirodt);
+ $result=dol_copy($src,$dest,0,0);
+ if ($result < 0)
+ {
+ $langs->load("errors");
+ $this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest);
+ return 0;
+ }
+ }
+
+ $sql = array(
+ "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
+ "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','askpricesupplier',".$conf->entity.")",
+ );
$result=$this->_load_tables('/comm/askpricesupplier/sql/');
return $this->_init($sql, $options);
diff --git a/htdocs/install/doctemplates/askpricesupplier/template_proposal.odt b/htdocs/install/doctemplates/askpricesupplier/template_askpricesupplier.odt
similarity index 100%
rename from htdocs/install/doctemplates/askpricesupplier/template_proposal.odt
rename to htdocs/install/doctemplates/askpricesupplier/template_askpricesupplier.odt