本文整理汇总了PHP中Commande类的典型用法代码示例。如果您正苦于以下问题:PHP Commande类的具体用法?PHP Commande怎么用?PHP Commande使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Commande类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
public function getList($order, $critere, $debut, $nbres)
{
$query = $this->getRequest('list', $order, $critere, $debut, $nbres);
$resul = $this->query($query);
$retour = array();
while ($resul && ($row = $this->fetch_object($resul))) {
$thisClient = array();
$thisClient['ref'] = $row->ref;
$thisClient['entreprise'] = $row->entreprise;
$thisClient['nom'] = $row->nom;
$thisClient['prenom'] = $row->prenom;
$thisClient['email'] = $row->email;
$commande = new Commande();
$devise = new Devise();
$querycom = "SELECT id FROM {$commande->table} WHERE client={$row->id} AND statut NOT IN(" . Commande::NONPAYE . "," . Commande::ANNULE . ") ORDER BY date DESC LIMIT 0,1";
$resulcom = $commande->query($querycom);
if ($commande->num_rows($resulcom) > 0) {
$idcom = $commande->get_result($resulcom, 0, "id");
$commande->charger($idcom);
$devise->charger($commande->devise);
$thisClient['date'] = strftime("%d/%m/%Y %H:%M:%S", strtotime($commande->date));
$thisClient['somme'] = formatter_somme($commande->total(true, true)) . ' ' . $devise->symbole;
} else {
$thisClient['date'] = '';
$thisClient['somme'] = '';
}
$retour[] = $thisClient;
}
return $retour;
}
示例2: loadBox
/**
* Load data for box to show them later
*
* @param int $max Maximum number of records to load
* @return void
*/
function loadBox($max = 5)
{
global $user, $langs, $db, $conf;
$this->max = $max;
include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
$commandestatic = new Commande($db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastCustomerOrders", $max));
if ($user->rights->commande->lire) {
$sql = "SELECT s.nom, s.rowid as socid,";
$sql .= " c.ref, c.tms, c.rowid,";
$sql .= " c.fk_statut, c.facture";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
$sql .= ", " . MAIN_DB_PREFIX . "commande as c";
if (!$user->rights->societe->client->voir && !$user->societe_id) {
$sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
}
$sql .= " WHERE c.fk_soc = s.rowid";
$sql .= " AND c.entity = " . $conf->entity;
if (!$user->rights->societe->client->voir && !$user->societe_id) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
}
if ($user->societe_id) {
$sql .= " AND s.rowid = " . $user->societe_id;
}
$sql .= " ORDER BY c.date_commande DESC, c.ref DESC ";
$sql .= $db->plimit($max, 0);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$i = 0;
while ($i < $num) {
$objp = $db->fetch_object($result);
$datem = $db->jdate($objp->tms);
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => DOL_URL_ROOT . "/commande/fiche.php?id=" . $objp->rowid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->ref, 'url' => DOL_URL_ROOT . "/commande/fiche.php?id=" . $objp->rowid);
$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', 'logo' => 'company', 'url' => DOL_URL_ROOT . "/comm/fiche.php?socid=" . $objp->socid);
$this->info_box_contents[$i][3] = array('td' => 'align="left"', 'text' => $objp->nom, 'url' => DOL_URL_ROOT . "/comm/fiche.php?socid=" . $objp->socid);
$this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => dol_print_date($datem, 'day'));
$this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', 'text' => $commandestatic->LibStatut($objp->fk_statut, $objp->facture, 3));
$i++;
}
if ($num == 0) {
$this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedOrders"));
}
$db->free($result);
} else {
$this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql);
}
} else {
$this->info_box_contents[0][0] = array('align' => 'left', 'text' => $langs->trans("ReadPermissionNotAllowed"));
}
}
示例3: getInstance
public static function getInstance($typeMatch, $phase, $place, $typeBillet, $nomUtilisateur, $password)
{
if (is_null(self::$_instance)) {
self::$_instance = new Commande($typeMatch, $phase, $place, $typeBillet, $nomUtilisateur, $password);
}
return self::$_instance;
}
示例4: confirmedCart
public function confirmedCart()
{
//on récupère l'id du client
$id = Session::get('client_id');
//on trouve le client avec son id
$user = User::find($id);
//on charge les données pour la création de la commande
$data = array('id_client' => $user->id);
//on créer une nouvelle commande
$commande = Commande::create($data);
//on récupère les données de la session cart
$cart_aray = Session::get('cart');
foreach ($cart_aray as $c_array) {
foreach ($c_array as $cart_line) {
//on charge les données avant de créer une nouvelle ligne de commande
$data = array('id_client' => $user->id, 'id_produit' => $cart_line['id'], 'quantite' => 1, 'id_command' => $commande->id);
// pour chaque tour, on crée une nouvelle ligne de commande dans la base
$ligne_commande = LigneCommande::create($data);
}
}
//on supprime la session cart, et on la recrée vide.
Session::forget('cart');
Session::put('cart.items', '');
return View::make('confirmed_cart');
}
示例5: substitcommande
function substitcommande($texte)
{
global $commande;
if ($commande) {
$refs = $commande;
} else {
$refs = $_SESSION['navig']->commande->ref;
}
$texte = str_replace("#COMMANDE_TRANSPORT", $_SESSION['navig']->commande->transport, $texte);
$tcommande = new Commande();
$tcommande->charger_ref($refs);
$texte = str_replace("#COMMANDE_ID", $tcommande->id, $texte);
$texte = str_replace("#COMMANDE_REF", $tcommande->ref, $texte);
$texte = str_replace("#COMMANDE_TRANSACTION", $tcommande->transaction, $texte);
return $texte;
}
示例6: update
public function update(Commande $commande){
$query = $this->_db->prepare(
'UPDATE t_commande SET
idFournisseur=:idFournisseur, idProjet=:idProjet, dateCommande=:dateCommande,
numeroCommande=:numeroCommande, designation=:designation, updated=:updated,
updatedBy=:updatedBy
WHERE id=:id')
or die (print_r($this->_db->errorInfo()));
$query->bindValue(':id', $commande->id());
$query->bindValue(':idFournisseur', $commande->idFournisseur());
$query->bindValue(':idProjet', $commande->idProjet());
$query->bindValue(':dateCommande', $commande->dateCommande());
$query->bindValue(':numeroCommande', $commande->numeroCommande());
$query->bindValue(':designation', $commande->designation());
$query->bindValue(':updated', $commande->updated());
$query->bindValue(':updatedBy', $commande->updatedBy());
$query->execute();
$query->closeCursor();
}
示例7: afficherListeCommandes
/**
* Affiche la liste de commandes
* @return renvoie true si le tableau n'est pas vide
*/
function afficherListeCommandes()
{
//requete sql
$fin_req = "";
if ($this->numclient) {
$fin_req .= " AND numclient='{$this->numclient}'";
}
if ($this->erreur_paiement) {
$fin_req .= " AND erreur_paiement='{$this->erreur_paiement}'";
}
if ($this->type_reg) {
$fin_req .= " AND tpereg='{$this->type_reg}'";
}
if ($this->date_du && $this->date_au) {
$fin_req .= " AND hcrea BETWEEN {$this->date_du} AND {$this->date_au}";
} else {
if ($this->date_du) {
$fin_req .= " AND hcrea >= {$this->date_du}";
} else {
if ($this->date_au) {
$fin_req .= " AND hcrea <= {$this->date_au}";
}
}
}
/*if ($this->formation) $result=mysql_query("SELECT if_bo_com.numcom FROM if_bo_com,if_bo_detail WHERE if_bo_com.numcom=if_bo_detail.numcom AND if_bo_detail.designation='Inscription formation' $fin_req ORDER BY hcrea DESC");
else $result=mysql_query("SELECT if_bo_com.numcom FROM if_bo_com,if_bo_detail WHERE etat $this->etat $fin_req AND if_bo_com.numcom=if_bo_detail.numcom ORDER BY hcrea DESC");*/
if ($this->formation) {
$result = mysql_query("SELECT if_bo_com.numcom FROM if_bo_com,if_bo_detail WHERE if_bo_com.numcom=if_bo_detail.numcom AND if_bo_detail.designation='Inscription formation' {$fin_req} ORDER BY hcrea DESC");
} else {
//$result=mysql_query("SELECT if_bo_com.numcom FROM if_bo_com,if_bo_detail WHERE etat $this->etat $fin_req AND if_bo_com.numcom=if_bo_detail.numcom ORDER BY hcrea DESC");
$result = mysql_query("SELECT if_bo_com.numcom FROM if_bo_com WHERE etat {$this->etat} {$fin_req} ORDER BY hcrea DESC");
}
// echo "SELECT numcom FROM if_bo_com WHERE etat $this->etat $fin_req ORDER BY hcrea DESC";
while ($row = mysql_fetch_row($result)) {
$uneCommande = new Commande();
$uneCommande->numcom = $row[0];
$uneCommande->infosCommande();
$this->commandes[] = $uneCommande;
}
if (count($this->commandes) >= 1) {
return true;
}
}
示例8: trad
?>
</th>
<th><?php
echo trad('MONTANT_euro', 'admin');
?>
</th>
<th><?php
echo trad('STATUT', 'admin');
?>
</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
$commande = new Commande();
$query = "SELECT * FROM " . Commande::TABLE . " WHERE client='" . $client->id . "' ORDER BY date DESC";
$resul = $commande->query($query);
while ($resul && ($cmd = $commande->fetch_object($resul, 'Commande'))) {
$statutdesc = new Statutdesc();
$statutdesc->charger($cmd->statut);
switch ($cmd->statut) {
case '1':
$trClass = 'warning';
break;
case '4':
$trClass = 'success';
break;
case '5':
$trClass = 'error';
break;
示例9: create
//.........这里部分代码省略.........
$sql .= ", " . ($this->fk_project ? $this->fk_project : "null");
$sql .= ", " . $this->cond_reglement_id;
$sql .= ", " . $this->mode_reglement_id;
$sql .= ", '" . $this->db->idate($datelim) . "', '" . $this->db->escape($this->modelpdf) . "'";
$sql .= ", " . ($this->situation_cycle_ref ? "'" . $this->db->escape($this->situation_cycle_ref) . "'" : "null");
$sql .= ", " . ($this->situation_counter ? "'" . $this->db->escape($this->situation_counter) . "'" : "null");
$sql .= ", " . ($this->situation_final ? $this->situation_final : 0);
$sql .= ", " . (int) $this->fk_incoterms;
$sql .= ", '" . $this->db->escape($this->location_incoterms) . "'";
$sql .= ")";
dol_syslog(get_class($this) . "::create", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . 'facture');
// Update ref with new one
$this->ref = '(PROV' . $this->id . ')';
$sql = 'UPDATE ' . MAIN_DB_PREFIX . "facture SET facnumber='" . $this->ref . "' WHERE rowid=" . $this->id;
dol_syslog(get_class($this) . "::create", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
}
// Add object linked
if (!$error && $this->id && is_array($this->linked_objects) && !empty($this->linked_objects)) {
foreach ($this->linked_objects as $origin => $origin_id) {
$ret = $this->add_object_linked($origin, $origin_id);
if (!$ret) {
dol_print_error($this->db);
$error++;
}
// TODO mutualiser
if ($origin == 'commande') {
// On recupere les differents contact interne et externe
$order = new Commande($this->db);
$order->id = $origin_id;
// On recupere le commercial suivi propale
$this->userid = $order->getIdcontact('internal', 'SALESREPFOLL');
if ($this->userid) {
//On passe le commercial suivi commande en commercial suivi paiement
$this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal');
}
// On recupere le contact client facturation commande
$this->contactid = $order->getIdcontact('external', 'BILLING');
if ($this->contactid) {
//On passe le contact client facturation commande en contact client facturation
$this->add_contact($this->contactid[0], 'BILLING', 'external');
}
}
}
}
/*
* Insert lines of invoices into database
*/
if (count($this->lines) && is_object($this->lines[0])) {
$fk_parent_line = 0;
dol_syslog("There is " . count($this->lines) . " lines that are invoice lines objects");
foreach ($this->lines as $i => $val) {
$newinvoiceline = $this->lines[$i];
$newinvoiceline->fk_facture = $this->id;
$newinvoiceline->origin = $this->element;
$newinvoiceline->origin_id = $this->lines[$i]->id;
if ($result >= 0 && ($newinvoiceline->info_bits & 0x1) == 0) {
// Reset fk_parent_line for no child products and special product
if ($newinvoiceline->product_type != 9 && empty($newinvoiceline->fk_parent_line) || $newinvoiceline->product_type == 9) {
$fk_parent_line = 0;
}
示例10: actionPaypalPayment
public function actionPaypalPayment()
{
$customer_model = new Customer();
$commande_model = new Commande();
$customer_model->attributes = Yii::app()->user->getState('Customer');
$commande_model->attributes = Yii::app()->user->getState('Commande');
if (sizeof($customer_model->search()->getData()) == 0) {
$customer_model->bilsignupip = CHttpRequest::getUserHostAddress();
$customer_model->save();
$commande_model->bilkey = $customer_model->bilkey;
$commande_model->comdebut = date("Y-m-d");
$commande_model->save();
} else {
$customerTemp = $customer_model->search()->getData();
$customer_model->bilkey = $customerTemp[0]->attributes['bilkey'];
}
if (isset($_POST['payment_status'])) {
if ($_POST['payment_status'] == "Completed" || $_POST['payment_status'] == "Pending") {
$city = Goodcity::model()->findByPk($_POST['item_number']);
$this->sendEmailConfirmation($customer_model, $city, $commande_model, $_POST['txn_id'], $this->getInvoiceTotals($customer_model, $commande_model));
$this->render('application/2-orderform', array('goodcity' => $city, 'thanks' => true, 'payment_type' => "paypal", 'payment_method' => "email", 'order_totals' => $this->getInvoiceTotals($customer_model, $commande_model), 'customer_model' => $customer_model, 'commande_model' => $commande_model, 'auth_code' => $_POST['txn_id']));
} else {
$this->redirect(array('user/order', 'transactionError' => true));
}
} else {
$city = Goodcity::model()->findByPk($commande_model['comgoodcitykey']);
$this->redirect(array('user/signup', 'city' => $commande_model['comgoodcitykey']));
}
}
示例11: Commande
$var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
print ' ('.$langs->trans("ToComplete").')';
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="email" size="48" value="'.GETPOST("email").'"></td></tr>'."\n";
}
// Payment on customer order
if (GETPOST("source") == 'order')
{
$found=true;
$langs->load("orders");
require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
$order=new Commande($db);
$result=$order->fetch('',$_REQUEST["ref"]);
if ($result < 0)
{
$mesg=$order->error;
$error++;
}
else
{
$result=$order->fetch_thirdparty($order->socid);
}
$amount=$order->total_ttc;
if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int');
$amount=price2num($amount);
示例12: Commande
$formmail->withtocc = $liste;
$formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
$formmail->withtopic = $outputlangs->trans('SendShippingRef', '__SHIPPINGREF__');
$formmail->withfile = 2;
$formmail->withbody = 1;
$formmail->withdeliveryreceipt = 1;
$formmail->withcancel = 1;
// Tableau des substitutions
$formmail->substit['__SHIPPINGREF__'] = $object->ref;
$formmail->substit['__SIGNATURE__'] = $user->signature;
$formmail->substit['__PERSONALIZED__'] = '';
$formmail->substit['__CONTACTCIVNAME__'] = '';
//Find the good contact adress
//Find the good contact adress
if ($typeobject == 'commande' && $object->{$typeobject}->id && !empty($conf->commande->enabled)) {
$objectsrc = new Commande($db);
$objectsrc->fetch($object->{$typeobject}->id);
}
if ($typeobject == 'propal' && $object->{$typeobject}->id && !empty($conf->propal->enabled)) {
$objectsrc = new Propal($db);
$objectsrc->fetch($object->{$typeobject}->id);
}
$custcontact = '';
$contactarr = array();
$contactarr = $objectsrc->liste_contact(-1, 'external');
if (is_array($contactarr) && count($contactarr) > 0) {
foreach ($contactarr as $contact) {
if ($contact['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) {
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
$contactstatic = new Contact($db);
$contactstatic->fetch($contact['id']);
示例13: array
print '<td align="right">';
$liststatus = array('0' => $langs->trans("StatusOrderDraftShort"), '1' => $langs->trans("StatusOrderValidated"), '2' => $langs->trans("StatusOrderSentShort"), '3' => $langs->trans("StatusOrderDelivered"), '-1' => $langs->trans("StatusOrderCanceledShort"));
print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4);
print '</td>';
print '<td align="center">';
print $form->selectyesno('billed', $billed, 1, 0, 1);
print '</td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
print "</td></tr>\n";
$var = true;
$total = 0;
$subtotal = 0;
$productstat_cache = array();
$i = 0;
$generic_commande = new Commande($db);
$generic_product = new Product($db);
while ($i < min($num, $limit)) {
$objp = $db->fetch_object($resql);
$var = !$var;
print '<tr ' . $bc[$var] . '>';
print '<td class="nowrap">';
$generic_commande->id = $objp->rowid;
$generic_commande->ref = $objp->ref;
$generic_commande->statut = $objp->fk_statut;
$generic_commande->date_commande = $db->jdate($objp->date_commande);
$generic_commande->date_livraison = $db->jdate($objp->date_delivery);
$generic_commande->ref_client = $objp->ref_client;
$generic_commande->total_ht = $objp->total_ht;
$generic_commande->total_tva = $objp->total_tva;
$generic_commande->total_ttc = $objp->total_ttc;
示例14: createFromClone
/**
* Load an object from its id and create a new one in database
* @param fromid Id of object to clone
* @param invertdetail Reverse sign of amounts for lines
* @param socid Id of thirdparty
* @return int New id of clone
*/
function createFromClone($fromid, $invertdetail = 0, $socid = 0)
{
global $conf, $user, $langs;
$error = 0;
$object = new Commande($this->db);
// Instantiate hooks of thirdparty module
if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules)) {
$object->callHooks('ordercard');
}
$this->db->begin();
// Load source object
$object->fetch($fromid);
$objFrom = $object;
// Change socid if needed
if (!empty($socid) && $socid != $object->socid) {
$objsoc = new Societe($this->db);
if ($objsoc->fetch($socid) > 0) {
$object->socid = $objsoc->id;
$object->cond_reglement_id = !empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0;
$object->mode_reglement_id = !empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0;
$object->fk_project = '';
$object->fk_delivery_address = '';
}
// TODO Change product price if multi-prices
}
$object->id = 0;
$object->statut = 0;
// Clear fields
$object->user_author_id = $user->id;
$object->user_valid = '';
$object->date_creation = '';
$object->date_validation = '';
$object->ref_client = '';
// Create clone
$result = $object->create($user);
// Other options
if ($result < 0) {
$this->error = $object->error;
$error++;
}
if (!$error) {
// Hook of thirdparty module
if (!empty($object->hooks)) {
foreach ($object->hooks as $hook) {
if (!empty($hook['modules'])) {
foreach ($hook['modules'] as $module) {
if (method_exists($module, 'createfrom')) {
$result = $module->createfrom($objFrom, $result, $object->element);
if ($result < 0) {
$error++;
}
}
}
}
}
}
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php";
$interface = new Interfaces($this->db);
$result = $interface->run_triggers('ORDER_CLONE', $object, $user, $langs, $conf);
if ($result < 0) {
$error++;
$this->errors = $interface->errors;
}
// Fin appel triggers
}
// End
if (!$error) {
$this->db->commit();
return $object->id;
} else {
$this->db->rollback();
return -1;
}
}
示例15: dol_print_error
print '</tr>';
} else {
print '<tr ' . $bc[$var] . '><td colspan="5">' . $langs->trans("None") . '</td></tr>';
}
print "</table><br>";
$db->free($resql);
} else {
dol_print_error($db);
}
}
}
/*
* Customers orders to be billed
*/
if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user->rights->commande->lire) {
$commandestatic = new Commande($db);
$langs->load("orders");
$sql = "SELECT sum(f.total) as tot_fht, sum(f.total_ttc) as tot_fttc,";
$sql .= " s.nom, s.rowid as socid,";
$sql .= " c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.total_ttc";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
}
$sql .= ", " . MAIN_DB_PREFIX . "commande as c";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "element_element as el ON el.fk_source = c.rowid AND el.sourcetype = 'commande'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture AS f ON el.fk_target = f.rowid AND el.targettype = 'facture'";
$sql .= " WHERE c.fk_soc = s.rowid";
$sql .= " AND c.entity = " . $conf->entity;
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;