Skip to content
Snippets Groups Projects
Commit 4a46480e authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix preview of PDF contract

parent a36a9fab
No related branches found
No related tags found
No related merge requests found
......@@ -85,7 +85,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
dol_fiche_head();
//dol_fiche_head(null, '', '', -1);
/*
* Params
......@@ -122,7 +122,7 @@ print '</tr>';
print "</table>\n";
dol_fiche_end();
//dol_fiche_end();
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
......
......@@ -1706,6 +1706,12 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
if ($fuser->rights->ficheinter->lire) $accessallowed=1;
$original_file=$conf->ficheinter->dir_output.'/'.$original_file;
}
// Wrapping pour les apercu conat
elseif (($modulepart == 'apercucontract') && !empty($conf->contrat->dir_output))
{
if ($fuser->rights->contrat->lire) $accessallowed=1;
$original_file=$conf->contrat->dir_output.'/'.$original_file;
}
// Wrapping pour les apercu supplier proposal
elseif (($modulepart == 'apercusupplier_proposal' || $modulepart == 'apercusupplier_proposal') && !empty($conf->supplier_proposal->dir_output))
{
......
......@@ -70,11 +70,28 @@ class modContrat extends DolibarrModules
// Constants
$this->const = array();
$this->const[0][0] = "CONTRACT_ADDON";
$this->const[0][1] = "chaine";
$this->const[0][2] = "mod_contract_serpis";
$this->const[0][3] = 'Nom du gestionnaire de numerotation des contrats';
$this->const[0][4] = 0;
$r=0;
$this->const[$r][0] = "CONTRACT_ADDON";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "mod_contract_serpis";
$this->const[$r][3] = 'Nom du gestionnaire de numerotation des contrats';
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "CONTRACT_ADDON_PDF";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "strato";
$this->const[$r][3] = 'Name of PDF model of contract';
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "CONTRACT_ADDON_PDF_ODT_PATH";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/contracts";
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
$r++;
// Boxes
$this->boxes = array(
......@@ -202,7 +219,28 @@ class modContrat extends DolibarrModules
// Nettoyage avant activation
$this->remove($options);
$sql = array();
//ODT template
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/contracts/template_contract.odt';
$dirodt=DOL_DATA_ROOT.'/doctemplates/contracts';
$dest=$dirodt.'/template_contract.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->db->escape($this->const[1][2])."' AND type = 'contract' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[1][2])."','contract',".$conf->entity.")"
);
return $this->_init($sql,$options);
}
......
......@@ -79,17 +79,17 @@ class modFacture extends DolibarrModules
$this->const = array();
$r=0;
$this->const[$r][0] = "FACTURE_ADDON_PDF";
$this->const[$r][0] = "FACTURE_ADDON";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "crabe";
$this->const[$r][3] = 'Name of PDF model of invoice';
$this->const[$r][2] = "mod_facture_terre";
$this->const[$r][3] = 'Name of numbering numerotation rules of invoice';
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "FACTURE_ADDON";
$this->const[$r][0] = "FACTURE_ADDON_PDF";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "mod_facture_terre";
$this->const[$r][3] = 'Name of numbering numerotation rules of invoice';
$this->const[$r][2] = "crabe";
$this->const[$r][3] = 'Name of PDF model of invoice';
$this->const[$r][4] = 0;
$r++;
......@@ -311,8 +311,8 @@ class modFacture extends DolibarrModules
}
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'invoice' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','invoice',".$conf->entity.")"
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[1][2])."' AND type = 'invoice' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[1][2])."','invoice',".$conf->entity.")"
);
return $this->_init($sql,$options);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment