2
0
forked from Wavyzz/dolibarr

Maxi miscellaneous debug

This commit is contained in:
Laurent Destailleur
2017-05-05 12:33:49 +02:00
parent fecf5efa5b
commit 68b63927e0
22 changed files with 203 additions and 220 deletions

View File

@@ -205,7 +205,7 @@ print "<br>";
$head = supplierorder_admin_prepare_head(); $head = supplierorder_admin_prepare_head();
dol_fiche_head($head, 'invoice', $langs->trans("Suppliers"), 0, 'company'); dol_fiche_head($head, 'invoice', $langs->trans("Suppliers"), -1, 'company');
// Supplier invoice numbering module // Supplier invoice numbering module

View File

@@ -234,7 +234,7 @@ print "<br>";
$head = supplierorder_admin_prepare_head(); $head = supplierorder_admin_prepare_head();
dol_fiche_head($head, 'order', $langs->trans("Suppliers"), 0, 'company'); dol_fiche_head($head, 'order', $langs->trans("Suppliers"), -1, 'company');
// Supplier order numbering module // Supplier order numbering module

View File

@@ -65,7 +65,7 @@ if ($action == 'updateMask')
} }
}else if ($action == 'setmod') }else if ($action == 'setmod')
{ {
dolibarr_set_const($db, "SUPPLIER_PAYMENT_ADDON",$value,'chaine',0,'',$conf->entity); dolibarr_set_const($db, "SUPPLIER_PAYMENT_ADDON", $value, 'chaine', 0, '', $conf->entity);
} }
// define constants for models generator that need parameters // define constants for models generator that need parameters
@@ -138,7 +138,7 @@ else if ($action == 'specimen')
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir) foreach($dirmodels as $reldir)
{ {
$file=dol_buildpath($reldir."core/modules/supplier_payment/pdf/pdf_".$modele.".modules.php",0); $file=dol_buildpath($reldir."core/modules/supplier_payment/doc/pdf_".$modele.".modules.php",0);
if (file_exists($file)) if (file_exists($file))
{ {
$filefound=1; $filefound=1;
@@ -188,7 +188,7 @@ print load_fiche_titre($langs->trans("SupplierPaymentSetup"),$linkback,'title_se
print "<br>"; print "<br>";
$head = supplierorder_admin_prepare_head(); $head = supplierorder_admin_prepare_head();
dol_fiche_head($head, 'supplierpayment', $langs->trans("Suppliers"), 0, 'company'); dol_fiche_head($head, 'supplierpayment', $langs->trans("Suppliers"), -1, 'company');
/* /*
* Numbering module * Numbering module
@@ -198,12 +198,6 @@ if (empty($conf->global->SUPPLIER_PAYMENT_ADDON)) $conf->global->SUPPLIER_PAYMEN
print load_fiche_titre($langs->trans("PaymentsNumberingModule"), '', ''); print load_fiche_titre($langs->trans("PaymentsNumberingModule"), '', '');
/*
* Document templates generators
*/
print '<br>';
print load_fiche_titre($langs->trans("BillsPDFModules"),'','');
// Load array def with activated templates // Load array def with activated templates
$def = array(); $def = array();
$sql = "SELECT nom"; $sql = "SELECT nom";
@@ -349,6 +343,12 @@ foreach ($dirmodels as $reldir)
print '</table>'; print '</table>';
/*
* Document templates generators
*/
print '<br>';
print load_fiche_titre($langs->trans("PaymentsPDFModules"),'','');
print '<table class="noborder" width="100%">'."\n"; print '<table class="noborder" width="100%">'."\n";
print '<tr class="liste_titre">'."\n"; print '<tr class="liste_titre">'."\n";
print '<td width="100">'.$langs->trans("Name").'</td>'."\n"; print '<td width="100">'.$langs->trans("Name").'</td>'."\n";
@@ -363,7 +363,7 @@ clearstatcache();
foreach ($dirmodels as $reldir) foreach ($dirmodels as $reldir)
{ {
$dir = dol_buildpath($reldir."core/modules/supplier_payment/pdf/"); $dir = dol_buildpath($reldir."core/modules/supplier_payment/doc/");
if (is_dir($dir)) if (is_dir($dir))
{ {
@@ -440,8 +440,6 @@ foreach ($dirmodels as $reldir)
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; $htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>'; $htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); $htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1);
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1);
print '<td align="center">'; print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,1,0); print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>'; print '</td>';
@@ -458,7 +456,7 @@ foreach ($dirmodels as $reldir)
} }
} }
print '</table><br>'; print '</table>';
dol_fiche_end(); dol_fiche_end();

View File

@@ -79,7 +79,7 @@ print "<br>\n";
$head = supplierorder_admin_prepare_head(); $head = supplierorder_admin_prepare_head();
dol_fiche_head($head, 'supplierinvoice', $langs->trans("Suppliers"), 0, 'company'); dol_fiche_head($head, 'supplierinvoice', $langs->trans("Suppliers"), -1, 'company');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@@ -79,7 +79,7 @@ print "<br>\n";
$head = supplierorder_admin_prepare_head(); $head = supplierorder_admin_prepare_head();
dol_fiche_head($head, 'supplierinvoicedet', $langs->trans("Suppliers"), 0, 'company'); dol_fiche_head($head, 'supplierinvoicedet', $langs->trans("Suppliers"), -1, 'company');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@@ -75,7 +75,7 @@ print "<br>\n";
$head = supplierorder_admin_prepare_head(); $head = supplierorder_admin_prepare_head();
dol_fiche_head($head, 'supplierorder', $langs->trans("Suppliers"), 0, 'company'); dol_fiche_head($head, 'supplierorder', $langs->trans("Suppliers"), -1, 'company');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@@ -76,7 +76,7 @@ print "<br>\n";
$head = supplierorder_admin_prepare_head(); $head = supplierorder_admin_prepare_head();
dol_fiche_head($head, 'supplierorderdet', $langs->trans("Suppliers"), 0, 'company'); dol_fiche_head($head, 'supplierorderdet', $langs->trans("Suppliers"), -1, 'company');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@@ -125,7 +125,7 @@ if ($catname || $id > 0)
print '</span>'; print '</span>';
print "</td>\n"; print "</td>\n";
print "\t\t<td>"; print "\t\t<td>";
print $cat->description; print dolGetFirstLineOfText($cat->description);
print "</td>\n"; print "</td>\n";
print "\t</tr>\n"; print "\t</tr>\n";
} }
@@ -162,7 +162,7 @@ foreach($fulltree as $key => $val)
'rowid'=>$val['rowid'], 'rowid'=>$val['rowid'],
'fk_menu'=>$val['fk_parent'], 'fk_menu'=>$val['fk_parent'],
'entry'=>'<table class="nobordernopadding centpercent"><tr><td><span class="noborderoncategories" '.($categstatic->color?' style="background: #'.$categstatic->color.';"':' style="background: #aaa"').'>'.$li.'</span></td>'. 'entry'=>'<table class="nobordernopadding centpercent"><tr><td><span class="noborderoncategories" '.($categstatic->color?' style="background: #'.$categstatic->color.';"':' style="background: #aaa"').'>'.$li.'</span></td>'.
'<td width="50%">'.dolGetFirstLineOfText($desc).'</td>'. //'<td width="50%">'.dolGetFirstLineOfText($desc).'</td>'.
'<td align="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td>'. '<td align="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td>'.
'</tr></table>' '</tr></table>'
); );
@@ -181,13 +181,13 @@ $nbofentries=(count($data) - 1);
if ($nbofentries > 0) if ($nbofentries > 0)
{ {
print '<tr '.$bc[0].'><td colspan="3">'; print '<tr class="pair"><td colspan="3">';
tree_recur($data,$data[0],0); tree_recur($data,$data[0],0);
print '</td></tr>'; print '</td></tr>';
} }
else else
{ {
print '<tr '.$bc[0].'>'; print '<tr class="pair">';
print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('','treemenu/branchbottom.gif').'</td>'; print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('','treemenu/branchbottom.gif').'</td>';
print '<td valign="middle">'; print '<td valign="middle">';
print $langs->trans("NoCategoryYet"); print $langs->trans("NoCategoryYet");

View File

@@ -334,7 +334,7 @@ else
// $head[$h][1] = $langs->trans("Info"); // $head[$h][1] = $langs->trans("Info");
// $h++; // $h++;
dol_fiche_head($head, $hselected, $langs->trans("Cheques"),0,'payment'); dol_fiche_head($head, $hselected, $langs->trans("Cheques"), -1, 'payment');
/* /*
* Confirmation de la suppression du bordereau * Confirmation de la suppression du bordereau
@@ -476,8 +476,7 @@ if ($action == 'new')
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td style="min-width: 120px">'.$langs->trans("DateChequeReceived").' '; print '<td style="min-width: 120px">'.$langs->trans("DateChequeReceived").'</td>'."\n";
print "</td>\n";
print '<td style="min-width: 120px">'.$langs->trans("ChequeNumber")."</td>\n"; print '<td style="min-width: 120px">'.$langs->trans("ChequeNumber")."</td>\n";
print '<td style="min-width: 200px">'.$langs->trans("CheckTransmitter")."</td>\n"; print '<td style="min-width: 200px">'.$langs->trans("CheckTransmitter")."</td>\n";
print '<td style="min-width: 200px">'.$langs->trans("Bank")."</td>\n"; print '<td style="min-width: 200px">'.$langs->trans("Bank")."</td>\n";
@@ -487,15 +486,12 @@ if ($action == 'new')
print '<td align="center" width="100px">'.$langs->trans("Select")."<br>"; print '<td align="center" width="100px">'.$langs->trans("Select")."<br>";
if ($conf->use_javascript_ajax) print '<a href="#" id="checkall_'.$bid.'">'.$langs->trans("All").'</a> / <a href="#" id="checknone_'.$bid.'">'.$langs->trans("None").'</a>'; if ($conf->use_javascript_ajax) print '<a href="#" id="checkall_'.$bid.'">'.$langs->trans("All").'</a> / <a href="#" id="checknone_'.$bid.'">'.$langs->trans("None").'</a>';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
$var=true; if (count($lines[$bid]))
{
foreach ($lines[$bid] as $lid => $value) foreach ($lines[$bid] as $lid => $value)
{ {
$account_id = $bid; $account_id = $bid;
if (! isset($accounts[$bid])) if (! isset($accounts[$bid]))
$accounts[$bid]=0; $accounts[$bid]=0;
@@ -541,6 +537,7 @@ if ($action == 'new')
$i++; $i++;
} }
}
print "</table>"; print "</table>";
print '</div>'; print '</div>';
@@ -686,7 +683,9 @@ else
print_liste_field_titre(''); print_liste_field_titre('');
print "</tr>\n"; print "</tr>\n";
$i=1; $i=1;
$var=false;
if ($num > 0)
{
while ($objp = $db->fetch_object($resql)) while ($objp = $db->fetch_object($resql))
{ {
$account_id = $objp->bid; $account_id = $objp->bid;
@@ -745,6 +744,14 @@ else
$i++; $i++;
} }
}
else
{
print '<td colspan="8" class="opacitymedium">';
print $langs->trans("None");
print '</td>';
}
print "</table>"; print "</table>";
print "</div>"; print "</div>";
} }

View File

@@ -50,8 +50,6 @@ llxHeader('',$langs->trans("ChequesArea"));
print load_fiche_titre($langs->trans("ChequesArea")); print load_fiche_titre($langs->trans("ChequesArea"));
//print '<table border="0" width="100%" class="notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">';
print '<div class="fichecenter"><div class="fichethirdleft">'; print '<div class="fichecenter"><div class="fichethirdleft">';
$sql = "SELECT count(b.rowid)"; $sql = "SELECT count(b.rowid)";
@@ -90,7 +88,6 @@ else
} }
//print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
$max=10; $max=10;
@@ -98,15 +95,13 @@ $max=10;
$sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.ref as ref"; $sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.ref as ref";
$sql.= ", bc.statut, bc.nbcheque"; $sql.= ", bc.statut, bc.nbcheque";
$sql.= ", ba.label, ba.rowid as bid"; $sql.= ", ba.label, ba.rowid as bid";
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc"; $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc, ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE ba.rowid = bc.fk_bank_account"; $sql.= " WHERE ba.rowid = bc.fk_bank_account";
$sql.= " AND bc.entity = ".$conf->entity; $sql.= " AND bc.entity = ".$conf->entity;
$sql.= " ORDER BY bc.date_bordereau DESC, rowid DESC"; $sql.= " ORDER BY bc.date_bordereau DESC, rowid DESC";
$sql.= $db->plimit($max); $sql.= $db->plimit($max);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
@@ -129,8 +124,7 @@ if ($resql)
$accountstatic->id=$objp->bid; $accountstatic->id=$objp->bid;
$accountstatic->label=$objp->label; $accountstatic->label=$objp->label;
print '<tr class="oddeven">'."\n";
print "<tr ".$bc[$var].">\n";
print '<td>'.$checkdepositstatic->getNomUrl(1).'</td>'; print '<td>'.$checkdepositstatic->getNomUrl(1).'</td>';
print '<td>'.dol_print_date($db->jdate($objp->db),'day').'</td>'; print '<td>'.dol_print_date($db->jdate($objp->db),'day').'</td>';
@@ -142,6 +136,7 @@ if ($resql)
print '</tr>'; print '</tr>';
} }
print "</table>"; print "</table>";
$db->free($resql); $db->free($resql);
} }
else else
@@ -150,7 +145,6 @@ else
} }
//print "</td></tr></table>\n";
print '</div></div></div>'; print '</div></div></div>';
llxFooter(); llxFooter();

View File

@@ -1631,12 +1631,24 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
if ($fuser->rights->ficheinter->lire) $accessallowed=1; if ($fuser->rights->ficheinter->lire) $accessallowed=1;
$original_file=$conf->ficheinter->dir_output.'/'.$original_file; $original_file=$conf->ficheinter->dir_output.'/'.$original_file;
} }
// Wrapping pour les apercu commande // Wrapping pour les apercu supplier proposal
elseif (($modulepart == 'apercusupplier_proposal' || $modulepart == 'apercusupplier_proposal') && !empty($conf->supplier_proposal->dir_output))
{
if ($fuser->rights->supplier_proposal->lire) $accessallowed=1;
$original_file=$conf->supplier_proposal->dir_output.'/'.$original_file;
}
// Wrapping pour les apercu supplier order
elseif (($modulepart == 'apercusupplier_order' || $modulepart == 'apercusupplier_order') && !empty($conf->fournisseur->commande->dir_output)) elseif (($modulepart == 'apercusupplier_order' || $modulepart == 'apercusupplier_order') && !empty($conf->fournisseur->commande->dir_output))
{ {
if ($fuser->rights->fournisseur->commande->lire) $accessallowed=1; if ($fuser->rights->fournisseur->commande->lire) $accessallowed=1;
$original_file=$conf->fournisseur->commande->dir_output.'/'.$original_file; $original_file=$conf->fournisseur->commande->dir_output.'/'.$original_file;
} }
// Wrapping pour les apercu supplier invoice
elseif (($modulepart == 'apercusupplier_invoice' || $modulepart == 'apercusupplier_invoice') && !empty($conf->fournisseur->facture->dir_output))
{
if ($fuser->rights->fournisseur->facture->lire) $accessallowed=1;
$original_file=$conf->fournisseur->facture->dir_output.'/'.$original_file;
}
// Wrapping pour les images des stats propales // Wrapping pour les images des stats propales
elseif ($modulepart == 'propalstats' && !empty($conf->propal->dir_temp)) elseif ($modulepart == 'propalstats' && !empty($conf->propal->dir_temp))
{ {

View File

@@ -1070,6 +1070,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if ($object->element == 'member') $modulepart='memberphoto'; if ($object->element == 'member') $modulepart='memberphoto';
if ($object->element == 'user') $modulepart='userphoto'; if ($object->element == 'user') $modulepart='userphoto';
if ($object->element == 'product') $modulepart='product'; if ($object->element == 'product') $modulepart='product';
if (class_exists("Imagick")) if (class_exists("Imagick"))
{ {
if ($object->element == 'propal') $modulepart='propal'; if ($object->element == 'propal') $modulepart='propal';
@@ -1077,7 +1078,9 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if ($object->element == 'facture') $modulepart='facture'; if ($object->element == 'facture') $modulepart='facture';
if ($object->element == 'fichinter') $modulepart='ficheinter'; if ($object->element == 'fichinter') $modulepart='ficheinter';
if ($object->element == 'contrat') $modulepart='contract'; if ($object->element == 'contrat') $modulepart='contract';
if ($object->element == 'supplier_proposal') $modulepart='supplier_proposal';
if ($object->element == 'order_supplier') $modulepart='supplier_order'; if ($object->element == 'order_supplier') $modulepart='supplier_order';
if ($object->element == 'invoice_supplier') $modulepart='supplier_invoice';
} }
if ($object->element == 'product') if ($object->element == 'product')
@@ -1107,13 +1110,21 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
{ {
$phototoshow=''; $phototoshow='';
// Check if a preview file is available // Check if a preview file is available
if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract', 'supplier_order')) && class_exists("Imagick")) if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract', 'supplier_order', 'supplier_proposal', 'supplier_invoice')) && class_exists("Imagick"))
{ {
$objectref = dol_sanitizeFileName($object->ref); $objectref = dol_sanitizeFileName($object->ref);
$dir_output = $conf->$modulepart->dir_output . "/"; $dir_output = $conf->$modulepart->dir_output . "/";
$filepath = $dir_output . $objectref . "/"; if (in_array($modulepart, array('invoice_supplier', 'supplier_invoice')))
{
$subdir = get_exdir($object->id, 2, 0, 0, $object, $modulepart).$objectref;
}
else
{
$subdir = get_exdir($object->id, 0, 0, 0, $object, $modulepart).$objectref;
}
$filepath = $dir_output . $subdir . "/";
$file = $filepath . $objectref . ".pdf"; $file = $filepath . $objectref . ".pdf";
$relativepath = $objectref.'/'.$objectref.'.pdf'; $relativepath = $subdir.'/'.$objectref.'.pdf';
// Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png") // Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png")
$fileimage = $file.'_preview.png'; // If PDF has 1 page $fileimage = $file.'_preview.png'; // If PDF has 1 page
@@ -4465,7 +4476,8 @@ function yn($yesno, $case=1, $color=0)
/** /**
* Return a path to have a directory according to object. * Return a path to have a directory according to object.
* New usage: $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'modulepart') * New usage: $conf->module->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'modulepart')
* or: $conf->module->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'modulepart') if multidir_output not defined.
* Old usage: '015' with level 3->"0/1/5/", '015' with level 1->"5/", 'ABC-1' with level 3 ->"0/0/1/" * Old usage: '015' with level 3->"0/1/5/", '015' with level 1->"5/", 'ABC-1' with level 3 ->"0/0/1/"
* *
* @param string $num Id of object (deprecated, $object will be used in future) * @param string $num Id of object (deprecated, $object will be used in future)
@@ -4486,7 +4498,7 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart)
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[]='product'; if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[]='product';
if (! empty($level) && in_array($modulepart, $arrayforoldpath)) if (! empty($level) && in_array($modulepart, $arrayforoldpath))
{ {
// This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided // This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided.
if (empty($alpha)) $num = preg_replace('/([^0-9])/i','',$num); if (empty($alpha)) $num = preg_replace('/([^0-9])/i','',$num);
else $num = preg_replace('/^.*\-/i','',$num); else $num = preg_replace('/^.*\-/i','',$num);
$num = substr("000".$num, -$level); $num = substr("000".$num, -$level);

View File

@@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functionsnumtoword.lib.php';
/** /**
* Class to generate the supplier invoices with the canelle model * Class to generate the supplier invoices with the canelle model
*/ */
class pdf_cow extends ModelePDFSuppliersPayments class pdf_standard extends ModelePDFSuppliersPayments
{ {
var $db; var $db;
var $name; var $name;
@@ -70,8 +70,8 @@ class pdf_cow extends ModelePDFSuppliersPayments
$langs->load("bills"); $langs->load("bills");
$this->db = $db; $this->db = $db;
$this->name = "cow"; $this->name = "standard";
$this->description = $langs->trans('SuppliersPaymentModel'); $this->description = $langs->trans('DocumentModelStandardPDF');
// Dimension page pour format A4 // Dimension page pour format A4
$this->type = 'pdf'; $this->type = 'pdf';
@@ -85,10 +85,6 @@ class pdf_cow extends ModelePDFSuppliersPayments
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
$this->option_logo = 1; // Affiche logo $this->option_logo = 1; // Affiche logo
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
$this->option_modereg = 1; // Affiche mode reglement
$this->option_condreg = 1; // Affiche conditions reglement
$this->option_codeproduitservice = 1; // Affiche code produit-service
$this->option_multilang = 1; // Dispo en plusieurs langues $this->option_multilang = 1; // Dispo en plusieurs langues
$this->franchise=!$mysoc->tva_assuj; $this->franchise=!$mysoc->tva_assuj;

View File

@@ -70,7 +70,7 @@ $projectid = GETPOST('projectid','int');
$origin = GETPOST('origin', 'alpha'); $origin = GETPOST('origin', 'alpha');
$originid = GETPOST('originid', 'int'); $originid = GETPOST('originid', 'int');
//PDF // PDF
$hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); $hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
$hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); $hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
$hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); $hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
@@ -1194,32 +1194,11 @@ if (empty($reshook))
$trackid='sin'.$object->id; $trackid='sin'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
// Actions to build doc
$upload_dir = $conf->fournisseur->facture->dir_output;
$permissioncreate = $user->rights->fournisseur->facture->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
// Build document
if ($action == 'builddoc')
{
// Save modele used
$object->fetch($id);
$object->fetch_thirdparty();
// Save last template used to generate document
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
$outputlangs = $langs;
$newlang=GETPOST('lang_id','alpha');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$action='';
}
}
// Make calculation according to calculationrule // Make calculation according to calculationrule
if ($action == 'calculate') if ($action == 'calculate')
{ {
@@ -1234,22 +1213,6 @@ if (empty($reshook))
exit; exit;
} }
} }
// Delete file in doc form
if ($action == 'remove_file')
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if ($object->fetch($id))
{
$object->fetch_thirdparty();
$upload_dir = $conf->fournisseur->facture->dir_output . "/";
$file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file,0,0,0,$object);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
}
}
if ($action == 'update_extras') if ($action == 'update_extras')
{ {
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
@@ -1924,7 +1887,7 @@ else
$head = facturefourn_prepare_head($object); $head = facturefourn_prepare_head($object);
$titre=$langs->trans('SupplierInvoice'); $titre=$langs->trans('SupplierInvoice');
dol_fiche_head($head, 'card', $titre, 0, 'bill'); dol_fiche_head($head, 'card', $titre, -1, 'bill');
// Clone confirmation // Clone confirmation
if ($action == 'clone') if ($action == 'clone')
@@ -2792,8 +2755,8 @@ else
* Documents generes * Documents generes
*/ */
$ref=dol_sanitizeFileName($object->ref); $ref=dol_sanitizeFileName($object->ref);
$subdir = get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref; $subdir = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').$ref;
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref; $filedir = $conf->fournisseur->facture->dir_output.'/'.$subdir;
$urlsource=$_SERVER['PHP_SELF'].'?id='.$object->id; $urlsource=$_SERVER['PHP_SELF'].'?id='.$object->id;
$genallowed=$user->rights->fournisseur->facture->creer; $genallowed=$user->rights->fournisseur->facture->creer;
$delallowed=$user->rights->fournisseur->facture->supprimer; $delallowed=$user->rights->fournisseur->facture->supprimer;

View File

@@ -138,7 +138,7 @@ if ($id > 0 || ! empty($ref))
$head = facturefourn_prepare_head($object); $head = facturefourn_prepare_head($object);
dol_fiche_head($head, 'contact', $langs->trans('SupplierInvoice'), 0, 'bill'); dol_fiche_head($head, 'contact', $langs->trans('SupplierInvoice'), -1, 'bill');
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';

View File

@@ -89,7 +89,7 @@ llxHeader('', $title, $helpurl);
if ($object->id > 0) if ($object->id > 0)
{ {
$head = facturefourn_prepare_head($object); $head = facturefourn_prepare_head($object);
dol_fiche_head($head, 'documents', $langs->trans('SupplierInvoice'), 0, 'bill'); dol_fiche_head($head, 'documents', $langs->trans('SupplierInvoice'), -1, 'bill');
$totalpaye = $object->getSommePaiement(); $totalpaye = $object->getSommePaiement();
@@ -230,6 +230,8 @@ if ($object->id > 0)
print '</table><br>'; print '</table><br>';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Nb of files // Nb of files

View File

@@ -59,7 +59,7 @@ $alreadypaid=$object->getSommePaiement();
$head = facturefourn_prepare_head($object); $head = facturefourn_prepare_head($object);
$titre=$langs->trans('SupplierInvoice'); $titre=$langs->trans('SupplierInvoice');
dol_fiche_head($head, 'info', $langs->trans('SupplierInvoice'), 0, 'bill'); dol_fiche_head($head, 'info', $langs->trans('SupplierInvoice'), -1, 'bill');
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';

View File

@@ -79,11 +79,9 @@ if ($object->id > 0)
$head = facturefourn_prepare_head($object); $head = facturefourn_prepare_head($object);
$titre=$langs->trans('SupplierInvoice'); $titre=$langs->trans('SupplierInvoice');
dol_fiche_head($head, 'note', $titre, 0, 'bill'); dol_fiche_head($head, 'note', $titre, -1, 'bill');
print '<table class="border" width="100%">';
// Supplier invoice card // Supplier invoice card
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
@@ -135,6 +133,8 @@ if ($object->id > 0)
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Type // Type
print '<tr><td class="titlefield">'.$langs->trans('Type').'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans('Type').'</td><td>';
print $object->getLibType(); print $object->getLibType();
@@ -203,6 +203,7 @@ if ($object->id > 0)
print '<br>'; print '<br>';
print '<div class="underbanner clearboth"></div>';
$cssclass="titlefield"; $cssclass="titlefield";
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';

View File

@@ -1154,6 +1154,7 @@ WebCalUrlForVCalExport=An export link to <b>%s</b> format is available at follow
BillsSetup=Invoices module setup BillsSetup=Invoices module setup
BillsNumberingModule=Invoices and credit notes numbering model BillsNumberingModule=Invoices and credit notes numbering model
BillsPDFModules=Invoice documents models BillsPDFModules=Invoice documents models
PaymentsPDFModules=Payment documents models
CreditNote=Credit note CreditNote=Credit note
CreditNotes=Credit notes CreditNotes=Credit notes
ForceInvoiceDate=Force invoice date to validation date ForceInvoiceDate=Force invoice date to validation date

View File

@@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
@@ -462,13 +462,9 @@ if (empty($reshook))
} }
} }
// Action for direct print
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
/*
* Send mail
*/
// Actions to send emails // Actions to send emails
$actiontypecode='AC_ASKPRICE'; $actiontypecode='AC_ASKPRICE';
$trigger_name='SUPPLIER_PROPOSAL_SENTBYMAIL'; $trigger_name='SUPPLIER_PROPOSAL_SENTBYMAIL';
@@ -1530,6 +1526,7 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
} }
/* Not for supplier proposals
if ($soc->outstanding_limit) if ($soc->outstanding_limit)
{ {
// Outstanding Bill // Outstanding Bill
@@ -1540,7 +1537,7 @@ if ($action == 'create')
print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency); print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }*/
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled)) if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled))
{ {

View File

@@ -2855,7 +2855,7 @@ class SupplierProposalLine extends CommonObjectLine
$sql.= ", ".$this->multicurrency_total_ht; $sql.= ", ".$this->multicurrency_total_ht;
$sql.= ", ".$this->multicurrency_total_tva; $sql.= ", ".$this->multicurrency_total_tva;
$sql.= ", ".$this->multicurrency_total_ttc; $sql.= ", ".$this->multicurrency_total_ttc;
$sql.= ", ".$this->fk_unit; $sql.= ", fk_unit=".($this->fk_unit?$this->fk_unit:'null');
$sql.= ')'; $sql.= ')';
dol_syslog(get_class($this).'::insert', LOG_DEBUG); dol_syslog(get_class($this).'::insert', LOG_DEBUG);
@@ -3025,13 +3025,13 @@ class SupplierProposalLine extends CommonObjectLine
$sql.= " , fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null"); $sql.= " , fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null");
if (! empty($this->rang)) $sql.= ", rang=".$this->rang; if (! empty($this->rang)) $sql.= ", rang=".$this->rang;
$sql.= " , ref_fourn=".(! empty($this->ref_fourn)?"'".$this->db->escape($this->ref_fourn)."'":"null"); $sql.= " , ref_fourn=".(! empty($this->ref_fourn)?"'".$this->db->escape($this->ref_fourn)."'":"null");
$sql.= " , fk_unit=".($this->fk_unit?$this->fk_unit:'null');
// Multicurrency // Multicurrency
$sql.= " , multicurrency_subprice=".price2num($this->multicurrency_subprice).""; $sql.= " , multicurrency_subprice=".price2num($this->multicurrency_subprice)."";
$sql.= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht).""; $sql.= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht)."";
$sql.= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; $sql.= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva)."";
$sql.= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; $sql.= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc)."";
$sql.= " , fk_unit=".$this->fk_unit;
$sql.= " WHERE rowid = ".$this->rowid; $sql.= " WHERE rowid = ".$this->rowid;