2
0
forked from Wavyzz/dolibarr

Merge branch 'upstream/develop'

This commit is contained in:
aspangaro
2014-05-28 05:35:35 +02:00
169 changed files with 638 additions and 238 deletions

View File

@@ -100,8 +100,9 @@ tools:
comparison_of_bit_result: true
basic_semantic_checks:
enabled: true
# Disabled unused code. In most cases, we want to keep it.
unused_code:
enabled: true
enabled: false
deprecation_checks:
enabled: true
useless_function_calls:

View File

@@ -229,7 +229,9 @@ from origin/upstream and origin/pristine.
* If new upstream is available onto sourceforge, launch:
> debian/get-orig-source.sh
* Edit tgz file to remove ckeditor and phpexcel and renama file into dolibarr-x.y.z+dsfgw.tgz
* Edit tgz file to remove ckeditor and phpexcel and rename file into
dolibarr-x.y.z+dsfgw.tgz
(x.y.z = version, w start from 1 and is increased for each new import)
* Staying into git root directory, run
> git-import-orig -vv ../dolibarr-x.y.z+dsfgw.tgz

View File

@@ -14,4 +14,3 @@ $force_install_databaserootpass='root';
$force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1';
$force_install_lockinstall='444';
?>

View File

@@ -452,6 +452,7 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/adapters`; # Keep this removal in case we embed libraries
#$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/_source`; # _source must be kept into tarball
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/datatables/extras/TableTools/swf`; # Source of this flash is not available
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;

View File

@@ -115,4 +115,3 @@ else
$db->close();
return $error;
?>

23
dev/rmphpclosingtag.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/bash
# vim:ft=sh:ts=3:sts=3:sw=3:et:
###
# Strips the closing php tag `?>` and any following blank lines from the
# end of any PHP file in the current working directory and sub-directories. Files
# with non-whitespace characters following the closing tag will not be affected.
#
# Author: Bryan C. Geraghty <bryan@ravensight.org>
# Date: 2009-10-28
# Source: http://bryan.ravensight.org/2010/07/remove-php-closing-tag/
##
FILES=$(pcregrep -rnM --include='^.*\.php$' '^\?\>(?=([\s\n]+)?$(?!\n))' .);
for MATCH in $FILES;
do
FILE=`echo $MATCH | awk -F ':' '{print $1}'`;
TARGET=`echo $MATCH | awk -F ':' '{print $2}'`;
LINE_COUNT=`wc -l $FILE | awk -F " " '{print $1}'`;
echo "Removing lines ${TARGET} through ${LINE_COUNT} from file $FILE...";
sed -i "${TARGET},${LINE_COUNT}d" $FILE;
done;

View File

@@ -371,4 +371,3 @@ class Skeleton_Class extends CommonObject
}
}
?>

View File

@@ -271,4 +271,3 @@ function createSkeleton($authentication,$skeleton)
// Return the results.
$server->service($HTTP_RAW_POST_DATA);
?>

View File

@@ -338,4 +338,3 @@ class autoTranslator
}
}
?>

View File

@@ -264,4 +264,3 @@ foreach($filesToProcess as $fileToProcess)
return 0;
?>

View File

@@ -93,4 +93,3 @@ class AccountancyAccount
}
}
?>

View File

@@ -62,7 +62,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
*/
private function getTitle($action)
{
global $langs;
global $langs,$conf;
$out='';

View File

@@ -138,7 +138,7 @@ if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights
if ($_POST["userid"] != $object->user_id) // If link differs from currently in database
{
$result=$object->setUserId($_POST["userid"]);
if ($result < 0) dol_print_error($object->db,$object->error);
if ($result < 0) dol_print_error('',$object->error);
$_POST['action']='';
$action='';
}
@@ -172,7 +172,7 @@ if ($action == 'setsocid')
if (! $error)
{
$result=$object->setThirdPartyId(GETPOST('socid','int'));
if ($result < 0) dol_print_error($object->db,$object->error);
if ($result < 0) dol_print_error('',$object->error);
$_POST['action']='';
$action='';
}
@@ -1101,4 +1101,3 @@ else
llxFooter();
$db->close();
?>

View File

@@ -280,4 +280,3 @@ print '<br>';
llxFooter();
$db->close();
?>

View File

@@ -95,6 +95,8 @@ class Adherent extends CommonObject
var $first_subscription_date;
var $first_subscription_amount;
var $last_subscription_date;
var $last_subscription_date_start;
var $last_subscription_date_end;
var $last_subscription_amount;
var $subscriptions=array();

View File

@@ -99,7 +99,9 @@ class AdherentType extends CommonObject
*/
function update($user)
{
global $hookmanager;
global $hookmanager,$conf;
$error=0;
$this->libelle=trim($this->libelle);
@@ -116,6 +118,8 @@ class AdherentType extends CommonObject
$result = $this->db->query($sql);
if ($result)
{
$action='update';
// Actions on extra fields (by external module or standard code)
$hookmanager->initHooks(array('membertypedao'));
$parameters=array('membertype'=>$this->id);

View File

@@ -64,7 +64,7 @@ else if ($action == 'update')
{
if (GETPOST('submit_GENBARCODE_LOCATION'))
{
$location = GETPOST('genbarcodelocation','alpha');
$location = GETPOST('GENBARCODE_LOCATION','alpha');
$res = dolibarr_set_const($db, "GENBARCODE_LOCATION",$location,'chaine',0,'',$conf->entity);
}
if (GETPOST('submit_PRODUIT_DEFAULT_BARCODE_TYPE'))

View File

@@ -468,4 +468,3 @@ print '</table>';
llxFooter();
$db->close();
?>

View File

@@ -170,4 +170,3 @@ print '<br /><br /><div style="text-align:center"><input type="submit" class="bu
$db->close();
llxFooter();
?>

View File

@@ -511,4 +511,3 @@ print '<br>';
$db->close();
llxFooter();
?>

View File

@@ -116,4 +116,3 @@ if (empty($reshook))
llxFooter();
$db->close();
?>

View File

@@ -143,4 +143,3 @@ print '</form>';
llxFooter();
$db->close();
?>

View File

@@ -703,4 +703,3 @@ else
llxFooter();
$db->close();
?>

View File

@@ -540,4 +540,3 @@ if ($mode != 'marketplace') print '<div class="info">'.showModulesExludedForExte
llxFooter();
$db->close();
?>

View File

@@ -157,4 +157,3 @@ if ($action == 'edit' && ! empty($attrname))
llxFooter();
$db->close();
?>

View File

@@ -88,4 +88,3 @@ print "</TABLE>";
$db->close();
llxFooter();
?>

View File

@@ -156,4 +156,3 @@ if ($action == 'edit' && ! empty($attrname))
llxFooter();
$db->close();
?>

View File

@@ -253,4 +253,3 @@ print "</form>\n";
llxFooter();
$db->close();
?>

View File

@@ -113,28 +113,23 @@ print '<li><a href="http://plus.google.com/+DolibarrOrg" target="_blank">Google
print '</ul>';
print $langs->trans("OfficialWebHostingService").':';
$url='http://wiki.dolibarr.org/index.php/Cloud_Solutions'; $title=$langs->trans('List');
print $langs->trans("OtherResources").':';
print '<ul>';
$url='http://saas.dolibarr.org'; $title=$langs->trans("OfficialWebHostingService");
if (preg_match('/^fr_/i',$langs->getDefaultLang())) $url='http://wiki.dolibarr.org/index.php/Solutions_de_Cloud';
if (preg_match('/^es_/i',$langs->getDefaultLang())) $url='http://wiki.dolibarr.org/index.php/Soluciones_en_la_Nube';
print '<ul>';
print '<li>';
print '<a target="_blank" href="'.$url.'">'.$title.'</a>';
print '</li>';
$url='http://partners.dolibarr.org'; $title=$langs->trans("ReferencedPreferredPartners");
print '<li>';
print '<a target="_blank" href="'.$url.'">'.$title.'</a>';
print '</li>';
print '</ul>';
llxFooter();
$db->close();
?>

View File

@@ -51,4 +51,3 @@ print '</table>';
llxFooter();
?>

View File

@@ -120,4 +120,3 @@ foreach($phparray as $key => $value)
llxFooter();
$db->close();
?>

View File

@@ -64,4 +64,3 @@ print '</table>';
llxFooter();
$db->close();
?>

View File

@@ -214,4 +214,3 @@ print '<br>';
llxFooter();
$db->close();
?>

View File

@@ -141,4 +141,3 @@ class Auth
}
?>

View File

@@ -653,4 +653,3 @@ class Facturation
}
?>

View File

@@ -166,4 +166,3 @@ $_SESSION['serObjFacturation'] = serialize($obj_facturation);
header('Location: '.$redirection);
exit;
?>

View File

@@ -142,4 +142,3 @@ else
exit;
}
?>

View File

@@ -26,4 +26,3 @@ $form=new Form($db);
// Affichage des templates
require ('tpl/validation1.tpl.php');
?>

View File

@@ -179,4 +179,3 @@ else
llxFooter();
$db->close();
?>

View File

@@ -142,4 +142,3 @@ else
llxFooter();
$db->close();
?>

View File

@@ -466,4 +466,3 @@ else
llxFooter();
$db->close();
?>

View File

@@ -224,4 +224,3 @@ if ($id > 0 || ! empty($ref))
$db->close();
llxFooter();
?>

View File

@@ -855,4 +855,3 @@ else
llxFooter();
$db->close();
?>

View File

@@ -798,7 +798,8 @@ else if ($action == 'add' && $user->rights->facture->creer)
$object->fetch_thirdparty();
// If creation from another object of another module (Example: origin=propal, originid=1)
if ($_POST['origin'] && $_POST['originid']) {
if ($_POST['origin'] && $_POST['originid'])
{
// Parse element/subelement (ex: project_task)
$element = $subelement = $_POST['origin'];
if (preg_match('/^([^_]+)_([^_]+)/i', $_POST['origin'], $regs)) {
@@ -835,15 +836,20 @@ else if ($action == 'add' && $user->rights->facture->creer)
$id = $object->create($user);
if ($id > 0) {
if ($id > 0)
{
// If deposit invoice
if ($_POST['type'] == 3) {
if ($_POST['type'] == 3)
{
$typeamount = GETPOST('typedeposit', 'alpha');
$valuedeposit = GETPOST('valuedeposit', 'int');
if ($typeamount == 'amount') {
if ($typeamount == 'amount')
{
$amountdeposit = $valuedeposit;
} else {
}
else
{
$amountdeposit = 0;
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
@@ -853,7 +859,8 @@ else if ($action == 'add' && $user->rights->facture->creer)
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add deposit lines");
$result = $srcobject->fetch($object->origin_id);
if ($result > 0) {
if ($result > 0)
{
$totalamount = 0;
$lines = $srcobject->lines;
$numlines=count($lines);
@@ -898,7 +905,9 @@ else if ($action == 'add' && $user->rights->facture->creer)
0,
$langs->trans('Deposit')
);
} else {
}
else
{
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
@@ -907,10 +916,10 @@ else if ($action == 'add' && $user->rights->facture->creer)
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
$result = $srcobject->fetch($object->origin_id);
if ($result > 0) {
if ($result > 0)
{
$lines = $srcobject->lines;
if (empty($lines) && method_exists($srcobject, 'fetch_lines'))
$lines = $srcobject->fetch_lines();
if (empty($lines) && method_exists($srcobject, 'fetch_lines')) $lines = $srcobject->fetch_lines();
$fk_parent_line=0;
$num=count($lines);
@@ -919,7 +928,8 @@ else if ($action == 'add' && $user->rights->facture->creer)
$label=(! empty($lines[$i]->label)?$lines[$i]->label:'');
$desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle);
if ($lines [$i]->subprice < 0) {
if ($lines [$i]->subprice < 0)
{
// Negative line, we create a discount line
$discount = new DiscountAbsolute($db);
$discount->fk_soc = $object->socid;

View File

@@ -156,4 +156,3 @@ if ($action == 'edit' && ! empty($attrname))
llxFooter();
$db->close();
?>

View File

@@ -2056,7 +2056,7 @@ class Facture extends CommonInvoice
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc);
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, '', $localtaxes_type);
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
@@ -2133,7 +2133,7 @@ class Facture extends CommonInvoice
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
// Mise a jour informations denormalisees au niveau de la facture meme
$result=$this->update_price(1,'auto'); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
$result=$this->update_price(1,'auto',0,$mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
if ($result > 0)
{
$this->db->commit();

View File

@@ -166,4 +166,3 @@ else
$db->close();
llxFooter();
?>

View File

@@ -310,4 +310,3 @@ print '</table>';
$db->close();
llxFooter();
?>

View File

@@ -179,4 +179,3 @@ else
$db->close();
llxFooter();
?>

View File

@@ -1094,4 +1094,3 @@ class Contact extends CommonObject
}
}
?>

View File

@@ -249,4 +249,3 @@ if ($action != 'edit')
llxFooter();
$db->close();
?>

View File

@@ -58,4 +58,3 @@ print '</div>';
$db->close();
llxFooter();
?>

View File

@@ -253,4 +253,3 @@ if ($section)
// Close db if mode is not noajax
if ((! isset($mode) || $mode != 'noajax') && is_object($db)) $db->close();
?>

View File

@@ -71,4 +71,3 @@ if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $
exit;
}
?>

View File

@@ -115,4 +115,3 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
}
}
?>

View File

@@ -156,4 +156,3 @@ class box_actions extends ModeleBoxes
}
?>

View File

@@ -165,4 +165,3 @@ class AntiVir
}
?>

View File

@@ -198,4 +198,3 @@ class Canvas
}
}
?>

View File

@@ -627,10 +627,10 @@ abstract class CommonObject
/**
* Load data for barcode into properties ->barcode_type*
* Properties ->barcode_type is used to find others.
* If not defined, ->element must be defined to know default barcode type.
* Properties ->barcode_type that is id of barcode type is used to find other properties, but
* if it is not defined, ->element must be defined to know default barcode type.
*
* @return int <0 if KO, >=0 if OK
* @return int <0 if KO, 0 if can't guess type of barcode (ISBN, EAN13...), >0 if OK (all barcode properties loaded)
*/
function fetch_barcode()
{
@@ -639,11 +639,11 @@ abstract class CommonObject
dol_syslog(get_class($this).'::fetch_barcode this->element='.$this->element.' this->barcode_type='.$this->barcode_type);
$idtype=$this->barcode_type;
if (! $idtype)
if (empty($idtype) && $idtype != '0') // If type of barcode no set, we try to guess. If set to '0' it means we forced to have type remain not defined
{
if ($this->element == 'product') $idtype = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;
else if ($this->element == 'societe') $idtype = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY;
else dol_print_error('','Call fetch_barcode with barcode_type not defined and cant be guessed');
else dol_syslog('Call fetch_barcode with barcode_type not defined and cant be guessed', LOG_WARNING);
}
if ($idtype > 0)
@@ -1518,7 +1518,7 @@ abstract class CommonObject
* @param int $exclspec >0 = Exclude special product (product_type=9)
* @param string $roundingadjust 'none'=Do nothing, 'auto'=Use default method (MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND if defined, or '0'), '0'=Force use total of rounding, '1'=Force use rounding of total
* @param int $nodatabaseupdate 1=Do not update database. Update only properties of object.
* @param Societe $seller If roundingadjust is 0, it means we recalculate total for lines before calculating total for object. For this, we need seller object.
* @param Societe $seller If roundingadjust is '0' or '1', it means we recalculate total for lines before calculating total for object. For this, we need seller object.
* @return int <0 if KO, >0 if OK
*/
function update_price($exclspec=0,$roundingadjust='none',$nodatabaseupdate=0,$seller='')

View File

@@ -1184,4 +1184,3 @@ class FormFile
}
?>

View File

@@ -1164,4 +1164,3 @@ class FormOther
}
?>

View File

@@ -775,4 +775,3 @@ function xml2php($xml)
}
?>

View File

@@ -108,4 +108,3 @@ function SendErrorNode($number, $text)
else
echo '<Error number="' . $number . '" />' ;
}
?>

View File

@@ -416,4 +416,3 @@ function barcode_outimage($text, $bars, $scale = 1, $mode = "png", $total_y = 0,
}
}
?>

View File

@@ -119,4 +119,3 @@ function contract_admin_prepare_head()
return $head;
}
?>

View File

@@ -134,4 +134,3 @@ function fichinter_admin_prepare_head()
}
?>

View File

@@ -198,4 +198,3 @@ function supplierorder_admin_prepare_head($object)
}
?>

View File

@@ -4589,4 +4589,3 @@ function natural_search($fields, $value)
return " AND " . ($end > 1? '(' : '') . $res;
}
?>

View File

@@ -286,4 +286,3 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
else return $result;
}
?>

View File

@@ -44,4 +44,3 @@ function mailmanspip_admin_prepare_head()
);
}
?>

View File

@@ -205,4 +205,3 @@ function member_stats_prepare_head($object)
return $head;
}
?>

View File

@@ -311,7 +311,9 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
}
}
//print "Delete access is ko";
// If a or and at least one ok
if (preg_match('/\|/', $features) && $nbko < count($featuresarray)) $deleteok=1;
if (! $deleteok) accessforbidden();
//print "Delete access is ok";
}

View File

@@ -286,7 +286,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
// Set jquery theme
$dol_loginmesg = (! empty($_SESSION["dol_loginmesg"])?$_SESSION["dol_loginmesg"]:'');
$favicon=DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/favicon.ico';
$favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1);
if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL;
$jquerytheme = 'smoothness';
if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;

View File

@@ -588,4 +588,3 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction,
return $list;
}
?>

View File

@@ -165,4 +165,3 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree')
if (empty($pere['rowid'])) print '</ul>';
}
?>

View File

@@ -164,17 +164,20 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
* @param DoliDB $db Database handler
* @param string &$code Code to check/correct
* @param Product $product Object product
* @param int $type 0 = customer/prospect , 1 = supplier
* @param int $thirdparty_type 0 = customer/prospect , 1 = supplier
* @param string $type type of barcode (EAN, ISBN, ...)
* @return int 0 if OK
* -1 ErrorBadCustomerCodeSyntax
* -2 ErrorCustomerCodeRequired
* -3 ErrorCustomerCodeAlreadyUsed
* -4 ErrorPrefixRequired
*/
function verif($db, &$code, $product, $type)
function verif($db, &$code, $product, $thirdparty_type, $type)
{
global $conf;
//var_dump($code.' '.$product->ref.' '.$thirdparty_type);exit;
require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
$result=0;
@@ -190,7 +193,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
}
else
{
if ($this->verif_syntax($code) >= 0)
if ($this->verif_syntax($code, $type) >= 0)
{
$is_dispo = $this->verif_dispo($db, $code, $product);
if ($is_dispo <> 0)
@@ -215,7 +218,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
}
}
dol_syslog(get_class($this)."::verif type=".$type." result=".$result);
dol_syslog(get_class($this)."::verif type=".$thirdparty_type." result=".$result);
return $result;
}
@@ -254,12 +257,13 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
}
/**
* Renvoi si un code respecte la syntaxe
* Return if a barcode value match syntax
*
* @param string $code Code a verifier
* @param string $codefortest Code to check syntax
* @param string $typefortest Type of barcode (ISBN, EAN, ...)
* @return int 0 if OK, <0 if KO
*/
function verif_syntax($code)
function verif_syntax($codefortest, $typefortest)
{
global $conf;
@@ -273,7 +277,13 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
return '';
}
$result=check_value($mask,$code);
$newcodefortest=$codefortest;
if (in_array($typefortest,array('EAN13','ISBN'))) // We remove the CRC char not included into mask
{
$newcodefortest=substr($newcodefortest,0,12);
}
$result=check_value($mask,$newcodefortest);
return $result;
}

View File

@@ -403,4 +403,3 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
}
?>

View File

@@ -256,4 +256,3 @@ function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0
return -1;
}
}
?>

View File

@@ -144,4 +144,3 @@ class mod_contract_serpis extends ModelNumRefContracts
}
}
?>

View File

@@ -143,4 +143,3 @@ class mod_expedition_safor extends ModelNumRefExpedition
}
}
?>

View File

@@ -224,4 +224,3 @@ class mod_facture_terre extends ModeleNumRefFactures
}
?>

View File

@@ -600,4 +600,3 @@ class pdf_soleil extends ModelePDFFicheinter
}
?>

View File

@@ -145,4 +145,3 @@ class mod_pacific extends ModeleNumRefFicheinter
}
?>

View File

@@ -117,4 +117,3 @@ class modImport extends DolibarrModules
}
}
?>

View File

@@ -107,4 +107,3 @@ class modNotification extends DolibarrModules
}
}
?>

View File

@@ -199,4 +199,3 @@ class modPaypal extends DolibarrModules
}
?>

View File

@@ -158,4 +158,3 @@ class modPrelevement extends DolibarrModules
}
}
?>

View File

@@ -245,6 +245,7 @@ class modProduct extends DolibarrModules
$this->import_tables_array[$r]=array('p'=>MAIN_DB_PREFIX.'product','extra'=>MAIN_DB_PREFIX.'product_extrafields');
$this->import_tables_creator_array[$r]=array('p'=>'fk_user_author'); // Fields to store import user id
$this->import_fields_array[$r]=array('p.ref'=>"Ref*",'p.label'=>"Label*",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.duration'=>"Duration",'p.customcode'=>'CustomCode','p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",'p.tva_tx'=>'VAT','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation*');
if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.barcode'=>'BarCode'));
// Add extra fields
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity = ".$conf->entity;
$resql=$this->db->query($sql);

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
@@ -17,7 +17,6 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
@@ -209,6 +208,7 @@ class modService extends DolibarrModules
$this->import_tables_array[$r]=array('p'=>MAIN_DB_PREFIX.'product','extra'=>MAIN_DB_PREFIX.'product_extrafields');
$this->import_tables_creator_array[$r]=array('p'=>'fk_user_author'); // Fields to store import user id
$this->import_fields_array[$r]=array('p.ref'=>"Ref*",'p.label'=>"Label*",'p.description'=>"Description",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.duration'=>"Duration",'p.customcode'=>'CustomCode','p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",'p.tva_tx'=>'VAT','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation*');
if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.barcode'=>'BarCode'));
// Add extra fields
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product'";
$resql=$this->db->query($sql);

View File

@@ -301,4 +301,3 @@ class mod_codeproduct_elephant extends ModeleProductCode
}
?>

View File

@@ -247,4 +247,3 @@ function project_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0,
}
}
?>

View File

@@ -1037,4 +1037,3 @@ class doc_generic_project_odt extends ModelePDFProjects
}
}
?>

View File

@@ -248,4 +248,3 @@ function task_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $h
}
}
?>

View File

@@ -258,4 +258,3 @@ function supplier_order_pdf_create($db, $object, $modele, $outputlangs, $hidedet
}
}
?>

View File

@@ -252,4 +252,3 @@ if ($id > 0 || ! empty($ref))
llxFooter();
$db->close();
?>

View File

@@ -1688,4 +1688,3 @@ else if ($id || $ref)
llxFooter();
$db->close();
?>

View File

@@ -0,0 +1,400 @@
/**
* TableDnD plug-in for JQuery, allows you to drag and drop table rows
* You can set up various options to control how the system will work
* Copyright (c) Denis Howlett <denish@isocra.com>
* Licensed like jQuery, see http://docs.jquery.com/License.
*
* Configuration options:
*
* onDragStyle
* This is the style that is assigned to the row during drag. There are limitations to the styles that can be
* associated with a row (such as you can't assign a border--well you can, but it won't be
* displayed). (So instead consider using onDragClass.) The CSS style to apply is specified as
* a map (as used in the jQuery css(...) function).
* onDropStyle
* This is the style that is assigned to the row when it is dropped. As for onDragStyle, there are limitations
* to what you can do. Also this replaces the original style, so again consider using onDragClass which
* is simply added and then removed on drop.
* onDragClass
* This class is added for the duration of the drag and then removed when the row is dropped. It is more
* flexible than using onDragStyle since it can be inherited by the row cells and other content. The default
* is class is tDnD_whileDrag. So to use the default, simply customise this CSS class in your
* stylesheet.
* onDrop
* Pass a function that will be called when the row is dropped. The function takes 2 parameters: the table
* and the row that was dropped. You can work out the new order of the rows by using
* table.rows.
* onDragStart
* Pass a function that will be called when the user starts dragging. The function takes 2 parameters: the
* table and the row which the user has started to drag.
* onAllowDrop
* Pass a function that will be called as a row is over another row. If the function returns true, allow
* dropping on that row, otherwise not. The function takes 2 parameters: the dragged row and the row under
* the cursor. It returns a boolean: true allows the drop, false doesn't allow it.
* scrollAmount
* This is the number of pixels to scroll if the user moves the mouse cursor to the top or bottom of the
* window. The page should automatically scroll up or down as appropriate (tested in IE6, IE7, Safari, FF2,
* FF3 beta
* dragHandle
* This is the name of a class that you assign to one or more cells in each row that is draggable. If you
* specify this class, then you are responsible for setting cursor: move in the CSS and only these cells
* will have the drag behaviour. If you do not specify a dragHandle, then you get the old behaviour where
* the whole row is draggable.
*
* Other ways to control behaviour:
*
* Add class="nodrop" to any rows for which you don't want to allow dropping, and class="nodrag" to any rows
* that you don't want to be draggable.
*
* Inside the onDrop method you can also call $.tableDnD.serialize() this returns a string of the form
* <tableID>[]=<rowID1>&<tableID>[]=<rowID2> so that you can send this back to the server. The table must have
* an ID as must all the rows.
*
* Other methods:
*
* $("...").tableDnDUpdate()
* Will update all the matching tables, that is it will reapply the mousedown method to the rows (or handle cells).
* This is useful if you have updated the table rows using Ajax and you want to make the table draggable again.
* The table maintains the original configuration (so you don't have to specify it again).
*
* $("...").tableDnDSerialize()
* Will serialize and return the serialized string as above, but for each of the matching tables--so it can be
* called from anywhere and isn't dependent on the currentTable being set up correctly before calling
*
* Known problems:
* - Auto-scoll has some problems with IE7 (it scrolls even when it shouldn't), work-around: set scrollAmount to 0
*
* Version 0.2: 2008-02-20 First public version
* Version 0.3: 2008-02-07 Added onDragStart option
* Made the scroll amount configurable (default is 5 as before)
* Version 0.4: 2008-03-15 Changed the noDrag/noDrop attributes to nodrag/nodrop classes
* Added onAllowDrop to control dropping
* Fixed a bug which meant that you couldn't set the scroll amount in both directions
* Added serialize method
* Version 0.5: 2008-05-16 Changed so that if you specify a dragHandle class it doesn't make the whole row
* draggable
* Improved the serialize method to use a default (and settable) regular expression.
* Added tableDnDupate() and tableDnDSerialize() to be called when you are outside the table
* Version 0.6: 2011-12-02 Added support for touch devices
*/
// Determine if this is a touch device
var hasTouch = 'ontouchstart' in document.documentElement,
startEvent = hasTouch ? 'touchstart' : 'mousedown',
moveEvent = hasTouch ? 'touchmove' : 'mousemove',
endEvent = hasTouch ? 'touchend' : 'mouseup';
jQuery.tableDnD = {
/** Keep hold of the current table being dragged */
currentTable : null,
/** Keep hold of the current drag object if any */
dragObject: null,
/** The current mouse offset */
mouseOffset: null,
/** Remember the old value of Y so that we don't do too much processing */
oldY: 0,
/** Actually build the structure */
build: function(options) {
// Set up the defaults if any
this.each(function() {
// This is bound to each matching table, set up the defaults and override with user options
this.tableDnDConfig = jQuery.extend({
onDragStyle: null,
onDropStyle: null,
// Add in the default class for whileDragging
onDragClass: "tDnD_whileDrag",
onDrop: null,
onDragStart: null,
scrollAmount: 5,
serializeRegexp: /[^\-]*$/, // The regular expression to use to trim row IDs
serializeParamName: null, // If you want to specify another parameter name instead of the table ID
dragHandle: null // If you give the name of a class here, then only Cells with this class will be draggable
}, options || {});
// Now make the rows draggable
jQuery.tableDnD.makeDraggable(this);
});
// Don't break the chain
return this;
},
/** This function makes all the rows on the table draggable apart from those marked as "NoDrag" */
makeDraggable: function(table) {
var config = table.tableDnDConfig;
if (config.dragHandle) {
// We only need to add the event to the specified cells
var cells = jQuery("td."+table.tableDnDConfig.dragHandle, table);
cells.each(function() {
// The cell is bound to "this"
jQuery(this).bind(startEvent, function(ev) {
jQuery.tableDnD.initialiseDrag(this.parentNode, table, this, ev, config);
return false;
});
})
} else {
// For backwards compatibility, we add the event to the whole row
var rows = jQuery("tr", table); // get all the rows as a wrapped set
rows.each(function() {
// Iterate through each row, the row is bound to "this"
var row = jQuery(this);
if (! row.hasClass("nodrag")) {
row.bind(startEvent, function(ev) {
if (ev.target.tagName == "TD") {
jQuery.tableDnD.initialiseDrag(this, table, this, ev, config);
return false;
}
}).css("cursor", "move"); // Store the tableDnD object
}
});
}
},
initialiseDrag: function(dragObject, table, target, evnt, config) {
jQuery.tableDnD.dragObject = dragObject;
jQuery.tableDnD.currentTable = table;
jQuery.tableDnD.mouseOffset = jQuery.tableDnD.getMouseOffset(target, evnt);
jQuery.tableDnD.originalOrder = jQuery.tableDnD.serialize();
// Now we need to capture the mouse up and mouse move event
// We can use bind so that we don't interfere with other event handlers
jQuery(document)
.bind(moveEvent, jQuery.tableDnD.mousemove)
.bind(endEvent, jQuery.tableDnD.mouseup);
if (config.onDragStart) {
// Call the onDragStart method if there is one
config.onDragStart(table, target);
}
},
updateTables: function() {
this.each(function() {
// this is now bound to each matching table
if (this.tableDnDConfig) {
jQuery.tableDnD.makeDraggable(this);
}
})
},
/** Get the mouse coordinates from the event (allowing for browser differences) */
mouseCoords: function(ev){
if(ev.pageX || ev.pageY){
return {x:ev.pageX, y:ev.pageY};
}
return {
x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
y:ev.clientY + document.body.scrollTop - document.body.clientTop
};
},
/** Given a target element and a mouse event, get the mouse offset from that element.
To do this we need the element's position and the mouse position */
getMouseOffset: function(target, ev) {
ev = ev || window.event;
var docPos = this.getPosition(target);
var mousePos = this.mouseCoords(ev);
return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y};
},
/** Get the position of an element by going up the DOM tree and adding up all the offsets */
getPosition: function(e){
var left = 0;
var top = 0;
/** Safari fix -- thanks to Luis Chato for this! */
if (e.offsetHeight == 0) {
/** Safari 2 doesn't correctly grab the offsetTop of a table row
this is detailed here:
http://jacob.peargrove.com/blog/2006/technical/table-row-offsettop-bug-in-safari/
the solution is likewise noted there, grab the offset of a table cell in the row - the firstChild.
note that firefox will return a text node as a first child, so designing a more thorough
solution may need to take that into account, for now this seems to work in firefox, safari, ie */
e = e.firstChild; // a table cell
}
while (e.offsetParent){
left += e.offsetLeft;
top += e.offsetTop;
e = e.offsetParent;
}
left += e.offsetLeft;
top += e.offsetTop;
return {x:left, y:top};
},
mousemove: function(ev) {
if (jQuery.tableDnD.dragObject == null) {
return;
}
if (ev.type == 'touchmove') {
// prevent touch device screen scrolling
event.preventDefault();
}
var dragObj = jQuery(jQuery.tableDnD.dragObject);
var config = jQuery.tableDnD.currentTable.tableDnDConfig;
var mousePos = jQuery.tableDnD.mouseCoords(ev);
var y = mousePos.y - jQuery.tableDnD.mouseOffset.y;
//auto scroll the window
var yOffset = window.pageYOffset;
if (document.all) {
// Windows version
//yOffset=document.body.scrollTop;
if (typeof document.compatMode != 'undefined' &&
document.compatMode != 'BackCompat') {
yOffset = document.documentElement.scrollTop;
}
else if (typeof document.body != 'undefined') {
yOffset=document.body.scrollTop;
}
}
if (mousePos.y-yOffset < config.scrollAmount) {
window.scrollBy(0, -config.scrollAmount);
} else {
var windowHeight = window.innerHeight ? window.innerHeight
: document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
if (windowHeight-(mousePos.y-yOffset) < config.scrollAmount) {
window.scrollBy(0, config.scrollAmount);
}
}
if (y != jQuery.tableDnD.oldY) {
// work out if we're going up or down...
var movingDown = y > jQuery.tableDnD.oldY;
// update the old value
jQuery.tableDnD.oldY = y;
// update the style to show we're dragging
if (config.onDragClass) {
dragObj.addClass(config.onDragClass);
} else {
dragObj.css(config.onDragStyle);
}
// If we're over a row then move the dragged row to there so that the user sees the
// effect dynamically
var currentRow = jQuery.tableDnD.findDropTargetRow(dragObj, y);
if (currentRow) {
// TODO worry about what happens when there are multiple TBODIES
if (movingDown && jQuery.tableDnD.dragObject != currentRow) {
jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow.nextSibling);
} else if (! movingDown && jQuery.tableDnD.dragObject != currentRow) {
jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow);
}
}
}
return false;
},
/** We're only worried about the y position really, because we can only move rows up and down */
findDropTargetRow: function(draggedRow, y) {
var rows = jQuery.tableDnD.currentTable.rows;
for (var i=0; i<rows.length; i++) {
var row = rows[i];
var rowY = this.getPosition(row).y;
var rowHeight = parseInt(row.offsetHeight)/2;
if (row.offsetHeight == 0) {
rowY = this.getPosition(row.firstChild).y;
rowHeight = parseInt(row.firstChild.offsetHeight)/2;
}
// Because we always have to insert before, we need to offset the height a bit
if ((y > rowY - rowHeight) && (y < (rowY + rowHeight))) {
// that's the row we're over
// If it's the same as the current row, ignore it
if (row == draggedRow) {return null;}
var config = jQuery.tableDnD.currentTable.tableDnDConfig;
if (config.onAllowDrop) {
if (config.onAllowDrop(draggedRow, row)) {
return row;
} else {
return null;
}
} else {
// If a row has nodrop class, then don't allow dropping (inspired by John Tarr and Famic)
var nodrop = jQuery(row).hasClass("nodrop");
if (! nodrop) {
return row;
} else {
return null;
}
}
return row;
}
}
return null;
},
mouseup: function(e) {
if (jQuery.tableDnD.currentTable && jQuery.tableDnD.dragObject) {
// Unbind the event handlers
jQuery(document)
.unbind(moveEvent, jQuery.tableDnD.mousemove)
.unbind(endEvent, jQuery.tableDnD.mouseup);
var droppedRow = jQuery.tableDnD.dragObject;
var config = jQuery.tableDnD.currentTable.tableDnDConfig;
// If we have a dragObject, then we need to release it,
// The row will already have been moved to the right place so we just reset stuff
if (config.onDragClass) {
jQuery(droppedRow).removeClass(config.onDragClass);
} else {
jQuery(droppedRow).css(config.onDropStyle);
}
jQuery.tableDnD.dragObject = null;
var newOrder = jQuery.tableDnD.serialize();
if (config.onDrop && (jQuery.tableDnD.originalOrder != newOrder)) {
// Call the onDrop method if there is one
config.onDrop(jQuery.tableDnD.currentTable, droppedRow);
}
jQuery.tableDnD.currentTable = null; // let go of the table too
}
},
serialize: function() {
if (jQuery.tableDnD.currentTable) {
return jQuery.tableDnD.serializeTable(jQuery.tableDnD.currentTable);
} else {
return "Error: No Table id set, you need to set an id on your table and every row";
}
},
serializeTable: function(table) {
var result = "";
var tableId = table.id;
var rows = table.rows;
for (var i=0; i<rows.length; i++) {
if (result.length > 0) result += "&";
var rowId = rows[i].id;
if (rowId && rowId && table.tableDnDConfig && table.tableDnDConfig.serializeRegexp) {
rowId = rowId.match(table.tableDnDConfig.serializeRegexp)[0];
}
result += tableId + '[]=' + rowId;
}
return result;
},
serializeTables: function() {
var result = "";
this.each(function() {
// this is now bound to each matching table
result += jQuery.tableDnD.serializeTable(this);
});
return result;
}
};
jQuery.fn.extend(
{
tableDnD : jQuery.tableDnD.build,
tableDnDUpdate : jQuery.tableDnD.updateTables,
tableDnDSerialize: jQuery.tableDnD.serializeTables
}
);

View File

@@ -444,4 +444,3 @@ if ($db->connected) $db->close();
// Return code if ran from command line
if ($ret) exit($ret);
?>

View File

@@ -233,7 +233,9 @@ OfficialWebSiteFr=French official web site
OfficialWiki=Dolibarr documentation on Wiki
OfficialDemo=Dolibarr online demo
OfficialMarketPlace=Official market place for external modules/addons
OfficialWebHostingService=Official web hosting services (Cloud hosting)
OfficialWebHostingService=Referenced web hosting services (Cloud hosting)
ReferencedPreferredPartners=Preferred Partners
OtherResources=Autres ressources
ForDocumentationSeeWiki=For user or developer documentation (Doc, FAQs...),<br>take a look at the Dolibarr Wiki:<br><b><a href="%s" target="_blank">%s</a></b>
ForAnswersSeeForum=For any other questions/help, you can use the Dolibarr forum:<br><b><a href="%s" target="_blank">%s</a></b>
HelpCenterDesc1=This area can help you to get a Help support service on Dolibarr.

View File

@@ -807,4 +807,3 @@ else
llxFooter();
$db->close();
?>

Some files were not shown because too many files have changed in this diff Show More