[CORE] Modif de trad et renomage pour le module askpricesupplier (#new_ask_price).

This commit is contained in:
phf
2015-01-28 15:37:52 +01:00
parent d134fa6a32
commit c5398f61f9
3 changed files with 31 additions and 9 deletions

View File

@@ -1285,7 +1285,7 @@ if ($action == 'create')
// Third party
print '<tr>';
print '<td class="fieldrequired">' . $langs->trans('Customer') . '</td>';
print '<td class="fieldrequired">' . $langs->trans('Supplier') . '</td>';
if ($socid > 0) {
print '<td colspan="2">';
print $soc->getNomUrl(1);
@@ -1293,7 +1293,7 @@ if ($action == 'create')
print '</td>';
} else {
print '<td colspan="2">';
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 '</td>';
}
print '</tr>' . "\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

View File

@@ -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);