[CORE] FIX : des noms des hooks

+ correction nom de variable (#new_ask_price).
This commit is contained in:
phf 2015-02-06 09:50:27 +01:00
parent bcbf29d9a5
commit bf643c26da
8 changed files with 27 additions and 46 deletions

View File

@ -65,8 +65,8 @@ if ($action == 'specimen')
{ {
$modele=GETPOST('module','alpha'); $modele=GETPOST('module','alpha');
$propal = new AskPriceSupplier($db); $askpricesupplier = new AskPriceSupplier($db);
$propal->initAsSpecimen(); $askpricesupplier->initAsSpecimen();
// Search template files // Search template files
$file=''; $classname=''; $filefound=0; $file=''; $classname=''; $filefound=0;
@ -88,7 +88,7 @@ if ($action == 'specimen')
$module = new $classname($db); $module = new $classname($db);
if ($module->write_file($propal,$langs) > 0) if ($module->write_file($askpricesupplier,$langs) > 0)
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=askpricesupplier&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=askpricesupplier&file=SPECIMEN.pdf");
return; return;
@ -313,14 +313,14 @@ foreach ($dirmodels as $reldir)
} }
print '</td>'; print '</td>';
$propal=new AskPriceSupplier($db); $askpricesupplier=new AskPriceSupplier($db);
$propal->initAsSpecimen(); $askpricesupplier->initAsSpecimen();
// Info // Info
$htmltooltip=''; $htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$propal->type=0; $askpricesupplier->type=0;
$nextval=$module->getNextValue($mysoc,$propal); $nextval=$module->getNextValue($mysoc,$askpricesupplier);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip.=''.$langs->trans("NextValue").': '; $htmltooltip.=''.$langs->trans("NextValue").': ';
if ($nextval) { if ($nextval) {

View File

@ -91,7 +91,7 @@ if ($id > 0 || ! empty($ref)) {
} }
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('propalcard','globalcard')); $hookmanager->initHooks(array('askpricesuppliercard','globalcard'));
$permissionnote = $user->rights->askpricesupplier->creer; // Used by the include of actions_setnotes.inc.php $permissionnote = $user->rights->askpricesupplier->creer; // Used by the include of actions_setnotes.inc.php
@ -950,8 +950,7 @@ if (empty($reshook))
if (! $error) { if (! $error) {
// Actions on extra fields (by external module or standard code) // Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('askpricesupplierdao'));
$hookmanager->initHooks(array('propaldao'));
$parameters = array('id' => $object->id); $parameters = array('id' => $object->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been
// modified by // modified by

View File

@ -812,8 +812,7 @@ class AskPriceSupplier extends CommonObject
$action='update'; $action='update';
// Actions on extra fields (by external module or standard code) // Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('askpricesupplierdao'));
$hookmanager->initHooks(array('propaldao'));
$parameters=array('socid'=>$this->id); $parameters=array('socid'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) if (empty($reshook))
@ -1190,8 +1189,7 @@ class AskPriceSupplier extends CommonObject
$action='update'; $action='update';
// Actions on extra fields (by external module or standard code) // Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('askpricesupplierdao'));
$hookmanager->initHooks(array('propaldao'));
$parameters=array('id'=>$this->id); $parameters=array('id'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) if (empty($reshook))
@ -1336,7 +1334,7 @@ class AskPriceSupplier extends CommonObject
*/ */
function set_date_livraison($user, $date_livraison) function set_date_livraison($user, $date_livraison)
{ {
if (! empty($user->rights->propal->creer)) if (! empty($user->rights->askpricesupplier->creer))
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."askpricesupplier "; $sql = "UPDATE ".MAIN_DB_PREFIX."askpricesupplier ";
$sql.= " SET date_livraison = ".($date_livraison!=''?"'".$this->db->idate($date_livraison)."'":'null'); $sql.= " SET date_livraison = ".($date_livraison!=''?"'".$this->db->idate($date_livraison)."'":'null');
@ -1367,7 +1365,7 @@ class AskPriceSupplier extends CommonObject
{ {
$remise=trim($remise)?trim($remise):0; $remise=trim($remise)?trim($remise):0;
if (! empty($user->rights->propal->creer)) if (! empty($user->rights->askpricesupplier->creer))
{ {
$remise = price2num($remise); $remise = price2num($remise);
@ -1400,7 +1398,7 @@ class AskPriceSupplier extends CommonObject
{ {
$remise=trim($remise)?trim($remise):0; $remise=trim($remise)?trim($remise):0;
if (! empty($user->rights->propal->creer)) if (! empty($user->rights->askpricesupplier->creer))
{ {
$remise = price2num($remise); $remise = price2num($remise);
@ -1739,11 +1737,11 @@ class AskPriceSupplier extends CommonObject
if ($shortlist == 1) if ($shortlist == 1)
{ {
$ga[$obj->propalid] = $obj->ref; $ga[$obj->askpricesupplierid] = $obj->ref;
} }
else if ($shortlist == 2) else if ($shortlist == 2)
{ {
$ga[$obj->propalid] = $obj->ref.' ('.$obj->name.')'; $ga[$obj->askpricesupplierid] = $obj->ref.' ('.$obj->name.')';
} }
else else
{ {
@ -1804,7 +1802,7 @@ class AskPriceSupplier extends CommonObject
{ {
// We remove directory // We remove directory
$ref = dol_sanitizeFileName($this->ref); $ref = dol_sanitizeFileName($this->ref);
if ($conf->propal->dir_output && !empty($this->ref)) if ($conf->askpricesupplier->dir_output && !empty($this->ref))
{ {
$dir = $conf->askpricesupplier->dir_output . "/" . $ref ; $dir = $conf->askpricesupplier->dir_output . "/" . $ref ;
$file = $dir . "/" . $ref . ".pdf"; $file = $dir . "/" . $ref . ".pdf";

View File

@ -98,7 +98,7 @@ $viewstatut=$object_statut;
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('propallist')); $hookmanager->initHooks(array('askpricesupplierlist'));

View File

@ -31,5 +31,5 @@ CREATE TABLE `llx_askpricesupplierdet` (
PRIMARY KEY (`rowid`), PRIMARY KEY (`rowid`),
KEY `idx_askpricesupplierdet_fk_askpricesupplierdet` (`fk_askpricesupplier`), KEY `idx_askpricesupplierdet_fk_askpricesupplierdet` (`fk_askpricesupplier`),
KEY `idx_askpricesupplierdet_fk_product` (`fk_product`), KEY `idx_askpricesupplierdet_fk_product` (`fk_product`),
CONSTRAINT `fk_askpricesupplierdet_fk_propal` FOREIGN KEY (`fk_askpricesupplier`) REFERENCES `llx_askpricesupplier` (`rowid`) CONSTRAINT `fk_askpricesupplierdet_fk_askpricesupplier` FOREIGN KEY (`fk_askpricesupplier`) REFERENCES `llx_askpricesupplier` (`rowid`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8

View File

@ -688,7 +688,7 @@ class pdf_aurore extends ModelePDFAskPriceSupplier
}*/ }*/
// Show payments conditions // Show payments conditions
if (empty($conf->global->PROPALE_PDF_HIDE_PAYMENTTERMCOND) && ($object->cond_reglement_code || $object->cond_reglement)) if (empty($conf->global->ASKPRICESUPPLIER_PDF_HIDE_PAYMENTTERMCOND) && ($object->cond_reglement_code || $object->cond_reglement))
{ {
$pdf->SetFont('','B', $default_font_size - 2); $pdf->SetFont('','B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy); $pdf->SetXY($this->marge_gauche, $posy);
@ -718,24 +718,8 @@ class pdf_aurore extends ModelePDFAskPriceSupplier
$posy=$pdf->GetY()+3; $posy=$pdf->GetY()+3;
} }
if (empty($conf->global->PROPALE_PDF_HIDE_PAYMENTTERMCOND)) if (empty($conf->global->ASKPRICESUPPLIER_PDF_HIDE_PAYMENTTERMCOND))
{ {
// Check a payment mode is defined
/* Not required on a proposal
if (empty($object->mode_reglement_code)
&& ! $conf->global->FACTURE_CHQ_NUMBER
&& ! $conf->global->FACTURE_RIB_NUMBER)
{
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetTextColor(200,0,0);
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->MultiCell(90, 3, $outputlangs->transnoentities("ErrorNoPaiementModeConfigured"),0,'L',0);
$pdf->SetTextColor(0,0,0);
$posy=$pdf->GetY()+1;
}
*/
// Show payment mode // Show payment mode
if ($object->mode_reglement_code if ($object->mode_reglement_code
&& $object->mode_reglement_code != 'CHQ' && $object->mode_reglement_code != 'CHQ'
@ -1220,9 +1204,9 @@ class pdf_aurore extends ModelePDFAskPriceSupplier
pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
// Show Draft Watermark // Show Draft Watermark
if($object->statut==0 && (! empty($conf->global->PROPALE_DRAFT_WATERMARK)) ) if($object->statut==0 && (! empty($conf->global->ASKPRICESUPPLIER_DRAFT_WATERMARK)) )
{ {
pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->PROPALE_DRAFT_WATERMARK); pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->ASKPRICESUPPLIER_DRAFT_WATERMARK);
} }
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
@ -1405,7 +1389,7 @@ class pdf_aurore extends ModelePDFAskPriceSupplier
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{ {
$showdetails=0; $showdetails=0;
return pdf_pagefoot($pdf,$outputlangs,'PROPALE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); return pdf_pagefoot($pdf,$outputlangs,'ASKPRICESUPPLIER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
} }
} }

View File

@ -149,7 +149,7 @@ abstract class ModeleNumRefAskPriceSupplier
* Create a document onto disk according to template module. * Create a document onto disk according to template module.
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param object $object Object proposal * @param object $object Object askpricesupplier
* @param string $modele Force model to use ('' to not force) * @param string $modele Force model to use ('' to not force)
* @param Translate $outputlangs Object langs to use for output * @param Translate $outputlangs Object langs to use for output
* @param int $hidedetails Hide details of lines * @param int $hidedetails Hide details of lines
@ -158,7 +158,7 @@ abstract class ModeleNumRefAskPriceSupplier
* @return int 0 if KO, 1 if OK * @return int 0 if KO, 1 if OK
* @deprecated Use the new function generateDocument of Propal class * @deprecated Use the new function generateDocument of Propal class
*/ */
function askpricesupplier_pdf_create(DoliDB $db, Propal $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) function askpricesupplier_pdf_create(DoliDB $db, AskPriceSupplier $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{ {
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }

View File

@ -31,7 +31,7 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
/** /**
* Classe de description et activation du module Propale * Classe de description et activation du module AskPriceSupllier
*/ */
class modAskPriceSupplier extends DolibarrModules class modAskPriceSupplier extends DolibarrModules
{ {