diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 7ead3a9940e..fea9cff6020 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -45,7 +45,7 @@ if (! $user->rights->accounting->bind->write) accessforbidden(); // Filter -$year = $_GET["year"]; +$year = GETPOST('year', 'int'); if ($year == 0) { $year_current = strftime("%Y", time()); $year_start = $year_current; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 8c6f7687263..ddcc6e50d5e 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1164,7 +1164,7 @@ else print ''.$langs->trans("PhonePerso").'phone_perso).'">'; // Mobile phone - print ''.$langs->trans("PhoneMobile").'phone_mobile).'">'; + print ''.$langs->trans("PhoneMobile").'phone_mobile).'">'; // Skype if (! empty($conf->skype->enabled)) diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index e6bb4a2914f..9406f8ecc5d 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -375,7 +375,7 @@ if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) print ''.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").''."\n"; print ' '."\n"; print ''."\n"; - $formactions->select_type_actions($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT, "AGENDA_USE_EVENT_TYPE_DEFAULT", '', 0, 1); + $formactions->select_type_actions($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT, "AGENDA_USE_EVENT_TYPE_DEFAULT", 'systemauto', 0, 1); print ''."\n"; } diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 41b2f489904..597327c04ba 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -112,7 +112,12 @@ $modules=array( array( 'code' => 'MAIN_DELAY_EXPENSEREPORTS', 'img' => 'trip' - ) + ), + /* TODO Enable this + array( + 'code' => 'MAIN_DELAY_EXPENSEREPORTS_TO_PAY', + 'img' => 'trip' + )*/ ), ); diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 01f2736d718..d05518374c1 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -404,7 +404,7 @@ if ($action == 'edit') $var=!$var; $liste = array(); $liste['user'] = $langs->trans('UserEmail'); - $liste['company'] = $langs->trans('CompanyEmail'); + $liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL)?$langs->trans("NotDefined"):$conf->global->MAIN_INFO_SOCIETE_MAIL).')'; print ''.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').''; print $form->selectarray('MAIN_MAIL_DEFAULT_FROMTYPE',$liste,$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE,0); diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 6880dbd0aa3..da0f1c73d12 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -49,8 +49,8 @@ class Categorie extends CommonObject const TYPE_MEMBER = 3; // TODO Replace this value with 'member' const TYPE_CONTACT = 4; // TODO Replace this value with 'contact' const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user' - const TYPE_ACCOUNT = 5; // for bank account TODO Replace this value with 'account' - const TYPE_PROJECT = 6; + const TYPE_ACCOUNT = 5; // for bank account TODO Replace this value with 'account' + const TYPE_PROJECT = 6; /** * @var array ID mapping from type string @@ -131,17 +131,17 @@ class Categorie extends CommonObject public $element='category'; public $table_element='categories'; - var $fk_parent; - var $label; - var $description; + public $fk_parent; + public $label; + public $description; /** * @var string Color */ - var $color; + public $color; /** * @var ??? */ - var $socid; + public $socid; /** * @var int Category type * @@ -154,10 +154,10 @@ class Categorie extends CommonObject * @see Categorie::TYPE_ACCOUNT * @see Categorie::TYPE_PROJECT */ - var $type; + public $type; - var $cats=array(); // Categories table in memory - var $motherof=array(); + public $cats = array(); // Categories table in memory + public $motherof = array(); /** * Constructor diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index f43f3ecd046..7c34498e6b4 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -681,9 +681,9 @@ if ($action == 'create') dol_fiche_head(); print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; // Other attributes $parameters=array(); @@ -697,7 +697,7 @@ if ($action == 'create') print '

'; print '
'.$langs->trans("MailTitle").'
'.$langs->trans("MailFrom").'
'.$langs->trans("MailErrorsTo").'
'.$langs->trans("MailTitle").'
'.$langs->trans("MailFrom").'
'.$langs->trans("MailErrorsTo").'
'; - print ''; + print ''; print ''; @@ -756,11 +756,12 @@ else $sendingmode=$conf->global->MAIN_MAIL_SENDMODE; if (empty($sendingmode)) $sendingmode='mail'; // If not defined, we use php mail function - // Note: MAILING_LIMIT_SENDBYWEB is always defined to something != 0 + // MAILING_NO_USING_PHPMAIL may be defined or not + // MAILING_LIMIT_SENDBYWEB is always defined to something != 0, MAILING_LIMIT_SENDBYCLI may be defined ot not. if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') { // EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent. - // You ensure that every user is using its own SMTP server. + // You ensure that every user is using its own SMTP server when using the mass emailing module. $linktoadminemailbefore=''; $linktoadminemailend=''; setEventMessages($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), null, 'warnings'); @@ -770,10 +771,13 @@ else } else if ($conf->global->MAILING_LIMIT_SENDBYWEB == '-1') { - // No limit was defined, so the feature is forbidden from GUI, we show just a message. - setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings'); + if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_PHPMAIL, null, 'warnings'); + if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL, null, 'warnings'); + + // The feature is forbidden from GUI, we show just message to use from command line. + setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings'); setEventMessages('', null, 'warnings'); - if ($conf->file->mailing_limit_sendbyweb != '-1') + if ($conf->file->mailing_limit_sendbyweb != '-1') // MAILING_LIMIT_SENDBYWEB was set to -1 in database, but it is allowed ot increase it. { setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); // You can send online with constant... } @@ -781,8 +785,11 @@ else } else { - $text=''; - if ($conf->global->MAILING_LIMIT_SENDBYCLI >= 0) + if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_PHPMAIL, null, 'warnings'); + if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL, null, 'warnings'); + + $text=''; + if ($conf->global->MAILING_LIMIT_SENDBYCLI >= 0) { $text.=$langs->trans("MailingNeedCommand"); $text.='
'; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 0a4ff814ec8..74566100f89 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1015,6 +1015,18 @@ if (empty($reshook)) if (! $error) { $db->begin(); + if (empty($user->rights->margins->creer)) + { + foreach ($object->lines as &$line) + { + if ($line->id == GETPOST('lineid')) + { + $fournprice = $line->fk_fournprice; + $buyingprice = $line->pa_ht; + break; + } + } + } $result = $object->updateline(GETPOST('lineid'), $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, $_POST["units"], $pu_ht_devise); if ($result >= 0) { diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php index 4ea377a4487..82269434638 100644 --- a/htdocs/comm/remise.php +++ b/htdocs/comm/remise.php @@ -116,7 +116,7 @@ if ($socid > 0) print '
'; print '
'.$langs->trans("MailTopic").'
'.$langs->trans("MailTopic").'
'.$langs->trans("BackgroundColorByDefault").''; print $htmlother->selectColor($_POST['bgcolor'],'bgcolor','new_mailing',0); print '
'; - // Remise + // Discount print '"; @@ -127,13 +127,13 @@ if ($socid > 0) print '
'; print $langs->trans("CustomerRelativeDiscount").''.price2num($object->remise_percent)."%
'; - // Nouvelle valeur + // New value print ''; + print $langs->trans("NewValue").''; // Motif/Note print ''; + print $langs->trans("NoteReason").''; print "
'; - print $langs->trans("NewValue").'%
%
'; - print $langs->trans("NoteReason").'
"; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index efd6af16f70..db11214803d 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -968,6 +968,19 @@ if (empty($reshook)) } if (! $error) { + + if (empty($user->rights->margins->creer)) + { + foreach ($object->lines as &$line) + { + if ($line->id == GETPOST('lineid')) + { + $fournprice = $line->fk_fournprice; + $buyingprice = $line->pa_ht; + break; + } + } + } $result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units'),$pu_ht_devise); if ($result >= 0) { diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index ddf30b290be..58b445c8ce7 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -58,9 +58,6 @@ llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES $object->fetch_thirdparty(); $object->info($object->id); -$soc = new Societe($db); -$soc->fetch($object->thirdparty->id); - $head = commande_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("CustomerOrder"), 0, 'order'); @@ -68,13 +65,12 @@ dol_fiche_head($head, 'info', $langs->trans("CustomerOrder"), 0, 'order'); $linkback = '' . $langs->trans("BackToList") . ''; - $morehtmlref='
'; // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty -$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); +$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project if (! empty($conf->projet->enabled)) { diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 9a4b58a26c6..4d53d8e8d50 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -71,11 +71,10 @@ $form = new Form($db); if ($id > 0 || ! empty($ref)) { - $soc = new Societe($db); - $soc->fetch($object->socid); - + $object->fetch_thirdparty(); + $head = commande_prepare_head($object); - + dol_fiche_head($head, 'note', $langs->trans("CustomerOrder"), 0, 'order'); // Order card @@ -88,7 +87,7 @@ if ($id > 0 || ! empty($ref)) $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project if (! empty($conf->projet->enabled)) { diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php index ce70e7ac938..47405d0e748 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -576,7 +576,7 @@ if ($resql) print ''; print ''; print ''; - if (! empty($_REQUEST['bid'])) print ''; + if (GETPOST('bid')) print ''; // Form to reconcile if ($user->rights->banque->consolidate && $action == 'reconcile') diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index d2b3c167872..baf2f3e26b1 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -50,7 +50,7 @@ $cancel = GETPOST('cancel', 'alpha'); // Security check if (isset($_GET["id"]) || isset($_GET["ref"])) { - $id = isset($_GET["id"])?$_GET["id"]:(isset($_GET["ref"])?$_GET["ref"]:''); + $id = isset($_GET["id"])?GETPOST("id"):(isset($_GET["ref"])?GETPOST("ref"):''); } $fieldid = isset($_GET["ref"])?'ref':'rowid'; if ($user->societe_id) $socid=$user->societe_id; @@ -93,7 +93,7 @@ if ($action == 'add') $object->iban = trim($_POST["iban"]); $object->domiciliation = trim($_POST["domiciliation"]); - $object->proprio = trim($_POST["proprio"]); + $object->proprio = trim($_POST["proprio"]); $object->owner_address = trim($_POST["owner_address"]); $account_number = GETPOST('account_number','alpha'); @@ -105,12 +105,12 @@ if ($action == 'add') $object->currency_code = trim($_POST["account_currency_code"]); - $object->state_id = $_POST["account_state_id"]; + $object->state_id = $_POST["account_state_id"]; $object->country_id = $_POST["account_country_id"]; $object->min_allowed = GETPOST("account_min_allowed",'int'); $object->min_desired = GETPOST("account_min_desired",'int'); - $object->comment = trim($_POST["account_comment"]); + $object->comment = trim(GETPOST("account_comment")); $object->fk_user_author = $user->id; @@ -172,7 +172,7 @@ if ($action == 'update') // Update account $object = new Account($db); - $object->fetch($_POST["id"]); + $object->fetch(GETPOST("id")); $object->ref = dol_string_nospecial(trim($_POST["ref"])); $object->label = trim($_POST["label"]); @@ -190,7 +190,7 @@ if ($action == 'update') $object->iban = trim($_POST["iban"]); $object->domiciliation = trim($_POST["domiciliation"]); - $object->proprio = trim($_POST["proprio"]); + $object->proprio = trim($_POST["proprio"]); $object->owner_address = trim($_POST["owner_address"]); $account_number = GETPOST('account_number', 'int'); @@ -204,7 +204,7 @@ if ($action == 'update') $object->min_allowed = GETPOST("account_min_allowed",'int'); $object->min_desired = GETPOST("account_min_desired",'int'); - $object->comment = trim($_POST["account_comment"]); + $object->comment = trim(GETPOST("account_comment")); if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) { @@ -251,7 +251,7 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user- { // Delete $object = new Account($db); - $object->fetch($_GET["id"]); + $object->fetch(GETPOST("id","int")); $object->delete(); header("Location: ".DOL_URL_ROOT."/compta/bank/index.php"); @@ -367,7 +367,7 @@ if ($action == 'create') // Web print ''.$langs->trans("Web").''; - print ''; + print ''; // Tags-Categories if ($conf->categorie->enabled) @@ -836,11 +836,11 @@ else // Ref print ''.$langs->trans("Ref").''; - print 'ref).'">'; + print 'ref).'">'; // Label print ''.$langs->trans("Label").''; - print 'label).'">'; + print 'label).'">'; // Type print ''.$langs->trans("AccountType").''; @@ -902,14 +902,14 @@ else // Balance print ''.$langs->trans("BalanceMinimalAllowed").''; - print 'min_allowed).'">'; + print 'min_allowed).'">'; print ''.$langs->trans("BalanceMinimalDesired").''; - print 'min_desired).'">'; + print 'min_desired).'">'; // Web print ''.$langs->trans("Web").''; - print 'url).'">'; + print 'url).'">'; print ''; // Tags-Categories @@ -970,7 +970,7 @@ else if (! empty($conf->accounting->enabled)) { print ''.$langs->trans("AccountancyJournal").''; - print 'accountancy_journal).'">'; + print 'accountancy_journal).'">'; } print ''; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 139f578c5d6..73dd2d4f199 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -833,7 +833,7 @@ class Account extends CommonObject * @param string $ref Ref of bank account to get * @return int <0 if KO, >0 if OK */ - function fetch($id,$ref='') + function fetch($id, $ref='') { global $conf; diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index bf69fe98a3b..31a4087815c 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -43,9 +43,9 @@ $fieldid = isset($_GET["ref"])?'ref':'rowid'; if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fieldid); -$account=$_GET["account"]; +$account=GETPOST("account"); $mode='standard'; -if (isset($_GET["mode"]) && $_GET["mode"] == 'showalltime') $mode='showalltime'; +if (GETPOST("mode") == 'showalltime') $mode='showalltime'; $error=0; @@ -63,18 +63,18 @@ $datetime = dol_now(); $year = dol_print_date($datetime, "%Y"); $month = dol_print_date($datetime, "%m"); $day = dol_print_date($datetime, "%d"); -if (! empty($_GET["year"])) $year=sprintf("%04d",$_GET["year"]); -if (! empty($_GET["month"])) $month=sprintf("%02d",$_GET["month"]); +if (GETPOST("year")) $year=sprintf("%04d",GETPOST("year")); +if (GETPOST("month")) $month=sprintf("%02d",GETPOST("month")); $object = new Account($db); if ($_GET["account"] && ! preg_match('/,/',$_GET["account"])) // if for a particular account and not a list { - $result=$object->fetch($_GET["account"]); + $result=$object->fetch(GETPOST("account", "int")); } if ($_GET["ref"]) { - $result=$object->fetch(0,$_GET["ref"]); + $result=$object->fetch(0, GETPOST("ref")); $account=$object->id; } @@ -823,7 +823,7 @@ print '

