From 65090c582d65f56a0eff6216289d02ba0a9304f3 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 15 Dec 2012 11:39:47 +0100 Subject: [PATCH] Fix: checkstyle --- htdocs/comm/action/contact.php | 2 +- htdocs/core/lib/project.lib.php | 2 +- .../commande/doc/pdf_einstein.modules.php | 20 +- .../modules/facture/doc/pdf_crabe.modules.php | 20 +- .../modules/propale/doc/pdf_azur.modules.php | 20 +- htdocs/product/class/product.class.php | 4 +- htdocs/theme/amarok/ckeditor/config.js | 164 ++++---- htdocs/webservices/server_order.php | 393 +++++++++--------- 8 files changed, 317 insertions(+), 308 deletions(-) diff --git a/htdocs/comm/action/contact.php b/htdocs/comm/action/contact.php index 625dd854790..897b040deb9 100644 --- a/htdocs/comm/action/contact.php +++ b/htdocs/comm/action/contact.php @@ -341,7 +341,7 @@ if ($id > 0 || ! empty($ref)) foreach(array('internal','external') as $source) { $tab = $object->liste_contact(-1,$source); - $num=sizeof($tab); + $num=count($tab); $i = 0; while ($i < $num) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 93016144b29..d6adc240c9d 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -496,7 +496,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr { print "   "; } - $taskstatic->id=$lines[$i]->id; + $taskstatic->id=$lines[$i]->id; $taskstatic->ref=$lines[$i]->label; print $taskstatic->getNomUrl(0); print "\n"; diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 0e179e4fb3c..2d93cccafd7 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -736,7 +736,7 @@ class pdf_einstein extends ModelePDFCommandes //$this->atleastoneratenotnull++; $index++; - $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $tvacompl=''; if (preg_match('/\*/',$tvakey)) @@ -748,7 +748,7 @@ class pdf_einstein extends ModelePDFCommandes $totalvat.=vatrate($tvakey,1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } } @@ -775,7 +775,7 @@ class pdf_einstein extends ModelePDFCommandes $index++; - $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $tvacompl=''; if (preg_match('/\*/',$tvakey)) @@ -787,7 +787,7 @@ class pdf_einstein extends ModelePDFCommandes $totalvat.=vatrate($tvakey,1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } @@ -837,7 +837,7 @@ class pdf_einstein extends ModelePDFCommandes //$this->atleastoneratenotnull++; $index++; - $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $tvacompl=''; if (preg_match('/\*/',$tvakey)) @@ -849,14 +849,14 @@ class pdf_einstein extends ModelePDFCommandes if ($localtax_type == '7') { // amount on order $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1); } else { $totalvat.=vatrate($tvakey,1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } } @@ -881,7 +881,7 @@ class pdf_einstein extends ModelePDFCommandes //$this->atleastoneratenotnull++; $index++; - $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $tvacompl=''; if (preg_match('/\*/',$tvakey)) @@ -893,7 +893,7 @@ class pdf_einstein extends ModelePDFCommandes if ($localtax_type == '7') { // amount on order $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1); } else @@ -901,7 +901,7 @@ class pdf_einstein extends ModelePDFCommandes $totalvat.=vatrate($tvakey,1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index fc2c2fb2872..4e878460d66 100755 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -868,7 +868,7 @@ class pdf_crabe extends ModelePDFFactures //$this->atleastoneratenotnull++; $index++; - $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $tvacompl=''; if (preg_match('/\*/',$tvakey)) @@ -880,7 +880,7 @@ class pdf_crabe extends ModelePDFFactures $totalvat.=vatrate($tvakey,1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } } @@ -907,7 +907,7 @@ class pdf_crabe extends ModelePDFFactures $index++; - $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $tvacompl=''; if (preg_match('/\*/',$tvakey)) @@ -919,7 +919,7 @@ class pdf_crabe extends ModelePDFFactures $totalvat.=vatrate($tvakey,1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } @@ -969,7 +969,7 @@ class pdf_crabe extends ModelePDFFactures //$this->atleastoneratenotnull++; $index++; - $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $tvacompl=''; if (preg_match('/\*/',$tvakey)) @@ -981,14 +981,14 @@ class pdf_crabe extends ModelePDFFactures if ($localtax_type == '7') { // amount on order $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1); } else { $totalvat.=vatrate($tvakey,1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } } @@ -1014,7 +1014,7 @@ class pdf_crabe extends ModelePDFFactures //$this->atleastoneratenotnull++; $index++; - $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $tvacompl=''; if (preg_match('/\*/',$tvakey)) @@ -1026,7 +1026,7 @@ class pdf_crabe extends ModelePDFFactures if ($localtax_type == '7') { // amount on order $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1); } else @@ -1034,7 +1034,7 @@ class pdf_crabe extends ModelePDFFactures $totalvat.=vatrate($tvakey,1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } } diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 3459b045b62..9250296bf67 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -769,7 +769,7 @@ class pdf_azur extends ModelePDFPropales //$this->atleastoneratenotnull++; $index++; - $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $tvacompl=''; if (preg_match('/\*/',$tvakey)) @@ -781,7 +781,7 @@ class pdf_azur extends ModelePDFPropales $totalvat.=vatrate($tvakey,1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } } @@ -808,7 +808,7 @@ class pdf_azur extends ModelePDFPropales $index++; - $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $tvacompl=''; if (preg_match('/\*/',$tvakey)) @@ -820,7 +820,7 @@ class pdf_azur extends ModelePDFPropales $totalvat.=vatrate($tvakey,1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } @@ -870,7 +870,7 @@ class pdf_azur extends ModelePDFPropales //$this->atleastoneratenotnull++; $index++; - $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $tvacompl=''; if (preg_match('/\*/',$tvakey)) @@ -882,14 +882,14 @@ class pdf_azur extends ModelePDFPropales if ($localtax_type == '7') { // amount on order $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1); } else { $totalvat.=vatrate($tvakey,1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } } @@ -914,7 +914,7 @@ class pdf_azur extends ModelePDFPropales //$this->atleastoneratenotnull++; $index++; - $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $tvacompl=''; if (preg_match('/\*/',$tvakey)) @@ -926,7 +926,7 @@ class pdf_azur extends ModelePDFPropales if ($localtax_type == '7') { // amount on order $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1); } else @@ -934,7 +934,7 @@ class pdf_azur extends ModelePDFPropales $totalvat.=vatrate($tvakey,1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index daff25aebc1..4f6fee8b312 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1223,7 +1223,7 @@ class Product extends CommonObject $sql.= " WHERE fk_product_price = '".$this->prices_by_qty_id[$i]."'"; $sql.= " ORDER BY quantity ASC"; $resultat=array(); - $resql = $this->db->query($sql) ; + $resql = $this->db->query($sql); if ($resql) { $ii=0; @@ -1276,7 +1276,7 @@ class Product extends CommonObject $sql.= " WHERE fk_product_price = '".$this->prices_by_qty_id[0]."'"; $sql.= " ORDER BY quantity ASC"; $resultat=array(); - $resql = $this->db->query($sql) ; + $resql = $this->db->query($sql); if ($resql) { $ii=0; diff --git a/htdocs/theme/amarok/ckeditor/config.js b/htdocs/theme/amarok/ckeditor/config.js index ad6868029ee..699f7d61ec7 100755 --- a/htdocs/theme/amarok/ckeditor/config.js +++ b/htdocs/theme/amarok/ckeditor/config.js @@ -1,82 +1,82 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -CKEDITOR.editorConfig = function( config ) -{ - // Define changes to default configuration here. - // http://docs.cksource.com/CKEditor_3.x/Developers_Guide - // http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html - config.enterMode = CKEDITOR.ENTER_BR; - config.resize_enabled = false; - //config.resize_maxHeight = 3000; - //config.resize_maxWidth = 3000; - //config.height = '300px'; - //config.resize_dir = 'vertical'; // horizontal, vertical, both - config.removePlugins = 'elementspath,save'; // config.removePlugins = 'elementspath,save,font'; - config.removeDialogTabs = 'flash:advanced'; // config.removeDialogTabs = 'flash:advanced;image:Link'; - config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // Prevent PHP Code to be formatted - //config.menu_groups = 'clipboard,table,anchor,link,image'; // for context menu 'clipboard,form,tablecell,tablecellproperties,tablerow,tablecolumn,table,anchor,link,image,flash,checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea' - //config.language = 'de'; - //config.defaultLanguage = 'en'; - //config.contentsLanguage = 'fr'; - config.fullPage = false; // Not a full html page string, just part of it - config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)'; - //config.contentsCss = '/css/mysitestyles.css'; - config.image_previewText=' '; - - config.toolbar_Full = - [ - ['Source','-','Save','NewPage','Preview','-','Templates'], - ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'], - ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], - ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'], - '/', - ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], - ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['BidiLtr', 'BidiRtl'], - ['Link','Unlink','Anchor'], - ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'], - '/', - ['Styles','Format','Font','FontSize'], - ['TextColor','BGColor'], - ['Maximize', 'ShowBlocks','-','About'] - ]; - - config.toolbar_dolibarr_mailings = - [ - ['Source','Maximize'], - ['Cut','Copy','Paste','-','SpellChecker'], - ['Undo','Redo','-','Find','Replace'], - ['Font','FontSize'], - ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], - ['NumberedList','BulletedList','Outdent','Indent'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','Anchor','Image','Table','SpecialChar'] - ]; - - config.toolbar_dolibarr_notes = - [ - ['Source'], - ['Cut','Copy','Paste','-','SpellChecker'], - ['Undo','Redo','-','Find','Replace'], - ['Font','FontSize'], - ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], - ['NumberedList','BulletedList','Outdent','Indent'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','Image','Table','SpecialChar'] - ]; - - config.toolbar_dolibarr_details = - [ - ['Source','Maximize'], - ['Cut','Copy','Paste','-','SpellChecker'], - ['Font','FontSize'], - ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], - ['NumberedList','BulletedList','Outdent','Indent'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['SpecialChar'] - ]; -}; +/* +Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ + +CKEDITOR.editorConfig = function( config ) +{ + // Define changes to default configuration here. + // http://docs.cksource.com/CKEditor_3.x/Developers_Guide + // http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html + config.enterMode = CKEDITOR.ENTER_BR; + config.resize_enabled = false; + //config.resize_maxHeight = 3000; + //config.resize_maxWidth = 3000; + //config.height = '300px'; + //config.resize_dir = 'vertical'; // horizontal, vertical, both + config.removePlugins = 'elementspath,save'; // config.removePlugins = 'elementspath,save,font'; + config.removeDialogTabs = 'flash:advanced'; // config.removeDialogTabs = 'flash:advanced;image:Link'; + config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // Prevent PHP Code to be formatted + //config.menu_groups = 'clipboard,table,anchor,link,image'; // for context menu 'clipboard,form,tablecell,tablecellproperties,tablerow,tablecolumn,table,anchor,link,image,flash,checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea' + //config.language = 'de'; + //config.defaultLanguage = 'en'; + //config.contentsLanguage = 'fr'; + config.fullPage = false; // Not a full html page string, just part of it + config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)'; + //config.contentsCss = '/css/mysitestyles.css'; + config.image_previewText=' '; + + config.toolbar_Full = + [ + ['Source','-','Save','NewPage','Preview','-','Templates'], + ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'], + ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], + ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'], + '/', + ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], + ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['BidiLtr', 'BidiRtl'], + ['Link','Unlink','Anchor'], + ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'], + '/', + ['Styles','Format','Font','FontSize'], + ['TextColor','BGColor'], + ['Maximize', 'ShowBlocks','-','About'] + ]; + + config.toolbar_dolibarr_mailings = + [ + ['Source','Maximize'], + ['Cut','Copy','Paste','-','SpellChecker'], + ['Undo','Redo','-','Find','Replace'], + ['Font','FontSize'], + ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], + ['NumberedList','BulletedList','Outdent','Indent'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['Link','Unlink','Anchor','Image','Table','SpecialChar'] + ]; + + config.toolbar_dolibarr_notes = + [ + ['Source'], + ['Cut','Copy','Paste','-','SpellChecker'], + ['Undo','Redo','-','Find','Replace'], + ['Font','FontSize'], + ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], + ['NumberedList','BulletedList','Outdent','Indent'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['Link','Unlink','Image','Table','SpecialChar'] + ]; + + config.toolbar_dolibarr_details = + [ + ['Source','Maximize'], + ['Cut','Copy','Paste','-','SpellChecker'], + ['Font','FontSize'], + ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], + ['NumberedList','BulletedList','Outdent','Indent'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['SpecialChar'] + ]; +}; diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 951147c9bee..2b5b8233464 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -1,6 +1,7 @@ - * Copyright (C) 2012 JF FERRY +/* Copyright (C) 2006-2010 Laurent Destailleur + * Copyright (C) 2012 JF FERRY + * Copyright (C) 2012 Regis Houssin * * 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 @@ -55,169 +56,181 @@ $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'), - ) + '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'), + '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'), + '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'), + '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'), + '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') - ) + // 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') - ) + 'LinesArray', + 'complexType', + 'array', + '', + 'SOAP-ENC:Array', + array(), + array( + array( + 'ref'=>'SOAP-ENC:arrayType', + 'wsdl:arrayType'=>'tns:line[]' + ) + ), + 'tns:line' ); $server->wsdl->addComplexType( - 'OrdersArray', - 'complexType', - 'array', - '', - 'SOAP-ENC:Array', - array(), - array( - array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:order[]') - ), - 'tns:order' + 'LinesArray2', + 'complexType', + 'array', + 'sequence', + '', + array( + 'line' => array( + 'name' => 'line', + 'type' => 'tns:line', + 'minOccurs' => '0', + 'maxOccurs' => 'unbounded' + ) + ) ); $server->wsdl->addComplexType( - 'OrdersArray2', - 'complexType', - 'array', - 'sequence', - '', - array( - 'order' => array( - 'name' => 'invoice', - 'type' => 'tns:invoice', - 'minOccurs' => '0', - 'maxOccurs' => 'unbounded' - ) - ) + '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( - 'result', - 'complexType', - 'struct', - 'all', - '', - array( - 'result_code' => array('name'=>'result_code','type'=>'xsd:string'), - 'result_label' => array('name'=>'result_label','type'=>'xsd:string'), - ) + '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' + ), + ) ); @@ -230,54 +243,50 @@ $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( + 'getOrder', + array('authentication'=>'tns:authentication','id'=>'xsd:string','ref'=>'xsd:string','ref_ext'=>'xsd:string'), // Entry values + array('result'=>'tns:result','order'=>'tns:order'), // Exit values + $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( + 'getOrdersForThirdParty', + array('authentication'=>'tns:authentication','idthirdparty'=>'xsd:string'), // Entry values + array('result'=>'tns:result','orders'=>'tns:OrdersArray2'), // Exit values + $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' +$server->register( + 'createOrder', + array('authentication'=>'tns:authentication','order'=>'tns:order'), // Entry values + array('result'=>'tns:result','id'=>'xsd:string'), // Exit values + $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' +$server->register( + 'validOrder', + array('authentication'=>'tns:authentication','id'=>'xsd:string'), // Entry values + array('result'=>'tns:result'), // Exit values + $ns, + $ns.'#validOrder', + $styledoc, + $styleuse, + 'WS to valid an order' ); /** @@ -605,7 +614,7 @@ function createOrder($authentication,$order) $now=dol_now(); - dol_syslog("Function: createOrder login=".$authentication['login']." socid :".$order['socid'] ); + dol_syslog("Function: createOrder login=".$authentication['login']." socid :".$order['socid']); // Init and check authentication $objectresp=array(); @@ -633,17 +642,17 @@ function createOrder($authentication,$order) $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']; @@ -656,7 +665,7 @@ function createOrder($authentication,$order) $newline->fk_product=$line['fk_product']; $newobject->lines[]=$newline; } - + $db->begin(); @@ -762,7 +771,7 @@ function validOrder($authentication,$id='') { $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); } - else + else { $db->commit(); $objectresp= array('result'=>array('result_code'=>'OK', 'result_label'=>''));