/**
  * testFactureFournisseurCreate
  *
  * @return int
  */
 public function testFactureFournisseurCreate()
 {
     global $conf, $user, $langs, $db;
     $conf = $this->savconf;
     $user = $this->savuser;
     $langs = $this->savlangs;
     $db = $this->savdb;
     $localobject = new FactureFournisseur($this->savdb);
     $localobject->initAsSpecimen();
     $result = $localobject->create($user);
     $this->assertLessThan($result, 0);
     print __METHOD__ . " result=" . $result . "\n";
     return $result;
 }
Esempio n. 2
0
			dol_syslog($obj->error, LOG_ERR);
		}
	}
	else
	{
		$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>';
		dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
	}
}

if ($action == 'specimenfacture')   // For invoices
{
	$modele=$_GET["module"];

	$facture = new FactureFournisseur($db);
	$facture->initAsSpecimen();
    $facture->thirdparty=$specimenthirdparty;

	// Charge le modele
	$dir = "/includes/modules/supplier_invoice/pdf/";
	$file = "pdf_".$modele.".modules.php";
	$file = dol_buildpath($dir.$file);
	if (file_exists($file))
	{
		$classname = "pdf_".$modele;
		require_once($file);

		$obj = new $classname($db,$facture);

		if ($obj->write_file($facture,$langs) > 0)
		{
Esempio n. 3
0
     print '<div class="error">' . $langs->trans($tmp) . '</div>';
 } elseif ($tmp == 'NotConfigured') {
     print $langs->trans($tmp);
 } else {
     print $tmp;
 }
 print '</td>' . "\n";
 print '<td align="center">';
 if ($conf->global->INVOICE_SUPPLIER_ADDON_NUMBER == "{$file}") {
     print img_picto($langs->trans("Activated"), 'switch_on');
 } else {
     print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setmod&amp;value=' . $file . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</a>';
 }
 print '</td>';
 $invoice = new FactureFournisseur($db);
 $invoice->initAsSpecimen();
 // Info
 $htmltooltip = '';
 $htmltooltip .= '' . $langs->trans("Version") . ': <b>' . $module->getVersion() . '</b><br>';
 $nextval = $module->getNextValue($mysoc, $invoice);
 if ("{$nextval}" != $langs->trans("NotAvailable")) {
     // Keep " on nextval
     $htmltooltip .= '' . $langs->trans("NextValue") . ': ';
     if ($nextval) {
         if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
             $nextval = $langs->trans($nextval);
         }
         $htmltooltip .= $nextval . '<br>';
     } else {
         $htmltooltip .= $langs->trans($module->error) . '<br>';
     }
Esempio n. 4
0
    /**
    * testFactureBuild
    *
    * @return int
    */
    public function testFactureFournisseurBuild()
    {
        global $conf,$user,$langs,$db;
        $conf=$this->savconf;
        $user=$this->savuser;
        $langs=$this->savlangs;
        $db=$this->savdb;

        $conf->fournisseur->facture->dir_output.='/temp';
        $localobject=new FactureFournisseur($this->savdb);
        $localobject->initAsSpecimen();

        // Canelle
        $localobject->modelpdf='canelle';
        $result=supplier_invoice_pdf_create($db, $localobject, $localobject->modelpdf, $langs);

        $this->assertLessThan($result, 0);
        print __METHOD__." result=".$result."\n";

        return 0;
    }