diff --git a/build/debian/conf.php.install b/build/debian/conf.php.install index c27d9e0985b..3fe41b98086 100644 --- a/build/debian/conf.php.install +++ b/build/debian/conf.php.install @@ -221,7 +221,13 @@ $dolibarr_main_prod='0'; # $dolibarr_main_limit_users='0'; # dolibarr_mailing_limit_sendbyweb -# Can set a limit for mailing send by web, can be used for a restricted mode. +# Can set a limit for mailing send by web. This overwrite database value. Can be used to restrict on OS level. # Default value: 0 (use database value if exist) # Examples: # $dolibarr_mailing_limit_sendbyweb='0'; + +# dolibarr_mailing_limit_sendbycli +# Can set a limit for mailing send by cli. This overwrite database value. Can be used to restrict on OS level. +# Default value: 0 (use database value if exist) +# Examples: +# $dolibarr_mailing_limit_sendbycli='0'; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index ddbc7123d70..8c6f7687263 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -822,7 +822,7 @@ else // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">'; + print ''.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">'; } // Type @@ -1066,7 +1066,7 @@ else // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">'; + print ''.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">'; } // Morphy @@ -1090,7 +1090,7 @@ else print ""; // Company - print ''.$langs->trans("Company").'societe).'">'; + print ''.$langs->trans("Company").'societe).'">'; // Civility print ''.$langs->trans("UserTitle").''; @@ -1099,11 +1099,11 @@ else print ''; // Lastname - print ''.$langs->trans("Lastname").'lastname).'">'; + print ''.$langs->trans("Lastname").'lastname).'">'; print ''; // Firstname - print ''.$langs->trans("Firstname").'firstname).'">'; + print ''.$langs->trans("Firstname").'firstname).'">'; print ''; // Photo @@ -1122,24 +1122,24 @@ else print ''; // EMail - print ''.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').'email).'">'; + print ''.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').'email).'">'; // Password if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''.$langs->trans("Password").'pass).'">'; + print ''.$langs->trans("Password").'pass).'">'; } // Address print ''.$langs->trans("Address").''; - print ''; + print ''; print ''; // Zip / Town print ''.$langs->trans("Zip").' / '.$langs->trans("Town").''; - 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["zipcode"])?GETPOST("zipcode",'',2):$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6); print ' '; - print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id')); + print $formcompany->select_ziptown((isset($_POST["town"])?GETPOST("town",'',2):$object->town),'town',array('zipcode','selectcountry_id','state_id')); print ''; // Country @@ -1153,23 +1153,23 @@ else if (empty($conf->global->MEMBER_DISABLE_STATE)) { print ''.$langs->trans('State').''; - print $formcompany->select_state($object->state_id,isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id); + print $formcompany->select_state($object->state_id,isset($_POST["country_id"])?GETPOST("country_id"):$object->country_id); print ''; } // Pro phone - print ''.$langs->trans("PhonePro").'phone).'">'; + print ''.$langs->trans("PhonePro").'phone).'">'; // Personal phone - print ''.$langs->trans("PhonePerso").'phone_perso).'">'; + 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)) { - print ''.$langs->trans("Skype").'skype).'">'; + print ''.$langs->trans("Skype").'skype).'">'; } // Birthday @@ -1179,7 +1179,7 @@ else // Public profil print "".$langs->trans("Public")."\n"; - print $form->selectyesno("public",(isset($_POST["public"])?$_POST["public"]:$object->public),1); + print $form->selectyesno("public",(isset($_POST["public"])?GETPOST("public",'',2):$object->public),1); print "\n"; // Categories diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index bc2234e9d5c..547265098be 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -32,7 +32,8 @@ class Subscription extends CommonObject { public $element='subscription'; public $table_element='subscription'; - + public $picto='payment'; + var $datec; // Date creation var $datem; // Date modification var $dateh; // Subscription start date (date subscription) @@ -277,6 +278,31 @@ class Subscription extends CommonObject } + /** + * Retourne le libelle du statut d'une adhesion + * + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label + */ + function getLibStatut($mode=0) + { + return ''; + } + + /** + * Renvoi le libelle d'un statut donne + * + * @param int $statut Id statut + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label + */ + function LibStatut($statut) + { + global $langs; + $langs->load("members"); + return ''; + } + /** * Load information of the subscription object * diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index e70f737d126..d15bdd30fd9 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -792,7 +792,7 @@ if ($rowid > 0) $sql.= " c.datef,"; $sql.= " c.fk_bank,"; $sql.= " b.rowid as bid,"; - $sql.= " ba.rowid as baid, ba.label, ba.bank"; + $sql.= " ba.rowid as baid, ba.label, ba.bank, ba.ref, ba.account_number, ba.accountancy_journal, ba.number"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; @@ -807,7 +807,7 @@ if ($rowid > 0) $num = $db->num_rows($result); $i = 0; - print "\n"; + print '
'."\n"; print ''; print ''; @@ -841,6 +841,10 @@ if ($rowid > 0) { $accountstatic->label=$objp->label; $accountstatic->id=$objp->baid; + $accountstatic->number=$objp->number; + $accountstatic->account_number=$objp->account_number; + $accountstatic->accountancy_journal=$objp->accountancy_journal; + $accountstatic->ref=$objp->ref; print $accountstatic->getNomUrl(1); } else diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index ce3baee712b..c8f68d2151c 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -40,6 +40,7 @@ $action=GETPOST("action",'alpha'); $rowid=GETPOST("rowid","int")?GETPOST("rowid","int"):GETPOST("id","int"); $typeid=GETPOST("typeid","int"); $cancel=GETPOST('cancel'); +$confirm=GETPOST('confirm'); if (! $user->rights->adherent->cotisation->lire) accessforbidden(); @@ -62,10 +63,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once -if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'update' && ! $_POST["cancel"]) +if ($user->rights->adherent->cotisation->creer && $action == 'update' && ! $cancel) { // Charge objet actuel - $result=$object->fetch($_POST["rowid"]); + $result=$object->fetch($rowid); if ($result > 0) { $db->begin(); @@ -138,7 +139,7 @@ if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'update } } -if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->adherent->cotisation->creer) +if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->adherent->cotisation->creer) { $result=$object->fetch($rowid); $result=$object->delete($user); @@ -189,11 +190,11 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment'); - print "\n"; - print '
'.$langs->trans("Ref").'
'; - $linkback = ''.$langs->trans("BackToList").''; + print "\n"; + print '
'; + // Ref print ''; print ''; } elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) { - print ''; + print ''; } elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { - print ''; + print ''; } elseif ($fieldlist[$field]=='unit') { print '
'.$langs->trans("Ref").''; @@ -287,49 +288,50 @@ if ($rowid && $action != 'edit') print '
'; print ''; - print ''; $linkback = ''.$langs->trans("BackToList").''; - // Ref - print ''; - print ''; - + dol_banner_tab($object, 'rowid', $linkback, 1); + + print '
'; + + print '
'; + + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'rowid', $linkback, 1); - print '
'; + // Member $adh->ref=$adh->getFullName($langs); print ''; - print ''; + print ''; print ''; // Date record /*print ''; - print ''; + print ''; print '';*/ // Date subscription print ''; - print ''; + print ''; print ''; // Date end subscription print ''; - print ''; + print ''; print ''; // Amount - print ''; + print ''; // Amount - print ''; + print ''; // Bank line if (! empty($conf->banque->enabled)) { if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank) { - print '
'.$langs->trans("Member").''.$adh->getNomUrl(1,0,'subscription').''.$langs->trans("Member").''.$adh->getNomUrl(1,0,'subscription').'
'.$langs->trans("DateSubscription").''.dol_print_date($object->datec,'dayhour').''.$langs->trans("DateSubscription").''.dol_print_date($object->datec,'dayhour').'
'.$langs->trans("DateSubscription").''.dol_print_date($object->dateh,'day').''.$langs->trans("DateSubscription").''.dol_print_date($object->dateh,'day').'
'.$langs->trans("DateEndSubscription").''.dol_print_date($object->datef,'day').''.$langs->trans("DateEndSubscription").''.dol_print_date($object->datef,'day').'
'.$langs->trans("Amount").''.price($object->amount).'
'.$langs->trans("Amount").''.price($object->amount).'
'.$langs->trans("Label").''.$object->note.'
'.$langs->trans("Label").''.$object->note.'
'.$langs->trans("BankTransactionLine").''; + print '
'.$langs->trans("BankTransactionLine").''; if ($object->fk_bank) { $bankline=new AccountLine($db); @@ -346,6 +348,8 @@ if ($rowid && $action != 'edit') print "
\n"; + print ''; + print '
'; dol_fiche_end(); diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 25616ffd1fc..0cd4886f8c9 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1786,10 +1786,10 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') print '
'; @@ -1829,8 +1829,8 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') { print ''; $size=''; $class=''; - if ($fieldlist[$field]=='code') $size='size="8" '; - if ($fieldlist[$field]=='position') $size='size="4" '; + if ($fieldlist[$field]=='code') $class='maxwidth100'; + if ($fieldlist[$field]=='position') $class='maxwidth50'; if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent'; if ($fieldlist[$field]=='tracking') $class='quatrevingtpercent'; if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" '; diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index c8b7b469bd2..acfa9d2dccd 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -71,7 +71,7 @@ if ($action == 'up') // Get current position $sql = "SELECT m.rowid, m.position, m.type, m.fk_menu"; $sql.= " FROM ".MAIN_DB_PREFIX."menu as m"; - $sql.= " WHERE m.rowid = ".$_GET["menuId"]; + $sql.= " WHERE m.rowid = ".GETPOST("menuId","int"); dol_syslog("admin/menus/index.php ".$sql); $result = $db->query($sql); $num = $db->num_rows($result); @@ -89,11 +89,11 @@ if ($action == 'up') // Menu before $sql = "SELECT m.rowid, m.position"; $sql.= " FROM ".MAIN_DB_PREFIX."menu as m"; - $sql.= " WHERE (m.position < ".($current['order'])." OR (m.position = ".($current['order'])." AND rowid < ".$_GET["menuId"]."))"; - $sql.= " AND m.menu_handler='".$menu_handler_to_search."'"; + $sql.= " WHERE (m.position < ".($current['order'])." OR (m.position = ".($current['order'])." AND rowid < ".GETPOST("menuId","int")."))"; + $sql.= " AND m.menu_handler='".$db->escape($menu_handler_to_search)."'"; $sql.= " AND m.entity = ".$conf->entity; - $sql.= " AND m.type = '".$current['type']."'"; - $sql.= " AND m.fk_menu = '".$current['fk_menu']."'"; + $sql.= " AND m.type = '".$db->escape($current['type'])."'"; + $sql.= " AND m.fk_menu = '".$db->escape($current['fk_menu'])."'"; $sql.= " ORDER BY m.position, m.rowid"; dol_syslog("admin/menus/index.php ".$sql); $result = $db->query($sql); @@ -127,7 +127,7 @@ elseif ($action == 'down') // Get current position $sql = "SELECT m.rowid, m.position, m.type, m.fk_menu"; $sql.= " FROM ".MAIN_DB_PREFIX."menu as m"; - $sql.= " WHERE m.rowid = ".$_GET["menuId"]; + $sql.= " WHERE m.rowid = ".GETPOST("menuId","int"); dol_syslog("admin/menus/index.php ".$sql); $result = $db->query($sql); $num = $db->num_rows($result); @@ -145,11 +145,11 @@ elseif ($action == 'down') // Menu after $sql = "SELECT m.rowid, m.position"; $sql.= " FROM ".MAIN_DB_PREFIX."menu as m"; - $sql.= " WHERE (m.position > ".($current['order'])." OR (m.position = ".($current['order'])." AND rowid > ".$_GET["menuId"]."))"; - $sql.= " AND m.menu_handler='".$menu_handler_to_search."'"; + $sql.= " WHERE (m.position > ".($current['order'])." OR (m.position = ".($current['order'])." AND rowid > ".GETPOST("menuId","int")."))"; + $sql.= " AND m.menu_handler='".$db->escape($menu_handler_to_search)."'"; $sql.= " AND m.entity = ".$conf->entity; - $sql.= " AND m.type = '".$current['type']."'"; - $sql.= " AND m.fk_menu = '".$current['fk_menu']."'"; + $sql.= " AND m.type = '".$db->escape($current['type'])."'"; + $sql.= " AND m.fk_menu = '".$db->escape($current['fk_menu'])."'"; $sql.= " ORDER BY m.position, m.rowid"; dol_syslog("admin/menus/index.php ".$sql); $result = $db->query($sql); @@ -180,7 +180,7 @@ elseif ($action == 'confirm_delete' && $confirm == 'yes') $db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu"; - $sql.= " WHERE rowid = ".$_GET['menuId']; + $sql.= " WHERE rowid = ".GETPOST('menuId','int'); $resql=$db->query($sql); if ($resql) { @@ -245,11 +245,11 @@ if ($action == 'delete') { $sql = "SELECT m.titre"; $sql.= " FROM ".MAIN_DB_PREFIX."menu as m"; - $sql.= " WHERE m.rowid = ".$_GET['menuId']; + $sql.= " WHERE m.rowid = ".GETPOST('menuId','int'); $result = $db->query($sql); $obj = $db->fetch_object($result); - print $form->formconfirm("index.php?menu_handler=".$menu_handler."&menuId=".$_GET['menuId'],$langs->trans("DeleteMenu"),$langs->trans("ConfirmDeleteMenu",$obj->titre),"confirm_delete"); + print $form->formconfirm("index.php?menu_handler=".$menu_handler."&menuId=".GETPOST('menuId','int'),$langs->trans("DeleteMenu"),$langs->trans("ConfirmDeleteMenu",$obj->titre),"confirm_delete"); } @@ -298,7 +298,7 @@ if ($conf->use_javascript_ajax) $sql = "SELECT m.rowid, m.titre, m.langs, m.mainmenu, m.leftmenu, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.module"; $sql.= " FROM ".MAIN_DB_PREFIX."menu as m"; - $sql.= " WHERE menu_handler = '".$menu_handler_to_search."'"; + $sql.= " WHERE menu_handler = '".$db->escape($menu_handler_to_search)."'"; $sql.= " AND entity = ".$conf->entity; //$sql.= " AND fk_menu >= 0"; $sql.= " ORDER BY m.position, m.rowid"; // Order is position then rowid (because we need a sort criteria when position is same) diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index 8ce7e046186..e023af90067 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -44,7 +44,7 @@ if (!$user->admin) accessforbidden(); if ($action == 'add') { $sql = "UPDATE ".MAIN_DB_PREFIX."rights_def SET bydefault=1"; - $sql.= " WHERE id = ".$_GET["pid"]; + $sql.= " WHERE id = ".GETPOST("pid",'int'); $sql.= " AND entity = ".$conf->entity; $db->query($sql); } @@ -52,7 +52,7 @@ if ($action == 'add') if ($action == 'remove') { $sql = "UPDATE ".MAIN_DB_PREFIX."rights_def SET bydefault=0"; - $sql.= " WHERE id = ".$_GET["pid"]; + $sql.= " WHERE id = ".GETPOST('pid','int'); $sql.= " AND entity = ".$conf->entity; $db->query($sql); } diff --git a/htdocs/admin/system/constall.php b/htdocs/admin/system/constall.php index 1ff005e88b2..0fb3a6c9a7b 100644 --- a/htdocs/admin/system/constall.php +++ b/htdocs/admin/system/constall.php @@ -90,7 +90,8 @@ $configfileparameters=array( '?dolibarr_font_DOL_DEFAULT_TTF_BOLD', 'separator', '?dolibarr_mailing_limit_sendbyweb', - '?dolibarr_strict_mode' + '?dolibarr_mailing_limit_sendbycli', + '?dolibarr_strict_mode' ); $configfilelib=array( // 'separator', diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 2fe87a02e63..21b79bcd7a1 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -286,7 +286,8 @@ $configfileparameters=array( 'separator4' => '', 'dolibarr_main_prod' => 'Production mode (Hide all error messages)', '?dolibarr_mailing_limit_sendbyweb' => 'Limit nb of email sent by page', - '?dolibarr_strict_mode' => 'Strict mode is on/off', + '?dolibarr_mailing_limit_sendbycli' => 'Limit nb of email sent by cli', + '?dolibarr_strict_mode' => 'Strict mode is on/off', '?dolibarr_pdf_force_fpdf' => 'Force fpdf usage to generate PDF' ); diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index 67e01bcb773..bef65d409a3 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -69,7 +69,7 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update') exit; } - if ($action == 'update') $bookmark->fetch($_POST["id"]); + if ($action == 'update') $bookmark->fetch(GETPOST("id",'int')); // Check if null because user not admin can't set an user and send empty value here. if(!empty($userid)) $bookmark->fk_user=$userid; @@ -217,7 +217,7 @@ if ($id > 0 && ! preg_match('/^add/i',$action)) print ''; - print ''; + print ''; print ''; @@ -301,6 +301,8 @@ if ($id > 0 && ! preg_match('/^add/i',$action)) } + // Buttons + print "
\n"; // Edit diff --git a/htdocs/cashdesk/tpl/validation2.tpl.php b/htdocs/cashdesk/tpl/validation2.tpl.php index 7bc7999d377..b74f5afdd52 100644 --- a/htdocs/cashdesk/tpl/validation2.tpl.php +++ b/htdocs/cashdesk/tpl/validation2.tpl.php @@ -33,7 +33,7 @@ $langs->load("bills"); largeur = 600; hauteur = 500; opt = 'width='+largeur+', height='+hauteur+', left='+(screen.width - largeur)/2+', top='+(screen.height-hauteur)/2+''; - window.open('validation_ticket.php?facid=', 'trans('PrintTicket') ?>', opt); + window.open('validation_ticket.php?facid=', 'trans('PrintTicket') ?>', opt); } popupTicket(); diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php index c7690e7e16f..7b71e3ade9c 100644 --- a/htdocs/comm/contact.php +++ b/htdocs/comm/contact.php @@ -125,6 +125,8 @@ if ($resql) $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses")); print_barre_liste($title.($label?" (".$label.")":""),$page, $_SERVER["PHP_SELF"], $param,$sortfield,$sortorder,"",$num); + print '
'; + print '
'.$langs->trans("Ref").''.$bookmark->ref.'
'.$langs->trans("Ref").''.$bookmark->ref.'
'; if ($action == 'edit') { @@ -231,7 +231,7 @@ if ($id > 0 && ! preg_match('/^add/i',$action)) } print ''; - if ($action == 'edit') print 'title).'">'; + if ($action == 'edit') print 'title).'">'; else print $bookmark->title; print '
'; print ''; print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"p.name", $begin, $param,"",$sortfield,$sortorder); @@ -134,7 +136,6 @@ if ($resql) print_liste_field_titre($langs->trans("Phone")); print "\n"; - print ''; print ''; print ''; print ''; @@ -142,7 +143,6 @@ if ($resql) print ''; print ''; print "\n"; - print ''; $var=True; $i = 0; @@ -167,7 +167,10 @@ if ($resql) print "\n"; $i++; } - print "
 

