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);
/** * 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++; } }
/** * \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++; } }
/** * 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; }
/** * 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; }