'; // Graphs if ($mode == 'standard') { - $prevyear=$year;$nextyear=$year; + $prevyear=$year; $nextyear=$year; $prevmonth=$month-1;$nextmonth=$month+1; if ($prevmonth < 1) { $prevmonth=12; $prevyear--; } if ($nextmonth > 12) { $nextmonth=1; $nextyear++; } diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php index db9d4e623ca..6a3052a938d 100644 --- a/htdocs/compta/clients.php +++ b/htdocs/compta/clients.php @@ -97,35 +97,36 @@ $sql.= " AND s.entity IN (".getEntity('societe', 1).")"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (dol_strlen($stcomm)) { - $sql.= " AND s.fk_stcomm=$stcomm"; + $sql.= " AND s.fk_stcomm=".$stcomm; } if ($socname) { - $sql.= " AND s.nom LIKE '%".$db->escape($socname)."%'"; + $sql.= natural_search("s.nom", $socname); $sortfield = "s.nom"; $sortorder = "ASC"; } if ($_GET["search_nom"]) { - $sql.= " AND s.nom LIKE '%".$db->escape($_GET["search_nom"])."%'"; + $sql.= natural_search("s.nom", GETPOST("search_nom")); } if ($_GET["search_compta"]) { - $sql.= " AND s.code_compta LIKE '%".$db->escape($_GET["search_compta"])."%'"; + $sql.= natural_search("s.code_compta", GETPOST("search_compta")); } if ($_GET["search_code_client"]) { - $sql.= " AND s.code_client LIKE '%".$db->escape($_GET["search_code_client"])."%'"; + $sql.= natural_search("s.code_client", GETPOST("search_code_client")); } if (dol_strlen($begin)) { - $sql.= " AND s.nom LIKE '".$db->escape($begin)."'"; + $sql.= natural_search("s.nom", $begin); } if ($socid) { $sql.= " AND s.rowid = ".$socid; } -$sql.= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); +$sql.= " ORDER BY $sortfield $sortorder "; +$sql.= $db->plimit($conf->liste_limit+1, $offset); //print $sql; $resql = $db->query($sql); diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 9708d8e6360..cd44122b981 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1688,6 +1688,19 @@ if (empty($reshook)) // Update line if (! $error) { + if (empty($user->rights->margins->creer)) + { + foreach ($object->lines as &$line) + { + if ($line->id == GETPOST('lineid')) + { + $fournprice = $line->fk_fournprice; + $buyingprice = $line->pa_ht; + break; + } + } + } + $result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty, GETPOST('remise_percent'), $date_start, $date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('progress'), diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index 8fbc028a589..1772b6861dd 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -66,12 +66,12 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $datev=dol_mktime(12,0,0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]); $datep=dol_mktime(12,0,0, $_POST["datepmonth"], $_POST["datepday"], $_POST["datepyear"]); - $localtax->accountid=$_POST["accountid"]; - $localtax->paymenttype=$_POST["paiementtype"]; + $localtax->accountid=GETPOST("accountid"); + $localtax->paymenttype=GETPOST("paiementtype"); $localtax->datev=$datev; $localtax->datep=$datep; - $localtax->amount=$_POST["amount"]; - $localtax->label=$_POST["label"]; + $localtax->amount=price2num(GETPOST("amount")); + $localtax->label=GETPOST("label"); $localtax->ltt=$lttype; $ret=$localtax->addPayment($user); @@ -178,10 +178,10 @@ if ($action == 'create') print ''; // Label - print ''.$langs->trans("Label").'transcountry(($lttype==2?"LT2Payment":"LT1Payment"),$mysoc->country_code)).'">'; + print ''.$langs->trans("Label").'transcountry(($lttype==2?"LT2Payment":"LT1Payment"),$mysoc->country_code)).'">'; // Amount - print ''.$langs->trans("Amount").''; + print ''.$langs->trans("Amount").''; if (! empty($conf->banque->enabled)) { diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 82749f4949f..9980ea396de 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -251,9 +251,9 @@ if (empty($reshook)) $paiement->datepaye = $datepaye; $paiement->amounts = $amounts; // Array with all payments dispatching $paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching - $paiement->paiementid = dol_getIdFromCode($db,$_POST['paiementcode'],'c_paiement'); - $paiement->num_paiement = $_POST['num_paiement']; - $paiement->note = $_POST['comment']; + $paiement->paiementid = dol_getIdFromCode($db,GETPOST('paiementcode'),'c_paiement'); + $paiement->num_paiement = GETPOST('num_paiement'); + $paiement->note = GETPOST('comment'); if (! $error) { @@ -513,7 +513,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Comments print ''.$langs->trans('Comments').''; print ''; - print ''; + print ''; print ''; @@ -683,12 +683,12 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if (!empty($conf->use_javascript_ajax)) print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $remaintopay)."'"); print ''; - print ''; + print ''; } else { - print ''; - print ''; + print ''; + print ''; } print ""; diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index 8f23036f6af..b8bcf030729 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -43,7 +43,7 @@ if ($user->societe_id > 0) $dir = $conf->facture->dir_output.'/payments'; if (! $user->rights->societe->client->voir || $socid) $dir.='/private/'.$user->id; // If user has no permission to see all, output dir is specific to user -$year = $_GET["year"]; +$year = GETPOST('year', 'int'); if (! $year) { $year=date("Y"); } diff --git a/htdocs/compta/payment_sc/card.php b/htdocs/compta/payment_sc/card.php index 0ea48d9075c..b64d92d873f 100644 --- a/htdocs/compta/payment_sc/card.php +++ b/htdocs/compta/payment_sc/card.php @@ -37,7 +37,7 @@ $langs->load('banks'); $langs->load('companies'); // Security check -$id=GETPOST("id"); +$id=GETPOST("id",'int'); $action=GETPOST("action"); $confirm=GETPOST('confirm'); if ($user->societe_id) $socid=$user->societe_id; @@ -126,12 +126,12 @@ $form = new Form($db); $h=0; -$head[$h][0] = DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$_GET["id"]; +$head[$h][0] = DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$id; $head[$h][1] = $langs->trans("Card"); $hselected = $h; $h++; -/*$head[$h][0] = DOL_URL_ROOT.'/compta/payment_sc/info.php?id='.$_GET["id"]; +/*$head[$h][0] = DOL_URL_ROOT.'/compta/payment_sc/info.php?id='.$id; $head[$h][1] = $langs->trans("Info"); $h++; */ diff --git a/htdocs/compta/salaries/card.php b/htdocs/compta/salaries/card.php index a7921e53859..df83f5b9958 100644 --- a/htdocs/compta/salaries/card.php +++ b/htdocs/compta/salaries/card.php @@ -257,7 +257,7 @@ if ($action == 'create') // Label print ''; print fieldLabel('Label','label',1).''; - print 'trans("SalaryPayment")).'">'; + print 'trans("SalaryPayment")).'">'; print ''; // Date start period @@ -275,7 +275,7 @@ if ($action == 'create') // Amount print ''; print fieldLabel('Amount','amount',1).''; - print ''; + print ''; print ''; // Bank diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index a32a67bb9fe..8d1aceeaa77 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -39,7 +39,7 @@ $userid=GETPOST('userid','int'); $socid = GETPOST('socid','int'); // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') $modecompta = $conf->global->ACCOUNTING_MODE; -if ($_GET["modecompta"]) $modecompta=$_GET["modecompta"]; +if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta",'alpha'); // Security check if ($user->societe_id > 0) $socid = $user->societe_id; diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 99bb676a321..cb80f49e790 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -258,10 +258,10 @@ if ($action == 'create') } else { $label = $langs->trans("VATPayment"); } - print ''.$langs->trans("Label").''; + print ''.$langs->trans("Label").''; // Amount - print ''.$langs->trans("Amount").''; + print ''.$langs->trans("Amount").''; if (! empty($conf->banque->enabled)) { diff --git a/htdocs/compta/tva/quadri.php b/htdocs/compta/tva/quadri.php index 0e4a66146aa..73cc0bc96ba 100644 --- a/htdocs/compta/tva/quadri.php +++ b/htdocs/compta/tva/quadri.php @@ -29,7 +29,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; -$year=$_GET["year"]; +$year = GETPOST('year', 'int'); if ($year == 0 ) { $year_current = strftime("%Y",time()); diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php new file mode 100644 index 00000000000..3882d2ebca3 --- /dev/null +++ b/htdocs/contact/agenda.php @@ -0,0 +1,297 @@ + + * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2007 Franky Van Liedekerke + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2015 Jean-François Ferry + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/contact/card.php + * \ingroup societe + * \brief Card of a contact + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; +require_once DOL_DOCUMENT_ROOT. '/core/class/html.form.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + +$langs->load("companies"); +$langs->load("users"); +$langs->load("other"); +$langs->load("commercial"); + +$mesg=''; $error=0; $errors=array(); + +$action = (GETPOST('action','alpha') ? GETPOST('action','alpha') : 'view'); +$confirm = GETPOST('confirm','alpha'); +$backtopage = GETPOST('backtopage','alpha'); +$id = GETPOST('id','int'); +$socid = GETPOST('socid','int'); + +$object = new Contact($db); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + +// Get object canvas (By default, this is not defined, so standard usage of dolibarr) +$object->getCanvas($id); +$objcanvas=null; +$canvas = (! empty($object->canvas)?$object->canvas:GETPOST("canvas")); +if (! empty($canvas)) +{ + require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; + $objcanvas = new Canvas($db, $action); + $objcanvas->getCanvas('contact', 'contactcard', $canvas); +} + +if (GETPOST('actioncode','array')) +{ + $actioncode=GETPOST('actioncode','array',3); + if (! count($actioncode)) $actioncode='0'; +} +else +{ + $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); +} +$search_agenda_label=GETPOST('search_agenda_label'); + +// Security check +if ($user->societe_id) $socid=$user->societe_id; +$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission + +$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = GETPOST("page",'int'); +if ($page == -1) { $page = 0; } +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortfield) $sortfield='a.datep, a.id'; +if (! $sortorder) $sortorder='DESC'; + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('contactcard','globalcard')); + + +/* + * Actions + */ + +$parameters=array('id'=>$id, 'objcanvas'=>$objcanvas); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) +{ + // Cancel + if (GETPOST("cancel") && ! empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } + + // Purge search criteria + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers + { + $actioncode=''; + $search_agenda_label=''; + } +} + + +/* + * View + */ + + +$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); +if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/contactnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->lastname) $title=$object->lastname; +$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; +llxHeader('', $title, $help_url); + +$form = new Form($db); +$formcompany = new FormCompany($db); + +$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; + +if ($socid > 0) +{ + $objsoc = new Societe($db); + $objsoc->fetch($socid); +} + +if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) +{ + // ----------------------------------------- + // When used with CANVAS + // ----------------------------------------- + if (empty($object->error) && $id) + { + $object = new Contact($db); + $result=$object->fetch($id); + if ($result <= 0) dol_print_error('',$object->error); + } + $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates + $objcanvas->display_canvas($action); // Show template +} +else +{ + // ----------------------------------------- + // When used in standard mode + // ----------------------------------------- + + // Confirm deleting contact + if ($user->rights->societe->contact->supprimer) + { + if ($action == 'delete') + { + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id.($backtopage?'&backtopage='.$backtopage:''),$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1); + } + } + + /* + * Onglets + */ + $head=array(); + if ($id > 0) + { + // Si edition contact deja existant + $object = new Contact($db); + $res=$object->fetch($id, $user); + if ($res < 0) { dol_print_error($db,$object->error); exit; } + $res=$object->fetch_optionals($object->id,$extralabels); + + // Show tabs + $head = contact_prepare_head($object); + + $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); + } + + if (! empty($id) && $action != 'edit' && $action != 'create') + { + $objsoc = new Societe($db); + + /* + * Fiche en mode visualisation + */ + + dol_htmloutput_errors($error,$errors); + + dol_fiche_head($head, 'agenda', $title, 0, 'contact'); + + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) + { + $objsoc=new Societe($db); + $objsoc->fetch($object->socid); + // Thirdparty + $morehtmlref.=$langs->trans('ThirdParty') . ' : '; + if ($objsoc->id > 0) $morehtmlref.=$objsoc->getNomUrl(1); + else $morehtmlref.=$langs->trans("ContactNotLinkedToCompany"); + } + $morehtmlref.='
'; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref); + + print '
'; + + print '
'; + + $object->info($id); + print dol_print_object_info($object, 1); + + print '
'; + + print dol_fiche_end(); + + + // Actions buttons + + $objcon=$object; + $object->fetch_thirdparty(); + $objthirdparty=$object->thirdparty; + + $out=''; + $permok=$user->rights->agenda->myactions->create; + if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok) + { + //$out.='trans("AddAnAction"),'filenew'); + //$out.=""; + } + + + print '
'; + + if (! empty($conf->agenda->enabled)) + { + if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create)) + { + print ''.$langs->trans("AddAction").''; + } + else + { + print ''.$langs->trans("AddAction").''; + } + } + + print '
'; + + if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) + { + $param='&id='.$id; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + + + print load_fiche_titre($langs->trans("TasksHistoryForThisContact"),'',''); + + // List of all actions + $filters=array(); + $filters['search_agenda_label']=$search_agenda_label; + + show_actions_done($conf,$langs,$db,$objthirdparty,$object,0,$actioncode, '', $filters, $sortfield, $sortorder); + } + } +} + + +llxFooter(); + +$db->close(); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index e7896d9b9ac..e6429fdc6d7 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -477,10 +477,10 @@ else */ $object->canvas=$canvas; - $object->state_id = $_POST["state_id"]; + $object->state_id = GETPOST("state_id"); // We set country_id, country_code and label for the selected country - $object->country_id=$_POST["country_id"]?$_POST["country_id"]:(empty($objsoc->country_id)?$mysoc->country_id:$objsoc->country_id); + $object->country_id=$_POST["country_id"]?GETPOST("country_id"):(empty($objsoc->country_id)?$mysoc->country_id:$objsoc->country_id); if ($object->country_id) { $tmparray=getCountry($object->country_id,'all'); @@ -530,9 +530,9 @@ else // Name print ''; - print 'lastname).'" autofocus="autofocus">'; + print 'lastname).'" autofocus="autofocus">'; print ''; - print 'firstname).'">'; + print 'firstname).'">'; // Company if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) @@ -559,7 +559,7 @@ else print ''; print ''; - print 'poste).'">'; + print 'poste).'">'; $colspan=3; if ($conf->use_javascript_ajax && $socid > 0) $colspan=2; @@ -612,20 +612,20 @@ else // Phone / Fax if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->phone_pro)) == 0) $object->phone_pro = $objsoc->phone; // Predefined with third party print ''; - print 'phone_pro).'">'; + print 'phone_pro).'">'; print ''; - print 'phone_perso).'">'; + print 'phone_perso).'">'; if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->fax)) == 0) $object->fax = $objsoc->fax; // Predefined with third party print ''; - print 'phone_mobile).'">'; + print 'phone_mobile).'">'; print ''; - print 'fax).'">'; + print 'fax).'">'; // EMail if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->email)) == 0) $object->email = $objsoc->email; // Predefined with third party print ''; - print 'email).'">'; + print 'email).'">'; if (! empty($conf->mailing->enabled)) { print ''; @@ -639,13 +639,13 @@ else // Instant message and no email print ''; - print 'jabberid).'">'; + print 'jabberid).'">'; // Skype if (! empty($conf->skype->enabled)) { print ''; - print 'skype).'">'; + print 'skype).'">'; } // Visibility @@ -784,9 +784,13 @@ else // Lastname print ''; - print 'lastname).'" autofocus="autofocus">'; + print 'lastname).'" autofocus="autofocus">'; + print ''; + print ''; + // Firstname print ''; - print 'firstname).'">'; + print 'firstname).'">'; + print ''; // Company if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) @@ -800,57 +804,56 @@ else // Civility print ''; - print $formcompany->select_civility(isset($_POST["civility_id"])?$_POST["civility_id"]:$object->civility_id); + print $formcompany->select_civility(isset($_POST["civility_id"])?GETPOST("civility_id"):$object->civility_id); print ''; print ''; - print 'poste).'">'; + print 'poste).'">'; // Address print ''; - print ''; - - $rowspan=3; - if (empty($conf->global->SOCIETE_DISABLE_STATE)) $rowspan++; - - print ''; - if ($conf->use_javascript_ajax) print ''.$langs->trans('CopyAddressFromSoc').''; - print ''; + print ''; + print '
'; + print ''; + print '
'; + if ($conf->use_javascript_ajax) print ''.$langs->trans('CopyAddressFromSoc').'
'; + print '
'; + print ''; // Zip / Town - print ' / '; - print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6).' '; - print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id')); + print ' / '; + print $formcompany->select_ziptown((isset($_POST["zipcode"])?GETPOST("zipcode"):$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6).' '; + print $formcompany->select_ziptown((isset($_POST["town"])?GETPOST("town"):$object->town),'town',array('zipcode','selectcountry_id','state_id')); print ''; // Country - print ''; - print $form->select_country(isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id,'country_id'); + print ''; + print $form->select_country(isset($_POST["country_id"])?GETPOST("country_id"):$object->country_id,'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print ''; // State if (empty($conf->global->SOCIETE_DISABLE_STATE)) { - print ''; - print $formcompany->select_state($object->state_id,isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id,'state_id'); + print ''; + print $formcompany->select_state($object->state_id,isset($_POST["country_id"])?GETPOST("country_id"):$object->country_id,'state_id'); print ''; } // Phone print ''; - print 'phone_pro).'">'; + print 'phone_pro).'">'; print ''; - print 'phone_perso).'">'; + print 'phone_perso).'">'; print ''; - print 'phone_mobile).'">'; + print 'phone_mobile).'">'; print ''; - print 'fax).'">'; + print 'fax).'">'; // EMail print ''; - print 'email).'">'; + print 'email).'">'; if (! empty($conf->mailing->enabled)) { $langs->load("mails"); @@ -865,7 +868,7 @@ else // Jabberid print ''; - print 'jabberid).'">'; + print 'jabberid).'">'; if (! empty($conf->mailing->enabled)) { print ''; @@ -881,7 +884,7 @@ else if (! empty($conf->skype->enabled)) { print ''; - print 'skype).'">'; + print 'skype).'">'; } // Visibility @@ -1046,7 +1049,18 @@ else $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); + $morehtmlref='
'; + if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) + { + $objsoc->fetch($object->socid); + // Thirdparty + $morehtmlref.=$langs->trans('ThirdParty') . ' : '; + if ($objsoc->id > 0) $morehtmlref.=$objsoc->getNomUrl(1); + else $morehtmlref.=$langs->trans("ContactNotLinkedToCompany"); + } + $morehtmlref.='
'; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref); print '
'; @@ -1055,24 +1069,6 @@ else print '
'; print ''; - // Company - if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) - { - print ''; - } - - print ''; - // Civility print '
'.$langs->trans("ThirdParty").''; - if ($object->socid > 0) - { - $objsoc->fetch($object->socid); - print $objsoc->getNomUrl(1); - } - else - { - print $langs->trans("ContactNotLinkedToCompany"); - } - print '
'.$langs->trans("UserTitle").''; print $object->getCivilityLabel(); @@ -1233,8 +1229,9 @@ else } print ""; - print "
"; + //print "
"; + /* if (! empty($conf->agenda->enabled)) { $objthirdparty=$objsoc; @@ -1258,6 +1255,7 @@ else print show_actions_done($conf,$langs,$db,$objsoc,$object,0,'',''); } + */ } } diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index 825c1e8dab5..8d003e14cf5 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -109,7 +109,19 @@ if ($object->id) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); + $morehtmlref='
'; + if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) + { + $objsoc=new Societe($db); + $objsoc->fetch($object->socid); + // Thirdparty + $morehtmlref.=$langs->trans('ThirdParty') . ' : '; + if ($objsoc->id > 0) $morehtmlref.=$objsoc->getNomUrl(1); + else $morehtmlref.=$langs->trans("ContactNotLinkedToCompany"); + } + $morehtmlref.='
'; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref); print '
'; @@ -117,6 +129,7 @@ if ($object->id) print ''; // Company + /* if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { if ($object->socid > 0) @@ -133,7 +146,7 @@ if ($object->id) print $langs->trans("ContactNotLinkedToCompany"); print ''; } - } + }*/ // Civility print '
'.$langs->trans("UserTitle").''; diff --git a/htdocs/contact/note.php b/htdocs/contact/note.php index 17c718cfb42..eed044cdadf 100644 --- a/htdocs/contact/note.php +++ b/htdocs/contact/note.php @@ -74,25 +74,31 @@ if ($id > 0) $head = contact_prepare_head($object); dol_fiche_head($head, 'note', $title,0,'contact'); - - - print '
'; - print ''; - $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); + + $morehtmlref='
'; + if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) + { + $objsoc=new Societe($db); + $objsoc->fetch($object->socid); + // Thirdparty + $morehtmlref.=$langs->trans('ThirdParty') . ' : '; + if ($objsoc->id > 0) $morehtmlref.=$objsoc->getNomUrl(1); + else $morehtmlref.=$langs->trans("ContactNotLinkedToCompany"); + } + $morehtmlref.='
'; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref); $cssclass='titlefield'; //if ($action == 'editnote_public') $cssclass='titlefieldcreate'; //if ($action == 'editnote_private') $cssclass='titlefieldcreate'; print '
'; - print '
'; - print ''; - $linkback = ''.$langs->trans("BackToList").''; + print '
'; // Company if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) @@ -148,13 +154,13 @@ if ($id > 0) print "
"; - //print '
'; + print '
'; - //print '
'; - - include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - + $cssclass="titlefield"; + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + print '
'; + dol_fiche_end(); } diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 03e62523922..bc4443dd8bf 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -233,7 +233,20 @@ else $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); + $morehtmlref='
'; + if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) + { + $objsoc=new Societe($db); + $objsoc->fetch($object->socid); + // Thirdparty + $morehtmlref.=$langs->trans('ThirdParty') . ' : '; + if ($objsoc->id > 0) $morehtmlref.=$objsoc->getNomUrl(1); + else $morehtmlref.=$langs->trans("ContactNotLinkedToCompany"); + } + $morehtmlref.='
'; + + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref); print '
'; @@ -242,6 +255,7 @@ else print ''; // Company + /* if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { if ($object->socid > 0) @@ -258,7 +272,7 @@ else print $langs->trans("ContactNotLinkedToCompany"); print ''; } - } + }*/ // Civility print ''; - else - print ''; - + if (!empty($user->rights->margins->creer)) + { + if ($conf->global->MARGIN_TYPE == "1") + print ''; + else + print ''; + } + if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) print ''; if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index abe672dee68..c451b2e32fd 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -553,10 +553,13 @@ class Conf $this->bank->cheque->warning_delay=(isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT)?$this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT:0)*24*60*60; } if (isset($this->expensereport)) { + $this->expensereport->approve = new stdClass(); + $this->expensereport->approve->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS)?$this->global->MAIN_DELAY_EXPENSEREPORTS:0)*24*60*60; $this->expensereport->payment = new stdClass(); $this->expensereport->payment->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY)?$this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY:0)*24*60*60; } + // For modules that want to disable top or left menu if (! empty($this->global->MAIN_HIDE_TOP_MENU)) $this->dol_hide_topmenu=$this->global->MAIN_HIDE_TOP_MENU; if (! empty($this->global->MAIN_HIDE_LEFT_MENU)) $this->dol_hide_leftmenu=$this->global->MAIN_HIDE_LEFT_MENU; diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 9a59801f720..2295a301e03 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -29,22 +29,22 @@ */ class DiscountAbsolute { - var $db; - var $error; + public $db; + public $error; - var $id; // Id discount - var $fk_soc; - var $amount_ht; // - var $amount_tva; // - var $amount_ttc; // - var $tva_tx; // Vat rate - var $fk_user; // Id utilisateur qui accorde la remise - var $description; // Description libre - var $datec; // Date creation - var $fk_facture_line; // Id invoice line when a discount linked to invoice line (for absolute discounts) - var $fk_facture; // Id invoice when a discoutn linked to invoice (for credit note) - var $fk_facture_source; // Id facture avoir a l'origine de la remise - var $ref_facture_source; // Ref facture avoir a l'origine de la remise + public $id; // Id discount + public $fk_soc; + public $amount_ht; // + public $amount_tva; // + public $amount_ttc; // + public $tva_tx; // Vat rate + public $fk_user; // Id utilisateur qui accorde la remise + public $description; // Description libre + public $datec; // Date creation + public $fk_facture_line; // Id invoice line when a discount linked to invoice line (for absolute discounts) + public $fk_facture; // Id invoice when a discoutn linked to invoice (for credit note) + public $fk_facture_source; // Id facture avoir a l'origine de la remise + public $ref_facture_source; // Ref facture avoir a l'origine de la remise /** * Constructor diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c9e57eeaa4d..8abe3f271f7 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4857,12 +4857,13 @@ class Form * @param int $disabled Html select box is disabled * @param string $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' or 'POS' = Do not sort, we keep original order * @param string $morecss Add more class to css styles - * @param int $addjscombo Add js combo + * @param int $addjscombo Add js combo * @param string $moreparamonempty Add more param on the empty option line. Not used if show_empty not set. - * @return string HTML select string. + * @param int $disablebademail Check if an email is found into value and if not disable and colorize entry. + * @return string HTML select string. * @see multiselectarray */ - static function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='', $addjscombo=0, $moreparamonempty='') + static function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='', $addjscombo=0, $moreparamonempty='',$disablebademail=0) { global $conf, $langs; @@ -4907,7 +4908,10 @@ class Form // Translate if ($translate) { - foreach($array as $key => $value) $array[$key]=$langs->trans($value); + foreach($array as $key => $value) + { + $array[$key]=$langs->trans($value); + } } // Sort @@ -4916,8 +4920,19 @@ class Form foreach($array as $key => $value) { + $disabled=''; $style=''; + if (! empty($disablebademail)) + { + if (! preg_match('/<.+@.+>/', $value)) + { + //$value=preg_replace('/'.preg_quote($a,'/').'/', $b, $value); + $disabled=' disabled'; + $style=' class="warning"'; + } + } $out.=''; if ($key == '50' && $onlyselect == 2) { - print ''; + print ''; } } print ''; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 6d88e735770..013b34699d7 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -264,6 +264,8 @@ class FormMail extends Form { $out=''; + $disablebademails=1; + // Define list of attached files $listofpaths=array(); $listofnames=array(); @@ -392,7 +394,15 @@ class FormMail extends Form } } else { $liste = array(); - $liste['user'] = $user->getFullName($langs) .' <'.$user->email.'>'; + if (empty($user->email)) + { + $langs->load('errors'); + $liste['user'] = $user->getFullName($langs) . ' <'.$langs->trans('ErrorNoMailDefinedForThisUser').'>'; + } + else + { + $liste['user'] = $user->getFullName($langs) .' <'.$user->email.'>'; + } $liste['company'] = $conf->global->MAIN_INFO_SOCIETE_NOM .' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; // Add also email aliases if there is one $listaliases=array('user_aliases'=>$user->email_aliases, 'global_aliases'=>$conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES); @@ -413,7 +423,7 @@ class FormMail extends Form } } } - $out.= ' '.$form->selectarray('fromtype', $liste, $this->fromtype, 0); + $out.= ' '.$form->selectarray('fromtype', $liste, $this->fromtype, 0, 0, 0, '', 0, 0, 0, '', '', 0, '', $disablebademails); } $out.= "\n"; @@ -510,7 +520,7 @@ class FormMail extends Form if (! empty($this->withto) && is_array($this->withto)) { if (! empty($this->withtofree)) $out.= " ".$langs->trans("or")." "; - $out.= $form->selectarray("receiver", $this->withto, GETPOST("receiver"), 1); + $out.= $form->selectarray("receiver", $this->withto, GETPOST("receiver"), 1, 0, 0, '', 0, 0, 0, '', '', 0, '', $disablebademails); } if (isset($this->withtosocid) && $this->withtosocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method. { @@ -522,7 +532,7 @@ class FormMail extends Form $liste[$key]=$value; } if ($this->withtofree) $out.= " ".$langs->trans("or")." "; - $out.= $form->selectarray("receiver", $liste, GETPOST("receiver"), 1); + $out.= $form->selectarray("receiver", $liste, GETPOST("receiver"), 1, 0, 0, '', 0, 0, 0, '', '', 0, '', $disablebademails); } } $out.= "\n"; @@ -544,7 +554,7 @@ class FormMail extends Form if (! empty($this->withtocc) && is_array($this->withtocc)) { $out.= " ".$langs->trans("or")." "; - $out.= $form->selectarray("receivercc", $this->withtocc, GETPOST("receivercc"), 1); + $out.= $form->selectarray("receivercc", $this->withtocc, GETPOST("receivercc"), 1, 0, 0, '', 0, 0, 0, '', '', 0, '', $disablebademails); } } $out.= "\n"; diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 1112d34d13f..6c2b5600917 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -446,7 +446,7 @@ class FormProjets * Build a HTML select list of element of same thirdparty to suggest to link them to project * * @param string $table_element Table of the element to update - * @param int $socid If of thirdparty to use as filter + * @param string $socid If of thirdparty to use as filter or 'id1,id2,...' * @param string $morecss More CSS * @param int $limitonstatus Add filters to limit length of list to opened status (for example to avoid ERR_RESPONSE_HEADERS_TOO_BIG on project/element.php page). TODO To implement * @return int|string The HTML select list of element or '' if nothing or -1 if KO @@ -502,7 +502,11 @@ class FormProjets $sql.= " FROM ".MAIN_DB_PREFIX.$table_element." as t"; if ($linkedtothirdparty) $sql.=", ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE ".$projectkey." is null"; - if (! empty($socid) && $linkedtothirdparty) $sql.= " AND t.fk_soc=".$socid; + if (! empty($socid) && $linkedtothirdparty) + { + if (is_numeric($socid)) $sql.= " AND t.fk_soc=".$socid; + else $sql.= " AND t.fk_soc IN (".$socid.")"; + } if (! in_array($table_element, array('expensereport_det'))) $sql.= ' AND t.entity IN ('.getEntity('project',1).')'; if ($linkedtothirdparty) $sql.=" AND s.rowid = t.fk_soc"; if ($sqlfilter) $sql.= " AND ".$sqlfilter; diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index c8b9cc50f01..93037117cb8 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -28,30 +28,30 @@ */ class Menubase { - var $db; // To store db handler - var $error; // To return error code (or message) - var $errors=array(); // To return several error codes (or messages) + public $db; // To store db handler + public $error; // To return error code (or message) + public $errors=array(); // To return several error codes (or messages) - var $id; + public $id; - var $menu_handler; - var $module; - var $type; - var $mainmenu; - var $fk_menu; - var $fk_mainmenu; - var $fk_leftmenu; - var $position; - var $url; - var $target; - var $titre; - var $langs; - var $level; - var $leftmenu; //_moreinheader = $_val; + } + + /** * get trackid * - * @return string Delivery receipt + * @return string Track id */ function getTrackId() { return $this->_trackId; } + /** + * get moreInHeader + * + * @return string moreInHeader + */ + function getMoreInHeader() + { + return $this->_moreinheader; + } + /** * Set errors to * @@ -1213,7 +1235,9 @@ class SMTPs { $_header .= 'Message-ID: <' . time() . '.SMTPs@' . $host . ">\r\n"; } - + if ( $this->getMoreInHeader() ) + $_header .= $this->getMoreInHeader(); // Value must include the "\r\n"; + //$_header .= // 'Read-Receipt-To: ' . $this->getFrom( 'org' ) . "\r\n" // 'Return-Receipt-To: ' . $this->getFrom( 'org' ) . "\r\n"; @@ -1227,15 +1251,16 @@ class SMTPs // DOL_CHANGE LDR if ( $this->getDeliveryReceipt() ) - $_header .= 'Disposition-Notification-To: '.$this->getFrom('addr') . "\r\n"; + $_header .= 'Disposition-Notification-To: '.$this->getFrom('addr') . "\r\n"; if ( $this->getErrorsTo() ) - $_header .= 'Errors-To: '.$this->getErrorsTo('addr') . "\r\n"; + $_header .= 'Errors-To: '.$this->getErrorsTo('addr') . "\r\n"; if ( $this->getReplyTo() ) - $_header .= "Reply-To: ".$this->getReplyTo('addr') ."\r\n"; + $_header .= "Reply-To: ".$this->getReplyTo('addr') ."\r\n"; - $_header .= 'X-Mailer: Dolibarr version ' . DOL_VERSION .' (using SMTPs Mailer)' . "\r\n" - . 'Mime-Version: 1.0' . "\r\n"; + $_header .= 'X-Mailer: Dolibarr version ' . DOL_VERSION .' (using SMTPs Mailer)' . "\r\n"; + $_header .= 'Mime-Version: 1.0' . "\r\n"; + return $_header; } @@ -1258,7 +1283,9 @@ class SMTPs // Make RFC821 Compliant, replace bare linefeeds $strContent = preg_replace("/(?_msgContent[$strType] = array(); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 5d8377368ae..ff6459413a4 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -713,12 +713,12 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ''; // Address / Phone - print ''; // Email - print ''; + print ''; // Status print ''; + print ''; } // Edit @@ -1148,7 +1148,14 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= $facturestatic=new Facture($db); $out.=''; - $out.=''; + if ($objcon && get_class($objcon) == 'Contact' && get_class($filterobj) == 'Societe') + { + $out.=''; + } + else + { + $out.=''; + } if (get_class($filterobj) == 'Societe') $out.=''; $out.="\n"; @@ -1179,18 +1186,18 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= $out.=''; if ($donetodo) { - $out.=''; + $out.=''; } - $out.=''; - $out.=''; - $out.=''; - $out.=''; + $out.=''; + $out.=''; + $out.=''; - $out.=''; - $out.=''; - $out.=''; - $out.=''; + $out.=''; + $out.=''; + $out.=''; + $out.=''; // Action column $out.='rights->margins->creer) { if (! empty($conf->global->DISPLAY_MARGIN_RATES)) @@ -398,7 +404,7 @@ if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $da if (! empty($usemargins)) { - $colspan++; // For the buying price + if (!empty($user->rights->margins->creer)) $colspan++; // For the buying price if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; } diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index e684e3c2750..c89b8ce4589 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -45,6 +45,7 @@ if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; $colspan = 3; // Col total ht + col edit + col delete if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc if (in_array($object->element,array('propal','supplier_proposal','facture','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button +if (empty($user->rights->margins->creer)) $colspan++; ?> @@ -174,6 +175,7 @@ $coldisplay=-1; // We remove first td if (! empty($usemargins)) { ?> + rights->margins->creer)) { ?> + rights->margins->creer) { if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index d38a3d761e4..62d4b0007ed 100755 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -186,7 +186,10 @@ if (empty($usemargins)) $usemargins=0; { $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); ?> + + rights->margins->creer)) { ?> + global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) { ?> societe_id) $socid=$user->societe_id; // TODO Add rule to restrict access payment //$result = restrictedArea($user, 'facture', $id,''); -$payment = new PaymentDonation($db); +$object = new PaymentDonation($db); if ($id > 0) { - $result=$payment->fetch($id); + $result=$object->fetch($id); if (! $result) dol_print_error($db,'Failed to get payment id '.$id); } @@ -57,7 +57,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->don->supp { $db->begin(); - $result = $payment->delete($user); + $result = $object->delete($user); if ($result > 0) { $db->commit(); @@ -66,7 +66,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->don->supp } else { - setEventMessages($payment->error, $payment->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } } @@ -76,7 +76,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->don->cree { $db->begin(); - $result=$payment->valide(); + $result=$object->valide(); if ($result > 0) { @@ -99,12 +99,12 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->don->cree } } - header('Location: card.php?id='.$payment->id); + header('Location: card.php?id='.$object->id); exit; } else { - setEventMessages($payment->error, $payment->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } } @@ -133,7 +133,7 @@ dol_fiche_head($head, $hselected, $langs->trans("DonationPayment"), 0, 'payment' */ if ($action == 'delete') { - print $form->formconfirm('card.php?id='.$payment->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2); + print $form->formconfirm('card.php?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2); } @@ -142,46 +142,51 @@ if ($action == 'delete') */ if ($action == 'valide') { - $facid = $_GET['facid']; - print $form->formconfirm('card.php?id='.$payment->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2); + $facid = GETPOST('facid','int'); + print $form->formconfirm('card.php?id='.$object->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2); } +dol_banner_tab($object,'id','',1,'rowid','id'); + +print '
'; + print '
'.$langs->trans("UserTitle").''; diff --git a/htdocs/core/ajax/bankconciliate.php b/htdocs/core/ajax/bankconciliate.php index 826e6fe9ba4..3a8a3e30687 100644 --- a/htdocs/core/ajax/bankconciliate.php +++ b/htdocs/core/ajax/bankconciliate.php @@ -51,8 +51,8 @@ if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $ { // Increase date $al = new AccountLine($db); - $al->datev_next($_GET["rowid"]); - $al->fetch($_GET["rowid"]); + $al->datev_next(GETPOST('rowid','int')); + $al->fetch(GETPOST('rowid','int')); print ''.dol_print_date($db->jdate($al->datev),"day").''; @@ -63,8 +63,8 @@ if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $ { // Decrease date $al =new AccountLine($db); - $al->datev_previous($_GET["rowid"]); - $al->fetch($_GET["rowid"]); + $al->datev_previous(GETPOST('rowid','int')); + $al->fetch(GETPOST('rowid','int')); print ''.dol_print_date($db->jdate($al->datev),"day").''; diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 31ec3d6e6b5..027bedebb6e 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -54,6 +54,7 @@ class CMailFile var $deliveryreceipt; var $eol; + var $eol2; var $atleastonefile=0; var $error=''; @@ -103,7 +104,7 @@ class CMailFile * @param string $errors_to Email for errors-to * @param string $css Css option * @param string $trackid Tracking string - * @param string $moreinheader More in header (for phpmail only for the moment) + * @param string $moreinheader More in header. $moreinheader must contains the "\r\n" (TODO not supported for other MAIL_SEND_MODE different than 'phpmail' and 'smtps' for the moment) */ function __construct($subject,$to,$from,$msg,$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0,$errors_to='',$css='',$trackid='',$moreinheader='') { @@ -117,6 +118,7 @@ class CMailFile { $this->eol="\n"; $this->eol2="\n"; + $moreinheader = str_replace("\r\n","\n",$moreinheader); } // On defini mixed_boundary @@ -152,6 +154,8 @@ class CMailFile $this->msgishtml = $msgishtml; } + if (! empty($conf->global->MAIN_MAIL_FORCE_CONTENT_TYPE_TO_HTML)) $this->msgishtml=1; // To force to send everything with content type html. + // Detect images if ($this->msgishtml) { @@ -207,7 +211,7 @@ class CMailFile $this->deliveryreceipt = $deliveryreceipt; $this->trackid = $trackid; $smtp_headers = $this->write_smtpheaders(); - if (! empty($moreinheader)) $smtp_headers.=$moreinheader; + if (! empty($moreinheader)) $smtp_headers.=$moreinheader; // $moreinheader contains the \r\n // Define mime_headers $mime_headers = $this->write_mimeheaders($filename_list, $mimefilename_list); @@ -268,7 +272,8 @@ class CMailFile $smtps->setFrom($this->getValidAddress($from,0,1)); $smtps->setTrackId($trackid); $smtps->setReplyTo($this->getValidAddress($from,0,1)); // Set property with this->smtps->setReplyTo after constructor if you want to use another value than the From - + if (! empty($moreinheader)) $smtps->setMoreInHeader($moreinheader); + if (! empty($this->html)) { if (!empty($css)) @@ -322,7 +327,8 @@ class CMailFile $this->phpmailer->SetFrom($this->getValidAddress($from,0,1)); $this->phpmailer->SetReplyTo($this->getValidAddress($from,0,1)); // Set property with this->phpmailer->setReplyTo after constructor if you want to use another value than the From // TODO Add trackid into smtp header - + // TODO if (! empty($moreinheader)) ... + if (! empty($this->html)) { if (!empty($css)) @@ -375,7 +381,8 @@ class CMailFile $msgid = $headers->get('Message-ID'); $msgid->setId($headerID); $headers->addIdHeader('References', $headerID); - + // TODO if (! empty($moreinheader)) ... + // Give the message a subject $this->message->setSubject($this->encodetorfc2822($subject)); @@ -456,7 +463,7 @@ class CMailFile */ function sendfile() { - global $conf,$db; + global $conf,$db,$langs; $errorlevel=error_reporting(); error_reporting($errorlevel ^ E_WARNING); // Desactive warnings @@ -479,6 +486,30 @@ class CMailFile return $reshook; } + // Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL + if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL=10; + $tmparray = explode(',', $this->addr_to); + if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) + { + $this->error = 'Too much recipients in to:'; + dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); + return false; + } + $tmparray = explode(',', $this->addr_cc); + if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) + { + $this->error = 'Too much recipients in cc:'; + dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); + return false; + } + $tmparray = explode(',', $this->addr_bcc); + if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) + { + $this->error = 'Too much recipients in bcc:'; + dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); + return false; + } + // Action according to choosed sending method if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') { @@ -507,8 +538,6 @@ class CMailFile } else { - dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port'), LOG_DEBUG); - $bounce = ''; // By default if (! empty($conf->global->MAIN_MAIL_ALLOW_SENDMAIL_F)) { @@ -521,7 +550,8 @@ class CMailFile { $bounce .= ($bounce?' ':'').'-ba'; } - + dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port').", additionnal_parameters=".$bounce, LOG_DEBUG); + $this->message=stripslashes($this->message); if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail(); @@ -539,7 +569,8 @@ class CMailFile { $this->error.=" to HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port'); // This values are value used only for non linuxlike systems } - $this->error.=".
Check your server logs and your firewalls setup"; + $this->error.=".
"; + $this->error.=$langs->trans("ErrorPhpMailDelivery"); dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); } else @@ -942,8 +973,9 @@ class CMailFile $strContent = preg_replace("/\r\n/si", "\n", $strContent); } - //$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems bugged - $strContent = rtrim(wordwrap($strContent)); + // Make RFC2045 Compliant, split lines + //$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content + $strContent = rtrim(wordwrap($strContent)); // TODO Using this method creates unexpected line break on text/plain content. if ($this->msgishtml) { diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 6a6a32c15f9..75336e2a291 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -586,9 +586,10 @@ abstract class CommonDocGenerator { if (strlen($object->array_options['options_'.$key])>0) { - $object->array_options['options_'.$key] = dol_print_date($object->array_options['options_'.$key],'day'); // using company output language - $object->array_options['options_'.$key.'_locale'] = dol_print_date($object->array_options['options_'.$key],'day','tzserver',$outputlangs); // using output language format - $object->array_options['options_'.$key.'_rfc'] = dol_print_date($object->array_options['options_'.$key],'dayrfc'); // international format + $date = $object->array_options['options_'.$key]; + $object->array_options['options_'.$key] = dol_print_date($date,'day'); // using company output language + $object->array_options['options_'.$key.'_locale'] = dol_print_date($date,'day','tzserver',$outputlangs); // using output language format + $object->array_options['options_'.$key.'_rfc'] = dol_print_date($date,'dayrfc'); // international format } else { @@ -596,12 +597,17 @@ abstract class CommonDocGenerator $object->array_options['options_'.$key.'_locale'] = ''; $object->array_options['options_'.$key.'_rfc'] = ''; } + $array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale'])); + $array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc'])); } else if($extrafields->attribute_type[$key] == 'datetime') { - $object->array_options['options_'.$key] = ($object->array_options['options_'.$key]!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhour'):''); // using company output language - $object->array_options['options_'.$key.'_locale'] = ($object->array_options['options_'.$key]!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhour','tzserver',$outputlangs):''); // using output language format - $object->array_options['options_'.$key.'_rfc'] = ($object->array_options['options_'.$key]!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhourrfc'):''); // international format + $datetime = $object->array_options['options_'.$key]; + $object->array_options['options_'.$key] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhour'):''); // using company output language + $object->array_options['options_'.$key.'_locale'] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhour','tzserver',$outputlangs):''); // using output language format + $object->array_options['options_'.$key.'_rfc'] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhourrfc'):''); // international format + $array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale'])); + $array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc'])); } $array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key => $object->array_options['options_'.$key])); } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1afae6875ae..5e83f59ea36 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1307,7 +1307,7 @@ abstract class CommonObject $sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te"; if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && empty($user->rights->societe->client->voir))) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc"; - $sql.= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'"; + $sql.= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists) if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id; if (! empty($filter)) $sql.=" AND ".$filter; if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity @@ -1328,7 +1328,7 @@ abstract class CommonObject $sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te"; if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc"; - $sql.= " WHERE te.".$fieldid." > '".$this->db->escape($this->ref)."'"; + $sql.= " WHERE te.".$fieldid." > '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists) if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id; if (! empty($filter)) $sql.=" AND ".$filter; if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity @@ -3336,11 +3336,14 @@ abstract class CommonObject if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id)) { - if ($conf->global->MARGIN_TYPE == "1") - print '
'.$langs->trans('BuyingPrice').''.$langs->trans('CostPrice').''.$langs->trans('BuyingPrice').''.$langs->trans('CostPrice').''.$langs->trans('MarginRate').'
'; + print ''; //print ''; print '  '; @@ -729,7 +729,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { $colspan++; - print '  
'; + $out.=''; $out.=$formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1, 0, 0, 1); $out.=''; $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); diff --git a/htdocs/core/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php index 2cbf7b23bc2..c507e2e66ee 100644 --- a/htdocs/core/lib/contact.lib.php +++ b/htdocs/core/lib/contact.lib.php @@ -84,11 +84,23 @@ function contact_prepare_head(Contact $object) $head[$tab][2] = 'documents'; $tab++; - // Info + // Agenda / Events + $head[$tab][0] = DOL_URL_ROOT.'/contact/agenda.php?id='.$object->id; + $head[$tab][1].= $langs->trans("Events"); + if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) + { + $head[$tab][1].= '/'; + $head[$tab][1].= $langs->trans("Agenda"); + } + $head[$tab][2] = 'agenda'; + $tab++; + + // Log + /* $head[$tab][0] = DOL_URL_ROOT.'/contact/info.php?id='.$object->id; $head[$tab][1] = $langs->trans("Info"); $head[$tab][2] = 'info'; - $tab++; + $tab++;*/ complete_head_from_modules($conf,$langs,$object,$head,$tab,'contact','remove'); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 668c43808ea..9b37c9c29e3 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3636,7 +3636,7 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round= * @param float $vatrate Vat rate. Can be '8.5' or '8.5 (VATCODEX)' for example * @param int $local Local tax to search and return (1 or 2 return only tax rate 1 or tax rate 2) * @param Societe $thirdparty_buyer Object of buying third party - * @param Societe $thirdparty_seller Object of selling third party + * @param Societe $thirdparty_seller Object of selling third party ($mysoc if not defined) * @param int $vatnpr If vat rate is NPR or not * @return mixed 0 if not found, localtax rate if found * @see get_default_tva @@ -3695,18 +3695,15 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller if ($local == 1 && ! $thirdparty_seller->localtax1_assuj) return 0; if ($local == 2 && ! $thirdparty_seller->localtax2_assuj) return 0; } - //if ($local == 0 && ! $thirdparty_seller->localtax1_assuj && ! $thirdparty_seller->localtax2_assuj) return array('localtax1'=>0,'localtax2'=>0); - // Do not enabled this. We want localtax that match the vat rate. - // If we forced a vat, we must also force local tax - /* - if (is_object($thirdparty_buyer)) + // For some country MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY is forced to on. + if (in_array($mysoc->country_code, array('ES'))) { - if ($thirdparty_seller->country_code != $thirdparty_buyer->country_code) return 0; - }*/ - + $conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY = 1; + } + // Search local taxes - if ($mysoc->country_code == 'ES' || ! empty($conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY)) + if (! empty($conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY)) { if ($local==1) { diff --git a/htdocs/core/modules/import/modules_import.php b/htdocs/core/modules/import/modules_import.php index 11b81ecb820..20ce6ddc34d 100644 --- a/htdocs/core/modules/import/modules_import.php +++ b/htdocs/core/modules/import/modules_import.php @@ -30,26 +30,26 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; */ class ModeleImports { - var $db; - var $datatoimport; + public $db; + public $datatoimport; - var $error=''; + public $error=''; - var $id; // Id of driver - var $label; // Label of driver - var $extension; // Extension of files imported by driver - var $version; // Version of driver + public $id; // Id of driver + public $label; // Label of driver + public $extension; // Extension of files imported by driver + public $version; // Version of driver - var $label_lib; // Label of external lib used by driver - var $version_lib; // Version of external lib used by driver + public $label_lib; // Label of external lib used by driver + public $version_lib; // Version of external lib used by driver // Array of all drivers - var $_driverlabel=array(); - var $_driverdesc=array(); - var $_driverversion=array(); + public $_driverlabel=array(); + public $_driverdesc=array(); + public $_driverversion=array(); - var $_liblabel=array(); - var $_libversion=array(); + public $_liblabel=array(); + public $_libversion=array(); /** diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 47e6fb43d5c..a0c2a6e9de4 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -82,7 +82,7 @@ class modAgenda extends DolibarrModules { while ($obj = $this->db->fetch_object($sqlreadactions)) { - if (preg_match('/_CREATE$/',$obj->code) && ($obj->code != 'COMPANY_CREATE')) continue; // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty creation because there is no validation). + if (preg_match('/_CREATE$/',$obj->code) && (! in_array($obj->code, array('COMPANY_CREATE','PRODUCT_CREATE')))) continue; // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty or product creation because there is no validation). if (preg_match('/^PROJECT_/',$obj->code)) continue; // We don't track such events by default. if (preg_match('/^TASK_/',$obj->code)) continue; // We don't track such events by default. $this->const[] = array('MAIN_AGENDA_ACTIONAUTO_'.$obj->code, "chaine", "1"); diff --git a/htdocs/core/modules/modExpenseReport.class.php b/htdocs/core/modules/modExpenseReport.class.php index ad82cb21a89..1507d236698 100644 --- a/htdocs/core/modules/modExpenseReport.class.php +++ b/htdocs/core/modules/modExpenseReport.class.php @@ -86,6 +86,20 @@ class modExpenseReport extends DolibarrModules $this->const[$r][4] = 0; $r++; + $this->const[$r][0] = "MAIN_DELAY_EXPENSEREPORTS"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "15"; + $this->const[$r][3] = 'Tolerance delay (in days) before alert for expense reports to approve'; + $this->const[$r][4] = 0; + $r++; + + $this->const[$r][0] = "MAIN_DELAY_EXPENSEREPORTS_TO_PAY"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "15"; + $this->const[$r][3] = 'Tolerance delay (in days) before alert for expense reports to pay'; + $this->const[$r][4] = 0; + $r++; + // Array to add new pages in new tabs $this->tabs = array(); diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index 3edb3fa4fdc..8bdc35efd4f 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -219,17 +219,16 @@ class modProjet extends DolibarrModules $this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label', 's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text', - 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.description'=>"Text", + 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.title'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.description'=>"Text", 'pt.rowid'=>'Text','pt.label'=>'Text','pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Numeric",'pt.progress'=>"Numeric",'pt.description'=>"Text", 'ptt.rowid'=>'Numeric','ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text"); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company', - 's.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company', - 'p.rowid'=>"project",'p.ref'=>"project",'p.datec'=>"project",'p.dateo'=>"project",'p.datee'=>"project",'p.duree'=>"project",'p.fk_statut'=>"project",'cls.code'=>"project",'p.opp_percent'=>'project','p.description'=>"project"); + 's.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company'); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country', 's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode', - 'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.description'=>"Description"); + 'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.title'=>'ProjectLabel', 'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.description'=>"Description"); // Add fields for project $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array()); diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index 5642300bd6c..9936a495ceb 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -300,7 +300,7 @@ print $langs->trans("NewHeight").': '; print ''; print ''; -print ''; +print ''; print ''; print '
'; print ''; diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 3a00ca2c060..3f8006c286b 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -59,12 +59,12 @@ $userstatic=new User($db); if ($permission) { ?> -
trans("Nature"); ?>
-
trans("ThirdParty"); ?>
-
trans("Users").'/'.$langs->trans("Contacts"); ?>
-
trans("ContactType"); ?>
-
 