"; + print "
"; + + print ''; + $db->free($resql); } else diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 29d4fa26c18..f43f3ecd046 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -756,6 +756,7 @@ 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 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. @@ -767,19 +768,21 @@ else if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings'); $_GET["action"]=''; } - else if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) + else if ($conf->global->MAILING_LIMIT_SENDBYWEB == '-1') { - // Pour des raisons de securite, on ne permet pas cette fonction via l'IHM, - // on affiche donc juste un message + // No limit was defined, so the feature is forbidden from GUI, we show just a message. setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings'); setEventMessages('', null, 'warnings'); - setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); + if ($conf->file->mailing_limit_sendbyweb != '-1') + { + setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); // You can send online with constant... + } $_GET["action"]=''; } else { $text=''; - if ($conf->file->mailing_limit_sendbyweb == 0) + if ($conf->global->MAILING_LIMIT_SENDBYCLI >= 0) { $text.=$langs->trans("MailingNeedCommand"); $text.='
'; diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 5cc7fcedf4d..575a55e435f 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -283,14 +283,14 @@ if ($socid > 0) print '
'; print ''; print ''; - print ''; print ''; print ''; print ''; - print ''; + print ''; print "
'.$langs->trans("AmountHT").''; + print ''; print ' '.$langs->trans("Currency".$conf->currency).'
'.$langs->trans("VAT").''; print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$object); print '
'.$langs->trans("NoteReason").'
"; } diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php index 391962c98cb..8190367a06a 100644 --- a/htdocs/commande/customer.php +++ b/htdocs/commande/customer.php @@ -44,11 +44,13 @@ accessforbidden(); $langs->load("companies"); $langs->load("orders"); + +$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 = $conf->liste_limit * $page; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) $sortorder="ASC"; @@ -77,32 +79,32 @@ $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"; -} - -if ($_GET["search_nom"]) -{ - $sql.= " AND s.nom like '%".$db->escape(strtolower($_GET["search_nom"]))."%'"; -} -if ($_GET["search_compta"]) -{ - $sql.= " AND s.code_compta like '%".$db->escape($_GET["search_compta"])."%'"; -} -if ($_GET["search_code_client"]) -{ - $sql.= " AND s.code_client like '%".$db->escape($_GET["search_code_client"])."%'"; + $sql.= " AND s.fk_stcomm=".$stcomm; } +if (GETPOST("search_nom")) $sql.= natural_search("s.nom", GETPOST("search_nom")); +if (GETPOST("search_compta")) $sql.= natural_search("s.code_compta", GETPOST("search_compta")); +if (GETPOST("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)."'"; } -if ($socid) +if ($socid > 0) { $sql.= " AND s.rowid = ".$socid; } $sql.= " AND c.fk_statut in (1, 2) AND c.facture = 0"; $sql.= " GROUP BY s.nom"; -$sql.= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); +$sql.= $db->order($sortfield,$sortorder); + +// Count total nb of records +$nbtotalofrecords = -1; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + +$sql.= $db->plimit($limit + 1, $offset); //print $sql; $resql = $db->query($sql); @@ -129,26 +131,27 @@ if ($resql) print ''; print ''; - print ''; + print ''; print ' '; print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; print ''; + print "\n"; $var=true; - while ($i < min($num,$conf->liste_limit)) + while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index f9767c74695..74861d3ee67 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -46,7 +46,7 @@ $langs->load('companies'); if (! $user->rights->facture->creer) accessforbidden(); -$id = (GETPOST('id')?GETPOST('id','int'):GETPOST("facid")); // For backward compatibility +$id = (GETPOST('id')?GETPOST('id','int'):GETPOST("facid","int")); // For backward compatibility $ref = GETPOST('ref','alpha'); $action = GETPOST('action','alpha'); $confirm = GETPOST('confirm','alpha'); @@ -112,7 +112,7 @@ if (($action == 'create' || $action == 'add') && !$error) $langs->load('main'); if (isset($_GET['orders_to_invoice'])) { - $orders_id = $_GET['orders_to_invoice']; + $orders_id = GETPOST('orders_to_invoice','',1); $n = count($orders_id); $i = 0; @@ -122,7 +122,7 @@ if (($action == 'create' || $action == 'add') && !$error) } if (isset($_POST['orders_to_invoice'])) { - $orders_id = $_POST['orders_to_invoice']; + $orders_id = GETPOST('orders_to_invoice','',1); $nn = count($orders_id); $ii = 0; diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index b4cea5b4982..5c21b67a891 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -106,7 +106,7 @@ $fsearch.=' '; $calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local; // Affiche en-tete du rapport -if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services +if ($calc==0 || $calc==1) // Calculate on invoice for goods and services { $nom=$langs->transcountry($local==1?"LT1ReportByCustomersInInputOutputMode":"LT2ReportByCustomersInInputOutputMode",$mysoc->country_code); $calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT".$local."Rec"); @@ -124,7 +124,7 @@ if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice $productsup=$langs->trans("Description"); $amountsup=$langs->trans("AmountHT"); } -if ($conf->global->$calc==2) // Invoice for goods, payment for services +if ($calc==2) // Invoice for goods, payment for services { $nom=$langs->transcountry($local==1?"LT1ReportByCustomersInInputOutputMode":"LT2ReportByCustomersInInputOutputMode",$mysoc->country_code); $calcmode=$langs->trans("CalcModeLT2Debt"); @@ -149,7 +149,7 @@ $vatcust=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code); $vatsup=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code); // IRPF that the customer has retained me -if($conf->global->$calc ==0 || $conf->global->$calc == 2) +if($calc ==0 || $calc == 2) { print ""; print ""; @@ -232,7 +232,7 @@ if($conf->global->$calc ==0 || $conf->global->$calc == 2) } // IRPF I retained my supplier -if($conf->global->$calc ==0 || $conf->global->$calc == 1){ +if($calc ==0 || $calc == 1){ print "
"; print ""; print '"; @@ -309,7 +309,7 @@ if($conf->global->$calc ==0 || $conf->global->$calc == 1){ } } -if($conf->global->$calc ==0){ +if($calc ==0){ // Total to pay print '

'; print '
'.$langs->trans("Num")."
'; diff --git a/htdocs/compta/localtax/reglement.php b/htdocs/compta/localtax/reglement.php index 54530b14443..df96d0b7d67 100644 --- a/htdocs/compta/localtax/reglement.php +++ b/htdocs/compta/localtax/reglement.php @@ -31,7 +31,7 @@ $langs->load("compta"); $socid = isset($_GET["socid"])?$_GET["socid"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'tax', '', '', 'charges'); -$ltt=$_REQUEST["localTaxType"]; +$ltt=GETPOST("localTaxType"); /* * View @@ -45,7 +45,7 @@ print load_fiche_titre($langs->transcountry($ltt==2?"LT2Payments":"LT1Payments", $sql = "SELECT rowid, amount, label, f.datev as dm"; $sql.= " FROM ".MAIN_DB_PREFIX."localtax as f "; -$sql.= " WHERE f.entity = ".$conf->entity." AND localtaxtype=".$ltt; +$sql.= " WHERE f.entity = ".$conf->entity." AND localtaxtype=".$db->escape($ltt); $sql.= " ORDER BY dm DESC"; $result = $db->query($sql); diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 128eb6456f3..e0a19d7a0f3 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -48,7 +48,7 @@ $langs->load("trips"); $langs->load("other"); // Date range -$year=GETPOST("year"); +$year=GETPOST("year","int"); if (empty($year)) { $year_current = strftime("%Y",dol_now()); @@ -57,15 +57,15 @@ if (empty($year)) $year_current = $year; $year_start = $year; } -$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); -$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); +$date_start=dol_mktime(0,0,0,GETPOST("date_startmonth"),GETPOST("date_startday"),GETPOST("date_startyear")); +$date_end=dol_mktime(23,59,59,GETPOST("date_endmonth"),GETPOST("date_endday"),GETPOST("date_endyear")); // Quarter if (empty($date_start) || empty($date_end)) // We define date_start and date_end { $q=GETPOST("q"); if (empty($q)) { - if (isset($_REQUEST["month"])) { $date_start=dol_get_first_day($year_start,$_REQUEST["month"],false); $date_end=dol_get_last_day($year_start,$_REQUEST["month"],false); } + if (GETPOST("month")) { $date_start=dol_get_first_day($year_start,GETPOST("month"),false); $date_end=dol_get_last_day($year_start,GETPOST("month"),false); } else { $month_current = strftime("%m",dol_now()); diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 83dbd300f60..c03e41b386c 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -273,6 +273,18 @@ $dolibarr_nocsrfcheck='0'; // Examples: // $dolibarr_main_limit_users='0'; +// dolibarr_mailing_limit_sendbyweb +// Can set a limit for mailing send by web. This overwrite database value. Can be used to restrict on OS level. +// Default value: '0' (no overwrite, use database value if exists) +// Examples: '-1' (sending by web is forbidden) +// $dolibarr_mailing_limit_sendbyweb='0'; + +// dolibarr_mailing_limit_sendbycli +// Can set a limit for mailing send by cli. This overwrite database value. Can be used to restrict on OS level. +// Default value: '0' (no overwrite, use database value if exists) +// Examples: '-1' (sending by cli is forbidden) +// $dolibarr_mailing_limit_sendbycli='0'; + // dolibarr_strict_mode // Set this to 1 to enable the PHP strict mode. For dev environment only. // Default value: 0 (use database value if exist) diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index e4a18e1599a..4fc2f9f53c3 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -33,17 +33,18 @@ $langs->load("products"); $langs->load("contracts"); $langs->load("companies"); -$mode = GETPOST("mode"); +$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 ; } -$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; -$offset = $limit * $page ; - +if ($page == -1) { $page = 0; } +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; if (! $sortfield) $sortfield="c.rowid"; if (! $sortorder) $sortorder="ASC"; +$mode = GETPOST("mode"); $filter=GETPOST("filter"); $search_name=GETPOST("search_name"); $search_contract=GETPOST("search_contract"); @@ -73,6 +74,17 @@ $opclotureday=GETPOST('opclotureday'); $opclotureyear=GETPOST('opclotureyear'); $filter_opcloture=GETPOST('filter_opcloture'); +// Initialize context for list +$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'servicelist'.$mode; + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array($contextpage)); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('contratdet'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); + // Security check $contratid = GETPOST('id','int'); if (! empty($user->societe_id)) $socid=$user->societe_id; @@ -100,39 +112,74 @@ $staticcontrat=new Contrat($db); $staticcontratligne=new ContratLigne($db); $companystatic=new Societe($db); -$arrayfields=array(); +$arrayfields=array( + 'c.ref'=>array('label'=>$langs->trans("Contract"), 'checked'=>1, 'position'=>80), + 'p.description'=>array('label'=>$langs->trans("Service"), 'checked'=>1, 'position'=>80), + 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'position'=>100), + 'cd.date_ouverture_prevue'=>array('label'=>$langs->trans("DateStartPlannedShort"), 'checked'=>(($mode == "" || $mode == -1) || $mode == "0")), + 'cd.date_ouverture'=>array('label'=>$langs->trans("DateStartRealShort"), 'checked'=>(($mode == "" || $mode == -1) || $mode > 0)), + 'cd.date_fin_validite'=>array('label'=>$langs->trans("DateEndPlannedShort"), 'checked'=>(($mode == "" || $mode == -1) || $mode < 5)), + 'cd.date_cloture'=>array('label'=>$langs->trans("DateEndRealShort"), 'checked'=>(($mode == "" || $mode == -1) || $mode >= 5)), + 'status'=>array('label'=>$langs->trans("Status"), 'checked'=>1), + //'cd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 'cd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500) +); +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) + { + $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); + } +} + + /* * Actions */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; } + +$parameters=array('socid'=>$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'); + +if (empty($reshook)) { - $search_name=""; - $search_contract=""; - $search_service=""; - $search_status=-1; - $opouvertureprevuemonth=""; - $opouvertureprevueday=""; - $opouvertureprevueyear=""; - $filter_opouvertureprevue=""; - $op1month=""; - $op1day=""; - $op1year=""; - $filter_op1=""; - $op2month=""; - $op2day=""; - $op2year=""; - $filter_op2=""; - $opcloturemonth=""; - $opclotureday=""; - $opclotureyear=""; - $filter_opcloture=""; - $mode=''; - $filter=''; + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers + { + $search_name=""; + $search_contract=""; + $search_service=""; + $search_status=-1; + $opouvertureprevuemonth=""; + $opouvertureprevueday=""; + $opouvertureprevueyear=""; + $filter_opouvertureprevue=""; + $op1month=""; + $op1day=""; + $op1year=""; + $filter_op1=""; + $op2month=""; + $op2day=""; + $op2year=""; + $filter_op2=""; + $opcloturemonth=""; + $opclotureday=""; + $opclotureyear=""; + $filter_opcloture=""; + $mode=''; + $filter=''; + } } + /* * View */ @@ -141,8 +188,6 @@ $now=dol_now(); $form=new Form($db); -llxHeader(); - $sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut,"; $sql.= " s.rowid as socid, s.nom as name,"; $sql.= " cd.rowid, cd.description, cd.statut,"; @@ -151,11 +196,20 @@ if (!$user->rights->societe->client->voir && !$socid) $sql .= " sc.fk_soc, sc.fk $sql.= " cd.date_ouverture_prevue,"; $sql.= " cd.date_ouverture,"; $sql.= " cd.date_fin_validite,"; -$sql.= " cd.date_cloture"; +$sql.= " cd.date_cloture,"; +//$sql.= " cd.date_c as date_creation,"; +$sql.= " cd.tms as date_update"; +// Add fields from extrafields +foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; $sql.= " FROM ".MAIN_DB_PREFIX."contrat as c,"; $sql.= " ".MAIN_DB_PREFIX."societe as s,"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,"; $sql.= " ".MAIN_DB_PREFIX."contratdet as cd"; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet_extrafields as ef on (cd.rowid = ef.fk_object)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product'; $sql.= " WHERE c.entity = ".$conf->entity; @@ -180,169 +234,263 @@ if (! empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1 && $fi if (! empty($filter_op1) && $filter_op1 != -1 && $filter_date1 != '') $sql.= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1)."'"; if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2)."'"; if (! empty($filter_opcloture) && $filter_opcloture != -1 && $filter_datecloture != '') $sql.= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture)."'"; -$totalnboflines=0; -$result=$db->query($sql); -if ($result) -{ - $totalnboflines = $db->num_rows($result); -} $sql .= $db->order($sortfield,$sortorder); + +$nbtotalofrecords = -1; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + $sql .= $db->plimit($limit + 1, $offset); //print $sql; dol_syslog("contrat/services.php", LOG_DEBUG); $resql=$db->query($sql); -if ($resql) +if (! $resql) { - $num = $db->num_rows($resql); - $i = 0; + dol_print_error($db); + exit; +} - $param=''; - if ($search_contract) $param.='&search_contract='.urlencode($search_contract); - if ($search_name) $param.='&search_name='.urlencode($search_name); - if ($search_service) $param.='&search_service='.urlencode($search_service); - if ($mode) $param.='&mode='.$mode; - if ($filter) $param.='&filter='.$filter; - if (! empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1) $param.='&filter_opouvertureprevue='.urlencode($filter_opouvertureprevue); - if (! empty($filter_op1) && $filter_op1 != -1) $param.='&filter_op1='.urlencode($filter_op1); - if (! empty($filter_op2) && $filter_op2 != -1) $param.='&filter_op2='.urlencode($filter_op2); - if (! empty($filter_opcloture) && $filter_opcloture != -1) $param.='&filter_opcloture='.urlencode($filter_opcloture); - if ($filter_dateouvertureprevue != '') $param.='&opouvertureprevueday='.$opouvertureprevueday.'&opouvertureprevuemonth='.$opouvertureprevuemonth.'&opouvertureprevueyear='.$opouvertureprevueyear; - if ($filter_date1 != '') $param.='&op1day='.$op1day.'&op1month='.$op1month.'&op1year='.$op1year; - if ($filter_date2 != '') $param.='&op2day='.$op2day.'&op2month='.$op2month.'&op2year='.$op2year; - if ($filter_datecloture != '') $param.='&opclotureday='.$op2day.'&opcloturemonth='.$op2month.'&opclotureyear='.$op2year; - - // List of mass actions available - $arrayofmassactions = array( - //'presend'=>$langs->trans("SendByMail"), - //'builddoc'=>$langs->trans("PDFMerge"), - ); - //if ($user->rights->contrat->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - //if ($massaction == 'presend') $arrayofmassactions=array(); - $massactionbutton=$form->selectMassAction('', $arrayofmassactions); - - print ''; - if ($optioncss != '') print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $title=$langs->trans("ListOfServices"); - if ($mode == "0") $title=$langs->trans("ListOfInactiveServices"); // Must use == "0" - if ($mode == "4" && $filter != "expired") $title=$langs->trans("ListOfRunningServices"); - if ($mode == "4" && $filter == "expired") $title=$langs->trans("ListOfExpiredServices"); - if ($mode == "5") $title=$langs->trans("ListOfClosedServices"); - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'title_commercial.png', 0, '', '', $limit); +$num = $db->num_rows($resql); - if ($sall) - { - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); - } +/* +if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) +{ + $obj = $db->fetch_object($resql); + $id = $obj->id; + header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withprojet=1'); + exit; +}*/ - $morefilter = ''; - - // If the user can view categories of products - if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire)) - { - include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); - $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1); - $moreforfilter.='
'; - } - - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook - if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; - else $moreforfilter = $hookmanager->resPrint; - - - if (! empty($moreforfilter)) - { - print '
'; - print $moreforfilter; - print '
'; - } - - $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; - $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - - print '
'; - print '
'."\n"; - - print ''; - print_liste_field_titre($langs->trans("Contract"),$_SERVER["PHP_SELF"], "c.rowid",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Service"),$_SERVER["PHP_SELF"], "p.description",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"], "s.nom",$param,"","",$sortfield,$sortorder); - // Date debut - if (($mode == "" || $mode == -1) || $mode == "0") print_liste_field_titre($langs->trans("DateStartPlannedShort"),$_SERVER["PHP_SELF"], "cd.date_ouverture_prevue",$param,'',' align="center"',$sortfield,$sortorder); - if (($mode == "" || $mode == -1) || $mode > 0) print_liste_field_titre($langs->trans("DateStartRealShort"),$_SERVER["PHP_SELF"], "cd.date_ouverture",$param,'',' align="center"',$sortfield,$sortorder); - // Date fin - if (($mode == "" || $mode == -1) || $mode < 5) print_liste_field_titre($langs->trans("DateEndPlannedShort"),$_SERVER["PHP_SELF"], "cd.date_fin_validite",$param,'',' align="center"',$sortfield,$sortorder); - if (($mode == "" || $mode == -1) || $mode >= 5) print_liste_field_titre($langs->trans("DateEndRealShort"),$_SERVER["PHP_SELF"], "cd.date_cloture",$param,'',' align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"], "cd.statut,c.statut",$param,"","align=\"right\"",$sortfield,$sortorder); - print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; +llxHeader(null, $langs->trans("Services")); - print ''; +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; +if ($search_contract) $param.='&search_contract='.urlencode($search_contract); +if ($search_name) $param.='&search_name='.urlencode($search_name); +if ($search_service) $param.='&search_service='.urlencode($search_service); +if ($mode) $param.='&mode='.urlencode($mode); +if ($filter) $param.='&filter='.urlencode($filter); +if (! empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1) $param.='&filter_opouvertureprevue='.urlencode($filter_opouvertureprevue); +if (! empty($filter_op1) && $filter_op1 != -1) $param.='&filter_op1='.urlencode($filter_op1); +if (! empty($filter_op2) && $filter_op2 != -1) $param.='&filter_op2='.urlencode($filter_op2); +if (! empty($filter_opcloture) && $filter_opcloture != -1) $param.='&filter_opcloture='.urlencode($filter_opcloture); +if ($filter_dateouvertureprevue != '') $param.='&opouvertureprevueday='.$opouvertureprevueday.'&opouvertureprevuemonth='.$opouvertureprevuemonth.'&opouvertureprevueyear='.$opouvertureprevueyear; +if ($filter_date1 != '') $param.='&op1day='.$op1day.'&op1month='.$op1month.'&op1year='.$op1year; +if ($filter_date2 != '') $param.='&op2day='.$op2day.'&op2month='.$op2month.'&op2year='.$op2year; +if ($filter_datecloture != '') $param.='&opclotureday='.$op2day.'&opcloturemonth='.$op2month.'&opclotureyear='.$op2year; +if ($optioncss != '') $param.='&optioncss='.$optioncss; +// Add $param from extra fields +foreach ($search_array_options as $key => $val) +{ + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); +} + +// List of mass actions available +$arrayofmassactions = array( + //'presend'=>$langs->trans("SendByMail"), + //'builddoc'=>$langs->trans("PDFMerge"), +); +//if ($user->rights->contrat->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); +//if ($massaction == 'presend') $arrayofmassactions=array(); +$massactionbutton=$form->selectMassAction('', $arrayofmassactions); + +print ''; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +$title=$langs->trans("ListOfServices"); +if ($mode == "0") $title=$langs->trans("ListOfInactiveServices"); // Must use == "0" +if ($mode == "4" && $filter != "expired") $title=$langs->trans("ListOfRunningServices"); +if ($mode == "4" && $filter == "expired") $title=$langs->trans("ListOfExpiredServices"); +if ($mode == "5") $title=$langs->trans("ListOfClosedServices"); +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); + +if ($sall) +{ + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); +} + +$morefilter = ''; + +// If the user can view categories of products +if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire)) +{ + include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); + $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1); + $moreforfilter.='
'; +} + +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook +if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; +else $moreforfilter = $hookmanager->resPrint; + + +if (! empty($moreforfilter)) +{ + print '
'; + print $moreforfilter; + print '
'; +} + +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + + +print '
'; +print '
'."\n"; + +print ''; +if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'],$_SERVER["PHP_SELF"],"c.ref","",$param,"",$sortfield,$sortorder); +if (! empty($arrayfields['p.description']['checked'])) print_liste_field_titre($arrayfields['p.description']['label'],$_SERVER["PHP_SELF"],"p.description","",$param,"",$sortfield,$sortorder); +if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); +if (! empty($arrayfields['cd.date_ouverture_prevue']['checked'])) print_liste_field_titre($arrayfields['cd.date_ouverture_prevue']['label'],$_SERVER["PHP_SELF"],"cd.date_ouverture_prevue","",$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['cd.date_ouverture']['checked'])) print_liste_field_titre($arrayfields['cd.date_ouverture']['label'],$_SERVER["PHP_SELF"],"cd.date_ouverture","",$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['cd.date_fin_validite']['checked'])) print_liste_field_titre($arrayfields['cd.date_fin_validite']['label'],$_SERVER["PHP_SELF"],"cd.date_fin_validite","",$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['cd.date_cloture']['checked'])) print_liste_field_titre($arrayfields['cd.date_cloture']['label'],$_SERVER["PHP_SELF"],"cd.date_cloture","",$param,'align="center"',$sortfield,$sortorder); +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + } + } +} +// Hook fields +$parameters=array('arrayfields'=>$arrayfields); +$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +if (! empty($arrayfields['cd.datec']['checked'])) print_liste_field_titre($arrayfields['cd.datec']['label'],$_SERVER["PHP_SELF"],"cd.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['cd.tms']['checked'])) print_liste_field_titre($arrayfields['cd.tms']['label'],$_SERVER["PHP_SELF"],"cd.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['status']['checked'])) print_liste_field_titre($arrayfields['status']['label'],$_SERVER["PHP_SELF"],"cd.statut,c.statut","",$param,'align="right"',$sortfield,$sortorder); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); +print "\n"; + +print ''; +if (! empty($arrayfields['c.ref']['checked'])) +{ print ''; - // Service label - print ''; - // Third party - print ''; - if (($mode == "" || $mode == -1) || $mode == "0") - { - print ''; - } - if (($mode == "" || $mode == -1) || $mode > 0) - { - print ''; - } - if (($mode == "" || $mode == -1) || $mode < 5) +} +if (! empty($arrayfields['cd.date_ouverture_prevue']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['cd.date_ouverture']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['cd.date_fin_validite']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['cd.date_cloture']['checked'])) +{ + print ''; +} +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) { - print ''; + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + $typeofextrafield=$extrafields->attribute_type[$key]; + print ''; + } } - if (($mode == "" || $mode == -1) || $mode >= 5) - { - print ''; - } - print ''; +} +if (! empty($arrayfields['cd.tms']['checked'])) +{ + // Date modification + print ''; +} +if (! empty($arrayfields['status']['checked'])) +{ + // Status + print ''; - print ''; - print "\n"; +} +// Action column +print ''; +print "\n"; - $contractstatic=new Contrat($db); - $productstatic=new Product($db); +$contractstatic=new Contrat($db); +$productstatic=new Product($db); - $var=True; - while ($i < min($num,$limit)) - { - $obj = $db->fetch_object($resql); - - $contractstatic->id=$obj->cid; - $contractstatic->ref=$obj->ref?$obj->ref:$obj->cid; - - $var=!$var; +$var=True; $i=0; +while ($i < min($num,$limit)) +{ + $obj = $db->fetch_object($resql); + + $contractstatic->id=$obj->cid; + $contractstatic->ref=$obj->ref?$obj->ref:$obj->cid; + + $var=!$var; - print ""; - - // Ref - print '"; + + // Ref + if (! empty($arrayfields['c.ref']['checked'])) + { + print ''; - - // Service - print ''; - - // Third party - print ''; - - // Start date - if (($mode == "" || $mode == -1) || $mode == "0") - { - print ''; - } - if (($mode == "" || $mode == -1) || $mode > 0) - { - print ''; - } - // End date - if (($mode == "" || $mode == -1) || $mode < 5) - { - print ''; - print ''; - print ''; - print "\n"; - $i++; } - $db->free($resql); + if (! empty($arrayfields['cd.date_ouverture']['checked'])) + { + print ''; + } + // End date + if (! empty($arrayfields['cd.date_fin_validite']['checked'])) + { + print ''; + } + if (! empty($arrayfields['cd.date_cloture']['checked'])) + { + print ''; + } - print '
'; print ''; print ''; print ''; print ''; - print ''; +} +// Service label +if (! empty($arrayfields['p.description']['checked'])) +{ + print ''; + print ''; print ''; - print ''; +} +// Third party +if (! empty($arrayfields['s.nom']['checked'])) +{ + print ''; + print ''; print ''; - $arrayofoperators=array('<'=>'<','>'=>'>'); - print $form->selectarray('filter_opouvertureprevue',$arrayofoperators,$filter_opouvertureprevue,1); - print ' '; - $filter_dateouvertureprevue=dol_mktime(0,0,0,$opouvertureprevuemonth,$opouvertureprevueday,$opouvertureprevueyear); - print $form->select_date($filter_dateouvertureprevue,'opouvertureprevue',0,0,1,'',1,0,1); - print ''; - $arrayofoperators=array('<'=>'<','>'=>'>'); - print $form->selectarray('filter_op1',$arrayofoperators,$filter_op1,1); - print ' '; - $filter_date1=dol_mktime(0,0,0,$op1month,$op1day,$op1year); - print $form->select_date($filter_date1,'op1',0,0,1,'',1,0,1); - print ''; + $arrayofoperators=array('<'=>'<','>'=>'>'); + print $form->selectarray('filter_opouvertureprevue',$arrayofoperators,$filter_opouvertureprevue,1); + print ' '; + $filter_dateouvertureprevue=dol_mktime(0,0,0,$opouvertureprevuemonth,$opouvertureprevueday,$opouvertureprevueyear); + print $form->select_date($filter_dateouvertureprevue,'opouvertureprevue',0,0,1,'',1,0,1); + print ''; + $arrayofoperators=array('<'=>'<','>'=>'>'); + print $form->selectarray('filter_op1',$arrayofoperators,$filter_op1,1); + print ' '; + $filter_date1=dol_mktime(0,0,0,$op1month,$op1day,$op1year); + print $form->select_date($filter_date1,'op1',0,0,1,'',1,0,1); + print ''; + $arrayofoperators=array('<'=>'<','>'=>'>'); + print $form->selectarray('filter_op2',$arrayofoperators,$filter_op2,1); + print ' '; + $filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year); + print $form->select_date($filter_date2,'op2',0,0,1,'',1,0,1); + print ''; + $arrayofoperators=array('<'=>'<','>'=>'>'); + print $form->selectarray('filter_opcloture',$arrayofoperators,$filter_opcloture,1); + print ' '; + $filter_date_cloture=dol_mktime(0,0,0,$opcloturemonth,$opclotureday,$opclotureyear); + print $form->select_date($filter_date_cloture,'opcloture',0,0,1,'',1,0,1); + print ''; - $arrayofoperators=array('<'=>'<','>'=>'>'); - print $form->selectarray('filter_op2',$arrayofoperators,$filter_op2,1); - print ' '; - $filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year); - print $form->select_date($filter_date2,'op2',0,0,1,'',1,0,1); - print ''; + if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select'))) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $searchclass=''; + if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; + if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; + print ''; + } + print ''; - $arrayofoperators=array('<'=>'<','>'=>'>'); - print $form->selectarray('filter_opcloture',$arrayofoperators,$filter_opcloture,1); - print ' '; - $filter_date_cloture=dol_mktime(0,0,0,$opcloturemonth,$opclotureday,$opclotureyear); - print $form->select_date($filter_date_cloture,'opcloture',0,0,1,'',1,0,1); - print ''; +} +// Fields from hook +$parameters=array('arrayfields'=>$arrayfields); +$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +if (! empty($arrayfields['cd.datec']['checked'])) +{ + // Date creation + print ''; + print ''; + print ''; $arrayofstatus=array( '0'=>$langs->trans("ServiceStatusInitial"), '4'=>$langs->trans("ServiceStatusRunning"), @@ -350,36 +498,42 @@ if ($resql) '4&filter=expired'=>$langs->trans("ServiceStatusLate"), '5'=>$langs->trans("ServiceStatusClosed") ); - print $form->selectarray('search_status',$arrayofstatus,(strstr($search_status, ',')?-1:$search_status),1); + print $form->selectarray('search_status', $arrayofstatus, (strstr($search_status, ',')?-1:$search_status), 1, 0, '', 0, 0, 0, '', 'maxwidth100onsmartphone'); print ''; - $searchpitco=$form->showFilterAndCheckAddButtons(0); - print $searchpitco; - print '
'; +$searchpitco=$form->showFilterAndCheckAddButtons(0); +print $searchpitco; +print '
'; + print "
'; print $contractstatic->getNomUrl(1,16); print ''; + } + // Service + if (! empty($arrayfields['p.description']['checked'])) + { + print ''; if ($obj->pid) { $productstatic->id=$obj->pid; @@ -396,70 +550,128 @@ if ($resql) if ($obj->type == 1) print img_object($obj->description,'service').' '.dol_trunc($obj->description,24); } print ''; + } + + // Third party + if (! empty($arrayfields['s.nom']['checked'])) + { + print ''; $companystatic->id=$obj->socid; $companystatic->name=$obj->name; $companystatic->client=1; print $companystatic->getNomUrl(1,'customer',28); print ''; - print ($obj->date_ouverture_prevue?dol_print_date($db->jdate($obj->date_ouverture_prevue)):' '); - if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay)) && $obj->statut == 0) - print ' '.img_picto($langs->trans("Late"),"warning"); - else print '    '; - print ''.($obj->date_ouverture?dol_print_date($db->jdate($obj->date_ouverture)):' ').''.($obj->date_fin_validite?dol_print_date($db->jdate($obj->date_fin_validite)):' '); - if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) - { - $warning_delay=$conf->contrat->services->expires->warning_delay / 3600 / 24; - $textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days"); - print img_warning($textlate); - } - else print '    '; - } - if (($mode == "" || $mode == -1) || $mode >= 5) print ''.dol_print_date($db->jdate($obj->date_cloture)); - // Icone warning + } + + // Start date + if (! empty($arrayfields['cd.date_ouverture_prevue']['checked'])) + { + print ''; + print ($obj->date_ouverture_prevue?dol_print_date($db->jdate($obj->date_ouverture_prevue)):' '); + if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay)) && $obj->statut == 0) + print ' '.img_picto($langs->trans("Late"),"warning"); + else print '    '; print ''; - if ($obj->cstatut == 0) // If contract is draft, we say line is also draft - { - print $contractstatic->LibStatut(0,5,($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now)); - } - else - { - print $staticcontratligne->LibStatut($obj->statut,5,($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now)?1:0); - } - print '
'.($obj->date_ouverture?dol_print_date($db->jdate($obj->date_ouverture)):' ').''.($obj->date_fin_validite?dol_print_date($db->jdate($obj->date_fin_validite)):' '); + if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) + { + $warning_delay=$conf->contrat->services->expires->warning_delay / 3600 / 24; + $textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days"); + print img_warning($textlate); + } + else print '    '; + print ''.dol_print_date($db->jdate($obj->date_cloture)).'
'; - print ''; + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + print 'getAlignFlag($key); + if ($align) print ' align="'.$align.'"'; + print '>'; + $tmpkey='options_'.$key; + print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); + print ''; + if (! $i) $totalarray['nbfield']++; + } + } + } + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (! empty($arrayfields['cd.datec']['checked'])) + { + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Date modification + if (! empty($arrayfields['cd.tms']['checked'])) + { + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour'); + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Status + if (! empty($arrayfields['status']['checked'])) + { + print ''; + if ($obj->cstatut == 0) // If contract is draft, we say line is also draft + { + print $contractstatic->LibStatut(0,5,($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now)); + } + else + { + print $staticcontratligne->LibStatut($obj->statut,5,($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now)?1:0); + } + print ''; + } + // Action column + print ''; + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + { + $selected=0; + if (in_array($obj->rowid, $arrayofselected)) $selected=1; + print ''; + } + print ''; + if (! $i) $totalarray['nbfield']++; - print ''; + print "\n"; + $i++; +} +$db->free($resql); + +$parameters=array('sql' => $sql); +$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print ''; +print ''; + +print ''; -} -else -{ - dol_print_error($db); -} llxFooter(); diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 4ff36a1e88b..28f78e22ef4 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -138,7 +138,7 @@ if (! dol_is_dir($upload_dir)) exit;*/ } -print ''."\n"; +print ''."\n"; print ''."\n"; $param=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:''); diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 3abd7dd58b5..31ec3d6e6b5 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -824,7 +824,7 @@ class CMailFile global $conf; $out = ""; - $host = dol_getprefix(); + $host = dol_getprefix('email'); // Sender //$out.= "Sender: ".getValidAddress($this->addr_from,2)).$this->eol2; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index b18738bde9f..be5272cf7c2 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -771,7 +771,7 @@ class ExtraFields } elseif ($type == 'price') { - $out=' '.$langs->getCurrencySymbol($conf->currency); + $out=' '.$langs->getCurrencySymbol($conf->currency); } elseif ($type == 'double') { diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 46eeb7eaf51..b5c370bee07 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -955,7 +955,7 @@ class FormFile print ''; print ''; } - print ''."\n"; + print '
'."\n"; print ''; print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder); @@ -1138,7 +1138,7 @@ class FormFile } if ($nboffiles == 0) { - print ''; @@ -1181,7 +1181,7 @@ class FormFile // Show list of documents if (empty($useinecm)) print load_fiche_titre($langs->trans("AttachedFiles")); if (empty($url)) $url=$_SERVER["PHP_SELF"]; - print '
'; + print '
'; if (empty($textifempty)) print $langs->trans("NoFileFound"); else print $textifempty; print '
'."\n"; + print '
'."\n"; print ''; $sortref="fullname"; if ($modulepart == 'invoice_supplier') $sortref='level1name'; diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php index b2802f91c09..9412582599d 100644 --- a/htdocs/core/class/html.formsms.class.php +++ b/htdocs/core/class/html.formsms.class.php @@ -255,7 +255,7 @@ function limitChars(textarea, limit, infodiv) } else { - print "withto) && $this->withto != '1'? (isset($_REQUEST["sendto"])?$_REQUEST["sendto"]:$this->withto):"+")."\">"; + print "withto) && $this->withto != '1'? (isset($_REQUEST["sendto"])?GETPOST("sendto"):$this->withto):"+")."\">"; if (! empty($this->withtosocid) && $this->withtosocid > 0) { $liste=array(); @@ -290,11 +290,11 @@ function limitChars(textarea, limit, infodiv) if ($this->withbodyreadonly) { print nl2br($defaultmessage); - print ''; + print ''; } else { - print ''; + print ''; print '
'.$langs->trans("SmsInfoCharRemain").': '.(160-dol_strlen($defaultmessage)).'
'; } print "\n"; diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index c8ce225e0c2..6cd5dfb2821 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1195,6 +1195,8 @@ class SMTPs $host=preg_replace('@tcp://@i','',$host); // Remove prefix $host=preg_replace('@ssl://@i','',$host); // Remove prefix + $host=dol_getprefix('email').'-'.$host; + //NOTE: Message-ID should probably contain the username of the user who sent the msg $_header .= 'Subject: ' . $this->getSubject() . "\r\n"; $_header .= 'Date: ' . date("r") . "\r\n"; diff --git a/htdocs/core/datepicker.php b/htdocs/core/datepicker.php index 63b765fbadb..eeb20ee265c 100644 --- a/htdocs/core/datepicker.php +++ b/htdocs/core/datepicker.php @@ -108,7 +108,7 @@ if (isset($_GET["m"]) && isset($_GET["y"])) if ($qualified) { //print $_GET["cm"].",".$_GET["sd"].",".$_GET["m"].",".$_GET["y"];exit; - displayBox($_GET["sd"],$_GET["m"],$_GET["y"]); + displayBox(GETPOST("sd",'alpha'),GETPOST("m",'int'),GETPOST("y",'int')); } else { diff --git a/htdocs/core/filemanagerdol/connectors/php/io.php b/htdocs/core/filemanagerdol/connectors/php/io.php index 731509b6e10..77c8c3ec253 100644 --- a/htdocs/core/filemanagerdol/connectors/php/io.php +++ b/htdocs/core/filemanagerdol/connectors/php/io.php @@ -44,7 +44,7 @@ function GetResourceTypePath($resourceType, $sCommand) { global $Config ; - if ( $sCommand == "QuickUpload") + if ($sCommand == "QuickUpload") return $Config['QuickUploadPath'][$resourceType] ; else return $Config['FileTypesPath'][$resourceType] ; @@ -60,7 +60,7 @@ function GetResourceTypePath($resourceType, $sCommand) function GetResourceTypeDirectory($resourceType, $sCommand) { global $Config ; - if ( $sCommand == "QuickUpload") + if ($sCommand == "QuickUpload") { if ( strlen($Config['QuickUploadAbsolutePath'][$resourceType]) > 0) return $Config['QuickUploadAbsolutePath'][$resourceType] ; @@ -299,7 +299,7 @@ function IsAllowedCommand($sCommand) { global $Config ; - if ( !in_array($sCommand, $Config['ConfigAllowedCommands'])) + if (! in_array($sCommand, $Config['ConfigAllowedCommands'])) return false ; return true ; @@ -315,7 +315,7 @@ function GetCurrentFolder() if (!isset($_GET)) { global $_GET; } - $sCurrentFolder = isset( $_GET['CurrentFolder'] ) ? $_GET['CurrentFolder'] : '/' ; + $sCurrentFolder = isset( $_GET['CurrentFolder'] ) ? GETPOST('CurrentFolder', '', 1) : '/' ; // Check the current folder syntax (must begin and start with a slash). if (!preg_match('|/$|', $sCurrentFolder)) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 082177b5cbc..668c43808ea 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -321,10 +321,20 @@ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL) * This prefix is unique for instance and avoid conflict between multi-instances, * even when having two instances with one root dir or two instances in virtual servers * + * @param string $mode '' or 'email' * @return string A calculated prefix */ -function dol_getprefix() +function dol_getprefix($mode='') { + global $conf; + + // If MAIL_PREFIX_FOR_EMAIL_ID is set and prefix is for email + if ($mode == 'email' && ! empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) + { + if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID; + else if (isset($_SERVER["SERVER_NAME"])) return $_SERVER["SERVER_NAME"]; + } + if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) { return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT); @@ -5246,7 +5256,7 @@ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id') $sql = "SELECT ".$fieldid." as valuetoget"; $sql.= " FROM ".MAIN_DB_PREFIX.$tablename; - $sql.= " WHERE ".$fieldkey." = '".$key."'"; + $sql.= " WHERE ".$fieldkey." = '".$db->escape($key)."'"; dol_syslog('dol_getIdFromCode', LOG_DEBUG); $resql = $db->query($sql); if ($resql) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 08ae59d0924..3e3ec91dd60 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -54,6 +54,9 @@ class ImportCsv extends ModeleImports var $cacheconvert=array(); // Array to cache list of value found after a convertion var $cachefieldtable=array(); // Array to cache list of value found into fields@tables + + var $nbinsert = 0; // # of insert done during the import + var $nbupdate = 0; // # of update done during the import /** @@ -266,9 +269,10 @@ class ImportCsv extends ModeleImports * @param Object $objimport Object import (contains objimport->array_import_tables, objimport->array_import_fields, objimport->array_import_convertvalue, ...) * @param int $maxfields Max number of fields to use * @param string $importid Import key + * @param array $updatekeys Array of keys to use to try to do update * @return int <0 if KO, >0 if OK */ - function import_insert($arrayrecord,$array_match_file_to_database,$objimport,$maxfields,$importid) + function import_insert($arrayrecord,$array_match_file_to_database,$objimport,$maxfields,$importid,$updatekeys) { global $langs,$conf,$user; global $thirdparty_static; // Specific to thirdparty import @@ -299,13 +303,15 @@ class ImportCsv extends ModeleImports else { $last_insert_id_array = array(); // store the last inserted auto_increment id for each table, so that dependent tables can be inserted with the appropriate id (eg: extrafields fk_object will be set with the last inserted object's id) + $updatedone = false; + $insertdone = false; // For each table to insert, me make a separate insert foreach($objimport->array_import_tables[0] as $alias => $tablename) { // Build sql request $sql=''; - $listfields=''; - $listvalues=''; + $listfields=array(); + $listvalues=array(); $i=0; $errorforthistable=0; @@ -539,36 +545,35 @@ class ImportCsv extends ModeleImports } // Define $listfields and $listvalues to build SQL request - if ($listfields) { $listfields.=', '; $listvalues.=', '; } - $listfields.=$fieldname; + $listfields[] = $fieldname; // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert - if (empty($newval) && $arrayrecord[($key-1)]['type'] < 0) $listvalues.=($newval=='0'?$newval:"null"); - elseif (empty($newval) && $arrayrecord[($key-1)]['type'] == 0) $listvalues.="''"; - else $listvalues.="'".$this->db->escape($newval)."'"; + if (empty($newval) && $arrayrecord[($key-1)]['type'] < 0) $listvalues[] = ($newval=='0'?$newval:"null"); + elseif (empty($newval) && $arrayrecord[($key-1)]['type'] == 0) $listvalues[] = "''"; + else $listvalues[] = "'".$this->db->escape($newval)."'"; } $i++; } // We add hidden fields (but only if there is at least one field to add into table) - if ($listfields && is_array($objimport->array_import_fieldshidden[0])) + if (!empty($listfields) && is_array($objimport->array_import_fieldshidden[0])) { // Loop on each hidden fields to add them into listfields/listvalues foreach($objimport->array_import_fieldshidden[0] as $key => $val) { if (! preg_match('/^'.preg_quote($alias).'\./', $key)) continue; // Not a field of current table - if ($listfields) { $listfields.=', '; $listvalues.=', '; } if ($val == 'user->id') { - $listfields.=preg_replace('/^'.preg_quote($alias).'\./','',$key); - $listvalues.=$user->id; + $listfields[] = preg_replace('/^'.preg_quote($alias).'\./','',$key); + $listvalues[] = $user->id; } elseif (preg_match('/^lastrowid-/',$val)) { $tmp=explode('-',$val); $lastinsertid=(isset($last_insert_id_array[$tmp[1]]))?$last_insert_id_array[$tmp[1]]:0; - $listfields.=preg_replace('/^'.preg_quote($alias).'\./','',$key); - $listvalues.=$lastinsertid; + $keyfield = preg_replace('/^'.preg_quote($alias).'\./','',$key); + $listfields[] = $keyfield; + $listvalues[] = $lastinsertid; //print $key."-".$val."-".$listfields."-".$listvalues."
";exit; } } @@ -578,47 +583,114 @@ class ImportCsv extends ModeleImports // If no error for this $alias/$tablename, we have a complete $listfields and $listvalues that are defined if (! $errorforthistable) { - //print "$alias/$tablename/$listfields/$listvalues
"; - if ($listfields) + //print "$alias/$tablename/$listfields/$listvalues
"; + if (!empty($listfields)) { - //var_dump($objimport->array_import_convertvalue); exit; - - // Build SQL request - if (empty($tablewithentity_cache[$tablename])) - { - $sql ='INSERT INTO '.$tablename.'('.$listfields.', import_key'; - if (! empty($objimport->array_import_tables_creator[0][$alias])) $sql.=', '.$objimport->array_import_tables_creator[0][$alias]; - $sql.=') VALUES('.$listvalues.", '".$importid."'"; - } - else - { - $sql ='INSERT INTO '.$tablename.'('.$listfields.', import_key, entity'; - if (! empty($objimport->array_import_tables_creator[0][$alias])) $sql.=', '.$objimport->array_import_tables_creator[0][$alias]; - $sql.=') VALUES('.$listvalues.", '".$importid."', ".$conf->entity ; - } - if (! empty($objimport->array_import_tables_creator[0][$alias])) $sql.=', '.$user->id; - $sql.=')'; - dol_syslog("import_csv.modules", LOG_DEBUG); - - //print '> '.join(',',$arrayrecord); - //print 'sql='.$sql; - //print '
'."\n"; - - // Run insert request - if ($sql) - { - $resql=$this->db->query($sql); - $last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that dependent tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr). - if ($resql) - { - //print '.'; + $updatedone = false; + $insertdone = false; + if(!empty($updatekeys)) { + // We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields) + if(empty($lastinsertid)) { + $sqlSelect = 'SELECT rowid FROM '.$tablename; + + $data = array_combine($listfields, $listvalues); + $where = array(); + $filters = array(); + foreach ($updatekeys as $key) { + $col = $objimport->array_import_updatekeys[0][$key]; + $key=preg_replace('/^.*\./i','',$key); + $where[] = $key.' = '.$data[$key]; + $filters[] = $col.' = '.$data[$key]; + } + $sqlSelect.= ' WHERE '.implode(' AND ', $where); + + $resql=$this->db->query($sqlSelect); + if($resql) { + $res = $this->db->fetch_object($resql); + if($resql->num_rows == 1) { + $lastinsertid = $res->rowid; + $last_insert_id_array[$tablename] = $lastinsertid; + } else if($resql->num_rows > 1) { + $this->errors[$error]['lib']=$langs->trans('MultipleRecordFoundWithTheseFilters', implode($filters, ', ')); + $this->errors[$error]['type']='SQL'; + $error++; + } else { + // No record found with filters, insert will be tried below + } + } + else + { + //print 'E'; + $this->errors[$error]['lib']=$this->db->lasterror(); + $this->errors[$error]['type']='SQL'; + $error++; + } } - else + + if(!empty($lastinsertid)) { + // Build SQL UPDATE request + $sqlstart = 'UPDATE '.$tablename; + + $data = array_combine($listfields, $listvalues); + $set = array(); + foreach ($data as $key => $val) { + $set[] = $key.' = '.$val; + } + $sqlstart.= ' SET '.implode(', ', $set); + + if(empty($keyfield)) $keyfield = 'rowid'; + $sqlend = ' WHERE '.$keyfield.' = '.$lastinsertid; + + $sql = $sqlstart.$sqlend; + + // Run update request + $resql=$this->db->query($sql); + if($resql) { + // No error, update has been done. $this->db->db->affected_rows can be 0 if data hasn't changed + $updatedone = true; + } + else + { + //print 'E'; + $this->errors[$error]['lib']=$this->db->lasterror(); + $this->errors[$error]['type']='SQL'; + $error++; + } + } + } + + // Update not done, we do insert + if(!$error && !$updatedone) { + // Build SQL INSERT request + $sqlstart = 'INSERT INTO '.$tablename.'('.implode(', ', $listfields).', import_key'; + $sqlend = ') VALUES('.implode(', ', $listvalues).", '".$importid."'"; + if (! empty($tablewithentity_cache[$tablename])) { + $sqlstart.= ', entity'; + $sqlend.= ', '.$conf->entity; + } + if (! empty($objimport->array_import_tables_creator[0][$alias])) { + $sqlstart.= ', '.$objimport->array_import_tables_creator[0][$alias]; + $sqlend.=', '.$user->id; + } + $sql = $sqlstart.$sqlend.')'; + dol_syslog("import_csv.modules", LOG_DEBUG); + + // Run insert request + if ($sql) { - //print 'E'; - $this->errors[$error]['lib']=$this->db->lasterror(); - $this->errors[$error]['type']='SQL'; - $error++; + $resql=$this->db->query($sql); + $last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that dependent tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr). + if ($resql) + { + $insertdone = true; + } + else + { + //print 'E'; + $this->errors[$error]['lib']=$this->db->lasterror(); + $this->errors[$error]['type']='SQL'; + $error++; + } } } } @@ -630,6 +702,9 @@ class ImportCsv extends ModeleImports if ($error) break; } + + if($updatedone) $this->nbupdate++; + if($insertdone) $this->nbinsert++; } return 1; diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 4ff68ae8d6b..330349b0842 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -248,6 +248,7 @@ class modProduct extends DolibarrModules $this->import_regex_array[$r]=array('p.ref'=>'[^ ]','p.tosell'=>'^[0|1]$','p.tobuy'=>'^[0|1]$','p.fk_product_type'=>'^[0|1]$','p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','p.recuperableonly'=>'^[0|1]$'); $import_sample=array('p.ref'=>"PREF123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31','p.recuperableonly'=>'0 or 1'); $this->import_examplevalues_array[$r]=array_merge($import_sample,$import_extrafield_sample); + $this->import_updatekeys_array[$r]=array('p.ref'=>'Ref','p.barcode'=>'BarCode'); if (! empty($conf->fournisseur->enabled)) { @@ -276,6 +277,7 @@ class modProduct extends DolibarrModules 'sp.unitprice'=>'50', 'sp.remise_percent'=>'0' ); + $this->import_updatekeys_array[$r]=array('sp.fk_product'=>'ProductOrService','sp.ref_fourn'=>'SupplierRef'); } if (! empty($conf->global->PRODUIT_MULTIPRICES)) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 1943e3f7b20..b217d452a86 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -354,6 +354,7 @@ class modSociete extends DolibarrModules //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); $this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.fk_typent'=>'id@'.MAIN_DB_PREFIX.'c_typent','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'); $this->import_examplevalues_array[$r]=array('s.nom'=>"MyBigCompany",'s.status'=>"0 (closed) or 1 (active)",'s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(dol_now(),'%Y-%m-%d'),'s.code_client'=>'CU01-0001 or empty or "auto"','s.code_fournisseur'=>'SU01-0001 or empty or "auto"','s.address'=>"61 jump street",'s.zip'=>"123456",'s.town'=>"Big town",'s.fk_pays'=>'US, FR, DE...','s.phone'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.idprof5'=>"",'s.idprof6'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note_private'=>"This is an example of private note for record",'s.note_public'=>"This is an example of public note for record",'s.fk_typent'=>"2",'s.fk_effectif'=>"3","s.fk_forme_juridique"=>"1",'s.fk_prospectlevel'=>'PL_MEDIUM','s.fk_stcomm'=>'0','s.default_lang'=>'en_US','s.barcode'=>'123456789','s.datec'=>"2015-01-01 or 2015-01-01 12:30:00"); + $this->import_updatekeys_array[$r]=array('s.nom'=>'Name','s.code_client'=>'CustomerCode','s.code_fournisseur'=>'SupplierCode','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode'); // Import list of contact and attributes $r++; diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index 2ef81d6e8df..ae73347edfa 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -34,7 +34,7 @@ $langs->load("other"); $id=GETPOST('id','int'); $action=GETPOST('action','alpha'); $modulepart=GETPOST('modulepart','alpha')?GETPOST('modulepart','alpha'):'produit|service'; -$original_file = isset($_REQUEST["file"])?urldecode($_REQUEST["file"]):''; +$original_file = GETPOST("file"); $backtourl=GETPOST('backtourl'); $cancel=GETPOST("cancel"); diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index c87a243a1c3..30027560140 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -153,7 +153,7 @@ else { } } - echo $form->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1,1,$forceall); + echo $form->select_type_of_lines(isset($_POST["type"])?GETPOST("type",'alpha',2):-1,'type',1,1,$forceall); echo ''; @@ -253,25 +253,25 @@ else { multicurrency->enabled)) { $colspan++;?> - global->PRODUCT_USE_UNITS) @@ -281,7 +281,7 @@ else { print ''; } ?> - + situation_cycle_ref) { $coldisplay++; @@ -296,7 +296,7 @@ else { - "> + "> global->DISPLAY_MARGIN_RATES)) { - echo ''; + echo ''; $coldisplay++; } if (! empty($conf->global->DISPLAY_MARK_RATES)) { - echo ''; + echo ''; $coldisplay++; } } diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 74c6bdd4211..e684e3c2750 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -185,7 +185,7 @@ $coldisplay=-1; // We remove first td rights->margins->creer) { if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { - $margin_rate = (isset($_POST["np_marginRate"])?$_POST["np_marginRate"]:(($line->pa_ht == 0)?'':price($line->marge_tx))); + $margin_rate = (isset($_POST["np_marginRate"])?GETPOST("np_marginRate","alpha",2):(($line->pa_ht == 0)?'':price($line->marge_tx))); // if credit note, dont allow to modify margin if ($line->subprice < 0) echo ''; @@ -195,7 +195,7 @@ $coldisplay=-1; // We remove first td } elseif (! empty($conf->global->DISPLAY_MARK_RATES)) { - $mark_rate = (isset($_POST["np_markRate"])?$_POST["np_markRate"]:price($line->marque_tx)); + $mark_rate = (isset($_POST["np_markRate"])?GETPOST("np_markRate",'alpha',2):price($line->marque_tx)); // if credit note, dont allow to modify margin if ($line->subprice < 0) echo ''; diff --git a/htdocs/ecm/docdir.php b/htdocs/ecm/docdir.php index 26372b7994d..1b36d0433d1 100644 --- a/htdocs/ecm/docdir.php +++ b/htdocs/ecm/docdir.php @@ -117,8 +117,7 @@ if ($action == 'add' && $user->rights->ecm->setup) else { $langs->load("errors"); - setEventMessages($langs->trans($ecmdir->error), null, 'errors'); - setEventMessages($ecmdir->error, $ecmdir->errors, 'errors'); + setEventMessages($langs->trans($ecmdir->error), $ecmdir->errors, 'errors'); $action = 'create'; } } @@ -173,9 +172,7 @@ if ($action == 'create') print ''; print ''."\n"; - print ''."\n"; - - print '
tva_assuj == "0") echo ''.vatrate(0, true); - else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?$_POST["tva_tx"]:-1), $seller, $buyer, 0, 0, '', false, 1); + else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?GETPOST("tva_tx",'alpha',2):-1), $seller, $buyer, 0, 0, '', false, 1); ?> - "> + "> - "> + "> - "> + "> "> + "> remise_percent); ?>">%remise_percent); ?>">% %%%%'.$margin_rate.'%'.$mark_rate.'%

