Works on paypal module
Fix: add multi status
This commit is contained in:
parent
8ce54c01b2
commit
8d8fd9ba91
@ -1162,24 +1162,26 @@ class Commande extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Get object and lines from database
|
||||
* \param id Id of object to load
|
||||
* \param ref Ref of object
|
||||
* \return int >0 if OK, <0 if KO
|
||||
* Get object and lines from database
|
||||
* @param id Id of object to load
|
||||
* @param ref Ref of object
|
||||
* @param ref_ext External reference of object
|
||||
* @param ref_int Internal reference of other object
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function fetch($id,$ref='')
|
||||
function fetch($id, $ref='', $ref_ext='', $ref_int='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Check parameters
|
||||
if (empty($id) && empty($ref)) return -1;
|
||||
if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
|
||||
|
||||
$sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut';
|
||||
$sql.= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_demand_reason';
|
||||
$sql.= ', c.date_commande';
|
||||
$sql.= ', c.date_livraison';
|
||||
$sql.= ', c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as facturee';
|
||||
$sql.= ', c.note, c.note_public, c.ref_client, c.ref_ext, c.model_pdf, c.fk_adresse_livraison';
|
||||
$sql.= ', c.note, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.fk_adresse_livraison';
|
||||
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
|
||||
$sql.= ', cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc';
|
||||
$sql.= ', ca.code as availability_code';
|
||||
@ -1192,8 +1194,10 @@ class Commande extends CommonObject
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON (c.fk_demand_reason = ca.rowid)';
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = c.rowid AND el.targettype = '".$this->element."'";
|
||||
$sql.= " WHERE c.entity = ".$conf->entity;
|
||||
if ($ref) $sql.= " AND c.ref='".$ref."'";
|
||||
else $sql.= " AND c.rowid=".$id;
|
||||
if ($id) $sql.= " AND c.rowid=".$id;
|
||||
if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'";
|
||||
if ($ref_ext) $sql.= " AND c.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql.= " AND c.ref_int='".$this->db->escape($ref_int)."'";
|
||||
|
||||
dol_syslog("Commande::fetch sql=".$sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql) ;
|
||||
@ -1206,6 +1210,7 @@ class Commande extends CommonObject
|
||||
$this->ref = $obj->ref;
|
||||
$this->ref_client = $obj->ref_client;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
$this->ref_int = $obj->ref_int;
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->user_author_id = $obj->fk_user_author;
|
||||
|
||||
@ -1440,9 +1440,9 @@ if ($action == 'create')
|
||||
if (empty($objectsrc->lines) && method_exists($objectsrc,'fetch_lines')) $objectsrc->fetch_lines();
|
||||
$objectsrc->fetch_thirdparty();
|
||||
|
||||
$projectid = (!empty($objectsrc->fk_project)?$object->fk_project:'');
|
||||
$ref_client = (!empty($objectsrc->ref_client)?$object->ref_client:'');
|
||||
$ref_int = (!empty($objectsrc->ref_int)?$object->ref_int:'');
|
||||
$projectid = (!empty($objectsrc->fk_project)?$objectsrc->fk_project:'');
|
||||
$ref_client = (!empty($objectsrc->ref_client)?$objectsrc->ref_client:'');
|
||||
$ref_int = (!empty($objectsrc->ref_int)?$objectsrc->ref_int:'');
|
||||
|
||||
$soc = $objectsrc->client;
|
||||
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));
|
||||
|
||||
@ -644,7 +644,8 @@ class Facture extends CommonObject
|
||||
* Get object and lines from database
|
||||
* @param rowid Id of object to load
|
||||
* @param ref Reference of invoice
|
||||
* @param ref External reference of invoice
|
||||
* @param ref_ext External reference of invoice
|
||||
* @param ref_int Internal reference of other object
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function fetch($rowid, $ref='', $ref_ext='', $ref_int='')
|
||||
|
||||
@ -26,7 +26,7 @@ GrossAmount=Gross amount
|
||||
FeeAmount=Fee amount
|
||||
NetAmount=Net amount
|
||||
CustomerDetails=Customer details
|
||||
NewTransaction=New transaction
|
||||
TransactionCompleted=Transaction completed
|
||||
OrderIsCreated=Order created
|
||||
InvoiceIsCreated=Invoice created
|
||||
PaypalCreateOrderEnabled=Enable the ability to create customer orders
|
||||
|
||||
@ -26,7 +26,7 @@ GrossAmount=Montant brut
|
||||
FeeAmount=Frais Paypal
|
||||
NetAmount=Montant net
|
||||
CustomerDetails=Détail du client
|
||||
NewTransaction=Nouveau paiement
|
||||
TransactionCompleted=Paiement validé
|
||||
OrderIsCreated=Commande créée
|
||||
InvoiceIsCreated=Facture créée
|
||||
PaypalCreateOrderEnabled=Activer la possibilité de créer des commandes clients.
|
||||
@ -34,7 +34,7 @@ PaypalCreateInvoiceEnabled=Activer la possibilité de créer des factures client
|
||||
UseThePriceDefinedInPaypal=Utiliser le prix défini dans Paypal au lieu de celui défini dans Dolibarr
|
||||
DefaultProductShippingCosts=Sélectionnez le produit qui sera utilisé pour l'ajout des frais de port.
|
||||
DefaultPaypalAccount=Sélectionner le compte bancaire qui sera utilisé comme compte Paypal, ceci permettra de déduire les frais Paypal lors de l'ajout d'un paiement.
|
||||
ErrorProductWithRefNotSamePrice=Le prix défini pour la référence <b>%s</b> ne correspond pas au prix Paypal
|
||||
ErrorProductWithRefNotSamePrice=Le prix défini pour la référence "<i>%s</i>" ne correspond pas au prix Paypal
|
||||
|
||||
# Paypal transaction fields
|
||||
PAYERID=ID du payeur
|
||||
|
||||
@ -196,17 +196,13 @@ function getLibStatut($statut,$mode,$url)
|
||||
if ($url) $out.= '<a href="'.$url.'">';
|
||||
if ($mode == 0)
|
||||
{
|
||||
if ($statut==-1) $out.= $langs->trans('Undefined');
|
||||
if ($statut==0) $out.= $langs->trans('NewTransaction');
|
||||
if ($statut==1) $out.= $langs->trans('OrderIsCreated');
|
||||
if ($statut==2) $out.= $langs->trans('InvoiceIsCreated');
|
||||
if ($statut==0) $out.= $langs->trans('Undefined');
|
||||
if ($statut==1) $out.= $langs->trans('NewTransaction');
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
if ($statut==-1) $out.= img_picto($langs->trans('Undefined'),'warning');
|
||||
if ($statut==0) $out.= img_picto($langs->trans('NewTransaction'),'statut0');
|
||||
if ($statut==1) $out.= img_picto($langs->trans('OrderIsCreated'),'statut3');
|
||||
if ($statut==2) $out.= img_picto($langs->trans('InvoiceIsCreated'),'statut4');
|
||||
if ($statut==0) $out.= img_picto($langs->trans('Undefined'),'warning');
|
||||
if ($statut==1) $out.= img_picto($langs->trans('TransactionCompleted'),'statut4');
|
||||
}
|
||||
if ($url) $out.= '</a>';
|
||||
|
||||
|
||||
@ -274,7 +274,15 @@ print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'','',''.$soc
|
||||
print_liste_field_titre($langs->trans('GrossAmount'),$_SERVER['PHP_SELF'],'','','&socid='.$socid.'&viewstatut='.$viewstatut, 'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('FeeAmount'),$_SERVER['PHP_SELF'],'','','&socid='.$socid.'&viewstatut='.$viewstatut, 'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('NetAmount'),$_SERVER['PHP_SELF'],'','','&socid='.$socid.'&viewstatut='.$viewstatut, 'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'','',''.$socid.'&viewstatut='.$viewstatut,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre(img_object($langs->trans('Paypal'), 'paypal@paypal'),$_SERVER['PHP_SELF'],'','',''.$socid.'&viewstatut='.$viewstatut,'width="30" align="right"',$sortfield,$sortorder);
|
||||
if ($conf->commande->enabled && $conf->global->PAYPAL_CREATE_ORDER_ENABLED)
|
||||
{
|
||||
print_liste_field_titre(img_object($langs->trans('Order'), 'order'),$_SERVER['PHP_SELF'],'','',''.$socid.'&viewstatut='.$viewstatut,'width="15" align="center"',$sortfield,$sortorder);
|
||||
}
|
||||
if ($conf->facture->enabled && $conf->global->PAYPAL_CREATE_INVOICE_ENABLED)
|
||||
{
|
||||
print_liste_field_titre(img_object($langs->trans('Bill'), 'bill'),$_SERVER['PHP_SELF'],'','',''.$socid.'&viewstatut='.$viewstatut,'width="15" align="center"',$sortfield,$sortorder);
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
$var=true;
|
||||
@ -303,18 +311,8 @@ else
|
||||
$netamount = $resArray["L_NETAMT".$i];
|
||||
$currency = $resArray["L_CURRENCYCODE".$i];
|
||||
|
||||
$status=-1; $url='';
|
||||
if ($resArray["L_STATUS".$i]=='Completed') $status=0;
|
||||
if (! empty($objects['order']))
|
||||
{
|
||||
$status=1;
|
||||
$url=$objects['order']->getNomUrl(0,'',0,1);
|
||||
}
|
||||
if (! empty($objects['invoice']))
|
||||
{
|
||||
$status=2;
|
||||
$url=$objects['invoice']->getNomUrl(0,'',0,1);
|
||||
}
|
||||
$status=0; $url='';
|
||||
if ($resArray["L_STATUS".$i]=='Completed') $status=1;
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td><div id="'.$transactionID.'" class="paypal_link" style="font-weight:bold;cursor:pointer;">'.$transactionID.'</div></td>';
|
||||
@ -324,6 +322,20 @@ else
|
||||
print '<td align="right">'.$feeamount.' '.$currency.'</td>';
|
||||
print '<td align="right">'.$netamount.' '.$currency.'</td>';
|
||||
print '<td align="right">'.getLibStatut($status, 1, $url).'</td>';
|
||||
if ($conf->commande->enabled && $conf->global->PAYPAL_CREATE_ORDER_ENABLED)
|
||||
{
|
||||
print '<td align="center">';
|
||||
if (! empty($objects['order'])) print '<a href="'.$objects['order']->getNomUrl(0,'',0,1).'">'.$objects['order']->getLibStatut(3).'</a>';
|
||||
else print '-';
|
||||
print '</td>';
|
||||
}
|
||||
if ($conf->facture->enabled && $conf->global->PAYPAL_CREATE_INVOICE_ENABLED)
|
||||
{
|
||||
print '<td align="center">';
|
||||
if (! empty($objects['invoice'])) print '<a href="'.$objects['invoice']->getNomUrl(0,'',0,1).'">'.$objects['invoice']->getLibStatut(3).'</a>';
|
||||
else print '-';
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user