Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop
This commit is contained in:
commit
eec5ddc08d
@ -14,7 +14,7 @@ For users:
|
||||
configured. Show also total number of activated modules.
|
||||
- New: Can filter list of proposal, order or invoice on sales representative.
|
||||
- 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: Monaco is like France for default vat calculation
|
||||
- New: Can list elements (invoices, orders or proposals) on a particular
|
||||
|
||||
@ -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/utils`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/LICENSE.TXT`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/savant`;
|
||||
}
|
||||
|
||||
# Build package for each target
|
||||
|
||||
@ -40,7 +40,16 @@ $action = GETPOST('action','alpha');
|
||||
* 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();
|
||||
|
||||
@ -129,14 +138,14 @@ print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("ActivateCheckRead").'</td><td>';
|
||||
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 '</a>';
|
||||
$readonly='';
|
||||
}
|
||||
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 '</a>';
|
||||
$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 '</td></tr>';
|
||||
|
||||
print '</table></form>';
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
/**
|
||||
* \file htdocs/compta/ajaxpayment.php
|
||||
* \brief File to return Ajax response on payment breakdown process
|
||||
* \version ajaxpayment.php,v 1.0
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||
@ -32,9 +31,15 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't nee
|
||||
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
//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
|
||||
$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)
|
||||
$currentInvId = $_POST['imgClicked']; // from DOM elements : imgId (equals invoice id)
|
||||
|
||||
|
||||
// Getting the posted keys=>values, sanitize the ones who are from text inputs
|
||||
// from text inputs : total amount
|
||||
$amountPayment = $amountPayment!='' ? ( is_numeric(price2num($amountPayment)) ? price2num($amountPayment)
|
||||
: ''
|
||||
)
|
||||
: ''; // keep void if not a valid entry
|
||||
// Checkamounts
|
||||
foreach ($amounts as $key => $value)
|
||||
{
|
||||
$value = price2num($value);
|
||||
if (!is_numeric($value)) unset($amounts[$key]);
|
||||
}
|
||||
$amountPayment = $amountPayment!='' ? ( is_numeric(price2num($amountPayment)) ? price2num($amountPayment) : '' ) : ''; // keep void if not a valid entry
|
||||
|
||||
// Clean checkamounts
|
||||
foreach ($amounts as $key => $value)
|
||||
{
|
||||
$value = price2num($value);
|
||||
$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
|
||||
$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();
|
||||
$totalRemaining = price2num(array_sum($remains));
|
||||
$toJsonArray['label'] = $amountPayment == '' ? $langs->transnoentities('AmountToBeCharged') : $langs->transnoentities('RemainingAmountPayment');
|
||||
if($currentInvId) // Here to breakdown
|
||||
$toJsonArray['label'] = $amountPayment == '' ? '' : $langs->transnoentities('RemainingAmountPayment');
|
||||
if ($currentInvId) // Here to breakdown
|
||||
{
|
||||
// Get the current amount (from form) and the corresponding remainToPay (from invoice)
|
||||
$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
|
||||
}
|
||||
// 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
|
||||
?>
|
||||
@ -280,12 +280,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
$(\'.fieldrequireddyn\').removeClass(\'fieldrequired\');
|
||||
$(\'#fieldchqemetteur\').val(\'\');
|
||||
}
|
||||
}';
|
||||
// For paiement auto-completion
|
||||
if (! empty($conf->global->MAIN_JS_ON_PAYMENT))
|
||||
{
|
||||
print "\n".'
|
||||
function elemToJson(selector)
|
||||
}
|
||||
|
||||
function _elemToJson(selector)
|
||||
{
|
||||
var subJson = {};
|
||||
$.map(selector.serializeArray(), function(n,i)
|
||||
@ -300,14 +297,14 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
var form = $("#payment_form");
|
||||
|
||||
json["amountPayment"] = $("#amountpayment").attr("value");
|
||||
json["amounts"] = elemToJson(form.find("input[name*=\"amount_\"]"));
|
||||
json["remains"] = elemToJson(form.find("input[name*=\"remain_\"]"));
|
||||
json["amounts"] = _elemToJson(form.find("input[name*=\"amount_\"]"));
|
||||
json["remains"] = _elemToJson(form.find("input[name*=\"remain_\"]"));
|
||||
|
||||
if (imgId != null) {
|
||||
json["imgClicked"] = imgId;
|
||||
}
|
||||
|
||||
$.post("ajaxpayment.php", json, function(data)
|
||||
$.post("'.DOL_URL_ROOT.'/compta/ajaxpayment.php", json, function(data)
|
||||
{
|
||||
json = $.parseJSON(data);
|
||||
|
||||
@ -317,9 +314,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
{
|
||||
if (key == "result") {
|
||||
if (json["makeRed"]) {
|
||||
$("#"+key).css("color", "red");
|
||||
$("#"+key).addClass("error");
|
||||
} else {
|
||||
$("#"+key).removeAttr("style");
|
||||
$("#"+key).removeClass("error");
|
||||
}
|
||||
json[key]=json["label"]+" "+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() {
|
||||
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() {
|
||||
callForResult();
|
||||
});';
|
||||
}
|
||||
print '});
|
||||
</script>'."\n";
|
||||
|
||||
print ' });'."\n";
|
||||
print ' </script>'."\n";
|
||||
}
|
||||
|
||||
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);
|
||||
print '</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"> </td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
@ -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.'/societe/class/societe.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
|
||||
*
|
||||
*/
|
||||
if ($error == 0)
|
||||
{
|
||||
@ -928,7 +924,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
/*
|
||||
* Creation process
|
||||
* Create withdrawal receipt
|
||||
*/
|
||||
if (!$error)
|
||||
{
|
||||
@ -1181,12 +1177,15 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
$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
|
||||
if ($mysoc->country_code=='ES')
|
||||
{
|
||||
// TODO replace by a hook (external modules)
|
||||
if (! empty($conf->esaeb->enabled))
|
||||
{
|
||||
dol_include_once('/esaeb/class/esaeb19.class.php');
|
||||
|
||||
//Head
|
||||
$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);
|
||||
@ -1239,7 +1238,7 @@ class BonPrelevement extends CommonObject
|
||||
fputs($this->file, $esaeb19->generaRemesa());
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$this->total = 0;
|
||||
$sql = "SELECT pl.amount";
|
||||
$sql.= " FROM";
|
||||
@ -1271,10 +1270,8 @@ class BonPrelevement extends CommonObject
|
||||
$langs->load('withdrawals');
|
||||
fputs($this->file, $langs->trans('WithdrawalFileNotCapable'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Build file for France
|
||||
// Build file for France
|
||||
elseif ($mysoc->country_code=='FR')
|
||||
{
|
||||
/*
|
||||
@ -1316,7 +1313,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$result = -2;
|
||||
}
|
||||
|
||||
@ -1326,10 +1323,9 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
$this->EnregTotal($this->total);
|
||||
}
|
||||
|
||||
//Build file for Other Countries with unknow format
|
||||
// Build file for Other Countries with unknow format
|
||||
else
|
||||
{
|
||||
{
|
||||
$this->total = 0;
|
||||
$sql = "SELECT pl.amount";
|
||||
$sql.= " FROM";
|
||||
|
||||
@ -214,11 +214,11 @@ if ($action == 'create')
|
||||
print '<td> </td>';
|
||||
|
||||
// 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
|
||||
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>';
|
||||
|
||||
// Date end period
|
||||
|
||||
@ -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);
|
||||
|
||||
// Some test to guess with no need to make database access
|
||||
if ($local == 1 && ! $thirdparty_seller->localtax1_assuj) return 0;
|
||||
if ($local == 2 && ! $thirdparty_seller->localtax2_assuj) return 0;
|
||||
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 == 2 && ! $thirdparty_seller->localtax2_assuj) return 0;
|
||||
}
|
||||
//if ($local == 0 && ! $thirdparty_seller->localtax1_assuj && ! $thirdparty_seller->localtax2_assuj) return array('localtax1'=>0,'localtax2'=>0);
|
||||
|
||||
$code_country=$thirdparty_seller->country_code;
|
||||
|
||||
@ -42,6 +42,8 @@ class modExpedition extends DolibarrModules
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->db = $db;
|
||||
$this->numero = 80;
|
||||
|
||||
@ -71,6 +73,8 @@ class modExpedition extends DolibarrModules
|
||||
// Dependances
|
||||
$this->depends = array("modCommande");
|
||||
$this->requiredby = array();
|
||||
$this->conflictwith = array();
|
||||
$this->langfiles = array('deliveries','sendings');
|
||||
|
||||
// Constantes
|
||||
$this->const = array();
|
||||
@ -141,6 +145,14 @@ class modExpedition extends DolibarrModules
|
||||
$this->rights[$r][4] = 'shipping_advance';
|
||||
$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++;
|
||||
$this->rights[$r][0] = 109;
|
||||
$this->rights[$r][1] = 'Supprimer les expeditions';
|
||||
@ -180,6 +192,25 @@ class modExpedition extends DolibarrModules
|
||||
$this->rights[$r][4] = 'livraison';
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -65,6 +65,8 @@ class modProjet extends DolibarrModules
|
||||
// Dependancies
|
||||
$this->depends = array();
|
||||
$this->requiredby = array();
|
||||
$this->conflictwith = array();
|
||||
$this->langfiles = array('projects');
|
||||
|
||||
// Constants
|
||||
$this->const = array();
|
||||
|
||||
@ -54,7 +54,6 @@ if (isset($conf->modules_parts['css']))
|
||||
}
|
||||
// JQuery. Must be before other includes
|
||||
$ext='.js';
|
||||
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) $ext='.jgz';
|
||||
print '<!-- Includes JS for JQuery -->'."\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";
|
||||
|
||||
@ -53,7 +53,6 @@ if (isset($conf->modules_parts['css']))
|
||||
}
|
||||
// JQuery. Must be before other includes
|
||||
$ext='.js';
|
||||
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) $ext='.jgz';
|
||||
print '<!-- Includes JS for JQuery -->'."\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";
|
||||
|
||||
@ -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.= " tracking_number=".(isset($this->tracking_number)?"'".$this->db->escape($this->tracking_number)."'":"null").",";
|
||||
$sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").",";
|
||||
$sql.= " height=".(isset($this->trueHeight)?$this->trueHeight:"null").",";
|
||||
$sql.= " width=".(isset($this->trueWidth)?$this->trueWidth:"null").",";
|
||||
$sql.= " height=".(($this->trueHeight != '')?$this->trueHeight:"null").",";
|
||||
$sql.= " width=".(($this->trueWidth != '')?$this->trueWidth:"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=".(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.= " model_pdf=".(isset($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null").",";
|
||||
$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.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.= ", 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.= " ".MAIN_DB_PREFIX."commandedet as cd)";
|
||||
$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->weight = $obj->weight;
|
||||
$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_units = $obj->volume_units;
|
||||
|
||||
|
||||
@ -285,10 +285,9 @@ else if ($action == 'settrackingnumber' || $action == 'settrackingurl'
|
||||
header("Location: fiche.php?id=".$shipping->id);
|
||||
exit;
|
||||
}
|
||||
$mesg=$shipping->error;
|
||||
setEventMessage($shipping->error,'errors');
|
||||
}
|
||||
|
||||
$mesg='<div class="error">'.$mesg.'</div>';
|
||||
$action="";
|
||||
}
|
||||
|
||||
@ -537,7 +536,7 @@ else if ($action == 'classifybilled')
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans('Sending'),'Expedition');
|
||||
|
||||
@ -904,7 +903,7 @@ else
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression
|
||||
*/
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('DeleteSending'),$langs->trans("ConfirmDeleteSending",$object->ref),'confirm_delete','',0,1);
|
||||
@ -913,7 +912,7 @@ else
|
||||
|
||||
/*
|
||||
* Confirmation de la validation
|
||||
*/
|
||||
*/
|
||||
if ($action == 'valid')
|
||||
{
|
||||
$objectref = substr($object->ref, 1, 4);
|
||||
@ -930,15 +929,15 @@ else
|
||||
}
|
||||
/*
|
||||
* Confirmation de l'annulation
|
||||
*/
|
||||
*/
|
||||
if ($action == 'annuler')
|
||||
{
|
||||
$ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('CancelSending'),$langs->trans("ConfirmCancelSending",$object->ref),'confirm_cancel','',0,1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
// Calculate ture totalVeight and totalVolume for all products
|
||||
// by adding weight and volume of each line.
|
||||
// Calculate true totalWeight and totalVolume for all products
|
||||
// by adding weight and volume of each product line.
|
||||
$totalWeight = '';
|
||||
$totalVolume = '';
|
||||
$weightUnit=0;
|
||||
@ -949,6 +948,7 @@ else
|
||||
$volumeUnit=0;
|
||||
if (! empty($lines[$i]->weight_units)) $weightUnit = $lines[$i]->weight_units;
|
||||
if (! empty($lines[$i]->volume_units)) $volumeUnit = $lines[$i]->volume_units;
|
||||
|
||||
// TODO Use a function addvalueunits(val1,unit1,val2,unit2)=>(val,unit)
|
||||
if ($lines[$i]->weight_units < 50)
|
||||
{
|
||||
@ -973,8 +973,6 @@ else
|
||||
$totalVolume += $lines[$i]->volume*$lines[$i]->qty_shipped;
|
||||
}
|
||||
}
|
||||
$totalVolume=$totalVolume;
|
||||
//print "totalVolume=".$totalVolume." volumeUnit=".$volumeUnit;
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -1053,49 +1051,50 @@ else
|
||||
// Weight
|
||||
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 $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>';
|
||||
|
||||
// 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 ' ';
|
||||
}
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
// Width
|
||||
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 $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>';
|
||||
|
||||
// Height
|
||||
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 $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>';
|
||||
|
||||
// Depth
|
||||
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 $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>';
|
||||
|
||||
// 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
|
||||
print '<tr><td>'.$langs->trans("Status").'</td>';
|
||||
print '<td colspan="3">'.$object->getLibStatut(4)."</td>\n";
|
||||
|
||||
@ -58,6 +58,8 @@ $entitytoicon = array(
|
||||
'product' => 'product',
|
||||
'warehouse' => 'stock',
|
||||
'category' => 'category',
|
||||
'shipment' => 'sending',
|
||||
'shipment_line'=> 'sending'
|
||||
);
|
||||
|
||||
// Translation code
|
||||
@ -86,7 +88,9 @@ $entitytolang = array(
|
||||
'warehouse' => 'Warehouse',
|
||||
'category' => 'Category',
|
||||
'other' => 'Other',
|
||||
'trip' => 'TripsAndExpenses'
|
||||
'trip' => 'TripsAndExpenses',
|
||||
'shipment' => 'Shipments',
|
||||
'shipment_line'=> 'ShipmentLine'
|
||||
);
|
||||
|
||||
$array_selected=isset($_SESSION["export_selected_fields"])?$_SESSION["export_selected_fields"]:array();
|
||||
|
||||
@ -262,29 +262,27 @@ if ($action == 'confirm_send')
|
||||
$verif = $cp->update($user->id);
|
||||
|
||||
// Si pas d'erreur SQL on redirige vers la fiche de la demande
|
||||
if($verif > 0) {
|
||||
|
||||
// A
|
||||
if ($verif > 0)
|
||||
{
|
||||
// To
|
||||
$destinataire = new User($db);
|
||||
$destinataire->fetch($cp->fk_validator);
|
||||
$emailTo = $destinataire->email;
|
||||
|
||||
// De
|
||||
// From
|
||||
$expediteur = new User($db);
|
||||
$expediteur->fetch($cp->fk_user);
|
||||
$emailFrom = $expediteur->email;
|
||||
|
||||
// Sujet
|
||||
if($conf->global->MAIN_APPLICATION_TITLE != NULL) {
|
||||
$societeName = addslashes($conf->global->MAIN_APPLICATION_TITLE);
|
||||
} else {
|
||||
$societeName = addslashes($conf->global->MAIN_INFO_SOCIETE_NOM);
|
||||
}
|
||||
// Subject
|
||||
$societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
|
||||
$subject = stripslashes($societeName)." - Demande de congés payés à valider";
|
||||
$subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysToValidate");
|
||||
|
||||
// Contenu
|
||||
$message = "Bonjour {$destinataire->prenom},\n\n";
|
||||
// Content
|
||||
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->prenom.",\n";
|
||||
$message.= "\n";
|
||||
$message.= "Veuillez trouver ci-dessous une demande de congés payés à valider.\n";
|
||||
|
||||
$delayForRequest = $cp->getConfCP('delayForRequest');
|
||||
@ -293,16 +291,18 @@ if ($action == 'confirm_send')
|
||||
$nextMonth = dol_time_plus_duree($now, $delayForRequest, 'd');
|
||||
|
||||
// Si l'option pour avertir le valideur en cas de délai trop court
|
||||
if($cp->getConfCP('AlertValidatorDelay')) {
|
||||
if($cp->date_debut < $nextMonth) {
|
||||
if($cp->getConfCP('AlertValidatorDelay'))
|
||||
{
|
||||
if($cp->date_debut < $nextMonth)
|
||||
{
|
||||
$message.= "\n";
|
||||
$message.= "Cette demande de congés payés à été effectué dans un";
|
||||
$message.= " délai de moins de ".$cp->getConfCP('delayForRequest')." jours avant ceux-ci.\n";
|
||||
$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";
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
if ($nbopenedday > $cp->getCPforUser($cp->fk_user))
|
||||
{
|
||||
@ -312,24 +312,26 @@ if ($action == 'confirm_send')
|
||||
}
|
||||
|
||||
$message.= "\n";
|
||||
$message.= "- Demandeur : {$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.= "- Lien : {$dolibarr_main_url_root}/holiday/fiche.php?id={$cp->rowid}\n\n";
|
||||
$message.= "Bien cordialement,\n".$societeName;
|
||||
$message.= "- ".$langs->transnoentitiesnoconv("Name")." : ".$expediteur->prenom." ".$expediteur->nom."\n";
|
||||
$message.= "- ".$langs->transnoentitiesnoconv("Period")." : ".dol_print_date($cp->date_debut,'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($cp->date_fin,'day')."\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);
|
||||
|
||||
// Envoi du mail
|
||||
$result=$mail->sendfile();
|
||||
|
||||
if(!$result) {
|
||||
if (!$result)
|
||||
{
|
||||
header('Location: fiche.php?id='.$_GET['id'].'&error=mail&error_content='.$mail->error);
|
||||
exit;
|
||||
}
|
||||
|
||||
header('Location: fiche.php?id='.$_GET['id']);
|
||||
exit;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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);
|
||||
exit;
|
||||
@ -366,37 +368,34 @@ if($action == 'confirm_valid')
|
||||
$newSolde = $soldeActuel - ($nbJour*$cp->getConfCP('nbHolidayDeducted'));
|
||||
|
||||
// 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
|
||||
$cp->updateSoldeCP($cp->fk_user,$newSolde);
|
||||
|
||||
// A
|
||||
// To
|
||||
$destinataire = new User($db);
|
||||
$destinataire->fetch($cp->fk_user);
|
||||
$emailTo = $destinataire->email;
|
||||
|
||||
// De
|
||||
// From
|
||||
$expediteur = new User($db);
|
||||
$expediteur->fetch($cp->fk_validator);
|
||||
$emailFrom = $expediteur->email;
|
||||
|
||||
// Sujet
|
||||
if($conf->global->MAIN_APPLICATION_TITLE != NULL) {
|
||||
$societeName = addslashes($conf->global->MAIN_APPLICATION_TITLE);
|
||||
} else {
|
||||
$societeName = addslashes($conf->global->MAIN_INFO_SOCIETE_NOM);
|
||||
}
|
||||
// Subject
|
||||
$societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
|
||||
$subject = stripslashes($societeName)." - Demande de congés payés validée";
|
||||
|
||||
// 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;
|
||||
$subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysValidated");
|
||||
|
||||
// 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);
|
||||
|
||||
@ -442,33 +441,30 @@ if ($action == 'confirm_refuse')
|
||||
// Si pas d'erreur SQL on redirige vers la fiche de la demande
|
||||
if($verif > 0) {
|
||||
|
||||
// A
|
||||
// To
|
||||
$destinataire = new User($db);
|
||||
$destinataire->fetch($cp->fk_user);
|
||||
$emailTo = $destinataire->email;
|
||||
|
||||
// De
|
||||
// From
|
||||
$expediteur = new User($db);
|
||||
$expediteur->fetch($cp->fk_validator);
|
||||
$emailFrom = $expediteur->email;
|
||||
|
||||
// Sujet
|
||||
if($conf->global->MAIN_APPLICATION_TITLE != NULL) {
|
||||
$societeName = addslashes($conf->global->MAIN_APPLICATION_TITLE);
|
||||
} else {
|
||||
$societeName = addslashes($conf->global->MAIN_INFO_SOCIETE_NOM);
|
||||
}
|
||||
// Subject
|
||||
$societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
|
||||
$subject = stripslashes($societeName)." - Demande de congés payés refusée";
|
||||
$subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysRefused");
|
||||
|
||||
// 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 refusée pour le motif suivant :\n";
|
||||
// Content
|
||||
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->prenom.",\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.= "- 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;
|
||||
|
||||
$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);
|
||||
|
||||
@ -516,32 +512,29 @@ if ($action == 'confirm_cancel' && $_GET['confirm'] == 'yes')
|
||||
// Si pas d'erreur SQL on redirige vers la fiche de la demande
|
||||
if($verif > 0)
|
||||
{
|
||||
// A
|
||||
// To
|
||||
$destinataire = new User($db);
|
||||
$destinataire->fetch($cp->fk_user);
|
||||
$emailTo = $destinataire->email;
|
||||
|
||||
// De
|
||||
// From
|
||||
$expediteur = new User($db);
|
||||
$expediteur->fetch($cp->fk_validator);
|
||||
$emailFrom = $expediteur->email;
|
||||
|
||||
// Sujet
|
||||
if($conf->global->MAIN_APPLICATION_TITLE != NULL) {
|
||||
$societeName = addslashes($conf->global->MAIN_APPLICATION_TITLE);
|
||||
} else {
|
||||
$societeName = addslashes($conf->global->MAIN_INFO_SOCIETE_NOM);
|
||||
}
|
||||
// Subject
|
||||
$societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
|
||||
$subject = stripslashes($societeName)."- Demande de congés payés annulée";
|
||||
|
||||
// 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;
|
||||
$subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysCanceled");
|
||||
|
||||
// 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);
|
||||
|
||||
@ -800,7 +793,7 @@ else
|
||||
{
|
||||
|
||||
if ($action == 'delete' && $cp->statut == 1) {
|
||||
if($user->rights->holiday->delete)
|
||||
if($user->rights->holiday->delete)
|
||||
{
|
||||
$ret=$form->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleDeleteCP"),$langs->trans("ConfirmDeleteCP"),"confirm_delete", '', 0, 1);
|
||||
if ($ret == 'html') print '<br />';
|
||||
@ -808,21 +801,21 @@ else
|
||||
}
|
||||
|
||||
// Si envoi en validation
|
||||
if ($action == 'sendToValidate' && $cp->statut == 1 && $userID == $cp->fk_user)
|
||||
if ($action == 'sendToValidate' && $cp->statut == 1 && $userID == $cp->fk_user)
|
||||
{
|
||||
$ret=$form->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleToValidCP"),$langs->trans("ConfirmToValidCP"),"confirm_send", '', 0, 1);
|
||||
if ($ret == 'html') print '<br />';
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
$ret=$form->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleValidCP"),$langs->trans("ConfirmValidCP"),"confirm_valid", '', 0, 1);
|
||||
if ($ret == 'html') print '<br />';
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
$array_input = array(array('type'=>"text",'label'=>"Entrez ci-dessous un motif de refus :",'name'=>"detail_refuse",'size'=>"50",'value'=>""));
|
||||
$ret=$form->form_confirm("fiche.php?id=".$_GET['id']."&action=confirm_refuse",$langs->trans("TitleRefuseCP"),"","confirm_refuse",$array_input,"",0);
|
||||
@ -830,7 +823,7 @@ else
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
$ret=$form->form_confirm("fiche.php?id=".$_GET['id'],$langs->trans("TitleCancelCP"),$langs->trans("ConfirmCancelCP"),"confirm_cancel", '', 0, 1);
|
||||
if ($ret == 'html') print '<br />';
|
||||
@ -990,27 +983,27 @@ else
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
if (! $edit)
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
// 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">'.$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">'.$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">'.$langs->trans("SendToValidationCP").'</a>';
|
||||
}
|
||||
|
||||
// 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">'.$langs->trans("ActionValidCP").'</a>';
|
||||
print '<a href="fiche.php?id='.$_GET['id'].'&action=refuse" class="butAction">'.$langs->trans("ActionRefuseCP").'</a>';
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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 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_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;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2003-2010 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- 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>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
@ -42,12 +42,12 @@ create table llx_expedition
|
||||
tracking_number varchar(50),
|
||||
fk_statut smallint DEFAULT 0,
|
||||
|
||||
height integer,
|
||||
width integer,
|
||||
size_units integer,
|
||||
size integer,
|
||||
weight_units integer,
|
||||
weight integer,
|
||||
height integer, -- height
|
||||
width integer, -- with
|
||||
size_units integer, -- unit of all sizes (height, width, depth)
|
||||
size integer, -- depth
|
||||
weight_units integer, -- unit of weight
|
||||
weight integer, -- weight
|
||||
note text,
|
||||
model_pdf varchar(255)
|
||||
|
||||
|
||||
@ -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).
|
||||
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].
|
||||
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
|
||||
Separator=Separator
|
||||
Enclosure=Enclosure
|
||||
|
||||
@ -24,6 +24,7 @@ ConfirmDeleteInterventionLine=Are you sure you want to delete this intervention
|
||||
NameAndSignatureOfInternalContact=Name and signature of intervening :
|
||||
NameAndSignatureOfExternalContact=Name and signature of customer :
|
||||
DocumentModelStandard=Standard document model for interventions
|
||||
InterventionCardsAndInterventionLines=Interventions and lines of interventions
|
||||
ClassifyBilled=Classify "Billed"
|
||||
StatusInterInvoiced=Billed
|
||||
RelatedInterventions=Related interventions
|
||||
|
||||
@ -77,8 +77,8 @@ MailingStatusRead=Read
|
||||
CheckRead=Read Receipt
|
||||
YourMailUnsubcribeOK=The email <b>%s</b> is correctly unsubcribe from mailing list
|
||||
MailtoEMail=Hyper link to email
|
||||
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
|
||||
ActivateCheckRead=Allow to use the "Read receipt" tracker and the "Unsubcribe" link
|
||||
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
|
||||
|
||||
@ -93,6 +93,7 @@ CloneFiles=Clone joined files
|
||||
ConfirmCloneProject=Are you sure to clone this project ?
|
||||
ProjectReportDate=Change task date according project start date
|
||||
ErrorShiftTaskDate=Impossible to shift task date according to new project start date
|
||||
ProjectsAndTasksLines=Projects and tasks
|
||||
##### Types de contacts #####
|
||||
TypeContact_project_internal_PROJECTLEADER=Project leader
|
||||
TypeContact_project_external_PROJECTLEADER=Project leader
|
||||
|
||||
@ -58,6 +58,7 @@ ActionsOnShipping=Events on shipment
|
||||
LinkToTrackYourPackage=Link to track your package
|
||||
ShipmentCreationIsDoneFromOrder=For the moment, creation of a new shipment is done from the order card.
|
||||
RelatedShippings=Related shippings
|
||||
ShipmentLine=Shipment line
|
||||
|
||||
# Sending methods
|
||||
SendingMethodCATCH=Catch by customer
|
||||
|
||||
@ -75,10 +75,10 @@ DateSending=Date envoi
|
||||
SentTo=Envoyés à <b>%s</b>
|
||||
MailingStatusRead=Lu
|
||||
CheckRead=Accusé de lecture
|
||||
YourMailUnsubcribeOK=L'adresse e-mail <b>%s</b> est bien désincrite de la liste.
|
||||
MailtoEMail=Ecrire a e-mail (lien)
|
||||
ActivateCheckRead=Permettre l'utilisation du tracker d'accusé de lecture et du lien de désincription
|
||||
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
|
||||
YourMailUnsubcribeOK=L'adresse e-mail <b>%s</b> est bien désinscrite de la liste.
|
||||
MailtoEMail=Ecrire un e-mail (lien)
|
||||
ActivateCheckRead=Permettre l'utilisation du tracker d'accusé de lecture et du lien de désinscription
|
||||
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
|
||||
@ -86,7 +86,7 @@ MailingModuleDescContactCompanies=Contacts de tiers (prospects, clients, fournis
|
||||
MailingModuleDescDolibarrUsers=Utilisateurs de Dolibarr
|
||||
MailingModuleDescFundationMembers=Adhérents
|
||||
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)
|
||||
MailingModuleDescDolibarrContractsLinesExpired=Tiers avec lignes de contrats de services expirées
|
||||
MailingModuleDescContactsByCompanyCategory=Contacts de tiers (par catégorie de tiers)
|
||||
@ -106,11 +106,11 @@ SendMailing=Envoi emailing
|
||||
SendMail=Envoi mail
|
||||
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 :
|
||||
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 ?
|
||||
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
|
||||
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
|
||||
NbOfEMailingsReceived=EMailings de masse reçus
|
||||
IdRecord=ID enregistrement
|
||||
|
||||
@ -93,6 +93,7 @@ CloneFiles=Cloner les pièces jointes
|
||||
ConfirmCloneProject=Êtes-vous sûr de vouloir cloner ce projet ?
|
||||
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.
|
||||
ProjectsAndTasksLines=Projets et taches
|
||||
##### Types de contacts #####
|
||||
TypeContact_project_internal_PROJECTLEADER=Chef de projet
|
||||
TypeContact_project_external_PROJECTLEADER=Chef de projet
|
||||
|
||||
@ -58,6 +58,7 @@ ActionsOnShipping=Événements sur l'expédition
|
||||
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.
|
||||
RelatedShippings=Expédition(s) associée(s)
|
||||
ShipmentLine=Ligne d'expédition
|
||||
|
||||
# Sending methods
|
||||
SendingMethodCATCH=Enlèvement par le client
|
||||
|
||||
@ -40,8 +40,8 @@ TransData=Date Transmission
|
||||
TransMetod=Méthode Transmission
|
||||
Send=Envoyer
|
||||
Lines=Lignes
|
||||
StandingOrderReject=Emmètre un rejet
|
||||
InvoiceRefused=Facture rejeté
|
||||
StandingOrderReject=Émettre un rejet
|
||||
InvoiceRefused=Facture rejetée
|
||||
WithdrawalRefused=Rejet de prélèvement
|
||||
WithdrawalRefusedConfirm=Êtes-vous sûr de vouloir saisir un rejet de prélèvement pour la société
|
||||
RefusedData=Date du rejet
|
||||
@ -70,25 +70,25 @@ CreateBanque=Seulement banque
|
||||
OrderWaiting=En attente de traitement
|
||||
NotifyTransmision=Transmission du bon
|
||||
NotifyEmision=Emission du bon
|
||||
NotifyCredit=Credit du bon
|
||||
NotifyCredit=Crédit du bon
|
||||
NumeroNationalEmetter= Numéro National Émetteur
|
||||
PleaseSelectCustomerBankBANToWithdraw=Saisissez les informations du compte bancaire client à prélever
|
||||
WithBankUsingRIB=Pour les comptes bancaires utilisant le RIB
|
||||
WithBankUsingBANBIC=Pour les comptes bancaires utilisant le code BAN/BIC/SWIFT
|
||||
BankToReceiveWithdraw=Compte bancaire recevant les prélèvements
|
||||
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
|
||||
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
|
||||
InfoCreditSubject=Credit prélèvement %s a la banque
|
||||
InfoCreditMessage=Le bon de prélèvement %s a eté credité par la banque.<br>Date credit : %s
|
||||
InfoTransSubject=Transmission du prélèvement %s a la banque
|
||||
InfoTransMessage=Le bon de prélèvement %s a eté transmis a la banque par %s %s.<br><br>
|
||||
InfoTransData=Montant: %s<br>Methode: %s<br>Date: %s
|
||||
InfoFoot=Ceci est un message automatique envoye par Dolibarr
|
||||
InfoCreditSubject=Crédit prélèvement %s à la banque
|
||||
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 à la banque
|
||||
InfoTransMessage=Le bon de prélèvement %s a été transmis à la banque par %s %s.<br><br>
|
||||
InfoTransData=Montant: %s<br>Méthode: %s<br>Date: %s
|
||||
InfoFoot=Ceci est un message automatique envoyé par Dolibarr
|
||||
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
|
||||
@ -946,13 +946,10 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
||||
if (! $disablejs && ! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$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
|
||||
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";
|
||||
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";
|
||||
|
||||
@ -212,6 +212,6 @@ if (! defined('NOREQUIRETRAN'))
|
||||
if (! defined('MAIN_LABEL_MENTION_NPR') ) define('MAIN_LABEL_MENTION_NPR','NPR');
|
||||
|
||||
// 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;
|
||||
|
||||
?>
|
||||
|
||||
@ -36,6 +36,9 @@ function llxHeaderPaypal($title, $head = "")
|
||||
|
||||
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//EN" http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd>';
|
||||
print "\n";
|
||||
@ -43,7 +46,7 @@ function llxHeaderPaypal($title, $head = "")
|
||||
print "<head>\n";
|
||||
print '<meta name="robots" content="noindex,nofollow">'."\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";
|
||||
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";
|
||||
@ -63,9 +66,6 @@ function llxHeaderPaypal($title, $head = "")
|
||||
|
||||
// Output standard javascript links
|
||||
$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
|
||||
print '<!-- Includes JS for JQuery -->'."\n";
|
||||
@ -73,8 +73,8 @@ function llxHeaderPaypal($title, $head = "")
|
||||
// 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.'/core/js/jnotify.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'.$ext.'"></script>'."\n";
|
||||
}
|
||||
}
|
||||
print "</head>\n";
|
||||
|
||||
@ -1441,7 +1441,7 @@ font-family: <?php print $fontlist ?>;
|
||||
|
||||
.ok { color: #114466; }
|
||||
.warning { color: #887711; }
|
||||
.error { color: #550000; font-weight: bold; }
|
||||
.error { color: #550000 !important; font-weight: bold; }
|
||||
|
||||
td.highlights { background: #f9c5c6; }
|
||||
|
||||
|
||||
@ -1595,7 +1595,7 @@ font-family: <?php print $fontlist ?>;
|
||||
|
||||
.ok { color: #114466; }
|
||||
.warning { color: #887711; }
|
||||
.error { color: #550000; font-weight: bold; }
|
||||
.error { color: #550000 !important; font-weight: bold; }
|
||||
|
||||
td.highlights { background: #f9c5c6; }
|
||||
|
||||
|
||||
@ -52,9 +52,8 @@ if (isset($conf->modules_parts['css']))
|
||||
}
|
||||
// JQuery. Must be before other includes
|
||||
$ext='.js';
|
||||
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) $ext='.jgz';
|
||||
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";
|
||||
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).'" />
|
||||
|
||||
@ -53,9 +53,8 @@ if (isset($conf->modules_parts['css']))
|
||||
}
|
||||
// JQuery. Must be before other includes
|
||||
$ext='.js';
|
||||
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) $ext='.jgz';
|
||||
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";
|
||||
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;
|
||||
|
||||
@ -1511,7 +1511,7 @@ font-family: <?php print $fontlist ?>;
|
||||
*/
|
||||
.ok { color: #114466; }
|
||||
.warning { color: #887711; }
|
||||
.error { color: #550000; font-weight: bold; }
|
||||
.error { color: #550000 !important; font-weight: bold; }
|
||||
|
||||
div.ok {
|
||||
color: #114466;
|
||||
|
||||
@ -1762,9 +1762,7 @@ tr.fiche {
|
||||
*/
|
||||
.ok { color: #114466; }
|
||||
.warning { color: #887711; }
|
||||
.error { color: #550000; font-weight: bold; }
|
||||
|
||||
td.highlights { background: #f9c5c6; }
|
||||
.error { color: #550000 !important; font-weight: bold; }
|
||||
|
||||
div.ok {
|
||||
color: #114466;
|
||||
|
||||
98
htdocs/webservices/demo_wsclient_category.php-NORUN
Executable file
98
htdocs/webservices/demo_wsclient_category.php-NORUN
Executable 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";;
|
||||
?>
|
||||
141
htdocs/webservices/demo_wsclient_order.php-NORUN
Executable file
141
htdocs/webservices/demo_wsclient_order.php-NORUN
Executable 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";;
|
||||
?>
|
||||
307
htdocs/webservices/server_category.php
Executable file
307
htdocs/webservices/server_category.php
Executable 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);
|
||||
|
||||
?>
|
||||
778
htdocs/webservices/server_order.php
Normal file
778
htdocs/webservices/server_order.php
Normal 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);
|
||||
|
||||
?>
|
||||
@ -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.'/product/class/product.class.php';
|
||||
require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php");
|
||||
|
||||
|
||||
|
||||
dol_syslog("Call Dolibarr webservices interfaces");
|
||||
@ -112,8 +114,17 @@ $server->wsdl->addComplexType(
|
||||
'price_net' => array('name'=>'price_net','type'=>'xsd:string'),
|
||||
'price' => array('name'=>'price','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'),
|
||||
|
||||
'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_real' => array('name'=>'stock_real','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'
|
||||
);
|
||||
|
||||
// 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
|
||||
@ -320,9 +345,21 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='')
|
||||
'country_code' => $product->country_code,
|
||||
'custom_code' => $product->customcode,
|
||||
|
||||
'price_net' => $product->price,
|
||||
'price' => ($product->price_ttc-$product->price),
|
||||
'vat_rate' => $product->tva_tx,
|
||||
'price_net' => $product->price, // todo : DEPRECATED ?
|
||||
//'price' => ($product->price_ttc-$product->price),
|
||||
'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_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.
|
||||
|
||||
@ -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
|
||||
@ -144,6 +172,19 @@ $server->register(
|
||||
'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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
||||
6
robots.txt
Normal file
6
robots.txt
Normal file
@ -0,0 +1,6 @@
|
||||
User-agent: *
|
||||
Disallow: /build
|
||||
Disallow: /dev
|
||||
Disallow: /doc
|
||||
Disallow: /scripts
|
||||
Disallow: /test
|
||||
Loading…
Reference in New Issue
Block a user