diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 1d6542eafc9..c8b3c7664e2 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -1150,14 +1150,16 @@ if ($nboftargetok) { if ($target eq 'SF') { $destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD; - print "Publish file ".$file." to $NEWPUBLISH/".$filestoscan{$file}."\n"; + print "Publish file ".$file." to $NEWPUBLISH/".$filestoscan{$file}."/".$MAJOR.'.'.$MINOR.'.'.$BUILD."\n"; } else { + $dirnameonly=$file; + $dirnameonly =~ s/.*\/([^\/]+)\/[^\/]+$/$1/; $filenameonly=$file; - $filenameonly =~ s/.*\/([^\/]+\/[^\/]+)$/$1/; # removes path - $destFolder="$NEWPUBLISH/$filenameonly"; - print "Publish file ".$file." to $NEWPUBLISH/".$filenameonly."\n"; + $filenameonly =~ s/.*\/[^\/]+\/([^\/])+$/$1/; + $destFolder="$NEWPUBLISH/$dirnameonly"; + print "Publish file ".$file." to $NEWPUBLISH/".$dirnameonly."\n"; } # mkdir diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 86232bb2029..7d9778f72b8 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -94,6 +94,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = $sql .= " JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = fd.fk_facture_fourn"; $sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc"; $sql .= " WHERE f.fk_statut > 0 "; +$sql .= " AND fd.fk_code_ventilation > 0 "; if (! empty($conf->multicompany->enabled)) { $sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")"; } diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 02d2fda06fe..aea09f73124 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -58,7 +58,7 @@ if ($page == -1) { $page = 0; } $offset = $limit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortorder) { $sortorder=($filter=='outofdate'?"ASC":"DESC"); } +if (! $sortorder) { $sortorder=($filter=='outofdate'?"DESC":"ASC"); } if (! $sortfield) { $sortfield=($filter=='outofdate'?"d.datefin":"d.lastname"); } if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers diff --git a/htdocs/admin/confexped.php b/htdocs/admin/confexped.php index ea05c683ef7..85682960df9 100644 --- a/htdocs/admin/confexped.php +++ b/htdocs/admin/confexped.php @@ -2,8 +2,8 @@ /* Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2011-2015 Juanjo Menent ù - * Copyright (C) 2015 Claudio Aschieri + * Copyright (C) 2011-2016 Juanjo Menent ù + * Copyright (C) 2015 Claudio Aschieri * * 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 @@ -38,21 +38,34 @@ if (!$user->admin) $action=GETPOST('action','alpha'); + +/* + * Actions + */ + // Shipment note +if (! empty($conf->expedition->enabled) && empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) +{ + // This option should always be set to on when module is on. + dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1",'chaine',0,'',$conf->entity); +} +/* if ($action == 'activate_sending') { dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1",'chaine',0,'',$conf->entity); header("Location: confexped.php"); exit; } -else if ($action == 'disable_sending') +if ($action == 'disable_sending') { dolibarr_del_const($db, "MAIN_SUBMODULE_EXPEDITION",$conf->entity); header("Location: confexped.php"); exit; } +*/ + // Delivery note -else if ($action == 'activate_delivery') +if ($action == 'activate_delivery') { dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1",'chaine',0,'',$conf->entity); // We must also enable this dolibarr_set_const($db, "MAIN_SUBMODULE_LIVRAISON", "1",'chaine',0,'',$conf->entity); @@ -68,8 +81,9 @@ else if ($action == 'disable_delivery') /* - * Affiche page + * View */ + $dir = DOL_DOCUMENT_ROOT."/core/modules/expedition/"; $form=new Form($db); @@ -102,16 +116,15 @@ print ''.$langs->trans("SendingsAbility").''; print ''; print ''; print ''; - -if (empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) +print $langs->trans("Required"); +/*if (empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) { print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } else { print ''.img_picto($langs->trans("Enabled"),'switch_on').''; -} - +}*/ print ""; print ''; diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 82a56a60f11..14332ceee63 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -1,8 +1,9 @@ - * Copyright (C) 2004-2010 Laurent Destailleur - * Copyright (C) 2005 Simon Tosser - * Copyright (C) 2005-2012 Regis Houssin +/* Copyright (C) 2001-2004 Rodolphe Quiedeville + * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2005 Simon Tosser + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2016 Raphaël Doursenaud * * 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 @@ -164,7 +165,7 @@ if ($action == 'edit') foreach($delays as $delay) { $var=!$var; - $value=(! empty($conf->global->$delay['code'])?$conf->global->$delay['code']:0); + $value=(! empty($conf->global->{$delay['code']})?$conf->global->{$delay['code']}:0); print ''; print ''.img_object('',$delay['img']).''; print ''.$langs->trans('Delays_'.$delay['code']).''; @@ -211,7 +212,7 @@ else foreach($delays as $delay) { $var=!$var; - $value=(! empty($conf->global->$delay['code'])?$conf->global->$delay['code']:0); + $value=(! empty($conf->global->{$delay['code']})?$conf->global->{$delay['code']}:0); print ''; print ''.img_object('',$delay['img']).''; print ''.$langs->trans('Delays_'.$delay['code']).''; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 18c112f987f..aac782cb37b 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1,15 +1,16 @@ - * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2011-2015 Philippe Grand - * Copyright (C) 2011 Remy Younes - * Copyright (C) 2012-2015 Marcos García - * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2011-2015 Alexandre Spangaro - * Copyright (C) 2015 Ferran Marcet +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2011-2015 Philippe Grand + * Copyright (C) 2011 Remy Younes + * Copyright (C) 2012-2015 Marcos García + * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2011-2015 Alexandre Spangaro + * Copyright (C) 2015 Ferran Marcet + * Copyright (C) 2016 Raphaël Doursenaud * * 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 @@ -1162,7 +1163,7 @@ if ($id) { $showfield=1; $align="left"; - $valuetoshow=$obj->$fieldlist[$field]; + $valuetoshow=$obj->{$fieldlist[$field]}; if ($value == 'type_template') { $valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow; @@ -1199,77 +1200,77 @@ if ($id) else if ($fieldlist[$field]=='libelle_facture') { $langs->load("bills"); $key=$langs->trans("PaymentCondition".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "PaymentCondition".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); + $valuetoshow=($obj->code && $key != "PaymentCondition".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); $valuetoshow=nl2br($valuetoshow); } else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') { $key=$langs->trans("Country".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); + $valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_availability') { $langs->load("propal"); $key=$langs->trans("AvailabilityType".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "AvailabilityType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); + $valuetoshow=($obj->code && $key != "AvailabilityType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_actioncomm') { $key=$langs->trans("Action".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); + $valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } else if (! empty($obj->code_iso) && $fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_currencies') { $key=$langs->trans("Currency".strtoupper($obj->code_iso)); - $valuetoshow=($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso)?$key:$obj->$fieldlist[$field]); + $valuetoshow=($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso)?$key:$obj->{$fieldlist[$field]}); } else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_typent') { $key=$langs->trans(strtoupper($obj->code)); - $valuetoshow=($key != strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); + $valuetoshow=($key != strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_prospectlevel') { $key=$langs->trans(strtoupper($obj->code)); - $valuetoshow=($key != strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); + $valuetoshow=($key != strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_civility') { $key=$langs->trans("Civility".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); + $valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_type_contact') { $langs->load('agenda'); $key=$langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); + $valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_payment_term') { $langs->load("bills"); $key=$langs->trans("PaymentConditionShort".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); + $valuetoshow=($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paiement') { $langs->load("bills"); $key=$langs->trans("PaymentType".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); + $valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_reason') { $key=$langs->trans("DemandReasonType".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); + $valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_method') { $langs->load("orders"); $key=$langs->trans($obj->code); - $valuetoshow=($obj->code && $key != $obj->code)?$key:$obj->$fieldlist[$field]; + $valuetoshow=($obj->code && $key != $obj->code)?$key:$obj->{$fieldlist[$field]}; } else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_shipment_mode') { $langs->load("sendings"); $key=$langs->trans("SendingMethod".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "SendingMethod".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); + $valuetoshow=($obj->code && $key != "SendingMethod".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } else if ($fieldlist[$field] == 'libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paper_format') { $key = $langs->trans('PaperFormat'.strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->$fieldlist[$field]); + $valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees') { $langs->load('trips'); $key = $langs->trans(strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->$fieldlist[$field]); + $valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); } else if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; @@ -1279,16 +1280,16 @@ if ($id) } else if ($fieldlist[$field]=='label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') { $langs->load("products"); - $valuetoshow=$langs->trans($obj->$fieldlist[$field]); + $valuetoshow=$langs->trans($obj->{$fieldlist[$field]}); } else if ($fieldlist[$field]=='short_label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') { $langs->load("products"); - $valuetoshow = $langs->trans($obj->$fieldlist[$field]); + $valuetoshow = $langs->trans($obj->{$fieldlist[$field]}); } else if (($fieldlist[$field] == 'unit') && ($tabname[$id] == MAIN_DB_PREFIX.'c_paper_format')) { $key = $langs->trans('SizeUnit'.strtolower($obj->unit)); - $valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->$fieldlist[$field]); + $valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->{$fieldlist[$field]}); } else if ($fieldlist[$field]=='localtax1_type') { @@ -1504,7 +1505,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') { if (! in_array('country',$fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate) { - $country_id = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0); + $country_id = (! empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : 0); print ''; print ''; print ''; @@ -1518,7 +1519,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') } elseif ($fieldlist[$field] == 'region_id') { - $region_id = (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:0); + $region_id = (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:0); print ''; print ''; print ''; @@ -1533,21 +1534,21 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') elseif ($fieldlist[$field] == 'type_template') { print ''; - print $form->selectarray('type_template', $elementList,(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'')); + print $form->selectarray('type_template', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')); print ''; } // Le type de l'element (pour les type de contact) elseif ($fieldlist[$field] == 'element') { print ''; - print $form->selectarray('element', $elementList,(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'')); + print $form->selectarray('element', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')); print ''; } // La source de l'element (pour les type de contact) elseif ($fieldlist[$field] == 'source') { print ''; - print $form->selectarray('source', $sourceList,(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'')); + print $form->selectarray('source', $sourceList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')); print ''; } elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm") @@ -1558,18 +1559,18 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') } elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'fdm' || $fieldlist[$field] == 'deductible') { print ''; - print $form->selectyesno($fieldlist[$field],(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''),1); + print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1); print ''; } elseif (in_array($fieldlist[$field],array('nbjour','decalage','taux','localtax1','localtax2'))) { $align="left"; if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) $align="right"; // Fields aligned on right print ''; - print ''; + print ''; print ''; } elseif (in_array($fieldlist[$field], array('libelle_facture'))) { - print ''; + print ''; } elseif (in_array($fieldlist[$field], array('content'))) { @@ -1580,18 +1581,18 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') else print ''; if ($context != 'hide') { - //print ''; - $doleditor = new DolEditor($fieldlist[$field], (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''), '', 140, 'dolibarr_mailings', 'In', 0, false, true, ROWS_5, '90%'); + //print ''; + $doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 140, 'dolibarr_mailings', 'In', 0, false, true, ROWS_5, '90%'); print $doleditor->Create(1); } else print ' '; print ''; } elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) { - print ''; + print ''; } - elseif ($fieldlist[$field] == 'code' && isset($obj->$fieldlist[$field])) { - print ''; + elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { + print ''; } elseif ($fieldlist[$field]=='unit') { print ''; @@ -1601,14 +1602,14 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') 'point' => $langs->trans('SizeUnitpoint'), 'inch' => $langs->trans('SizeUnitinch') ); - print $form->selectarray('unit', $units, (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''), 0, 0, 0); + print $form->selectarray('unit', $units, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 0, 0, 0); print ''; } // Le type de taxe locale elseif ($fieldlist[$field] == 'localtax1_type' || $fieldlist[$field] == 'localtax2_type') { print ''; - print $form->selectarray($fieldlist[$field], $localtax_typeList, (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'')); + print $form->selectarray($fieldlist[$field], $localtax_typeList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')); print ''; } elseif ($fieldlist[$field] == 'accountancy_code' || $fieldlist[$field] == 'accountancy_code_sell' || $fieldlist[$field] == 'accountancy_code_buy') @@ -1634,7 +1635,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') if ($fieldlist[$field]=='libelle') $size='size="32" '; if ($fieldlist[$field]=='tracking') $size='size="92" '; if ($fieldlist[$field]=='sortorder') $size='size="2" '; - print ''; + print ''; print ''; } } diff --git a/htdocs/admin/oauth.php b/htdocs/admin/oauth.php index 2adf79a6174..2100230fdb4 100644 --- a/htdocs/admin/oauth.php +++ b/htdocs/admin/oauth.php @@ -1,5 +1,6 @@ + * Copyright (C) 2016 Raphaël Doursenaud * * 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 @@ -43,7 +44,7 @@ if (!$user->admin) $action = GETPOST('action', 'alpha'); -// Supported OAUTH (a provider is supported when a file xxx_oauth2callback.php is available into htdocs/core/modules/oauth) +// Supported OAUTH (a provider is supported when a file xxx_oauthcallback.php is available into htdocs/core/modules/oauth) $supportedoauth2array=array('OAUTH_GOOGLE_NAME'=>'google'); // API access parameters OAUTH @@ -346,14 +347,14 @@ foreach ($list as $key) $var = !$var; print ''; print ''; - print ''; + print ''; print ''; // Api Secret $var = !$var; print ''; print ''; - print ''; + print ''; print ''; } @@ -368,4 +369,4 @@ print ''; llxFooter(); -$db->close(); \ No newline at end of file +$db->close(); diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index a468e79e23a..b5f33b5f689 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2005-2012 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2016 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 @@ -222,6 +222,8 @@ if (empty($reshook)) $tmpfield=explode('=',$other[2],2); $other3=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); $tmpfield=explode('=',$other[3],2); $other4=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); $tmpfield=explode('=',$other[4],2); $other5=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]); + $signature = ((!empty($user->signature) && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$user->signature:''); + // Array of possible substitutions (See also fie mailing-send.php that should manage same substitutions) $substitutionarray=array( '__ID__' => $obj->source_id, @@ -234,6 +236,7 @@ if (empty($reshook)) '__OTHER3__' => $other3, '__OTHER4__' => $other4, '__OTHER5__' => $other5, + '__SIGNATURE__' => $signature, // Signature is empty when ran from command line or taken from user in parameter) '__CHECK_READ__' => '', '__UNSUBSCRIBE__' => ''.$langs->trans("MailUnsubcribe").'' ); @@ -1095,10 +1098,10 @@ else } print ''; - + dol_fiche_end(); - - + + print "\n"; print '
'."\n"; @@ -1110,7 +1113,7 @@ else print load_fiche_titre($langs->trans("EMail"),'',''); dol_fiche_head(); - + print ''; // Subject @@ -1177,7 +1180,7 @@ else print '
'; dol_fiche_end(); - + print '
'; print ''; print '     '; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index d4956377543..07c51e76916 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -288,7 +288,7 @@ if (empty($reshook)) { $db->begin(); - // Si on a selectionne une propal a copier, on realise la copie + // If we select proposal to clone during creation (when option PROPAL_CLONE_ON_CREATE_PAGE is on) if (GETPOST('createmode') == 'copy' && GETPOST('copie_propal')) { if ($object->fetch(GETPOST('copie_propal')) > 0) { @@ -316,7 +316,8 @@ if (empty($reshook)) $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); - $id = $object->create_from($user); + // the create is done below and further more the existing create_from function is quite hilarating + //$id = $object->create_from($user); } else { setEventMessages($langs->trans("ErrorFailedToCopyProposal", GETPOST('copie_propal')), null, 'errors'); } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 26e65e09464..a5b048d9719 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1064,6 +1064,7 @@ class Propal extends CommonObject */ function create_from($user) { + // i love this function because $this->products is not used in create function... $this->products=$this->lines; return $this->create($user); diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php index a08e0a66a6f..a5c0a89f29d 100644 --- a/htdocs/comm/remise.php +++ b/htdocs/comm/remise.php @@ -30,6 +30,8 @@ $langs->load("companies"); $langs->load("orders"); $langs->load("bills"); +$id=GETPOST("id",'int'); + $socid = GETPOST('id','int'); // Security check if ($user->societe_id > 0) @@ -53,8 +55,8 @@ if (GETPOST('cancel') && ! empty($backtopage)) if (GETPOST("action") == 'setremise') { $object = new Societe($db); - $object->fetch($_GET["id"]); - $result=$object->set_remise_client($_POST["remise"],$_POST["note"],$user); + $object->fetch($id); + $result=$object->set_remise_client(price2num(GETPOST("remise")),GETPOST("note"),$user); if ($result > 0) { diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index ad555a8f605..2ce51ad3afd 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3509,7 +3509,9 @@ else if ($id > 0 || ! empty($ref)) print ' '; print $prevsits[0]->situation_counter; - for ($i = 1; $i < count($prevsits); $i++) { + $cprevsits = count($prevsits); + + for ($i = 1; $i < $cprevsits; $i++) { print ' + '; print $prevsits[$i]->situation_counter; } @@ -3530,7 +3532,7 @@ else if ($id > 0 || ! empty($ref)) print '' . $langs->trans('Currency' . $conf->currency) . ''; // Previous situation(s) deduction(s) - for ($i = 0; $i < count($prevsits); $i++) { + for ($i = 0; $i < $cprevsits; $i++) { print ''; print ''; print $langs->trans('SituationDeduction'); @@ -3843,6 +3845,7 @@ else if ($id > 0 || ! empty($ref)) } } + // deprecated. Useless because now we can use templates if (! empty($conf->global->FACTURE_SHOW_SEND_REMINDER)) // For backward compatibility { if (($object->statut == 1 || $object->statut == 2) && $resteapayer > 0) { @@ -3898,7 +3901,7 @@ else if ($id > 0 || ! empty($ref)) // Classify paid if ($object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement && (($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && $resteapayer <= 0) || ($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0)) - || ($object->type == Facture::TYPE_DEPOSIT && $object->paye == 0 && $resteapayer == 0 && $user->rights->facture->paiement && empty($discount->id)) + || ($object->type == Facture::TYPE_DEPOSIT && $object->paye == 0 && $object->total_ttc > 0 && $resteapayer == 0 && $user->rights->facture->paiement && empty($discount->id)) ) { print ''; @@ -3928,10 +3931,10 @@ else if ($id > 0 || ! empty($ref)) print ''; } - // Clone as predefined + // Clone as predefined / Create template if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $user->rights->facture->creer) { - if (! $objectidnext) + if (! $objectidnext && count($object->lines) > 0) { print ''; } @@ -3946,7 +3949,7 @@ else if ($id > 0 || ! empty($ref)) } } - //Create next situation invoice + // Create next situation invoice if ($user->rights->facture->creer && ($object->type == 5) && ($object->statut == 1 || $object->statut == 2)) { if ($object->is_last_in_cycle() && $object->situation_final != 1) { print ''; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5afd2ca38d4..27a1b3c30d4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -384,7 +384,7 @@ abstract class CommonObject */ function errorsToString() { - return $this->error.(is_array($this->errors)?(($this->error!=''?' ':'').join(',',$this->errors)):''); + return $this->error.(is_array($this->errors)?(($this->error!=''?', ':'').join(', ',$this->errors)):''); } /** @@ -3351,6 +3351,8 @@ abstract class CommonObject $text.= ' - '.(! empty($line->label)?$line->label:$label); $description.=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($line->description)); // Description is what to show on popup. We shown nothing if already into desc. } + + $line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU'); // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer @@ -3374,7 +3376,7 @@ abstract class CommonObject if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("Label").'"'; else $placeholder=' title="'.$langs->trans("Label").'"'; - $pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU'); + $line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU'); // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 828483db3c7..97645487d45 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1,12 +1,13 @@ - * Copyright (C) 2002-2003 Jean-Louis Bergamo - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2009-2012 Laurent Destailleur - * Copyright (C) 2009-2012 Regis Houssin - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2015 Charles-Fr BENKE +/* Copyright (C) 2002-2003 Rodolphe Quiedeville + * Copyright (C) 2002-2003 Jean-Louis Bergamo + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2009-2012 Laurent Destailleur + * Copyright (C) 2009-2012 Regis Houssin + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2015 Charles-Fr BENKE + * Copyright (C) 2016 Raphaël Doursenaud * * 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 @@ -878,7 +879,7 @@ class ExtraFields } else { - $labeltoshow=$obj->$InfoFieldList[1]; + $labeltoshow=$obj->{$InfoFieldList[1]}; } $labeltoshow=dol_trunc($labeltoshow,45); @@ -899,12 +900,12 @@ class ExtraFields { if(!$notrans) { - $translabel=$langs->trans($obj->$InfoFieldList[1]); - if ($translabel!=$obj->$InfoFieldList[1]) { + $translabel=$langs->trans($obj->{$InfoFieldList[1]}); + if ($translabel!=$obj->{$InfoFieldList[1]}) { $labeltoshow=dol_trunc($translabel,18); } else { - $labeltoshow=dol_trunc($obj->$InfoFieldList[1],18); + $labeltoshow=dol_trunc($obj->{$InfoFieldList[1]},18); } } if (empty($labeltoshow)) $labeltoshow='(not defined)'; @@ -1055,7 +1056,7 @@ class ExtraFields $labeltoshow .= $obj->$field_toshow . ' '; } } else { - $labeltoshow = $obj->$InfoFieldList[1]; + $labeltoshow = $obj->{$InfoFieldList[1]}; } $labeltoshow = dol_trunc($labeltoshow, 45); @@ -1076,11 +1077,11 @@ class ExtraFields $out .= '/>' . $labeltoshow . '
'; } else { if (! $notrans) { - $translabel = $langs->trans($obj->$InfoFieldList[1]); - if ($translabel != $obj->$InfoFieldList[1]) { + $translabel = $langs->trans($obj->{$InfoFieldList[1]}); + if ($translabel != $obj->{$InfoFieldList[1]}) { $labeltoshow = dol_trunc($translabel, 18); } else { - $labeltoshow = dol_trunc($obj->$InfoFieldList[1], 18); + $labeltoshow = dol_trunc($obj->{$InfoFieldList[1]}, 18); } } if (empty($labeltoshow)) @@ -1274,13 +1275,13 @@ class ExtraFields else { $translabel=''; - if (!empty($obj->$InfoFieldList[1])) { - $translabel=$langs->trans($obj->$InfoFieldList[1]); + if (!empty($obj->{$InfoFieldList[1]})) { + $translabel=$langs->trans($obj->{$InfoFieldList[1]}); } - if ($translabel!=$obj->$InfoFieldList[1]) { + if ($translabel!=$obj->{$InfoFieldList[1]}) { $value=dol_trunc($translabel,18); }else { - $value=$obj->$InfoFieldList[1]; + $value=$obj->{$InfoFieldList[1]}; } } } @@ -1354,13 +1355,13 @@ class ExtraFields } } else { $translabel = ''; - if (! empty($obj->$InfoFieldList[1])) { - $translabel = $langs->trans($obj->$InfoFieldList[1]); + if (! empty($obj->{$InfoFieldList[1]})) { + $translabel = $langs->trans($obj->{$InfoFieldList[1]}); } - if ($translabel != $obj->$InfoFieldList[1]) { + if ($translabel != $obj->{$InfoFieldList[1]}) { $value .= dol_trunc($translabel, 18) . '
'; } else { - $value .= $obj->$InfoFieldList[1] . '
'; + $value .= $obj->{$InfoFieldList[1]} . '
'; } } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 668855672a5..17a3601a660 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -503,7 +503,8 @@ class Form $ret.=''; } $ret.=''; - $ret.=''; + // Warning: if you set submit button to disabled, post using Enter will no more work + $ret.=''; $ret.='
'; $ret.=' @@ -515,7 +516,6 @@ class Form /* console.log( index + ": " + $( this ).text() ); */ if ($(this).is(\':checked\')) atleastoneselected++; }); - console.log(atleastoneselected); if (atleastoneselected) { jQuery(".massaction").show(); @@ -531,6 +531,7 @@ class Form jQuery(".checkforselect").click(function() { initCheckForSelect(); }); + /* Warning: if you set submit button to disabled, post using Enter will no more work jQuery(".massactionselect").change(function() { console.log( $( this ).val() ); if ($(this).val() != \'0\') @@ -542,6 +543,7 @@ class Form jQuery(".massactionconfirmed").prop(\'disabled\', true); } }); + */ }); '; @@ -893,7 +895,7 @@ class Form * @param string $selected Preselected type * @param string $htmlname Name of field in form * @param string $filter optional filters criteras (example: 's.rowid <> x', 's.client IN (1,3)') - * @param int $showempty Add an empty field + * @param string $showempty Add an empty field (Can be '1' or text to use on empty line) * @param int $showtype Show third party type in combolist (customer, prospect or supplier) * @param int $forcecombo Force to use combo box * @param array $events Ajax event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) @@ -902,7 +904,7 @@ class Form * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container * @return string HTML string with select box for thirdparty. */ - function select_company($selected='', $htmlname='socid', $filter='', $showempty=0, $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='') + function select_company($selected='', $htmlname='socid', $filter='', $showempty='', $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='') { $out=''; @@ -948,7 +950,7 @@ class Form * @param string $selected Preselected type * @param string $htmlname Name of field in form * @param string $filter optional filters criteras (example: 's.rowid <> x', 's.client in (1,3)') - * @param int $showempty Add an empty field + * @param string $showempty Add an empty field (Can be '1' or text to use on empty line) * @param int $showtype Show third party type in combolist (customer, prospect or supplier) * @param int $forcecombo Force to use combo box * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) @@ -959,7 +961,7 @@ class Form * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container * @return string HTML string with */ - function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0, $morecss='minwidth100', $moreparam='') + function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty='', $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0, $morecss='minwidth100', $moreparam='') { global $conf,$user,$langs; @@ -1016,10 +1018,13 @@ class Form $out.= '