'; + print ''; dol_fiche_end(); diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 8236693f37f..18157ee60ba 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -494,7 +494,7 @@ if ($action == 'delete_section') if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$action) || $action == 'delete') { - print ''."\n"; + print '
'."\n"; print ''."\n"; print ''."\n"; @@ -721,6 +721,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti $mode='noajax'; +$url=DOL_URL_ROOT.'/ecm/index.php'; include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php'; diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index 8964f3b0534..5119c66194a 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -480,7 +480,7 @@ if ($action == 'delete_section') if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$action) || $action == 'delete') { - print '
'."\n"; + print '
'."\n"; print ''."\n"; print ''."\n"; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 7206dc532a5..a2f8e54bf6b 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1350,10 +1350,10 @@ else print ''; } - print '
'; - $linkback = ''.$langs->trans("BackToList").''; + print '
'; + print ''; print ''; print ''; // Year print ''; // Ref supplier - print ''; + print ''; print ''; // Third party @@ -387,7 +387,7 @@ if ($action == 'create' && !$error) { print ''; print ''; print ''; + print ''; print ''; } print ''; print '
'.$langs->trans("User").''; @@ -1564,12 +1564,6 @@ else print ''; - // Ref - /* - print '';*/ - // Author print ''; print ''; @@ -1586,7 +1580,7 @@ else print ''; print ''; print ''; print ''; if (! empty($conf->global->EXPENSEREPORT_ASK_PAYMENTMODE_ON_CREATION)) @@ -1596,13 +1590,6 @@ else print ''; print ''; } - // Status - /* - print ''; - print ''; - print ''; - print ''; - */ // Amount print ''; diff --git a/htdocs/expensereport/synchro_compta.php b/htdocs/expensereport/synchro_compta.php deleted file mode 100644 index eba616d2620..00000000000 --- a/htdocs/expensereport/synchro_compta.php +++ /dev/null @@ -1,216 +0,0 @@ - - * - * 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 . - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; -require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; - -$langs->load("companies"); -$langs->load("users"); -$langs->load("trips"); -$langs->load("banks"); - -$idAccount=isset($_GET["account"])?$_GET["account"]:$_POST["account"]; - -if ($_GET["action"] == 'confirm_ndf_to_account' && $_GET["confirm"] == "yes"): - - $idTrip = $_GET['idTrip']; - - $expensereport = new ExpenseReport($db); - $expensereport->fetch($idTrip,$user); - - $dateop = dol_mktime(12,0,0,$datePaiement[1],$datePaiement[2],$datePaiement[0]); - $operation = $expensereport->code_paiement; - $label = "Règlement ".$expensereport->ref; - $amount = - price2num($expensereport->total_ttc); - $num_chq = ''; - $cat1 = ''; - - $user = new User($db); - $user->fetch($user->id); - - $acct=new Account($db,$idAccount); - $insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user); - - if ($insertid > 0): - $sql = " UPDATE ".MAIN_DB_PREFIX."expensereport as d"; - $sql.= " SET integration_compta = 1, fk_bank_account = $idAccount"; - $sql.= " WHERE rowid = $idTrip"; - $resql=$db->query($sql); - if($result): - Header("Location: ".$_SERVER["PHP_SELF"]."?account=".$idAccount); - exit; - else: - dol_print_error($db); - endif; - else: - dol_print_error($db,$acct->error); - endif; -endif; - -if ($_GET["action"] == 'confirm_account_to_ndf' && $_GET["confirm"] == "yes"): - - $idTrip = $_GET['idTrip']; - - $expensereport = new ExpenseReport($db); - $expensereport->fetch($idTrip,$user); - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank"; - $sql.= " WHERE label LIKE '%".$expensereport->ref."%'"; - $resql=$db->query($sql); - if ($resql > 0): - $sql = " UPDATE ".MAIN_DB_PREFIX."expensereport as d"; - $sql.= " SET integration_compta = 0, fk_bank_account = 0"; - $sql.= " WHERE rowid = $idTrip"; - $resql=$db->query($sql); - if($result): - Header("Location: ".$_SERVER["PHP_SELF"]."?account=".$idAccount); - exit; - else: - dol_print_error($db); - endif; - else: - dol_print_error($db); - endif; -endif; - - -/* - * Actions - */ - -llxHeader(); - -$html = new Form($db); - -$submit = isset($_POST['submit'])?true:false; -$idAccount=isset($_GET["account"])?$_GET["account"]:$_POST["account"]; - -print load_fiche_titre($langs->trans("TripSynch")); - - -dol_fiche_head(''); - - -if ($_GET["action"] == 'ndfTOaccount'): - $idTrip = $_GET['idTrip']; - $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?idTrip=".$idTrip."&account=".$idAccount,$langs->trans("ndfToAccount"),$langs->trans("ConfirmNdfToAccount"),"confirm_ndf_to_account","","",1); - if ($ret == 'html') print '
'; -endif; - -if ($_GET["action"] == 'accountTOndf'): - $idTrip = $_GET['idTrip']; - $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?idTrip=".$idTrip."&account=".$idAccount,$langs->trans("AccountToNdf"),$langs->trans("ConfirmAccountToNdf"),"confirm_account_to_ndf","","",1); - if ($ret == 'html') print '
'; -endif; - -if(empty($submit) && empty($idAccount)): - - print "
"; - print 'Choix du compte  '; - print $html->select_comptes($_POST['account'],'account',0,'',1); - print ' '; - print ""; - -else: - - print "
"; - print 'Choix du compte  '; - print $html->select_comptes($idAccount,'account',0,'',1); - print ' '; - print ""; - - $sql = "SELECT d.fk_bank_account, d.ref, d.rowid, d.date_valid, d.fk_user_author, d.total_ttc, d.integration_compta, d.fk_statut"; - $sql.= " ,CONCAT(u.firstname,' ',u.lastname) as declarant_NDF"; - $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d"; - $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON d.fk_user_author = u.rowid"; - $sql.= " WHERE d.fk_statut = 6"; - $sql.= ' AND d.entity IN ('.getEntity('expensereport', 1).')'; - $sql.= " ORDER BY d.date_valid DESC"; - - $resql=$db->query($sql); - if ($resql): - $num = $db->num_rows($resql); $i = 0; - if($num>0): - - $account=new Account($db); - $account->fetch($idAccount); - - print '
'; - - print "
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); - print '
'.$langs->trans("User").'
'.$langs->trans("Period").''; - print get_date_range($object->date_debut,$object->date_fin,'',$langs,0); + print get_date_range($object->date_debut,$object->date_fin,'day',$langs,0); print '
'.$object->libelle_paiement.'
'.$langs->trans("Statut").''.$object->getLibStatut(4).'
"; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - while($i<$num): - $objp = $db->fetch_object($resql); - $var=!$var; - print ''; - print ''; - print ''; - print ''; - print ''; - - if($objp->integration_compta) - { - print ''; - } - else - { - print ''; - } - - print ''; - - if($objp->integration_compta) - { - print ''; - } - else - { - print ''; - } - - print ""; - $i++; - endwhile; - - print "
'.$langs->trans("Ref").''.$langs->trans("DateValidation").''.$langs->trans("USER_AUTHOR").''.$langs->trans("TotalTTC").'ActionsCompteInt.
'.$objp->ref.''.dol_print_date($db->jdate($objp->date_valid),'day').''.img_object($langs->trans("ShowUser"),"user").' '.$objp->declarant_NDF.''.$objp->total_ttc.' '.$langs->trans("EURO").'Compte vers NDFNDF vers Compte'.$account->label.'Intégration OKIntégration Non OK
"; - - else: - print '
'.$langs->trans("NoTripToSync").'
'; - endif; - - $db->free($resql); - else: - dol_print_error($db); - endif; - -endif; - -dol_fiche_end(); - -llxFooter(); - -$db->close(); \ No newline at end of file diff --git a/htdocs/fichinter/class/fichinterstats.class.php b/htdocs/fichinter/class/fichinterstats.class.php index 1219a83d9e0..9fb17eb25f2 100644 --- a/htdocs/fichinter/class/fichinterstats.class.php +++ b/htdocs/fichinter/class/fichinterstats.class.php @@ -61,6 +61,7 @@ class FichinterStats extends Stats $this->userid = $userid; $this->cachefilesuffix = $mode; + $this->where.= " c.entity = ".$conf->entity; if ($mode == 'customer') { $object=new Fichinter($this->db); @@ -68,10 +69,8 @@ class FichinterStats extends Stats $this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl"; $this->field='0'; $this->field_line='0'; - $this->where.= " c.fk_statut > 0"; // Not draft and not cancelled + //$this->where.= " AND c.fk_statut > 0"; // Not draft and not cancelled } - //$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity; - $this->where.= " AND c.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; if ($this->socid) { diff --git a/htdocs/fichinter/stats/index.php b/htdocs/fichinter/stats/index.php index 5cdd7923cbd..c053239de1c 100644 --- a/htdocs/fichinter/stats/index.php +++ b/htdocs/fichinter/stats/index.php @@ -47,6 +47,8 @@ $year = GETPOST('year')>0?GETPOST('year'):$nowyear; $startyear=$year-1; $endyear=$year; +$object_status=GETPOST('object_status'); + $langs->load('interventions'); $langs->load('companies'); $langs->load('other'); @@ -58,6 +60,7 @@ $langs->load('suppliers'); */ $form=new Form($db); +$objectstatic=new FichInter($db); if ($mode == 'customer') { @@ -72,6 +75,7 @@ print load_fiche_titre($title,'','title_commercial.png'); dol_mkdir($dir); $stats = new FichinterStats($db, $socid, $mode, ($userid>0?$userid:0)); +if ($object_status != '' && $object_status > -1) $stats->where .= ' AND c.fk_statut IN ('.$object_status.')'; // Build graphic number of object $data = $stats->getNbByMonthWithPrevYear($endyear,$startyear); @@ -249,6 +253,12 @@ print '
'; // User print '
'.$langs->trans("CreatedBy").''; print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); + // Status + print '
'.$langs->trans("Status").''; + $liststatus=$objectstatic->statuts_short; + if (empty($conf->global->FICHINTER_CLASSIFY_BILLED)) unset($liststatus[2]); // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1 + print $form->selectarray('object_status', $liststatus, $object_status, 1, 0, 0, '', 1); + print '
'.$langs->trans("Year").''; if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year; diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 5ce08697913..2954b431708 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -154,6 +154,7 @@ if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption=0; if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey=''; if (empty($dolibarr_main_limit_users)) $dolibarr_main_limit_users=0; if (empty($dolibarr_mailing_limit_sendbyweb)) $dolibarr_mailing_limit_sendbyweb=0; +if (empty($dolibarr_mailing_limit_sendbycli)) $dolibarr_mailing_limit_sendbycli=0; if (empty($dolibarr_strict_mode)) $dolibarr_strict_mode=0; // For debug in php strict mode // TODO Multicompany Remove this. Useless. if (empty($multicompany_transverse_mode)) $multicompany_transverse_mode=0; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 34bc05a7d42..3e889ba263c 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -327,10 +327,10 @@ class CommandeFournisseur extends CommonOrder $line->product_label = $objp->product_label; $line->product_desc = $objp->product_desc; - $line->ref = $objp->product_ref; - $line->product_ref = $objp->product_ref; - $line->ref_fourn = $objp->ref_supplier; - $line->ref_supplier = $objp->ref_supplier; + $line->ref = $objp->product_ref; // Ref of product + $line->product_ref = $objp->product_ref; // Ref of product + $line->ref_fourn = $objp->ref_supplier; // The supplier ref of price when product was added. May have change since + $line->ref_supplier = $objp->ref_supplier; // The supplier ref of price when product was added. May have change since $line->date_start = $this->db->jdate($objp->date_start); $line->date_end = $this->db->jdate($objp->date_end); @@ -1160,7 +1160,7 @@ class CommandeFournisseur extends CommonOrder $this->lines[$i]->localtax2_tx, $this->lines[$i]->fk_product, 0, - $this->lines[$i]->ref_fourn, + $this->lines[$i]->ref_fourn, // $this->lines[$i]->ref_fourn comes from field ref into table of lines. Value may ba a ref that does not exists anymore, so we first try with value of product $this->lines[$i]->remise_percent, 'HT', 0, @@ -1322,7 +1322,7 @@ class CommandeFournisseur extends CommonOrder * @param float $txlocaltax2 Localtax2 tax * @param int $fk_product Id product * @param int $fk_prod_fourn_price Id supplier price - * @param string $fourn_ref Supplier reference + * @param string $fourn_ref Supplier reference price * @param float $remise_percent Remise * @param string $price_base_type HT or TTC * @param float $pu_ttc Unit price TTC @@ -1369,7 +1369,8 @@ class CommandeFournisseur extends CommonOrder $pu=$pu_ttc; } $desc=trim($desc); - + $ref_supplier=''; // Ref of supplier price when we add line + // Check parameters if ($qty < 1 && ! $fk_product) { @@ -1391,15 +1392,28 @@ class CommandeFournisseur extends CommonOrder $prod = new Product($this->db, $fk_product); if ($prod->fetch($fk_product) > 0) { - $result=$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, $fourn_ref); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$fourn_ref + $product_type = $prod->type; + $label = $prod->libelle; + + // We use 'none' instead of $fourn_ref, because fourn_ref may not exists anymore. So we will take the first supplier price ok. + // If we want a dedicated supplier price, we must provide $fk_prod_fourn_price. + $result=$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', $this->fk_soc); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$fourn_ref/$this->fk_soc if ($result > 0) { - $label = $prod->libelle; - $pu = $prod->fourn_pu; - $ref_supplier = $prod->ref_supplier; - $product_type = $prod->type; + $pu = $prod->fourn_pu; // Unit price supplier price set by get_buyprice + $ref_supplier = $prod->ref_supplier; // Ref supplier price set by get_buyprice } - if ($result == 0 || $result == -1) + if ($result == 0) // If result == 0, we failed to found the supplier reference price + { + $langs->load("errors"); + $this->error = "Ref " . $prod->ref . " " . $langs->trans("ErrorQtyTooLowForThisSupplier"); + $this->db->rollback(); + dol_syslog(get_class($this)."::addline we did not found supplier price, so we can't guess unit price"); + //$pu = $prod->fourn_pu; // We do not overwrite unit price + //$ref = $prod->ref_fourn; // We do not overwrite ref supplier price + return -1; + } + if ($result == -1) { $langs->load("errors"); $this->error = "Ref " . $prod->ref . " " . $langs->trans("ErrorQtyTooLowForThisSupplier"); @@ -2899,15 +2913,7 @@ class CommandeFournisseurLigne extends CommonOrderLine // From llx_product_fournisseur_price /** - * Supplier ref - * @var string - * @deprecated Use ref_supplier - * @see ref_supplier - */ - public $ref_fourn; - - /** - * Supplier reference + * Supplier reference of price when we added the line. May have been changed after line was added. * @var string */ public $ref_supplier; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 8137592b41d..29b52fe45c1 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2263,12 +2263,14 @@ class SupplierInvoiceLine extends CommonObjectLine * @var string */ public $product_ref; + /** - * Reference product supplier - * TODO Rename field ref to ref_supplier into table llx_facture_fourn_det and llx_commande_fournisseurdet and update fields it into updateline + * Supplier reference of price when we added the line. May have been changed after line was added. + * TODO Rename field ref to ref_supplier into table llx_facture_fourn_det and llx_commande_fournisseurdet and update fields into updateline * @var string */ public $ref_supplier; + /** * @deprecated * @see label diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index 89f0a942172..1f87cdf5929 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -108,7 +108,7 @@ if (($action == 'create' || $action == 'add') && ! $error) { $langs->load('products'); $langs->load('main'); if (isset($_GET['orders_to_invoice'])) { - $orders_id = $_GET['orders_to_invoice']; + $orders_id = GETPOST('orders_to_invoice','',1); $n = count($orders_id); $i = 0; @@ -116,7 +116,7 @@ if (($action == 'create' || $action == 'add') && ! $error) { $_GET['originid'] = $orders_id[0]; } if (isset($_POST['orders_to_invoice'])) { - $orders_id = $_POST['orders_to_invoice']; + $orders_id = GETPOST('orders_to_invoice','',1); $nn = count($orders_id); $ii = 0; @@ -149,10 +149,10 @@ if (($action == 'create' || $action == 'add') && ! $error) { $datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y")); } if (! $error) { - $object->ref = $_POST['ref']; - $object->ref_supplier = $_POST['ref_supplier']; - $object->socid = $_POST['socid']; - $object->libelle = $_POST['libelle']; + $object->ref = GETPOST('ref'); + $object->ref_supplier = GETPOST('ref_supplier'); + $object->socid = GETPOST('socid','int'); + $object->libelle = GETPOST('libelle'); $object->date = $datefacture; $object->date_echeance = $datedue; $object->note_public = GETPOST('note_public'); @@ -178,7 +178,7 @@ if (($action == 'create' || $action == 'add') && ! $error) { foreach ( $orders_id as $origin => $origin_id ) { $origin_id = (! empty($origin_id) ? $origin_id : $orders_id[$ii]); - $object->add_object_linked($_POST['origin'], $origin_id); + $object->add_object_linked(GETPOST('origin'), $origin_id); } while ( $ii < $nn ) { @@ -321,7 +321,7 @@ if ($action == 'create' && !$error) { print '
' . $langs->trans('Ref') . '' . $langs->trans('Draft') . '
' . $langs->trans('RefSupplier') . '
' . $langs->trans('RefSupplier') . '
' . $langs->trans('NotePublic') . ''; - print '
'."\n"; - print '

'; - + print ''; + print '
'; + print '
'; + + print '
'; + // Info workflow - print ''."\n"; + print '
'."\n"; print ''; - print ''; - print ''; - print ''; - if (! empty($cp->fk_user_create)) + if (! empty($object->fk_user_create)) { $userCreate=new User($db); - $userCreate->fetch($cp->fk_user_create); + $userCreate->fetch($object->fk_user_create); print ''; - print ''; + print ''; print ''; print ''; } if (!$edit) { print ''; - print ''; + print ''; print ''; print ''; } else { print ''; - print ''; + print ''; print ''; print ''; } print ''; print ''; - print ''; + print ''; print ''; - if ($cp->statut == 3) { + if ($object->statut == 3) { print ''; print ''; - print ''; + print ''; print ''; } - if ($cp->statut == 4) { + if ($object->statut == 4) { print ''; print ''; - print ''; + print ''; print ''; } - if ($cp->statut == 5) { + if ($object->statut == 5) { print ''; print ''; - print ''; + print ''; print ''; } print ''; print '
'.$langs->trans("InfosWorkflowCP").'
'.$langs->trans('RequestByCP').''.$langs->trans('RequestByCP').''.$userCreate->getNomUrl(-1).'
'.$langs->trans('ReviewedByCP').''.$langs->trans('ReviewedByCP').''.$valideur->getNomUrl(-1).'
'.$langs->trans('ReviewedByCP').''.$langs->trans('ReviewedByCP').''; - print $form->select_dolusers($cp->fk_user, "valideur", 1, ($user->admin ? '' : array($user->id))); // By default, hierarchical parent + print $form->select_dolusers($object->fk_user, "valideur", 1, ($user->admin ? '' : array($user->id))); // By default, hierarchical parent print '
'.$langs->trans('DateCreateCP').''.dol_print_date($cp->date_create,'dayhour').''.dol_print_date($object->date_create,'dayhour').'
'.$langs->trans('DateValidCP').''.dol_print_date($cp->date_valid,'dayhour').''.dol_print_date($object->date_valid,'dayhour').'
'.$langs->trans('DateCancelCP').''.dol_print_date($cp->date_cancel,'dayhour').''.dol_print_date($object->date_cancel,'dayhour').'
'.$langs->trans('DateRefusCP').''.dol_print_date($cp->date_refuse,'dayhour').''.dol_print_date($object->date_refuse,'dayhour').'
'; + print '
'; + print '
'; + print ''; + + print '
'; + dol_fiche_end(); - if ($action == 'edit' && $cp->statut == 1) + + if ($action == 'edit' && $object->statut == 1) { print '
'; - if ($canedit && $cp->statut == 1) + if ($canedit && $object->statut == 1) { print ''; } @@ -1185,28 +1189,28 @@ else print '
'; // Boutons d'actions - if ($canedit && $cp->statut == 1) + if ($canedit && $object->statut == 1) { - print ''.$langs->trans("EditCP").''; + print ''.$langs->trans("EditCP").''; } - if ($canedit && $cp->statut == 1) + if ($canedit && $object->statut == 1) { - print ''.$langs->trans("Validate").''; + print ''.$langs->trans("Validate").''; } - if ($user->rights->holiday->delete && $cp->statut == 1) // If draft + if ($user->rights->holiday->delete && $object->statut == 1) // If draft { - print ''.$langs->trans("DeleteCP").''; + print ''.$langs->trans("DeleteCP").''; } - if ($user->id == $cp->fk_validator && $cp->statut == 2) + if ($user->id == $object->fk_validator && $object->statut == 2) { - print ''.$langs->trans("Approve").''; - print ''.$langs->trans("ActionRefuseCP").''; + print ''.$langs->trans("Approve").''; + print ''.$langs->trans("ActionRefuseCP").''; } - if (($user->id == $cp->fk_validator || $user->id == $cp->fk_user) && ($cp->statut == 2 || $cp->statut == 3)) // Status validated or approved + if (($user->id == $object->fk_validator || $user->id == $object->fk_user) && ($object->statut == 2 || $object->statut == 3)) // Status validated or approved { - if (($cp->date_debut > dol_now()) || $user->admin) print ''.$langs->trans("ActionCancelCP").''; + if (($object->date_debut > dol_now()) || $user->admin) print ''.$langs->trans("ActionCancelCP").''; else print ''.$langs->trans("ActionCancelCP").''; } diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index dc9adcd7725..78bc1582a65 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -36,7 +36,8 @@ class Holiday extends CommonObject public $table_element='holiday'; protected $isnolinkedbythird = 1; // No field fk_soc protected $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + public $picto = 'holiday'; + /** * @deprecated * @see id @@ -785,7 +786,17 @@ class Holiday extends CommonObject if ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'),'statut5'); if ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'),'statut5'); } - + if ($mode == 6) + { + $pictoapproved='statut6'; + if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; + if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'),'statut0'); // Draft + if ($statut == 2) return $langs->trans('ToReviewCP').' '.img_picto($langs->trans('ToReviewCP'),'statut1'); // Waiting approval + if ($statut == 3) return $langs->trans('ApprovedCP').' '.img_picto($langs->trans('ApprovedCP'),$pictoapproved); + if ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'),'statut5'); + if ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'),'statut5'); + } + return $statut; } diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php index edc85ca0060..1d30e33f189 100644 --- a/htdocs/holiday/document.php +++ b/htdocs/holiday/document.php @@ -108,28 +108,29 @@ if ($object->id) } - print ''; - - $linkback=''.$langs->trans("BackToList").''; - + $linkback=''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref'); + + + print '
'; + //print '
'; + print '
'; + + print '
'; + print ''; - print ''; - print ''; - print ''; - - print ''; - print ''; + print ''; + print ''; // Type print ''; print ''; print ''; print ''; @@ -138,57 +139,52 @@ if ($object->id) if(!$edit) { - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; } else { - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; } if (!$edit) { - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; } else { - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; } print ''; print ''; print ''; print ''; - // Status - print ''; - print ''; - print ''; - print ''; if ($object->statut == 5) { print ''; @@ -200,25 +196,93 @@ if ($object->id) // Description if (!$edit) { - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; } else { - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; } print ''; print ''; + + print ''; + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref'); - print '
'.$langs->trans("User").''; - print $userRequest->getNomUrl(-1); - print '
'.$langs->trans("User").''; + print $userRequest->getNomUrl(-1, 'leave'); + print '
'.$langs->trans("Type").''; $typeleaves=$object->getTypes(1,-1); - print $typeleaves[$object->fk_type]['label']; + print empty($typeleaves[$object->fk_type]['label']) ? $langs->trans("TypeWasDisabledOrRemoved",$object->fk_type) : $typeleaves[$object->fk_type]['label']; print '
'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')'.dol_print_date($object->date_debut,'day'); - print '     '; - print $langs->trans($listhalfday[$starthalfday]); - print '
'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')'.dol_print_date($object->date_debut,'day'); + print '     '; + print $langs->trans($listhalfday[$starthalfday]); + print '
'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')'; - $form->select_date($object->date_debut,'date_debut_'); - print '     '; - print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday')?GETPOST('starthalfday'):$starthalfday)); - print '
'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')'; + $form->select_date($object->date_debut,'date_debut_'); + print '     '; + print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday')?GETPOST('starthalfday'):$starthalfday)); + print '
'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')'.dol_print_date($object->date_fin,'day'); - print '     '; - print $langs->trans($listhalfday[$endhalfday]); - print '
'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')'.dol_print_date($object->date_fin,'day'); + print '     '; + print $langs->trans($listhalfday[$endhalfday]); + print '
'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')'; - $form->select_date($object->date_fin,'date_fin_'); - print '     '; - print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday')?GETPOST('endhalfday'):$endhalfday)); - print '
'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')'; + $form->select_date($object->date_fin,'date_fin_'); + print '     '; + print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday')?GETPOST('endhalfday'):$endhalfday)); + print '
'.$langs->trans('NbUseDaysCP').''.num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday).'
'.$langs->trans('StatutCP').''.$object->getLibStatut(2).'
'.$langs->trans('DescCP').''.nl2br($object->description).'
'.$langs->trans('DescCP').''.nl2br($object->description).'
'.$langs->trans('DescCP').'
'.$langs->trans('DescCP').'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'."\n"; +/* + print '
'; + print '
'; + print '
'; + + print '
'; + + // Info workflow + print ''."\n"; + print ''; + if (! empty($object->fk_user_create)) + { + $userCreate=new User($db); + $userCreate->fetch($object->fk_user_create); + print ''; + print ''; + print ''; + print ''; + } + + if (!$edit) { + print ''; + print ''; + print ''; + print ''; + } else { + print ''; + print ''; + print ''; + print ''; + } + + print ''; + print ''; + print ''; + print ''; + if ($object->statut == 3) { + print ''; + print ''; + print ''; + print ''; + } + if ($object->statut == 4) { + print ''; + print ''; + print ''; + print ''; + } + if ($object->statut == 5) { + print ''; + print ''; + print ''; + print ''; + } + print ''; print '
'.$langs->trans('RequestByCP').''.$userCreate->getNomUrl(-1).'
'.$langs->trans('ReviewedByCP').''.$valideur->getNomUrl(-1).'
'.$langs->trans('ReviewedByCP').''; + print $form->select_dolusers($object->fk_user, "valideur", 1, ($user->admin ? '' : array($user->id))); // By default, hierarchical parent + print '
'.$langs->trans('DateCreateCP').''.dol_print_date($object->date_create,'dayhour').'
'.$langs->trans('DateValidCP').''.dol_print_date($object->date_valid,'dayhour').'
'.$langs->trans('DateCancelCP').''.dol_print_date($object->date_cancel,'dayhour').'
'.$langs->trans('DateRefusCP').''.dol_print_date($object->date_refuse,'dayhour').'
'; + print '
'; + print '
'; */ + print '
'; + + print '
'; + dol_fiche_end(); + + $modulepart = 'holiday'; $permission = $user->rights->holiday->write; diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index 254628b38fa..828e0f53719 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -38,6 +38,7 @@ class Import var $array_import_fieldshidden; var $array_import_entities; var $array_import_regex; + var $array_import_updatekeys; var $array_import_examplevalues; var $array_import_convertvalue; var $array_import_run_sql_after; @@ -153,6 +154,8 @@ class Import $this->array_import_entities[$i]=$module->import_entities_array[$r]; // Tableau des alias a exporter (cle=champ, valeur=alias) $this->array_import_regex[$i]=$module->import_regex_array[$r]; + // Array of columns allowed as UPDATE options + $this->array_import_updatekeys[$i]=$module->import_updatekeys_array[$r]; // Array of examples $this->array_import_examplevalues[$i]=$module->import_examplevalues_array[$r]; // Tableau des regles de conversion d'une valeur depuis une autre source (cle=champ, valeur=tableau des regles) diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index ec49f8e450a..21348a5c948 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -76,7 +76,8 @@ $import_name = GETPOST('import_name'); $hexa = GETPOST('hexa'); $importmodelid = GETPOST('importmodelid'); $excludefirstline = (GETPOST('excludefirstline') ? GETPOST('excludefirstline') : 1); -$endatlinenb = (GETPOST('endatlinenb') ? GETPOST('endatlinenb') : ''); +$endatlinenb = (GETPOST('endatlinenb') ? GETPOST('endatlinenb') : ''); +$updatekeys = (GETPOST('updatekeys') ? GETPOST('updatekeys') : array()); $separator = (GETPOST('separator') ? GETPOST('separator') : (! empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE)?$conf->global->IMPORT_CSV_SEPARATOR_TO_USE:',')); $enclosure = (GETPOST('enclosure') ? GETPOST('enclosure') : '"'); @@ -1184,8 +1185,9 @@ if ($step == 5 && $datatoimport) $param='&leftmenu=import&format='.$format.'&datatoimport='.$datatoimport.'&filetoimport='.urlencode($filetoimport).'&nboflines='.$nboflines.'&separator='.urlencode($separator).'&enclosure='.urlencode($enclosure); $param2 = $param; // $param2 = $param without excludefirstline and endatlinenb - if ($excludefirstline) $param.='&excludefirstline='.$excludefirstline; - if ($endatlinenb) $param.='&endatlinenb='.$endatlinenb; + if ($excludefirstline) $param.='&excludefirstline='.$excludefirstline; + if ($endatlinenb) $param.='&endatlinenb='.$endatlinenb; + if (!empty($updatekeys)) $param.='&updatekeys[]='.implode('&updatekeys[]=', $updatekeys); llxHeader('',$langs->trans("NewImport"),'EN:Module_Imports_En|FR:Module_Imports|ES:Módulo_Importaciones'); @@ -1291,6 +1293,24 @@ if ($step == 5 && $datatoimport) } print ''; + print ''; + print $langs->trans("KeysToUseForUpdates"); + print ''; + if($action=='launchsimu') { + print $form->multiselectarray('updatekeysbis', $objimport->array_import_updatekeys[0], $updatekeys, 0, 0, '', 1, '', 'disabled'); + foreach($updatekeys as $val) { + print ''; + } + print '   '.$langs->trans("Modify").''; + } else { + print $form->multiselectarray('updatekeys', $objimport->array_import_updatekeys[0], $updatekeys, 0, 0, '', 1, '80%'); + print $form->textwithpicto("", $langs->trans("SelectColumnsOfYourFileForUpdateAttempt")); + } + /*echo '
';
+	print_r($objimport->array_import_updatekeys);
+	echo '
';*/ + print ''; + print ''; print '
'; @@ -1424,7 +1444,7 @@ if ($step == 5 && $datatoimport) if ($endatlinenb && ($sourcelinenb > $endatlinenb)) continue; // Run import - $result=$obj->import_insert($arrayrecord,$array_match_file_to_database,$objimport,count($fieldssource),$importid); + $result=$obj->import_insert($arrayrecord,$array_match_file_to_database,$objimport,count($fieldssource),$importid,$updatekeys); if (count($obj->errors)) $arrayoferrors[$sourcelinenb]=$obj->errors; if (count($obj->warnings)) $arrayofwarnings[$sourcelinenb]=$obj->warnings; @@ -1460,9 +1480,13 @@ if ($step == 5 && $datatoimport) $db->rollback(); // We force rollback because this was just a simulation. // Show OK - if (! count($arrayoferrors) && ! count($arrayofwarnings)) print '
'.img_picto($langs->trans("OK"),'tick').' '.$langs->trans("NoError").'


