diff --git a/COPYRIGHT b/COPYRIGHT index 5f7929499a8..3872a12729d 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -22,14 +22,15 @@ FPDF_TPL 1.1.5 Apache Software License 2.0 No GPL3 only PDF temp FPDI 1.3.4 Apache Software License 2.0 No GPL3 only PDF templates management FPDI_Protection 1.0.3 Apache Software License 2.0 No GPL3 only PDF encryption (8 files) GeoIP x.x Yes GeoIP Maxmind conversion -JCrop 0.9.8 MIT Licence Yes JS library (to crop images) jQuery 1.6.1 GPL and MIT Licence Yes JS library jQuery UI 1.8.14 GPL and MIT Licence Yes JS library plugin UI +jQuery JCrop 0.9.8 MIT Licence Yes JS library plugin Crop (to crop images) jQuery Layout 1.3.0 GPL and MIT Licence Yes JS library plugin Layout (RC-29.12) jQuery TableDnD 0.5 GPL and MIT Licence Yes JS library plugin TableDnD (to reorder table rows) jQuery jNotify 1.1.00 Apache Software License 2.0 No GPL3 only JS library plugin jNotify (to use ajax popups) jQuery Mobile 1.0b1 GPL and MIT Licence Yes JS library for smartphone (not used) -JSGantt 1.2 BSD Licence Yes JS library (ot build Gantt reports) +jQuery Tiptip 1.3 GPL and MIT Licence Yes JS library for tooltips +JSGantt 1.2 BSD Licence Yes JS library (to build Gantt reports) MagPieRss 0.72 GPL 2.0 Yes Load RSS NuSoap 0.9.5 LGPL 2.1 Yes Interfaces with third tools OdtPHP 1.0.1 GPL 2.0 Yes Library to build/edit ODT files diff --git a/ChangeLog b/ChangeLog index 951361e26b3..ae46b071d03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,31 +1,31 @@ -------------------------------------------------------------- English Dolibarr ChangeLog -$Id: ChangeLog,v 1.420 2011/06/29 22:42:42 eldy Exp $ +$Id: ChangeLog,v 1.421 2011/07/02 11:28:03 eldy Exp $ -------------------------------------------------------------- ***** ChangeLog for 3.1 compared to 3.0 ***** For users: - New: War against number of clicks: - - When adding a free bank transaction, form to add next one is still - visible (save one click). - - task #10969 : Add checkbox to close automatically invoice if - payment is complete (save 3 clicks). - - Reduce a step into supplier order workflow to save time. If user - has permission to approve, order is approved when order is validated. - (Save 2 clicks). - - In commercial main menu, left menu are already opened. This save one click - to open a proposal or order. - - Can add a discount for third party, during invoice edition (and we - saved clicks again). - - When creating a contract, sales representative are preset to user. This save - 4 clicks. - - Can edit several fields in bank transaction line page into one update. - - Creation of contacts from third party page go back to third party. - - Preselect model if there is only one. This save 2 clicks. + - When adding a free bank transaction, form to add next one is still + visible (save one click). + - task #10969 : Add checkbox to close automatically invoice if + payment is complete (save 3 clicks). + - Reduce a step into supplier order workflow to save time. If user + has permission to approve, order is approved when order is validated. + (Save 2 clicks). + - In commercial main menu, left menu are already opened. This save one click + to open a proposal or order. + - Can add a discount for third party, during invoice edition (and we + saved clicks again). + - When creating a contract, sales representative are preset to user. This save + 4 clicks. + - Can edit several fields in bank transaction line page into one update. + - Creation of contacts from third party page go back to third party. + - Preselect model if there is only one. This save 2 clicks. + - Can remove a project if project has tasks. No need to delete task one by one. - New: Enhance donation module. Add a status "canceled". -- New: Add filters on statistics page reports. -- New: Usage of Jquery Notify to show result or error messages on action. -- New: If a service contains subproducts, subrpoducts are decrease when service +- New: Add filters on all statistics report pages. +- New: If a service contains subproducts, subpoducts are decrease when service is decrease. - New: Add status for third parties to disable a third party. - New: Can send interventions cards by email. @@ -34,14 +34,14 @@ For users: letters for names and firstname. - New: Can filter of payment type in bank transaction list. - New: Status of users is visible into user list. -- New: Support BSB code for bank account in australia. +- New: Support BSB code for bank account in Australia. - New: Can set date of payment for autocreate invoice/payment when creating a foundation subscription. - New: Can edit note of payment. -- New: Login is not mandatory in member module. +- New: Option to make login not mandatory in member module. - New: Add box for last members for foundation module. - New: A specialized menu can now be used when using smartphones. -- New: Can add information on current user on odt generation +- New: Can add information on current user on ODT generation. - New: Prefix on third party is not used by default. Hidden option SOCIETE_USEPREFIX can restore old feature. - New: Standing orders module use bank account from banks module. @@ -57,21 +57,23 @@ For users: - New: Add subscriptions/country/region/town statistics for member module. - New: Can define a proxy for external web access. - New: task #11003: checkbox on checks for deposit. -- New: Add status into export. Add default language into export. -- New: Can remove a project if project has tasks. +- New: Add status into export. Add third party default language into export. - New: Can filter on date and bank account when building check receipts. - New: Paypal module can show paypal list of transaction and convert one into an order. - New: task #10958 : Add link to cheque receipts into bank transaction line if exists - New: Can import external ical url into dolibarr agenda view. -- New: Minor look enhancements into agenda view. - New: Can add a logo on third parties card. - New: task #11194 : Can delete uploaded photos - New: task #9744 : Add the barcode to select products on Point of Sale module - New: Subscription/Unsubscription to mailman mailing-list can be done on validate/resiliate in foundation module. - New: Can use extrafields on third parties. +- New: Add chart to report counts by status on element home area pages. +- New: Look: Usage of Jquery Notify to show result or error messages on action. +- New: Look: Minor enhancements into agenda view. +- New: Look: Nicer tooltips with transparency and shadow. - Fix: Better Postgresql compatibility. - Fix: Numbering module for invoices use same number for invoice and credit note if mask is same. @@ -79,19 +81,19 @@ For users: For developers: - New: External modules can add tabs on agenda views. +- New: External modules can also remove default tabs. - New: External modules can force skin directory so force their own skins. - New: External modules can add their own menu manager. -- New: External modules can remove tabs. - New: External modules can force menu manager. - New: External modules can overwrite all default language files by forcing priority on langs directories on its own lang directory. - New: External modules can show export list with an "enabled" condition. -- New: Support a backtopage parameter on contact creation page -- New: Add id on div to show logo -- New: Install wizard can activate a module during install. +- New: Support a backtopage parameter on contact creation page. +- New: Add id on div to show logo. +- New: Install wizard can activate a module at end of install. - New: Dictionnary setup works with very large external dictionnaries (Add page navigation). -- New: Add function to draw graphics with javascript (using Jquery Flot). +- New: Add api to draw graphics with javascript (using Jquery Flot). - New: Can add user login into menu urls added by modules. For translators: diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 8c5ac745689..6f6bb746336 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -20,7 +20,7 @@ /** * \file htdocs/admin/mails.php * \brief Page to setup emails sending - * \version $Id$ + * \version $Id: mails.php,v 1.70 2011/07/02 16:48:31 eldy Exp $ */ require("../main.inc.php"); @@ -218,7 +218,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'sendhtml') if ($result) { - $message='
'.$langs->trans("MailSuccessfulySent",$email_from,$sendto).'
'; + $message='
'.$langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($email_from,2),$mailfile->getValidAddress($sendto,2)).'
'; } else { @@ -746,5 +746,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/02 16:48:31 $ - $Revision: 1.70 $'); ?> diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index e00a44ab5d8..687a5e9053d 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -21,7 +21,7 @@ * \file htdocs/comm/mailing/fiche.php * \ingroup mailing * \brief Fiche mailing, onglet general - * \version $Id$ + * \version $Id: fiche.php,v 1.121 2011/07/02 16:48:32 eldy Exp $ */ require("../../main.inc.php"); @@ -351,7 +351,7 @@ if ($_POST["action"] == 'send' && empty($_POST["cancel"])) $result=$mailfile->sendfile(); if ($result) { - $message='
'.$langs->trans("MailSuccessfulySent",$mil->email_from,$mil->sendto).'
'; + $message='
'.$langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($mil->email_from,2),$mailfile->getValidAddress($mil->sendto,2)).'
'; } else { @@ -1073,5 +1073,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.121 $'); ?> diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 27251fbc322..81169c18ab8 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -27,7 +27,7 @@ * \file htdocs/comm/propal.php * \ingroup propale * \brief Page of commercial proposals card and list - * \version $Id: propal.php,v 1.606 2011/06/30 13:27:21 hregis Exp $ + * \version $Id: propal.php,v 1.607 2011/07/02 16:48:32 eldy Exp $ */ require("../main.inc.php"); @@ -536,7 +536,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] $result=$mailfile->sendfile(); if ($result) { - $mesg=$langs->trans('MailSuccessfulySent',$from,$sendto); // Must not contain " + $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain " $error=0; @@ -1021,7 +1021,7 @@ if ($id > 0 || ! empty($ref)) /* * Show object in view mode */ - + dol_htmloutput_mesg($mesg,$mesgs); $object->fetch($id,$ref); @@ -1975,6 +1975,6 @@ else } $db->close(); -llxFooter('$Date: 2011/06/30 13:27:21 $ - $Revision: 1.606 $'); +llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.607 $'); ?> diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index c7fbc9163a3..896f166899b 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -26,7 +26,7 @@ * \file htdocs/commande/fiche.php * \ingroup commande * \brief Page to show customer order - * \version $Id: fiche.php,v 1.521 2011/06/30 13:27:21 hregis Exp $ + * \version $Id: fiche.php,v 1.523 2011/07/02 16:48:32 eldy Exp $ */ require("../main.inc.php"); @@ -90,7 +90,7 @@ if (! empty($object->hooks)) $reshook+=$module->doActions($object); if (! empty($module->error) || (! empty($module->errors) && sizeof($module->errors) > 0)) { - $mesg=$module->error; $mesgs[]=$module->errors; + $mesg=$module->error; $mesgs=$module->errors; if ($action=='add') $action='create'; if ($action=='update') $action='edit'; } @@ -1054,7 +1054,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P $result=$mailfile->sendfile(); if ($result) { - $mesg=$langs->trans('MailSuccessfulySent',$from,$sendto); // Must not contains " + $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contains " $error=0; @@ -2134,5 +2134,5 @@ else $db->close(); -llxFooter('$Date: 2011/06/30 13:27:21 $ - $Revision: 1.521 $'); +llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.523 $'); ?> diff --git a/htdocs/compta/ajaxpayment.php b/htdocs/compta/ajaxpayment.php new file mode 100644 index 00000000000..fa09707e543 --- /dev/null +++ b/htdocs/compta/ajaxpayment.php @@ -0,0 +1,83 @@ + + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/** + * \file htdocs/compta/ajaxpayment.php + * \brief File to return Ajax response on payment breakdown process + * \version ajaxpayment.php,v 1.0 + */ + +if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); +if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); +if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no menu to show +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php +//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); +//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session) + +require('../main.inc.php'); + +//print_r($_POST); + +// Getting the posted keys=>values, sanitize the ones who are from text inputs +// from text inputs : total amount +$amountPayment = price2num($_POST['amountPayment']); +$amountPayment = is_numeric($amountPayment)? $amountPayment : 0; // is a value +// from text inputs : invoice amount payment +$amounts = $_POST['amounts']; // is an array (need a foreach) +foreach ($amounts as $key => $value) +{ + $value = price2num($value); + if (!is_numeric($value)) unset($amounts[$key]); +} +// from dolibarr's object (no need to check) +$remains = $_POST['remains']; +// from DOM elements : imgId (equals invoice id) +$currentInvId = $_POST['imgClicked']; + + +// Treatment +$result = $amountPayment - array_sum($amounts); // Remaining amountPayment +$toJsonArray = array(); +if($currentInvId) // Here to breakdown +{ + // Get the current amount (from form) and the corresponding remainToPay (from invoice) + $currentAmount = $amounts['amount_'.$currentInvId]; + $currentRemain = $remains['remain_'.$currentInvId]; + + // Reset the substraction for this amount + $result += price2num($currentAmount); + $currentAmount = 0; + if($result >= 0) // then we need to calculate the amount to breakdown + { + $amountToBreakdown = ($result - $currentRemain >= 0 ? + $currentRemain : // Remain can be fully paid + $currentRemain + ($result - $currentRemain)); // Remain can only partially be paid + $currentAmount = $amountToBreakdown; // In both cases, amount will take breakdown value + $result -= $amountToBreakdown; // And canceled substraction has been replaced by breakdown + } // else there's no need to calc anything, just reset the field (result is still < 0) + $toJsonArray['amount_'.$currentInvId] = price2num($currentAmount).""; // Param will exist only if an img has been clicked +} +// Encode to JSON to return +$toJsonArray['result'] = price2num($result).""; +echo json_encode($toJsonArray); // Printing the call's result + +?> \ No newline at end of file diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index 404e0afb5f4..504eea0ae1d 100755 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -22,7 +22,7 @@ /** * \file htdocs/compta/deplacement/list.php * \brief Page list of expenses - * \version $Id: list.php,v 1.1 2011/06/29 17:55:33 eldy Exp $ + * \version $Id: list.php,v 1.2 2011/06/30 21:53:02 eldy Exp $ */ require("../../main.inc.php"); @@ -49,6 +49,8 @@ if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="d.dated"; $limit = $conf->liste_limit; +$search_ref=GETPOST('search_ref'); + /* * View @@ -59,7 +61,7 @@ $tripandexpense_static=new Deplacement($db); llxHeader(); $sql = "SELECT s.nom, s.rowid as socid,"; // Ou -$sql.= " d.rowid, d.type, d.dated as dd, d.km, "; // Comment +$sql.= " d.rowid, d.type, d.dated as dd, d.km,"; // Comment $sql.= " u.name, u.firstname"; // Qui $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= ", ".MAIN_DB_PREFIX."deplacement as d"; @@ -69,6 +71,10 @@ $sql.= " WHERE d.fk_user = u.rowid"; $sql.= " AND d.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = ".$socid; +if (trim($search_ref) != '') +{ + $sql.= ' AND d.rowid LIKE \'%'.$db->escape(trim($search_ref)) . '%\''; +} $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1 ,$offset); @@ -81,6 +87,7 @@ if ($resql) print_barre_liste($langs->trans("ListOfFees"), $page, $_SERVER["PHP_SELF"],"&socid=$socid",$sortfield,$sortorder,'',$num); $i = 0; + print '
'."\n"; print ''; print ""; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","","&socid=$socid",'',$sortfield,$sortorder); @@ -92,6 +99,29 @@ if ($resql) print_liste_field_titre('',$_SERVER["PHP_SELF"], ''); print "\n"; + // Filters lines + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '\n"; + $var=true; while ($i < min($num,$limit)) { @@ -117,6 +147,7 @@ if ($resql) } print "
'; + print ''; + print ''; + //print ''; + print ''; + //print ''; + print ''; + print ' '; + print ''; + print ' '; + print ''; + print ' '; + print ''; + print "
"; + print "
\n"; $db->free($resql); } else @@ -125,5 +156,5 @@ else } $db->close(); -llxFooter('$Date: 2011/06/29 17:55:33 $ - $Revision: 1.1 $'); +llxFooter('$Date: 2011/06/30 21:53:02 $ - $Revision: 1.2 $'); ?> diff --git a/htdocs/compta/dons/liste.php b/htdocs/compta/dons/liste.php index 3f5240adbe3..61f1c321947 100644 --- a/htdocs/compta/dons/liste.php +++ b/htdocs/compta/dons/liste.php @@ -21,7 +21,7 @@ * \file htdocs/compta/dons/liste.php * \ingroup don * \brief Page de liste des dons - * \version $Id$ + * \version $Id: liste.php,v 1.34 2011/06/30 21:53:02 eldy Exp $ */ require("../../main.inc.php"); @@ -43,6 +43,9 @@ if (! $sortfield) $sortfield="d.datedon"; $limit = $conf->liste_limit; $statut=isset($_GET["statut"])?$_GET["statut"]:"-1"; +$search_ref=GETPOST('search_ref'); +$search_company=GETPOST('search_company'); +$search_name=GETPOST('search_name'); @@ -66,6 +69,18 @@ if ($statut >= 0) { $sql .= " AND d.fk_statut = ".$statut; } +if (trim($search_ref) != '') +{ + $sql.= ' AND d.rowid LIKE \'%'.$db->escape(trim($search_ref)) . '%\''; +} +if (trim($search_company) != '') +{ + $sql.= ' AND d.societe LIKE \'%'.$db->escape(trim($search_company)) . '%\''; +} +if (trim($search_name) != '') +{ + $sql.= ' AND d.nom LIKE \'%'.$db->escape(trim($search_name)) . '%\' OR d.prenom LIKE \'%'.$db->escape(trim($search_name)) . '%\''; +} $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1, $offset); @@ -89,6 +104,7 @@ if ($result) } + print '
'."\n"; print ""; print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","&page=$page&statut=$statut","","",$sortfield,$sortorder); @@ -104,12 +120,38 @@ if ($result) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.fk_statut","&page=$page&statut=$statut","",'align="right"',$sortfield,$sortorder); print "\n"; + // Filters lines + print ''; + print ''; + print ''; + print ''; + print ''; + if ($conf->projet->enabled) + { + print ''; + } + print ''; + print '\n"; + $var=True; while ($i < min($num,$limit)) { $objp = $db->fetch_object($result); $var=!$var; - print ""; + print ""; $donationstatic->id=$objp->rowid; $donationstatic->ref=$objp->rowid; $donationstatic->nom=$objp->nom; @@ -140,6 +182,8 @@ if ($result) $i++; } print "
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ' '; + print ''; + print ' '; + print ''; + print ' '; + print ''; + print "
"; + print "
\n"; + $db->free($resql); } else { @@ -149,5 +193,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/06/30 21:53:02 $ - $Revision: 1.34 $'); ?> diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 38d3851f5cf..75f62a178a3 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -26,7 +26,7 @@ * \file htdocs/compta/facture.php * \ingroup facture * \brief Page to create/see an invoice - * \version $Id: facture.php,v 1.841 2011/06/30 13:27:21 hregis Exp $ + * \version $Id: facture.php,v 1.845 2011/07/02 17:02:00 eldy Exp $ */ require('../main.inc.php'); @@ -61,6 +61,7 @@ $action=GETPOST('action'); $confirm=GETPOST('confirm'); $lineid=GETPOST('lineid'); $userid=GETPOST('userid'); +$search_ref=GETPOST('sf_ref')?GETPOST('sf_ref'):GETPOST('search_ref'); // Security check $fieldid = isset($_GET["ref"])?'facnumber':'rowid'; @@ -100,7 +101,7 @@ if (! empty($object->hooks)) $reshook+=$module->doActions($object); if (! empty($module->error) || (! empty($module->errors) && sizeof($module->errors) > 0)) { - $mesg=$module->error; $mesgs[]=$module->errors; + $mesg=$module->error; $mesgs=$module->errors; if ($action=='add') $action='create'; if ($action=='update') $action='edit'; } @@ -248,8 +249,8 @@ if ($action == 'valid') if ($action == 'set_thirdparty') { - $object->updateObjectField('facture',$id,'fk_soc',$socid); - + $object->updateObjectField('facture',$id,'fk_soc',$socid); + Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); exit; } @@ -712,6 +713,7 @@ if ($action == 'add' && $user->rights->facture->creer) if ($element == 'order') { $element = $subelement = 'commande'; } if ($element == 'propal') { $element = 'comm/propal'; $subelement = 'propal'; } if ($element == 'contract') { $element = $subelement = 'contrat'; } + if ($element == 'inter') { $element = $subelement = 'ficheinter'; } $object->origin = $_POST['origin']; $object->origin_id = $_POST['originid']; @@ -1306,7 +1308,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $result=$mailfile->sendfile(); if ($result) { - $mesg=$langs->trans('MailSuccessfulySent',$from,$sendto); // Must not contain " + $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain " $error=0; @@ -1440,7 +1442,7 @@ if ($action == 'create') print_fiche_titre($langs->trans('NewBill')); - if ($mesg) print $mesg; + dol_htmloutput_mesg($mesg); $soc = new Societe($db); if ($socid) $res=$soc->fetch($socid); @@ -3052,9 +3054,9 @@ else { $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } - if ($_POST['sf_ref']) + if (trim($search_ref) != '') { - $sql.= ' AND f.facnumber LIKE \'%'.$db->escape(trim($_POST['sf_ref'])) . '%\''; + $sql.= ' AND f.facnumber LIKE \'%'.$db->escape(trim($search_ref)) . '%\''; } if ($sall) { @@ -3106,17 +3108,17 @@ else //print ' '; print ''; - // Lignes des champs de filtre - + // Filters lines print ''; print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; - //print ' '.$langs->trans('Year').': '; - $syear = $year; + //print ' '.$langs->trans('Year').': '.$syear; + //print 'xx'.$syear.'zz'; //if ($syear == '') $syear = date("Y"); - $htmlother->select_year($syear,'year',1, 20, 5); + $htmlother->select_year($syear?$syear:-1,'year',1, 20, 5); print ''; print ' '; print ''; @@ -3234,5 +3236,5 @@ else $db->close(); -llxFooter('$Date: 2011/06/30 13:27:21 $ - $Revision: 1.841 $'); +llxFooter('$Date: 2011/07/02 17:02:00 $ - $Revision: 1.845 $'); ?> diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 2b7d3eaa2d2..c6a7474c9b8 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -22,7 +22,7 @@ * \file htdocs/compta/index.php * \ingroup compta * \brief Main page of accountancy area - * \version $Id: index.php,v 1.181 2011/06/29 17:55:34 eldy Exp $ + * \version $Id: index.php,v 1.182 2011/06/30 21:53:02 eldy Exp $ */ require('../main.inc.php'); @@ -111,7 +111,7 @@ $max=3; /* - * Find invoices + * Search invoices */ if ($conf->facture->enabled && $user->rights->facture->lire) { @@ -127,6 +127,9 @@ if ($conf->facture->enabled && $user->rights->facture->lire) print "
"; } +/* + * Search supplier invoices + */ if ($conf->fournisseur->enabled && $user->rights->fournisseur->lire) { print '
'; @@ -141,6 +144,39 @@ if ($conf->fournisseur->enabled && $user->rights->fournisseur->lire) print "

"; } +/* + * Search donations + */ +if ($conf->don->enabled && $user->rights->don->lire) +{ + print '
'; + print ''; + print ''; + print ''; + print ""; + print "'; + print ''; + //print "'; + print ''; + print "
'.$langs->trans("SearchADonation").'
".$langs->trans("Ref").':
".$langs->trans("Other").':

"; +} + +/* + * Search expenses + */ +if ($conf->deplacement->enabled && $user->rights->deplacement->lire) +{ + print '
'; + print ''; + print ''; + print ''; + print ""; + print "'; + print ''; + //print "'; + print ''; + print "
'.$langs->trans("SearchATripAndExpense").'
".$langs->trans("Ref").':
".$langs->trans("Other").':

"; +} /** * Draft customers invoices @@ -1009,5 +1045,5 @@ print ''; $db->close(); -llxFooter('$Date: 2011/06/29 17:55:34 $ - $Revision: 1.181 $'); +llxFooter('$Date: 2011/06/30 21:53:02 $ - $Revision: 1.182 $'); ?> diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 96203d9c39f..ec6ad090caa 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -24,7 +24,7 @@ * \file htdocs/compta/paiement.php * \ingroup compta * \brief Page to create a payment - * \version $Id$ + * \version $Id: paiement.php,v 1.108 2011/07/01 16:18:10 hregis Exp $ */ require('../main.inc.php'); @@ -253,7 +253,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if (! empty($conf->global->PAYPAL_BANK_ACCOUNT)) $accountid=$conf->global->PAYPAL_BANK_ACCOUNT; $paymentnum=$facture->ref_int; } - if ($conf->use_javascript_ajax) { print "\n".''."\n"; + } + + if (! empty($conf->global->MAIN_JS_ON_PAYMENT)) + { + print "\n".''."\n"; + jQuery("#payment_form").find("img").click(function() { + callToBreakdown(jQuery(this)); + }); + + jQuery("#payment_form").find("input[name*=\"amount_\"]").change(function() { + callForResult(); + }); + + jQuery("#amountpayment").change(function() { + callForResult(); + }); + }); + '."\n"; } print '
'; @@ -314,7 +374,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $html->select_types_paiements((GETPOST('paiementcode')?GETPOST('paiementcode'):$facture->mode_reglement_code),'paiementcode','',2); print "\n"; print ''; - print ''; + print ''; print ''; // Payment amount @@ -407,115 +467,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''.$langs->trans('RemainderToPay').''; print ''.$langs->trans('PaymentAmount').''; print ' '; - print "\n"; - - // FIXME Does not work yet because : - // - Does not support non , and non . decimal separator. - // - Does not use dolibarr param rounding - // - Other minor bugs - if (! empty($conf->global->MAIN_JS_ON_PAYMENT)) - { - print ''; - } + print "\n"; $var=True; $total=0; @@ -563,8 +515,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Add remind amount $namef = 'amount_'.$objp->facid; + $nameRemain = 'remain_'.$objp->facid; - $namef = 'amount_'.$objp->facid; if ($action != 'add_paiement') { if (! empty($conf->global->MAIN_JS_ON_PAYMENT)) @@ -614,7 +566,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if ($totalrecudeposits) print '+'.price($totalrecudeposits); print ''; print ''.price(price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).''; - print ''; + print ''; print ' '; print "\n"; } @@ -730,5 +682,5 @@ if (! GETPOST('action')) $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/01 16:18:10 $ - $Revision: 1.108 $'); ?> diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 47e6e549c7d..6fc5ef70e40 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -24,7 +24,7 @@ * \file htdocs/contact/fiche.php * \ingroup societe * \brief Card of a contact - * \version $Id: fiche.php,v 1.215 2011/06/30 13:25:32 hregis Exp $ + * \version $Id: fiche.php,v 1.220 2011/07/02 14:53:42 eldy Exp $ */ require("../main.inc.php"); @@ -68,37 +68,61 @@ else $result = restrictedArea($user, 'contact', $id, 'socpeople'); // If we create a contact with no company (shared contacts), no check on write permission } +// Instantiate hooks of thirdparty module +if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules)) +{ + $object->callHooks('contactcard'); +} + /* * Actions */ +$reshook=0; + +// Hook of actions. After that, reshook is 0 if we need to process standard actions, >0 otherwise. +if (! empty($object->hooks)) +{ + foreach($object->hooks as $hook) + { + if (! empty($hook['modules'])) + { + foreach($hook['modules'] as $module) + { + if (method_exists($module,'doActions')) + { + $resaction+=$module->doActions($object,$action,$id); // object is deprecated, action can be changed by method (to go back to other action for example), id can be changed/set by method (during creation for example) + if ($resaction < 0 || ! empty($module->error) || (! empty($module->errors) && sizeof($module->errors) > 0)) + { + $error=$module->error; $errors=$module->errors; + if ($action=='add') $action='create'; + if ($action=='update') $action='edit'; + } + else $reshook+=$resaction; + } + } + } + } +} + +// ---------- start deprecated. Use hook to hook actions. // If canvas actions are defined, because on url, or because contact was created with canvas feature on, we use the canvas feature. // If canvas actions are not defined, we use standard feature. if (method_exists($objcanvas->control,'doActions')) { - // ----------------------------------------- - // When used with CANVAS - // ----------------------------------------- $objcanvas->doActions($id); - if (empty($objcanvas->error) && (empty($objcanvas->errors) || sizeof($objcanvas->errors) == 0)) - { - if ($action=='add') { $objcanvas->action='create'; $action='create'; } - if ($action=='update') { $objcanvas->action='view'; $action='view'; } - } - else + if (! empty($objcanvas->error) || (! empty($objcanvas->errors) && sizeof($objcanvas->errors) > 0)) { $error=$objcanvas->error; $errors=$objcanvas->errors; if ($action=='add') { $objcanvas->action='create'; $action='create'; } if ($action=='update') { $objcanvas->action='edit'; $action='edit'; } } } -else -{ - // ----------------------------------------- - // When used in standard mode - // ----------------------------------------- +// ---------- end deprecated. +if (empty($reshook)) +{ // Creation utilisateur depuis contact if ($_POST["action"] == 'confirm_create_user' && $_POST["confirm"] == 'yes' && $user->rights->user->user->creer) { @@ -303,26 +327,26 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // ----------------------------------------- if ($action == 'create') { - $objcanvas->assign_post(); // Assign POST data + $objcanvas->assign_post(); // TODO: Put code of assign_post into assign_values to keep only assign_values $objcanvas->assign_values($action); // Set value for templates $objcanvas->display_canvas($action); // Show template } else if ($action == 'edit') { - $objcanvas->control->object=$objcanvas->getObject($id); // Load object + $objcanvas->control->object=$objcanvas->getObject($id); // TODO: Getting and storing object should be done into assign_values (for template with no code) or into tpl if (empty($objcanvas->control->object)) { $object = new Contact($db); $object->fetch($id,$user); $objcanvas->control->object=$object; } - $objcanvas->assign_post(); // Assign POST data + $objcanvas->assign_post(); // TODO: Put code of assign_post into assign_values to keep only assign_values $objcanvas->assign_values($action); // Set value for templates $objcanvas->display_canvas($action); // Show template } else { - $objcanvas->control->object=$objcanvas->getObject($id); // Load object + $objcanvas->control->object=$objcanvas->getObject($id); // TODO: Getting and storing object should be done into assign_values (for template with no code) or into tpl if (empty($objcanvas->control->object)) { $object = new Contact($db); @@ -950,5 +974,5 @@ else $db->close(); -llxFooter('$Date: 2011/06/30 13:25:32 $ - $Revision: 1.215 $'); +llxFooter('$Date: 2011/07/02 14:53:42 $ - $Revision: 1.220 $'); ?> diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index 88d13ec471a..c2aa4c83e84 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -21,7 +21,7 @@ * \file htdocs/core/class/canvas.class.php * \ingroup core * \brief File of class to manage canvas - * \version $Id$ + * \version $Id: canvas.class.php,v 1.44 2011/07/02 14:51:26 eldy Exp $ */ @@ -135,7 +135,8 @@ class Canvas /** * Execute actions - * @param id Id of object (may be empty for creation) + * @param id Id of object (may be empty for creation) + * @deprecated Use actions with hooks instead */ function doActions($id) { @@ -229,11 +230,12 @@ class Canvas /** * Display canvas * @param mode 'create', 'view', 'edit' + * @param id Id of object to show */ - function display_canvas($mode='view') + function display_canvas($mode='view',$id=0) { global $db, $conf, $langs, $user, $canvas; - global $form, $formfile; + global $id, $form, $formfile; //print $this->template_dir.$this->card.'_'.$mode.'.tpl.php';exit; include($this->template_dir.$this->card.'_'.$mode.'.tpl.php'); // Include native PHP template diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index dba9a784f4d..98a83f441f6 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -22,7 +22,7 @@ * \file htdocs/core/class/commonobject.class.php * \ingroup core * \brief File of parent class of all other business classes (invoices, contracts, proposals, orders, ...) - * \version $Id: commonobject.class.php,v 1.140 2011/06/30 13:27:20 hregis Exp $ + * \version $Id: commonobject.class.php,v 1.143 2011/07/01 23:05:39 eldy Exp $ */ @@ -1281,12 +1281,13 @@ class CommonObject $classpath = $element.'/class'; // To work with non standard path - if ($objecttype == 'facture') { $classpath = 'compta/facture/class'; } - if ($objecttype == 'propal') { $classpath = 'comm/propal/class'; } - if ($objecttype == 'shipping') { $classpath = 'expedition/class'; $subelement = 'expedition'; $module = 'expedition_bon'; } - if ($objecttype == 'delivery') { $classpath = 'livraison/class'; $subelement = 'livraison'; $module = 'livraison_bon'; } - if ($objecttype == 'invoice_supplier') { $classpath = 'fourn/class'; } - if ($objecttype == 'order_supplier') { $classpath = 'fourn/class'; } + if ($objecttype == 'facture') { $classpath = 'compta/facture/class'; } + if ($objecttype == 'propal') { $classpath = 'comm/propal/class'; } + if ($objecttype == 'shipping') { $classpath = 'expedition/class'; $subelement = 'expedition'; $module = 'expedition_bon'; } + if ($objecttype == 'delivery') { $classpath = 'livraison/class'; $subelement = 'livraison'; $module = 'livraison_bon'; } + if ($objecttype == 'invoice_supplier') { $classpath = 'fourn/class'; } + if ($objecttype == 'order_supplier') { $classpath = 'fourn/class'; } + if ($objecttype == 'fichinter') { $classpath = 'fichinter/class'; $subelement ='fichinter'; $module ='ficheinter'; } $classfile = strtolower($subelement); $classname = ucfirst($subelement); if ($objecttype == 'invoice_supplier') { $classfile = 'fournisseur.facture'; $classname='FactureFournisseur'; } @@ -1430,15 +1431,15 @@ class CommonObject /** - * Instantiate hooks of thirdparty module - * @param $type Type of hook + * Init array this->hooks with instantiated controler and/or dao + * @param arraytype Array list of hooked tab/features. For example: thirdpartytab, ... */ function callHooks($arraytype) { global $conf; if (! is_array($arraytype)) $arraytype=array($arraytype); - + $i=0; foreach($conf->hooks_modules as $module => $hooks) @@ -1453,13 +1454,15 @@ class CommonObject $actionfile = 'actions_'.$module.'.class.php'; $daofile = 'dao_'.$module.'.class.php'; $pathroot = ''; - + $this->hooks[$i]['type']=$type; // Include actions class (controller) + //print 'include '.$path.$actionfile."\n"; $resaction=dol_include_once($path.$actionfile); // Include dataservice class (model) + //print 'include '.$path.$daofile."\n"; $resdao=dol_include_once($path.$daofile); // Instantiate actions class (controller) @@ -1470,13 +1473,14 @@ class CommonObject $this->hooks[$i]['modules'][$objModule->module_number] = $objModule; } + // FIXME storing dao is useless here. It's goal of controller to known which dao to manage if ($resdao) { // Instantiate dataservice class (model) $modelclassname = 'Dao'.ucfirst($module); $this->hooks[$i]['modules'][$objModule->module_number]->object = new $modelclassname($this->db); } - + $i++; } } diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 86d002f55cb..6cd0d6761b8 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -25,7 +25,7 @@ * \ingroup core * \brief Fichier de la classe de stockage de la config courante * \remarks La config est stockee dans le fichier conf/conf.php - * \version $Id$ + * \version $Id: conf.class.php,v 1.59 2011/07/01 23:06:06 eldy Exp $ */ @@ -153,7 +153,7 @@ class Conf $modulename = strtolower($reg[1]); $this->login_method_modules[] = DOL_DOCUMENT_ROOT.'/'.$modulename.'/inc/login/'; } - // If this is constant for hook activated by a module + // If this is constant for hook activated by a module. Value is list of hooked tabs separated with : elseif (preg_match('/^MAIN_MODULE_([A-Z_]+)_HOOKS$/i',$key,$reg)) { $modulename = strtolower($reg[1]); diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index be03bde9395..fdafeafbca2 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -1,6 +1,6 @@ - * Copyright (C) 2009 Meos +/* Copyright (C) 2010-2011 Laurent Destailleur + * Copyright (C) 2009 Meos * * 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 @@ -125,7 +125,7 @@ if ($_POST["action"] == 'confirm_crop') * View */ -llxHeader($head, $langs->trans("Image"), '', '', 0, 0, array('/includes/jcrop/js/jquery.Jcrop.min.js','/lib/lib_photosresize.js'), array('/includes/jcrop/css/jquery.Jcrop.css')); +llxHeader($head, $langs->trans("Image"), '', '', 0, 0, array('/includes/jquery/plugins/jcrop/js/jquery.Jcrop.min.js','/lib/lib_photosresize.js'), array('/includes/jquery/plugins/jcrop/css/jquery.Jcrop.css')); print_fiche_titre($langs->trans("ImageEditor")); @@ -201,5 +201,5 @@ print ''; } -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/02 01:26:30 $ - $Revision: 1.13 $'); ?> \ No newline at end of file diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index e219919ae1d..4955f460ed0 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -25,7 +25,7 @@ * \file htdocs/expedition/fiche.php * \ingroup expedition * \brief Fiche descriptive d'une expedition - * \version $Id$ + * \version $Id: fiche.php,v 1.208 2011/07/02 16:48:32 eldy Exp $ */ require("../main.inc.php"); @@ -398,7 +398,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P $result=$mailfile->sendfile(); if ($result) { - $_SESSION['mesg']=$langs->trans('MailSuccessfulySent',$from,$sendto); + $_SESSION['mesg']=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); $error=0; @@ -1381,5 +1381,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.208 $'); ?> diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 259b4baa6c5..9da927aefb1 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2002-2003 Rodolphe Quiedeville * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2011 Juanjo Menent * * 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 @@ -21,7 +22,7 @@ /** \file htdocs/fichinter/class/fichinter.class.php * \ingroup ficheinter * \brief Fichier de la classe des gestion des fiches interventions - * \version $Id$ + * \version $Id: fichinter.class.php,v 1.19 2011/07/02 17:02:00 eldy Exp $ */ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); @@ -50,7 +51,7 @@ class Fichinter extends CommonObject var $datev; var $datem; var $duree; - var $statut; // 0=draft, 1=validated + var $statut; // 0=draft, 1=validated, 2=invoiced var $description; var $note_private; var $note_public; @@ -75,8 +76,10 @@ class Fichinter extends CommonObject // List of language codes for status $this->statuts[0]='Draft'; $this->statuts[1]='Validated'; + $this->statuts[2]='Invoiced'; $this->statuts_short[0]='Draft'; $this->statuts_short[1]='Validated'; + $this->statuts_short[2]='Invoiced'; } @@ -166,10 +169,10 @@ class Fichinter extends CommonObject } /* - * \brief Met a jour une intervention - * \return int <0 si ko, >0 si ok + * Met a jour une intervention + * @return int <0 if KO, >0 if OK */ - function update($id) + function update($user) { global $conf; @@ -183,7 +186,7 @@ class Fichinter extends CommonObject $sql.= ", description = '".$this->db->escape($this->description)."'"; $sql.= ", duree = ".$this->duree; $sql.= ", fk_projet = ".$this->fk_project; - $sql.= " WHERE rowid = ".$id; + $sql.= " WHERE rowid = ".$this->id; $sql.= " AND entity = ".$conf->entity; dol_syslog("Fichinter::update sql=".$sql); @@ -237,6 +240,14 @@ class Fichinter extends CommonObject if ($this->statut == 0) $this->brouillon = 1; + /* + * Lines + */ + $result=$this->fetch_lines(); + if ($result < 0) + { + return -3; + } $this->db->free($resql); return 1; } @@ -338,6 +349,31 @@ class Fichinter extends CommonObject } } + /** + * set intervetnion as billed + * @return int <0 si ko, >0 si ok + */ + function setBilled() + { + global $conf; + + $sql = 'UPDATE '.MAIN_DB_PREFIX.'fichinter SET fk_statut = 2'; + $sql.= ' WHERE rowid = '.$this->id; + $sql.= " AND entity = ".$conf->entity; + $sql.= " AND fk_statut = 1"; + + if ($this->db->query($sql) ) + { + return 1; + } + else + { + dol_print_error($this->db); + return -1; + } + } + + /** * \brief Retourne le libelle du statut * \param mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto @@ -369,22 +405,26 @@ class Fichinter extends CommonObject if ($mode == 2) { if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]); - if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]); + if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]); + if ($statut==2) return img_picto($langs->trans('StatusInterInvoiced'),'statut6').' '.$langs->trans('StatusOrderProcessed'); } if ($mode == 3) { if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); - if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); + if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); + if ($statut==2) return img_picto($langs->trans('StatusInterInvoiced'),'statut6'); } if ($mode == 4) { if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); - if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); + if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); + if ($statut==2) return img_picto($langs->trans('StatusInterInvoiced'),'statut6').' '.$langs->trans('StatusInterInvoiced'); } if ($mode == 5) { if ($statut==0) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); - if ($statut==1) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); + if ($statut==1) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); + if ($statut==2) return $langs->trans('StatusInterInvoiced').' '.img_picto($langs->trans('StatusInterInvoiced'),'statut6'); } } @@ -523,17 +563,29 @@ class Fichinter extends CommonObject $this->db->begin(); - if (! $error) + // Delete linked object + $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_element"; + $sql.= " WHERE fk_target = ".$this->id; + $sql.= " AND targettype = '".$this->element."'"; + dol_syslog("Fichinter::delete sql=".$sql); + if (! $this->db->query($sql) ) { - // Delete linked contacts - $res = $this->delete_linked_contact(); - if ($res < 0) - { - $this->error='ErrorFailToDeleteLinkedContact'; - //$error++; - $this->db->rollback(); - return 0; - } + dol_syslog("Fichinter::delete error", LOG_ERR); + $error++; + } + + // Delete linked contacts + $res = $this->delete_linked_contact(); + if ($res < 0) + { + $this->error='ErrorFailToDeleteLinkedContact'; + $error++; + } + + if ($err > 0) + { + $this->db->rollback(); + return -1; } $sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet"; @@ -761,13 +813,13 @@ class Fichinter extends CommonObject } /** - * \brief Initialise la fiche intervention avec valeurs fictives aleatoire - * Sert a generer une fiche intervention pour l'aperu des modeles ou demo - * \return int <0 OK, >0 KO + * Initialise la fiche intervention avec valeurs fictives aleatoire + * Sert a generer une fiche intervention pour l'aperu des modeles ou demo + * @return int <0 OK, >0 KO */ function fetch_lines() { - $sql = 'SELECT rowid'; + $sql = 'SELECT rowid, description, duree, date, rang'; $sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet'; $sql.= ' where fk_fichinter = '.$this->id; @@ -775,21 +827,26 @@ class Fichinter extends CommonObject $resql=$this->db->query($sql); if ($resql) { - $num = $this->db->num_rows($result); + $num = $this->db->num_rows($resql); $i = 0; while ($i < $num) { - $objp = $this->db->fetch_object($result); + $objp = $this->db->fetch_object($resql); $line = new FichinterLigne($this->db); $line->id = $objp->rowid; - //... + $line->desc = $objp->description; + //For invoicing we calculing hours + $line->qty = round($objp->duree/3600,2); + $line->date = $this->db->jdate($objp->date); + $line->rang = $objp->rang; + $line->product_type = 1; $this->lines[$i] = $line; $i++; } - $this->db->free($result); + $this->db->free($resql); return 1; } diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index 5057a85acd0..05989883782 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -25,7 +25,7 @@ * \file htdocs/fichinter/document.php * \ingroup fichinter * \brief Page des documents joints sur les contrats - * \version $Id$ + * \version $Id: document.php,v 1.20 2011/07/02 17:33:24 eldy Exp $ */ require("../main.inc.php"); @@ -37,6 +37,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); $langs->load("other"); $langs->load("fichinter"); $langs->load("companies"); +$langs->load("interventions"); $fichinterid = GETPOST("id"); $action = GETPOST("action"); @@ -173,5 +174,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/02 17:33:24 $ - $Revision: 1.20 $'); ?> diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 61ddcc6ba9d..39c9a121147 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -1,7 +1,8 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2011 Juanjo Menent * * 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 @@ -22,7 +23,7 @@ * \file htdocs/fichinter/fiche.php * \brief Fichier fiche intervention * \ingroup ficheinter - * \version $Id$ + * \version $Id: fiche.php,v 1.165 2011/07/02 17:14:58 eldy Exp $ */ require("../main.inc.php"); @@ -44,22 +45,24 @@ if (! empty($conf->global->FICHEINTER_ADDON) && is_readable(DOL_DOCUMENT_ROOT ." $langs->load("companies"); $langs->load("interventions"); +$id=GETPOST('id'); +$action=GETPOST("action"); +$mesg=GETPOST("msg"); + // Load object if defined $fichinterid=0; -$fichinter = new Fichinter($db); -if ($_GET["id"] > 0 || ! empty($_GET["ref"])) +$object = new Fichinter($db); +if ($id > 0 || ! empty($_GET["ref"])) { - $result=$fichinter->fetch($_GET["id"],$_GET["ref"]); + $result=$object->fetch($id,$_GET["ref"]); if (! $result > 0) { dol_print_error($db); exit; } - $fichinterid=$fichinter->id; + $fichinterid=$object->id; } -$mesg=GETPOST("msg"); - // Security check if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'ficheinter', $fichinterid, 'fichinter'); @@ -70,145 +73,145 @@ $result = restrictedArea($user, 'ficheinter', $fichinterid, 'fichinter'); * Actions */ -if ($_REQUEST["action"] != 'create' && $_REQUEST["action"] != 'add' && ! ($_REQUEST["id"] > 0) && empty($_REQUEST["ref"])) +if ($action != 'create' && $action != 'add' && $action != 'classifybilled' && ! ($_REQUEST["id"] > 0) && empty($_REQUEST["ref"])) { Header("Location: index.php"); - return; + exit; } -if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes') +if ($action == 'confirm_validate' && $_REQUEST['confirm'] == 'yes') { - $fichinter = new Fichinter($db); - $fichinter->fetch($_GET["id"]); - $fichinter->fetch_thirdparty(); + $object = new Fichinter($db); + $object->fetch($id); + $object->fetch_thirdparty(); - $result = $fichinter->setValid($user, $conf->fichinter->outputdir); + $result = $object->setValid($user, $conf->fichinter->outputdir); if ($result >= 0) { // Define output language $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - $result=fichinter_create($db, $fichinter, $_REQUEST['model'], $outputlangs); - Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$fichinter->id); + $result=fichinter_create($db, $object, $_REQUEST['model'], $outputlangs); + Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; } else { - $mesg='
'.$fichinter->error.'
'; + $mesg='
'.$object->error.'
'; } } -if ($_REQUEST['action'] == 'confirm_modify' && $_REQUEST['confirm'] == 'yes') +if ($action == 'confirm_modify' && $_REQUEST['confirm'] == 'yes') { - $fichinter = new Fichinter($db); - $fichinter->fetch($_GET["id"]); - $fichinter->fetch_thirdparty(); + $object = new Fichinter($db); + $object->fetch($id); + $object->fetch_thirdparty(); - $result = $fichinter->setDraft($user); + $result = $object->setDraft($user); if ($result >= 0) { // Define output language $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - $result=fichinter_create($db, $fichinter, (empty($_REQUEST['model'])?$fichinter->model:$_REQUEST['model']), $outputlangs); - Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$fichinter->id); + $result=fichinter_create($db, $object, (empty($_REQUEST['model'])?$object->model:$_REQUEST['model']), $outputlangs); + Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; } else { - $mesg='
'.$fichinter->error.'
'; + $mesg='
'.$object->error.'
'; } } if ($_POST["action"] == 'add') { - $fichinter = new Fichinter($db); + $object = new Fichinter($db); - $fichinter->socid = $_POST["socid"]; - $fichinter->duree = $_POST["duree"]; - $fichinter->fk_project = $_POST["projectid"]; - $fichinter->author = $user->id; - $fichinter->description = $_POST["description"]; - $fichinter->ref = $_POST["ref"]; - $fichinter->modelpdf = $_POST["model"]; + $object->socid = $_POST["socid"]; + $object->duree = $_POST["duree"]; + $object->fk_project = $_POST["projectid"]; + $object->author = $user->id; + $object->description = $_POST["description"]; + $object->ref = $_POST["ref"]; + $object->modelpdf = $_POST["model"]; - if ($fichinter->socid > 0) + if ($object->socid > 0) { - $result = $fichinter->create(); + $result = $object->create(); if ($result > 0) { - $_GET["id"]=$result; // Force raffraichissement sur fiche venant d'etre cree + $id=$result; // Force raffraichissement sur fiche venant d'etre cree $fichinterid=$result; } else { $langs->load("errors"); - $mesg='
'.$langs->trans($fichinter->error).'
'; - $_GET["action"] = 'create'; + $mesg='
'.$langs->trans($object->error).'
'; + $action = 'create'; $_GET["socid"] = $_POST["socid"]; } } else { $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("ThirdParty")).'
'; - $_GET["action"] = 'create'; + $action = 'create'; } } if ($_POST["action"] == 'update') { - $fichinter = new Fichinter($db); + $object = new Fichinter($db); + $object->fetch($id); - $fichinter->socid = $_POST["socid"]; - $fichinter->fk_project = $_POST["projectid"]; - $fichinter->author = $user->id; - $fichinter->description = $_POST["description"]; - $fichinter->ref = $_POST["ref"]; + $object->socid = $_POST["socid"]; + $object->fk_project = $_POST["projectid"]; + $object->author = $user->id; + $object->description = $_POST["description"]; + $object->ref = $_POST["ref"]; - $fichinter->update($_POST["id"]); - $_GET["id"]=$_POST["id"]; // Force raffraichissement sur fiche venant d'etre creee + $object->update($user); } /* * Build doc */ -if ($_REQUEST['action'] == 'builddoc') // En get ou en post +if ($action == 'builddoc') // En get ou en post { - $fichinter = new Fichinter($db); - $fichinter->fetch($_GET['id']); - $fichinter->fetch_thirdparty(); - $fichinter->fetch_lines(); + $object = new Fichinter($db); + $object->fetch($id); + $object->fetch_thirdparty(); + $object->fetch_lines(); if ($_REQUEST['model']) { - $fichinter->setDocModel($user, $_REQUEST['model']); + $object->setDocModel($user, $_REQUEST['model']); } // Define output language $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - $result=fichinter_create($db, $fichinter, $_REQUEST['model'], $outputlangs); + $result=fichinter_create($db, $object, $_REQUEST['model'], $outputlangs); if ($result <= 0) { dol_print_error($db,$result); @@ -217,48 +220,48 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post } // Set into a project -if ($_POST['action'] == 'classin') +if ($action == 'classin') { - $fichinter = new Fichinter($db); - $fichinter->fetch($_GET['id']); - $result=$fichinter->setProject($_POST['projectid']); - if ($result < 0) dol_print_error($db,$fichinter->error); + $object = new Fichinter($db); + $object->fetch($id); + $result=$object->setProject($_POST['projectid']); + if ($result < 0) dol_print_error($db,$object->error); } -if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes') +if ($action == 'confirm_delete' && $_REQUEST['confirm'] == 'yes') { if ($user->rights->ficheinter->supprimer) { - $fichinter = new Fichinter($db); - $fichinter->fetch($_GET['id']); - $fichinter->delete($user); + $object = new Fichinter($db); + $object->fetch($id); + $object->delete($user); } Header('Location: index.php?leftmenu=ficheinter'); exit; } -if ($_POST['action'] == 'setdescription') +if ($action == 'setdescription') { - $fichinter = new Fichinter($db); - $fichinter->fetch($_GET['id']); - $result=$fichinter->set_description($user,$_POST['description']); - if ($result < 0) dol_print_error($db,$fichinter->error); + $object = new Fichinter($db); + $object->fetch($id); + $result=$object->set_description($user,$_POST['description']); + if ($result < 0) dol_print_error($db,$object->error); } // Add line -if ($_POST['action'] == "addline" && $user->rights->ficheinter->creer) +if ($action == "addline" && $user->rights->ficheinter->creer) { if ($_POST['np_desc'] && ($_POST['durationhour'] || $_POST['durationmin'])) { - $fichinter = new Fichinter($db); - $ret=$fichinter->fetch($_POST['fichinterid']); - $fichinter->fetch_thirdparty(); + $object = new Fichinter($db); + $ret=$object->fetch($_POST['fichinterid']); + $object->fetch_thirdparty(); $desc=$_POST['np_desc']; $date_intervention = dol_mktime($_POST["dihour"], $_POST["dimin"], 0, $_POST["dimonth"], $_POST["diday"], $_POST["diyear"]); $duration = ConvertTime2Seconds($_POST['durationhour'],$_POST['durationmin']); - $fichinter->addline( + $object->addline( $_POST['fichinterid'], $desc, $date_intervention, @@ -269,22 +272,39 @@ if ($_POST['action'] == "addline" && $user->rights->ficheinter->creer) $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs); + fichinter_create($db, $object, $object->modelpdf, $outputlangs); Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_POST['fichinterid']); exit; } } +// Classify Billed +if ($action == 'classifybilled') +{ + $object = new Fichinter($db); + $object->fetch($id); + $result=$object->setBilled(); + if ($result > 0) + { + Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_POST['fichinterid']); + exit; + } + else + { + $mesg='
'.$object->error.'
'; + } +} + /* * Mise a jour d'une ligne d'intervention */ -if ($_POST['action'] == 'updateligne' && $user->rights->ficheinter->creer && $_POST["save"] == $langs->trans("Save")) +if ($action == 'updateligne' && $user->rights->ficheinter->creer && $_POST["save"] == $langs->trans("Save")) { $fichinterline = new FichinterLigne($db); if ($fichinterline->fetch($_POST['ligne']) <= 0) @@ -293,13 +313,13 @@ if ($_POST['action'] == 'updateligne' && $user->rights->ficheinter->creer && $_P exit; } - $fichinter = new Fichinter($db); - if ($fichinter->fetch($fichinterline->fk_fichinter) <= 0) + $object = new Fichinter($db); + if ($object->fetch($fichinterline->fk_fichinter) <= 0) { dol_print_error($db); exit; } - $fichinter->fetch_thirdparty(); + $object->fetch_thirdparty(); $desc=$_POST['np_desc']; $date_intervention = dol_mktime($_POST["dihour"], $_POST["dimin"], 0, $_POST["dimonth"], $_POST["diday"], $_POST["diyear"]); @@ -319,13 +339,13 @@ if ($_POST['action'] == 'updateligne' && $user->rights->ficheinter->creer && $_P $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs); + fichinter_create($db, $object, $object->modelpdf, $outputlangs); unset($_POST['dihour']); unset($_POST['dimin']); @@ -342,7 +362,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->ficheinter->creer && $_P /* * Supprime une ligne d'intervention AVEC confirmation */ -if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes') +if ($action == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes') { if ($user->rights->ficheinter->creer) { @@ -353,8 +373,8 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes' exit; } $result=$fichinterline->deleteline(); - $fichinter = new Fichinter($db); - if ($fichinter->fetch($fichinterline->fk_fichinter) <= 0) + $object = new Fichinter($db); + if ($object->fetch($fichinterline->fk_fichinter) <= 0) { dol_print_error($db); exit; @@ -364,15 +384,15 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes' $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs); + fichinter_create($db, $object, $object->modelpdf, $outputlangs); } - Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET['id']); + Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit; } @@ -380,66 +400,66 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes' * Ordonnancement des lignes */ -if ($_GET['action'] == 'up' && $user->rights->ficheinter->creer) +if ($action == 'up' && $user->rights->ficheinter->creer) { - $fichinter = new Fichinter($db); - $fichinter->fetch($_GET['id']); - $fichinter->fetch_thirdparty(); - $fichinter->line_up($_GET['rowid']); + $object = new Fichinter($db); + $object->fetch($id); + $object->fetch_thirdparty(); + $object->line_up($_GET['rowid']); // Define output language $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs); - Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']); + fichinter_create($db, $object, $object->modelpdf, $outputlangs); + Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'#'.$_GET['rowid']); exit; } -if ($_GET['action'] == 'down' && $user->rights->ficheinter->creer) +if ($action == 'down' && $user->rights->ficheinter->creer) { - $fichinter = new Fichinter($db); - $fichinter->fetch($_GET['id']); - $fichinter->fetch_thirdparty(); - $fichinter->line_down($_GET['rowid']); + $object = new Fichinter($db); + $object->fetch($id); + $object->fetch_thirdparty(); + $object->line_down($_GET['rowid']); // Define output language $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$fichinter->client->default_lang; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs); - Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']); + fichinter_create($db, $object, $object->modelpdf, $outputlangs); + Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'#'.$_GET['rowid']); exit; } /* * Send mail */ -if ($_POST['action'] == 'send' && ! $_POST['cancel'] && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send)) +if ($action == 'send' && ! $_POST['cancel'] && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send)) { $langs->load('mails'); - $fichinter = new Fichinter($db); - if ( $fichinter->fetch($_POST['fichinter_id']) ) + $object = new Fichinter($db); + if ( $object->fetch($_POST['fichinter_id']) ) { - $ficheinterref = dol_sanitizeFileName($fichinter->ref); + $ficheinterref = dol_sanitizeFileName($object->ref); $file = $conf->ficheinter->dir_output . '/' . $ficheinterref . '/' . $ficheinterref . '.pdf'; if (is_readable($file)) { - $fichinter->fetch_thirdparty(); + $object->fetch_thirdparty(); if ($_POST['sendto']) { @@ -452,12 +472,12 @@ if ($_POST['action'] == 'send' && ! $_POST['cancel'] && (empty($conf->global->MA // Le destinataire a ete fourni via la liste deroulante if ($_POST['receiver'] < 0) // Id du tiers { - $sendto = $fichinter->client->email; + $sendto = $object->client->email; $sendtoid = 0; } else // Id du contact { - $sendto = $fichinter->client->contact_get_email($_POST['receiver']); + $sendto = $object->client->contact_get_email($_POST['receiver']); $sendtoid = $_POST['receiver']; } } @@ -472,10 +492,10 @@ if ($_POST['action'] == 'send' && ! $_POST['cancel'] && (empty($conf->global->MA $sendtocc = $_POST['sendtocc']; $deliveryreceipt = $_POST['deliveryreceipt']; - if ($_POST['action'] == 'send') + if ($action == 'send') { if (strlen($_POST['subject'])) $subject = $_POST['subject']; - else $subject = $langs->transnoentities('Intervention').' '.$fichinter->ref; + else $subject = $langs->transnoentities('Intervention').' '.$object->ref; $actiontypecode='AC_FICH'; $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; if ($message) @@ -508,22 +528,22 @@ if ($_POST['action'] == 'send' && ! $_POST['cancel'] && (empty($conf->global->MA $result=$mailfile->sendfile(); if ($result) { - $mesg='
'.$langs->trans('MailSuccessfulySent',$from,$sendto).'.
'; + $mesg='
'.$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)).'.
'; $error=0; // Initialisation donnees - $fichinter->sendtoid = $sendtoid; - $fichinter->actiontypecode = $actiontypecode; - $fichinter->actionmsg = $actionmsg; - $fichinter->actionmsg2 = $actionmsg2; - $fichinter->fk_element = $fichinter->id; - $fichinter->elementtype = $fichinter->element; + $object->sendtoid = $sendtoid; + $object->actiontypecode = $actiontypecode; + $object->actionmsg = $actionmsg; + $object->actionmsg2 = $actionmsg2; + $object->fk_element = $object->id; + $object->elementtype = $object->element; // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); $interface=new Interfaces($db); - $result=$interface->run_triggers('FICHEINTER_SENTBYMAIL',$fichinter,$user,$langs,$conf); + $result=$interface->run_triggers('FICHEINTER_SENTBYMAIL',$object,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers @@ -535,7 +555,7 @@ if ($_POST['action'] == 'send' && ! $_POST['cancel'] && (empty($conf->global->MA { // Redirect here // This avoid sending mail twice if going out and then back to page - Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&msg='.urlencode($mesg)); + Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&msg='.urlencode($mesg)); exit; } } @@ -576,6 +596,8 @@ if ($_POST['action'] == 'send' && ! $_POST['cancel'] && (empty($conf->global->MA $mesg='
'.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Intervention")).'
'; dol_syslog('Impossible de lire les donnees de l\'intervention. Le fichier intervention n\'a peut-etre pas ete genere.'); } + + $action='presend'; } @@ -588,7 +610,7 @@ $formfile = new FormFile($db); llxHeader(); -if ($_GET["action"] == 'create') +if ($action == 'create') { /* * Mode creation @@ -603,7 +625,7 @@ if ($_GET["action"] == 'create') print_fiche_titre($langs->trans("AddIntervention")); - if ($mesg) print $mesg.'
'; + dol_htmloutput_mesg($mesg); if (! $conf->global->FICHEINTER_ADDON) { @@ -697,44 +719,44 @@ elseif ($fichinterid) /* * Affichage en mode visu */ - $fichinter->fetch_thirdparty(); + $object->fetch_thirdparty(); $societe=new Societe($db); - $societe->fetch($fichinter->socid); + $societe->fetch($object->socid); - dol_htmloutput_errors($mesg); + dol_htmloutput_mesg($mesg); - $head = fichinter_prepare_head($fichinter); + $head = fichinter_prepare_head($object); dol_fiche_head($head, 'card', $langs->trans("InterventionCard"), 0, 'intervention'); // Confirmation de la suppression de la fiche d'intervention - if ($_GET['action'] == 'delete') + if ($action == 'delete') { - $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete','',0,1); + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete','',0,1); if ($ret == 'html') print '
'; } // Confirmation validation - if ($_GET['action'] == 'validate') + if ($action == 'validate') { - $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ValidateIntervention'), $langs->trans('ConfirmValidateIntervention'), 'confirm_validate','',0,1); + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateIntervention'), $langs->trans('ConfirmValidateIntervention'), 'confirm_validate','',0,1); if ($ret == 'html') print '
'; } // Confirmation de la validation de la fiche d'intervention - if ($_GET['action'] == 'modify') + if ($action == 'modify') { - $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify','',0,1); + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify','',0,1); if ($ret == 'html') print '
'; } // Confirmation de la suppression d'une ligne d'intervention - if ($_GET['action'] == 'ask_deleteline') + if ($action == 'ask_deleteline') { - $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&ligne='.$_GET["ligne"], $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1); + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&ligne='.$_GET["ligne"], $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1); if ($ret == 'html') print '
'; } @@ -742,16 +764,16 @@ elseif ($fichinterid) // Ref print ''.$langs->trans("Ref").''; - print $html->showrefnav($fichinter,'ref','',1,'ref','ref'); + print $html->showrefnav($object,'ref','',1,'ref','ref'); print ''; // Third party - print "".$langs->trans("Company")."".$fichinter->client->getNomUrl(1).""; + print "".$langs->trans("Company")."".$object->client->getNomUrl(1).""; // Duration print ''.$langs->trans("TotalDuration").''; - //print $fichinter->duree.'-'.$conf->global->MAIN_DURATION_OF_WORKDAY; - print ''.ConvertSecondToTime($fichinter->duree,'all',$conf->global->MAIN_DURATION_OF_WORKDAY).''; + //print $object->duree.'-'.$conf->global->MAIN_DURATION_OF_WORKDAY; + print ''.ConvertSecondToTime($object->duree,'all',$conf->global->MAIN_DURATION_OF_WORKDAY).''; //print ''.ConvertSecondToTime(90000,'all',$conf->global->MAIN_DURATION_OF_WORKDAY).''; print ''; @@ -760,21 +782,21 @@ elseif ($fichinterid) print ''; - if ($_GET['action'] != 'editdescription' && $fichinter->statut == 0) print ''; + if ($action != 'editdescription' && $object->statut == 0) print ''; print '
'; print $langs->trans('Description'); print 'id.'">'.img_edit($langs->trans('Modify'),1).'id.'">'.img_edit($langs->trans('Modify'),1).'
'; print ''; - if ($_GET['action'] == 'editdescription') + if ($action == 'editdescription') { - print ''; + print ''; print ''; print ''; - print '
'; + print '
'; print ''; print ''; } else { - print nl2br($fichinter->description); + print dol_nl2br($object->description); } print ''; print ''; @@ -789,28 +811,28 @@ elseif ($fichinterid) print ''; - if ($_GET['action'] != 'classin') + if ($action != 'classin') { - print ''; } print '
'; print $langs->trans('Project'); print 'id.'">'; + print 'id.'">'; print img_edit($langs->trans('SetProject'),1); print '
'; print ''; - if ($_GET['action'] == 'classin') + if ($action == 'classin') { - $html->form_project($_SERVER['PHP_SELF'].'?id='.$fichinter->id, $fichinter->socid, $fichinter->fk_project,'projectid'); + $html->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'projectid'); } else { - $html->form_project($_SERVER['PHP_SELF'].'?id='.$fichinter->id, $fichinter->socid, $fichinter->fk_project,'none'); + $html->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'none'); } print ''; print ''; } // Statut - print ''.$langs->trans("Status").''.$fichinter->getLibStatut(4).''; + print ''.$langs->trans("Status").''.$object->getLibStatut(4).''; print ""; @@ -847,7 +869,7 @@ elseif ($fichinterid) $var=!$var; // Ligne en mode visu - if ($_GET['action'] != 'editline' || $_GET['ligne'] != $objp->rowid) + if ($action != 'editline' || $_GET['ligne'] != $objp->rowid) { print ''; print ''; @@ -864,15 +886,15 @@ elseif ($fichinterid) // Icone d'edition et suppression - if ($fichinter->statut == 0 && $user->rights->ficheinter->creer) + if ($object->statut == 0 && $user->rights->ficheinter->creer) { print ''; - print 'rowid.'#'.$objp->rowid.'">'; + print 'rowid.'#'.$objp->rowid.'">'; print img_edit(); print ''; print ''; print ''; - print 'rowid.'">'; + print 'rowid.'">'; print img_delete(); print ''; if ($num > 1) @@ -880,13 +902,13 @@ elseif ($fichinterid) print ''; if ($i > 0) { - print 'rowid.'">'; + print 'rowid.'">'; print img_up(); print ''; } if ($i < $num-1) { - print 'rowid.'">'; + print 'rowid.'">'; print img_down(); print ''; } @@ -902,12 +924,12 @@ elseif ($fichinterid) } // Ligne en mode update - if ($fichinter->statut == 0 && $_GET["action"] == 'editline' && $user->rights->ficheinter->creer && $_GET["ligne"] == $objp->rowid) + if ($object->statut == 0 && $action == 'editline' && $user->rights->ficheinter->creer && $_GET["ligne"] == $objp->rowid) { - print '
rowid.'" method="post">'; + print 'rowid.'" method="post">'; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -944,7 +966,7 @@ elseif ($fichinterid) /* * Ajouter une ligne */ - if ($fichinter->statut == 0 && $user->rights->ficheinter->creer && $_GET["action"] <> 'editline') + if ($object->statut == 0 && $user->rights->ficheinter->creer && $action <> 'editline') { if (! $num) print '
'; @@ -959,9 +981,9 @@ elseif ($fichinterid) print "\n"; // Ajout ligne d'intervention - print ''; + print ''; print ''; - print ''; + print ''; print ''; $var=false; @@ -1012,43 +1034,63 @@ elseif ($fichinterid) if ($user->societe_id == 0) { - if ($_GET['action'] != 'editdescription') + if ($action != 'editdescription') { // Validate - if ($fichinter->statut == 0 && $user->rights->ficheinter->creer) + if ($object->statut == 0 && $user->rights->ficheinter->creer) { - print ''.$langs->trans("Valid").''; } // Modify - if ($fichinter->statut == 1 && $user->rights->ficheinter->creer) + if ($object->statut == 1 && $user->rights->ficheinter->creer) { - print ''.$langs->trans("Modify").''; } // Send - if ($fichinter->statut == 1) + if ($object->statut > 0) { - $ficheinterref = dol_sanitizeFileName($fichinter->ref); + $ficheinterref = dol_sanitizeFileName($object->ref); $file = $conf->ficheinter->dir_output . '/'.$ficheinterref.'/'.$ficheinterref.'.pdf'; if (file_exists($file)) { if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send) { - print ''.$langs->trans('SendByMail').''; + print ''.$langs->trans('SendByMail').''; } else print ''.$langs->trans('SendByMail').''; } } - // Delete - if (($fichinter->statut == 0 && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) + // Invoicing + if ($conf->facture->enabled && $object->statut > 0) { - print 'load("bills"); + if ($object->statut < 2) + { + if ($user->rights->facture->creer) print ''.$langs->trans("CreateBill").''; + else print ''.$langs->trans("CreateBill").''; + } + + if (! empty($conf->global->FICHEINTER_CLASSIFY_BILLED)) + { + if ($object->statut != 2) + { + print ''.$langs->trans("ClassifyBilled").''; + } + } + } + + // Delete + if (($object->statut == 0 && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) + { + print ''.$langs->trans('Delete').''; } + } } @@ -1058,9 +1100,9 @@ elseif ($fichinterid) /* * Action presend */ - if ($_GET['action'] == 'presend') + if ($action == 'presend') { - $ref = dol_sanitizeFileName($fichinter->ref); + $ref = dol_sanitizeFileName($object->ref); $file = $conf->ficheinter->dir_output . '/' . $ref . '/' . $ref . '.pdf'; print '
'; @@ -1087,18 +1129,18 @@ elseif ($fichinterid) $formmail->withcancel=1; // Tableau des substitutions - $formmail->substit['__FICHREF__']=$fichinter->ref; + $formmail->substit['__FICHREF__']=$object->ref; // Tableau des parametres complementaires $formmail->param['action']='send'; $formmail->param['models']='fichinter_send'; - $formmail->param['fichinter_id']=$fichinter->id; - $formmail->param['returnurl']=DOL_URL_ROOT.'/fichinter/fiche.php?id='.$fichinter->id; + $formmail->param['fichinter_id']=$object->id; + $formmail->param['returnurl']=DOL_URL_ROOT.'/fichinter/fiche.php?id='.$object->id; // Init list of files if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init') { $formmail->clear_attached_files(); - $formmail->add_attached_files($file,$fichinter->ref.'.pdf','application/pdf'); + $formmail->add_attached_files($file,$object->ref.'.pdf','application/pdf'); } $formmail->show_form(); @@ -1111,9 +1153,9 @@ elseif ($fichinterid) /* * Built documents */ - $filename=dol_sanitizeFileName($fichinter->ref); - $filedir=$conf->ficheinter->dir_output . "/".$fichinter->ref; - $urlsource=$_SERVER["PHP_SELF"]."?id=".$fichinter->id; + $filename=dol_sanitizeFileName($object->ref); + $filedir=$conf->ficheinter->dir_output . "/".$object->ref; + $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed=$user->rights->ficheinter->creer; $delallowed=$user->rights->ficheinter->supprimer; $genallowed=1; @@ -1122,8 +1164,12 @@ elseif ($fichinterid) $var=true; print "
\n"; - $somethingshown=$formfile->show_documents('ficheinter',$filename,$filedir,$urlsource,$genallowed,$delallowed,$fichinter->modelpdf,1,0,0,28,0,'','','',$societe->default_lang); + $somethingshown=$formfile->show_documents('ficheinter',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$societe->default_lang); + /* + * Linked object block + */ + $somethingshown=$object->showLinkedObjectBlock(); print ""; print "
"; print " 
\n"; @@ -1132,5 +1178,5 @@ elseif ($fichinterid) $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/02 17:14:58 $ - $Revision: 1.165 $'); ?> diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index bcbc0beba4f..9afa9447bb9 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -1,8 +1,8 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2011 Juanjo Menent * * 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 @@ -23,7 +23,7 @@ * \file htdocs/fichinter/index.php * \brief List of all interventions * \ingroup ficheinter - * \version $Id$ + * \version $Id: index.php,v 1.65 2011/07/02 16:48:32 eldy Exp $ */ require("../main.inc.php"); @@ -117,10 +117,11 @@ if ($result) print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ' '; + print ' '; print ' '; print ''; print "\n"; @@ -145,7 +146,8 @@ if ($result) $companystatic->id=$objp->socid; $companystatic->client=$objp->client; print $companystatic->getNomUrl(1,'',44); - print ''.dol_htmlentitiesbr(dol_trunc($objp->description,20)).''; + print ''; + print ''.dol_htmlentitiesbr(dol_trunc($objp->description,20)).''; print ''.dol_htmlentitiesbr(dol_trunc($objp->descriptiondetail,20)).''; print ''.dol_print_date($db->jdate($objp->dp),'dayhour')."\n"; print ''.ConvertSecondToTime($objp->duree).''; @@ -171,5 +173,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.65 $'); ?> diff --git a/htdocs/fichinter/info.php b/htdocs/fichinter/info.php index 22f934f35f6..3e63f0c0afc 100644 --- a/htdocs/fichinter/info.php +++ b/htdocs/fichinter/info.php @@ -22,7 +22,7 @@ * \file htdocs/fichinter/info.php * \ingroup fichinter * \brief Page d'affichage des infos d'une fiche d'intervention - * \version $Id$ + * \version $Id: info.php,v 1.14 2011/07/02 17:33:24 eldy Exp $ */ require("../main.inc.php"); @@ -31,6 +31,7 @@ require_once(DOL_DOCUMENT_ROOT."/fichinter/class/fichinter.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/fichinter.lib.php"); $langs->load('companies'); +$langs->load("interventions"); $fichinterid = GETPOST("id"); @@ -64,5 +65,5 @@ print ''; $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/02 17:33:24 $ - $Revision: 1.14 $'); ?> diff --git a/htdocs/fichinter/note.php b/htdocs/fichinter/note.php index 7b3a9cdea82..c30d20359d9 100644 --- a/htdocs/fichinter/note.php +++ b/htdocs/fichinter/note.php @@ -21,7 +21,7 @@ * \file htdocs/fichinter/note.php * \ingroup fichinter * \brief Fiche d'information sur une fiche d'intervention - * \version $Id$ + * \version $Id: note.php,v 1.18 2011/07/02 17:33:24 eldy Exp $ */ require("../main.inc.php"); @@ -29,6 +29,7 @@ require_once(DOL_DOCUMENT_ROOT."/fichinter/class/fichinter.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/fichinter.lib.php"); $langs->load('companies'); +$langs->load("interventions"); $fichinterid = GETPOST("id"); $action=GETPOST("action"); @@ -167,5 +168,5 @@ if ($fichinterid) } } $db->close(); -llxFooter('$Date$ - $Revision: 1.15 '); +llxFooter('$Date: 2011/07/02 17:33:24 $ - $Revision: 1.15 '); ?> diff --git a/htdocs/fichinter/rapport.php b/htdocs/fichinter/rapport.php index e441657c6b9..88c3666c40b 100644 --- a/htdocs/fichinter/rapport.php +++ b/htdocs/fichinter/rapport.php @@ -17,12 +17,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Id$ + * $Id: rapport.php,v 1.25 2011/07/02 17:33:24 eldy Exp $ */ require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php"); +$langs->load("interventions"); + // Security check if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'ficheinter', $fichinterid, 'fichinter'); @@ -142,5 +144,5 @@ else } $db->close(); -llxFooter("$Date$ - $Revision$"); +llxFooter("$Date: 2011/07/02 17:33:24 $ - $Revision: 1.25 $"); ?> diff --git a/htdocs/fichinter/tpl/linkedobjectblock.tpl.php b/htdocs/fichinter/tpl/linkedobjectblock.tpl.php new file mode 100755 index 00000000000..193e9eaf838 --- /dev/null +++ b/htdocs/fichinter/tpl/linkedobjectblock.tpl.php @@ -0,0 +1,58 @@ + + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id: linkedobjectblock.tpl.php,v 1.1 2011/07/01 16:24:44 simnandez Exp $ + */ +?> + + + +linkedObjectBlock; + +$langs->load("interventions"); +echo '
'; +print_titre($langs->trans('RelatedInterventions')); + +?> + + + + + + + + > + + + + + +
trans("Ref"); ?>trans("Date"); ?>trans("Status"); ?>
+ trans("ShowIntervention"),"intervention").' '.$object->ref; ?>datev,'day'); ?>getLibStatut(3); ?>
+ + \ No newline at end of file diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 8fc6001ac68..72894a685c4 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -25,7 +25,7 @@ * \file htdocs/fourn/commande/fiche.php * \ingroup supplier, order * \brief Card supplier order - * \version $Id$ + * \version $Id: fiche.php,v 1.230 2011/07/02 16:48:32 eldy Exp $ */ require("../../main.inc.php"); @@ -559,7 +559,7 @@ if ($action == 'create') } $id=$orderid; - + $db->commit(); } else @@ -685,7 +685,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P $result=$mailfile->sendfile(); if ($result) { - $mesg=$langs->trans('MailSuccessfulySent',$from,$sendto); // Must not contain " + $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain " $error=0; @@ -1545,5 +1545,5 @@ if ($id > 0 || ! empty($ref)) $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.230 $'); ?> diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 62fafb2893f..561e484a7ba 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -25,7 +25,7 @@ * \file htdocs/fourn/facture/fiche.php * \ingroup facture, fournisseur * \brief Page for supplier invoice card (view, edit, validate) - * \version $Id$ + * \version $Id: fiche.php,v 1.259 2011/07/02 16:48:32 eldy Exp $ */ require("../../main.inc.php"); @@ -738,7 +738,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] $result=$mailfile->sendfile(); if ($result) { - $mesg=$langs->trans('MailSuccessfulySent',$from,$sendto); // Must not contain " + $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain " $error=0; @@ -1916,5 +1916,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.259 $'); ?> diff --git a/htdocs/includes/jcrop/.cvsignore b/htdocs/includes/jquery/plugins/jcrop/.cvsignore old mode 100644 new mode 100755 similarity index 100% rename from htdocs/includes/jcrop/.cvsignore rename to htdocs/includes/jquery/plugins/jcrop/.cvsignore diff --git a/htdocs/includes/jcrop/css/Jcrop.gif b/htdocs/includes/jquery/plugins/jcrop/css/Jcrop.gif old mode 100644 new mode 100755 similarity index 100% rename from htdocs/includes/jcrop/css/Jcrop.gif rename to htdocs/includes/jquery/plugins/jcrop/css/Jcrop.gif diff --git a/htdocs/includes/jcrop/css/jquery.Jcrop.css b/htdocs/includes/jquery/plugins/jcrop/css/jquery.Jcrop.css old mode 100644 new mode 100755 similarity index 100% rename from htdocs/includes/jcrop/css/jquery.Jcrop.css rename to htdocs/includes/jquery/plugins/jcrop/css/jquery.Jcrop.css diff --git a/htdocs/includes/jcrop/index.html b/htdocs/includes/jquery/plugins/jcrop/index.html old mode 100644 new mode 100755 similarity index 100% rename from htdocs/includes/jcrop/index.html rename to htdocs/includes/jquery/plugins/jcrop/index.html diff --git a/htdocs/includes/jcrop/js/jquery.Jcrop.js b/htdocs/includes/jquery/plugins/jcrop/js/jquery.Jcrop.js old mode 100644 new mode 100755 similarity index 100% rename from htdocs/includes/jcrop/js/jquery.Jcrop.js rename to htdocs/includes/jquery/plugins/jcrop/js/jquery.Jcrop.js diff --git a/htdocs/includes/jcrop/js/jquery.Jcrop.min.js b/htdocs/includes/jquery/plugins/jcrop/js/jquery.Jcrop.min.js old mode 100644 new mode 100755 similarity index 100% rename from htdocs/includes/jcrop/js/jquery.Jcrop.min.js rename to htdocs/includes/jquery/plugins/jcrop/js/jquery.Jcrop.min.js diff --git a/htdocs/includes/jcrop/js/jquery.min.js b/htdocs/includes/jquery/plugins/jcrop/js/jquery.min.js old mode 100644 new mode 100755 similarity index 100% rename from htdocs/includes/jcrop/js/jquery.min.js rename to htdocs/includes/jquery/plugins/jcrop/js/jquery.min.js diff --git a/htdocs/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css b/htdocs/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css index ac68529042a..7dfa1c3b14f 100755 --- a/htdocs/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css +++ b/htdocs/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css @@ -48,7 +48,6 @@ padding: 0 5px; font: bold 1.4em Arial,Helvetica,sans-serif; line-height: 1em; - color: #fff; text-decoration: none; z-index: 3; cursor: pointer; @@ -59,7 +58,7 @@ z-index: 2; padding: 20px; text-align: left; - color: #fff; + color: #446548; font: bold 1.2em verdana, arial, helvetica; line-height: 1.2em; } diff --git a/htdocs/includes/jquery/plugins/jstree/jquery.cookie.js b/htdocs/includes/jquery/plugins/jstree/jquery.cookie.js new file mode 100644 index 00000000000..6036754e815 --- /dev/null +++ b/htdocs/includes/jquery/plugins/jstree/jquery.cookie.js @@ -0,0 +1,96 @@ +/** + * Cookie plugin + * + * Copyright (c) 2006 Klaus Hartl (stilbuero.de) + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + */ + +/** + * Create a cookie with the given name and value and other optional parameters. + * + * @example $.cookie('the_cookie', 'the_value'); + * @desc Set the value of a cookie. + * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); + * @desc Create a cookie with all available options. + * @example $.cookie('the_cookie', 'the_value'); + * @desc Create a session cookie. + * @example $.cookie('the_cookie', null); + * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain + * used when the cookie was set. + * + * @param String name The name of the cookie. + * @param String value The value of the cookie. + * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. + * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. + * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. + * If set to null or omitted, the cookie will be a session cookie and will not be retained + * when the the browser exits. + * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). + * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). + * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will + * require a secure protocol (like HTTPS). + * @type undefined + * + * @name $.cookie + * @cat Plugins/Cookie + * @author Klaus Hartl/klaus.hartl@stilbuero.de + */ + +/** + * Get the value of a cookie with the given name. + * + * @example $.cookie('the_cookie'); + * @desc Get the value of a cookie. + * + * @param String name The name of the cookie. + * @return The value of the cookie. + * @type String + * + * @name $.cookie + * @cat Plugins/Cookie + * @author Klaus Hartl/klaus.hartl@stilbuero.de + */ +jQuery.cookie = function(name, value, options) { + if (typeof value != 'undefined') { // name and value given, set cookie + options = options || {}; + if (value === null) { + value = ''; + options.expires = -1; + } + var expires = ''; + if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { + var date; + if (typeof options.expires == 'number') { + date = new Date(); + date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); + } else { + date = options.expires; + } + expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE + } + // CAUTION: Needed to parenthesize options.path and options.domain + // in the following expressions, otherwise they evaluate to undefined + // in the packed version for some reason... + var path = options.path ? '; path=' + (options.path) : ''; + var domain = options.domain ? '; domain=' + (options.domain) : ''; + var secure = options.secure ? '; secure' : ''; + document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); + } else { // only name given, get cookie + var cookieValue = null; + if (document.cookie && document.cookie != '') { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = jQuery.trim(cookies[i]); + // Does this cookie string begin with the name we want? + if (cookie.substring(0, name.length + 1) == (name + '=')) { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } +}; \ No newline at end of file diff --git a/htdocs/includes/jquery/plugins/jstree/jquery.hotkeys.js b/htdocs/includes/jquery/plugins/jstree/jquery.hotkeys.js new file mode 100644 index 00000000000..cd62905fbce --- /dev/null +++ b/htdocs/includes/jquery/plugins/jstree/jquery.hotkeys.js @@ -0,0 +1,99 @@ +/* + * jQuery Hotkeys Plugin + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * + * Based upon the plugin by Tzury Bar Yochay: + * http://github.com/tzuryby/hotkeys + * + * Original idea by: + * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/ +*/ + +(function(jQuery){ + + jQuery.hotkeys = { + version: "0.8", + + specialKeys: { + 8: "backspace", 9: "tab", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause", + 20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home", + 37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del", + 96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7", + 104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/", + 112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8", + 120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 191: "/", 224: "meta" + }, + + shiftNums: { + "`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&", + "8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<", + ".": ">", "/": "?", "\\": "|" + } + }; + + function keyHandler( handleObj ) { + // Only care when a possible input has been specified + if ( typeof handleObj.data !== "string" ) { + return; + } + + var origHandler = handleObj.handler, + keys = handleObj.data.toLowerCase().split(" "); + + handleObj.handler = function( event ) { + // Don't fire in text-accepting inputs that we didn't directly bind to + if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) || + event.target.type === "text") ) { + return; + } + + // Keypress represents characters, not special keys + var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[ event.which ], + character = String.fromCharCode( event.which ).toLowerCase(), + key, modif = "", possible = {}; + + // check combinations (alt|ctrl|shift+anything) + if ( event.altKey && special !== "alt" ) { + modif += "alt+"; + } + + if ( event.ctrlKey && special !== "ctrl" ) { + modif += "ctrl+"; + } + + // TODO: Need to make sure this works consistently across platforms + if ( event.metaKey && !event.ctrlKey && special !== "meta" ) { + modif += "meta+"; + } + + if ( event.shiftKey && special !== "shift" ) { + modif += "shift+"; + } + + if ( special ) { + possible[ modif + special ] = true; + + } else { + possible[ modif + character ] = true; + possible[ modif + jQuery.hotkeys.shiftNums[ character ] ] = true; + + // "$" can be triggered as "Shift+4" or "Shift+$" or just "$" + if ( modif === "shift+" ) { + possible[ jQuery.hotkeys.shiftNums[ character ] ] = true; + } + } + + for ( var i = 0, l = keys.length; i < l; i++ ) { + if ( possible[ keys[i] ] ) { + return origHandler.apply( this, arguments ); + } + } + }; + } + + jQuery.each([ "keydown", "keyup", "keypress" ], function() { + jQuery.event.special[ this ] = { add: keyHandler }; + }); + +})( jQuery ); \ No newline at end of file diff --git a/htdocs/includes/jquery/plugins/jstree/jquery.jstree.min.jgz b/htdocs/includes/jquery/plugins/jstree/jquery.jstree.min.jgz new file mode 100644 index 00000000000..2fbed408bc1 Binary files /dev/null and b/htdocs/includes/jquery/plugins/jstree/jquery.jstree.min.jgz differ diff --git a/htdocs/includes/jquery/plugins/jstree/jquery.jstree.min.js b/htdocs/includes/jquery/plugins/jstree/jquery.jstree.min.js new file mode 100644 index 00000000000..84fc5d24d04 --- /dev/null +++ b/htdocs/includes/jquery/plugins/jstree/jquery.jstree.min.js @@ -0,0 +1,597 @@ +"use strict";(function(){if(jQuery&&jQuery.jstree){return;} +var is_ie6=false,is_ie7=false,is_ff2=false;(function($){$.vakata={};$.vakata.css={get_css:function(rule_name,delete_flag,sheet){rule_name=rule_name.toLowerCase();var css_rules=sheet.cssRules||sheet.rules,j=0;do{if(css_rules.length&&j>css_rules.length+5){return false;} +if(css_rules[j].selectorText&&css_rules[j].selectorText.toLowerCase()==rule_name){if(delete_flag===true){if(sheet.removeRule){sheet.removeRule(j);} +if(sheet.deleteRule){sheet.deleteRule(j);} +return true;} +else{return css_rules[j];}}} +while(css_rules[++j]);return false;},add_css:function(rule_name,sheet){if($.jstree.css.get_css(rule_name,false,sheet)){return false;} +if(sheet.insertRule){sheet.insertRule(rule_name+' { }',0);}else{sheet.addRule(rule_name,null,0);} +return $.vakata.css.get_css(rule_name);},remove_css:function(rule_name,sheet){return $.vakata.css.get_css(rule_name,true,sheet);},add_sheet:function(opts){var tmp=false,is_new=true;if(opts.str){if(opts.title){tmp=$("style[id='"+opts.title+"-stylesheet']")[0];} +if(tmp){is_new=false;} +else{tmp=document.createElement("style");tmp.setAttribute('type',"text/css");if(opts.title){tmp.setAttribute("id",opts.title+"-stylesheet");}} +if(tmp.styleSheet){if(is_new){document.getElementsByTagName("head")[0].appendChild(tmp);tmp.styleSheet.cssText=opts.str;} +else{tmp.styleSheet.cssText=tmp.styleSheet.cssText+" "+opts.str;}} +else{tmp.appendChild(document.createTextNode(opts.str));document.getElementsByTagName("head")[0].appendChild(tmp);} +return tmp.sheet||tmp.styleSheet;} +if(opts.url){if(document.createStyleSheet){try{tmp=document.createStyleSheet(opts.url);}catch(e){}} +else{tmp=document.createElement('link');tmp.rel='stylesheet';tmp.type='text/css';tmp.media="all";tmp.href=opts.url;document.getElementsByTagName("head")[0].appendChild(tmp);return tmp.styleSheet;}}}};var instances=[],focused_instance=-1,plugins={},prepared_move={};$.fn.jstree=function(settings){var isMethodCall=(typeof settings=='string'),args=Array.prototype.slice.call(arguments,1),returnValue=this;if(isMethodCall){if(settings.substring(0,1)=='_'){return returnValue;} +this.each(function(){var instance=instances[$.data(this,"jstree-instance-id")],methodValue=(instance&&$.isFunction(instance[settings]))?instance[settings].apply(instance,args):instance;if(typeof methodValue!=="undefined"&&(settings.indexOf("is_")===0||(methodValue!==true&&methodValue!==false))){returnValue=methodValue;return false;}});} +else{this.each(function(){var instance_id=$.data(this,"jstree-instance-id"),a=[],b=settings?$.extend({},true,settings):{},c=$(this),s=false,t=[];a=a.concat(args);if(c.data("jstree")){a.push(c.data("jstree"));} +b=a.length?$.extend.apply(null,[true,b].concat(a)):b;if(typeof instance_id!=="undefined"&&instances[instance_id]){instances[instance_id].destroy();} +instance_id=parseInt(instances.push({}),10)-1;$.data(this,"jstree-instance-id",instance_id);b.plugins=$.isArray(b.plugins)?b.plugins:$.jstree.defaults.plugins.slice();b.plugins.unshift("core");b.plugins=b.plugins.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");s=$.extend(true,{},$.jstree.defaults,b);s.plugins=b.plugins;$.each(plugins,function(i,val){if($.inArray(i,s.plugins)===-1){s[i]=null;delete s[i];} +else{t.push(i);}});s.plugins=t;instances[instance_id]=new $.jstree._instance(instance_id,$(this).addClass("jstree jstree-"+instance_id),s);$.each(instances[instance_id]._get_settings().plugins,function(i,val){instances[instance_id].data[val]={};});$.each(instances[instance_id]._get_settings().plugins,function(i,val){if(plugins[val]){plugins[val].__init.apply(instances[instance_id]);}});setTimeout(function(){instances[instance_id].init();},0);});} +return returnValue;};$.jstree={defaults:{plugins:[]},_focused:function(){return instances[focused_instance]||null;},_reference:function(needle){if(instances[needle]){return instances[needle];} +var o=$(needle);if(!o.length&&typeof needle==="string"){o=$("#"+needle);} +if(!o.length){return null;} +return instances[o.closest(".jstree").data("jstree-instance-id")]||null;},_instance:function(index,container,settings){this.data={core:{}};this.get_settings=function(){return $.extend(true,{},settings);};this._get_settings=function(){return settings;};this.get_index=function(){return index;};this.get_container=function(){return container;};this.get_container_ul=function(){return container.children("ul:eq(0)");};this._set_settings=function(s){settings=$.extend(true,{},settings,s);};},_fn:{},plugin:function(pname,pdata){pdata=$.extend({},{__init:$.noop,__destroy:$.noop,_fn:{},defaults:false},pdata);plugins[pname]=pdata;$.jstree.defaults[pname]=pdata.defaults;$.each(pdata._fn,function(i,val){val.plugin=pname;val.old=$.jstree._fn[i];$.jstree._fn[i]=function(){var rslt,func=val,args=Array.prototype.slice.call(arguments),evnt=new $.Event("before.jstree"),rlbk=false;if(this.data.core.locked===true&&i!=="unlock"&&i!=="is_locked"){return;} +do{if(func&&func.plugin&&$.inArray(func.plugin,this._get_settings().plugins)!==-1){break;} +func=func.old;}while(func);if(!func){return;} +if(i.indexOf("_")===0){rslt=func.apply(this,args);} +else{rslt=this.get_container().triggerHandler(evnt,{"func":i,"inst":this,"args":args,"plugin":func.plugin});if(rslt===false){return;} +if(typeof rslt!=="undefined"){args=rslt;} +rslt=func.apply($.extend({},this,{__callback:function(data){this.get_container().triggerHandler(i+'.jstree',{"inst":this,"args":args,"rslt":data,"rlbk":rlbk});},__rollback:function(){rlbk=this.get_rollback();return rlbk;},__call_old:function(replace_arguments){return func.old.apply(this,(replace_arguments?Array.prototype.slice.call(arguments,1):args));}}),args);} +return rslt;};$.jstree._fn[i].old=val.old;$.jstree._fn[i].plugin=pname;});},rollback:function(rb){if(rb){if(!$.isArray(rb)){rb=[rb];} +$.each(rb,function(i,val){instances[val.i].set_rollback(val.h,val.d);});}}};$.jstree._fn=$.jstree._instance.prototype={};$(function(){var u=navigator.userAgent.toLowerCase(),v=(u.match(/.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,'0'])[1],css_string=''+'.jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } '+'.jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; min-width:18px; } '+'.jstree-rtl li { margin-left:0; margin-right:18px; } '+'.jstree > ul > li { margin-left:0px; } '+'.jstree-rtl > ul > li { margin-right:0px; } '+'.jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } '+'.jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } '+'.jstree a:focus { outline: none; } '+'.jstree a > ins { height:16px; width:16px; } '+'.jstree a > .jstree-icon { margin-right:3px; } '+'.jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } '+'li.jstree-open > ul { display:block; } '+'li.jstree-closed > ul { display:none; } ';if(/msie/.test(u)&&parseInt(v,10)==6){is_ie6=true;try{document.execCommand("BackgroundImageCache",false,true);}catch(err){} +css_string+=''+'.jstree li { height:18px; margin-left:0; margin-right:0; } '+'.jstree li li { margin-left:18px; } '+'.jstree-rtl li li { margin-left:0px; margin-right:18px; } '+'li.jstree-open ul { display:block; } '+'li.jstree-closed ul { display:none !important; } '+'.jstree li a { display:inline; border-width:0 !important; padding:0px 2px !important; } '+'.jstree li a ins { height:16px; width:16px; margin-right:3px; } '+'.jstree-rtl li a ins { margin-right:0px; margin-left:3px; } ';} +if(/msie/.test(u)&&parseInt(v,10)==7){is_ie7=true;css_string+='.jstree li a { border-width:0 !important; padding:0px 2px !important; } ';} +if(!/compatible/.test(u)&&/mozilla/.test(u)&&parseFloat(v,10)<1.9){is_ff2=true;css_string+=''+'.jstree ins { display:-moz-inline-box; } '+'.jstree li { line-height:12px; } '+'.jstree a { display:-moz-inline-box; } '+'.jstree .jstree-no-icons .jstree-checkbox { display:-moz-inline-stack !important; } ';} +$.vakata.css.add_sheet({str:css_string,title:"jstree"});});$.jstree.plugin("core",{__init:function(){this.data.core.locked=false;this.data.core.to_open=this.get_settings().core.initially_open;this.data.core.to_load=this.get_settings().core.initially_load;},defaults:{html_titles:false,animation:500,initially_open:[],initially_load:[],open_parents:true,notify_plugins:true,rtl:false,load_open:false,strings:{loading:"Loading ...",new_node:"New node",multiple_selection:"Multiple selection"}},_fn:{init:function(){this.set_focus();if(this._get_settings().core.rtl){this.get_container().addClass("jstree-rtl").css("direction","rtl");} +this.get_container().html("");this.data.core.li_height=this.get_container_ul().find("li.jstree-closed, li.jstree-leaf").eq(0).height()||18;this.get_container().delegate("li > ins","click.jstree",$.proxy(function(event){var trgt=$(event.target);if(trgt.is("ins")&&event.pageY-trgt.offset().top ul > li:first-child");} +if(!obj.length){return false;} +if(strict){return(obj.nextAll("li").size()>0)?obj.nextAll("li:eq(0)"):false;} +if(obj.hasClass("jstree-open")){return obj.find("li:eq(0)");} +else if(obj.nextAll("li").size()>0){return obj.nextAll("li:eq(0)");} +else{return obj.parentsUntil(".jstree","li").next("li").eq(0);}},_get_prev:function(obj,strict){obj=this._get_node(obj);if(obj===-1){return this.get_container().find("> ul > li:last-child");} +if(!obj.length){return false;} +if(strict){return(obj.prevAll("li").length>0)?obj.prevAll("li:eq(0)"):false;} +if(obj.prev("li").length){obj=obj.prev("li").eq(0);while(obj.hasClass("jstree-open")){obj=obj.children("ul:eq(0)").children("li:last");} +return obj;} +else{var o=obj.parentsUntil(".jstree","li:eq(0)");return o.length?o:false;}},_get_parent:function(obj){obj=this._get_node(obj);if(obj==-1||!obj.length){return false;} +var o=obj.parentsUntil(".jstree","li:eq(0)");return o.length?o:-1;},_get_children:function(obj){obj=this._get_node(obj);if(obj===-1){return this.get_container().children("ul:eq(0)").children("li");} +if(!obj.length){return false;} +return obj.children("ul:eq(0)").children("li");},get_path:function(obj,id_mode){var p=[],_this=this;obj=this._get_node(obj);if(obj===-1||!obj||!obj.length){return false;} +obj.parentsUntil(".jstree","li").each(function(){p.push(id_mode?this.id:_this.get_text(this));});p.reverse();p.push(id_mode?obj.attr("id"):this.get_text(obj));return p;},_get_string:function(key){return this._get_settings().core.strings[key]||key;},is_open:function(obj){obj=this._get_node(obj);return obj&&obj!==-1&&obj.hasClass("jstree-open");},is_closed:function(obj){obj=this._get_node(obj);return obj&&obj!==-1&&obj.hasClass("jstree-closed");},is_leaf:function(obj){obj=this._get_node(obj);return obj&&obj!==-1&&obj.hasClass("jstree-leaf");},correct_state:function(obj){obj=this._get_node(obj);if(!obj||obj===-1){return false;} +obj.removeClass("jstree-closed jstree-open").addClass("jstree-leaf").children("ul").remove();this.__callback({"obj":obj});},open_node:function(obj,callback,skip_animation){obj=this._get_node(obj);if(!obj.length){return false;} +if(!obj.hasClass("jstree-closed")){if(callback){callback.call();}return false;} +var s=skip_animation||is_ie6?0:this._get_settings().core.animation,t=this;if(!this._is_loaded(obj)){obj.children("a").addClass("jstree-loading");this.load_node(obj,function(){t.open_node(obj,callback,skip_animation);},callback);} +else{if(this._get_settings().core.open_parents){obj.parentsUntil(".jstree",".jstree-closed").each(function(){t.open_node(this,false,true);});} +if(s){obj.children("ul").css("display","none");} +obj.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading");if(s){obj.children("ul").stop(true,true).slideDown(s,function(){this.style.display="";t.after_open(obj);});} +else{t.after_open(obj);} +this.__callback({"obj":obj});if(callback){callback.call();}}},after_open:function(obj){this.__callback({"obj":obj});},close_node:function(obj,skip_animation){obj=this._get_node(obj);var s=skip_animation||is_ie6?0:this._get_settings().core.animation,t=this;if(!obj.length||!obj.hasClass("jstree-open")){return false;} +if(s){obj.children("ul").attr("style","display:block !important");} +obj.removeClass("jstree-open").addClass("jstree-closed");if(s){obj.children("ul").stop(true,true).slideUp(s,function(){this.style.display="";t.after_close(obj);});} +else{t.after_close(obj);} +this.__callback({"obj":obj});},after_close:function(obj){this.__callback({"obj":obj});},toggle_node:function(obj){obj=this._get_node(obj);if(obj.hasClass("jstree-closed")){return this.open_node(obj);} +if(obj.hasClass("jstree-open")){return this.close_node(obj);}},open_all:function(obj,do_animation,original_obj){obj=obj?this._get_node(obj):-1;if(!obj||obj===-1){obj=this.get_container_ul();} +if(original_obj){obj=obj.find("li.jstree-closed");} +else{original_obj=obj;if(obj.is(".jstree-closed")){obj=obj.find("li.jstree-closed").andSelf();} +else{obj=obj.find("li.jstree-closed");}} +var _this=this;obj.each(function(){var __this=this;if(!_this._is_loaded(this)){_this.open_node(this,function(){_this.open_all(__this,do_animation,original_obj);},!do_animation);} +else{_this.open_node(this,false,!do_animation);}});if(original_obj.find('li.jstree-closed').length===0){this.__callback({"obj":original_obj});}},close_all:function(obj,do_animation){var _this=this;obj=obj?this._get_node(obj):this.get_container();if(!obj||obj===-1){obj=this.get_container_ul();} +obj.find("li.jstree-open").andSelf().each(function(){_this.close_node(this,!do_animation);});this.__callback({"obj":obj});},clean_node:function(obj){obj=obj&&obj!=-1?$(obj):this.get_container_ul();obj=obj.is("li")?obj.find("li").andSelf():obj.find("li");obj.removeClass("jstree-last").filter("li:last-child").addClass("jstree-last").end().filter(":has(li)").not(".jstree-open").removeClass("jstree-leaf").addClass("jstree-closed");obj.not(".jstree-open, .jstree-closed").addClass("jstree-leaf").children("ul").remove();this.__callback({"obj":obj});},get_rollback:function(){this.__callback();return{i:this.get_index(),h:this.get_container().children("ul").clone(true),d:this.data};},set_rollback:function(html,data){this.get_container().empty().append(html);this.data=data;this.__callback();},load_node:function(obj,s_call,e_call){this.__callback({"obj":obj});},_is_loaded:function(obj){return true;},create_node:function(obj,position,js,callback,is_loaded){obj=this._get_node(obj);position=typeof position==="undefined"?"last":position;var d=$("
  • "),s=this._get_settings().core,tmp;if(obj!==-1&&!obj.length){return false;} +if(!is_loaded&&!this._is_loaded(obj)){this.load_node(obj,function(){this.create_node(obj,position,js,callback,true);});return false;} +this.__rollback();if(typeof js==="string"){js={"data":js};} +if(!js){js={};} +if(js.attr){d.attr(js.attr);} +if(js.metadata){d.data(js.metadata);} +if(js.state){d.addClass("jstree-"+js.state);} +if(!js.data){js.data=this._get_string("new_node");} +if(!$.isArray(js.data)){tmp=js.data;js.data=[];js.data.push(tmp);} +$.each(js.data,function(i,m){tmp=$("");if($.isFunction(m)){m=m.call(this,js);} +if(typeof m=="string"){tmp.attr('href','#')[s.html_titles?"html":"text"](m);} +else{if(!m.attr){m.attr={};} +if(!m.attr.href){m.attr.href='#';} +tmp.attr(m.attr)[s.html_titles?"html":"text"](m.title);if(m.language){tmp.addClass(m.language);}} +tmp.prepend(" ");if(m.icon){if(m.icon.indexOf("/")===-1){tmp.children("ins").addClass(m.icon);} +else{tmp.children("ins").css("background","url('"+m.icon+"') center center no-repeat");}} +d.append(tmp);});d.prepend(" ");if(obj===-1){obj=this.get_container();if(position==="before"){position="first";} +if(position==="after"){position="last";}} +switch(position){case"before":obj.before(d);tmp=this._get_parent(obj);break;case"after":obj.after(d);tmp=this._get_parent(obj);break;case"inside":case"first":if(!obj.children("ul").length){obj.append("