-
 
+
trans("Nature"); ?>
+
trans("ThirdParty"); ?>
+
trans("Users").'/'.$langs->trans("Contacts"); ?>
+
trans("ContactType"); ?>
+
 
+
 
-
trans("Nature"); ?>
-
trans("ThirdParty"); ?>
-
trans("Users").'/'.$langs->trans("Contacts"); ?>
-
trans("ContactType"); ?>
-
trans("Status"); ?>
-
 
+
trans("Nature"); ?>
+
trans("ThirdParty"); ?>
+
trans("Users").'/'.$langs->trans("Contacts"); ?>
+
trans("ContactType"); ?>
+
trans("Status"); ?>
+
 
diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 30027560140..c7ebe5b7b8b 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -88,9 +88,13 @@ if ($nolinesbefore) { } if (! empty($usemargins)) { + if (!empty($user->rights->margins->creer)) { ?>
global->MARGIN_TYPE == "1") echo $langs->trans('BuyingPrice'); else @@ -289,6 +293,7 @@ else { } if (! empty($usemargins)) { + if (!empty($user->rights->margins->creer)) { ?> @@ -299,8 +304,9 @@ else { "> product->enabled) || ! empty($conf->service->enabled)) { ?> @@ -182,6 +184,7 @@ $coldisplay=-1; // We remove first td pa_ht); ?> pa_ht == 0)?'n/a':price($line->marge_tx, null, null, null, null, $rounding).'%'); ?>
'; // Ref -print ''; +/*print ''; +*/ // Date -print ''; +print ''; // Mode -print ''; +print ''; // Number -print ''; +print ''; // Amount -print ''; +print ''; // Note -print ''; +print ''; // Bank account if (! empty($conf->banque->enabled)) { - if ($payment->bank_account) + if ($object->bank_account) { $bankline=new AccountLine($db); - $bankline->fetch($payment->bank_line); + $bankline->fetch($object->bank_line); print ''; print ''; - print ''; print ''; @@ -269,7 +274,7 @@ print '
'; /* if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { - if ($user->societe_id == 0 && $payment->statut == 0 && $_GET['action'] == '') + if ($user->societe_id == 0 && $object->statut == 0 && $_GET['action'] == '') { if ($user->rights->facture->paiement) { diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index a2f8e54bf6b..ea75f7eeab6 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1617,17 +1617,17 @@ else // Validation date print '
'; print ''; - print ''; print ''; - // User to inform + // User to inform for approval if ($object->fk_statut < 3) // informed { print ''; - print ''; + print ''; // approver print '
'.$langs->trans('Ref').'
'; -print $form->showrefnav($payment,'id','',1,'rowid','id'); +print $form->showrefnav($object,'id','',1,'rowid','id'); print '
'.$langs->trans('Date').''.dol_print_date($payment->datep,'day').'
'.$langs->trans('Date').''.dol_print_date($object->datep,'day').'
'.$langs->trans('Mode').''.$langs->trans("PaymentType".$payment->type_code).'
'.$langs->trans('Mode').''.$langs->trans("PaymentType".$object->type_code).'
'.$langs->trans('Number').''.$payment->num_payment.'
'.$langs->trans('Number').''.$object->num_payment.'
'.$langs->trans('Amount').''.price($payment->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'
'.$langs->trans('Amount').''.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'
'.$langs->trans('Note').''.nl2br($payment->note).'
'.$langs->trans('Note').''.nl2br($object->note).'
'.$langs->trans('BankTransactionLine').''; + print ''; print $bankline->getNomUrl(1,0,'showall'); print '
'.$langs->trans("DATE_SAVE").''.dol_print_date($object->date_create,'dayhour'); + print ''.dol_print_date($object->date_valid,'dayhour'); if ($object->status == 2 && $object->hasDelay('toapprove')) print ' '.img_warning($langs->trans("Late")); if ($object->status == 5 && $object->hasDelay('topay')) print ' '.img_warning($langs->trans("Late")); print '
'.$langs->trans("VALIDATOR").''.$langs->trans("VALIDATOR").''; if ($object->fk_user_validator > 0) { diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 0e2fe371fd8..631d1ca548b 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -984,7 +984,6 @@ class ExpenseReport extends CommonObject } } } - if ($this->fk_statut != 2) { $now = dol_now(); @@ -995,7 +994,7 @@ class ExpenseReport extends CommonObject $sql.= ", ref_number_int = ".$ref_number_int; } $sql.= ' WHERE rowid = '.$this->id; - + $resql=$this->db->query($sql); if ($resql) { @@ -1706,13 +1705,13 @@ class ExpenseReport extends CommonObject if ($option == 'toapprove') { - if ($this->db->jdate($obj->datevalid) < ($now - $conf->expensereport->approve->warning_delay)) { + if ($this->db->jdate($obj->date_valid) < ($now - $conf->expensereport->approve->warning_delay)) { $response->nbtodolate++; } } else { - if ($this->db->jdate($obj->datevalid) < ($now - $conf->expensereport->payment->warning_delay)) { + if ($this->db->jdate($obj->date_valid) < ($now - $conf->expensereport->payment->warning_delay)) { $response->nbtodolate++; } } @@ -1743,11 +1742,12 @@ class ExpenseReport extends CommonObject if ($option == 'topay' && $this->status != 5) return false; $now = dol_now(); - if ($option == 'toapprove') - return $this->datevalid < ($now - $conf->expensereport->approve->warning_delay); + { + return ($this->datevalid?$this->datevalid:$this->date_valid) < ($now - $conf->expensereport->approve->warning_delay); + } else - return $this->datevalid < ($now - $conf->expensereport->payment->warning_delay); + return ($this->datevalid?$this->datevalid:$this->date_valid) < ($now - $conf->expensereport->payment->warning_delay); } } diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 935faab9983..ce682273b6e 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -49,16 +49,19 @@ $result = restrictedArea($user, 'expensereport','',''); $diroutputmassaction=$conf->expensereport->dir_output . '/temp/massgeneration/'.$user->id; + +// Load variable for pagination $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; -$sortfield = GETPOST("sortfield",'alpha'); -$sortorder = GETPOST("sortorder",'alpha'); -$page = GETPOST("page",'int'); +$sortfield = GETPOST('sortfield','alpha'); +$sortorder = GETPOST('sortorder','alpha'); +$page = GETPOST('page','int'); if ($page == -1) { $page = 0; } $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortfield) $sortfield='c.ref'; -if (! $sortorder) $sortorder='DESC'; +if (!$sortorder) $sortorder="DESC"; +if (!$sortfield) $sortfield="d.date_debut"; + $sall = GETPOST('sall'); $search_ref = GETPOST('search_ref'); @@ -103,6 +106,8 @@ $arrayfields=array( 'user'=>array('label'=>$langs->trans("User"), 'checked'=>1), 'd.date_debut'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1), 'd.date_fin'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1), + 'd.date_valid'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1), + 'd.date_approve'=>array('label'=>$langs->trans("DateApprove"), 'checked'=>1), 'd.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), 'd.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>1), 'd.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>1), @@ -176,23 +181,9 @@ llxHeader('', $langs->trans("ListOfTrips")); $max_year = 5; $min_year = 5; -$sortorder = GETPOST("sortorder"); -$sortfield = GETPOST("sortfield"); -$page = GETPOST("page"); -if (!$sortorder) $sortorder="DESC"; -if (!$sortfield) $sortfield="d.date_debut"; -$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; - -if ($page == -1) { - $page = 0 ; -} - -$offset = $limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; $sql = "SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.total_ttc, d.fk_statut as status,"; -$sql.= " d.date_debut, d.date_fin, d.date_valid, d.date_create, d.tms as date_modif,"; +$sql.= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve,"; $sql.= " u.rowid as id_user, u.firstname, u.lastname, u.login, u.statut, u.photo"; // Add fields from extrafields foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); @@ -355,13 +346,15 @@ if ($resql) print '
'; print ''."\n"; print ""; - if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.ref","",$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['user']['checked'])) print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"u.lastname","",$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['d.date_debut']['checked'])) print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"d.date_debut","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['d.date_fin']['checked'])) print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"d.date_fin","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['d.total_ht']['checked'])) print_liste_field_titre($langs->trans("TotalHT"),$_SERVER["PHP_SELF"],"d.total_ht","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['d.total_vat']['checked'])) print_liste_field_titre($langs->trans("TotalVAT"),$_SERVER["PHP_SELF"],"d.total_tva","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['d.total_ttc']['checked'])) print_liste_field_titre($langs->trans("TotalTTC"),$_SERVER["PHP_SELF"],"d.total_ttc","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'],$_SERVER["PHP_SELF"],"d.ref","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['user']['checked'])) print_liste_field_titre($arrayfields['user']['label'],$_SERVER["PHP_SELF"],"u.lastname","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['d.date_debut']['checked'])) print_liste_field_titre($arrayfields['d.date_debut']['label'],$_SERVER["PHP_SELF"],"d.date_debut","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['d.date_fin']['checked'])) print_liste_field_titre($arrayfields['d.date_fin']['label'],$_SERVER["PHP_SELF"],"d.date_fin","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['d.date_valid']['checked'])) print_liste_field_titre($arrayfields['d.date_valid']['label'],$_SERVER["PHP_SELF"],"d.date_valid","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['d.date_approve']['checked'])) print_liste_field_titre($arrayfields['d.date_approve']['label'],$_SERVER["PHP_SELF"],"d.date_approve","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['d.total_ht']['checked'])) print_liste_field_titre($arrayfields['d.total_ht']['label'],$_SERVER["PHP_SELF"],"d.total_ht","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['d.total_vat']['checked'])) print_liste_field_titre($arrayfields['d.total_vat']['label'],$_SERVER["PHP_SELF"],"d.total_tva","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['d.total_ttc']['checked'])) print_liste_field_titre($arrayfields['d.total_ttc']['label'],$_SERVER["PHP_SELF"],"d.total_ttc","",$param,'align="right"',$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -420,7 +413,23 @@ if ($resql) $formother->select_year($year_end,'year_end',1, $min_year, $max_year); print ''; } - // Amount with no tax + // Date valid + if (! empty($arrayfields['d.date_valid']['checked'])) + { + print ''; + } + // Date approve + if (! empty($arrayfields['d.date_approve']['checked'])) + { + print ''; + } + // Amount with no tax if (! empty($arrayfields['d.total_ht']['checked'])) { print ''; @@ -509,12 +518,13 @@ if ($resql) $expensereportstatic->id=$obj->rowid; $expensereportstatic->ref=$obj->ref; $expensereportstatic->status=$obj->status; - $expensereportstatic->valid=$obj->date_valid; - $expensereportstatic->date_debut=$obj->date_debut; - $expensereportstatic->date_fin=$obj->date_fin; - $expensereportstatic->date_create=$obj->date_create; - $expensereportstatic->date_modif=$obj->date_modif; - + $expensereportstatic->date_debut=$db->jdate($obj->date_debut); + $expensereportstatic->date_fin=$db->jdate($obj->date_fin); + $expensereportstatic->date_create=$db->jdate($obj->date_create); + $expensereportstatic->date_modif=$db->jdate($obj->date_modif); + $expensereportstatic->date_valid=$db->jdate($obj->date_valid); + $expensereportstatic->date_approve=$db->jdate($obj->date_approve); + $var=!$var; print ""; if (! empty($arrayfields['d.ref']['checked'])) { @@ -545,7 +555,15 @@ if ($resql) print ''; if (! $i) $totalarray['nbfield']++; } - // Amount HT + if (! empty($arrayfields['d.date_valid']['checked'])) { + print ''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['d.date_approve']['checked'])) { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Amount HT if (! empty($arrayfields['d.total_ht']['checked'])) { print '\n"; diff --git a/htdocs/expensereport/stats/index.php b/htdocs/expensereport/stats/index.php index 675d800145b..b92405424c6 100644 --- a/htdocs/expensereport/stats/index.php +++ b/htdocs/expensereport/stats/index.php @@ -196,7 +196,7 @@ if (! count($arrayyears)) $arrayyears[$nowyear]=$nowyear; $h=0; $head = array(); -$head[$h][0] = DOL_URL_ROOT . '/compta/expensereport/stats/index.php'; +$head[$h][0] = DOL_URL_ROOT . '/expensereport/stats/index.php'; $head[$h][1] = $langs->trans("ByMonthYear"); $head[$h][2] = 'byyear'; $h++; diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 51f3a70a409..cd0c3fc1598 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -175,25 +175,41 @@ else print '
'; print '
'; + //print ''; + //$formother->select_year($year_end,'year_end',1, $min_year, $max_year); + print ''; + //print ''; + //$formother->select_year($year_end,'year_end',1, $min_year, $max_year); + print '
'.($obj->date_fin > 0 ? dol_print_date($obj->date_fin, 'day') : '').''.($obj->date_valid > 0 ? dol_print_date($obj->date_valid, 'day') : '').''.($obj->date_approve > 0 ? dol_print_date($obj->date_approve, 'day') : '').''.price($obj->total_ht)."
'."\n"; - print ""; - print ''; + print ''; + print_liste_field_titre($langs->trans('Employee'), $_SERVER["PHP_SELF"]); if (count($typeleaves)) { foreach($typeleaves as $key => $val) { - print ''; + print ''; } } else { - print ''; + print ''; } - print ''; + print ''; + print_liste_field_titre(''); print ''; - + print ''; + print ''; + if (count($typeleaves)) + { + foreach($typeleaves as $key => $val) + { + print ''; + } + } + else + { + print ''; + } + print ''; + print ''; + print ''; + foreach($listUsers as $users) { $var=!$var; @@ -204,7 +220,7 @@ else if (($users['rowid'] != $user->id) && (! in_array($users['rowid'], $userchilds))) continue; // This user is not into hierarchy of current user, we hide it. } - print ''; + print ''; print '
'.$langs->trans('Employee').'
'.$val['label'].''.$val['label'].''.$langs->trans("NoLeaveWithCounterDefined").''.$langs->trans("NoLeaveWithCounterDefined").''; + print ''; if ($canedit) print $langs->trans('Note'); - print ''; - print '
'; $userstatic->id=$users['rowid']; $userstatic->lastname=$users['lastname']; diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index a04ef05c69b..51d3e2d0be3 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -78,17 +78,28 @@ print ''; print ''; - -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - +print_liste_field_titre($langs->trans('ID')); +print_liste_field_titre($langs->trans('Date'), $_SERVER["PHP_SELF"], '', '', '', 'align="center"'); +print_liste_field_titre($langs->trans('ActionByCP')); +print_liste_field_titre($langs->trans('UserUpdateCP')); +print_liste_field_titre($langs->trans('Description')); +print_liste_field_titre($langs->trans('Type')); +print_liste_field_titre($langs->trans('PrevSoldeCP'), $_SERVER["PHP_SELF"], '', '', '', 'align="right"'); +print_liste_field_titre($langs->trans('NewSoldeCP'), $_SERVER["PHP_SELF"], '', '', '', 'align="right"'); print ''; + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + + $var=true; foreach($cp->logs as $logs_CP) diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index b9b4f46d05e..2558c72feca 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -384,11 +384,11 @@ function pHeader($subtitle,$next,$action='set',$param='',$forcejqueryurl='') // We force the content charset header("Content-type: text/html; charset=".$conf->file->character_set_client); - print ''."\n"; + print ''."\n"; print ''."\n"; print ''."\n"; - print ''."\n"; - print ''."\n"; + print ''."\n"; + print ''."\n"; print ''."\n"; print ''."\n"; diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index c01e8d5ae20..d0a66a9ab67 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -33,6 +33,7 @@ -- List of all managed triggered events (used for trigger agenda automatic events and for notification) -- delete from llx_c_action_trigger; +-- actions enabled by default (constant created for that) when we enable module agenda insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('COMPANY_CREATE','Third party created','Executed when a third party is created','societe',1); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('COMPANY_SENTBYMAIL','Mails sent from third party card','Executed when you send email from third party card','societe',1); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_VALIDATE','Customer proposal validated','Executed when a commercial proposal is validated','propal',2); @@ -79,6 +80,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_CREATE','Product or service created','Executed when a product or sevice is created','product',30); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',30); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_DELETE','Product or service deleted','Executed when a product or sevice is deleted','product',30); +-- actions not enabled by default (no constant created for that) when we enable module agenda insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_CREATE','Project creation','Executed when a project is created','project',140); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_MODIFY','Project modified','Executed when a project is modified','project',141); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_DELETE','Project deleted','Executed when a project is deleted','project',142); diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 1ccb3d5e458..e872c1710cc 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -178,6 +178,7 @@ ErrorFailedToLoadLoginFileForMode=Failed to get the login file for mode '%s'. ErrorModuleNotFound=File of module was not found. ErrorFieldAccountNotDefinedForBankLine=Value for Accounting account not defined for source bank line %s ErrorBankStatementNameMustFollowRegex=Error, bank statement name must follow the following syntax rule %s +ErrorPhpMailDelivery=Check that you don't use a too high number of recipients and that your email content is not similar to a Spam. Ask also your administrator to check firewall and server logs files for a more complete information. # Warnings WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index b9677805dcd..9e0f3a987fb 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -89,7 +89,7 @@ SearchAMailing=Search mailing SendMailing=Send emailing SendMail=Send email SentBy=Sent by -MailingNeedCommand=For security reason, sending an emailing must be performed from command line. Ask your server administrator to launch the following command to send the emailing to all recipients: +MailingNeedCommand=Sending an emailing can be performed from command line. Ask your server administrator to launch the following command to send the emailing to all recipients: MailingNeedCommand2=You can however send them online by adding parameter MAILING_LIMIT_SENDBYWEB with value of max number of emails you want to send by session. For this, go on Home - Setup - Other. ConfirmSendingEmailing=If you want to send emailing directly from this screen, please confirm you are sure you want to send emailing now from your browser ? LimitSendingEmailing=Note: Sending of emailings from web interface is done in several times for security and timeout reasons, %s recipients at a time for each sending session. diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index e07ef156124..b6a5d904c34 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1003,10 +1003,10 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs if (empty($conf->css)) $conf->css = '/theme/eldy/style.css.php'; // If not defined, eldy by default - if (empty($conf->global->MAIN_ACTIVATE_HTML5)) { + if (! empty($conf->global->MAIN_ACTIVATE_HTML4)) { $doctype = ''; }else { - $doctype = ''; // Html5 - Developement - Only available on Eldy template + $doctype = ''; } print $doctype."\n"; if (! empty($conf->global->MAIN_USE_CACHE_MANIFEST)) print ''."\n"; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 51c3375677a..d3c3784c00c 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -286,10 +286,17 @@ if (empty($reshook)) { $obj = $db->fetch_object($resql); $npr = $obj->recuperableonly; - $localtax1 = get_localtax($tva_tx,1); - $localtax2 = get_localtax($tva_tx,2); + $localtax1 = $obj->localtax1; + $localtax2 = $obj->localtax2; $localtax1_type = $obj->localtax1_type; $localtax2_type = $obj->localtax2_type; + + // If spain, we don't use the localtax found into tax record in database with same code, but using the get_localtax rule + if (in_array($mysoc->country_code, array('ES'))) + { + $localtax1 = get_localtax($tva_tx,1); + $localtax2 = get_localtax($tva_tx,2); + } } } $pricestoupdate[0] = array( diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 2da7a6e5227..710807dcdec 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -640,9 +640,14 @@ foreach ($listofreferent as $key => $value) $addform=''; $idtofilterthirdparty=0; - if (! in_array($tablename, array('facture_fourn', 'commande_fournisseur'))) $idtofilterthirdparty=$object->thirdparty->id; + $array_of_element_linkable_with_different_thirdparty = array('facture_fourn', 'commande_fournisseur'); + if (! in_array($tablename, $array_of_element_linkable_with_different_thirdparty)) + { + $idtofilterthirdparty=$object->thirdparty->id; + if (! empty($conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS)) $idtofilterthirdparty.=','.$conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS; + } - if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty > 0) + if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty) { $selectList=$formproject->select_element($tablename, $idtofilterthirdparty, 'minwidth300'); if (! $selectList || ($selectList<0)) diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index f4c8f5c6dbc..25eb78cfe24 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -73,11 +73,21 @@ $parameters=array('id'=>$socid); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -// Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +if (empty($reshook)) { - $actioncode=''; - $search_agenda_label=''; + // Cancel + if (GETPOST("cancel") && ! empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } + + // Purge search criteria + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers + { + $actioncode=''; + $search_agenda_label=''; + } } @@ -90,7 +100,7 @@ $contactstatic = new Contact($db); $form = new Form($db); -if ($socid) +if ($socid > 0) { require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 1d249ad627d..53e7bf8ad34 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Marcos García + * Copyright (C) 2016 Ferran Marcet * * 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 @@ -1632,24 +1633,11 @@ class SupplierProposal extends CommonObject $trigger_name='SUPPLIER_PROPOSAL_CLOSE_SIGNED'; $modelpdf=$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL?$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL:$this->modelpdf; - // The connected company is classified as a client - $soc=new Societe($this->db); - $soc->id = $this->socid; - $result=$soc->set_as_client(); - - if ($result < 0) + if (! empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) // TODO This option was not tested correctly. Error if product ref does not exists { - $this->error=$this->db->error(); - $this->db->rollback(); - return -2; + $result = $this->updateOrCreatePriceFournisseur($user); } - else - { - if (! empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) // TODO This option was not tested correctly. Error if product ref does not exists - { - $result = $this->updateOrCreatePriceFournisseur($user); - } - } + } if ($statut == 4) { diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 73015308521..c5d9dd13189 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -867,12 +867,12 @@ div.fichecenterbis { div.fichethirdleft { browser->layout != 'phone') { print "float: ".$left.";\n"; } ?> browser->layout != 'phone') { print "width: 50%;\n"; } ?> - browser->layout == 'phone') { print "padding-bottom: 6px;\n"; } ?> + browser->layout == 'phone') { print "padding-bottom: 6px;\n"; } ?> } div.fichetwothirdright { browser->layout != 'phone') { print "float: ".$right.";\n"; } ?> browser->layout != 'phone') { print "width: 50%;\n"; } ?> - browser->layout == 'phone') { print "padding-bottom: 6px\n"; } ?> + browser->layout == 'phone') { print "padding-bottom: 6px\n"; } ?> } div.fichehalfleft { browser->layout != 'phone') { print "float: ".$left.";\n"; } ?> @@ -4451,7 +4451,7 @@ border-top-right-radius: 6px; color: #fff; text-decoration: none; padding-top: 18px; - padding-left: 54px; + : 54px; font-size: 14px; height: 38px; }
'.$langs->trans('ID').''.$langs->trans('Date').''.$langs->trans('ActionByCP').''.$langs->trans('UserUpdateCP').''.$langs->trans('Description').''.$langs->trans('Type').''.$langs->trans('PrevSoldeCP').''.$langs->trans('NewSoldeCP').'