Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into mko559

This commit is contained in:
Maxime Kohlhaas 2012-11-19 13:31:23 +01:00
commit ec37a5e005
93 changed files with 8459 additions and 4905 deletions

View File

@ -14,7 +14,7 @@ For users:
configured. Show also total number of activated modules. configured. Show also total number of activated modules.
- New: Can filter list of proposal, order or invoice on sales representative. - New: Can filter list of proposal, order or invoice on sales representative.
- New: Add supplier ref on supplier orders. - New: Add supplier ref on supplier orders.
- New: Can export supplier orders. - New: Can export supplier orders and customers shipments.
- New: First change to install external plugins from gui (experimental). - New: First change to install external plugins from gui (experimental).
- New: Monaco is like France for default vat calculation - New: Monaco is like France for default vat calculation
- New: Can list elements (invoices, orders or proposals) on a particular - New: Can list elements (invoices, orders or proposals) on a particular

View File

@ -337,6 +337,7 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-20100919`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-20100919`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/utils`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/utils`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/LICENSE.TXT`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/LICENSE.TXT`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/savant`;
} }
# Build package for each target # Build package for each target

View File

@ -33,8 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
/** /**
* \class Adherent * Class to manage members of a foundation
* \brief Class to manage members of a foundation
*/ */
class Adherent extends CommonObject class Adherent extends CommonObject
{ {

View File

@ -28,8 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
/** /**
* \class AdherentType * Class to manage members type
* \brief Class to manage members type
*/ */
class AdherentType extends CommonObject class AdherentType extends CommonObject
{ {

View File

@ -28,8 +28,7 @@ include_once DOL_DOCUMENT_ROOT . '/adherents/class/cotisation.class.php';
/** /**
* \class AdherentStats * Class to manage statistics of members
* \brief Classe permettant la gestion des stats des adherents
*/ */
class AdherentStats extends Stats class AdherentStats extends Stats
{ {

View File

@ -26,8 +26,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
/** /**
* \class Cotisation * Class to manage subscriptions of foundation members
* \brief Class to manage subscriptions of foundation members
*/ */
class Cotisation extends CommonObject class Cotisation extends CommonObject
{ {

View File

@ -40,7 +40,16 @@ $action = GETPOST('action','alpha');
* Actions * Actions
*/ */
if ($action == 'setvalue' && $user->admin) if ($action == 'setMAILING_EMAIL_UNSUBSCRIBE')
{
$res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE",1,'chaine',0,'',$conf->entity);
}
if ($action == 'unsetMAILING_EMAIL_UNSUBSCRIBE')
{
$res=dolibarr_del_const($db, "MAILING_EMAIL_UNSUBSCRIBE");
}
if ($action == 'setvalue')
{ {
$db->begin(); $db->begin();
@ -129,14 +138,14 @@ print '<tr '.$bc[$var].'><td>';
print $langs->trans("ActivateCheckRead").'</td><td>'; print $langs->trans("ActivateCheckRead").'</td><td>';
if (!empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE)) if (!empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE))
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setvalue&value=off">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetMAILING_EMAIL_UNSUBSCRIBE">';
print img_picto($langs->trans("Enabled"),'switch_on'); print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>'; print '</a>';
$readonly=''; $readonly='';
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setvalue&value=on">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setMAILING_EMAIL_UNSUBSCRIBE">';
print img_picto($langs->trans("Disabled"),'switch_off'); print img_picto($langs->trans("Disabled"),'switch_off');
print '</a>'; print '</a>';
$readonly='disabled="disabled"'; $readonly='disabled="disabled"';
@ -149,11 +158,13 @@ print $langs->trans("ActivateCheckReadKey").'</td><td>';
print '<input size="32" type="text" name="MAILING_EMAIL_UNSUBSCRIBE_KEY" '.$readonly.' value="'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY.'">'; print '<input size="32" type="text" name="MAILING_EMAIL_UNSUBSCRIBE_KEY" '.$readonly.' value="'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY.'">';
print '</td></tr>'; print '</td></tr>';
print '</table></form>'; print '</table>';
print '<br>'; print '<br>';
print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></div>'; print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></div>';
print '</form>';
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -23,8 +23,7 @@
/** /**
* \class Bookmark * Class to manage bookmarks
* \brief Class to manage bookmarks
*/ */
class Bookmark class Bookmark
{ {

View File

@ -298,7 +298,7 @@ if ($object->fetch($id) >= 0)
} }
print '<td>'; print '<td>';
if (! $obj->picto) $obj->picto='generic'; if (empty($obj->picto)) $obj->picto='generic';
print img_object($langs->trans("Module").': '.get_class($obj),$obj->picto).' '.$obj->getDesc(); print img_object($langs->trans("Module").': '.get_class($obj),$obj->picto).' '.$obj->getDesc();
print '</td>'; print '</td>';

View File

@ -337,16 +337,30 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
$i++; $i++;
} }
} }
else
{
setEventMessage($langs->transnoentitiesnoconv("NoMoreRecipientToSendTo"));
}
// Loop finished, set global statut of mail // Loop finished, set global statut of mail
if ($nbko > 0) if ($nbko > 0)
{ {
$statut=2; // Status 'sent partially' (because at least one error) $statut=2; // Status 'sent partially' (because at least one error)
if ($nbok > 0) setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
else setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
} }
else else
{ {
if ($nbok >= $num) $statut=3; // Send to everybody if ($nbok >= $num)
else $statut=2; // Status 'sent partially' (because not send to everybody) {
$statut=3; // Send to everybody
setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
}
else
{
$statut=2; // Status 'sent partially' (because not send to everybody)
setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
}
} }
$sql="UPDATE ".MAIN_DB_PREFIX."mailing SET statut=".$statut." WHERE rowid=".$object->id; $sql="UPDATE ".MAIN_DB_PREFIX."mailing SET statut=".$statut." WHERE rowid=".$object->id;
@ -388,8 +402,8 @@ if ($action == 'send' && empty($_POST["cancel"]))
if (preg_match('/[\s\t]*<html>/i',$object->body)) $msgishtml=1; if (preg_match('/[\s\t]*<html>/i',$object->body)) $msgishtml=1;
// Pratique les substitutions sur le sujet et message // Pratique les substitutions sur le sujet et message
$object->sujet=make_substitutions($object->sujet,$object->substitutionarrayfortest); $tmpsujet=make_substitutions($object->sujet,$object->substitutionarrayfortest);
$object->body=make_substitutions($object->body,$object->substitutionarrayfortest); $tmpbody=make_substitutions($object->body,$object->substitutionarrayfortest);
$arr_file = array(); $arr_file = array();
$arr_mime = array(); $arr_mime = array();
@ -412,7 +426,7 @@ if ($action == 'send' && empty($_POST["cancel"]))
} }
} }
$mailfile = new CMailFile($object->sujet,$object->sendto,$object->email_from,$object->body, $arr_file,$arr_mime,$arr_name,'', '', 0, $msgishtml,$object->email_errorsto,$arr_css); $mailfile = new CMailFile($tmpsujet,$object->sendto,$object->email_from,$tmpbody, $arr_file,$arr_mime,$arr_name,'', '', 0, $msgishtml,$object->email_errorsto,$arr_css);
$result=$mailfile->sendfile(); $result=$mailfile->sendfile();
if ($result) if ($result)
@ -1148,7 +1162,6 @@ else
} }
} }
llxFooter(); llxFooter();
$db->close(); $db->close();
?> ?>

View File

@ -18,7 +18,6 @@
/** /**
* \file htdocs/compta/ajaxpayment.php * \file htdocs/compta/ajaxpayment.php
* \brief File to return Ajax response on payment breakdown process * \brief File to return Ajax response on payment breakdown process
* \version ajaxpayment.php,v 1.0
*/ */
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
@ -33,8 +32,14 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't nee
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session) //if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
$langs->Load('compta'); $langs->load('compta');
/*
* View
*/
//init var //init var
$amountPayment = $_POST['amountPayment']; $amountPayment = $_POST['amountPayment'];
@ -42,26 +47,31 @@ $amounts = $_POST['amounts']; // from text inputs : invoice amount payment (c
$remains = $_POST['remains']; // from dolibarr's object (no need to check) $remains = $_POST['remains']; // from dolibarr's object (no need to check)
$currentInvId = $_POST['imgClicked']; // from DOM elements : imgId (equals invoice id) $currentInvId = $_POST['imgClicked']; // from DOM elements : imgId (equals invoice id)
// Getting the posted keys=>values, sanitize the ones who are from text inputs // Getting the posted keys=>values, sanitize the ones who are from text inputs
// from text inputs : total amount // from text inputs : total amount
$amountPayment = $amountPayment!='' ? ( is_numeric(price2num($amountPayment)) ? price2num($amountPayment) $amountPayment = $amountPayment!='' ? ( is_numeric(price2num($amountPayment)) ? price2num($amountPayment) : '' ) : ''; // keep void if not a valid entry
: ''
) // Clean checkamounts
: ''; // keep void if not a valid entry
// Checkamounts
foreach ($amounts as $key => $value) foreach ($amounts as $key => $value)
{ {
$value = price2num($value); $value = price2num($value);
if (!is_numeric($value)) unset($amounts[$key]); $amounts[$key]=$value;
if (empty($value)) unset($amounts[$key]);
}
// Clean remains
foreach ($remains as $key => $value)
{
$value = price2num($value);
$remains[$key]=$value;
if (empty($value)) unset($remains[$key]);
} }
// Treatment // Treatment
$result = $amountPayment != '' ? $amountPayment - array_sum($amounts) : $amountPayment + array_sum($amounts); // Remaining amountPayment $result = $amountPayment != '' ? ($amountPayment - array_sum($amounts)) : ($amountPayment + array_sum($amounts)); // Remaining amountPayment
$toJsonArray = array(); $toJsonArray = array();
$totalRemaining = price2num(array_sum($remains)); $totalRemaining = price2num(array_sum($remains));
$toJsonArray['label'] = $amountPayment == '' ? $langs->transnoentities('AmountToBeCharged') : $langs->transnoentities('RemainingAmountPayment'); $toJsonArray['label'] = $amountPayment == '' ? '' : $langs->transnoentities('RemainingAmountPayment');
if($currentInvId) // Here to breakdown if ($currentInvId) // Here to breakdown
{ {
// Get the current amount (from form) and the corresponding remainToPay (from invoice) // Get the current amount (from form) and the corresponding remainToPay (from invoice)
$currentAmount = $amounts['amount_'.$currentInvId]; $currentAmount = $amounts['amount_'.$currentInvId];
@ -99,9 +109,11 @@ if($currentInvId) // Here to breakdown
} }
$toJsonArray['amount_'.$currentInvId] = price2num($currentAmount).""; // Param will exist only if an img has been clicked $toJsonArray['amount_'.$currentInvId] = price2num($currentAmount).""; // Param will exist only if an img has been clicked
} }
// Encode to JSON to return
$toJsonArray['makeRed'] = $totalRemaining < price2num($result) || price2num($result) < 0 ? true : false;
$toJsonArray['result'] = price2num($result);
echo json_encode($toJsonArray); // Printing the call's result
$toJsonArray['makeRed'] = ($totalRemaining < price2num($result) || price2num($result) < 0) ? true : false;
$toJsonArray['result'] = price($result); // Return value to user format
$toJsonArray['resultnum'] = price2num($result); // Return value to numeric format
// Encode to JSON to return
echo dol_json_encode($toJsonArray); // Printing the call's result
?> ?>

View File

@ -280,12 +280,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$(\'.fieldrequireddyn\').removeClass(\'fieldrequired\'); $(\'.fieldrequireddyn\').removeClass(\'fieldrequired\');
$(\'#fieldchqemetteur\').val(\'\'); $(\'#fieldchqemetteur\').val(\'\');
} }
}'; }
// For paiement auto-completion
if (! empty($conf->global->MAIN_JS_ON_PAYMENT)) function _elemToJson(selector)
{
print "\n".'
function elemToJson(selector)
{ {
var subJson = {}; var subJson = {};
$.map(selector.serializeArray(), function(n,i) $.map(selector.serializeArray(), function(n,i)
@ -300,14 +297,14 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
var form = $("#payment_form"); var form = $("#payment_form");
json["amountPayment"] = $("#amountpayment").attr("value"); json["amountPayment"] = $("#amountpayment").attr("value");
json["amounts"] = elemToJson(form.find("input[name*=\"amount_\"]")); json["amounts"] = _elemToJson(form.find("input[name*=\"amount_\"]"));
json["remains"] = elemToJson(form.find("input[name*=\"remain_\"]")); json["remains"] = _elemToJson(form.find("input[name*=\"remain_\"]"));
if (imgId != null) { if (imgId != null) {
json["imgClicked"] = imgId; json["imgClicked"] = imgId;
} }
$.post("ajaxpayment.php", json, function(data) $.post("'.DOL_URL_ROOT.'/compta/ajaxpayment.php", json, function(data)
{ {
json = $.parseJSON(data); json = $.parseJSON(data);
@ -317,9 +314,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
{ {
if (key == "result") { if (key == "result") {
if (json["makeRed"]) { if (json["makeRed"]) {
$("#"+key).css("color", "red"); $("#"+key).addClass("error");
} else { } else {
$("#"+key).removeAttr("style"); $("#"+key).removeClass("error");
} }
json[key]=json["label"]+" "+json[key]; json[key]=json["label"]+" "+json[key];
$("#"+key).text(json[key]); $("#"+key).text(json[key]);
@ -331,27 +328,27 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
} }
}); });
} }
function callToBreakdown(imgSelector) {
var form = $("#payment_form"), imgId;
imgId = imgSelector.attr("id");
callForResult(imgId);
}
$("#payment_form").find("img").click(function() {
callToBreakdown(jQuery(this));
});
$("#payment_form").find("input[name*=\"amount_\"]").change(function() { $("#payment_form").find("input[name*=\"amount_\"]").change(function() {
callForResult(); callForResult();
}); });
$("#payment_form").find("input[name*=\"amount_\"]").keyup(function() {
callForResult();
});
';
if (! empty($conf->global->MAIN_JS_ON_PAYMENT))
{
print ' $("#payment_form").find("img").click(function() {
callForResult(jQuery(this).attr("id"));
});
$("#amountpayment").change(function() { $("#amountpayment").change(function() {
callForResult(); callForResult();
});'; });';
} }
print '});
</script>'."\n"; print ' });'."\n";
print ' </script>'."\n";
} }
print '<form id="payment_form" name="add_paiement" action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form id="payment_form" name="add_paiement" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
@ -573,7 +570,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
if ($totalrecudeposits) print '+'.price($totalrecudeposits); if ($totalrecudeposits) print '+'.price($totalrecudeposits);
print '</b></td>'; print '</b></td>';
print '<td align="right"><b>'.price(price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).'</b></td>'; print '<td align="right"><b>'.price(price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).'</b></td>';
print '<td align="right" id="result" style="font-weight:bold;"></td>'; print '<td align="right" id="result" style="font-weight: bold;"></td>';
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
} }

View File

@ -28,9 +28,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
// FIXME don't include external module class
if (! empty($conf->esaeb->enabled))
dol_include_once('/esaeb/class/esaeb19.class.php');
/** /**
@ -481,7 +478,6 @@ class BonPrelevement extends CommonObject
/* /*
* End of procedure * End of procedure
*
*/ */
if ($error == 0) if ($error == 0)
{ {
@ -928,7 +924,7 @@ class BonPrelevement extends CommonObject
} }
/* /*
* Creation process * Create withdrawal receipt
*/ */
if (!$error) if (!$error)
{ {
@ -1181,12 +1177,15 @@ class BonPrelevement extends CommonObject
$this->file = fopen($this->filename,"w"); $this->file = fopen($this->filename,"w");
// TODO Move code for es and fr into an external module file with selection into setup of prelevement module
// Build file for Spain // Build file for Spain
if ($mysoc->country_code=='ES') if ($mysoc->country_code=='ES')
{ {
// TODO replace by a hook (external modules)
if (! empty($conf->esaeb->enabled)) if (! empty($conf->esaeb->enabled))
{ {
dol_include_once('/esaeb/class/esaeb19.class.php');
//Head //Head
$esaeb19 = new AEB19DocWritter; $esaeb19 = new AEB19DocWritter;
$esaeb19->configuraPresentador($this->numero_national_emetteur,$conf->global->ESAEB_SUFIX_PRESENTADOR,$this->raison_sociale,$this->emetteur_code_banque,$this->emetteur_code_guichet); $esaeb19->configuraPresentador($this->numero_national_emetteur,$conf->global->ESAEB_SUFIX_PRESENTADOR,$this->raison_sociale,$this->emetteur_code_banque,$this->emetteur_code_guichet);
@ -1271,10 +1270,8 @@ class BonPrelevement extends CommonObject
$langs->load('withdrawals'); $langs->load('withdrawals');
fputs($this->file, $langs->trans('WithdrawalFileNotCapable')); fputs($this->file, $langs->trans('WithdrawalFileNotCapable'));
} }
} }
// Build file for France
//Build file for France
elseif ($mysoc->country_code=='FR') elseif ($mysoc->country_code=='FR')
{ {
/* /*
@ -1326,8 +1323,7 @@ class BonPrelevement extends CommonObject
$this->EnregTotal($this->total); $this->EnregTotal($this->total);
} }
// Build file for Other Countries with unknow format
//Build file for Other Countries with unknow format
else else
{ {
$this->total = 0; $this->total = 0;

View File

@ -214,11 +214,11 @@ if ($action == 'create')
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
// Label // Label
print '<td align="left"><input type="text" size="34" name="label" class="flat"></td>'; print '<td align="left"><input type="text" size="34" name="label" class="flat" value="'.GETPOST('label').'"></td>';
// Type // Type
print '<td align="left">'; print '<td align="left">';
$formsocialcontrib->select_type_socialcontrib(isset($_POST["actioncode"])?$_POST["actioncode"]:'','actioncode',1); $formsocialcontrib->select_type_socialcontrib(GETPOST("actioncode")?GETPOST("actioncode"):'','actioncode',1);
print '</td>'; print '</td>';
// Date end period // Date end period

View File

@ -29,8 +29,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
/** /**
* \class Contact * Class to manage contact/addresses
* \brief Classe permettant la gestion des contacts
*/ */
class Contact extends CommonObject class Contact extends CommonObject
{ {

View File

@ -2700,8 +2700,17 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="")
dol_syslog("get_localtax tva=".$tva." local=".$local." thirdparty_buyer=".(is_object($thirdparty_buyer)?$thirdparty_buyer->id:'')." thirdparty_seller=".$thirdparty_seller->id); dol_syslog("get_localtax tva=".$tva." local=".$local." thirdparty_buyer=".(is_object($thirdparty_buyer)?$thirdparty_buyer->id:'')." thirdparty_seller=".$thirdparty_seller->id);
// Some test to guess with no need to make database access // Some test to guess with no need to make database access
if ($mysoc->country_code == 'ES') // For spain, localtaxes are qualified if both supplier and seller use local taxe
{
if ($local == 1 && (! $thirdparty_seller->localtax1_assuj || ! $thirdparty_buyer->localtax1_assuj)) return 0;
if ($local == 2 && (! $thirdparty_seller->localtax2_assuj || ! $thirdparty_buyer->localtax2_assuj)) return 0;
}
else
{
if ($local == 1 && ! $thirdparty_seller->localtax1_assuj) return 0; if ($local == 1 && ! $thirdparty_seller->localtax1_assuj) return 0;
if ($local == 2 && ! $thirdparty_seller->localtax2_assuj) return 0; if ($local == 2 && ! $thirdparty_seller->localtax2_assuj) return 0;
}
//if ($local == 0 && ! $thirdparty_seller->localtax1_assuj && ! $thirdparty_seller->localtax2_assuj) return array('localtax1'=>0,'localtax2'=>0); //if ($local == 0 && ! $thirdparty_seller->localtax1_assuj && ! $thirdparty_seller->localtax2_assuj) return array('localtax1'=>0,'localtax2'=>0);
$code_country=$thirdparty_seller->country_code; $code_country=$thirdparty_seller->country_code;
@ -3565,7 +3574,7 @@ function get_date_range($date_start,$date_end,$format = '',$outputlangs='')
*/ */
function setEventMessage($mesgs, $style='mesgs') function setEventMessage($mesgs, $style='mesgs')
{ {
if (! in_array($style,array('mesgs','warnings','errors'))) dol_print_error('','Bad parameter for setEventMessage'); if (! in_array((string) $style, array('mesgs','warnings','errors'))) dol_print_error('','Bad parameter for setEventMessage');
if (! is_array($mesgs)) // If mesgs is a string if (! is_array($mesgs)) // If mesgs is a string
{ {
if ($mesgs) $_SESSION['dol_events'][$style][] = $mesgs; if ($mesgs) $_SESSION['dol_events'][$style][] = $mesgs;

View File

@ -177,7 +177,6 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
} }
// if there's some localtax without vat, we calculate localtaxes (we will add them at end) // if there's some localtax without vat, we calculate localtaxes (we will add them at end)
$apply_tax = false;
//If price is 'TTC' we need to have the totals without VAT for a correct calculation //If price is 'TTC' we need to have the totals without VAT for a correct calculation
if ($price_base_type=='TTC') if ($price_base_type=='TTC')
@ -186,6 +185,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
$tot_avec_remise= price2num($tot_avec_remise / (1 + ($txtva / 100)),'MU'); $tot_avec_remise= price2num($tot_avec_remise / (1 + ($txtva / 100)),'MU');
} }
$apply_tax = false;
switch($localtax1_type) { switch($localtax1_type) {
case '1': // localtax on product or service case '1': // localtax on product or service
$apply_tax = true; $apply_tax = true;

View File

@ -415,6 +415,9 @@ abstract class DolibarrModules
global $db,$conf; global $db,$conf;
$error=0; $error=0;
$dirfound=0;
if (empty($reldir)) return 1;
include_once DOL_DOCUMENT_ROOT .'/core/lib/admin.lib.php'; include_once DOL_DOCUMENT_ROOT .'/core/lib/admin.lib.php';
@ -426,10 +429,12 @@ abstract class DolibarrModules
$dir = $dirroot.$reldir; $dir = $dirroot.$reldir;
$ok = 0; $ok = 0;
// Run llx_mytable.sql files
$handle=@opendir($dir); // Dir may not exists $handle=@opendir($dir); // Dir may not exists
if (is_resource($handle)) if (is_resource($handle))
{ {
$dirfound++;
// Run llx_mytable.sql files
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data') if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data')
@ -438,13 +443,10 @@ abstract class DolibarrModules
if ($result <= 0) $error++; if ($result <= 0) $error++;
} }
} }
closedir($handle);
} rewinddir($handle);
// Run llx_mytable.key.sql files (Must be done after llx_mytable.sql) // Run llx_mytable.key.sql files (Must be done after llx_mytable.sql)
$handle=@opendir($dir); // Dir may not exist
if (is_resource($handle))
{
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data') if (preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data')
@ -453,13 +455,10 @@ abstract class DolibarrModules
if ($result <= 0) $error++; if ($result <= 0) $error++;
} }
} }
closedir($handle);
} rewinddir($handle);
// Run data_xxx.sql files (Must be done after llx_mytable.key.sql) // Run data_xxx.sql files (Must be done after llx_mytable.key.sql)
$handle=@opendir($dir); // Dir may not exist
if (is_resource($handle))
{
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'data') if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'data')
@ -468,13 +467,10 @@ abstract class DolibarrModules
if ($result <= 0) $error++; if ($result <= 0) $error++;
} }
} }
closedir($handle);
} rewinddir($handle);
// Run update_xxx.sql files // Run update_xxx.sql files
$handle=@opendir($dir); // Dir may not exist
if (is_resource($handle))
{
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,6) == 'update') if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,6) == 'update')
@ -483,6 +479,7 @@ abstract class DolibarrModules
if ($result <= 0) $error++; if ($result <= 0) $error++;
} }
} }
closedir($handle); closedir($handle);
} }
@ -493,6 +490,7 @@ abstract class DolibarrModules
} }
} }
if (! $dirfound) dol_syslog("A module ask to load sql files into ".$reldir." but this directory was not found.", LOG_WARNING);
return $ok; return $ok;
} }

View File

@ -61,9 +61,8 @@ class mailing_framboise extends MailingTargets
$cibles = array(); $cibles = array();
// CHANGE THIS
// Select the members from category // Select the members from category
$sql = "SELECT a.rowid as id, a.email as email, a.nom as name, null as fk_contact, null as firstname,"; $sql = "SELECT a.rowid as id, a.email as email, a.nom as name, null as fk_contact, a.prenom as firstname,";
if ($_POST['filter']) $sql.= " c.label"; if ($_POST['filter']) $sql.= " c.label";
else $sql.=" null as label"; else $sql.=" null as label";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a";

View File

@ -42,6 +42,8 @@ class modExpedition extends DolibarrModules
*/ */
function __construct($db) function __construct($db)
{ {
global $conf;
$this->db = $db; $this->db = $db;
$this->numero = 80; $this->numero = 80;
@ -71,6 +73,8 @@ class modExpedition extends DolibarrModules
// Dependances // Dependances
$this->depends = array("modCommande"); $this->depends = array("modCommande");
$this->requiredby = array(); $this->requiredby = array();
$this->conflictwith = array();
$this->langfiles = array('deliveries','sendings');
// Constantes // Constantes
$this->const = array(); $this->const = array();
@ -141,6 +145,14 @@ class modExpedition extends DolibarrModules
$this->rights[$r][4] = 'shipping_advance'; $this->rights[$r][4] = 'shipping_advance';
$this->rights[$r][5] = 'send'; $this->rights[$r][5] = 'send';
$r++;
$this->rights[$r][0] = 106;
$this->rights[$r][1] = 'Exporter les expeditions';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'shipment';
$this->rights[$r][5] = 'export';
$r++; $r++;
$this->rights[$r][0] = 109; $this->rights[$r][0] = 109;
$this->rights[$r][1] = 'Supprimer les expeditions'; $this->rights[$r][1] = 'Supprimer les expeditions';
@ -180,6 +192,25 @@ class modExpedition extends DolibarrModules
$this->rights[$r][4] = 'livraison'; $this->rights[$r][4] = 'livraison';
$this->rights[$r][5] = 'supprimer'; $this->rights[$r][5] = 'supprimer';
// Exports
//--------
$r=0;
$r++;
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='Shipments'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("expedition","shipment","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_customer'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation",'c.date_delivery'=>"DateSending",'c.tracking_number'=>"TrackingNumber",'c.height'=>"Height",'c.width'=>"Width",'c.size'=>"Depth",'c.size_units'=>'SizeUnits','c.weight'=>"Weight",'c.weight_units'=>"WeightUnits",'c.fk_statut'=>'Status','c.note'=>"Note",'ed.rowid'=>'LineId','cd.description'=>'Description','ed.qty'=>"Qty",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','s.libelle'=>'List:c_pays:libelle:rowid','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Number",'c.remise_percent'=>"Number",'c.total_ht'=>"Number",'c.total_ttc'=>"Number",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note'=>"Text",'c.date_livraison'=>'Date','ed.qty'=>"Text");
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','s.libelle'=>'List:c_pays:libelle:rowid','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_customer'=>"Text",'c.date_creation'=>"Date",'c.date_delivery'=>"Date",'c.tracking_number'=>"Number",'c.height'=>"Number",'c.width'=>"Number",'c.weight'=>"Number",'c.fk_statut'=>'Status','c.note'=>"Text",'ed.qty'=>"Number");
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.ape'=>'company','s.siret'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','c.rowid'=>"shipment",'c.ref'=>"shipment",'c.ref_customer'=>"shipment",'c.fk_soc'=>"shipment",'c.date_creation'=>"shipment",'c.date_delivery'=>"shipment",'c.tracking_number'=>'shipment','c.height'=>"shipment",'c.width'=>"shipment",'c.size'=>'shipment','c.size_units'=>'shipment','c.weight'=>"shipment",'c.weight_units'=>'shipment','c.fk_statut'=>"shipment",'c.note'=>"shipment",'ed.rowid'=>'shipment_line','cd.description'=>'shipment_line','ed.qty'=>"shipment_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product');
$this->export_dependencies_array[$r]=array('shipment_line'=>'ed.rowid','product'=>'ed.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'expedition as c, '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'expeditiondet as ed, '.MAIN_DB_PREFIX.'commandedet as cd)';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (cd.fk_product = p.rowid)';
$this->export_sql_end[$r] .=' WHERE c.fk_soc = s.rowid AND c.rowid = ed.fk_expedition AND ed.fk_origin_line = cd.rowid';
$this->export_sql_end[$r] .=' AND c.entity = '.$conf->entity;
} }

View File

@ -220,7 +220,7 @@ class modGravatar extends DolibarrModules
*/ */
function load_tables() function load_tables()
{ {
return $this->_load_tables('/mymodule/sql/'); return $this->_load_tables('');
} }
} }

View File

@ -65,6 +65,8 @@ class modProjet extends DolibarrModules
// Dependancies // Dependancies
$this->depends = array(); $this->depends = array();
$this->requiredby = array(); $this->requiredby = array();
$this->conflictwith = array();
$this->langfiles = array('projects');
// Constants // Constants
$this->const = array(); $this->const = array();

View File

@ -173,7 +173,7 @@ class modWorkflow extends DolibarrModules
*/ */
function load_tables() function load_tables()
{ {
return $this->_load_tables('/workflow/sql/'); return $this->_load_tables('');
} }
} }
?> ?>

View File

@ -54,7 +54,6 @@ if (isset($conf->modules_parts['css']))
} }
// JQuery. Must be before other includes // JQuery. Must be before other includes
$ext='.js'; $ext='.js';
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) $ext='.jgz';
print '<!-- Includes JS for JQuery -->'."\n"; print '<!-- Includes JS for JQuery -->'."\n";
if (constant('JS_JQUERY')) print '<script type="text/javascript" src="'.JS_JQUERY.'jquery.min.js"></script>'."\n"; if (constant('JS_JQUERY')) print '<script type="text/javascript" src="'.JS_JQUERY.'jquery.min.js"></script>'."\n";
else print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-latest.min'.$ext.'"></script>'."\n"; else print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-latest.min'.$ext.'"></script>'."\n";

View File

@ -53,7 +53,6 @@ if (isset($conf->modules_parts['css']))
} }
// JQuery. Must be before other includes // JQuery. Must be before other includes
$ext='.js'; $ext='.js';
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) $ext='.jgz';
print '<!-- Includes JS for JQuery -->'."\n"; print '<!-- Includes JS for JQuery -->'."\n";
if (constant('JS_JQUERY')) print '<script type="text/javascript" src="'.JS_JQUERY.'jquery.min.js"></script>'."\n"; if (constant('JS_JQUERY')) print '<script type="text/javascript" src="'.JS_JQUERY.'jquery.min.js"></script>'."\n";
else print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-latest.min'.$ext.'"></script>'."\n"; else print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-latest.min'.$ext.'"></script>'."\n";

View File

@ -709,12 +709,12 @@ class Expedition extends CommonObject
$sql.= " fk_expedition_methode=".((isset($this->expedition_method_id) && $this->expedition_method_id > 0)?$this->expedition_method_id:"null").","; $sql.= " fk_expedition_methode=".((isset($this->expedition_method_id) && $this->expedition_method_id > 0)?$this->expedition_method_id:"null").",";
$sql.= " tracking_number=".(isset($this->tracking_number)?"'".$this->db->escape($this->tracking_number)."'":"null").","; $sql.= " tracking_number=".(isset($this->tracking_number)?"'".$this->db->escape($this->tracking_number)."'":"null").",";
$sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").","; $sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").",";
$sql.= " height=".(isset($this->trueHeight)?$this->trueHeight:"null").","; $sql.= " height=".(($this->trueHeight != '')?$this->trueHeight:"null").",";
$sql.= " width=".(isset($this->trueWidth)?$this->trueWidth:"null").","; $sql.= " width=".(($this->trueWidth != '')?$this->trueWidth:"null").",";
$sql.= " size_units=".(isset($this->size_units)?$this->size_units:"null").","; $sql.= " size_units=".(isset($this->size_units)?$this->size_units:"null").",";
$sql.= " size=".(isset($this->trueDepth)?$this->trueDepth:"null").","; $sql.= " size=".(($this->trueDepth != '')?$this->trueDepth:"null").",";
$sql.= " weight_units=".(isset($this->weight_units)?$this->weight_units:"null").","; $sql.= " weight_units=".(isset($this->weight_units)?$this->weight_units:"null").",";
$sql.= " weight=".(isset($this->trueWeight)?$this->trueWeight:"null").","; $sql.= " weight=".(($this->trueWeight != '')?$this->trueWeight:"null").",";
$sql.= " note=".(isset($this->note)?"'".$this->db->escape($this->note)."'":"null").","; $sql.= " note=".(isset($this->note)?"'".$this->db->escape($this->note)."'":"null").",";
$sql.= " model_pdf=".(isset($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null").","; $sql.= " model_pdf=".(isset($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null").",";
$sql.= " entity=".$conf->entity; $sql.= " entity=".$conf->entity;
@ -858,7 +858,8 @@ class Expedition extends CommonObject
$sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva"; $sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva";
$sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice"; $sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice";
$sql.= ", ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot"; $sql.= ", ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot";
$sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type, p.weight, p.weight_units, p.volume, p.volume_units"; $sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type";
$sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units";
$sql.= " FROM (".MAIN_DB_PREFIX."expeditiondet as ed,"; $sql.= " FROM (".MAIN_DB_PREFIX."expeditiondet as ed,";
$sql.= " ".MAIN_DB_PREFIX."commandedet as cd)"; $sql.= " ".MAIN_DB_PREFIX."commandedet as cd)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = cd.fk_product"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = cd.fk_product";
@ -900,6 +901,10 @@ class Expedition extends CommonObject
$line->qty_shipped = $obj->qty_shipped; $line->qty_shipped = $obj->qty_shipped;
$line->weight = $obj->weight; $line->weight = $obj->weight;
$line->weight_units = $obj->weight_units; $line->weight_units = $obj->weight_units;
$line->length = $obj->length;
$line->length_units = $obj->length_units;
$line->surface = $obj->surface;
$line->surface_units = $obj->surface_units;
$line->volume = $obj->volume; $line->volume = $obj->volume;
$line->volume_units = $obj->volume_units; $line->volume_units = $obj->volume_units;

View File

@ -285,10 +285,9 @@ else if ($action == 'settrackingnumber' || $action == 'settrackingurl'
header("Location: fiche.php?id=".$shipping->id); header("Location: fiche.php?id=".$shipping->id);
exit; exit;
} }
$mesg=$shipping->error; setEventMessage($shipping->error,'errors');
} }
$mesg='<div class="error">'.$mesg.'</div>';
$action=""; $action="";
} }
@ -537,7 +536,7 @@ else if ($action == 'classifybilled')
/* /*
* View * View
*/ */
llxHeader('',$langs->trans('Sending'),'Expedition'); llxHeader('',$langs->trans('Sending'),'Expedition');
@ -937,8 +936,8 @@ else
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
// Calculate ture totalVeight and totalVolume for all products // Calculate true totalWeight and totalVolume for all products
// by adding weight and volume of each line. // by adding weight and volume of each product line.
$totalWeight = ''; $totalWeight = '';
$totalVolume = ''; $totalVolume = '';
$weightUnit=0; $weightUnit=0;
@ -949,6 +948,7 @@ else
$volumeUnit=0; $volumeUnit=0;
if (! empty($lines[$i]->weight_units)) $weightUnit = $lines[$i]->weight_units; if (! empty($lines[$i]->weight_units)) $weightUnit = $lines[$i]->weight_units;
if (! empty($lines[$i]->volume_units)) $volumeUnit = $lines[$i]->volume_units; if (! empty($lines[$i]->volume_units)) $volumeUnit = $lines[$i]->volume_units;
// TODO Use a function addvalueunits(val1,unit1,val2,unit2)=>(val,unit) // TODO Use a function addvalueunits(val1,unit1,val2,unit2)=>(val,unit)
if ($lines[$i]->weight_units < 50) if ($lines[$i]->weight_units < 50)
{ {
@ -973,8 +973,6 @@ else
$totalVolume += $lines[$i]->volume*$lines[$i]->qty_shipped; $totalVolume += $lines[$i]->volume*$lines[$i]->qty_shipped;
} }
} }
$totalVolume=$totalVolume;
//print "totalVolume=".$totalVolume." volumeUnit=".$volumeUnit;
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -1053,49 +1051,50 @@ else
// Weight // Weight
print '<tr><td>'.$form->editfieldkey("Weight",'trueWeight',$object->trueWeight,$object,$user->rights->expedition->creer).'</td><td colspan="3">'; print '<tr><td>'.$form->editfieldkey("Weight",'trueWeight',$object->trueWeight,$object,$user->rights->expedition->creer).'</td><td colspan="3">';
print $form->editfieldval("Weight",'trueWeight',$object->trueWeight,$object,$user->rights->expedition->creer); print $form->editfieldval("Weight",'trueWeight',$object->trueWeight,$object,$user->rights->expedition->creer);
print $object->weight_units?measuring_units_string($object->weight_units,"weight"):''; print ($object->trueWeight && $object->weight_units!='')?' '.measuring_units_string($object->weight_units,"weight"):'';
print '</td></tr>'; print '</td></tr>';
// Volume Total
print '<tr><td>'.$langs->trans("Volume").'</td>';
print '<td colspan="3">';
if (! empty($object->trueVolume)) // FIXME trueVolume not exist
{
// If sending volume defined
print $object->trueVolume.' '.measuring_units_string($object->volumeUnit,"volume");
}
else
{
// If sending volume not defined we use sum of products
if ($totalVolume > 0)
{
print $totalVolume.' ';
if ($volumeUnit < 50) print measuring_units_string(0,"volume");
else print measuring_units_string($volumeUnit,"volume");
}
else print '&nbsp;';
}
print "</td>\n";
print '</tr>';
// Width // Width
print '<tr><td>'.$form->editfieldkey("Width",'trueWidth',$object->trueWidth,$object,$user->rights->expedition->creer).'</td><td colspan="3">'; print '<tr><td>'.$form->editfieldkey("Width",'trueWidth',$object->trueWidth,$object,$user->rights->expedition->creer).'</td><td colspan="3">';
print $form->editfieldval("Width",'trueWidth',$object->trueWidth,$object,$user->rights->expedition->creer); print $form->editfieldval("Width",'trueWidth',$object->trueWidth,$object,$user->rights->expedition->creer);
print $object->trueWidth?measuring_units_string($object->width_units,"size"):''; print ($object->trueWidth && $object->width_units!='')?' '.measuring_units_string($object->width_units,"size"):'';
print '</td></tr>'; print '</td></tr>';
// Height // Height
print '<tr><td>'.$form->editfieldkey("Height",'trueHeight',$object->trueHeight,$object,$user->rights->expedition->creer).'</td><td colspan="3">'; print '<tr><td>'.$form->editfieldkey("Height",'trueHeight',$object->trueHeight,$object,$user->rights->expedition->creer).'</td><td colspan="3">';
print $form->editfieldval("Height",'trueHeight',$object->trueHeight,$object,$user->rights->expedition->creer); print $form->editfieldval("Height",'trueHeight',$object->trueHeight,$object,$user->rights->expedition->creer);
print $object->trueHeight?measuring_units_string($object->height_units,"size"):''; print ($object->trueHeight && $object->height_units!='')?' '.measuring_units_string($object->height_units,"size"):'';
print '</td></tr>'; print '</td></tr>';
// Depth // Depth
print '<tr><td>'.$form->editfieldkey("Depth",'trueDepth',$object->trueDepth,$object,$user->rights->expedition->creer).'</td><td colspan="3">'; print '<tr><td>'.$form->editfieldkey("Depth",'trueDepth',$object->trueDepth,$object,$user->rights->expedition->creer).'</td><td colspan="3">';
print $form->editfieldval("Depth",'trueDepth',$object->trueDepth,$object,$user->rights->expedition->creer); print $form->editfieldval("Depth",'trueDepth',$object->trueDepth,$object,$user->rights->expedition->creer);
print $object->trueDepth?measuring_units_string($object->depth_units,"size"):''; print ($object->trueDepth && $object->depth_units!='')?' '.measuring_units_string($object->depth_units,"size"):'';
print '</td></tr>'; print '</td></tr>';
// Volume
print '<tr><td>';
print $langs->trans("Volume");
print '</td>';
print '<td colspan="3">';
$calculatedVolume=0;
if ($object->trueWidth && $object->trueHeight && $object->trueDepth) $calculatedVolume=($object->trueWidth * $object->trueHeight * $object->trueDepth);
// If sending volume not defined we use sum of products
if ($calculatedVolume > 0)
{
print $calculatedVolume.' ';
if ($volumeUnit < 50) print measuring_units_string(0,"volume");
else print measuring_units_string($volumeUnit,"volume");
}
if ($totalVolume > 0)
{
if ($calculatedVolume) print ' ('.$langs->trans("SumOfProductVolumes").': ';
print $totalVolume;
if ($calculatedVolume) print ')';
}
print "</td>\n";
print '</tr>';
// Status // Status
print '<tr><td>'.$langs->trans("Status").'</td>'; print '<tr><td>'.$langs->trans("Status").'</td>';
print '<td colspan="3">'.$object->getLibStatut(4)."</td>\n"; print '<td colspan="3">'.$object->getLibStatut(4)."</td>\n";

View File

@ -58,6 +58,8 @@ $entitytoicon = array(
'product' => 'product', 'product' => 'product',
'warehouse' => 'stock', 'warehouse' => 'stock',
'category' => 'category', 'category' => 'category',
'shipment' => 'sending',
'shipment_line'=> 'sending'
); );
// Translation code // Translation code
@ -86,7 +88,9 @@ $entitytolang = array(
'warehouse' => 'Warehouse', 'warehouse' => 'Warehouse',
'category' => 'Category', 'category' => 'Category',
'other' => 'Other', 'other' => 'Other',
'trip' => 'TripsAndExpenses' 'trip' => 'TripsAndExpenses',
'shipment' => 'Shipments',
'shipment_line'=> 'ShipmentLine'
); );
$array_selected=isset($_SESSION["export_selected_fields"])?$_SESSION["export_selected_fields"]:array(); $array_selected=isset($_SESSION["export_selected_fields"])?$_SESSION["export_selected_fields"]:array();

View File

@ -1,20 +1,21 @@
<?php <?php
/* Copyright (C) 2007-2008 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com> * Copyright (C) 2012 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 * This program is free software; you can redistribute it and/or modify
* the Free Software Foundation; either version 2 of the License, or * it under the terms of the GNU General Public License as published by
* (at your option) any later version. * the Free Software Foundation; either version 2 of the License, or
* * (at your option) any later version.
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * This program is distributed in the hope that it will be useful,
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * but WITHOUT ANY WARRANTY; without even the implied warranty of
* GNU General Public License for more details. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* * GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** /**
* \file holiday.class.php * \file holiday.class.php
@ -88,6 +89,12 @@ class Holiday extends CommonObject
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
$now=dol_now();
// Check parameters
if (empty($this->fk_user) || ! is_numeric($this->fk_user) || $this->fk_user < 0) { $this->error="ErrorBadParameter"; return -1; }
if (empty($this->fk_validator) || ! is_numeric($this->fk_validator) || $this->fk_validator < 0) { $this->error="ErrorBadParameter"; return -1; }
// Insert request // Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday(";
@ -102,22 +109,13 @@ class Holiday extends CommonObject
$sql.= ") VALUES ("; $sql.= ") VALUES (";
// User // User
if(!empty($this->fk_user)) {
$sql.= "'".$this->fk_user."',"; $sql.= "'".$this->fk_user."',";
} else { $sql.= " '".$this->db->idate($now)."',";
$error++;
}
$sql.= " NOW(),";
$sql.= " '".addslashes($this->description)."',"; $sql.= " '".addslashes($this->description)."',";
$sql.= " '".$this->db->idate($this->date_debut)."',"; $sql.= " '".$this->db->idate($this->date_debut)."',";
$sql.= " '".$this->db->idate($this->date_fin)."',"; $sql.= " '".$this->db->idate($this->date_fin)."',";
$sql.= " '1',"; $sql.= " '1',";
if(is_numeric($this->fk_validator)) {
$sql.= " '".$this->fk_validator."'"; $sql.= " '".$this->fk_validator."'";
}
else {
$error++;
}
$sql.= ")"; $sql.= ")";
@ -182,7 +180,6 @@ class Holiday extends CommonObject
$sql.= " cp.fk_user_cancel,"; $sql.= " cp.fk_user_cancel,";
$sql.= " cp.detail_refuse"; $sql.= " cp.detail_refuse";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp";
$sql.= " WHERE cp.rowid = ".$id; $sql.= " WHERE cp.rowid = ".$id;
@ -225,12 +222,12 @@ class Holiday extends CommonObject
} }
/** /**
* Liste les congés payés pour un utilisateur * List holidays for a particular user
* *
* @param int $user_id ID de l'utilisateur à lister * @param int $user_id ID of user to list
* @param string $order Filtrage par ordre * @param string $order Sort order
* @param string $filter Filtre de séléction * @param string $filter SQL Filter
* @return int -1 si erreur, 1 si OK et 2 si pas de résultat * @return int -1 if KO, 1 if OK, 2 if no result
*/ */
function fetchByUser($user_id,$order='',$filter='') function fetchByUser($user_id,$order='',$filter='')
{ {
@ -320,11 +317,11 @@ class Holiday extends CommonObject
} }
/** /**
* Liste les congés payés de tout les utilisateurs * List all holidays of all users
* *
* @param string $order Filtrage par ordre * @param string $order Sort order
* @param string $filter Filtre de séléction * @param string $filter SQL Filter
* @return int -1 si erreur, 1 si OK et 2 si pas de résultat * @return int -1 if KO, 1 if OK, 2 if no result
*/ */
function fetchAll($order,$filter) function fetchAll($order,$filter)
{ {
@ -1182,12 +1179,12 @@ class Holiday extends CommonObject
// On séléctionne les utilisateurs qui ne sont pas déjà dans le module // On séléctionne les utilisateurs qui ne sont pas déjà dans le module
$sql = "SELECT u.fk_user"; $sql = "SELECT u.fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_users as u"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday_users as u";
$sql.= " WHERE u.fk_user NOT IN(".$listUsersDolibarr.")"; $sql.= " WHERE u.fk_user NOT IN (".$listUsersDolibarr.")";
$result = $this->db->query($sql); $resql = $this->db->query($sql);
// Si pas d'erreur SQL // Si pas d'erreur SQL
if($result) { if ($resql) {
$i = 0; $i = 0;
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
@ -1594,5 +1591,27 @@ class Holiday extends CommonObject
} }
} }
/**
* Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/
function initAsSpecimen()
{
global $user,$langs;
// Initialise parameters
$this->id=0;
$this->specimen=1;
$this->fk_user=1;
$this->description='SPECIMEN description';
$this->date_debut=dol_now();
$this->date_fin=dol_now()+(24*3600);
$this->fk_validator=1;
}
} }
?> ?>

View File

@ -43,14 +43,14 @@ if (empty($conf->holiday->enabled))
} }
$verifConf.= "SELECT value"; $sql = "SELECT value";
$verifConf.= " FROM ".MAIN_DB_PREFIX."holiday_config"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday_config";
$verifConf.= " WHERE name = 'userGroup'"; $sql.= " WHERE name = 'userGroup'";
$result = $db->query($verifConf); $result = $db->query($sql);
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
if($obj->value == NULL) if ($obj->value == NULL)
{ {
llxHeader('',$langs->trans('CPTitreMenu')); llxHeader('',$langs->trans('CPTitreMenu'));
print '<div class="tabBar">'; print '<div class="tabBar">';

View File

@ -1,20 +1,21 @@
<?php <?php
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com> * Copyright (C) 2012 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 * This program is free software; you can redistribute it and/or modify
* the Free Software Foundation; either version 2 of the License, or * it under the terms of the GNU General Public License as published by
* (at your option) any later version. * the Free Software Foundation; either version 2 of the License, or
* * (at your option) any later version.
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * This program is distributed in the hope that it will be useful,
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * but WITHOUT ANY WARRANTY; without even the implied warranty of
* GNU General Public License for more details. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* * GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** /**
* \file fiche.php * \file fiche.php
@ -33,14 +34,14 @@ require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
// Get parameters // Get parameters
$myparam = GETPOST("myparam"); $myparam = GETPOST("myparam");
$action=GETPOST('action'); $action=GETPOST('action', 'alpha');
$id=GETPOST('id'); $id=GETPOST('id', 'int');
// Protection if external user // Protection if external user
if ($user->societe_id > 0) accessforbidden(); if ($user->societe_id > 0) accessforbidden();
$user_id = $user->id; $user_id = $user->id;
$now=dol_now();
/******************************************************************* /*******************************************************************
@ -50,7 +51,6 @@ $user_id = $user->id;
// Si création de la demande // Si création de la demande
if ($action == 'create') if ($action == 'create')
{ {
// Si pas le droit de créer une demande // Si pas le droit de créer une demande
if(!$user->rights->holiday->write) if(!$user->rights->holiday->write)
{ {
@ -262,48 +262,47 @@ if ($action == 'confirm_send')
$verif = $cp->update($user->id); $verif = $cp->update($user->id);
// Si pas d'erreur SQL on redirige vers la fiche de la demande // Si pas d'erreur SQL on redirige vers la fiche de la demande
if($verif > 0) { if ($verif > 0)
{
// A // To
$destinataire = new User($db); $destinataire = new User($db);
$destinataire->fetch($cp->fk_validator); $destinataire->fetch($cp->fk_validator);
$emailTo = $destinataire->email; $emailTo = $destinataire->email;
// De // From
$expediteur = new User($db); $expediteur = new User($db);
$expediteur->fetch($cp->fk_user); $expediteur->fetch($cp->fk_user);
$emailFrom = $expediteur->email; $emailFrom = $expediteur->email;
// Sujet // Subject
if($conf->global->MAIN_APPLICATION_TITLE != NULL) { $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
$societeName = addslashes($conf->global->MAIN_APPLICATION_TITLE); if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE;
} else {
$societeName = addslashes($conf->global->MAIN_INFO_SOCIETE_NOM);
}
$subject = stripslashes($societeName)." - Demande de congés payés à valider"; $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysToValidate");
// Contenu // Content
$message = "Bonjour {$destinataire->prenom},\n\n"; $message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->prenom.",\n";
$message.= "\n";
$message.= "Veuillez trouver ci-dessous une demande de congés payés à valider.\n"; $message.= "Veuillez trouver ci-dessous une demande de congés payés à valider.\n";
$delayForRequest = $cp->getConfCP('delayForRequest'); $delayForRequest = $cp->getConfCP('delayForRequest');
//$delayForRequest = $delayForRequest * (60*60*24); //$delayForRequest = $delayForRequest * (60*60*24);
$now=dol_now();
$nextMonth = dol_time_plus_duree($now, $delayForRequest, 'd'); $nextMonth = dol_time_plus_duree($now, $delayForRequest, 'd');
// Si l'option pour avertir le valideur en cas de délai trop court // Si l'option pour avertir le valideur en cas de délai trop court
if($cp->getConfCP('AlertValidatorDelay')) { if($cp->getConfCP('AlertValidatorDelay'))
if($cp->date_debut < $nextMonth) { {
if($cp->date_debut < $nextMonth)
{
$message.= "\n"; $message.= "\n";
$message.= "Cette demande de congés payés à été effectué dans un"; $message.= "Cette demande de congés payés à été effectué dans un délai de moins de ".$cp->getConfCP('delayForRequest')." jours avant ceux-ci.\n";
$message.= " délai de moins de ".$cp->getConfCP('delayForRequest')." jours avant ceux-ci.\n";
} }
} }
// Si l'option pour avertir le valideur en cas de solde inférieur à la demande // Si l'option pour avertir le valideur en cas de solde inférieur à la demande
if($cp->getConfCP('AlertValidatorSolde')) { if($cp->getConfCP('AlertValidatorSolde'))
{
$nbopenedday=num_open_day($cp->date_debut,$cp->date_fin,0,1); $nbopenedday=num_open_day($cp->date_debut,$cp->date_fin,0,1);
if ($nbopenedday > $cp->getCPforUser($cp->fk_user)) if ($nbopenedday > $cp->getCPforUser($cp->fk_user))
{ {
@ -313,24 +312,26 @@ if ($action == 'confirm_send')
} }
$message.= "\n"; $message.= "\n";
$message.= "- Demandeur : {$expediteur->prenom} {$expediteur->nom}\n"; $message.= "- ".$langs->transnoentitiesnoconv("Name")." : ".$expediteur->prenom." ".$expediteur->nom."\n";
$message.= "- Période : du ".date('d/m/Y',strtotime($cp->date_debut))." au ".date('d/m/Y',strtotime($cp->date_fin))."\n"; $message.= "- ".$langs->transnoentitiesnoconv("Period")." : ".dol_print_date($cp->date_debut,'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($cp->date_fin,'day')."\n";
$message.= "- Lien : {$dolibarr_main_url_root}/holiday/fiche.php?id={$cp->rowid}\n\n"; $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/fiche.php?id=".$cp->rowid."\n\n";
$message.= "Bien cordialement,\n".$societeName; $message.= "\n";
$mail = new CMailFile($subject,$emailTo,$emailFrom,$message); $mail = new CMailFile($subject,$emailTo,$emailFrom,$message);
// Envoi du mail // Envoi du mail
$result=$mail->sendfile(); $result=$mail->sendfile();
if(!$result) { if (!$result)
{
header('Location: fiche.php?id='.$_GET['id'].'&error=mail&error_content='.$mail->error); header('Location: fiche.php?id='.$_GET['id'].'&error=mail&error_content='.$mail->error);
exit; exit;
} }
header('Location: fiche.php?id='.$_GET['id']); header('Location: fiche.php?id='.$_GET['id']);
exit; exit;
} else { }
else
{
// Sinon on affiche le formulaire de demande avec le message d'erreur SQL // Sinon on affiche le formulaire de demande avec le message d'erreur SQL
header('Location: fiche.php?id='.$_GET['id'].'&error=SQL_Create&msg='.$cp->error); header('Location: fiche.php?id='.$_GET['id'].'&error=SQL_Create&msg='.$cp->error);
exit; exit;
@ -367,37 +368,34 @@ if($action == 'confirm_valid')
$newSolde = $soldeActuel - ($nbJour*$cp->getConfCP('nbHolidayDeducted')); $newSolde = $soldeActuel - ($nbJour*$cp->getConfCP('nbHolidayDeducted'));
// On ajoute la modification dans le LOG // On ajoute la modification dans le LOG
$cp->addLogCP($userID,$cp->fk_user,'Event : Prise de congés payés',$newSolde); $cp->addLogCP($userID,$cp->fk_user,'Event : '.$langs->transnoentitiesnoconv("Holiday"),$newSolde);
// Mise à jour du solde // Mise à jour du solde
$cp->updateSoldeCP($cp->fk_user,$newSolde); $cp->updateSoldeCP($cp->fk_user,$newSolde);
// A // To
$destinataire = new User($db); $destinataire = new User($db);
$destinataire->fetch($cp->fk_user); $destinataire->fetch($cp->fk_user);
$emailTo = $destinataire->email; $emailTo = $destinataire->email;
// De // From
$expediteur = new User($db); $expediteur = new User($db);
$expediteur->fetch($cp->fk_validator); $expediteur->fetch($cp->fk_validator);
$emailFrom = $expediteur->email; $emailFrom = $expediteur->email;
// Sujet // Subject
if($conf->global->MAIN_APPLICATION_TITLE != NULL) { $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
$societeName = addslashes($conf->global->MAIN_APPLICATION_TITLE); if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE;
} else {
$societeName = addslashes($conf->global->MAIN_INFO_SOCIETE_NOM);
}
$subject = stripslashes($societeName)." - Demande de congés payés validée"; $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysValidated");
// Contenu
$message = "Bonjour {$destinataire->prenom},\n\n";
$message.= "Votre demande de congés payés du ".$cp->date_debut." au ".$cp->date_fin." vient d'être validée!\n";
$message.= "- Valideur : {$expediteur->prenom} {$expediteur->nom}\n";
$message.= "- Lien : {$dolibarr_main_url_root}/holiday/fiche.php?id={$cp->rowid}\n\n";
$message.= "Bien cordialement,\n".$societeName;
// Content
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->prenom.",\n";
$message.= "\n";
$message.= "Votre demande de congés payés du ".dol_print_date($cp->date_debut,'day')." au ".dol_print_date($cp->date_fin,'day')." vient d'être validée!\n";
$message.= "- ".$langs->transnoentitiesnoconv("ValidatedBy")." : ".$expediteur->prenom." ".$expediteur->nom."\n";
$message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/fiche.php?id=".$cp->rowid."\n\n";
$message.= "\n";
$mail = new CMailFile($subject,$emailTo,$emailFrom,$message); $mail = new CMailFile($subject,$emailTo,$emailFrom,$message);
@ -443,33 +441,30 @@ if ($action == 'confirm_refuse')
// Si pas d'erreur SQL on redirige vers la fiche de la demande // Si pas d'erreur SQL on redirige vers la fiche de la demande
if($verif > 0) { if($verif > 0) {
// A // To
$destinataire = new User($db); $destinataire = new User($db);
$destinataire->fetch($cp->fk_user); $destinataire->fetch($cp->fk_user);
$emailTo = $destinataire->email; $emailTo = $destinataire->email;
// De // From
$expediteur = new User($db); $expediteur = new User($db);
$expediteur->fetch($cp->fk_validator); $expediteur->fetch($cp->fk_validator);
$emailFrom = $expediteur->email; $emailFrom = $expediteur->email;
// Sujet // Subject
if($conf->global->MAIN_APPLICATION_TITLE != NULL) { $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
$societeName = addslashes($conf->global->MAIN_APPLICATION_TITLE); if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE;
} else {
$societeName = addslashes($conf->global->MAIN_INFO_SOCIETE_NOM);
}
$subject = stripslashes($societeName)." - Demande de congés payés refusée"; $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysRefused");
// Contenu // Content
$message = "Bonjour {$destinataire->prenom},\n\n"; $message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->prenom.",\n";
$message.= "Votre demande de congés payés ".$cp->date_debut." au ".$cp->date_fin." vient d'être refusée pour le motif suivant :\n"; $message.= "\n";
$message.= "Votre demande de congés payés ".dol_print_date($cp->date_debut,'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($cp->date_fin,'day')." vient d'être refusée pour le motif suivant :\n";
$message.= $_POST['detail_refuse']."\n\n"; $message.= $_POST['detail_refuse']."\n\n";
$message.= "- Valideur : {$expediteur->prenom} {$expediteur->nom}\n"; $message.= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".$expediteur->prenom." ".$expediteur->nom."\n";
$message.= "- Lien : {$dolibarr_main_url_root}/holiday/fiche.php?id={$cp->rowid}\n\n"; $message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/fiche.php?id=".$cp->rowid."\n\n";
$message.= "Bien cordialement,\n".$societeName; $message.= "\n";
$mail = new CMailFile($subject,$emailTo,$emailFrom,$message); $mail = new CMailFile($subject,$emailTo,$emailFrom,$message);
@ -517,32 +512,29 @@ if ($action == 'confirm_cancel' && $_GET['confirm'] == 'yes')
// Si pas d'erreur SQL on redirige vers la fiche de la demande // Si pas d'erreur SQL on redirige vers la fiche de la demande
if($verif > 0) if($verif > 0)
{ {
// A // To
$destinataire = new User($db); $destinataire = new User($db);
$destinataire->fetch($cp->fk_user); $destinataire->fetch($cp->fk_user);
$emailTo = $destinataire->email; $emailTo = $destinataire->email;
// De // From
$expediteur = new User($db); $expediteur = new User($db);
$expediteur->fetch($cp->fk_validator); $expediteur->fetch($cp->fk_validator);
$emailFrom = $expediteur->email; $emailFrom = $expediteur->email;
// Sujet // Subject
if($conf->global->MAIN_APPLICATION_TITLE != NULL) { $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
$societeName = addslashes($conf->global->MAIN_APPLICATION_TITLE); if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE;
} else {
$societeName = addslashes($conf->global->MAIN_INFO_SOCIETE_NOM);
}
$subject = stripslashes($societeName)."- Demande de congés payés annulée"; $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysCanceled");
// Contenu
$message = "Bonjour {$destinataire->prenom},\n\n";
$message.= "Votre demande de congés payés ".$cp->date_debut." au ".$cp->date_fin." vient d'être annulée !\n";
$message.= "- Valideur : {$expediteur->prenom} {$expediteur->nom}\n";
$message.= "- Lien : {$dolibarr_main_url_root}/holiday/fiche.php?id={$cp->rowid}\n\n";
$message.= "Bien cordialement,\n".$societeName;
// Content
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->prenom.",\n";
$message.= "\n";
$message.= "Votre demande de congés ".dol_print_date($cp->date_debut,'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($cp->date_fin,'day')." va été annulée.\n";
$message.= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".$expediteur->prenom." ".$expediteur->nom."\n";
$message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/fiche.php?id=".$cp->rowid."\n\n";
$message.= "\n";
$mail = new CMailFile($subject,$emailTo,$emailFrom,$message); $mail = new CMailFile($subject,$emailTo,$emailFrom,$message);
@ -575,6 +567,9 @@ if ($action == 'confirm_cancel' && $_GET['confirm'] == 'yes')
* View * View
****************************************************/ ****************************************************/
$form = new Form($db);
llxHeader(array(),$langs->trans('CPTitreMenu')); llxHeader(array(),$langs->trans('CPTitreMenu'));
if (empty($id) || $action == 'add' || $action == 'request') if (empty($id) || $action == 'add' || $action == 'request')
@ -622,7 +617,6 @@ if (empty($id) || $action == 'add' || $action == 'request')
dol_htmloutput_mesg('',$errors,'error'); dol_htmloutput_mesg('',$errors,'error');
} }
$html = new Form($db);
$cp = new Holiday($db); $cp = new Holiday($db);
$delayForRequest = $cp->getConfCP('delayForRequest'); $delayForRequest = $cp->getConfCP('delayForRequest');
@ -679,10 +673,10 @@ if (empty($id) || $action == 'add' || $action == 'request')
print '<td>'; print '<td>';
// Si la demande ne vient pas de l'agenda // Si la demande ne vient pas de l'agenda
if(!isset($_GET['datep'])) { if(!isset($_GET['datep'])) {
$html->select_date(-1,'date_debut_'); $form->select_date(-1,'date_debut_');
} else { } else {
$tmpdate = dol_mktime(0, 0, 0, GETPOST('datepmonth'), GETPOST('datepday'), GETPOST('datepyear')); $tmpdate = dol_mktime(0, 0, 0, GETPOST('datepmonth'), GETPOST('datepday'), GETPOST('datepyear'));
$html->select_date($tmpdate,'date_debut_'); $form->select_date($tmpdate,'date_debut_');
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -691,10 +685,10 @@ if (empty($id) || $action == 'add' || $action == 'request')
print '<td>'; print '<td>';
// Si la demande ne vient pas de l'agenda // Si la demande ne vient pas de l'agenda
if(!isset($_GET['datep'])) { if(!isset($_GET['datep'])) {
$html->select_date(-1,'date_fin_'); $form->select_date(-1,'date_fin_');
} else { } else {
$tmpdate = dol_mktime(0, 0, 0, GETPOST('datefmonth'), GETPOST('datefday'), GETPOST('datefyear')); $tmpdate = dol_mktime(0, 0, 0, GETPOST('datefmonth'), GETPOST('datefday'), GETPOST('datefyear'));
$html->select_date($tmpdate,'date_fin_'); $form->select_date($tmpdate,'date_fin_');
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -703,11 +697,11 @@ if (empty($id) || $action == 'add' || $action == 'request')
// Liste des utiliseurs du groupes choisi dans la config // Liste des utiliseurs du groupes choisi dans la config
$idGroupValid = $cp->getConfCP('userGroup'); $idGroupValid = $cp->getConfCP('userGroup');
$validator = new UserGroup($db,$idGroupValid); $validator = new UserGroup($db, $idGroupValid);
$valideurarray = $validator->listUsersForGroup(); $valideurarray = $validator->listUsersForGroup();
print '<td>'; print '<td>';
print $html->select_dolusers($valideur,"valideur",1,"",0,$valideurarray,''); print $form->select_dolusers($validator->id, "valideur", 1, "", 0, $valideurarray);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '<tr>'; print '<tr>';
@ -799,44 +793,39 @@ else
{ {
if ($action == 'delete' && $cp->statut == 1) { if ($action == 'delete' && $cp->statut == 1) {
if($user->rights->holiday->delete) { if($user->rights->holiday->delete)
$html = new Form($db); {
$ret=$form->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleDeleteCP"),$langs->trans("ConfirmDeleteCP"),"confirm_delete", '', 0, 1);
$ret=$html->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleDeleteCP"),$langs->trans("ConfirmDeleteCP"),"confirm_delete", '', 0, 1);
if ($ret == 'html') print '<br />'; if ($ret == 'html') print '<br />';
} }
} }
// Si envoi en validation // Si envoi en validation
if ($action == 'sendToValidate' && $cp->statut == 1 && $userID == $cp->fk_user) { if ($action == 'sendToValidate' && $cp->statut == 1 && $userID == $cp->fk_user)
$html = new Form($db); {
$ret=$form->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleToValidCP"),$langs->trans("ConfirmToValidCP"),"confirm_send", '', 0, 1);
$ret=$html->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleToValidCP"),$langs->trans("ConfirmToValidCP"),"confirm_send", '', 0, 1);
if ($ret == 'html') print '<br />'; if ($ret == 'html') print '<br />';
} }
// Si validation de la demande // Si validation de la demande
if ($action == 'valid' && $cp->statut == 2 && $userID == $cp->fk_validator) { if ($action == 'valid' && $cp->statut == 2 && $userID == $cp->fk_validator)
$html = new Form($db); {
$ret=$form->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleValidCP"),$langs->trans("ConfirmValidCP"),"confirm_valid", '', 0, 1);
$ret=$html->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleValidCP"),$langs->trans("ConfirmValidCP"),"confirm_valid", '', 0, 1);
if ($ret == 'html') print '<br />'; if ($ret == 'html') print '<br />';
} }
// Si refus de la demande // Si refus de la demande
if ($action == 'refuse' && $cp->statut == 2 && $userID == $cp->fk_validator) { if ($action == 'refuse' && $cp->statut == 2 && $userID == $cp->fk_validator)
$html = new Form($db); {
$array_input = array(array('type'=>"text",'label'=>"Entrez ci-dessous un motif de refus :",'name'=>"detail_refuse",'size'=>"50",'value'=>"")); $array_input = array(array('type'=>"text",'label'=>"Entrez ci-dessous un motif de refus :",'name'=>"detail_refuse",'size'=>"50",'value'=>""));
$ret=$html->form_confirm("fiche.php?id=".$_GET['id']."&action=confirm_refuse",$langs->trans("TitleRefuseCP"),"","confirm_refuse",$array_input,"",0); $ret=$form->form_confirm("fiche.php?id=".$_GET['id']."&action=confirm_refuse",$langs->trans("TitleRefuseCP"),"","confirm_refuse",$array_input,"",0);
if ($ret == 'html') print '<br />'; if ($ret == 'html') print '<br />';
} }
// Si annulation de la demande // Si annulation de la demande
if ($action == 'cancel' && $cp->statut == 2 && $userID == $cp->fk_validator) { if ($action == 'cancel' && $cp->statut == 2 && $userID == $cp->fk_validator)
$html = new Form($db); {
$ret=$form->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleCancelCP"),$langs->trans("ConfirmCancelCP"),"confirm_cancel", '', 0, 1);
$ret=$html->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleCancelCP"),$langs->trans("ConfirmCancelCP"),"confirm_cancel", '', 0, 1);
if ($ret == 'html') print '<br />'; if ($ret == 'html') print '<br />';
} }
@ -850,8 +839,6 @@ else
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$_GET['id'].'">'."\n"; print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$_GET['id'].'">'."\n";
print '<input type="hidden" name="action" value="update"/>'."\n"; print '<input type="hidden" name="action" value="update"/>'."\n";
print '<input type="hidden" name="holiday_id" value="'.$_GET['id'].'" />'."\n"; print '<input type="hidden" name="holiday_id" value="'.$_GET['id'].'" />'."\n";
$html = new Form($db);
} }
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -874,7 +861,7 @@ else
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans('DateDebCP').'</td>'; print '<td>'.$langs->trans('DateDebCP').'</td>';
print '<td>'; print '<td>';
$html->select_date($cp->date_debut,'date_debut_'); $form->select_date($cp->date_debut,'date_debut_');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
@ -888,7 +875,7 @@ else
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans('DateFinCP').'</td>'; print '<td>'.$langs->trans('DateFinCP').'</td>';
print '<td>'; print '<td>';
$html->select_date($cp->date_fin,'date_fin_'); $form->select_date($cp->date_fin,'date_fin_');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
@ -953,7 +940,7 @@ else
$valideur = $validator->listUsersForGroup(); $valideur = $validator->listUsersForGroup();
print '<td>'; print '<td>';
$html->select_users($cp->fk_validator,"valideur",1,"",0,$valideur,''); $form->select_users($cp->fk_validator,"valideur",1,"",0,$valideur,'');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
@ -983,44 +970,44 @@ else
print '</tbody>'; print '</tbody>';
print '</table>'; print '</table>';
dol_fiche_end(); if ($edit && $user->id == $cp->fk_user && $cp->statut == 1)
print '<div style="clear: both;"></div>'."\n";
if ($edit)
{ {
print '<center>'; print '<br><div align="center">';
if($user->rights->holiday->write && $_GET['action'] == 'edit' && $cp->statut == 1) if($user->rights->holiday->write && $_GET['action'] == 'edit' && $cp->statut == 1)
{ {
print '<input type="submit" value="'.$langs->trans("UpdateButtonCP").'" class="button">'; print '<input type="submit" value="'.$langs->trans("UpdateButtonCP").'" class="button">';
} }
print '</center>'; print '</div>';
print '</form>'; print '</form>';
} }
dol_fiche_end();
if (! $edit) if (! $edit)
{ {
print '<br />'; print '<div class="tabsAction">';
print '<div style="float: right;">'."\n";
// Boutons d'actions // Boutons d'actions
if($user->rights->holiday->write && $_GET['action'] != 'edit' && $cp->statut == 1)
if($user->rights->holiday->write && $_GET['action'] != 'edit' && $cp->statut == 1) { {
print '<a href="fiche.php?id='.$_GET['id'].'&action=edit" class="butAction" style="float: left;">'.$langs->trans("EditCP").'</a>'; print '<a href="fiche.php?id='.$_GET['id'].'&action=edit" class="butAction">'.$langs->trans("EditCP").'</a>';
} }
if($user->rights->holiday->delete && $cp->statut == 1) { if($user->rights->holiday->delete && $cp->statut == 1)
print '<a href="fiche.php?id='.$_GET['id'].'&action=delete" class="butAction" style="float: left;">'.$langs->trans("DeleteCP").'</a>'; {
print '<a href="fiche.php?id='.$_GET['id'].'&action=delete" class="butAction">'.$langs->trans("DeleteCP").'</a>';
} }
if($user->id == $cp->fk_user && $cp->statut == 1) { if($user->id == $cp->fk_user && $cp->statut == 1)
print '<a href="fiche.php?id='.$_GET['id'].'&action=sendToValidate" class="butAction" style="float: left;">'.$langs->trans("SendToValidationCP").'</a>'; {
print '<a href="fiche.php?id='.$_GET['id'].'&action=sendToValidate" class="butAction">'.$langs->trans("SendToValidationCP").'</a>';
} }
// Si le statut est en attente de validation et que le valideur est connecté // Si le statut est en attente de validation et que le valideur est connecté
if($userID == $cp->fk_validator && $cp->statut == 2) { if($userID == $cp->fk_validator && $cp->statut == 2)
print '<a href="fiche.php?id='.$_GET['id'].'&action=valid" class="butAction" style="float: left;">'.$langs->trans("ActionValidCP").'</a>'; {
print '<a href="fiche.php?id='.$_GET['id'].'&action=refuse" class="butAction" style="float: left;">'.$langs->trans("ActionRefuseCP").'</a>'; print '<a href="fiche.php?id='.$_GET['id'].'&action=valid" class="butAction">'.$langs->trans("ActionValidCP").'</a>';
print '<a href="fiche.php?id='.$_GET['id'].'&action=cancel" class="butAction" style="float: left;">'.$langs->trans("ActionCancelCP").'</a>'; print '<a href="fiche.php?id='.$_GET['id'].'&action=refuse" class="butAction">'.$langs->trans("ActionRefuseCP").'</a>';
print '<a href="fiche.php?id='.$_GET['id'].'&action=cancel" class="butAction">'.$langs->trans("ActionCancelCP").'</a>';
} }
print '</div>'; print '</div>';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com> * Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -71,6 +71,7 @@ $search_statut = GETPOST('select_statut');
$max_year = 5; $max_year = 5;
$min_year = 10; $min_year = 10;
$filter='';
llxHeader(array(),$langs->trans('CPTitreMenu')); llxHeader(array(),$langs->trans('CPTitreMenu'));
@ -185,7 +186,7 @@ if($holiday_payes == '-1')
$var=true; $num = count($holiday->holiday); $var=true; $num = count($holiday->holiday);
$html = new Form($db); $html = new Form($db);
$htmlother = new FormOther($db); $htmlother = new FormOther($db);
print_barre_liste($langs->trans("ListeCP"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num,$nbtotalofrecords); print_barre_liste($langs->trans("ListeCP"), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, "", $num);
print '<div class="tabBar">'; print '<div class="tabBar">';

File diff suppressed because it is too large Load Diff

View File

@ -164,10 +164,10 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (18
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1844, 184, '0','0','VAT Rate 0', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1844, 184, '0','0','VAT Rate 0', 1);
-- PORTUGAL (id country=25) -- PORTUGAL (id country=25)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (251, 25, '20','0','VAT standard rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (251, 25, '23','0','VAT standard rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (252, 25, '12','0','VAT reduced rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (252, 25, '13','0','VAT reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (253, 25, '0','0','VAT Rate 0', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (253, 25, '0','0','VAT Rate 0', 1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (254, 25, '5','0','VAT reduced rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (254, 25, '6','0','VAT reduced rate',1);
-- ROMANIA (id country=188) -- ROMANIA (id country=188)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1881,188, '24','0','VAT standard rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1881,188, '24','0','VAT standard rate',1);

View File

@ -79,6 +79,8 @@ alter table llx_propaldet drop column pa_ht;
alter table llx_propaldet drop column marge_tx; alter table llx_propaldet drop column marge_tx;
alter table llx_propaldet drop column marque_tx; alter table llx_propaldet drop column marque_tx;
alter table llx_expedition add column height_unit integer after height;
ALTER TABLE llx_commande CHANGE COLUMN fk_demand_reason fk_input_reason integer NULL DEFAULT NULL; ALTER TABLE llx_commande CHANGE COLUMN fk_demand_reason fk_input_reason integer NULL DEFAULT NULL;
ALTER TABLE llx_propal CHANGE COLUMN fk_demand_reason fk_input_reason integer NULL DEFAULT NULL; ALTER TABLE llx_propal CHANGE COLUMN fk_demand_reason fk_input_reason integer NULL DEFAULT NULL;
ALTER TABLE llx_commande_fournisseur CHANGE COLUMN fk_methode_commande fk_input_method integer NULL DEFAULT 0; ALTER TABLE llx_commande_fournisseur CHANGE COLUMN fk_methode_commande fk_input_method integer NULL DEFAULT 0;

View File

@ -1,7 +1,7 @@
-- =================================================================== -- ===================================================================
-- Copyright (C) 2003-2010 Rodolphe Quiedeville <rodolphe@quiedeville.org> -- Copyright (C) 2003-2010 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2008-2010 Regis Houssin <regis@dolibarr.fr> -- Copyright (C) 2008-2010 Regis Houssin <regis@dolibarr.fr>
-- Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net> -- Copyright (C) 2011-2012 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> -- Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
-- --
-- This program is free software; you can redistribute it and/or modify -- This program is free software; you can redistribute it and/or modify
@ -42,12 +42,12 @@ create table llx_expedition
tracking_number varchar(50), tracking_number varchar(50),
fk_statut smallint DEFAULT 0, fk_statut smallint DEFAULT 0,
height integer, height integer, -- height
width integer, width integer, -- with
size_units integer, size_units integer, -- unit of all sizes (height, width, depth)
size integer, size integer, -- depth
weight_units integer, weight_units integer, -- unit of weight
weight integer, weight integer, -- weight
note text, note text,
model_pdf varchar(255) model_pdf varchar(255)

View File

@ -124,3 +124,7 @@ BankCode=Codi banc
DeskCode=Codi oficina DeskCode=Codi oficina
BankAccountNumber=Número compte BankAccountNumber=Número compte
BankAccountNumberKey=Dígit Control BankAccountNumberKey=Dígit Control
## filters
FilterableFields=Camps filtrables
FilteredFields=Campos filtrats
FilteredFieldsValues=Valors de filtres

View File

@ -43,3 +43,4 @@ Language_sl_SI=Eslovè
Language_sv_SV=Suec Language_sv_SV=Suec
Language_sv_SE=Suec Language_sv_SE=Suec
Language_zh_CN=Xinès Language_zh_CN=Xinès
Language_zh_TW=Xinès (Tradicional)

View File

@ -76,41 +76,6 @@ MailingModuleDescDolibarrUsers=All Dolibarr users with emails
MailingModuleDescFundationMembers=Foundation members with emails MailingModuleDescFundationMembers=Foundation members with emails
MailingModuleDescEmailsFromFile=EMails from a text file (email;name;surname;comments) MailingModuleDescEmailsFromFile=EMails from a text file (email;name;surname;comments)
MailingModuleDescContactsCategories=Στοιχεία με emails (ανά κατηγορία) MailingModuleDescContactsCategories=Στοιχεία με emails (ανά κατηγορία)
MailingModuleDescDolibarrContractsLinesExpired=Third parties with expired contract's lines
LineInFile=Line %s in file
RecipientSelectionModules=Defined requests for recipient's selection
MailSelectedRecipients=Selected recipients
MailingArea=EMailings area
LastMailings=Last %s emailings
TargetsStatistics=Targets statistics
NbOfCompaniesContacts=Unique contacts of companies
MailNoChangePossible=Recipients for validated emailing can't be changed
SearchAMailing=Search mailing
SendMailing=Send emailing
SendMail=Send email
SentBy=Sent by
MailingNeedCommand=For securities reason, sending an emailing should be performed from command line. Ask your administrator to launch the following command to send the emailing to all recipients:
MailingNeedCommand2=You can however send them online by adding parameter MAILING_LIMIT_SENDBYWEB with value of max number of emails you want to send by session. For this, go on Home - Setup - Other.
ConfirmSendingEmailing=Are you sure you want to send mailing ?
LimitSendingEmailing=On line sending of emailings are limited for security and timeout reasons to <b>%s</b> recipients by sending session.
TargetsReset=Clear list
ToClearAllRecipientsClickHere=Click here to clear the recipient list for this emailing
ToAddRecipientsChooseHere=Add recipients by choosing from the lists
NbOfEMailingsReceived=Mass emailings received
IdRecord=ID record
DeliveryReceipt=Delivery Receipt
YouCanUseCommaSeparatorForSeveralRecipients=You can use the <b>comma</b> separator to specify several recipients.
# Module Notifications
Notifications=Notifications
NoNotificationsWillBeSent=No email notifications are planned for this event and company
ANotificationsWillBeSent=1 notification will be sent by email
SomeNotificationsWillBeSent=%s notifications will be sent by email
AddNewNotification=Activate a new email notification request
ListOfActiveNotifications=List all active email notification requests
ListOfNotificationsDone=List all email notifications sent
// START - Lines generated via autotranslator.php tool (2011-06-26 15:35:22). // START - Lines generated via autotranslator.php tool (2011-06-26 15:35:22).
// Reference language: en_US -> el_GR // Reference language: en_US -> el_GR

View File

@ -115,7 +115,7 @@ CSVFormatDesc=<b>Comma Separated Value</b> file format (.csv).<br>This is a text
Excel95FormatDesc=<b>Excel</b> file format (.xls)<br>This is native Excel 95 format (BIFF5). Excel95FormatDesc=<b>Excel</b> file format (.xls)<br>This is native Excel 95 format (BIFF5).
Excel2007FormatDesc=<b>Excel</b> file format (.xlsx)<br>This is native Excel 2007 format (SpreadsheetML). Excel2007FormatDesc=<b>Excel</b> file format (.xlsx)<br>This is native Excel 2007 format (SpreadsheetML).
TsvFormatDesc=<b>Tab Separated Value</b> file format (.tsv)<br>This is a text file format where fields are separated by a tabulator [tab]. TsvFormatDesc=<b>Tab Separated Value</b> file format (.tsv)<br>This is a text file format where fields are separated by a tabulator [tab].
ExportFieldAutomaticallyAdded=Field <b>%s</b> was automatically added. It will avoid you to have similar lines to be treated as duplicate records (with this field added, all ligne will own its own id and will differ). ExportFieldAutomaticallyAdded=Field <b>%s</b> was automatically added. It will avoid you to have similar lines to be treated as duplicate records (with this field added, all lines will own their own id and will differ).
CsvOptions=Csv Options CsvOptions=Csv Options
Separator=Separator Separator=Separator
Enclosure=Enclosure Enclosure=Enclosure

View File

@ -24,6 +24,7 @@ ConfirmDeleteInterventionLine=Are you sure you want to delete this intervention
NameAndSignatureOfInternalContact=Name and signature of intervening : NameAndSignatureOfInternalContact=Name and signature of intervening :
NameAndSignatureOfExternalContact=Name and signature of customer : NameAndSignatureOfExternalContact=Name and signature of customer :
DocumentModelStandard=Standard document model for interventions DocumentModelStandard=Standard document model for interventions
InterventionCardsAndInterventionLines=Interventions and lines of interventions
ClassifyBilled=Classify "Billed" ClassifyBilled=Classify "Billed"
StatusInterInvoiced=Billed StatusInterInvoiced=Billed
RelatedInterventions=Related interventions RelatedInterventions=Related interventions

View File

@ -77,8 +77,9 @@ MailingStatusRead=Read
CheckRead=Read Receipt CheckRead=Read Receipt
YourMailUnsubcribeOK=The email <b>%s</b> is correctly unsubcribe from mailing list YourMailUnsubcribeOK=The email <b>%s</b> is correctly unsubcribe from mailing list
MailtoEMail=Hyper link to email MailtoEMail=Hyper link to email
ActivateCheckRead=Allow to use the Read receipt tracker and the unsubcribe link ActivateCheckRead=Allow to use the "Read receipt" tracker and the "Unsubcribe" link
ActivateCheckReadKey=Key use to encrypt URL use for Read Receipt and unsubcribe function ActivateCheckReadKey=Key use to encrypt URL use for "Read Receipt" and "Unsubcribe" feature
EMailSentToNRecipients=EMail sent to %s recipients.
# Libelle des modules de liste de destinataires mailing # Libelle des modules de liste de destinataires mailing
MailingModuleDescContactCompanies=Contacts of all third parties (customer, prospect, supplier, ...) MailingModuleDescContactCompanies=Contacts of all third parties (customer, prospect, supplier, ...)
@ -105,7 +106,7 @@ SearchAMailing=Search mailing
SendMailing=Send emailing SendMailing=Send emailing
SendMail=Send email SendMail=Send email
SentBy=Sent by SentBy=Sent by
MailingNeedCommand=For security reason, sending an emailing should be performed from command line. Ask your administrator to launch the following command to send the emailing to all recipients: MailingNeedCommand=For security reason, sending an emailing is better when performed from command line. Ask your administrator to launch the following command to send the emailing to all recipients:
MailingNeedCommand2=You can however send them online by adding parameter MAILING_LIMIT_SENDBYWEB with value of max number of emails you want to send by session. For this, go on Home - Setup - Other. MailingNeedCommand2=You can however send them online by adding parameter MAILING_LIMIT_SENDBYWEB with value of max number of emails you want to send by session. For this, go on Home - Setup - Other.
ConfirmSendingEmailing=Are you sure you want to send emailing without command line and from web mode ? ConfirmSendingEmailing=Are you sure you want to send emailing without command line and from web mode ?
LimitSendingEmailing=On line sending of emailings are limited for security and timeout reasons to <b>%s</b> recipients by sending session. LimitSendingEmailing=On line sending of emailings are limited for security and timeout reasons to <b>%s</b> recipients by sending session.

View File

@ -93,6 +93,7 @@ CloneFiles=Clone joined files
ConfirmCloneProject=Are you sure to clone this project ? ConfirmCloneProject=Are you sure to clone this project ?
ProjectReportDate=Change task date according project start date ProjectReportDate=Change task date according project start date
ErrorShiftTaskDate=Impossible to shift task date according to new project start date ErrorShiftTaskDate=Impossible to shift task date according to new project start date
ProjectsAndTasksLines=Projects and tasks
##### Types de contacts ##### ##### Types de contacts #####
TypeContact_project_internal_PROJECTLEADER=Project leader TypeContact_project_internal_PROJECTLEADER=Project leader
TypeContact_project_external_PROJECTLEADER=Project leader TypeContact_project_external_PROJECTLEADER=Project leader

View File

@ -58,6 +58,7 @@ ActionsOnShipping=Events on shipment
LinkToTrackYourPackage=Link to track your package LinkToTrackYourPackage=Link to track your package
ShipmentCreationIsDoneFromOrder=For the moment, creation of a new shipment is done from the order card. ShipmentCreationIsDoneFromOrder=For the moment, creation of a new shipment is done from the order card.
RelatedShippings=Related shippings RelatedShippings=Related shippings
ShipmentLine=Shipment line
# Sending methods # Sending methods
SendingMethodCATCH=Catch by customer SendingMethodCATCH=Catch by customer

View File

@ -124,3 +124,7 @@ BankCode=Código banco
DeskCode=Código oficina DeskCode=Código oficina
BankAccountNumber=Número cuenta BankAccountNumber=Número cuenta
BankAccountNumberKey=Dígito Control BankAccountNumberKey=Dígito Control
## filters
FilterableFields=Campos filtrables
FilteredFields=Campos filtrados
FilteredFieldsValues=Valores de filtros

View File

@ -46,3 +46,4 @@ Language_sl_SI=Esloveno
Language_sv_SV=Sueco Language_sv_SV=Sueco
Language_sv_SE=Sueco Language_sv_SE=Sueco
Language_zh_CN=Chino Language_zh_CN=Chino
Language_zh_TW=Chino (Tradicional)

View File

@ -75,17 +75,18 @@ DateSending=Date envoi
SentTo=Envoyés à <b>%s</b> SentTo=Envoyés à <b>%s</b>
MailingStatusRead=Lu MailingStatusRead=Lu
CheckRead=Accusé de lecture CheckRead=Accusé de lecture
YourMailUnsubcribeOK=L'adresse e-mail <b>%s</b> est bien désincrite de la liste. YourMailUnsubcribeOK=L'adresse e-mail <b>%s</b> est bien désinscrite de la liste.
MailtoEMail=Ecrire a e-mail (lien) MailtoEMail=Ecrire un e-mail (lien)
ActivateCheckRead=Permettre l'utilisation du tracker d'accusé de lecture et du lien de désincription ActivateCheckRead=Permettre l'utilisation du tracker d'accusé de lecture et du lien de désinscription
ActivateCheckReadKey=Clef de sécurité utilisée pour l'encryption des URL utilisées dans les fonctions d'accusé de lecture et de désincription ActivateCheckReadKey=Clef de sécurité permettant l'encryption des URL utilisées dans les fonctions d'accusé de lecture et de désinscription
EMailSentToNRecipients=EMail envoyé à %s destinataires.
# Libelle des modules de liste de destinataires mailing # Libelle des modules de liste de destinataires mailing
MailingModuleDescContactCompanies=Contacts de tiers (prospects, clients, fournisseurs...) MailingModuleDescContactCompanies=Contacts de tiers (prospects, clients, fournisseurs...)
MailingModuleDescDolibarrUsers=Utilisateurs de Dolibarr MailingModuleDescDolibarrUsers=Utilisateurs de Dolibarr
MailingModuleDescFundationMembers=Adhérents MailingModuleDescFundationMembers=Adhérents
MailingModuleDescEmailsFromFile=EMails issus d'un fichier texte (email;nom;prenom;autre) MailingModuleDescEmailsFromFile=EMails issus d'un fichier texte (email;nom;prenom;autre)
MailingModuleDescEmailsFromUser=EMails saisi manuellement (email;nom;prenom;autre) MailingModuleDescEmailsFromUser=EMails saisis manuellement (email;nom;prenom;autre)
MailingModuleDescContactsCategories=Tiers (par catégorie) MailingModuleDescContactsCategories=Tiers (par catégorie)
MailingModuleDescDolibarrContractsLinesExpired=Tiers avec lignes de contrats de services expirées MailingModuleDescDolibarrContractsLinesExpired=Tiers avec lignes de contrats de services expirées
MailingModuleDescContactsByCompanyCategory=Contacts de tiers (par catégorie de tiers) MailingModuleDescContactsByCompanyCategory=Contacts de tiers (par catégorie de tiers)
@ -105,11 +106,11 @@ SendMailing=Envoi emailing
SendMail=Envoi mail SendMail=Envoi mail
SentBy=Envoyé par SentBy=Envoyé par
MailingNeedCommand=Pour des raisons de sécurité, il est recommandé de faire les envois d'un mailing de masse depuis une ligne de commande. Demandez à votre administrateur de lancer la commande suivante pour envoyer le mailing à tous les destinataires : MailingNeedCommand=Pour des raisons de sécurité, il est recommandé de faire les envois d'un mailing de masse depuis une ligne de commande. Demandez à votre administrateur de lancer la commande suivante pour envoyer le mailing à tous les destinataires :
MailingNeedCommand2=Vous pouvez toutefois quand même les envoyer par l'interface écrans en ajoutant le paramètre MAILING_LIMIT_SENDBYWEB avec la valeur du nombre max de mails envoyés par session d'envoi. Pour cela, aller dans Accueil - Configuration - Divers. MailingNeedCommand2=Vous pouvez toutefois quand même les envoyer par l'interface écran en ajoutant le paramètre MAILING_LIMIT_SENDBYWEB avec la valeur du nombre max de mails envoyés par session d'envoi. Pour cela, aller dans Accueil - Configuration - Divers.
ConfirmSendingEmailing=Confirmez-vous l'envoi de l'emailing depuis le mode web ? ConfirmSendingEmailing=Confirmez-vous l'envoi de l'emailing depuis le mode web ?
LimitSendingEmailing=L'envoi d'un emailing depuis les écrans est limité pour raisons de sécurité et de timeout à <b>%s</b> destinataires par session d'envoi. LimitSendingEmailing=L'envoi d'un emailing depuis les écrans est limité pour raisons de sécurité et de timeout à <b>%s</b> destinataires par session d'envoi.
TargetsReset=Vider liste TargetsReset=Vider liste
ToClearAllRecipientsClickHere=Pour vider la liste des destinataires de cet emailing, cliquer le bouton ToClearAllRecipientsClickHere=Pour vider la liste des destinataires de cet emailing, cliquez sur le bouton
ToAddRecipientsChooseHere=Pour ajouter des destinataires, choisir dans les listes ci-dessous ToAddRecipientsChooseHere=Pour ajouter des destinataires, choisir dans les listes ci-dessous
NbOfEMailingsReceived=EMailings de masse reçus NbOfEMailingsReceived=EMailings de masse reçus
IdRecord=ID enregistrement IdRecord=ID enregistrement

View File

@ -93,6 +93,7 @@ CloneFiles=Cloner les pièces jointes
ConfirmCloneProject=Êtes-vous sûr de vouloir cloner ce projet ? ConfirmCloneProject=Êtes-vous sûr de vouloir cloner ce projet ?
ProjectReportDate=Reporter les dates des taches en fonction de la date de départ. ProjectReportDate=Reporter les dates des taches en fonction de la date de départ.
ErrorShiftTaskDate=Une erreur c'est produite dans le report des dates des taches. ErrorShiftTaskDate=Une erreur c'est produite dans le report des dates des taches.
ProjectsAndTasksLines=Projets et taches
##### Types de contacts ##### ##### Types de contacts #####
TypeContact_project_internal_PROJECTLEADER=Chef de projet TypeContact_project_internal_PROJECTLEADER=Chef de projet
TypeContact_project_external_PROJECTLEADER=Chef de projet TypeContact_project_external_PROJECTLEADER=Chef de projet

View File

@ -58,6 +58,7 @@ ActionsOnShipping=Événements sur l'expédition
LinkToTrackYourPackage=Lien pour suivi de votre colis LinkToTrackYourPackage=Lien pour suivi de votre colis
ShipmentCreationIsDoneFromOrder=Pour le moment, la création d'une nouvelle expédition se fait depuis la fiche commande. ShipmentCreationIsDoneFromOrder=Pour le moment, la création d'une nouvelle expédition se fait depuis la fiche commande.
RelatedShippings=Expédition(s) associée(s) RelatedShippings=Expédition(s) associée(s)
ShipmentLine=Ligne d'expédition
# Sending methods # Sending methods
SendingMethodCATCH=Enlèvement par le client SendingMethodCATCH=Enlèvement par le client

View File

@ -40,8 +40,8 @@ TransData=Date Transmission
TransMetod=Méthode Transmission TransMetod=Méthode Transmission
Send=Envoyer Send=Envoyer
Lines=Lignes Lines=Lignes
StandingOrderReject=Emmètre un rejet StandingOrderReject=Émettre un rejet
InvoiceRefused=Facture rejeté InvoiceRefused=Facture rejetée
WithdrawalRefused=Rejet de prélèvement WithdrawalRefused=Rejet de prélèvement
WithdrawalRefusedConfirm=Êtes-vous sûr de vouloir saisir un rejet de prélèvement pour la société WithdrawalRefusedConfirm=Êtes-vous sûr de vouloir saisir un rejet de prélèvement pour la société
RefusedData=Date du rejet RefusedData=Date du rejet
@ -70,25 +70,25 @@ CreateBanque=Seulement banque
OrderWaiting=En attente de traitement OrderWaiting=En attente de traitement
NotifyTransmision=Transmission du bon NotifyTransmision=Transmission du bon
NotifyEmision=Emission du bon NotifyEmision=Emission du bon
NotifyCredit=Credit du bon NotifyCredit=Crédit du bon
NumeroNationalEmetter= Numéro National Émetteur NumeroNationalEmetter= Numéro National Émetteur
PleaseSelectCustomerBankBANToWithdraw=Saisissez les informations du compte bancaire client à prélever PleaseSelectCustomerBankBANToWithdraw=Saisissez les informations du compte bancaire client à prélever
WithBankUsingRIB=Pour les comptes bancaires utilisant le RIB WithBankUsingRIB=Pour les comptes bancaires utilisant le RIB
WithBankUsingBANBIC=Pour les comptes bancaires utilisant le code BAN/BIC/SWIFT WithBankUsingBANBIC=Pour les comptes bancaires utilisant le code BAN/BIC/SWIFT
BankToReceiveWithdraw=Compte bancaire recevant les prélèvements BankToReceiveWithdraw=Compte bancaire recevant les prélèvements
CreditDate=Crédité le CreditDate=Crédité le
WithdrawalFileNotCapable=Impossible de generer fichier de bon de prelevements pour votre pays WithdrawalFileNotCapable=Impossible de générer un fichier de bons de prélèvements pour votre pays
ShowWithdraw=Voir prélèvement ShowWithdraw=Voir prélèvement
IfInvoiceNeedOnWithdrawPaymentWontBeClosed=Toutefois, si la facture a au moins un paiement par prélèvement non traité, elle ne le sera pas afin de permettre la gestion du prélèvement d'abord. IfInvoiceNeedOnWithdrawPaymentWontBeClosed=Toutefois, si la facture a au moins un paiement par prélèvement non traité, elle ne le sera pas afin de permettre la gestion du prélèvement d'abord.
DoStandingOrdersBeforePayments=Cet onglet permet de faire une demande de pélèvement bancaire. Une fois réalisé, vous pourrez saisir le paiement sur la facture pour la clore. DoStandingOrdersBeforePayments=Cet onglet permet de faire une demande de prélèvement bancaire. Une fois réalisé, vous pourrez saisir le paiement sur la facture pour la clore.
### Notifications ### Notifications
InfoCreditSubject=Credit prélèvement %s a la banque InfoCreditSubject=Crédit prélèvement %s à la banque
InfoCreditMessage=Le bon de prélèvement %s a eté credité par la banque.<br>Date credit : %s InfoCreditMessage=Le bon de prélèvement %s a été crédité par la banque.<br>Date crédit : %s
InfoTransSubject=Transmission du prélèvement %s a la banque InfoTransSubject=Transmission du prélèvement %s à la banque
InfoTransMessage=Le bon de prélèvement %s a eté transmis a la banque par %s %s.<br><br> InfoTransMessage=Le bon de prélèvement %s a été transmis à la banque par %s %s.<br><br>
InfoTransData=Montant: %s<br>Methode: %s<br>Date: %s InfoTransData=Montant: %s<br>Méthode: %s<br>Date: %s
InfoFoot=Ceci est un message automatique envoye par Dolibarr InfoFoot=Ceci est un message automatique envoyé par Dolibarr
InfoRejectSubject=Prélèvement rejeté InfoRejectSubject=Prélèvement rejeté
InfoRejectMessage=Bonjour,<br><br>Le prelevement de la facture %s pour le compte de la societé %s, d'un montant de %s a été rejeté par la banque.<br><br>--<br>%$ InfoRejectMessage=Bonjour,<br><br>Le prélèvement de la facture %s pour le compte de la société %s, d'un montant de %s a été rejeté par la banque.<br><br>--<br>%$
ModeWarning=Option mode réel non établi, nous allons arrêter après cette simulation ModeWarning=Option mode réel non établi, nous allons arrêter après cette simulation

View File

@ -946,13 +946,10 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
if (! $disablejs && ! empty($conf->use_javascript_ajax)) if (! $disablejs && ! empty($conf->use_javascript_ajax))
{ {
$ext='.js'; $ext='.js';
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) {
$ext='.jgz';
} // mini='_mini', ext='.gz'
// JQuery. Must be before other includes // JQuery. Must be before other includes
print '<!-- Includes JS for JQuery -->'."\n"; print '<!-- Includes JS for JQuery -->'."\n";
if (constant('JS_JQUERY')) print '<script type="text/javascript" src="'.JS_JQUERY.'jquery.min.js"></script>'."\n"; if (constant('JS_JQUERY')) print '<script type="text/javascript" src="'.JS_JQUERY.'jquery.min'.$ext.'"></script>'."\n";
else print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-latest.min'.$ext.'"></script>'."\n"; else print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-latest.min'.$ext.'"></script>'."\n";
if (constant('JS_JQUERY_UI')) print '<script type="text/javascript" src="'.JS_JQUERY_UI.'jquery-ui.min.js"></script>'."\n"; if (constant('JS_JQUERY_UI')) print '<script type="text/javascript" src="'.JS_JQUERY_UI.'jquery-ui.min.js"></script>'."\n";
else print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-ui-latest.custom.min'.$ext.'"></script>'."\n"; else print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-ui-latest.custom.min'.$ext.'"></script>'."\n";

View File

@ -212,6 +212,6 @@ if (! defined('NOREQUIRETRAN'))
if (! defined('MAIN_LABEL_MENTION_NPR') ) define('MAIN_LABEL_MENTION_NPR','NPR'); if (! defined('MAIN_LABEL_MENTION_NPR') ) define('MAIN_LABEL_MENTION_NPR','NPR');
// We force feature to help debug // We force feature to help debug
$conf->global->MAIN_JS_ON_PAYMENT=0; // We set to zero to unifrmize way of working between customer and supplier payments //$conf->global->MAIN_JS_ON_PAYMENT=0;
?> ?>

View File

@ -36,6 +36,9 @@ function llxHeaderPaypal($title, $head = "")
header("Content-type: text/html; charset=".$conf->file->character_set_client); header("Content-type: text/html; charset=".$conf->file->character_set_client);
$appli='Dolibarr';
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE;
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'; print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
//print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd>'; //print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd>';
print "\n"; print "\n";
@ -43,7 +46,7 @@ function llxHeaderPaypal($title, $head = "")
print "<head>\n"; print "<head>\n";
print '<meta name="robots" content="noindex,nofollow">'."\n"; print '<meta name="robots" content="noindex,nofollow">'."\n";
print '<meta name="keywords" content="dolibarr,payment,online">'."\n"; print '<meta name="keywords" content="dolibarr,payment,online">'."\n";
print '<meta name="description" content="Welcome on Dolibarr online payment form">'."\n"; print '<meta name="description" content="Welcome on '.$appli.' online payment form">'."\n";
print "<title>".$title."</title>\n"; print "<title>".$title."</title>\n";
if ($head) print $head."\n"; if ($head) print $head."\n";
if (! empty($conf->global->PAYPAL_CSS_URL)) print '<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYPAL_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n"; if (! empty($conf->global->PAYPAL_CSS_URL)) print '<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYPAL_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
@ -63,9 +66,6 @@ function llxHeaderPaypal($title, $head = "")
// Output standard javascript links // Output standard javascript links
$ext='.js'; $ext='.js';
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) {
$ext='.jgz';
} // mini='_mini', ext='.gz'
// JQuery. Must be before other includes // JQuery. Must be before other includes
print '<!-- Includes JS for JQuery -->'."\n"; print '<!-- Includes JS for JQuery -->'."\n";
@ -73,8 +73,8 @@ function llxHeaderPaypal($title, $head = "")
// jQuery jnotify // jQuery jnotify
if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY)) if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY))
{ {
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jnotify/jquery.jnotify.min.js"></script>'."\n"; print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jnotify/jquery.jnotify.min'.$ext.'"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/jnotify.js"></script>'."\n"; print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/jnotify'.$ext.'"></script>'."\n";
} }
} }
print "</head>\n"; print "</head>\n";

View File

@ -512,6 +512,9 @@ else
/* /*
* Creation * Creation
*/ */
$private=GETPOST("private","int");
if (! empty($conf->global->MAIN_THIRPARTY_CREATION_INDIVIDUAL) && ! isset($_GET['private']) && ! isset($_POST['private'])) $private=1;
if (empty($private)) $private=0;
// Load object modCodeTiers // Load object modCodeTiers
$module=(! empty($conf->global->SOCIETE_CODECLIENT_ADDON)?$conf->global->SOCIETE_CODECLIENT_ADDON:'mod_codeclient_leopard'); $module=(! empty($conf->global->SOCIETE_CODECLIENT_ADDON)?$conf->global->SOCIETE_CODECLIENT_ADDON:'mod_codeclient_leopard');
@ -545,11 +548,10 @@ else
if (GETPOST("type")=='c') { $object->client=1; } if (GETPOST("type")=='c') { $object->client=1; }
if (GETPOST("type")=='p') { $object->client=2; } if (GETPOST("type")=='p') { $object->client=2; }
if (! empty($conf->fournisseur->enabled) && (GETPOST("type")=='f' || GETPOST("type")=='')) { $object->fournisseur=1; } if (! empty($conf->fournisseur->enabled) && (GETPOST("type")=='f' || GETPOST("type")=='')) { $object->fournisseur=1; }
if (GETPOST("private")==1) { $object->particulier=1; }
$object->name = GETPOST('nom'); $object->name = GETPOST('nom');
$object->firstname = GETPOST('prenom'); $object->firstname = GETPOST('prenom');
$object->particulier = GETPOST('private', 'int'); $object->particulier = $private;
$object->prefix_comm = GETPOST('prefix_comm'); $object->prefix_comm = GETPOST('prefix_comm');
$object->client = GETPOST('client')?GETPOST('client'):$object->client; $object->client = GETPOST('client')?GETPOST('client'):$object->client;
$object->code_client = GETPOST('code_client'); $object->code_client = GETPOST('code_client');
@ -638,7 +640,7 @@ else
print '$(document).ready(function () { print '$(document).ready(function () {
id_te_private=8; id_te_private=8;
id_ef15=1; id_ef15=1;
is_private='.(GETPOST("private")?GETPOST("private"):0).'; is_private='.$private.';
if (is_private) { if (is_private) {
$(".individualline").show(); $(".individualline").show();
} else { } else {
@ -667,10 +669,10 @@ else
print "<br>\n"; print "<br>\n";
print $langs->trans("ThirdPartyType").': &nbsp; '; print $langs->trans("ThirdPartyType").': &nbsp; ';
print '<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.(! GETPOST("private")?' checked="checked"':''); print '<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.($private?'':' checked="checked"');
print '> '.$langs->trans("Company/Fundation"); print '> '.$langs->trans("Company/Fundation");
print ' &nbsp; &nbsp; '; print ' &nbsp; &nbsp; ';
print '<input type="radio" id="radioprivate" class="flat" name="private" value="1"'.(! GETPOST("private")?'':' checked="checked"'); print '<input type="radio" id="radioprivate" class="flat" name="private" value="1"'.($private?' checked="checked"':'');
print '> '.$langs->trans("Individual"); print '> '.$langs->trans("Individual");
print ' ('.$langs->trans("ToCreateContactWithSameName").')'; print ' ('.$langs->trans("ToCreateContactWithSameName").')';
print "<br>\n"; print "<br>\n";
@ -693,7 +695,7 @@ else
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Name, firstname // Name, firstname
if ($object->particulier || GETPOST("private")) if ($object->particulier || $private)
{ {
print '<tr><td><span id="TypeName" class="fieldrequired">'.$langs->trans('LastName').'</span></td><td'.(empty($conf->global->SOCIETE_USEPREFIX)?' colspan="3"':'').'><input type="text" size="30" maxlength="60" name="nom" value="'.$object->name.'"></td>'; print '<tr><td><span id="TypeName" class="fieldrequired">'.$langs->trans('LastName').'</span></td><td'.(empty($conf->global->SOCIETE_USEPREFIX)?' colspan="3"':'').'><input type="text" size="30" maxlength="60" name="nom" value="'.$object->name.'"></td>';
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field

View File

@ -1441,7 +1441,7 @@ font-family: <?php print $fontlist ?>;
.ok { color: #114466; } .ok { color: #114466; }
.warning { color: #887711; } .warning { color: #887711; }
.error { color: #550000; font-weight: bold; } .error { color: #550000 !important; font-weight: bold; }
td.highlights { background: #f9c5c6; } td.highlights { background: #f9c5c6; }

View File

@ -1595,7 +1595,7 @@ font-family: <?php print $fontlist ?>;
.ok { color: #114466; } .ok { color: #114466; }
.warning { color: #887711; } .warning { color: #887711; }
.error { color: #550000; font-weight: bold; } .error { color: #550000 !important; font-weight: bold; }
td.highlights { background: #f9c5c6; } td.highlights { background: #f9c5c6; }

View File

@ -52,9 +52,8 @@ if (isset($conf->modules_parts['css']))
} }
// JQuery. Must be before other includes // JQuery. Must be before other includes
$ext='.js'; $ext='.js';
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) $ext='.jgz';
print '<!-- Includes JS for JQuery -->'."\n"; print '<!-- Includes JS for JQuery -->'."\n";
if (constant('JS_JQUERY')) print '<script type="text/javascript" src="'.JS_JQUERY.'jquery.min.js"></script>'."\n"; if (constant('JS_JQUERY')) print '<script type="text/javascript" src="'.JS_JQUERY.'jquery.min'.$ext.'"></script>'."\n";
else print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-latest.min'.$ext.'"></script>'."\n"; else print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-latest.min'.$ext.'"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/dst.js"></script>'."\n"; print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/dst.js"></script>'."\n";
print '<link rel="stylesheet" type="text/css" href="'.dol_escape_htmltag($conf_css).'" /> print '<link rel="stylesheet" type="text/css" href="'.dol_escape_htmltag($conf_css).'" />

View File

@ -53,9 +53,8 @@ if (isset($conf->modules_parts['css']))
} }
// JQuery. Must be before other includes // JQuery. Must be before other includes
$ext='.js'; $ext='.js';
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) $ext='.jgz';
print '<!-- Includes JS for JQuery -->'."\n"; print '<!-- Includes JS for JQuery -->'."\n";
if (constant('JS_JQUERY')) print '<script type="text/javascript" src="'.JS_JQUERY.'jquery.min.js"></script>'."\n"; if (constant('JS_JQUERY')) print '<script type="text/javascript" src="'.JS_JQUERY.'jquery.min'.$ext.'"></script>'."\n";
else print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-latest.min'.$ext.'"></script>'."\n"; else print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-latest.min'.$ext.'"></script>'."\n";
print '<link rel="stylesheet" type="text/css" href="'.dol_escape_htmltag($conf_css).'" />'."\n"; print '<link rel="stylesheet" type="text/css" href="'.dol_escape_htmltag($conf_css).'" />'."\n";
if (! empty($conf->global->MAIN_HTML_HEADER)) print $conf->global->MAIN_HTML_HEADER; if (! empty($conf->global->MAIN_HTML_HEADER)) print $conf->global->MAIN_HTML_HEADER;

View File

@ -1511,7 +1511,7 @@ font-family: <?php print $fontlist ?>;
*/ */
.ok { color: #114466; } .ok { color: #114466; }
.warning { color: #887711; } .warning { color: #887711; }
.error { color: #550000; font-weight: bold; } .error { color: #550000 !important; font-weight: bold; }
div.ok { div.ok {
color: #114466; color: #114466;

View File

@ -1762,9 +1762,7 @@ tr.fiche {
*/ */
.ok { color: #114466; } .ok { color: #114466; }
.warning { color: #887711; } .warning { color: #887711; }
.error { color: #550000; font-weight: bold; } .error { color: #550000 !important; font-weight: bold; }
td.highlights { background: #f9c5c6; }
div.ok { div.ok {
color: #114466; color: #114466;

View File

@ -0,0 +1,98 @@
<?php
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 JF FERRY <jfefe@aternatik.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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* \file htdocs/webservices/demo_wsclient_category.php
* \brief Demo page to make a category call to Dolibarr WebServices "server_category"
*/
// This is to make Dolibarr working with Plesk
set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
require_once("../master.inc.php");
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
$WS_DOL_URL = $dolibarr_main_url_root.'/webservices/server_category.php';
$WS_METHOD = 'getCategory';
// Set the WebService URL
dol_syslog("Create nusoap_client for URL=".$WS_DOL_URL);
$soapclient = new nusoap_client($WS_DOL_URL);
if ($soapclient)
{
$soapclient->soap_defencoding='UTF-8';
}
$soapclient2 = new nusoap_client($WS_DOL_URL);
if ($soapclient2)
{
$soapclient2->soap_defencoding='UTF-8';
}
// Call the WebService method and store its result in $result.
$authentication=array(
'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
'sourceapplication'=>'DEMO',
'login'=>'admin',
'password'=>'changeme',
'entity'=>'');
$parameters = array('authentication'=>$authentication,'id'=>1);
dol_syslog("Call method ".$WS_METHOD);
$result = $soapclient->call($WS_METHOD,$parameters);
if (! $result)
{
var_dump($soapclient);
print '<h2>Erreur SOAP 1</h2>'.$soapclient->error_str;
exit;
}
/*
* View
*/
header("Content-type: text/html; charset=utf8");
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'."\n";
echo '<html>'."\n";
echo '<head>';
echo '<title>WebService Test: '.$WS_METHOD.'</title>';
echo '</head>'."\n";
echo '<body>'."\n";
echo "<h2>Request 1:</h2>";
echo '<h4>Function</h4>';
echo $WS_METHOD;
echo '<h4>SOAP Message</h4>';
echo '<pre>' . htmlspecialchars($soapclient->request, ENT_QUOTES) . '</pre>';
echo '<hr>';
echo "<h2>Response:</h2>";
echo '<h4>Result</h4>';
echo '<pre>';
print_r($result);
echo '</pre>';
echo '<h4>SOAP Message</h4>';
echo '<pre>' . htmlspecialchars($soapclient->response, ENT_QUOTES) . '</pre>';
echo '</body>'."\n";;
echo '</html>'."\n";;
?>

View File

@ -0,0 +1,141 @@
<?php
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/webservices/demo_wsclient_order.php
* \brief Demo page to make a client call to Dolibarr WebServices "server_order"
*/
// This is to make Dolibarr working with Plesk
set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
require_once '../master.inc.php';
require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP
$WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_order.php';
//$WS_DOL_URL = 'http://localhost:8080/'; // To test with Soapui mock. If not a page, should end with /
$WS_METHOD1 = 'getOrder';
$WS_METHOD2 = 'getOrdersForThirdParty';
$ns='http://www.dolibarr.org/ns/';
// Set the WebService URL
dol_syslog("Create nusoap_client for URL=".$WS_DOL_URL);
$soapclient1 = new nusoap_client($WS_DOL_URL);
if ($soapclient1)
{
$soapclient1->soap_defencoding='UTF-8';
$soapclient1->decodeUTF8(false);
}
$soapclient2 = new nusoap_client($WS_DOL_URL);
if ($soapclient2)
{
$soapclient2->soap_defencoding='UTF-8';
$soapclient2->decodeUTF8(false);
}
// Call the WebService method and store its result in $result.
$authentication=array(
'dolibarrkey'=>$conf->global->WEBSERVICES_KEY,
'sourceapplication'=>'DEMO',
'login'=>'admin',
'password'=>'changeme',
'entity'=>'');
// Test url 1
if ($WS_METHOD1)
{
$parameters = array('authentication'=>$authentication,'id'=>1,'ref'=>'');
dol_syslog("Call method ".$WS_METHOD1);
$result1 = $soapclient1->call($WS_METHOD1,$parameters,$ns,'');
if (! $result1)
{
print $soapclient1->error_str;
print "<br>\n\n";
print $soapclient1->request;
print "<br>\n\n";
print $soapclient1->response;
exit;
}
}
// Test url 2
if ($WS_METHOD2)
{
$parameters = array('authentication'=>$authentication,'idthirdparty'=>'4');
dol_syslog("Call method ".$WS_METHOD2);
$result2 = $soapclient2->call($WS_METHOD2,$parameters,$ns,'');
if (! $result2)
{
print $soapclient2->error_str;
print "<br>\n\n";
print $soapclient2->request;
print "<br>\n\n";
print $soapclient2->response;
exit;
}
}
/*
* View
*/
header("Content-type: text/html; charset=utf8");
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'."\n";
echo '<html>'."\n";
echo '<head>';
echo '<title>WebService Test: '.$WS_METHOD1.'</title>';
echo '</head>'."\n";
echo '<body>'."\n";
echo 'NUSOAP_PATH='.NUSOAP_PATH.'<br>';
echo "<h2>Request:</h2>";
echo '<h4>Function</h4>';
echo $WS_METHOD1;
echo '<h4>SOAP Message</h4>';
echo '<pre>' . htmlspecialchars($soapclient1->request, ENT_QUOTES) . '</pre>';
echo '<hr>';
echo "<h2>Response:</h2>";
echo '<h4>Result</h4>';
echo '<pre>';
print_r($result1);
echo '</pre>';
echo '<h4>SOAP Message</h4>';
echo '<pre>' . htmlspecialchars($soapclient1->response, ENT_QUOTES) . '</pre>';
print '<hr>';
echo "<h2>Request:</h2>";
echo '<h4>Function</h4>';
echo $WS_METHOD2;
echo '<h4>SOAP Message</h4>';
echo '<pre>' . htmlspecialchars($soapclient2->request, ENT_QUOTES) . '</pre>';
echo '<hr>';
echo "<h2>Response:</h2>";
echo '<h4>Result</h4>';
echo '<pre>';
print_r($result2);
echo '</pre>';
echo '<h4>SOAP Message</h4>';
echo '<pre>' . htmlspecialchars($soapclient2->response, ENT_QUOTES) . '</pre>';
echo '</body>'."\n";;
echo '</html>'."\n";;
?>

View File

@ -0,0 +1,307 @@
<?php
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 JF FERRY <jfefe@aternatik.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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* \file htdocs/webservices/server_category.php
* \brief File that is entry point to call Dolibarr WebServices
*/
// This is to make Dolibarr working with Plesk
set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
require_once("../master.inc.php");
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
require_once DOL_DOCUMENT_ROOT.'/core/lib/ws.lib.php';
require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php");
dol_syslog("Call Dolibarr webservices interfaces");
// Enable and test if module web services is enabled
if (empty($conf->global->MAIN_MODULE_WEBSERVICES))
{
$langs->load("admin");
dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled");
print $langs->trans("WarningModuleNotActive",'WebServices').'.<br><br>';
print $langs->trans("ToActivateModule");
exit;
}
// Create the soap Object
$server = new nusoap_server();
$server->soap_defencoding='UTF-8';
$server->decode_utf8=false;
$ns='http://www.dolibarr.org/ns/';
$server->configureWSDL('WebServicesDolibarrCategorie',$ns);
$server->wsdl->schemaTargetNamespace=$ns;
// Define WSDL content
$server->wsdl->addComplexType(
'authentication',
'complexType',
'struct',
'all',
'',
array(
'dolibarrkey' => array('name'=>'dolibarrkey','type'=>'xsd:string'),
'sourceapplication' => array('name'=>'sourceapplication','type'=>'xsd:string'),
'login' => array('name'=>'login','type'=>'xsd:string'),
'password' => array('name'=>'password','type'=>'xsd:string'),
'entity' => array('name'=>'entity','type'=>'xsd:string'),
)
);
/*
* Une catégorie
*/
$server->wsdl->addComplexType(
'categorie',
'complexType',
'struct',
'all',
'',
array(
'id' => array('name'=>'id','type'=>'xsd:string'),
'id_mere' => array('name'=>'id_mere','type'=>'xsd:string'),
'label' => array('name'=>'label','type'=>'xsd:string'),
'description' => array('name'=>'description','type'=>'xsd:string'),
'socid' => array('name'=>'socid','type'=>'xsd:string'),
'type' => array('name'=>'type','type'=>'xsd:string'),
'visible' => array('name'=>'visible','type'=>'xsd:string'),
'dir'=> array('name'=>'dir','type'=>'xsd:string'),
'photos' => array('name'=>'photos','type'=>'tns:PhotosArray'),
'filles' => array('name'=>'filles','type'=>'tns:FillesArray')
)
);
/*
* Les catégories filles, sous tableau dez la catégorie
*/
$server->wsdl->addComplexType(
'FillesArray',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:categorie[]')
),
'tns:categorie'
);
/*
* Tableau des catégories
$server->wsdl->addComplexType(
'categories',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('id'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:categorie[]')
),
'tns:categories'
);
*/
/*
* Les photos de la catégorie (un tableau indéxé qui contient les images avec leur vignette)
*/
$server->wsdl->addComplexType(
'PhotosArray',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:image[]')
),
''
);
/*
* Une photo ( nom image / nom_vignette )
*/
$server->wsdl->addComplexType(
'image',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
'photo' => array('name'=>'photo','type'=>'xsd:string'),
'photo_vignette' => array('name'=>'photo_vignette','type'=>'xsd:string'),
'imgWidth' => array('name'=>'imgWidth','type'=>'xsd:string'),
'imgHeight' => array('name'=>'imgHeight','type'=>'xsd:string')
)
);
/*
* Retour
*/
$server->wsdl->addComplexType(
'result',
'complexType',
'struct',
'all',
'',
array(
'result_code' => array('name'=>'result_code','type'=>'xsd:string'),
'result_label' => array('name'=>'result_label','type'=>'xsd:string'),
)
);
// 5 styles: RPC/encoded, RPC/literal, Document/encoded (not WS-I compliant), Document/literal, Document/literal wrapped
// Style merely dictates how to translate a WSDL binding to a SOAP message. Nothing more. You can use either style with any programming model.
// http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/
$styledoc='rpc'; // rpc/document (document is an extend into SOAP 1.0 to support unstructured messages)
$styleuse='encoded'; // encoded/literal/literal wrapped
// Better choice is document/literal wrapped but literal wrapped not supported by nusoap.
// Register WSDL
$server->register(
'getCategory',
// Entry values
array('authentication'=>'tns:authentication','id'=>'xsd:string'),
// Exit values
array('result'=>'tns:result','categorie'=>'tns:categorie'),
$ns,
$ns.'#getCategory',
$styledoc,
$styleuse,
'WS to get category'
);
/**
* Get category infos and children
*
* @param array $authentication Array of authentication information
* @param int $id Id of object
* @return mixed
*/
function getCategory($authentication,$id)
{
global $db,$conf,$langs;
dol_syslog("Function: getCategory login=".$authentication['login']." id=".$id);
if ($authentication['entity']) $conf->entity=$authentication['entity'];
$objectresp=array();
$errorcode='';$errorlabel='';
$error=0;
$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
if (! $error && !$id)
{
$error++;
$errorcode='BAD_PARAMETERS'; $errorlabel="Parameter id must be provided.";
}
if (! $error)
{
$fuser->getrights();
if ($fuser->rights->categorie->lire)
{
$categorie=new Categorie($db);
$result=$categorie->fetch($id);
if ($result > 0)
{
$dir = (!empty($conf->categorie->dir_output)?$conf->categorie->dir_output:$conf->service->dir_output);
$pdir = get_exdir($categorie->id,2) . $categorie->id ."/photos/";
$dir = $dir . '/'. $pdir;
$cat = array(
'id' => $categorie->id,
'id_mere' => $categorie->id_mere,
'label' => $categorie->label,
'description' => $categorie->description,
'socid' => $categorie->socid,
//'visible'=>$categorie->visible,
'type' => $categorie->type,
'dir' => $pdir,
'photos' => $categorie->liste_photos($dir,$nbmax=10)
);
$cats = $categorie->get_filles();
if (sizeof ($cats) > 0)
{
foreach($cats as $fille)
{
$dir = (!empty($conf->categorie->dir_output)?$conf->categorie->dir_output:$conf->service->dir_output);
$pdir = get_exdir($fille->id,2) . $fille->id ."/photos/";
$dir = $dir . '/'. $pdir;
$cat['filles'][] = array(
'id'=>$fille->id,
'id_mere' => $categorie->id_mere,
'label'=>$fille->label,
'description'=>$fille->description,
'socid'=>$fille->socid,
//'visible'=>$fille->visible,
'type'=>$fille->type,
'dir' => $pdir,
'photos' => $fille->liste_photos($dir,$nbmax=10)
);
}
}
// Create
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'categorie'=> $cat
);
}
else
{
$error++;
$errorcode='NOT_FOUND'; $errorlabel='Object not found for id='.$id;
}
}
else
{
$error++;
$errorcode='PERMISSION_DENIED'; $errorlabel='User does not have permission for this request';
}
}
if ($error)
{
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
}
// Return the results.
$server->service($HTTP_RAW_POST_DATA);
?>

View File

@ -294,7 +294,7 @@ function getInvoice($authentication,$id='',$ref='',$ref_ext='')
$linesresp[]=array( $linesresp[]=array(
'id'=>$line->rowid, 'id'=>$line->rowid,
'type'=>$line->product_type, 'type'=>$line->product_type,
'desc'=>dol_htmlcleanlastbr($line->description), 'desc'=>dol_htmlcleanlastbr($line->desc),
'total_net'=>$line->total_ht, 'total_net'=>$line->total_ht,
'total_vat'=>$line->total_tva, 'total_vat'=>$line->total_tva,
'total'=>$line->total_ttc, 'total'=>$line->total_ttc,

View File

@ -0,0 +1,778 @@
<?php
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 JF FERRY <jfefe@aternatik.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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/webservices/server_order.php
* \brief File that is entry point to call Dolibarr WebServices
*/
// This is to make Dolibarr working with Plesk
set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
require_once '../master.inc.php';
require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP
require_once DOL_DOCUMENT_ROOT.'/core/lib/ws.lib.php';
require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
dol_syslog("Call Dolibarr webservices interfaces");
// Enable and test if module web services is enabled
if (empty($conf->global->MAIN_MODULE_WEBSERVICES))
{
$langs->load("admin");
dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled");
print $langs->trans("WarningModuleNotActive",'WebServices').'.<br><br>';
print $langs->trans("ToActivateModule");
exit;
}
// Create the soap Object
$server = new nusoap_server();
$server->soap_defencoding='UTF-8';
$server->decode_utf8=false;
$ns='http://www.dolibarr.org/ns/';
$server->configureWSDL('WebServicesDolibarrOrder',$ns);
$server->wsdl->schemaTargetNamespace=$ns;
// Define WSDL content
$server->wsdl->addComplexType(
'authentication',
'complexType',
'struct',
'all',
'',
array(
'dolibarrkey' => array('name'=>'dolibarrkey','type'=>'xsd:string'),
'sourceapplication' => array('name'=>'sourceapplication','type'=>'xsd:string'),
'login' => array('name'=>'login','type'=>'xsd:string'),
'password' => array('name'=>'password','type'=>'xsd:string'),
'entity' => array('name'=>'entity','type'=>'xsd:string'),
)
);
$server->wsdl->addComplexType(
'line',
'complexType',
'struct',
'all',
'',
array(
'id' => array('name'=>'id','type'=>'xsd:string'),
'fk_commande' => array('name'=>'fk_commande','type'=>'xsd:int'),
'fk_parent_line' => array('name'=>'fk_parent_line','type'=>'xsd:int'),
'desc' => array('name'=>'desc','type'=>'xsd:string'),
'qty' => array('name'=>'qty','type'=>'xsd:int'),
'price' => array('name'=>'price','type'=>'xsd:double'),
'subprice' => array('name'=>'subprice','type'=>'xsd:double'),
'tva_tx' => array('name'=>'tva_tx','type'=>'xsd:double'),
'remise' => array('name'=>'remise','type'=>'xsd:double'),
'remise_percent' => array('name'=>'remise_percent','type'=>'xsd:double'),
'fk_product' => array('name'=>'fk_product','type'=>'xsd:int'),
'product_type' => array('name'=>'product_type','type'=>'xsd:int'),
'total_ht' => array('name'=>'total_ht','type'=>'xsd:double'),
'total_tva' => array('name'=>'totaltva','type'=>'xsd:double'),
'total_ttc' => array('name'=>'total_ttc','type'=>'xsd:double'),
'date_start' => array('name'=>'date_start','type'=>'xsd:string'),
'date_end' => array('name'=>'date_end','type'=>'xsd:string'),
// From product
'product_ref' => array('name'=>'product_ref','type'=>'xsd:string'),
'product_label' => array('name'=>'product_label','type'=>'xsd:string'),
'product_desc' => array('name'=>'product_desc','type'=>'xsd:string')
)
);
$server->wsdl->addComplexType(
'LinesArray',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:line[]')
),
'tns:line'
);
$server->wsdl->addComplexType(
'LinesArray2',
'complexType',
'array',
'sequence',
'',
array(
'line' => array(
'name' => 'line',
'type' => 'tns:line',
'minOccurs' => '0',
'maxOccurs' => 'unbounded'
)
)
);
$server->wsdl->addComplexType(
'order',
'complexType',
'struct',
'all',
'',
array(
'id' => array('name'=>'id','type'=>'xsd:string'),
'ref' => array('name'=>'ref','type'=>'xsd:string'),
'ref_client' => array('name'=>'ref_client','type'=>'xsd:string'),
'ref_ext' => array('name'=>'ref_ext','type'=>'xsd:string'),
'ref_int' => array('name'=>'ref_int','type'=>'xsd:string'),
'socid' => array('name'=>'socid','type'=>'xsd:int'),
'statut' => array('name'=>'statut','type'=>'xsd:int'),
'facturee' => array('name'=>'facturee','type'=>'xsd:string'),
'total_ht' => array('name'=>'total_ht','type'=>'xsd:double'),
'total_tva' => array('name'=>'total_tva','type'=>'xsd:double'),
'total_localtax1' => array('name'=>'total_localtax1','type'=>'xsd:double'),
'total_localtax2' => array('name'=>'total_localtax2','type'=>'xsd:double'),
'total_ttc' => array('name'=>'total_ttc','type'=>'xsd:double'),
'date' => array('name'=>'date','type'=>'xsd:date'),
'date_commande' => array('name'=>'date_commande','type'=>'xsd:date'),
'remise' => array('name'=>'remise','type'=>'xsd:string'),
'remise_percent' => array('name'=>'remise_percent','type'=>'xsd:string'),
'remise_absolue' => array('name'=>'remise_absolue','type'=>'xsd:string'),
'source' => array('name'=>'source','type'=>'xsd:string'),
'note' => array('name'=>'note','type'=>'xsd:string'),
'note_public' => array('name'=>'note_public','type'=>'xsd:string'),
'fk_project' => array('name'=>'fk_project','type'=>'xsd:string'),
'mode_reglement_id' => array('name'=>'mode_reglement_id','type'=>'xsd:string'),
'mode_reglement_code' => array('name'=>'mode_reglement_code','type'=>'xsd:string'),
'mode_reglement' => array('name'=>'mode_reglement','type'=>'xsd:string'),
'cond_reglement_id' => array('name'=>'cond_reglement_id','type'=>'xsd:string'),
'cond_reglement_code' => array('name'=>'cond_reglement_code','type'=>'xsd:string'),
'cond_reglement' => array('name'=>'cond_reglement','type'=>'xsd:string'),
'cond_reglement_doc' => array('name'=>'cond_reglement_doc','type'=>'xsd:string'),
'date_livraison' => array('name'=>'date_livraison','type'=>'xsd:date'),
'fk_delivery_address' => array('name'=>'fk_delivery_address','type'=>'xsd:int'),
'demand_reason_id' => array('name'=>'demand_reason_id','type'=>'xsd:string'),
'lines' => array('name'=>'lines','type'=>'tns:LinesArray')
)
);
$server->wsdl->addComplexType(
'OrdersArray',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:order[]')
),
'tns:order'
);
$server->wsdl->addComplexType(
'OrdersArray2',
'complexType',
'array',
'sequence',
'',
array(
'order' => array(
'name' => 'invoice',
'type' => 'tns:invoice',
'minOccurs' => '0',
'maxOccurs' => 'unbounded'
)
)
);
$server->wsdl->addComplexType(
'result',
'complexType',
'struct',
'all',
'',
array(
'result_code' => array('name'=>'result_code','type'=>'xsd:string'),
'result_label' => array('name'=>'result_label','type'=>'xsd:string'),
)
);
// 5 styles: RPC/encoded, RPC/literal, Document/encoded (not WS-I compliant), Document/literal, Document/literal wrapped
// Style merely dictates how to translate a WSDL binding to a SOAP message. Nothing more. You can use either style with any programming model.
// http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/
$styledoc='rpc'; // rpc/document (document is an extend into SOAP 1.0 to support unstructured messages)
$styleuse='encoded'; // encoded/literal/literal wrapped
// Better choice is document/literal wrapped but literal wrapped not supported by nusoap.
// Register WSDL
$server->register('getOrder',
// Entry values
array('authentication'=>'tns:authentication','id'=>'xsd:string','ref'=>'xsd:string','ref_ext'=>'xsd:string'),
// Exit values
array('result'=>'tns:result','order'=>'tns:order'),
$ns,
$ns.'#getOrder',
$styledoc,
$styleuse,
'WS to get a particular invoice'
);
$server->register('getOrdersForThirdParty',
// Entry values
array('authentication'=>'tns:authentication','idthirdparty'=>'xsd:string'),
// Exit values
array('result'=>'tns:result','orders'=>'tns:OrdersArray2'),
$ns,
$ns.'#getOrdersForThirdParty',
$styledoc,
$styleuse,
'WS to get all orders of a third party'
);
$server->register('createOrder',
// Entry values
array('authentication'=>'tns:authentication','order'=>'tns:order'),
// Exit values
array('result'=>'tns:result','id'=>'xsd:string'),
$ns,
$ns.'#createOrder',
$styledoc,
$styleuse,
'WS to create an order'
);
// Register WSDL
$server->register('validOrder',
// Entry values
array('authentication'=>'tns:authentication','id'=>'xsd:string'),
// Exit values
array('result'=>'tns:result'),
$ns,
$ns.'#validOrder',
$styledoc,
$styleuse,
'WS to valid an order'
);
/**
* Get order from id, ref or ref_ext.
*
* @param array $authentication Array of authentication information
* @param int $id Id
* @param string $ref Ref
* @param string $ref_ext Ref_ext
* @return array Array result
*/
function getOrder($authentication,$id='',$ref='',$ref_ext='')
{
global $db,$conf,$langs;
dol_syslog("Function: getOrder login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext);
if ($authentication['entity']) $conf->entity=$authentication['entity'];
// Init and check authentication
$objectresp=array();
$errorcode='';$errorlabel='';
$error=0;
$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
if ($fuser->societe_id) $socid=$fuser->societe_id;
// Check parameters
if (! $error && (($id && $ref) || ($id && $ref_ext) || ($ref && $ref_ext)))
{
$error++;
$errorcode='BAD_PARAMETERS'; $errorlabel="Parameter id, ref and ref_ext can't be both provided. You must choose one or other but not both.";
}
if (! $error)
{
$fuser->getrights();
if ($fuser->rights->commande->lire)
{
$order=new Commande($db);
$result=$order->fetch($id,$ref,$ref_ext);
if ($result > 0)
{
// Security for external user
if( $socid && ( $socid != $order->socid) )
{
$error++;
$errorcode='PERMISSION_DENIED'; $errorlabel=$order->socid.'User does not have permission for this request';
}
if(!$error)
{
$linesresp=array();
$i=0;
foreach($order->lines as $line)
{
//var_dump($line); exit;
$linesresp[]=array(
'id'=>$line->rowid,
'fk_commande'=>$line->fk_commande,
'fk_parent_line'=>$line->fk_parent_line,
'desc'=>$line->desc,
'qty'=>$line->qty,
'price'=>$line->price,
'subprice'=>$line->subprice,
'tva_tx'=>$line->tva_tx,
'remise'=>$line->remise,
'remise_percent'=>$line->remise_percent,
'fk_product'=>$line->fk_product,
'product_type'=>$line->product_type,
'total_ht'=>$line->total_ht,
'total_tva'=>$line->total_tva,
'total_ttc'=>$line->total_ttc,
'date_start'=>$line->date_start,
'date_end'=>$line->date_end,
'product_ref'=>$line->product_ref,
'product_label'=>$line->product_label,
'product_desc'=>$line->product_desc
);
$i++;
}
// Create order
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'order'=>array(
'id' => $order->id,
'ref' => $order->ref,
'ref_client' => $order->ref_client,
'ref_ext' => $order->ref_ext,
'ref_int' => $order->ref_int,
'socid' => $order->socid,
'statut' => $order->statut,
'total_ht' => $order->total_ht,
'total_tva' => $order->total_tva,
'total_localtax1' => $order->total_localtax1,
'total_localtax2' => $order->total_localtax2,
'total_ttc' => $order->total_ttc,
'fk_project' => $order->fk_project,
'date' => $order->date?dol_print_date($order->date,'dayrfc'):'',
'date_commande' => $order->date_commande?dol_print_date($order->date_commande,'dayrfc'):'',
'remise' => $order->remise,
'remise_percent' => $order->remise_percent,
'remise_absolue' => $order->remise_absolue,
'source' => $order->source,
'facturee' => $order->facturee,
'note' => $order->note,
'note_public' => $order->note_public,
'cond_reglement_id' => $order->cond_reglement_id,
'cond_reglement' => $order->cond_reglement,
'cond_reglement_doc' => $order->cond_reglement_doc,
'cond_reglement_code' => $order->cond_reglement_code,
'mode_reglement_id' => $order->mode_reglement_id,
'mode_reglement' => $order->mode_reglement,
'mode_reglement_code' => $order->mode_reglement_code,
'date_livraison' => $order->date_livraison,
'fk_delivery_address' => $order->fk_delivery_address,
'demand_reason_id' => $order->demand_reason_id,
'demand_reason_code' => $order->demand_reason_code,
'lines' => $linesresp
));
}
}
else
{
$error++;
$errorcode='NOT_FOUND'; $errorlabel='Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext;
}
}
else
{
$error++;
$errorcode='PERMISSION_DENIED'; $errorlabel='User does not have permission for this request';
}
}
if ($error)
{
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
}
/**
* Get list of orders for third party
* @param array $authentication Array of authentication information
* @param int $idthirdparty Id of thirdparty
* @return array Array result
*/
function getOrdersForThirdParty($authentication,$idthirdparty)
{
global $db,$conf,$langs;
dol_syslog("Function: getOrdersForThirdParty login=".$authentication['login']." idthirdparty=".$idthirdparty);
if ($authentication['entity']) $conf->entity=$authentication['entity'];
// Init and check authentication
$objectresp=array();
$errorcode='';$errorlabel='';
$error=0;
$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
if ($fuser->societe_id) $socid=$fuser->societe_id;
// Check parameters
if (! $error && !$idthirdparty)
{
$error++;
$errorcode='BAD_PARAMETERS'; $errorlabel='Parameter id is not provided';
}
if (! $error)
{
$linesorders=array();
$sql.='SELECT c.rowid as orderid';
$sql.=' FROM '.MAIN_DB_PREFIX.'commande as c';
$sql.=" WHERE c.entity = ".$conf->entity;
if ($idthirdparty != 'all' ) $sql.=" AND c.fk_soc = ".$db->escape($idthirdparty);
$resql=$db->query($sql);
if ($resql)
{
$num=$db->num_rows($resql);
$i=0;
while ($i < $num)
{
// En attendant remplissage par boucle
$obj=$db->fetch_object($resql);
$order=new Commande($db);
$order->fetch($obj->orderid);
// Sécurité pour utilisateur externe
if( $socid && ( $socid != $order->socid) )
{
$error++;
$errorcode='PERMISSION_DENIED'; $errorlabel=$order->socid.'User does not have permission for this request';
}
if(!$error)
{
// Define lines of invoice
$linesresp=array();
foreach($order->lines as $line)
{
$linesresp[]=array(
'id'=>$line->rowid,
'fk_commande'=>$line->fk_commande,
'fk_parent_line'=>$line->fk_parent_line,
'desc'=>$line->desc,
'qty'=>$line->qty,
'price'=>$line->price,
'subprice'=>$line->subprice,
'tva_tx'=>$line->tva_tx,
'remise'=>$line->remise,
'remise_percent'=>$line->remise_percent,
'fk_product'=>$line->fk_product,
'product_type'=>$line->product_type,
'total_ht'=>$line->total_ht,
'total_tva'=>$line->total_tva,
'total_ttc'=>$line->total_ttc,
'date_start'=>$line->date_start,
'date_end'=>$line->date_end,
'product_ref'=>$line->product_ref,
'product_label'=>$line->product_label,
'product_desc'=>$line->product_desc
);
}
// Now define invoice
$linesorders[]=array(
'id' => $order->id,
'ref' => $order->ref,
'ref_client' => $order->ref_client,
'ref_ext' => $order->ref_ext,
'ref_int' => $order->ref_int,
'socid' => $order->socid,
'statut' => $order->statut,
'total_ht' => $order->total_ht,
'total_tva' => $order->total_tva,
'total_localtax1' => $order->total_localtax1,
'total_localtax2' => $order->total_localtax2,
'total_ttc' => $order->total_ttc,
'fk_project' => $order->fk_project,
'date' => $order->date?dol_print_date($order->date,'dayrfc'):'',
'date_commande' => $order->date_commande?dol_print_date($order->date_commande,'dayrfc'):'',
'remise' => $order->remise,
'remise_percent' => $order->remise_percent,
'remise_absolue' => $order->remise_absolue,
'source' => $order->source,
'facturee' => $order->facturee,
'note' => $order->note,
'note_public' => $order->note_public,
'cond_reglement_id' => $order->cond_reglement_id,
'cond_reglement' => $order->cond_reglement,
'cond_reglement_doc' => $order->cond_reglement_doc,
'cond_reglement_code' => $order->cond_reglement_code,
'mode_reglement_id' => $order->mode_reglement_id,
'mode_reglement' => $order->mode_reglement,
'mode_reglement_code' => $order->mode_reglement_code,
'date_livraison' => $order->date_livraison,
'fk_delivery_address' => $order->fk_delivery_address,
'demand_reason_id' => $order->demand_reason_id,
'demand_reason_code' => $order->demand_reason_code,
'lines' => $linesresp
);
}
$i++;
}
$objectresp=array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'orders'=>$linesorders
);
}
else
{
$error++;
$errorcode=$db->lasterrno(); $errorlabel=$db->lasterror();
}
}
if ($error)
{
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
}
/**
* Create order
* @param array $authentication Array of authentication information
* @param array $order Order info
* @return int Id of new order
*/
function createOrder($authentication,$order)
{
global $db,$conf,$langs;
$now=dol_now();
dol_syslog("Function: createOrder login=".$authentication['login']." socid :".$order['socid'] );
// Init and check authentication
$objectresp=array();
$errorcode='';$errorlabel='';
$error=0;
if ($authentication['entity']) $conf->entity=$authentication['entity'];
$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
// Check parameters
if (! $error)
{
$newobject=new Commande($db);
$newobject->socid=$order['socid'];
$newobject->type=$order['type'];
$newobject->ref_ext=$order['ref_ext'];
$newobject->date=$order['date'];
$newobject->date_lim_reglement=$order['date_due'];
$newobject->note=$order['note'];
$newobject->note_public=$order['note_public'];
$newobject->statut=$order['statut'];
$newobject->facturee=$order['facturee'];
$newobject->fk_project=$order['project_id'];
$newobject->cond_reglement_id=$order['cond_reglement_id'];
$newobject->demand_reason_id=$order['demand_reason_id'];
$newobject->date_commande=$now;
// Trick because nusoap does not store data with same structure if there is one or several lines
$arrayoflines=array();
if (isset($order['lines']['line'][0])) $arrayoflines=$order['lines']['line'];
else $arrayoflines=$order['lines'];
foreach($arrayoflines as $key => $line)
{
// $key can be 'line' or '0','1',...
$newline=new OrderLigne($db);
$newline->type=$line['type'];
$newline->desc=$line['desc'];
$newline->fk_product=$line['fk_product'];
$newline->tva_tx=$line['vat_rate'];
$newline->qty=$line['qty'];
$newline->subprice=$line['unitprice'];
$newline->total_ht=$line['total_net'];
$newline->total_tva=$line['total_vat'];
$newline->total_ttc=$line['total'];
$newline->fk_product=$line['fk_product'];
$newobject->lines[]=$newline;
}
$db->begin();
$object_id=$newobject->create($fuser,0,0);
if ($object_id < 0)
{
$error++;
}
if (! $error)
{
$db->commit();
$objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''),'id'=>$object_id);
}
else
{
$db->rollback();
$error++;
$errorcode='KO';
$errorlabel=$newobject->error;
}
}
if ($error)
{
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
}
/**
* Valid an order
* @param array $authentication Array of authentication information
* @param int $id Id of order to validate
* @return array Array result
*/
function validOrder($authentication,$id='')
{
global $db,$conf,$langs;
dol_syslog("Function: validOrder login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext);
// Init and check authentication
$objectresp=array();
$errorcode='';$errorlabel='';
$error=0;
if ($authentication['entity']) $conf->entity=$authentication['entity'];
$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
if (! $error)
{
$fuser->getrights();
if ($fuser->rights->commande->lire)
{
$order=new Commande($db);
$result=$order->fetch($id,$ref,$ref_ext);
$order->fetch_thirdparty();
$db->begin();
if ($result > 0)
{
$result=$order->valid($fuser);
if ($result >= 0)
{
// Define output language
$outputlangs = $langs;
commande_pdf_create($db, $order, $order->modelpdf, $outputlangs, 0, 0, 0);
}
else
{
$db->rollback();
$error++;
$errorcode='KO';
$errorlabel=$newobject->error;
}
}
else
{
$db->rollback();
$error++;
$errorcode='KO';
$errorlabel=$newobject->error;
}
}
else
{
$db->rollback();
$error++;
$errorcode='KO';
$errorlabel=$newobject->error;
}
}
if ($error)
{
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
else
{
$db->commit();
$objectresp= array('result'=>array('result_code'=>'OK', 'result_label'=>''));
}
return $objectresp;
}
// Return the results.
$server->service($HTTP_RAW_POST_DATA);
?>

View File

@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php");
dol_syslog("Call Dolibarr webservices interfaces"); dol_syslog("Call Dolibarr webservices interfaces");
@ -112,8 +114,17 @@ $server->wsdl->addComplexType(
'price_net' => array('name'=>'price_net','type'=>'xsd:string'), 'price_net' => array('name'=>'price_net','type'=>'xsd:string'),
'price' => array('name'=>'price','type'=>'xsd:string'), 'price' => array('name'=>'price','type'=>'xsd:string'),
'price_ttc' => array('name'=>'price_ttc','type'=>'xsd:string'), 'price_ttc' => array('name'=>'price_ttc','type'=>'xsd:string'),
'price_min' => array('name'=>'price_min','type'=>'xsd:string'),
'price_min_ttc' => array('name'=>'price_min_ttc','type'=>'xsd:string'),
'price_base_type' => array('name'=>'price_base_type','type'=>'xsd:string'), 'price_base_type' => array('name'=>'price_base_type','type'=>'xsd:string'),
'vat_rate' => array('name'=>'vat_rate','type'=>'xsd:string'),
'tva_tx' => array('name'=>'tva_tx','type'=>'xsd:string'),
'tva_npr' => array('name'=>'tva_npr','type'=>'xsd:string'),
'localtax1_tx' => array('name'=>'localtax1_tx','type'=>'xsd:string'),
'localtax2_tx' => array('name'=>'localtax2_tx','type'=>'xsd:string'),
'stock_alert' => array('name'=>'stock_alert','type'=>'xsd:string'), 'stock_alert' => array('name'=>'stock_alert','type'=>'xsd:string'),
'stock_real' => array('name'=>'stock_real','type'=>'xsd:string'), 'stock_real' => array('name'=>'stock_real','type'=>'xsd:string'),
'stock_pmp' => array('name'=>'stock_pmp','type'=>'xsd:string'), 'stock_pmp' => array('name'=>'stock_pmp','type'=>'xsd:string'),
@ -255,6 +266,20 @@ $server->register(
'WS to get list of all products or services id and ref' 'WS to get list of all products or services id and ref'
); );
// Register WSDL
$server->register(
'getProductsForCategory',
// Entry values
array('authentication'=>'tns:authentication','id'=>'xsd:string'),
// Exit values
array('result'=>'tns:result','products'=>'ProductsArray'),
$ns,
$ns.'#getProductsForCategory',
$styledoc,
$styleuse,
'WS to get list of all products or services for a category'
);
/** /**
* Get produt or service * Get produt or service
@ -320,9 +345,21 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='')
'country_code' => $product->country_code, 'country_code' => $product->country_code,
'custom_code' => $product->customcode, 'custom_code' => $product->customcode,
'price_net' => $product->price, 'price_net' => $product->price, // todo : DEPRECATED ?
'price' => ($product->price_ttc-$product->price), //'price' => ($product->price_ttc-$product->price),
'vat_rate' => $product->tva_tx, 'price' => $product->price,
'price_ttc' => $product->price_ttc,
'price_min' => $product->price_min,
'price_min_ttc' => $product->price_min_ttc,
'price_base_type' => $product->price_base_type,
'vat_rate' => $product->tva_tx, // todo : DEPRECATED ?
'tva_tx' => $product->tva_tx,
//! French VAT NPR
'tva_npr' => $product->tva_npr,
//! Spanish local taxes
'localtax1_tx' => $product->localtax1_tx,
'localtax2_tx' => $product->localtax2_tx,
'price_ttc' => $product->price_ttc, 'price_ttc' => $product->price_ttc,
'price_base_type' => $product->price_base_type, 'price_base_type' => $product->price_base_type,
@ -541,6 +578,135 @@ function getListOfProductsOrServices($authentication,$filterproduct)
} }
// return category infos and children
function getProductsForCategory($authentication,$id)
{
global $db,$conf,$langs;
dol_syslog("Function: getProductsForCategory login=".$authentication['login']." id=".$id);
if ($authentication['entity']) $conf->entity=$authentication['entity'];
$objectresp=array();
$errorcode='';$errorlabel='';
$error=0;
$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
if (! $error && !$id)
{
$error++;
$errorcode='BAD_PARAMETERS'; $errorlabel="Parameter id must be provided.";
}
if (! $error)
{
$fuser->getrights();
if ($fuser->rights->produit->lire)
{
$categorie=new Categorie($db);
$result=$categorie->fetch($id);
if ($result > 0)
{
$table = "product";
$field = "product";
$sql = "SELECT fk_".$field." FROM ".MAIN_DB_PREFIX."categorie_".$table;
$sql .= " WHERE fk_categorie = ".$id;
$sql .= " ORDER BY fk_".$field." ASC" ;
dol_syslog("GetProductsForCategory::get_type sql=".$sql);
$res = $db->query($sql);
if ($res)
{
while ($rec = $db->fetch_array ($res))
{
$obj = new Product ($db);
$obj->fetch ($rec['fk_'.$field]);
if($obj->status > 0 ) {
$dir = (!empty($conf->product->dir_output)?$conf->product->dir_output:$conf->service->dir_output);
$pdir = get_exdir($obj->id,2) . $obj->id ."/photos/";
$dir = $dir . '/'. $pdir;
$products[] = array(
'id' => $obj->id,
'ref' => $obj->ref,
'ref_ext' => $obj->ref_ext,
'label' => $obj->label,
'description' => $obj->description,
'date_creation' => dol_print_date($obj->date_creation,'dayhourrfc'),
'date_modification' => dol_print_date($obj->date_modification,'dayhourrfc'),
'note' => $obj->note,
'status_tosell' => $obj->status,
'status_tobuy' => $obj->status_buy,
'type' => $obj->type,
'barcode' => $obj->barcode,
'barcode_type' => $obj->barcode_type,
'country_id' => $obj->country_id>0?$obj->country_id:'',
'country_code' => $obj->country_code,
'custom_code' => $obj->customcode,
'price_net' => $obj->price,
'price' => ($obj->price_ttc-$obj->price),
'vat_rate' => $obj->tva_tx,
'price_ttc' => $obj->price_ttc,
'price_base_type' => $obj->price_base_type,
'stock_real' => $obj->stock_reel,
'stock_alert' => $obj->seuil_stock_alerte,
'pmp' => $obj->pmp,
'import_key' => $obj->import_key,
'dir' => $pdir,
'photos' => $obj->liste_photos($dir,$nbmax=10)
);
}
}
// Retour
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'products'=> $products
);
}
else
{
$errorcode='NORECORDS_FOR_ASSOCIATION'; $errorlabel='No products associated'.$sql;
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
dol_syslog("getProductsForCategory:: ".$c->error, LOG_DEBUG);
}
}
else
{
$error++;
$errorcode='NOT_FOUND'; $errorlabel='Object not found for id='.$id;
}
}
else
{
$error++;
$errorcode='PERMISSION_DENIED'; $errorlabel='User does not have permission for this request';
}
}
if ($error)
{
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
}
// Return the results. // Return the results.

View File

@ -120,6 +120,34 @@ $server->wsdl->addComplexType(
) )
); );
// Define other specific objects
$server->wsdl->addComplexType(
'group',
'complexType',
'struct',
'all',
'',
array(
'nom' => array('name'=>'nom','type'=>'xsd:string'),
'id' => array('name'=>'id','type'=>'xsd:string'),
'datec' => array('name'=>'datec','type'=>'xsd:string'),
'nb' => array('name'=>'nb','type'=>'xsd:string')
)
);
$server->wsdl->addComplexType(
'GroupsArray',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:group[]')
),
'tns:group'
);
// 5 styles: RPC/encoded, RPC/literal, Document/encoded (not WS-I compliant), Document/literal, Document/literal wrapped // 5 styles: RPC/encoded, RPC/literal, Document/encoded (not WS-I compliant), Document/literal, Document/literal wrapped
@ -144,6 +172,19 @@ $server->register(
'WS to get user' 'WS to get user'
); );
$server->register(
'getListOfGroups',
// Entry values
array('authentication'=>'tns:authentication'),
// Exit values
array('result'=>'tns:result','groups'=>'tns:GroupsArray'),
$ns,
$ns.'#getListOfGroups',
$styledoc,
$styleuse,
'WS to get list of groups'
);
@ -246,6 +287,83 @@ function getUser($authentication,$id,$ref='',$ref_ext='')
return $objectresp; return $objectresp;
} }
/**
* getListOfGroups
*
* @param array $authentication Array of authentication information
* @return array Array result
*/
function getListOfGroups($authentication)
{
global $db,$conf,$langs;
$now=dol_now();
dol_syslog("Function: getListOfGroups login=".$authentication['login']);
if ($authentication['entity']) $conf->entity=$authentication['entity'];
// Init and check authentication
$objectresp=array();
$arraygroups=array();
$errorcode='';$errorlabel='';
$error=0;
$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
// Check parameters
if (! $error)
{
$sql = "SELECT g.rowid, g.nom, g.entity, g.datec, COUNT(DISTINCT ugu.fk_user) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."usergroup as g";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_usergroup = g.rowid";
if (! empty($conf->multicompany->enabled) && $conf->entity == 1 && ($conf->multicompany->transverse_mode || ($user->admin && ! $user->entity)))
{
$sql.= " WHERE g.entity IS NOT NULL";
}
else
{
$sql.= " WHERE g.entity IN (0,".$conf->entity.")";
}
$sql.= " GROUP BY g.rowid, g.nom, g.entity, g.datec";
$resql=$db->query($sql);
if ($resql)
{
$num=$db->num_rows($resql);
$i=0;
while ($i < $num)
{
$obj=$db->fetch_object($resql);
$arraygroups[]=array('id'=>$obj->rowid,'nom'=>$obj->nom,'datec'=>$obj->datec,'nb'=>$obj->nb);
$i++;
}
}
else
{
$error++;
$errorcode=$db->lasterrno();
$errorlabel=$db->lasterror();
}
}
if ($error)
{
$objectresp = array(
'result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel),
'groups'=>$arraygroups
);
}
else
{
$objectresp = array(
'result'=>array('result_code' => 'OK', 'result_label' => ''),
'groups'=>$arraygroups
);
}
return $objectresp;
}
// Return the results. // Return the results.

6
robots.txt Normal file
View File

@ -0,0 +1,6 @@
User-agent: *
Disallow: /build
Disallow: /dev
Disallow: /doc
Disallow: /scripts
Disallow: /test

View File

@ -0,0 +1,319 @@
<?php
/* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file test/phpunit/HolidayTest.php
* \ingroup test
* \brief PHPUnit test
* \remarks To run this script as CLI: phpunit filename.php
*/
global $conf,$user,$langs,$db;
//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
require_once 'PHPUnit/Autoload.php';
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
require_once dirname(__FILE__).'/../../htdocs/holiday/class/holiday.class.php';
$langs->load("dict");
if (empty($user->id))
{
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
}
$conf->global->MAIN_DISABLE_ALL_MAILS=1;
/**
* Class for PHPUnit tests
*
* @backupGlobals disabled
* @backupStaticAttributes enabled
* @remarks backupGlobals must be disabled to have db,conf,user and lang not erased.
*/
class HolidayTest extends PHPUnit_Framework_TestCase
{
protected $savconf;
protected $savuser;
protected $savlangs;
protected $savdb;
/**
* Constructor
* We save global variables into local variables
*
* @return HolidayTest
*/
function __construct()
{
//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
$this->savuser=$user;
$this->savlangs=$langs;
$this->savdb=$db;
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
//print " - db ".$db->db;
print "\n";
}
// Static methods
public static function setUpBeforeClass()
{
global $conf,$user,$langs,$db;
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
print __METHOD__."\n";
}
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;
$db->rollback();
print __METHOD__."\n";
}
/**
* Init phpunit tests
*
* @return void
*/
protected function setUp()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
print __METHOD__."\n";
}
/**
* End phpunit tests
*
* @return void
*/
protected function tearDown()
{
print __METHOD__."\n";
}
/**
* testHolidayCreate
*
* @return int
*/
public function testHolidayCreate()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject=new Holiday($this->savdb);
$localobject->initAsSpecimen();
$result=$localobject->create($user);
print __METHOD__." result=".$result."\n";
$this->assertLessThan($result, 0);
return $result;
}
/**
* testHolidayFetch
*
* @param int $id Id of Holiday
* @return int
* @depends testHolidayCreate
* The depends says test is run only if previous is ok
*/
public function testHolidayFetch($id)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject=new Holiday($this->savdb);
$result=$localobject->fetch($id);
print __METHOD__." id=".$id." result=".$result."\n";
$this->assertLessThan($result, 0);
return $localobject;
}
/**
* testHolidayUpdate
*
* @param Holiday $localobject Holiday
* @return int
*
* @depends testHolidayFetch
* The depends says test is run only if previous is ok
*/
public function testHolidayUpdate($localobject)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject->oldcopy=dol_clone($localobject);
$localobject->note='New note after update';
//$localobject->note_public='New note public after update';
$localobject->lastname='New name';
$localobject->firstname='New firstname';
$localobject->address='New address';
$localobject->zip='New zip';
$localobject->town='New town';
$localobject->country_id=2;
//$localobject->status=0;
$localobject->phone_pro='New tel pro';
$localobject->phone_perso='New tel perso';
$localobject->phone_mobile='New tel mobile';
$localobject->fax='New fax';
$localobject->email='newemail@newemail.com';
$localobject->jabberid='New im id';
$localobject->default_lang='es_ES';
$result=$localobject->update($localobject->id,$user);
print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0, 'Holiday::update error');
$result=$localobject->update_note($localobject->note);
print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0, 'Holiday::update_note error');
//$result=$localobject->update_note_public($localobject->note_public);
//print __METHOD__." id=".$localobject->id." result=".$result."\n";
//$this->assertLessThan($result, 0);
$newobject=new Holiday($this->savdb);
$result=$newobject->fetch($localobject->id);
print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0, 'Holiday::fetch error');
print __METHOD__." old=".$localobject->note." new=".$newobject->note."\n";
$this->assertEquals($localobject->note, $newobject->note);
//print __METHOD__." old=".$localobject->note_public." new=".$newobject->note_public."\n";
//$this->assertEquals($localobject->note_public, $newobject->note_public);
print __METHOD__." old=".$localobject->lastname." new=".$newobject->lastname."\n";
$this->assertEquals($localobject->lastname, $newobject->lastname);
print __METHOD__." old=".$localobject->firstname." new=".$newobject->firstname."\n";
$this->assertEquals($localobject->firstname, $newobject->firstname);
print __METHOD__." old=".$localobject->address." new=".$newobject->address."\n";
$this->assertEquals($localobject->address, $newobject->address);
print __METHOD__." old=".$localobject->zip." new=".$newobject->zip."\n";
$this->assertEquals($localobject->zip, $newobject->zip);
print __METHOD__." old=".$localobject->town." new=".$newobject->town."\n";
$this->assertEquals($localobject->town, $newobject->town);
print __METHOD__." old=".$localobject->country_id." new=".$newobject->country_id."\n";
$this->assertEquals($localobject->country_id, $newobject->country_id);
print __METHOD__." old=BE new=".$newobject->country_code."\n";
$this->assertEquals('BE', $newobject->country_code);
//print __METHOD__." old=".$localobject->status." new=".$newobject->status."\n";
//$this->assertEquals($localobject->status, $newobject->status);
print __METHOD__." old=".$localobject->phone_pro." new=".$newobject->phone_pro."\n";
$this->assertEquals($localobject->phone_pro, $newobject->phone_pro);
print __METHOD__." old=".$localobject->phone_pro." new=".$newobject->phone_pro."\n";
$this->assertEquals($localobject->phone_perso, $newobject->phone_perso);
print __METHOD__." old=".$localobject->phone_mobile." new=".$newobject->phone_mobile."\n";
$this->assertEquals($localobject->phone_mobile, $newobject->phone_mobile);
print __METHOD__." old=".$localobject->fax." new=".$newobject->fax."\n";
$this->assertEquals($localobject->fax, $newobject->fax);
print __METHOD__." old=".$localobject->email." new=".$newobject->email."\n";
$this->assertEquals($localobject->email, $newobject->email);
print __METHOD__." old=".$localobject->jabberid." new=".$newobject->jabberid."\n";
$this->assertEquals($localobject->jabberid, $newobject->jabberid);
print __METHOD__." old=".$localobject->default_lang." new=".$newobject->default_lang."\n";
$this->assertEquals($localobject->default_lang, $newobject->default_lang);
return $localobject;
}
/**
* testHolidayOther
*
* @param Holiday $localobject Holiday
* @return void
*
* @depends testHolidayUpdate
* The depends says test is run only if previous is ok
*/
public function testHolidayOther($localobject)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
//$localobject->fetch($localobject->id);
/*
$result=$localobject->getNomUrl(1);
print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertNotEquals($result, '');
$result=$localobject->getFullAddress(1);
print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertContains("New address\nNew zip New town\nBelgium", $result);
$localobject->info($localobject->id);
print __METHOD__." localobject->date_creation=".$localobject->date_creation."\n";
$this->assertNotEquals($localobject->date_creation, '');
*/
return $localobject->id;
}
/**
* testHolidayDelete
*
* @param int $id Id of Holiday
* @return void
*
* @depends testHolidayOther
* The depends says test is run only if previous is ok
*/
public function testHolidayDelete($id)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject=new Holiday($this->savdb);
$result=$localobject->fetch($id);
$result=$localobject->delete(0);
print __METHOD__." id=".$id." result=".$result."\n";
$this->assertLessThan($result, 0);
return $result;
}
}
?>