'; + if (! count($arrayoferrors) && ! count($arrayofwarnings)) { + print '
'.img_picto($langs->trans("OK"),'tick').' '.$langs->trans("NoError").'


'; + print $langs->trans("NbInsert", $obj->nbinsert).'
'; + print $langs->trans("NbUpdate", $obj->nbupdate).'

'; + } else print ''.$langs->trans("NbOfLinesOK",$nbok).'

'; - + // Show Errors //var_dump($arrayoferrors); if (count($arrayoferrors)) @@ -1778,7 +1802,7 @@ if ($step == 6 && $datatoimport) if ($endatlinenb && ($sourcelinenb > $endatlinenb)) continue; // Run import - $result=$obj->import_insert($arrayrecord,$array_match_file_to_database,$objimport,count($fieldssource),$importid); + $result=$obj->import_insert($arrayrecord,$array_match_file_to_database,$objimport,count($fieldssource),$importid,$updatekeys); if (count($obj->errors)) $arrayoferrors[$sourcelinenb]=$obj->errors; if (count($obj->warnings)) $arrayofwarnings[$sourcelinenb]=$obj->warnings; @@ -1824,7 +1848,9 @@ if ($step == 6 && $datatoimport) // Show result print '
'; print '
'; - print $langs->trans("NbOfLinesImported",$nbok).'

