diff --git a/htdocs/admin/paybox.php b/htdocs/admin/paybox.php index 3db56888134..814d70b30ed 100644 --- a/htdocs/admin/paybox.php +++ b/htdocs/admin/paybox.php @@ -26,6 +26,8 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); +$service='PayBox'; + $langs->load("admin"); $langs->load("paybox"); @@ -132,9 +134,14 @@ $regex=DOL_URL_ROOT.'$'; $firstpart=eregi_replace($regex,'',$firstpart); //print $firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=order&ref=orderref&tag=ATAGOFYOURCHOICE'."
\n"; //print $firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=invoice&ref=invoiceref&tag=ATAGOFYOURCHOICE'."
\n"; -print $firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=contractline&ref=contractlineref&tag=ATAGOFYOURCHOICE'."
\n"; -print $firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=9.99&tag=ATAGOFYOURCHOICE'."
\n"; - +print '
'; +print $langs->trans("ToOfferALinkForOnlinePaymentOnContractLine",$service).':
'; +print $firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=contractline&ref=contractlineref'."
\n"; +print '
'; +print $langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount",$service).':
'; +print $firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=9.99&tag=yourfreetag'."
\n"; +print '
'; +print $langs->trans("YouCanAddTagOnUrl"); $db->close(); diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 6566f2a1561..ca4be05aeb8 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -863,7 +863,7 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') && $tva_tx = get_default_tva($mysoc,$fac->client,$prod->tva_tx); $tva_npr = get_default_npr($mysoc,$fac->client,$prod->tva_tx); - // On defini prix unitaire + // We define price for product if ($conf->global->PRODUIT_MULTIPRICES) { $pu_ht = $prod->multiprices[$fac->client->price_level]; @@ -2987,7 +2987,7 @@ else } } } - + // Emettre paiement if ($fac->type != 2 && $fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement) { diff --git a/htdocs/contrat/contrat.class.php b/htdocs/contrat/contrat.class.php index 22c1cacbce1..acf526969c6 100644 --- a/htdocs/contrat/contrat.class.php +++ b/htdocs/contrat/contrat.class.php @@ -245,11 +245,11 @@ class Contrat extends CommonObject /** - * \brief Chargement depuis la base des donnees du contrat - * \param id Id du contrat a charger - * \return int <0 si ko, id du contrat charge si ok + * \brief Load a contract from database + * \param id Id of contract to load + * \return int <0 if KO, id of contract if OK */ - function fetch($id) + function fetch($id,$ref='') { $sql = "SELECT rowid, statut, ref, fk_soc, mise_en_service as datemise,"; $sql.= " fk_user_mise_en_service, date_contrat as datecontrat,"; @@ -257,9 +257,11 @@ class Contrat extends CommonObject $sql.= " fk_projet,"; $sql.= " fk_commercial_signature, fk_commercial_suivi,"; $sql.= " note, note_public"; - $sql.= " FROM ".MAIN_DB_PREFIX."contrat WHERE rowid = ".$id; + $sql.= " FROM ".MAIN_DB_PREFIX."contrat"; + if ($ref) $sql.= " WHERE ref='".$ref."'"; + else $sql.= " WHERE rowid=".$id; - dolibarr_syslog("Contrat::fetch sql=".$sql); + dol_syslog("Contrat::fetch sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql) ; if ($resql) { @@ -289,8 +291,9 @@ class Contrat extends CommonObject $this->fk_projet = $result["fk_projet"]; - $this->socid = $result["fk_soc"]; - $this->societe->fetch($result["fk_soc"]); // TODO A virer car la societe doit etre charg� par appel de fetch_client() + $this->socid = $result["fk_soc"]; + $this->fk_soc = $result["fk_soc"]; + $this->societe->fetch($result["fk_soc"]); // TODO A virer car la societe doit etre charge par appel de fetch_client() $this->db->free($resql); @@ -298,14 +301,14 @@ class Contrat extends CommonObject } else { - dolibarr_syslog("Contrat::Fetch Erreur contrat non trouve"); + dol_syslog("Contrat::Fetch Erreur contrat non trouve"); $this->error="Contrat non trouve"; return -2; } } else { - dolibarr_syslog("Contrat::Fetch Erreur lecture contrat"); + dol_syslog("Contrat::Fetch Erreur lecture contrat"); $this->error=$this->db->error(); return -1; } @@ -340,7 +343,7 @@ class Contrat extends CommonObject $sql.= " WHERE d.fk_contrat = ".$this->id ." AND d.fk_product = p.rowid"; $sql.= " ORDER by d.rowid ASC"; - dolibarr_syslog("Contrat::fetch_lignes sql=".$sql); + dol_syslog("Contrat::fetch_lignes sql=".$sql); $result = $this->db->query($sql); if ($result) { @@ -390,8 +393,8 @@ class Contrat extends CommonObject $ligne->date_fin_prevue = $this->db->jdate($objp->date_fin_validite); $ligne->date_fin_reel = $this->db->jdate($objp->date_cloture); $this->lignes[] = $ligne; - //dolibarr_syslog("1 ".$ligne->desc); - //dolibarr_syslog("2 ".$ligne->product_desc); + //dol_syslog("1 ".$ligne->desc); + //dol_syslog("2 ".$ligne->product_desc); if ($ligne->statut == 0) $this->nbofserviceswait++; if ($ligne->statut == 4 && (empty($ligne->date_fin_prevue) || $ligne->date_fin_prevue >= $now)) $this->nbofservicesopened++; @@ -404,7 +407,7 @@ class Contrat extends CommonObject } else { - dolibarr_syslog("Contrat::Fetch Erreur lecture des lignes de contrats liees aux produits"); + dol_syslog("Contrat::Fetch Erreur lecture des lignes de contrats liees aux produits"); return -3; } @@ -481,7 +484,7 @@ class Contrat extends CommonObject } else { - dolibarr_syslog("Contrat::Fetch Erreur lecture des lignes de contrat non li�es aux produits"); + dol_syslog("Contrat::Fetch Erreur lecture des lignes de contrat non li�es aux produits"); $this->error=$this->db->error(); return -2; } @@ -561,7 +564,7 @@ class Contrat extends CommonObject else { $this->error=$interface->error; - dolibarr_syslog("Contrat::create - 30 - ".$this->error); + dol_syslog("Contrat::create - 30 - ".$this->error); $this->db->rollback(); return -3; @@ -570,7 +573,7 @@ class Contrat extends CommonObject else { $this->error="Failed to add contact"; - dolibarr_syslog("Contrat::create - 20 - ".$this->error); + dol_syslog("Contrat::create - 20 - ".$this->error); $this->db->rollback(); return -2; @@ -579,7 +582,7 @@ class Contrat extends CommonObject else { $this->error=$langs->trans("UnknownError: ".$this->db->error()." - sql=".$sql); - dolibarr_syslog("Contrat::create - 10 - ".$this->error); + dol_syslog("Contrat::create - 10 - ".$this->error); $this->db->rollback(); return -1; @@ -617,7 +620,7 @@ class Contrat extends CommonObject $sql.= " AND tc.element='".$this->element."'"; $sql.= " AND ec.element_id=".$this->id; - dolibarr_syslog("Contrat::delete element_contact sql=".$sql,LOG_DEBUG); + dol_syslog("Contrat::delete element_contact sql=".$sql,LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -638,7 +641,7 @@ class Contrat extends CommonObject $sql= "DELETE FROM ".MAIN_DB_PREFIX."element_contact "; $sql.= " WHERE ".MAIN_DB_PREFIX."element_contact.rowid IN (".implode(",",$tab_resql).")"; - dolibarr_syslog("Contrat::delete element_contact sql=".$sql,LOG_DEBUG); + dol_syslog("Contrat::delete element_contact sql=".$sql,LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -660,7 +663,7 @@ class Contrat extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."contratdet_log as cdl, ".MAIN_DB_PREFIX."contratdet as cd"; $sql.= " WHERE cdl.fk_contratdet=cd.rowid AND cd.fk_contrat=".$this->id; - dolibarr_syslog("Contrat::delete contratdet_log sql=".$sql, LOG_DEBUG); + dol_syslog("Contrat::delete contratdet_log sql=".$sql, LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -681,7 +684,7 @@ class Contrat extends CommonObject $sql= "DELETE FROM ".MAIN_DB_PREFIX."contratdet_log "; $sql.= " WHERE ".MAIN_DB_PREFIX."contratdet_log.rowid IN (".implode(",",$tab_resql).")"; - dolibarr_syslog("Contrat::delete contratdet_log sql=".$sql, LOG_DEBUG); + dol_syslog("Contrat::delete contratdet_log sql=".$sql, LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -697,7 +700,7 @@ class Contrat extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."contratdet"; $sql.= " WHERE fk_contrat=".$this->id; - dolibarr_syslog("Contrat::delete contratdet sql=".$sql, LOG_DEBUG); + dol_syslog("Contrat::delete contratdet sql=".$sql, LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -712,7 +715,7 @@ class Contrat extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."contrat"; $sql.= " WHERE rowid=".$this->id; - dolibarr_syslog("Contrat::delete contrat sql=".$sql); + dol_syslog("Contrat::delete contrat sql=".$sql); $resql=$this->db->query($sql); if (! $resql) { @@ -736,7 +739,7 @@ class Contrat extends CommonObject else { $this->error=$this->db->error(); - dolibarr_syslog("Contrat::delete ERROR ".$this->error); + dol_syslog("Contrat::delete ERROR ".$this->error); $this->db->rollback(); return -1; } @@ -762,7 +765,7 @@ class Contrat extends CommonObject { global $langs, $conf; - dolibarr_syslog("Contrat::addline $desc, $pu_ht, $qty, $txtva, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type, $pu_ttc, $info_bits"); + dol_syslog("Contrat::addline $desc, $pu_ht, $qty, $txtva, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type, $pu_ttc, $info_bits"); if ($this->statut == 0 || ($this->statut == 1 && $conf->global->CONTRAT_EDITWHENVALIDATED)) { @@ -829,7 +832,7 @@ class Contrat extends CommonObject if ($date_end > 0) { $sql.= ",".$this->db->idate($date_end); } $sql.= ")"; - dolibarr_syslog("Contrat::addline sql=".$sql); + dol_syslog("Contrat::addline sql=".$sql); $resql=$this->db->query($sql); if ($resql) @@ -842,7 +845,7 @@ class Contrat extends CommonObject } else { - dolibarr_syslog("Error sql=$sql, error=".$this->error,LOG_ERR); + dol_syslog("Error sql=$sql, error=".$this->error,LOG_ERR); $this->db->rollback(); return -1; } @@ -851,13 +854,13 @@ class Contrat extends CommonObject { $this->db->rollback(); $this->error=$this->db->error()." sql=".$sql; - dolibarr_syslog("Contrat::addline ".$this->error,LOG_ERR); + dol_syslog("Contrat::addline ".$this->error,LOG_ERR); return -1; } } else { - dolibarr_syslog("Contrat::addline ErrorTryToAddLineOnValidatedContract", LOG_ERR); + dol_syslog("Contrat::addline ErrorTryToAddLineOnValidatedContract", LOG_ERR); return -2; } } @@ -898,7 +901,7 @@ class Contrat extends CommonObject $remise_percent=0; } - dolibarr_syslog("Contrat::UpdateLine $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $date_debut_reel, $date_fin_reel, $tvatx"); + dol_syslog("Contrat::UpdateLine $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $date_debut_reel, $date_fin_reel, $tvatx"); $this->db->begin(); @@ -920,7 +923,7 @@ class Contrat extends CommonObject else { $sql.=",date_cloture=null"; } $sql .= " WHERE rowid = ".$rowid; - dolibarr_syslog("Contrat::UpdateLine sql=".$sql); + dol_syslog("Contrat::UpdateLine sql=".$sql); $result = $this->db->query($sql); if ($result) { @@ -933,7 +936,7 @@ class Contrat extends CommonObject else { $this->db->rollback(); - dolibarr_syslog("Contrat::UpdateLigne Erreur -2"); + dol_syslog("Contrat::UpdateLigne Erreur -2"); return -2; } } @@ -941,7 +944,7 @@ class Contrat extends CommonObject { $this->db->rollback(); $this->error=$this->db->error(); - dolibarr_syslog("Contrat::UpdateLigne Erreur -1"); + dol_syslog("Contrat::UpdateLigne Erreur -1"); return -1; } } @@ -962,12 +965,12 @@ class Contrat extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."contratdet"; $sql.= " WHERE rowid=".$idline; - dolibarr_syslog("Contratdet::delete sql=".$sql); + dol_syslog("Contratdet::delete sql=".$sql); $resql = $this->db->query($sql); if (! $resql) { $this->error="Error ".$this->db->lasterror(); - dolibarr_syslog("Contratdet::delete ".$this->error, LOG_ERR); + dol_syslog("Contratdet::delete ".$this->error, LOG_ERR); return -1; } @@ -1160,7 +1163,7 @@ class Contrat extends CommonObject $sql.= " WHERE fk_contrat =".$this->id; if ($statut >= 0) $sql.= " AND statut = '$statut'"; - dolibarr_syslog("Contrat::array_detail() sql=".$sql,LOG_DEBUG); + dol_syslog("Contrat::array_detail() sql=".$sql,LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1195,7 +1198,7 @@ class Contrat extends CommonObject $sql.= " WHERE fk_soc =".$this->socid; if ($option == 'others') $sql.= " AND c.rowid != ".$this->id; - dolibarr_syslog("Contrat::getOtherContracts() sql=".$sql,LOG_DEBUG); + dol_syslog("Contrat::getOtherContracts() sql=".$sql,LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1486,7 +1489,7 @@ class ContratLigne function fetch($id, $ref='') { global $langs,$user; - + $sql = "SELECT"; $sql.= " t.rowid,"; @@ -1520,7 +1523,7 @@ class ContratLigne if ($id) $sql.= " WHERE t.rowid = ".$id; if ($ref) $sql.= " WHERE t.rowid = '".$ref."'"; - dolibarr_syslog("Contratdet::fetch sql=".$sql, LOG_DEBUG); + dol_syslog("Contratdet::fetch sql=".$sql, LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1530,7 +1533,7 @@ class ContratLigne $this->id = $obj->rowid; $this->ref = $obj->rowid; - + $this->tms = $obj->tms; $this->fk_contrat = $obj->fk_contrat; $this->fk_product = $obj->fk_product; @@ -1566,7 +1569,7 @@ class ContratLigne else { $this->error="Error ".$this->db->lasterror(); - dolibarr_syslog("ContratLigne::fetch ".$this->error, LOG_ERR); + dol_syslog("ContratLigne::fetch ".$this->error, LOG_ERR); return -1; } } @@ -1636,7 +1639,7 @@ class ContratLigne $sql.= " commentaire='".addslashes($this->commentaire)."'"; $sql.= " WHERE rowid=".$this->id; - dolibarr_syslog("ContratLigne::update sql=".$sql, LOG_DEBUG); + dol_syslog("ContratLigne::update sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1647,7 +1650,7 @@ class ContratLigne else { $this->error="Error ".$this->db->lasterror(); - dolibarr_syslog("ContratLigne::update ".$this->error, LOG_ERR); + dol_syslog("ContratLigne::update ".$this->error, LOG_ERR); return -1; } @@ -1681,7 +1684,7 @@ class ContratLigne $sql.= ",total_ttc=".price2num($this->total_ttc,'MT').""; $sql.= " WHERE rowid = ".$this->rowid; - dolibarr_syslog("ContratLigne::update_total sql=".$sql); + dol_syslog("ContratLigne::update_total sql=".$sql); $resql=$this->db->query($sql); if ($resql) @@ -1692,7 +1695,7 @@ class ContratLigne else { $this->error=$this->db->error(); - dolibarr_syslog("ContratLigne::update_total Error ".$this->error); + dol_syslog("ContratLigne::update_total Error ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 886f7b90366..775f83b9cd8 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -608,10 +608,11 @@ else $now=gmmktime(); $id = $_GET["id"]; - if ($id > 0) + $ref= $_GET['ref']; + if ($id > 0 || ! empty($ref)) { $contrat = new Contrat($db); - $result=$contrat->fetch($id); + $result=$contrat->fetch($_GET['id'],$_GET['ref']); if ($result > 0) $result=$contrat->fetch_lignes(); if ($result < 0) { @@ -683,7 +684,7 @@ else // Ref du contrat print ''.$langs->trans("Ref").''; - print $contrat->ref; + print $html->showrefnav($contrat,'ref','',1,'ref','ref',''); print ""; // Customer diff --git a/htdocs/langs/en_US/contracts.lang b/htdocs/langs/en_US/contracts.lang index 450c7b8eee5..69ba8e6ee9b 100644 --- a/htdocs/langs/en_US/contracts.lang +++ b/htdocs/langs/en_US/contracts.lang @@ -75,6 +75,7 @@ CloseAllContracts=Close all contracts MoveToAnotherContract=Move service into another contract. ConfirmMoveToAnotherContract=I choosed new target contract and confirm I want to move this service into this contract. ConfirmMoveToAnotherContractQuestion=Choose in which existing contract (of same third party), you want to move this service to ? +PaymentRenewContractId=Renew contract line (number %s) ##### Types de contacts ##### TypeContact_contrat_internal_SALESREPSIGN=Sales representative signing contract TypeContact_contrat_internal_SALESREPFOLL=Sales representative following-up contract diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index a69fc5ca033..b509588c6f3 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -190,9 +190,11 @@ DateRealShort=Date real. DateBuild=Report build date DurationYear=year DurationMonth=month +DurationWeek=week DurationDay=day DurationYears=years DurationMonths=months +DurationWeeks=weeks DurationDays=days Year=Year Month=Month diff --git a/htdocs/langs/en_US/paybox.lang b/htdocs/langs/en_US/paybox.lang index 367b3083a2c..fdbaf6e4bfa 100644 --- a/htdocs/langs/en_US/paybox.lang +++ b/htdocs/langs/en_US/paybox.lang @@ -13,4 +13,7 @@ PaymentCode=Payment code PayBoxDoPayment=Go on payment YouWillBeRedirectedOnPayBox=You will be redirected on secured Paybox page to input you credit card informations PleaseBePatient=Please, be patient -Continue=Next \ No newline at end of file +Continue=Next +ToOfferALinkForOnlinePaymentOnContractLine=URL to offer an %s online payment user interface for a contract line +ToOfferALinkForOnlinePaymentOnFreeAmount=URL to offer an %s online payment user interface for a free amount +YouCanAddTagOnUrl=You can also add url parameter &tag=value to any of those URL to add your own tag to the payment comment code. diff --git a/htdocs/langs/fr_FR/contracts.lang b/htdocs/langs/fr_FR/contracts.lang index 14b6279c530..456bdf5fa25 100644 --- a/htdocs/langs/fr_FR/contracts.lang +++ b/htdocs/langs/fr_FR/contracts.lang @@ -75,6 +75,7 @@ CloseAllContracts=Tout clôturer MoveToAnotherContract=Déplacer le service vers un autre contrat de ce tiers. ConfirmMoveToAnotherContract=J'ai choisi le contrat cible et confirme le déplacement du service dans ce contrat. ConfirmMoveToAnotherContractQuestion=Choisissez vers quel autre contrat de ce même tiers, vous voulez déplacer ce service ? +PaymentRenewContractId=Renouvellement service (numéro %s) ##### Types de contacts ##### TypeContact_contrat_internal_SALESREPSIGN=Commercial signataire du contrat TypeContact_contrat_internal_SALESREPFOLL=Commercial suivi du contrat diff --git a/htdocs/langs/fr_FR/paybox.lang b/htdocs/langs/fr_FR/paybox.lang index 77d37ac366a..7fd98e558f6 100644 --- a/htdocs/langs/fr_FR/paybox.lang +++ b/htdocs/langs/fr_FR/paybox.lang @@ -10,7 +10,11 @@ ToComplete=A compléter YourEMail=Email de confirmation du paiement Creditor=Bénéficiaire PaymentCode=Code de paiement -PayBoxDoPayment=Poursuivre le paiement +PayBoxDoPayment=Poursuivre le paiement par carte YouWillBeRedirectedOnPayBox=Vous serez redirigé vers la page sécurisée Paybox de saisie de votre carte bancaire PleaseBePatient=Merci de patientez quelques secondes -Continue=Continuer \ No newline at end of file +Continue=Continuer +ToOfferALinkForOnlinePaymentOnContractLine=URL offrant une interface de paiement en ligne %s sur la base du montant d'une ligne de contrat +ToOfferALinkForOnlinePaymentOnFreeAmount=URL offrant une interface de paiement en ligne %s pour un montant libre +YouCanAddTagOnUrl=Vous pouvez de plus ajouter le paramètre url &tag=value à n'importe quelle de ces URL pour voir votre propre tag au code commentaire de paiement. + \ No newline at end of file diff --git a/htdocs/paybox/paybox.lib.php b/htdocs/paybox/paybox.lib.php index 671fdfb3976..97a14afb69c 100644 --- a/htdocs/paybox/paybox.lib.php +++ b/htdocs/paybox/paybox.lib.php @@ -68,7 +68,7 @@ function llxFooterPayBox() * \brief Create a redirect form to paybox form * \return int 1 if OK, -1 if ERROR */ -function print_paybox_redirect($PRICE,$EMAIL,$urlok,$urlko,$DOLSTRING,$ID=0) +function print_paybox_redirect($PRICE,$EMAIL,$urlok,$urlko,$TAG,$ID=0) { global $conf, $langs, $db; @@ -112,24 +112,24 @@ function print_paybox_redirect($PRICE,$EMAIL,$urlok,$urlko,$DOLSTRING,$ID=0) dol_syslog("Paypal.lib::print_paybox_redirect PRICE: ".$PRICE, LOG_DEBUG); + $langsiso=new Translate('',$conf); + $langsiso=$langs; + $langsiso->charset_output='ISO-8859-1'; + // Definition des parametres vente produit pour paybox - $IBS_CMD=$DOLSTRING; + $IBS_CMD=$TAG; $IBS_TOTAL=$PRICE*100; # En centimes - $IBS_MODE=1; # Mode formulaire - $IBS_PORTEUR=$EMAIL; - $IBS_RETOUR="montant:M;ref:R;auto:A;trans:T"; # Format des param�tres du get de validation en reponse (url a definir sous paybox) - $IBS_TXT="
".$langs->trans("YouWillBeRedirectedOnPayBox")."
".$langs->trans("PleaseBePatient")."...
"; + $IBS_RETOUR="montant:M;ref:R;auto:A;trans:T"; # Format des parametres du get de validation en reponse (url a definir sous paybox) + $IBS_TXT="
".$langsiso->trans("YouWillBeRedirectedOnPayBox")."
".$langsiso->trans("PleaseBePatient")."...
"; $IBS_EFFECTUE=$urlok; $IBS_ANNULE=$urlko; $IBS_REFUSE=$urlko; - $IBS_BOUTPI=$langs->trans("Continue"); + $IBS_BOUTPI=$langsiso->trans("Continue"); $IBS_BKGD="#FFFFFF"; $IBS_WAIT="4000"; - - $IBS_LANG="ENG"; - if (eregi('^FR',$langs->defaultlang)) $IBS_LANG="FRA"; + $IBS_LANG="ENG"; if (eregi('^FR',$langs->defaultlang)) $IBS_LANG="FRA"; dol_syslog("Soumission Paybox", LOG_DEBUG); dol_syslog("IBS_MODE: $IBS_MODE", LOG_DEBUG); @@ -147,31 +147,43 @@ function print_paybox_redirect($PRICE,$EMAIL,$urlok,$urlko,$DOLSTRING,$ID=0) dol_syslog("IBS_WAIT: $IBS_WAIT", LOG_DEBUG); dol_syslog("IBS_LANG: $IBS_LANG", LOG_DEBUG); - print ''; + header("Content-type: text/html; charset=".$conf->character_set_client); + + print ''."\n"; + print ''."\n"; + print "\n"; + print ''."\n"; + print ''."\n"; print "\n"; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; + + // Formulaire pour module Paybox v1 (IBS_xxx) + print '
'."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print '
'."\n"; + + // Formulaire pour module Paybox v2 (PBX_xxx) + + print "\n"; - print ''; + print ''."\n"; print "\n"; - print ''; + print ''."\n"; print "\n"; return; diff --git a/htdocs/public/paybox/newpayment.php b/htdocs/public/paybox/newpayment.php index c3012fd1a8e..90ff67c0ce2 100644 --- a/htdocs/public/paybox/newpayment.php +++ b/htdocs/public/paybox/newpayment.php @@ -28,6 +28,7 @@ require("../../master.inc.php"); require_once(DOL_DOCUMENT_ROOT."/paybox/paybox.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/product.class.php"); $langcode=(empty($_GET["lang"])?'auto':$_GET["lang"]); $langs->setDefaultLang($langcode); @@ -136,49 +137,16 @@ print ''.$langs->trans("Thi $found=false; $var=false; -if (is_numeric($_REQUEST["amount"])) -{ - $found=true; - $tag=$_REQUEST["tag"]; - - // Creditor - $var=!$var; - print ''.$langs->trans("Creditor"); - print ''.$mysoc->nom.''."\n"; - // Amount - $var=!$var; - print ''.$langs->trans("Amount"); - if (empty($amount)) print ' ('.$langs->trans("ToComplete").')'; - print ''; - if (empty($amount) || ! is_numeric($amount)) print ''; - else { - print ''.price($amount).''; - print ''; - } - print ''."\n"; - // Currency - $var=!$var; - print ''.$langs->trans("Currency"); - print 'EUR'."\n"; - // Tag - $var=!$var; - print ''.$langs->trans("PaymentCode"); - print ''.$tag.''."\n"; - // EMail - $var=!$var; - print ''.$langs->trans("YourEMail"); - print ' ('.$langs->trans("ToComplete").')'; - print ''."\n"; -} if ($_REQUEST["amount"] == 'contractline') { $found=true; + $langs->load("contracts"); require_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php"); $contractline=new ContratLigne($db); - $result=$contractline->fetch('',$_GET["ref"]); + $result=$contractline->fetch('',$_REQUEST["ref"]); if ($result < 0) { $mesg=$contractline->error; @@ -189,7 +157,11 @@ if ($_REQUEST["amount"] == 'contractline') { $contract=new Contrat($db); $result=$contract->fetch($contractline->fk_contrat); - if ($result < 0) + if ($result > 0) + { + $result=$contract->fetch_client($contract->socid); + } + else { $mesg=$contract->error; } @@ -199,31 +171,100 @@ if ($_REQUEST["amount"] == 'contractline') $mesg='ErrorRecordNotFound'; } } + $amount=$contractline->total_ttc; + if ($contractline->fk_product) + { + $product=new Product($db); + $result=$product->fetch($contractline->fk_product); + + // We define price for product (TODO Put this in a method in product class) + if ($conf->global->PRODUIT_MULTIPRICES) + { + $pu_ht = $product->multiprices[$contract->client->price_level]; + $pu_ttc = $product->multiprices_ttc[$contract->client->price_level]; + $price_base_type = $product->multiprices_base_type[$contract->client->price_level]; + } + else + { + $pu_ht = $product->price; + $pu_ttc = $product->price_ttc; + $price_base_type = $product->price_base_type; + } + + $amount=$pu_ttc; + if (empty($amount)) + { + dolibarr_print_error('','ErrorNoPriceDefinedForThisProduct'); + exit; + } + } + $tag=''; - if (! empty($_REQUEST["tag"])) $tag=$_REQUEST["tag"].'-'; - $tag.='thirdparty='.$contract->socid.'-contractref='.$contract->ref.'-contractlineref='.$contractline->ref; + $tag='CLR='.$contractline->ref.'.CR='.$contract->ref.'.TPID='.$contract->client->id.'.TP='.strtr($contract->client->nom,"-"," "); + if (! empty($_REQUEST["tag"])) $tag.='.TAG='.$_REQUEST["tag"]; + $tag=dol_string_unaccent($tag); + $qty=1; if (isset($_REQUEST["qty"])) $qty=$_REQUEST["qty"]; - - // Object - $var=!$var; - $text=$langs->trans("PaymentRenewContractId",$contractline->ref,$contract->id); - if ($contractline->description) $text.='
'.dol_htmlentitiesbr($contractline->description); - print ''.$langs->trans("Designation"); - print ''.$text.''."\n"; - // Quantity - $var=!$var; - print ''.$langs->trans("Quantity"); - print ''; - print $qty; - print ''; - print ''."\n"; // Creditor $var=!$var; print ''.$langs->trans("Creditor"); print ''.$mysoc->nom.''."\n"; + + // Debitor + $var=!$var; + print ''.$langs->trans("ThirdParty"); + print ''.$contract->client->nom.''; + + // Object + $var=!$var; + $text=''.$langs->trans("PaymentRenewContractId",$contract->ref,$contractline->ref).''; + if ($contractline->fk_product) + { + $text.='
'.$product->ref.($product->libelle?' - '.$product->libelle:''); + } + if ($contractline->description) $text.='
'.dol_htmlentitiesbr($contractline->description); + //if ($contractline->date_fin_validite) { + // $text.='
'.$langs->trans("DateEndPlanned").': '; + // $text.=dolibarr_print_date($contractline->date_fin_validite); + //} + print ''.$langs->trans("Designation"); + print ''.$text; + print ''; + print ''."\n"; + + // Quantity + $var=!$var; + print ''.$langs->trans("Quantity"); + print ''.$qty.''; + if ($contractline->fk_product) + { + if ($product->duration_value > 0) + { + // TODO Put this in a global method + if ($product->duration_value > 1) + { + $dur=array("h"=>$langs->trans("Hours"),"d"=>$langs->trans("DurationDays"),"w"=>$langs->trans("DurationWeeks"),"m"=>$langs->trans("DurationMonths"),"y"=>$langs->trans("DurationYears")); + } + else + { + $dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("DurationDay"),"w"=>$langs->trans("DurationWeek"),"m"=>$langs->trans("DurationMonth"),"y"=>$langs->trans("DurationYear")); + } + $duration=' ('.$product->duration_value.' '.$dur[$product->duration_unit]; + print $duration; + if ($contractline->date_fin_validite) + { + $dateactend = dol_time_plus_duree ($contractline->date_fin_validite, $product->duration_value, $product->duration_unit); + print ', '.$langs->trans("DateEndPlanned").': '.dolibarr_print_date($contractline->date_fin_validite); + } + print ')'; + } + } + print ''; + print ''."\n"; + // Amount $var=!$var; print ''.$langs->trans("Amount"); @@ -235,14 +276,19 @@ if ($_REQUEST["amount"] == 'contractline') print ''; } print ''."\n"; + // Currency $var=!$var; print ''.$langs->trans("Currency"); print 'EUR'."\n"; + // Tag $var=!$var; print ''.$langs->trans("PaymentCode"); - print ''.$tag.''."\n"; + print ''.$tag.''; + print ''; + print ''."\n"; + // EMail $var=!$var; print ''.$langs->trans("YourEMail"); @@ -251,14 +297,57 @@ if ($_REQUEST["amount"] == 'contractline') } +if (is_numeric($_REQUEST["amount"])) +{ + $found=true; + $tag=$_REQUEST["tag"]; + + // Creditor + $var=!$var; + print ''.$langs->trans("Creditor"); + print ''.$mysoc->nom.''."\n"; + + // Amount + $var=!$var; + print ''.$langs->trans("Amount"); + if (empty($amount)) print ' ('.$langs->trans("ToComplete").')'; + print ''; + if (empty($amount) || ! is_numeric($amount)) print ''; + else { + print ''.price($amount).''; + print ''; + } + print ''."\n"; + + // Currency + $var=!$var; + print ''.$langs->trans("Currency"); + print 'EUR'."\n"; + + // Tag + $var=!$var; + print ''.$langs->trans("PaymentCode"); + print ''.$tag.''; + print ''; + print ''."\n"; + + // EMail + $var=!$var; + print ''.$langs->trans("YourEMail"); + print ' ('.$langs->trans("ToComplete").')'; + print ''."\n"; +} + if (! $found && ! $mesg) $mesg=$langs->trans("ErrorBadParameters"); if ($mesg) print '
'.$mesg.'
'; -print '
'; -print ''.$langs->trans("YouWillBeRedirectedOnPayBox").'...'; - +if ($found) +{ + print '
'; + //print ''.$langs->trans("YouWillBeRedirectedOnPayBox").'...'; +} print ''; print ''; diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index 2242b792a31..5e42a2c3a67 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -499,7 +499,7 @@ class Societe extends CommonObject } $sql = 'SELECT s.rowid, s.nom, s.address,'.$this->db->pdate('s.datec').' as dc, s.prefix_comm'; - if($conf->global->PRODUIT_MULTIPRICES) $sql .= ', s.price_level'; + $sql .= ', s.price_level'; $sql .= ','. $this->db->pdate('s.tms').' as date_update'; $sql .= ', s.tel, s.fax, s.email, s.url, s.cp, s.ville, s.note, s.client, s.fournisseur'; $sql .= ', s.siren, s.siret, s.ape, s.idprof4'; @@ -524,6 +524,7 @@ class Societe extends CommonObject $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as te ON s.fk_typent = te.id'; $sql .= ' WHERE s.rowid = '.$socid; + $resql=$this->db->query($sql); if ($resql) { @@ -770,7 +771,7 @@ class Societe extends CommonObject $this->error .= $this->db->lasterror(); dolibarr_syslog("Societe::Delete erreur -1 ".$this->error); } - + // Remove ban $sql = "DELETE from ".MAIN_DB_PREFIX."societe_rib"; $sql.= " WHERE fk_soc = " . $id; @@ -1954,7 +1955,7 @@ class Societe extends CommonObject print ''; } - + /** * \brief Cree en base un utilisateur depuis l'objet adherent * \param member Objet adherent source @@ -1978,8 +1979,8 @@ class Societe extends CommonObject $this->ville=$member->ville; $this->pays_code=$member->pays_code; $this->pays_id=$member->pays_id; - $this->tel=$member->phone; // Prof phone - + $this->tel=$member->phone; // Prof phone + $this->db->begin(); // Cree et positionne $this->id @@ -1989,7 +1990,7 @@ class Societe extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."adherent"; $sql.= " SET fk_soc=".$this->id; $sql.= " WHERE rowid=".$member->id; - + dolibarr_syslog("Societe::create_from_member sql=".$sql, LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -2015,7 +2016,7 @@ class Societe extends CommonObject return $result; } } - + } ?>