本文整理汇总了PHP中Commande::initAsSpecimen方法的典型用法代码示例。如果您正苦于以下问题:PHP Commande::initAsSpecimen方法的具体用法?PHP Commande::initAsSpecimen怎么用?PHP Commande::initAsSpecimen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Commande
的用法示例。
在下文中一共展示了Commande::initAsSpecimen方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Commande
print $langs->trans($tmp);
} else {
print $tmp;
}
print '</td>' . "\n";
print '<td align="center">';
if ($conf->global->COMMANDE_ADDON == $file) {
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setmod&value=' . $file . '">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>';
}
print '</td>';
$commande = new Commande($db);
$commande->initAsSpecimen();
// Info
$htmltooltip = '';
$htmltooltip .= '' . $langs->trans("Version") . ': <b>' . $module->getVersion() . '</b><br>';
$commande->type = 0;
$nextval = $module->getNextValue($mysoc, $commande);
if ("{$nextval}" != $langs->trans("NotAvailable")) {
$htmltooltip .= '' . $langs->trans("NextValue") . ': ';
if ($nextval) {
$htmltooltip .= $nextval . '<br>';
} else {
$htmltooltip .= $langs->trans($module->error) . '<br>';
}
}
print '<td align="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
示例2: initAsSpecimen
/**
* Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/
function initAsSpecimen()
{
global $user, $langs, $conf;
$now = dol_now();
dol_syslog(get_class($this) . "::initAsSpecimen");
// Charge tableau des produits prodids
$prodids = array();
$sql = "SELECT rowid";
$sql .= " FROM " . MAIN_DB_PREFIX . "product";
$sql .= " WHERE entity IN (" . getEntity('product', 1) . ")";
$resql = $this->db->query($sql);
if ($resql) {
$num_prods = $this->db->num_rows($resql);
$i = 0;
while ($i < $num_prods) {
$i++;
$row = $this->db->fetch_row($resql);
$prodids[$i] = $row[0];
}
}
$order = new Commande($this->db);
$order->initAsSpecimen();
// Initialise parametres
$this->id = 0;
$this->ref = 'SPECIMEN';
$this->specimen = 1;
$this->statut = 1;
$this->livraison_id = 0;
$this->date = $now;
$this->date_creation = $now;
$this->date_valid = $now;
$this->date_delivery = $now;
$this->date_expedition = $now + 24 * 3600;
$this->entrepot_id = 0;
$this->fk_delivery_address = 0;
$this->socid = 1;
$this->commande_id = 0;
$this->commande = $order;
$this->origin_id = 1;
$this->origin = 'commande';
$this->note_private = 'Private note';
$this->note_public = 'Public note';
$nbp = 5;
$xnbp = 0;
while ($xnbp < $nbp) {
$line = new ExpeditionLigne($this->db);
$line->desc = $langs->trans("Description") . " " . $xnbp;
$line->libelle = $langs->trans("Description") . " " . $xnbp;
$line->qty = 10;
$line->qty_asked = 5;
$line->qty_shipped = 4;
$line->fk_product = $this->commande->lines[$xnbp]->fk_product;
$this->lines[] = $line;
$xnbp++;
}
}
示例3: initAsSpecimen
/**
* \brief Initialise la facture avec valeurs fictives aleatoire
* Sert a generer une facture pour l'aperu des modeles ou dem
*/
function initAsSpecimen()
{
global $user,$langs,$conf;
dol_syslog("Expedition::initAsSpecimen");
// Charge tableau des produits prodids
$prodids = array();
$sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."product";
$sql.= " WHERE entity = ".$conf->entity;
$resql = $this->db->query($sql);
if ($resql)
{
$num_prods = $this->db->num_rows($resql);
$i = 0;
while ($i < $num_prods)
{
$i++;
$row = $this->db->fetch_row($resql);
$prodids[$i] = $row[0];
}
}
$order=new Commande($this->db);
$order->initAsSpecimen();
// Initialise parametres
$this->id=0;
$this->ref = 'SPECIMEN';
$this->specimen=1;
$this->statut = 1;
if ($conf->livraison_bon->enabled)
{
$this->livraison_id = 0;
}
$this->date = time();
$this->entrepot_id = 0;
$this->fk_delivery_address = 0;
$this->socid = 1;
$this->commande_id = 0;
$this->commande = $order;
$this->origin_id = 1;
$this->origin = 'commande';
$nbp = 5;
$xnbp = 0;
while ($xnbp < $nbp)
{
$line=new ExpeditionLigne($this->db);
$line->desc=$langs->trans("Description")." ".$xnbp;
$line->libelle=$langs->trans("Description")." ".$xnbp;
$line->qty=10;
$line->qty_asked=5;
$line->qty_shipped=4;
$line->fk_product=$this->commande->lines[$xnbp]->fk_product;
$this->lines[]=$line;
$xnbp++;
}
}
示例4: testCommandeCreate
/**
* testCommandeCreate
*
* @return void
*/
public function testCommandeCreate()
{
global $conf, $user, $langs, $db;
$conf = $this->savconf;
$user = $this->savuser;
$langs = $this->savlangs;
$db = $this->savdb;
$localobject = new Commande($this->savdb);
$localobject->initAsSpecimen();
$result = $localobject->create($user);
$this->assertLessThan($result, 0);
print __METHOD__ . " result=" . $result . "\n";
return $result;
}
示例5: testCommandeBuild
/**
* testCommandeBuild
*
* @return int
*/
public function testCommandeBuild()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$conf->commande->dir_output.='/temp';
$localobject=new Commande($this->savdb);
$localobject->initAsSpecimen();
// Einstein
$localobject->modelpdf='einstein';
$result=commande_pdf_create($db, $localobject, $localobject->modelpdf, $langs);
$this->assertLessThan($result, 0);
print __METHOD__." result=".$result."\n";
// Edison
$localobject->modelpdf='edison';
$result=commande_pdf_create($db, $localobject, $localobject->modelpdf, $langs);
$this->assertLessThan($result, 0);
print __METHOD__." result=".$result."\n";
return 0;
}