'; + print $langs->trans("NbOfLinesImported",$nbok).'
'; + print $langs->trans("NbInsert", $obj->nbinsert).'
'; + print $langs->trans("NbUpdate", $obj->nbupdate).'

'; print $langs->trans("FileWasImported",$importid).'
'; print $langs->trans("YouCanUseImportIdToFindRecord",$importid).'
'; print '
'; diff --git a/htdocs/install/default.css b/htdocs/install/default.css index 76a71e079d8..4d1f9259813 100644 --- a/htdocs/install/default.css +++ b/htdocs/install/default.css @@ -1,5 +1,5 @@ -/* Copyright (C) 2004 Rodolphe Quiedeville - * Copyright (C) 2009 Laurent Destailleur +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2009-2016 Laurent Destailleur * * 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 @@ -13,9 +13,50 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * */ +.minwidth100 { min-width: 100px; } +.minwidth200 { min-width: 200px; } +.minwidth300 { min-width: 300px; } +.minwidth400 { min-width: 400px; } +.minwidth500 { min-width: 500px; } +.minwidth50imp { min-width: 50px !important; } +.minwidth100imp { min-width: 100px !important; } +.minwidth200imp { min-width: 200px !important; } +.minwidth300imp { min-width: 300px !important; } +.minwidth400imp { min-width: 400px !important; } +.minwidth500imp { min-width: 500px !important; } + +/* Force values for small screen 570 */ +@media only screen and (max-width: 570px) +{ + input, input[type=text], input[type=password], select, textarea { + min-width: 20px; + min-height: 1.4em; + line-height: 1.4em; + padding: .4em .1em; + border: 1px solid #BBB; + /* max-width: inherit; why this ? */ + } + + .hideonsmartphone { display: none; } + .noenlargeonsmartphone { width : 50px !important; display: inline !important; } + .maxwidthonsmartphone { max-width: 100px; } + .maxwidth50onsmartphone { max-width: 40px; } + .maxwidth75onsmartphone { max-width: 50px; } + .maxwidth100onsmartphone { max-width: 70px; } + .maxwidth150onsmartphone { max-width: 120px; } + .maxwidth200onsmartphone { max-width: 200px; } + .maxwidth300onsmartphone { max-width: 300px; } + .maxwidth400onsmartphone { max-width: 400px; } + .minwidth50imp { min-width: 50px !important; } + .minwidth100imp { min-width: 50px !important; } + .minwidth200imp { min-width: 50px !important; } + .minwidth300imp { min-width: 50px !important; } + .minwidth400imp { min-width: 50px !important; } + .minwidth500imp { min-width: 50px !important; } +} + body { font-size:13px; font-family: Verdana, Arial, Helvetica, Tahoma, sans-serif; @@ -94,6 +135,11 @@ input:focus, textarea:focus, button:focus, select:focus { } input[type=text], input[type=password] { border: 1px solid #ACBCBB; + padding: 4px; +} +select { + padding: 4px; + background-color: #fff; } input[type=text]:focus, input[type=password]:focus, textarea:focus, select:focus { border: 1px solid #ACBCBB; @@ -244,12 +290,11 @@ td.comment { padding: 5px 5px 5px 5px; margin: 0 0 0 0; text-decoration:none; - font-size: 11px; + font-size: 12px; border-bottom: 1px solid #CCCCDB; } - table { - font-size: 12px; + font-size: 13px; } .install diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 3f597c794d1..73357faa5db 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -127,7 +127,7 @@ if (! empty($force_install_message)) ?> - trans("Server"); ?> + trans("DatabaseServer"); ?> '."\n"; - print '
'."\n"; + print ''."\n"; print ''."\n"; print ''."\n"; diff --git a/htdocs/install/mysql/data/llx_c_payment_term.sql b/htdocs/install/mysql/data/llx_c_payment_term.sql index a444bfbc466..783bf1e0daf 100644 --- a/htdocs/install/mysql/data/llx_c_payment_term.sql +++ b/htdocs/install/mysql/data/llx_c_payment_term.sql @@ -27,7 +27,7 @@ -- de l'install et tous les sigles '--' sont supprimés. -- -insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (1,'RECEP', 1,1, 'A réception de facture','Réception de facture',0,1); +insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (1,'RECEP', 1,1, 'Due Upon Receipt','Due Upon Receipt',0,1); insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (2,'30D', 2,1, '30 jours','Réglement à 30 jours',0,30); insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (3,'30DENDMONTH', 3,1, '30 jours fin de mois','Réglement à 30 jours fin de mois',1,30); insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (4,'60D', 4,1, '60 jours','Réglement à 60 jours',0,60); diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql index 2fd59793a09..b94d289de31 100644 --- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql +++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql @@ -8,6 +8,7 @@ -- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); -- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; -- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To set a DEFAULT value: ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT (0|NULL|...); -- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; -- To drop an index: -- VMYSQL4.0 DROP INDEX nomindex on llx_table -- To drop an index: -- VPGSQL8.0 DROP INDEX nomindex @@ -19,7 +20,6 @@ -- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; -- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL; -- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL; --- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; -- Note: fields with type BLOB/TEXT can't have default value. -- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); @@ -32,6 +32,8 @@ UPDATE llx_const SET name = __ENCRYPT('THIRDPARTY_DEFAULT_CREATE_CONTACT')__ WHE ALTER TABLE llx_product_lot MODIFY COLUMN entity integer DEFAULT 1; UPDATE llx_product_lot SET entity = 1 WHERE entity IS NULL; +ALTER TABLE llx_societe ALTER COLUMN fk_stcomm SET DEFAULT 0; + ALTER TABLE llx_c_actioncomm ADD COLUMN picto varchar(48); ALTER TABLE llx_facturedet ADD INDEX idx_facturedet_fk_code_ventilation (fk_code_ventilation); diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 1e4a745621c..f16fdf25413 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -333,8 +333,8 @@ DateIsNotEnough=Date not reached yet InvoiceGeneratedFromTemplate=Invoice %s generated from recurring template invoice %s # PaymentConditions Statut=Status -PaymentConditionShortRECEP=Immediate -PaymentConditionRECEP=Immediate +PaymentConditionShortRECEP=Due Upon Receipt +PaymentConditionRECEP=Due Upon Receipt PaymentConditionShort30D=30 days PaymentCondition30D=30 days PaymentConditionShort30DENDMONTH=30 days of month-end diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang index f235bfef3cc..7c95f12a30d 100644 --- a/htdocs/langs/en_US/exports.lang +++ b/htdocs/langs/en_US/exports.lang @@ -120,3 +120,8 @@ SelectFilterFields=If you want to filter on some values, just input values here. FilteredFields=Filtered fields FilteredFieldsValues=Value for filter FormatControlRule=Format control rule +## imports updates +KeysToUseForUpdates=Key to use for updating data +NbInsert=Number of inserted lines: %s +NbUpdate=Number of updated lines: %s +MultipleRecordFoundWithTheseFilters=Multiple records have been found with these filters: %s \ No newline at end of file diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 38dc854b5f9..7933be96aba 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -78,6 +78,7 @@ ManualUpdate=Manual update HolidaysCancelation=Leave request cancelation EmployeeLastname=Employee lastname EmployeeFirstname=Employee firstname +TypeWasDisabledOrRemoved=Leave type (id %s) was disabled or removed ## Configuration du Module ## LastUpdateCP=Latest automatic update of leaves allocation diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 83a344623aa..b9677805dcd 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -88,9 +88,10 @@ MailNoChangePossible=Recipients for validated emailing can't be changed SearchAMailing=Search mailing SendMailing=Send emailing SendMail=Send email -MailingNeedCommand=For security reason, sending an emailing is better when performed from command line. If you have one, ask your server administrator to launch the following command to send the emailing to all recipients: +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: 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 can't or prefer sending them with your www browser, please confirm you are sure you want to send emailing now from your browser? +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. TargetsReset=Clear list ToClearAllRecipientsClickHere=Click here to clear the recipient list for this emailing diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 245f6f3ccc0..e1c0e859ea6 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -45,7 +45,7 @@ MemberStatusDraft=Draft (needs to be validated) MemberStatusDraftShort=Draft MemberStatusActive=Validated (waiting subscription) MemberStatusActiveShort=Validated -MemberStatusActiveLate=subscription expired +MemberStatusActiveLate=Subscription expired MemberStatusActiveLateShort=Expired MemberStatusPaid=Subscription up to date MemberStatusPaidShort=Up to date diff --git a/htdocs/langs/en_US/trips.lang b/htdocs/langs/en_US/trips.lang index 900b424f3e7..9cb992f6af3 100644 --- a/htdocs/langs/en_US/trips.lang +++ b/htdocs/langs/en_US/trips.lang @@ -59,31 +59,23 @@ DATE_REFUS=Deny date DATE_SAVE=Validation date DATE_CANCEL=Cancelation date DATE_PAIEMENT=Payment date - BROUILLONNER=Reopen ValidateAndSubmit=Validate and submit for approval ValidatedWaitingApproval=Validated (waiting for approval) - NOT_AUTHOR=You are not the author of this expense report. Operation cancelled. - ConfirmRefuseTrip=Are you sure you want to deny this expense report? - ValideTrip=Approve expense report ConfirmValideTrip=Are you sure you want to approve this expense report? - PaidTrip=Pay an expense report ConfirmPaidTrip=Are you sure you want to change status of this expense report to "Paid"? - ConfirmCancelTrip=Are you sure you want to cancel this expense report? - BrouillonnerTrip=Move back expense report to status "Draft" ConfirmBrouillonnerTrip=Are you sure you want to move this expense report to status "Draft"? - SaveTrip=Validate expense report ConfirmSaveTrip=Are you sure you want to validate this expense report? - NoTripsToExportCSV=No expense report to export for this period. ExpenseReportPayment=Expense report payment - ExpenseReportsToApprove=Expense reports to approve ExpenseReportsToPay=Expense reports to pay +CloneExpenseReport=Clone expese report +ConfirmCloneExpenseReport=Are you sure you want to clone this expense report ? \ No newline at end of file diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 3a9ef61d7ec..e07ef156124 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -89,7 +89,6 @@ function test_sql_and_script_inject($val, $type) $sql_inj += preg_match('/union.+select/i', $val); $sql_inj += preg_match('/into\s+(outfile|dumpfile)/i', $val); $sql_inj += preg_match('/(\.\.%2f)+/i', $val); - $sql_inj += preg_match('/onerror=/i', $val); } // For XSS Injection done by adding javascript with script // This is all cases a browser consider text is javascript: @@ -98,7 +97,8 @@ function test_sql_and_script_inject($val, $type) $sql_inj += preg_match('/