本文整理汇总了PHP中CommandeFournisseur::initAsSpecimen方法的典型用法代码示例。如果您正苦于以下问题:PHP CommandeFournisseur::initAsSpecimen方法的具体用法?PHP CommandeFournisseur::initAsSpecimen怎么用?PHP CommandeFournisseur::initAsSpecimen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommandeFournisseur
的用法示例。
在下文中一共展示了CommandeFournisseur::initAsSpecimen方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
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->COMMANDE_SUPPLIER_ADDON_NUMBER == "{$file}") {
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setmod&value=' . $file . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</a>';
}
print '</td>';
$commande = new CommandeFournisseur($db);
$commande->initAsSpecimen();
// Info
$htmltooltip = '';
$htmltooltip .= '' . $langs->trans("Version") . ': <b>' . $module->getVersion() . '</b><br>';
$nextval = $module->getNextValue($mysoc, $commande);
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>';
}
示例2: testCommandeFournisseurBuild
/**
* testCommandeFournisseurBuild
*
* @return int
*/
public function testCommandeFournisseurBuild()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$conf->fournisseur->commande->dir_output.='/temp';
$localobject=new CommandeFournisseur($this->savdb);
$localobject->initAsSpecimen();
// Muscadet
$localobject->modelpdf='muscadet';
$result=supplier_order_pdf_create($db, $localobject, $localobject->modelpdf, $langs);
$this->assertLessThan($result, 0);
print __METHOD__." result=".$result."\n";
return 0;
}
示例3: testCommandeFournisseurCreate
/**
*/
public function testCommandeFournisseurCreate()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject=new CommandeFournisseur($this->savdb);
$localobject->initAsSpecimen();
$result=$localobject->create($user);
print __METHOD__." result=".$result."\n";
$this->assertLessThan($result, 0);
return $result;
}
示例4: testCommandeFournisseurCreate
/**
* testCommandeFournisseurCreate
*
* @return void
*/
public function testCommandeFournisseurCreate()
{
global $conf, $user, $langs, $db;
$conf = $this->savconf;
$user = $this->savuser;
$langs = $this->savlangs;
$db = $this->savdb;
// Set supplier and product to use
$socid = 1;
$societe = new Societe($db);
$societe->fetch($socid);
$product = new ProductFournisseur($db);
$product->fetch(0, 'PIDRESS');
if ($product->id <= 0) {
print "\n" . __METHOD__ . " A product with ref PIDRESS must exists into database";
die;
}
$quantity = 10;
$ref_fourn = 'SUPPLIER_REF_PHPUNIT';
$tva_tx = 19.6;
// Create supplier price
$result = $product->add_fournisseur($user, $societe->id, $ref_fourn, $quantity);
// This insert record with no value for price. Values are update later with update_buyprice
$this->assertGreaterThanOrEqual(1, $result);
$result = $product->update_buyprice($quantity, 10, $user, 'HT', $societe, '', $ref_fourn, $tva_tx, 0, 0);
$this->assertGreaterThanOrEqual(0, $result);
// Create supplier order with a too low quantity
$localobject = new CommandeFournisseur($db);
$localobject->initAsSpecimen();
$localobject->lines = array();
// Overwrite lines of order
$line = new CommandeFournisseurLigne($db);
$line->desc = $langs->trans("Description") . " specimen line too low";
$line->qty = 1;
// So lower than $quantity
$line->fk_product = $product->id;
$line->ref_fourn = $ref_fourn;
$localobject->lines[] = $line;
$result = $localobject->create($user);
print __METHOD__ . " result=" . $result . "\n";
$this->assertEquals(-1, $result);
// must be -1 because quantity is lower than minimum of supplier price
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "commande_fournisseur where ref=''";
$db->query($sql);
// Create supplier order
$localobject2 = new CommandeFournisseur($db);
$localobject2->initAsSpecimen();
// This create 5 lines of first product found for socid 1
$localobject2->lines = array();
// Overwrite lines of order
$line = new CommandeFournisseurLigne($db);
$line->desc = $langs->trans("Description") . " specimen line ok";
$line->qty = 10;
// So enough quantity
$line->fk_product = $product->id;
$line->ref_fourn = $ref_fourn;
$localobject2->lines[] = $line;
$result = $localobject2->create($user);
print __METHOD__ . " result=" . $result . "\n";
$this->assertGreaterThanOrEqual(0, $result);
return $result;
}