diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl
index cd13e6fcc1b..7235f2d4226 100644
--- a/build/makepack-dolibarr.pl
+++ b/build/makepack-dolibarr.pl
@@ -166,7 +166,7 @@ $atleastonerpm=0;
foreach my $target (keys %CHOOSEDTARGET) {
if ($target =~ /RPM/i)
{
- if ($atleastonerpm && ! $ENV{"DESTI"})
+ if ($atleastonerpm && ($DESTI eq "$SOURCE/build"))
{
print "Error: You asked creation of several rpms. Because all rpm have same name, you must defined an environment variable DESTI to tell packager where it can create subdirs for each generated package.\n";
exit;
diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php
index c636200bdf4..4a2ccf210f6 100644
--- a/htdocs/adherents/admin/adherent.php
+++ b/htdocs/adherents/admin/adherent.php
@@ -50,7 +50,7 @@ $action = GETPOST('action','alpha');
if ($action == 'update' || $action == 'add')
{
$constname=GETPOST('constname','alpha');
- $constvalue=(GETPOST('constvalue_'.$constname,'alpha') ? GETPOST('constvalue_'.$constname,'alpha') : GETPOST('constvalue','alpha'));
+ $constvalue=(GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue'));
if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE') && $constvalue == -1) $constvalue='';
if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
@@ -60,7 +60,7 @@ if ($action == 'update' || $action == 'add')
}
$consttype=GETPOST('consttype','alpha');
- $constnote=GETPOST('constnote','alpha');
+ $constnote=GETPOST('constnote');
$res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
if (! $res > 0) $error++;
@@ -78,7 +78,7 @@ if ($action == 'update' || $action == 'add')
// Action activation d'un sous module du module adherent
if ($action == 'set')
{
- $result=dolibarr_set_const($db, GETPOST('name','alpha'),GETPOST('value','alpha'),'',0,'',$conf->entity);
+ $result=dolibarr_set_const($db, GETPOST('name','alpha'),GETPOST('value'),'',0,'',$conf->entity);
if ($result < 0)
{
print $db->error();
@@ -271,4 +271,4 @@ dol_fiche_end();
llxFooter();
$db->close();
-?>
\ No newline at end of file
+?>
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 709d7690c74..de6a320e2b9 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -185,12 +185,12 @@ class Adherent extends CommonObject
function makeSubstitution($text)
{
global $langs;
-
+
$birthday = dol_print_date($this->naiss,'day');
-
+
$msgishtml = 0;
if (dol_textishtml($text,1)) $msgishtml = 1;
-
+
$infos='';
if ($this->civilite_id) $infos.= $langs->transnoentities("UserTitle").": ".$this->getCivilityLabel(1)."\n";
$infos.= $langs->transnoentities("id").": ".$this->id."\n";
@@ -207,7 +207,7 @@ class Adherent extends CommonObject
$infos.= $langs->transnoentities("Birthday").": ".$birthday."\n";
$infos.= $langs->transnoentities("Photo").": ".$this->photo."\n";
$infos.= $langs->transnoentities("Public").": ".yn($this->public);
-
+
// Substitutions
$substitutionarray=array(
'%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT,
@@ -227,9 +227,9 @@ class Adherent extends CommonObject
'%LOGIN%'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login,
'%PASSWORD%'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass
);
-
+
complete_substitutions_array($substitutionarray, $langs);
-
+
return make_substitutions($text,$substitutionarray);
}
@@ -696,6 +696,10 @@ class Adherent extends CommonObject
$resql=$this->db->query($sql);
if ($resql)
{
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_member WHERE fk_member = ".$rowid;
+ dol_syslog(get_class($this)."::delete sql=".$sql);
+ $resql=$this->db->query($sql);
+
$sql = "DELETE FROM ".MAIN_DB_PREFIX."cotisation WHERE fk_adherent = ".$rowid;
dol_syslog(get_class($this)."::delete sql=".$sql);
$resql=$this->db->query($sql);
diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php
index cd15b82eb42..3b3f1305484 100644
--- a/htdocs/adherents/fiche.php
+++ b/htdocs/adherents/fiche.php
@@ -819,8 +819,8 @@ if ($action == 'edit')
$res=$object->fetch($rowid);
if ($res < 0) { dol_print_error($db,$object->error); exit; }
- //$res=$object->fetch_optionals($object->id,$extralabels);
- //if ($res < 0) { dol_print_error($db); exit; }
+ $res=$object->fetch_optionals($object->id,$extralabels);
+ if ($res < 0) { dol_print_error($db); exit; }
$adht = new AdherentType($db);
$adht->fetch($object->typeid);
@@ -1052,7 +1052,6 @@ if ($rowid && $action != 'edit')
/* */
/* ************************************************************************** */
- //$object = new Adherent($db);
$res=$object->fetch($rowid);
if ($res < 0) { dol_print_error($db,$object->error); exit; }
$res=$object->fetch_optionals($object->id,$extralabels);
@@ -1506,7 +1505,7 @@ if ($rowid && $action != 'edit')
}
// Action SPIP
- if ($conf->global->ADHERENT_USE_SPIP)
+ if ($conf->mailmanspip->enabled && $conf->global->ADHERENT_USE_SPIP)
{
$isinspip=$object->is_in_spip();
if ($isinspip == 1)
diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php
index d0708c96db5..240f8e5c349 100644
--- a/htdocs/comm/mailing/fiche.php
+++ b/htdocs/comm/mailing/fiche.php
@@ -681,14 +681,12 @@ else
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("ValidMailing"),$langs->trans("ConfirmValidMailing"),"confirm_valid",'','',1);
if ($ret == 'html') print '
';
}
-
// Confirm reset
else if ($action == 'reset')
{
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("ResetMailing"),$langs->trans("ConfirmResetMailing",$object->ref),"confirm_reset",'','',2);
if ($ret == 'html') print '
';
}
-
// Confirm delete
else if ($action == 'delete')
{
@@ -696,7 +694,8 @@ else
if ($ret == 'html') print '
';
}
- else if ($action != 'edit')
+
+ if ($action != 'edit')
{
/*
* Mailing en mode visu
@@ -747,12 +746,12 @@ else
// From
print '
| '.$langs->trans("Ref").' | '.$object->id.' | |||||||
| '.$langs->trans("MailTitle").' | '.$object->titre.' | |||||||
| '.$langs->trans("MailFrom").' | '.dol_print_email($object->email_from,0,0,0,0,1).' | |||||||
| '.$langs->trans("MailErrorsTo").' | '.dol_print_email($object->email_errorsto,0,0,0,0,1).' | '; $nbemail = $obj->nbemail; - if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) + if ($obj->statut != 3 && !empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) { $text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); print $form->textwithpicto($nbemail,$text,1,'warning'); @@ -192,7 +192,7 @@ else dol_print_error($db); } -$db->close(); - llxFooter(); + +$db->close(); ?> diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 70726cde310..46b27ec6a99 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -1254,14 +1254,13 @@ else print ''; print ''; - print " | ||||||
| ';
// multiprix
if($conf->global->PRODUIT_MULTIPRICES)
$form->select_produits('','idprod',1,$conf->product->limit_size,$object->thirdparty->price_level);
else
$form->select_produits('','idprod',1,$conf->product->limit_size);
- if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print ' '; print ''; print ' | ';
@@ -1270,7 +1269,7 @@ else
print ''; print ' | |||||||
| '; print $langs->trans("DateStartPlanned").' '; $form->select_date('',"date_start",$usehm,$usehm,1,"addline"); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2269febfcc5..2e28e13803e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2254,7 +2254,10 @@ class Form if ($inputarray.length>0) { $.each($inputarray, function() { var inputname = this; - var inputvalue = $("#" + this).val(); + var more = \'\'; + if ($("#" + this).attr("type") == \'checkbox\') { more = \':checked\'; } + var inputvalue = $("#" + this + more).val(); + if (typeof inputvalue == \'undefined\') { inputvalue=\'\'; } options += \'&\' + inputname + \'=\' + inputvalue; }); //alert(options); diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 272a4b2ffa2..50d8dd7e123 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -481,7 +481,6 @@ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $not //print "sql".$value."-".pg_escape_string($value)."-".$sql;exit; //print "xx".$db->escape($value); - //print $sql;exit; dol_syslog("admin.lib::dolibarr_set_const sql=".$sql, LOG_DEBUG); $resql=$db->query($sql); } @@ -1036,7 +1035,7 @@ function form_constantes($tableau) print ''; print ''; print ''; - print ''; + print ''; print $langs->trans("Desc".$const) != ("Desc".$const) ? $langs->trans("Desc".$const) : ($obj->note?$obj->note:$const); @@ -1104,7 +1103,7 @@ function form_constantes($tableau) } else { - print ''; + print ''; print ' | '; print ''; } @@ -1190,4 +1189,4 @@ function delDocumentModel($name, $type) } } -?> \ No newline at end of file +?> diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c76924f5822..a745e8e10a3 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2682,9 +2682,8 @@ function get_localtax($tva, $local, $societe_acheteuse="") { global $db, $conf, $mysoc; - // TODO Can we uncomment this ? - //if ($local == 1 && empty($conf->global->FACTURE_LOCAL_TAX1_OPTION)) return; - //if ($local == 2 && empty($conf->global->FACTURE_LOCAL_TAX2_OPTION)) return; + if ($local == 1 && ! $mysoc->localtax1_assuj) return 0; + if ($local == 2 && ! $mysoc->localtax2_assuj) return 0; $code_pays=$mysoc->pays_code; @@ -2716,12 +2715,13 @@ function get_localtax($tva, $local, $societe_acheteuse="") * Return vat rate of a product in a particular selling country or default country * vat if product is unknown * - * @param int $idprod Id of product or 0 if not a predefined product - * @param string $countrycode Country code (FR, US, IT, ...) - * @return int <0 if KO, Vat rate if OK + * @param int $idprod Id of product or 0 if not a predefined product + * @param Societe $thirdparty_seller Thirdparty with a ->country_code defined (FR, US, IT, ...) + * @param int $idprodfournprice Id product_fournisseur_price (for supplier order/invoice) + * @return int <0 if KO, Vat rate if OK * TODO May be this should be better as a method of product class */ -function get_product_vat_for_country($idprod, $countrycode) +function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice=0) { global $db,$mysoc; @@ -2734,9 +2734,17 @@ function get_product_vat_for_country($idprod, $countrycode) $product=new Product($db); $result=$product->fetch($idprod); - if ($mysoc->pays_code == $countrycode) // If selling country is ours + if ($mysoc->pays_code == $thirdparty_seller->country_code) // If selling country is ours { - $ret=$product->tva_tx; // Default vat of product we defined + if ($idprodfournprice > 0) // We want vat for product for a supplier order or invoice + { + $product->get_buyprice($idprodfournprice,0,0,0); + $ret=$product->vatrate_supplier; + } + else + { + $ret=$product->tva_tx; // Default vat of product we defined + } $found=1; } else @@ -2752,7 +2760,7 @@ function get_product_vat_for_country($idprod, $countrycode) // If vat of product for the country not found or not defined, we return higher vat of country. $sql.="SELECT taux as vat_rate"; $sql.=" FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; - $sql.=" WHERE t.active=1 AND t.fk_pays = p.rowid AND p.code='".$countrycode."'"; + $sql.=" WHERE t.active=1 AND t.fk_pays = p.rowid AND p.code='".$thirdparty_seller->country_code."'"; $sql.=" ORDER BY t.taux DESC, t.recuperableonly ASC"; $sql.=$db->plimit(1); @@ -2806,16 +2814,17 @@ function get_product_localtax_for_country($idprod, $local, $countrycode) * @param Societe $societe_vendeuse Objet societe vendeuse * @param Societe $societe_acheteuse Objet societe acheteuse * @param int $idprod Id product + * @param int $idprodfournprice Id product_fournisseur_price (for supplier order/invoice) * @return float Taux de tva a appliquer, -1 si ne peut etre determine */ -function get_default_tva($societe_vendeuse, $societe_acheteuse, $idprod=0) +function get_default_tva($societe_vendeuse, $societe_acheteuse, $idprod=0, $idprodfournprice=0) { global $conf; if (!is_object($societe_vendeuse)) return -1; if (!is_object($societe_acheteuse)) return -1; - dol_syslog("get_default_tva: seller use vat=".$societe_vendeuse->tva_assuj.", seller country=".$societe_vendeuse->pays_code.", seller in cee=".$societe_vendeuse->isInEEC().", buyer country=".$societe_acheteuse->pays_code.", buyer in cee=".$societe_acheteuse->isInEEC().", idprod=".$idprod.", SERVICE_ARE_ECOMMERCE_200238EC=".$conf->global->SERVICES_ARE_ECOMMERCE_200238EC); + dol_syslog("get_default_tva: seller use vat=".$societe_vendeuse->tva_assuj.", seller country=".$societe_vendeuse->pays_code.", seller in cee=".$societe_vendeuse->isInEEC().", buyer country=".$societe_acheteuse->pays_code.", buyer in cee=".$societe_acheteuse->isInEEC().", idprod=".$idprod.", idprodfournprice=".$idprodfournprice.", SERVICE_ARE_ECOMMERCE_200238EC=".$conf->global->SERVICES_ARE_ECOMMERCE_200238EC); // Si vendeur non assujeti a TVA (tva_assuj vaut 0/1 ou franchise/reel) if (is_numeric($societe_vendeuse->tva_assuj) && ! $societe_vendeuse->tva_assuj) @@ -2836,7 +2845,7 @@ function get_default_tva($societe_vendeuse, $societe_acheteuse, $idprod=0) if ($societe_vendeuse->country_code == $societe_acheteuse->country_code) // Warning ->country_code not always defined { //print 'VATRULE 3'; - return get_product_vat_for_country($idprod,$societe_vendeuse->country_code); + return get_product_vat_for_country($idprod,$societe_vendeuse,$idprodfournprice); } // Si (vendeur et acheteur dans Communaute europeenne) et (bien vendu = moyen de transports neuf comme auto, bateau, avion) alors TVA par defaut=0 (La TVA doit etre paye par l'acheteur au centre d'impots de son pays et non au vendeur). Fin de regle. @@ -2855,7 +2864,7 @@ function get_default_tva($societe_vendeuse, $societe_acheteuse, $idprod=0) else { //print 'VATRULE 5'; - return get_product_vat_for_country($idprod,$societe_vendeuse->country_code); + return get_product_vat_for_country($idprod,$societe_vendeuse,$idprodfournprice); } } @@ -2867,7 +2876,7 @@ function get_default_tva($societe_vendeuse, $societe_acheteuse, $idprod=0) if (! $societe_vendeuse->isInEEC() && $societe_acheteuse->isInEEC() && ! $societe_acheteuse->isACompany()) { //print 'VATRULE 6'; - return get_product_vat_for_country($idprod,$societe_acheteuse->country_code); + return get_product_vat_for_country($idprod,$societe_acheteuse,$idprodfournprice); } } diff --git a/htdocs/core/tpl/freeproductline_create.tpl.php b/htdocs/core/tpl/freeproductline_create.tpl.php index bf4dc001e00..18f76aa105d 100644 --- a/htdocs/core/tpl/freeproductline_create.tpl.php +++ b/htdocs/core/tpl/freeproductline_create.tpl.php @@ -75,7 +75,7 @@ service->enabled && $dateSelector) { ?> | |||||||
| global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="10"' : ' colspan="9s"'); ?>> + | global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="10"' : ' colspan="9"'); ?>>
trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
echo $form->select_date('','date_start',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addproduct");
diff --git a/htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php b/htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php
index aacd600f478..dc577289df6 100755
--- a/htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php
+++ b/htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2011-2012 Regis Houssin '.$paiementfourn->error.' ';
}
}
@@ -412,7 +413,7 @@ elseif ($action == 'update_line')
$pu=$_POST['puttc'];
$price_base_type='TTC';
}
-
+
if ($_POST['idprod'])
{
$prod = new Product($db);
@@ -421,21 +422,17 @@ elseif ($action == 'update_line')
if (trim($_POST['desc']) != trim($label)) $label=$_POST['desc'];
$type = $prod->type;
- $localtax1tx = $prod->localtax1_tx;
- $localtax2tx = $prod->localtax2_tx;
}
else
{
- if ($object->socid)
- {
- $societe=new Societe($db);
- $societe->fetch($object->socid);
- }
+
$label = $_POST['desc'];
$type = $_POST["type"]?$_POST["type"]:0;
- $localtax1tx= get_localtax($_POST['tauxtva'], 1, $mysoc);
- $localtax2tx= get_localtax($_POST['tauxtva'], 2, $mysoc);
+
}
+
+ $localtax1tx= get_localtax($_POST['tauxtva'], 1, $object->thirdparty);
+ $localtax2tx= get_localtax($_POST['tauxtva'], 2, $object->thirdparty);
$result=$object->updateline($_GET['lineid'], $label, $pu, $_POST['tauxtva'], $localtax1tx, $localtax2tx, $_POST['qty'], $_POST['idprod'], $price_base_type, 0, $type);
if ($result >= 0)
@@ -458,7 +455,7 @@ elseif ($action == 'addline')
if ($_POST['idprodfournprice']) // > 0 or -1
{
$product=new Product($db);
- $idprod=$product->get_buyprice($_POST['idprodfournprice'], $_POST['qty']);
+ $idprod=$product->get_buyprice($_POST['idprodfournprice'], $_POST['qty']); // Just to see if a price exists for the quantity. Not used to found vat
if ($idprod > 0)
{
@@ -468,10 +465,10 @@ elseif ($action == 'addline')
// $label = '['.$product->ref.'] - '. $product->libelle;
$label = $product->description;
- $tvatx=get_default_tva($object->thirdparty,$mysoc,$product->id);
+ $tvatx=get_default_tva($object->thirdparty, $mysoc, $product->id, $_POST['idprodfournprice']);
- $localtax1tx= get_localtax($tvatx, 1, $mysoc);
- $localtax2tx= get_localtax($tvatx, 2, $mysoc);
+ $localtax1tx= get_localtax($tvatx, 1, $object->thirdparty);
+ $localtax2tx= get_localtax($tvatx, 2, $object->thirdparty);
$type = $product->type;
@@ -488,8 +485,8 @@ elseif ($action == 'addline')
else
{
$tauxtva = price2num($_POST['tauxtva']);
- $localtax1tx= get_localtax($tauxtva, 1, $mysoc);
- $localtax2tx= get_localtax($tauxtva, 2, $mysoc);
+ $localtax1tx= get_localtax($tauxtva, 1, $object->thirdparty);
+ $localtax2tx= get_localtax($tauxtva, 2, $object->thirdparty);
if (! $_POST['dp_desc'])
{
diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql
index 012f01bb2dd..d4ed30f7ce9 100644
--- a/htdocs/install/mysql/migration/repair.sql
+++ b/htdocs/install/mysql/migration/repair.sql
@@ -36,9 +36,15 @@ update llx_projet_task set fk_projet = null where fk_projet not in (select rowid
update llx_commande set fk_user_author = null where fk_user_author not in (select rowid from llx_user);
+delete from llx_societe_extrafields where fk_object not in (select rowid from llx_societe);
+delete from llx_adherent_extrafields where fk_object not in (select rowid from llx_adherent);
+delete from llx_product_extrafields where fk_object not in (select rowid from llx_product);
+--delete from llx_societe_commerciaux where fk_soc not in (select rowid from llx_societe);
+
DELETE FROM llx_boxes where box_id NOT IN (SELECT rowid FROM llx_boxes_def);
-- VMYSQL4.1 DELETE T1 FROM llx_boxes_def as T1, llx_boxes_def as T2 where T1.entity = T2.entity AND T1.file = T2.file AND T1.note = T2.note and T1.rowid > T2.rowid
-- VPGSQL8.2 DELETE FROM llx_boxes_def as T1 WHERE rowid NOT IN (SELECT min(rowid) FROM llx_boxes_def GROUP BY file, entity, note)
+
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 8380d390a96..1153e2674fe 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -807,12 +807,12 @@ class Product extends CommonObject
{
$result = 0;
$sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity,";
- $sql.= " pfp.fk_product, pfp.ref_fourn, pfp.fk_soc";
+ $sql.= " pfp.fk_product, pfp.ref_fourn, pfp.fk_soc, pfp.tva_tx";
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql.= " WHERE pfp.rowid = ".$prodfournprice;
- $sql.= " AND pfp.quantity <= ".$qty;
+ if ($qty) $sql.= " AND pfp.quantity <= ".$qty;
- dol_syslog(get_class($this)."get_buyprice sql=".$sql);
+ dol_syslog(get_class($this)."::get_buyprice sql=".$sql);
$resql = $this->db->query($sql);
if ($resql)
{
@@ -821,15 +821,16 @@ class Product extends CommonObject
{
$this->buyprice = $obj->price; // \deprecated
$this->fourn_pu = $obj->price / $obj->quantity; // Prix unitaire du produit pour le fournisseur $fourn_id
- $this->ref_fourn = $obj->ref_fourn;
+ $this->ref_fourn = $obj->ref_fourn; // Ref supplier
+ $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier
$result=$obj->fk_product;
return $result;
}
else
{
// On refait le meme select sur la ref et l'id du produit
- $sql = "SELECT pfp.price as price, pfp.quantity as quantity, pfp.fk_soc,";
- $sql.= " pfp.fk_product, pfp.ref_fourn";
+ $sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.fk_soc,";
+ $sql.= " pfp.fk_product, pfp.ref_fourn, pfp.tva_tx";
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql.= " WHERE pfp.ref_fourn = '".$fourn_ref."'";
$sql.= " AND pfp.fk_product = ".$product_id;
@@ -837,7 +838,7 @@ class Product extends CommonObject
$sql.= " ORDER BY pfp.quantity DESC";
$sql.= " LIMIT 1";
- dol_syslog(get_class($this)."get_buyprice sql=".$sql);
+ dol_syslog(get_class($this)."::get_buyprice sql=".$sql);
$resql = $this->db->query($sql);
if ($resql)
{
@@ -846,7 +847,8 @@ class Product extends CommonObject
{
$this->buyprice = $obj->price; // \deprecated
$this->fourn_pu = $obj->price / $obj->quantity; // Prix unitaire du produit pour le fournisseur $fourn_id
- $this->ref_fourn = $obj->ref_fourn;
+ $this->ref_fourn = $obj->ref_fourn; // Ref supplier
+ $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier
$result=$obj->fk_product;
return $result;
}
@@ -858,7 +860,7 @@ class Product extends CommonObject
else
{
$this->error=$this->db->error();
- dol_syslog("Product:get_buyprice ".$this->error, LOG_ERR);
+ dol_syslog(get_class($this)."::get_buyprice ".$this->error, LOG_ERR);
return -3;
}
}
@@ -866,7 +868,7 @@ class Product extends CommonObject
else
{
$this->error=$this->db->error();
- dol_syslog("Product:get_buyprice ".$this->error, LOG_ERR);
+ dol_syslog(get_class($this)."::get_buyprice ".$this->error, LOG_ERR);
return -2;
}
}
@@ -1790,6 +1792,7 @@ class Product extends CommonObject
$sql.= ", ref_fourn";
$sql.= ", quantity";
$sql.= ", fk_user";
+ $sql.= ", tva_tx";
$sql.= ") VALUES (";
$sql.= "'".$this->db->idate($now)."'";
$sql.= ", ".$conf->entity;
@@ -1798,6 +1801,7 @@ class Product extends CommonObject
$sql.= ", '".$ref_fourn."'";
$sql.= ", ".$quantity;
$sql.= ", ".$user->id;
+ $sql.= ", 0";
$sql.= ")";
dol_syslog(get_class($this)."add_fournisseur sql=".$sql);
diff --git a/htdocs/projet/ganttchart.php b/htdocs/projet/ganttchart.php
index 258ba415ebc..dff07828e36 100644
--- a/htdocs/projet/ganttchart.php
+++ b/htdocs/projet/ganttchart.php
@@ -167,7 +167,7 @@ function constructGanttLine($tarr,$task,$project_dependencies,$level=0,$project_
// Add line to gantt
$s = "// Add taks id=".$task["task_id"]." level = ".$level."\n";
//$s.= "g.AddElementItem(new JSGantt.ElementItem('task',".$task['task_id'].",'".$name."','".$start_date."', '".$end_date."', '".$task['task_color']."', '', ".$task['task_milestone'].", '".$resources."', ".$percent.", ".($task["task_is_group"]>0?1:0).", ".$parent.", 1".($depend?", ".$depend:"")."));";
- $s = "g.AddTaskItem(new JSGantt.TaskItem(".$task['task_id'].",'".$name."','".$start_date."', '".$end_date."', '".$task['task_color']."', '".$link."', ".$task['task_milestone'].", '".$resources."', ".$percent.", ".($task["task_is_group"]>0?1:0).", '".$parent."', 1, '".($depend?$depend:"")."'));";
+ $s = "g.AddTaskItem(new JSGantt.TaskItem(".$task['task_id'].",'".dol_escape_js($name)."','".$start_date."', '".$end_date."', '".$task['task_color']."', '".$link."', ".$task['task_milestone'].", '".$resources."', ".$percent.", ".($task["task_is_group"]>0?1:0).", '".$parent."', 1, '".($depend?$depend:"")."'));";
echo $s."\n";
}
diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php
index 10daa2be3d4..02d2d678215 100644
--- a/htdocs/projet/ganttview.php
+++ b/htdocs/projet/ganttview.php
@@ -185,7 +185,7 @@ if (count($tasksarray)>0)
$tasks[$taskcursor]['task_milestone']=0;
$tasks[$taskcursor]['task_percent_complete']=$val->progress;
//$tasks[$taskcursor]['task_name']=$task->getNomUrl(1);
- $tasks[$taskcursor]['task_name']=dol_escape_js($val->label);
+ $tasks[$taskcursor]['task_name']=$val->label;
$tasks[$taskcursor]['task_start_date']=$val->date_start;
$tasks[$taskcursor]['task_end_date']=$val->date_end;
$tasks[$taskcursor]['task_color']='b4d1ea';
@@ -228,7 +228,8 @@ if (count($tasksarray)>0)
if (! empty($conf->use_javascript_ajax))
{
- print ''."\n";
+ //var_dump($_SESSION);
+ print ' '."\n";
include_once(DOL_DOCUMENT_ROOT.'/projet/ganttchart.php');
print ' '."\n";
}
diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php
index b63a99d19a8..9a82627c3bb 100644
--- a/htdocs/public/members/new.php
+++ b/htdocs/public/members/new.php
@@ -274,12 +274,18 @@ if ($action == 'add')
$urlback=DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?from=membernewform&source=membersubscription&ref='.$adh->ref;
if (price2num(GETPOST('amount'))) $urlback.='&amount='.price2num(GETPOST('amount'));
if (GETPOST('email')) $urlback.='&email='.urlencode(GETPOST('email'));
+ if (! empty($entity)) $urlback.='&entity='.$entity;
}
else if ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paypal')
{
$urlback=DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?from=membernewform&source=membersubscription&ref='.$adh->ref;
if (price2num(GETPOST('amount'))) $urlback.='&amount='.price2num(GETPOST('amount'));
if (GETPOST('email')) $urlback.='&email='.urlencode(GETPOST('email'));
+ if (! empty($conf->global->PAYPAL_SECURITY_TOKEN) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE))
+ {
+ $urlback.='&securekey='.dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'membersubscription' . $adh->ref, 2);
+ }
+ if (! empty($entity)) $urlback.='&entity='.$entity;
}
else
{
@@ -368,7 +374,7 @@ jQuery(document).ready(function () {
// Print form
print ' | |||||||