This commit is contained in:
Raphaël Doursenaud 2012-05-10 15:05:02 +02:00
commit decdc2a9a3
27 changed files with 206 additions and 133 deletions

View File

@ -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;

View File

@ -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();
?>
?>

View File

@ -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);

View File

@ -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)

View File

@ -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 '<br>';
}
// 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 '<br>';
}
// Confirm delete
else if ($action == 'delete')
{
@ -696,7 +694,8 @@ else
if ($ret == 'html') print '<br>';
}
else if ($action != 'edit')
if ($action != 'edit')
{
/*
* Mailing en mode visu
@ -747,12 +746,12 @@ else
// From
print '<tr><td>'.$form->editfieldkey("MailFrom",'email_from',$object->email_from,$object,$user->rights->mailing->creer && $object->statut < 3,'string').'</td><td colspan="3">';
print $form->editfieldval("MailFrom",'email_from',$object->email_from,$object,$user->rights->mailing->creer && $object->statut < 3,'string');
print $form->editfieldval("MailFrom",'email_from',$object->email_from,$object,$user->rights->mailing->creer && $object->statut < 3,'email');
print '</td></tr>';
// Errors to
print '<tr><td>'.$form->editfieldkey("MailErrorsTo",'email_errorsto',$object->email_errorsto,$object,$user->rights->mailing->creer && $object->statut < 3,'string').'</td><td colspan="3">';
print $form->editfieldval("MailErrorsTo",'email_errorsto',$object->email_errorsto,$object,$user->rights->mailing->creer && $object->statut < 3,'string');
print $form->editfieldval("MailErrorsTo",'email_errorsto',$object->email_errorsto,$object,$user->rights->mailing->creer && $object->statut < 3,'email');
print '</td></tr>';
// Status
@ -763,7 +762,7 @@ else
print $langs->trans("TotalNbOfDistinctRecipients");
print '</td><td colspan="3">';
$nbemail = ($object->nbemail?$object->nbemail:img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>');
if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && is_numeric($nbemail) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail)
if ($object->statut != 3 && !empty($conf->global->MAILING_LIMIT_SENDBYWEB) && is_numeric($nbemail) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail)
{
if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0)
{
@ -955,9 +954,13 @@ else
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">'.$object->id.'</td></tr>';
// Topic
print '<tr><td width="25%">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
// From
print '<tr><td width="25%">'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($object->email_from,0,0,0,0,1).'</td></tr>';
// To
print '<tr><td width="25%">'.$langs->trans("MailErrorsTo").'</td><td colspan="3">'.dol_print_email($object->email_errorsto,0,0,0,0,1).'</td></tr>';
// Status

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -155,7 +155,7 @@ if ($result)
{
print '<td align="center">';
$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();
?>

View File

@ -1254,14 +1254,13 @@ else
print '<input type="hidden" name="mode" value="predefined">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print "<tr $bc[$var]>";
print "<tr ".$bc[$var].">";
print '<td colspan="3">';
// 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 '<br>';
print '<textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea>';
print '</td>';
@ -1270,7 +1269,7 @@ else
print '<td align="center" colspan="2" rowspan="2"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
print '</tr>'."\n";
print "<tr $bc[$var]>";
print "<tr ".$bc[$var].">";
print '<td colspan="8">';
print $langs->trans("DateStartPlanned").' ';
$form->select_date('',"date_start",$usehm,$usehm,1,"addline");

View File

@ -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);

View File

@ -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 '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="rowid" value="'.$obj->rowid.'">';
print '<input type="hidden" name="constname" value="'.$const.'">';
print '<input type="hidden" name="constnote" value="'.nl2br($obj->note).'">';
print '<input type="hidden" name="constnote" value="'.nl2br(dol_escape_htmltag($obj->note)).'">';
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 '<input type="text" class="flat" size="48" name="constvalue" value="'.$obj->value.'">';
print '<input type="text" class="flat" size="48" name="constvalue" value="'.dol_escape_htmltag($obj->value).'">';
print '</td><td>';
print '<input type="hidden" name="consttype" value="chaine">';
}
@ -1190,4 +1189,4 @@ function delDocumentModel($name, $type)
}
}
?>
?>

View File

@ -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);
}
}

View File

@ -75,7 +75,7 @@
<?php if ($conf->service->enabled && $dateSelector) { ?>
<tr <?php echo $bcnd[$var]; ?>>
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="10"' : ' colspan="9s"'); ?>>
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="10"' : ' colspan="9"'); ?>>
<?php
echo $langs->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");

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr>
/* Copyright (C) 2011-2012 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -102,35 +102,48 @@ class InterfacePaypalWorkflow
if ($action == 'PAYPAL_PAYMENT_OK')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". source=".$object->source." ref=".$object->ref);
require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
$soc = new Societe($this->db);
// Parse element/subelement (ex: project_task)
$element = $path = $filename = $object->source;
if (preg_match('/^([^_]+)_([^_]+)/i',$object->source,$regs))
{
$element = $path = $regs[1];
$filename = $regs[2];
}
// For compatibility
if ($element == 'order') { $path = $filename = 'commande'; }
if ($element == 'invoice') { $path = 'compta/facture'; $filename = 'facture'; }
dol_include_once('/'.$path.'/class/'.$filename.'.class.php');
$classname = ucfirst($filename);
$obj = new $classname($this->db);
$ret = $obj->fetch('',$object->ref);
if ($ret < 0) return -1;
// Add payer id
$soc->setValueFrom('ref_int', $object->payerID, 'societe', $obj->socid);
// Add transaction id
$obj->setValueFrom('ref_int',$object->resArray["TRANSACTIONID"]);
if ($object->source == 'membersubscription')
{
//require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherents.class.php");
// TODO add subscription treatment
}
else
{
require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
$soc = new Societe($this->db);
// Parse element/subelement (ex: project_task)
$element = $path = $filename = $object->source;
if (preg_match('/^([^_]+)_([^_]+)/i',$object->source,$regs))
{
$element = $path = $regs[1];
$filename = $regs[2];
}
// For compatibility
if ($element == 'order') {
$path = $filename = 'commande';
}
if ($element == 'invoice') {
$path = 'compta/facture'; $filename = 'facture';
}
dol_include_once('/'.$path.'/class/'.$filename.'.class.php');
$classname = ucfirst($filename);
$obj = new $classname($this->db);
$ret = $obj->fetch('',$object->ref);
if ($ret < 0) return -1;
// Add payer id
$soc->setValueFrom('ref_int', $object->payerID, 'societe', $obj->socid);
// Add transaction id
$obj->setValueFrom('ref_int',$object->resArray["TRANSACTIONID"]);
}
}

View File

@ -156,7 +156,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
$qty = $_POST['qty'] ? $_POST['qty'] : $_POST['pqty'];
$productsupplier = new ProductFournisseur($db);
$idprod=$productsupplier->get_buyprice($_POST['idprodfournprice'], $qty);
$idprod=$productsupplier->get_buyprice($_POST['idprodfournprice'], $qty); // Just to see if a price exists for the quantity. Not used to found vat
if ($idprod > 0)
{
@ -172,12 +172,12 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
$remise_percent = $_POST["remise_percent"] ? $_POST["remise_percent"] : $_POST["p_remise_percent"];
$tva_tx = get_default_tva($object->thirdparty,$mysoc,$productsupplier->id);
$tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, $_POST['idprodfournprice']);
$type = $productsupplier->type;
// Local Taxes
$localtax1_tx= get_localtax($tva_tx, 1, $mysoc);
$localtax2_tx= get_localtax($tva_tx, 2, $mysoc);
$localtax1_tx= get_localtax($tva_tx, 1, $object->thirdparty);
$localtax2_tx= get_localtax($tva_tx, 2, $object->thirdparty);
$result=$object->addline(
$desc,

View File

@ -2,9 +2,9 @@
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005 Marc Barilley <marc@ocebo.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2005 Marc Barilley <marc@ocebo.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -205,7 +205,8 @@ elseif($action == 'deletepaiement')
{
$paiementfourn = new PaiementFourn($db);
$paiementfourn->fetch($_GET['paiement_id']);
$paiementfourn->delete();
$result=$paiementfourn->delete();
if ($result < 0) $mesg='<div class="error">'.$paiementfourn->error.'</div>';
}
}
@ -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'])
{

View File

@ -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)

View File

@ -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);

View File

@ -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";
}

View File

@ -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 '<div id="tabs" style="border: 1px solid #ACACAC;">'."\n";
//var_dump($_SESSION);
print '<div id="tabs" class="ganttcontainer" style="border: 1px solid #ACACAC;">'."\n";
include_once(DOL_DOCUMENT_ROOT.'/projet/ganttchart.php');
print '</div>'."\n";
}

View File

@ -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 '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" / >';
print '<input type="hidden" name="entity" value"'.$entity.'" />';
print '<input type="hidden" name="entity" value="'.$entity.'" />';
print '<input type="hidden" name="action" value="add" />';
print '<div id="divsubscribe">';

View File

@ -27,6 +27,13 @@
define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
// For MultiCompany module
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_int($entity))
{
define("DOLENTITY", $entity);
}
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypal.lib.php");
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypalfunctions.lib.php");
@ -113,6 +120,11 @@ if (! empty($SECUREKEY))
$urlok.='securekey='.urlencode($SECUREKEY).'&';
$urlko.='securekey='.urlencode($SECUREKEY).'&';
}
if (! empty($entity))
{
$urlok.='entity='.urlencode($entity).'&';
$urlko.='entity='.urlencode($entity).'&';
}
$urlok=preg_replace('/&$/','',$urlok); // Remove last &
$urlko=preg_replace('/&$/','',$urlko); // Remove last &
@ -255,6 +267,7 @@ print '<input type="hidden" name="action" value="dopayment">'."\n";
print '<input type="hidden" name="tag" value="'.GETPOST("tag",'alpha').'">'."\n";
print '<input type="hidden" name="suffix" value="'.GETPOST("suffix",'alpha').'">'."\n";
print '<input type="hidden" name="securekey" value="'.$SECUREKEY.'">'."\n";
print '<input type="hidden" name="entity" value="'.$entity.'" />';
print "\n";
print '<!-- Form to send a Paypal payment -->'."\n";
print '<!-- PAYPAL_API_SANDBOX = '.$conf->global->PAYPAL_API_SANDBOX.' -->'."\n";

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -28,6 +29,13 @@
define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
// For MultiCompany module
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_int($entity))
{
define("DOLENTITY", $entity);
}
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypal.lib.php");
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypalfunctions.lib.php");

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -28,6 +29,13 @@
define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
// For MultiCompany module
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_int($entity))
{
define("DOLENTITY", $entity);
}
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypal.lib.php");
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypalfunctions.lib.php");

View File

@ -2061,7 +2061,7 @@ div.tdlineupdown {
/* ============================================================================== */
div.scroll2 {
width: 582px !important;
width: <?php print isset($_SESSION['dol_screenwidth'])?max($_SESSION['dol_screenwidth']-830,450):'450'; ?>px !important;
}
@ -2187,4 +2187,4 @@ div.ecmjqft {
<?php
if (is_object($db)) $db->close();
?>
?>

View File

@ -2315,7 +2315,7 @@ form.listactionsfilter input[type="submit"] {
/* ============================================================================== */
div.scroll2 {
width: 582px !important;
width: <?php print isset($_SESSION['dol_screenwidth'])?max($_SESSION['dol_screenwidth']-830,450):'450'; ?>px !important;
}
@ -2432,4 +2432,4 @@ div.ecmjqft {
<?php
if (is_object($db)) $db->close();
?>
?>

View File

@ -2131,7 +2131,7 @@ div.table-val-border-col {
/* ============================================================================== */
div.scroll2 {
width: 582px !important;
width: <?php print isset($_SESSION['dol_screenwidth'])?max($_SESSION['dol_screenwidth']-830,450):'450'; ?>px !important;
}

View File

@ -214,9 +214,9 @@ textarea:disabled {
-moz-border-radius:0px 5px 0px 5px;
-webkit-border-radius:0px 5px 0px 5px;
border-radius:0px 5px 0px 5px;
-moz-box-shadow: 4px 4px 4px #CCC;
-webkit-box-shadow: 4px 4px 4px #CCC;
box-shadow: 4px 4px 4px #CCC;
-moz-box-shadow: 2px 2px 3px #CCC;
-webkit-box-shadow: 2px 2px 3px #CCC;
box-shadow: 2px 2px 3px #CCC;
}
.button:focus {
font-family: <?php print $fontlist ?>;
@ -1234,9 +1234,9 @@ span.tabspan {
-moz-border-radius:0px 5px 0px 5px;
-webkit-border-radius:0px 5px 0px 5px;
border-radius:0px 5px 0px 5px;
-moz-box-shadow: 4px 4px 4px #CCC;
-webkit-box-shadow: 4px 4px 4px #CCC;
box-shadow: 4px 4px 4px #CCC;
-moz-box-shadow: 2px 2px 3px #CCC;
-webkit-box-shadow: 2px 2px 3px #CCC;
box-shadow: 2px 2px 3px #CCC;
}
.butAction:hover {
@ -2282,7 +2282,7 @@ a.cke_dialog_ui_button
/* ============================================================================== */
div.scroll2 {
width: 582px !important;
width: <?php print isset($_SESSION['dol_screenwidth'])?max($_SESSION['dol_screenwidth']-830,450):'450'; ?>px !important;
}

View File

@ -29,6 +29,7 @@ require_once(DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php');
require_once(DOL_DOCUMENT_ROOT."/core/lib/usergroups.lib.php");
$langs->load("users");
$langs->load("admin");
$id=GETPOST('id','int');
$action=GETPOST("action");