From 3940abe7c19744764df53eeb31f758a2f9e92dc2 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Sat, 7 Feb 2015 10:48:03 +0100 Subject: [PATCH 01/63] FIX: select DISTINCT for natural search on proposal list (in the same way it's done in invoices list) --- htdocs/comm/propal/list.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index d45718b5daf..33748025edc 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -141,7 +141,9 @@ if (! $sortorder) $sortorder='DESC'; $limit = $conf->liste_limit; -$sql = 'SELECT s.rowid, s.nom, s.town, s.client, s.code_client,'; +if (! $sall) $sql = 'SELECT'; +else $sql = 'SELECT DISTINCT'; +$sql.= ' s.rowid, s.nom, s.town, s.client, s.code_client,'; $sql.= ' p.rowid as propalid, p.note_private, p.total_ht, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,'; if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,"; $sql.= ' u.login'; From 9a7a5b9b20c96a15a23c4a631b98279cdbd5c4a0 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sat, 7 Feb 2015 20:36:16 +0100 Subject: [PATCH 02/63] review product stats list --- htdocs/product/stats/commande.php | 210 +++++++---- htdocs/product/stats/commande_fournisseur.php | 325 +++++++++++------- htdocs/product/stats/facture.php | 109 ++++-- htdocs/product/stats/facture_fournisseur.php | 325 +++++++++++------- htdocs/product/stats/propal.php | 295 ++++++++++------ 5 files changed, 801 insertions(+), 463 deletions(-) diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 472b9ce4a45..68170bd19df 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2014 Florian Henry * * 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 @@ -27,6 +28,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $langs->load("orders"); $langs->load("products"); @@ -38,7 +40,8 @@ $ref = GETPOST('ref', 'alpha'); // Security check $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); -if ($user->societe_id) $socid=$user->societe_id; +$socid=''; +if (! empty($user->societe_id)) $socid=$user->societe_id; $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array @@ -55,13 +58,23 @@ $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="c.date_commande"; +$search_month = GETPOST('search_month', 'aplha'); +$search_year = GETPOST('search_year', 'int'); +if (GETPOST("button_removefilter_x")) { + $search_month=''; + $search_year=''; +} /* * View */ +$orderstatic=new Commande($db); +$societestatic=new Societe($db); + $form = new Form($db); +$formother= new FormOther($db); if ($id > 0 || ! empty($ref)) { @@ -76,9 +89,6 @@ if ($id > 0 || ! empty($ref)) if ($result > 0) { - /* - * En mode visu - */ $head=product_prepare_head($product, $user); $titre=$langs->trans("CardProduct".$product->type); $picto=($product->type==1?'service':'product'); @@ -87,7 +97,6 @@ if ($id > 0 || ! empty($ref)) $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - print ''; // Reference @@ -117,83 +126,138 @@ if ($id > 0 || ! empty($ref)) print ''; - - $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client, c.rowid, c.total_ht as total_ht, c.ref,"; - $sql.= " c.date_commande, c.fk_statut as statut, c.facture, c.rowid as commandeid, d.qty"; - if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sql.= ", ".MAIN_DB_PREFIX."commande as c"; - $sql.= ", ".MAIN_DB_PREFIX."commandedet as d"; - if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE c.fk_soc = s.rowid"; - $sql.= " AND c.entity = ".$conf->entity; - $sql.= " AND d.fk_commande = c.rowid"; - $sql.= " AND d.fk_product =".$product->id; - if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socid) $sql.= " AND c.fk_soc = ".$socid; - $sql.= " ORDER BY $sortfield $sortorder "; - $sql.= $db->plimit($conf->liste_limit +1, $offset); - - $result = $db->query($sql); - if ($result) + if ($user->rights->commande->lire) { - $num = $db->num_rows($result); - - print_barre_liste($langs->trans("CustomersOrders"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num,0,''); - - $i = 0; - print "
"; - - print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"c.rowid","","&id=".$product->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&id=".$product->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","","&id=".$product->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("OrderDate"),$_SERVER["PHP_SELF"],"c.date_commande","","&id=".$product->id,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","","&id=".$product->id,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"c.total_ht","","&id=".$product->id,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"c.fk_statut","","&id=".$product->id,'align="right"',$sortfield,$sortorder); - print "\n"; - - $commandestatic=new Commande($db); - - if ($num > 0) + $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client, c.rowid, c.total_ht as total_ht, c.ref,"; + $sql .= " c.ref_client,"; + $sql.= " c.date_commande, c.fk_statut as statut, c.facture, c.rowid as commandeid, d.qty"; + if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; + $sql.= ", ".MAIN_DB_PREFIX."commande as c"; + $sql.= ", ".MAIN_DB_PREFIX."commandedet as d"; + if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= " WHERE c.fk_soc = s.rowid"; + $sql.= " AND c.entity = ".$conf->entity; + $sql.= " AND d.fk_commande = c.rowid"; + $sql.= " AND d.fk_product =".$product->id; + if (! empty($search_month)) + $sql.= ' AND MONTH(f.datef) IN (' . $search_month . ')'; + if (! empty($search_year)) + $sql.= ' AND YEAR(f.datef) IN (' . $search_year . ')'; + if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($socid) $sql.= " AND c.fk_soc = ".$socid; + $sql.= " ORDER BY $sortfield $sortorder "; + + //Calcul total qty and amount for global if full scan list + $total_ht=0; + $total_qty=0; + $totalrecords=0; + if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + $result = $db->query($sql); + if ($result) { + $totalrecords = $db->num_rows($result); + while ($objp = $db->fetch_object($result)) { + $total_ht+=$objp->total_ht; + $total_qty+=$objp->qty; + } + } + } + + $sql.= $db->plimit($conf->liste_limit +1, $offset); + + $result = $db->query($sql); + if ($result) { - $var=True; - while ($i < $num && $i < $conf->liste_limit) + $num = $db->num_rows($result); + + if (! empty($id)) + $option .= '&id='.$product->id; + if (! empty($search_month)) + $option .= '&search_month='.$search_month; + if (! empty($search_year)) + $option .= '&search_year='.$search_year; + + print '' . "\n"; + if (! empty($sortfield)) + print ''; + if (! empty($sortorder)) + print ''; + if (! empty($page)) { + print ''; + $option .= '&page=' . $page; + } + + print_barre_liste($langs->trans("CustomersOrders"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num,$totalrecords,''); + print '
'; + print $langs->trans('Period').'('.$langs->trans("DateInvoice") .') '; + print $langs->trans('Month') . ': '; + print $langs->trans('Year') . ':' . $formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5); + print ''; + print ''; + print '
'; + + $i = 0; + print '
'; + print ''; + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"c.rowid","",$option,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$option,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","",$option,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("OrderDate"),$_SERVER["PHP_SELF"],"c.date_commande","",$option,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","",$option,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"c.total_ht","",$option,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"c.fk_statut","",$option,'align="right"',$sortfield,$sortorder); + print "\n"; + + if ($num > 0) { - $objp = $db->fetch_object($result); - $var=!$var; - - print ""; - print '\n"; - print ''; - print "\n"; - print ""; - print "\n"; - print "\n"; - print ''; - print "\n"; - $i++; + $var=True; + while ($i < $num && $i < $conf->liste_limit) + { + $objp = $db->fetch_object($result); + $var=!$var; + + print ''; + print '\n"; + $societestatic->fetch($objp->socid); + print ''; + print "\n"; + print '"; + print '\n"; + print '\n"; + print ''; + print "\n"; + $i++; + + if (!empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + $total_ht+=$objp->total_ht; + $total_qty+=$objp->qty; + } + } } + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "
'.img_object($langs->trans("ShowOrder"),"order").' '; - print $objp->ref; - print "'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->name,44).'".$objp->code_client.""; - print dol_print_date($db->jdate($objp->date_commande))."".$objp->qty."".price($objp->total_ht)."'.$commandestatic->LibStatut($objp->statut,$objp->facture,5).'
'; + $orderstatic->id=$objp->commandeid; + $orderstatic->ref=$objp->ref; + $orderstatic->ref_client=$objp->ref_client; + print $orderstatic->getNomUrl(1); + print "'.$societestatic->getNomUrl(1).'".$objp->code_client."'; + print dol_print_date($db->jdate($objp->date_commande))."'.$objp->qty."'.price($objp->total_ht)."'.$commandestatic->LibStatut($objp->statut,$objp->facture,5).'
' . $langs->trans('Total') . ''.$total_qty.''.price($total_ht).'
"; + print ''; + print '
'; + } else { + dol_print_error($db); } + $db->free($result); } - else - { - dol_print_error($db); - } - print ""; - print '
'; - $db->free($result); } -} -else -{ +} else { dol_print_error(); } - llxFooter(); $db->close(); diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 73de0374ebe..f5b362d5423 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2014 Florian Henry * * 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 @@ -18,15 +19,15 @@ */ /** - * \file htdocs/product/stats/commande_fournisseur.php - * \ingroup product service commande - * \brief Page des stats des commandes fournisseurs pour un produit + * \file htdocs/product/stats/commande_fournisseur.php + * \ingroup product service commande + * \brief Page des stats des commandes fournisseurs pour un produit */ - require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; $langs->load("orders"); $langs->load("products"); @@ -38,157 +39,233 @@ $ref = GETPOST('ref', 'alpha'); // Security check $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); -if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); +$socid = ''; +if (! empty($user->societe_id)) + $socid = $user->societe_id; +$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('productstatssupplyorder')); +$hookmanager->initHooks(array ( + 'productstatssupplyorder' +)); $mesg = ''; -$sortfield = GETPOST("sortfield",'alpha'); -$sortorder = GETPOST("sortorder",'alpha'); -$page = GETPOST("page",'int'); -if ($page == -1) { $page = 0; } +$sortfield = GETPOST("sortfield", 'alpha'); +$sortorder = GETPOST("sortorder", 'alpha'); +$page = GETPOST("page", 'int'); +if ($page == - 1) { + $page = 0; +} $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortorder) $sortorder="DESC"; -if (! $sortfield) $sortfield="c.date_commande"; +if (! $sortorder) + $sortorder = "DESC"; +if (! $sortfield) + $sortfield = "c.date_commande"; +$search_month = GETPOST('search_month', 'aplha'); +$search_year = GETPOST('search_year', 'int'); +if (GETPOST("button_removefilter_x")) { + $search_month = ''; + $search_year = ''; +} /* * View */ -$form = new Form($db); +$commandefournstatic = new CommandeFournisseur($db); +$societestatic = new Societe($db); -if ($id > 0 || ! empty($ref)) -{ +$form = new Form($db); +$formother = new FormOther($db); + +if ($id > 0 || ! empty($ref)) { $product = new Product($db); $result = $product->fetch($id, $ref); - - $parameters=array('id'=>$id); - $reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - - llxHeader("","",$langs->trans("CardProduct".$product->type)); - - if ($result > 0) - { - $head=product_prepare_head($product, $user); - $titre=$langs->trans("CardProduct".$product->type); - $picto=($product->type==1?'service':'product'); + + $parameters = array ( + 'id' => $id + ); + $reshook = $hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + + llxHeader("", "", $langs->trans("CardProduct" . $product->type)); + + if ($result > 0) { + $head = product_prepare_head($product, $user); + $titre = $langs->trans("CardProduct" . $product->type); + $picto = ($product->type == 1 ? 'service' : 'product'); dol_fiche_head($head, 'referers', $titre, 0, $picto); - - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - + + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + print ''; - + // Reference print ''; - print ''; - + print ''; + print ''; + // Libelle - print ''; - + print ''; + print ''; + // Status (to sell) - print ''; - + // Status (to buy) - print ''; - - show_stats_for_company($product,$socid); - + + show_stats_for_company($product, $socid); + print "
'.$langs->trans("Ref").''; - print $form->showrefnav($product,'ref','',1,'ref'); - print '
' . $langs->trans("Ref") . ''; + print $form->showrefnav($product, 'ref', '', 1, 'ref'); + print '
'.$langs->trans("Label").''.$product->libelle.'
' . $langs->trans("Label") . '' . $product->libelle . '
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; - print $product->getLibStatut(2,0); + print '
' . $langs->trans("Status") . ' (' . $langs->trans("Sell") . ')'; + print $product->getLibStatut(2, 0); print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'; - print $product->getLibStatut(2,1); + print '
' . $langs->trans("Status") . ' (' . $langs->trans("Buy") . ')'; + print $product->getLibStatut(2, 1); print '
"; + print ''; - - $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client,"; - $sql.= " c.rowid, c.total_ht as total_ht, c.ref,"; - $sql.= " c.date_commande, c.fk_statut as statut, c.rowid as commandeid, d.qty"; - if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c"; - $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseurdet as d"; - if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE c.fk_soc = s.rowid"; - $sql.= " AND c.entity = ".$conf->entity; - $sql.= " AND d.fk_commande = c.rowid"; - $sql.= " AND d.fk_product =".$product->id; - if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socid) $sql.= " AND c.fk_soc = ".$socid; - $sql.= " ORDER BY $sortfield $sortorder "; - $sql.= $db->plimit($conf->liste_limit +1, $offset); - - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows($result); - - print_barre_liste($langs->trans("SuppliersOrders"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num,0,''); - - $i = 0; - print ""; - - print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"c.rowid","","&id=".$product->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&id=".$product->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("SupplierCode"),$_SERVER["PHP_SELF"],"s.code_client","","&id=".$product->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("OrderDate"),$_SERVER["PHP_SELF"],"c.date_commande","","&id=".$product->id,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","","&id=".$product->id,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"c.total_ht","","&id=".$product->id,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"c.fk_statut","","&id=".$product->id,'align="right"',$sortfield,$sortorder); - print "\n"; - - $commandestatic=new CommandeFournisseur($db); - - if ($num > 0) - { - $var=True; - while ($i < $num && $i < $conf->liste_limit) - { - $objp = $db->fetch_object($result); - $var=!$var; - - $commandestatic->id=$objp->commandeid; - $commandestatic->ref=$objp->ref; - $commandestatic->statut=$objp->statut; - - print ""; - print '\n"; - print "\n"; - print ''; - print "\n"; - print '"; - print "\n"; - print '\n"; - print ''; - print "\n"; - $i++; + + if ($user->rights->fournisseur->commande->lire) { + $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client,"; + $sql .= " c.rowid, c.total_ht as total_ht, c.ref,"; + $sql .= " c.date_commande, c.fk_statut as statut, c.rowid as commandeid, d.qty"; + if (! $user->rights->societe->client->voir && ! $socid) + $sql .= ", sc.fk_soc, sc.fk_user "; + $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; + $sql .= ", " . MAIN_DB_PREFIX . "commande_fournisseur as c"; + $sql .= ", " . MAIN_DB_PREFIX . "commande_fournisseurdet as d"; + if (! $user->rights->societe->client->voir && ! $socid) + $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; + $sql .= " WHERE c.fk_soc = s.rowid"; + $sql .= " AND c.entity = " . $conf->entity; + $sql .= " AND d.fk_commande = c.rowid"; + $sql .= " AND d.fk_product =" . $product->id; + if (! empty($search_month)) + $sql .= ' AND MONTH(f.datef) IN (' . $search_month . ')'; + if (! empty($search_year)) + $sql .= ' AND YEAR(f.datef) IN (' . $search_year . ')'; + if (! $user->rights->societe->client->voir && ! $socid) + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; + if ($socid) + $sql .= " AND c.fk_soc = " . $socid; + $sql .= " ORDER BY $sortfield $sortorder "; + + // Calcul total qty and amount for global if full scan list + $total_ht = 0; + $total_qty = 0; + $totalrecords = 0; + if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + $result = $db->query($sql); + if ($result) { + $totalrecords = $db->num_rows($result); + while ( $objp = $db->fetch_object($result) ) { + $total_ht += $objp->total_ht; + $total_qty += $objp->qty; + } } } + + $sql .= $db->plimit($conf->liste_limit + 1, $offset); + + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows($result); + + if (! empty($id)) + $option .= '&id=' . $product->id; + if (! empty($search_month)) + $option .= '&search_month=' . $search_month; + if (! empty($search_year)) + $option .= '&search_year=' . $search_year; + + print '' . "\n"; + if (! empty($sortfield)) + print ''; + if (! empty($sortorder)) + print ''; + if (! empty($page)) { + print ''; + $option .= '&page=' . $page; + } + + print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, ''); + print '
'; + print $langs->trans('Period') . '(' . $langs->trans("DateInvoice") . ') '; + print $langs->trans('Month') . ': '; + print $langs->trans('Year') . ':' . $formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5); + print ''; + print ''; + print '
'; + + $i = 0; + print '
'.$commandestatic->getNomUrl(1)."'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->name,44).'".$objp->code_client."'.dol_print_date($db->jdate($objp->date_commande))."".$objp->qty."'.price($objp->total_ht)."'.$commandestatic->getLibStatut(4).'
'; + print ''; + print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid", "", $option, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom", "", $option, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("SupplierCode"), $_SERVER["PHP_SELF"], "s.code_client", "", $option, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("OrderDate"), $_SERVER["PHP_SELF"], "c.date_commande", "", $option, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Qty"), $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("AmountHT"), $_SERVER["PHP_SELF"], "c.total_ht", "", $option, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "c.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder); + print "\n"; + + if ($num > 0) { + $var = True; + while ( $i < $num && $i < $conf->liste_limit ) { + $objp = $db->fetch_object($result); + $var = ! $var; + + print ''; + print '\n"; + $societestatic->fetch($objp->socid); + print ''; + print "\n"; + print '"; + print '\n"; + print '\n"; + print ''; + print "\n"; + $i ++; + + if (! empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + $total_ht += $objp->total_ht; + $total_qty += $objp->qty; + } + } + } + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "
'; + $commandestatic->id = $objp->commandeid; + $commandestatic->ref = $objp->ref; + $commandestatic->statut = $objp->statut; + print $commandestatic->getNomUrl(1); + print "' . $societestatic->getNomUrl(1) . '" . $objp->code_client . "'; + print dol_print_date($db->jdate($objp->date_commande)) . "' . $objp->qty . "' . price($objp->total_ht) . "' . $commandestatic->getLibStatut(4) . '
' . $langs->trans('Total') . '' . $total_qty . '' . price($total_ht) . '
"; + print ''; + print '
'; + } else { + dol_print_error($db); + } + $db->free($result); } - else - { - dol_print_error($db); - } - print ""; - print '
'; - $db->free($result); } -} -else -{ +} else { dol_print_error(); } - llxFooter(); $db->close(); diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 49e5651b065..8269a7f57da 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2014 Florian Henry * * 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 @@ -28,6 +29,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $langs->load("companies"); $langs->load("bills"); @@ -36,12 +38,11 @@ $langs->load("products"); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); -$socid=''; -if (! empty($user->societe_id)) $socid=$user->societe_id; - // Security check $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); +$socid=''; +if (! empty($user->societe_id)) $socid=$user->societe_id; $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array @@ -58,16 +59,23 @@ $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="f.datef"; +$search_month = GETPOST('search_month', 'aplha'); +$search_year = GETPOST('search_year', 'int'); +if (GETPOST("button_removefilter_x")) { + $search_month=''; + $search_year=''; +} /* * View */ $invoicestatic=new Facture($db); +$societestatic=new Societe($db); $form = new Form($db); - +$formother= new FormOther($db); if ($id > 0 || ! empty($ref)) { @@ -80,9 +88,6 @@ if ($id > 0 || ! empty($ref)) llxHeader("","",$langs->trans("CardProduct".$product->type)); - /* - * En mode visu - */ if ($result > 0) { $head=product_prepare_head($product, $user); @@ -136,33 +141,79 @@ if ($id > 0 || ! empty($ref)) $sql.= " AND f.entity = ".$conf->entity; $sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND d.fk_product =".$product->id; + if (! empty($search_month)) + $sql.= ' AND MONTH(f.datef) IN (' . $search_month . ')'; + if (! empty($search_year)) + $sql.= ' AND YEAR(f.datef) IN (' . $search_year . ')'; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socid) $sql.= " AND f.fk_soc = $socid"; + if ($socid) $sql.= " AND f.fk_soc = ".$socid; $sql.= " ORDER BY $sortfield $sortorder "; + + //Calcul total qty and amount for global if full scan list + $total_ht=0; + $total_qty=0; + $totalrecords=0; + if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + $result = $db->query($sql); + if ($result) { + $totalrecords = $db->num_rows($result); + while ($objp = $db->fetch_object($result)) { + $total_ht+=$objp->total_ht; + $total_qty+=$objp->qty; + } + } + } + $sql.= $db->plimit($conf->liste_limit +1, $offset); $result = $db->query($sql); - if ($result) { + if ($result) + { $num = $db->num_rows($result); - - print_barre_liste($langs->trans("CustomersInvoices"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num,0,''); + + if (! empty($id)) + $option .= '&id='.$product->id; + if (! empty($search_month)) + $option .= '&search_month='.$search_month; + if (! empty($search_year)) + $option .= '&search_year='.$search_year; + + print '
' . "\n"; + if (! empty($sortfield)) + print ''; + if (! empty($sortorder)) + print ''; + if (! empty($page)) { + print ''; + $option .= '&page=' . $page; + } + + print_barre_liste($langs->trans("CustomersInvoices"),$page,$_SERVER["PHP_SELF"],"&id=".$product->id,$sortfield,$sortorder,'',$num,$totalrecords,''); + print '
'; + print $langs->trans('Period').'('.$langs->trans("DateInvoice") .') '; + print $langs->trans('Month') . ': '; + print $langs->trans('Year') . ':' . $formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5); + print ''; + print ''; + print '
'; $i = 0; print ''; - print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"s.rowid","","&id=".$product->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&id=".$product->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","","&id=".$product->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&id=".$product->id,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","","&id=".$product->id,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","","&id=".$product->id,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","","&id=".$product->id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"s.rowid","",$option,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$option,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","",$option,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","",$option,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","",$option,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","",$option,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","",$option,'align="right"',$sortfield,$sortorder); print "\n"; - if ($num > 0) { + if ($num > 0) + { $var=True; - while ($i < $num && $i < $conf->liste_limit) { + while ($i < $num && $i < $conf->liste_limit) + { $objp = $db->fetch_object($result); $var=!$var; @@ -172,7 +223,8 @@ if ($id > 0 || ! empty($ref)) $invoicestatic->ref=$objp->facnumber; print $invoicestatic->getNomUrl(1); print "\n"; - print ''; + $societestatic->fetch($objp->socid); + print ''; print "\n"; print '"; @@ -181,9 +233,21 @@ if ($id > 0 || ! empty($ref)) print ''; print "\n"; $i++; + + if (!empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + $total_ht+=$objp->total_ht; + $total_qty+=$objp->qty; + } } } + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print "
'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->name,44).''.$societestatic->getNomUrl(1).'".$objp->code_client."'; print dol_print_date($db->jdate($objp->datef),'day')."'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).'
' . $langs->trans('Total') . ''.$total_qty.''.price($total_ht).'
"; + print '
'; print '
'; } else { dol_print_error($db); @@ -195,6 +259,5 @@ if ($id > 0 || ! empty($ref)) dol_print_error(); } - llxFooter(); $db->close(); diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index d8e30bdae6a..362e3e1427e 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2014 Florian Henry * * 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 @@ -19,15 +20,16 @@ */ /** - * \file htdocs/product/stats/facture_fournisseur.php - * \ingroup product service facture - * \brief Page des stats des factures fournisseurs pour un produit + * \file htdocs/product/stats/facture_fournisseur.php + * \ingroup product service facture + * \brief Page des stats des factures fournisseurs pour un produit */ require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; +require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; $langs->load("companies"); $langs->load("bills"); @@ -40,164 +42,223 @@ $ref = GETPOST('ref', 'alpha'); // Security check $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); -if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); +$socid = ''; +if (! empty($user->societe_id)) $socid=$user->societe_id; +$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('productstatssupplyinvoice')); $mesg = ''; -$sortfield = GETPOST("sortfield",'alpha'); -$sortorder = GETPOST("sortorder",'alpha'); -$page = GETPOST("page",'int'); +$sortfield = GETPOST("sortfield", 'alpha'); +$sortorder = GETPOST("sortorder", 'alpha'); +$page = GETPOST("page", 'int'); if ($page == -1) { $page = 0; } $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortorder) $sortorder="DESC"; -if (! $sortfield) $sortfield="f.datef"; - +if (! $sortorder) $sortorder = "DESC"; +if (! $sortfield) $sortfield = "f.datef"; +$search_month = GETPOST('search_month', 'aplha'); +$search_year = GETPOST('search_year', 'int'); +if (GETPOST("button_removefilter_x")) { + $search_month = ''; + $search_year = ''; +} /* * View */ -$supplierinvoicestatic=new FactureFournisseur($db); +$supplierinvoicestatic = new FactureFournisseur($db); +$societestatic = new Societe($db); $form = new Form($db); +$formother = new FormOther($db); if ($id > 0 || ! empty($ref)) { $product = new Product($db); $result = $product->fetch($id, $ref); - - $parameters=array('id'=>$id); - $reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks + + $parameters = array('id' => $id); + $reshook = $hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - - llxHeader("","",$langs->trans("CardProduct".$product->type)); - - if ($result > 0) - { - /* - * En mode visu - */ - $head=product_prepare_head($product, $user); - $titre=$langs->trans("CardProduct".$product->type); - $picto=($product->type==1?'service':'product'); + + llxHeader("", "", $langs->trans("CardProduct" . $product->type)); + + if ($result > 0) + { + $head = product_prepare_head($product, $user); + $titre = $langs->trans("CardProduct" . $product->type); + $picto = ($product->type == 1 ? 'service' : 'product'); dol_fiche_head($head, 'referers', $titre, 0, $picto); - - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook + + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - - print ''; - - // Reference - print ''; - print ''; - print ''; - - // Libelle - print ''; - print ''; - + + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($product,'ref','',1,'ref'); - print '
'.$langs->trans("Label").''.$product->libelle.'
'; + + // Reference + print ''; + print ''; + print ''; + + // Libelle + print ''; + print ''; + // Status (to sell) - print ''; - + // Status (to buy) - print ''; + + show_stats_for_company($product, $socid); + + print "
' . $langs->trans("Ref") . ''; + print $form->showrefnav($product, 'ref', '', 1, 'ref'); + print '
' . $langs->trans("Label") . '' . $product->libelle . '
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; - print $product->getLibStatut(2,0); + print '
' . $langs->trans("Status") . ' (' . $langs->trans("Sell") . ')'; + print $product->getLibStatut(2, 0); print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'; - print $product->getLibStatut(2,1); + print '
' . $langs->trans("Status") . ' (' . $langs->trans("Buy") . ')'; + print $product->getLibStatut(2, 1); print '
"; + + print ''; + + if ($user->rights->fournisseur->facture->lire) + { + $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client, f.ref, f.total_ht as total_ht,"; + $sql .= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid, d.qty"; + if (! $user->rights->societe->client->voir && ! $socid) + $sql .= ", sc.fk_soc, sc.fk_user "; + $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; + $sql .= ", " . MAIN_DB_PREFIX . "facture_fourn as f"; + $sql .= ", " . MAIN_DB_PREFIX . "facture_fourn_det as d"; + if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; + $sql .= " WHERE f.fk_soc = s.rowid"; + $sql .= " AND f.entity = " . $conf->entity; + $sql .= " AND d.fk_facture_fourn = f.rowid"; + $sql .= " AND d.fk_product =" . $product->id; + if (! empty($search_month)) + $sql .= ' AND MONTH(f.datef) IN (' . $search_month . ')'; + if (! empty($search_year)) + $sql .= ' AND YEAR(f.datef) IN (' . $search_year . ')'; + if (! $user->rights->societe->client->voir && ! $socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; + if ($socid) $sql .= " AND f.fk_soc = " . $socid; + $sql .= " ORDER BY $sortfield $sortorder "; + + // Calcul total qty and amount for global if full scan list + $total_ht = 0; + $total_qty = 0; + $totalrecords = 0; + if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + $result = $db->query($sql); + if ($result) { + $totalrecords = $db->num_rows($result); + while ( $objp = $db->fetch_object($result) ) { + $total_ht += $objp->total_ht; + $total_qty += $objp->qty; + } + } + } + + $sql .= $db->plimit($conf->liste_limit + 1, $offset); + + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + + if (! empty($id)) + $option .= '&id=' . $product->id; + if (! empty($search_month)) + $option .= '&search_month=' . $search_month; + if (! empty($search_year)) + $option .= '&search_year=' . $search_year; + + print '
' . "\n"; + if (! empty($sortfield)) + print ''; + if (! empty($sortorder)) + print ''; + if (! empty($page)) { + print ''; + $option .= '&page=' . $page; + } - show_stats_for_company($product,$socid); - - print ""; - - print ''; - - - $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client, f.ref, f.total_ht as total_ht,"; - $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid, d.qty"; - if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f"; - $sql.= ", ".MAIN_DB_PREFIX."facture_fourn_det as d"; - if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE f.fk_soc = s.rowid"; - $sql.= " AND f.entity = ".$conf->entity; - $sql.= " AND d.fk_facture_fourn = f.rowid"; - $sql.= " AND d.fk_product =".$product->id; - if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socid) $sql.= " AND f.fk_soc = ".$socid; - $sql.= " ORDER BY $sortfield $sortorder "; - $sql.= $db->plimit($conf->liste_limit +1, $offset); - - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows($result); - - print_barre_liste($langs->trans("SuppliersInvoices"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num,0,''); - - $i = 0; - print ""; - - print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"s.rowid","","&id=".$product->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&id=".$product->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("SupplierCode"),$_SERVER["PHP_SELF"],"s.code_client","","&id=".$product->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&id=".$product->id,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","","&id=".$product->id,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total_ht","","&id=".$product->id,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","","&id=".$product->id,'align="right"',$sortfield,$sortorder); - print "\n"; - - if ($num > 0) - { - $var=True; - while ($i < $num && $conf->liste_limit) - { - $objp = $db->fetch_object($result); - $var=!$var; - - print ""; - print '\n"; - print ''; - print "\n"; - print ""; - print "\n"; - print "\n"; - print ''; - print "\n"; - $i++; - } - } - } - else - { - dol_print_error($db); - } - print "
'; - $supplierinvoicestatic->id=$objp->facid; - $supplierinvoicestatic->ref=$objp->facnumber; - print $supplierinvoicestatic->getNomUrl(1); - print "'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->name,44).'".$objp->code_client.""; - print dol_print_date($db->jdate($objp->datef))."".$objp->qty."".price($objp->total_ht)."'.$supplierinvoicestatic->LibStatut($objp->paye,$objp->statut,5).'
"; - print '
'; - $db->free($result); - } + print_barre_liste($langs->trans("SuppliersInvoices"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, ''); + print '
'; + print $langs->trans('Period') . '(' . $langs->trans("DateInvoice") . ') '; + print $langs->trans('Month') . ': '; + print $langs->trans('Year') . ':' . $formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5); + print ''; + print ''; + print '
'; + + $i = 0; + print ''; + print ''; + print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "s.rowid", "", $option, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom", "", $option, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("SupplierCode"), $_SERVER["PHP_SELF"], "s.code_client", "", $option, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("DateInvoice"), $_SERVER["PHP_SELF"], "f.datef", "", $option, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Qty"), $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("AmountHT"), $_SERVER["PHP_SELF"], "f.total_ht", "", $option, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "f.paye,f.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder); + print "\n"; + + if ($num > 0) + { + $var = True; + while ($i < $num && $i < $conf->liste_limit) + { + $objp = $db->fetch_object($result); + $var = ! $var; + + print ''; + print '\n"; + $societestatic->fetch($objp->socid); + print ''; + print "\n"; + print '"; + print '\n"; + print '\n"; + print ''; + print "\n"; + $i ++; + + if (! empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + $total_ht += $objp->total_ht; + $total_qty += $objp->qty; + } + } + } + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "
'; + $supplierinvoicestatic->id = $objp->facid; + $supplierinvoicestatic->ref = $objp->facnumber; + print $supplierinvoicestatic->getNomUrl(1); + print "' . $societestatic->getNomUrl(1) . '" . $objp->code_client . "'; + print dol_print_date($db->jdate($objp->datef)) . "' . $objp->qty . "' . price($objp->total_ht) . "' . $supplierinvoicestatic->LibStatut($objp->paye, $objp->statut, 5) . '
' . $langs->trans('Total') . '' . $total_qty . '' . price($total_ht) . '
"; + print '
'; + print '
'; + } else { + dol_print_error($db); + } + $db->free($result); + } + } +} else { + dol_print_error(); } -else -{ - dol_print_error(); -} - llxFooter(); $db->close(); diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index 566961d9c5f..e8fc8e6ee27 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004-2007 Rodolphe Quiedeville * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2014 Florian Henry * * 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 @@ -18,16 +19,16 @@ */ /** - * \file htdocs/product/stats/propal.php - * \ingroup product service propal - * \brief Page des stats des propals pour un produit + * \file htdocs/product/stats/propal.php + * \ingroup product service propal + * \brief Page des stats des propals pour un produit */ - require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; +require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; $langs->load("products"); $langs->load("companies"); @@ -38,154 +39,226 @@ $ref = GETPOST('ref', 'alpha'); // Security check $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); -if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); +$socid=''; +if (! empty($user->societe_id)) $socid=$user->societe_id; +$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('productstatspropal')); +$hookmanager->initHooks(array ('productstatspropal')); $mesg = ''; -$sortfield = GETPOST("sortfield",'alpha'); -$sortorder = GETPOST("sortorder",'alpha'); -$page = GETPOST("page",'int'); -if ($page == -1) { $page = 0; } +$sortfield = GETPOST("sortfield", 'alpha'); +$sortorder = GETPOST("sortorder", 'alpha'); +$page = GETPOST("page", 'int'); +if ($page == - 1) { $page = 0;} $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortorder) $sortorder="DESC"; -if (! $sortfield) $sortfield="p.datep"; +if (! $sortorder) $sortorder = "DESC"; +if (! $sortfield) $sortfield = "p.datep"; +$search_month = GETPOST('search_month', 'aplha'); +$search_year = GETPOST('search_year', 'int'); + +if (GETPOST("button_removefilter_x")) { + $search_month = ''; + $search_year = ''; +} /* * View */ + +$propalstatic = new Propal($db); +$societestatic=new Societe($db); + $form = new Form($db); +$formother = new FormOther($db); if ($id > 0 || ! empty($ref)) { $product = new Product($db); $result = $product->fetch($id, $ref); - - $parameters=array('id'=>$id); - $reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks + + $parameters = array ('id' => $id); + $reshook = $hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - - llxHeader("","",$langs->trans("CardProduct".$product->type)); - + + llxHeader("", "", $langs->trans("CardProduct" . $product->type)); + if ($result > 0) { - $head=product_prepare_head($product, $user); - $titre=$langs->trans("CardProduct".$product->type); - $picto=($product->type==1?'service':'product'); - dol_fiche_head($head, 'referers', $titre,0,$picto); - - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook + $head = product_prepare_head($product, $user); + $titre = $langs->trans("CardProduct" . $product->type); + $picto = ($product->type == 1 ? 'service' : 'product'); + dol_fiche_head($head, 'referers', $titre, 0, $picto); + + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - + print ''; - + // Reference print ''; - print ''; print ''; - + // Libelle - print ''; + print ''; print ''; - + // Status (to sell) - print ''; - + // Status (to buy) - print ''; - - show_stats_for_company($product,$socid); - + + show_stats_for_company($product, $socid); + print "
'.$langs->trans("Ref").''; - print $form->showrefnav($product,'ref','',1,'ref'); + print '' . $langs->trans("Ref") . ''; + print $form->showrefnav($product, 'ref', '', 1, 'ref'); print '
'.$langs->trans("Label").''.$product->libelle.'
' . $langs->trans("Label") . '' . $product->libelle . '
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; - print $product->getLibStatut(2,0); + print '
' . $langs->trans("Status") . ' (' . $langs->trans("Sell") . ')'; + print $product->getLibStatut(2, 0); print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'; - print $product->getLibStatut(2,1); + print '
' . $langs->trans("Status") . ' (' . $langs->trans("Buy") . ')'; + print $product->getLibStatut(2, 1); print '
"; - + print ''; - - - $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, p.rowid as propalid, p.ref, p.total_ht as amount,"; - $sql.= "p.datep, p.fk_statut as statut, d.qty"; - if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sql.= ",".MAIN_DB_PREFIX."propal as p"; - $sql.= ", ".MAIN_DB_PREFIX."propaldet as d"; - if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE p.fk_soc = s.rowid"; - $sql.= " AND p.entity = ".$conf->entity; - $sql.= " AND d.fk_propal = p.rowid"; - $sql.= " AND d.fk_product =".$product->id; - if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socid) $sql.= " AND p.fk_soc = ".$socid; - $sql.= " ORDER BY $sortfield $sortorder "; - $sql.= $db->plimit($conf->liste_limit +1, $offset); - - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows($result); - - print_barre_liste($langs->trans("Proposals"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num,0,''); - - $i = 0; - print ''; - print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"p.rowid","","&id=".$product->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&id=".$product->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DatePropal"),$_SERVER["PHP_SELF"],"p.datep","","&id=".$product->id,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","","&id=".$product->id,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"p.total","","&id=".$product->id,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.fk_statut","","&id=".$product->id,'align="right"',$sortfield,$sortorder); - print "\n"; - - $propalstatic=new Propal($db); - - if ($num > 0) - { - $var=True; - while ($i < $num && $i < $conf->liste_limit) - { - $objp = $db->fetch_object($result); - $var=!$var; - - print ''; - print ''."\n"; - print ''; - print '"; - print "\n"; - print ''."\n"; - print ''; - print ''."\n"; - $i++; + + if ($user->rights->propale->lire) { + $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, p.rowid as propalid, p.ref, p.total_ht as amount,"; + $sql .= " p.ref_client,"; + $sql .= "p.datep, p.fk_statut as statut, d.qty"; + if (! $user->rights->societe->client->voir && ! $socid) + $sql .= ", sc.fk_soc, sc.fk_user "; + $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; + $sql .= "," . MAIN_DB_PREFIX . "propal as p"; + $sql .= ", " . MAIN_DB_PREFIX . "propaldet as d"; + if (! $user->rights->societe->client->voir && ! $socid) + $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; + $sql .= " WHERE p.fk_soc = s.rowid"; + $sql .= " AND p.entity = " . $conf->entity; + $sql .= " AND d.fk_propal = p.rowid"; + $sql .= " AND d.fk_product =" . $product->id; + if (! empty($search_month)) + $sql .= ' AND MONTH(p.datep) IN (' . $search_month . ')'; + if (! empty($search_year)) + $sql .= ' AND YEAR(p.datep) IN (' . $search_year . ')'; + if (! $user->rights->societe->client->voir && ! $socid) + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; + if ($socid) + $sql .= " AND p.fk_soc = " . $socid; + $sql .= " ORDER BY $sortfield $sortorder "; + + // Calcul total qty and amount for global if full scan list + $total_ht = 0; + $total_qty = 0; + $totalrecords = 0; + if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + $result = $db->query($sql); + if ($result) { + $totalrecords = $db->num_rows($result); + while ( $objp = $db->fetch_object($result) ) { + $total_ht += $objp->amount; + $total_qty += $objp->qty; + } } } - } - else - { + + $sql .= $db->plimit($conf->liste_limit + 1, $offset); + + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + + if (! empty($id)) + $option .= '&id=' . $product->id; + if (! empty($search_month)) + $option .= '&search_month=' . $search_month; + if (! empty($search_year)) + $option .= '&search_year=' . $search_year; + + print '' . "\n"; + if (! empty($sortfield)) + print ''; + if (! empty($sortorder)) + print ''; + if (! empty($page)) { + print ''; + $option .= '&page=' . $page; + } + + print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, ''); + print '
'; + print $langs->trans('Period') . '(' . $langs->trans("DateInvoice") . ') '; + print $langs->trans('Month') . ': '; + print $langs->trans('Year') . ':' . $formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5); + print ''; + print ''; + print '
'; + + $i = 0; + print '
'.img_object($langs->trans("ShowPropal"),"propal").' '; - print $objp->ref; - print ''.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->name,44).''; - print dol_print_date($db->jdate($objp->datep))."".$objp->qty."'.price($objp->amount).''.$propalstatic->LibStatut($objp->statut,5).'
'; + print ''; + print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.rowid", "", $option, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom", "", $option, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("DatePropal"), $_SERVER["PHP_SELF"], "p.datep", "", $option, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Qty"), $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("AmountHT"), $_SERVER["PHP_SELF"], "p.total", "", $option, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "p.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder); + print "\n"; + + if ($num > 0) + { + $var = True; + while ($i < $num && $i < $conf->liste_limit) + { + $objp = $db->fetch_object($result); + $var = ! $var; + + print ''; + print '\n"; + $societestatic->fetch($objp->socid); + print ''; + print '"; + print "\n"; + print '' . "\n"; + print ''; + print "\n"; + $i ++; + + if (! empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + $total_ht += $objp->total_ht; + $total_qty += $objp->qty; + } + } + } + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "
'; + $propalstatic->id=$objp->propalid; + $propalstatic->ref=$objp->ref; + $propalstatic->ref_client=$objp->ref_client; + print $propalstatic->getNomUrl(1); + print "'.$societestatic->getNomUrl(1).''; + print dol_print_date($db->jdate($objp->datep)) . "" . $objp->qty . "' . price($objp->amount) . '' . $propalstatic->LibStatut($objp->statut, 5) . '
' . $langs->trans('Total') . '' . $total_qty . '' . price($total_ht) . '
"; + print ''; + print '
'; + } else { dol_print_error($db); } - print ""; - print '
'; $db->free($result); + } } -} -else -{ +} else { dol_print_error(); } - llxFooter(); $db->close(); From eea48153128337c2b3d0fa3fb47e2d192703bc1e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sat, 7 Feb 2015 20:58:18 +0100 Subject: [PATCH 03/63] Display amount of line not total amount --- htdocs/product/stats/commande.php | 2 +- htdocs/product/stats/commande_fournisseur.php | 2 +- htdocs/product/stats/facture.php | 2 +- htdocs/product/stats/facture_fournisseur.php | 2 +- htdocs/product/stats/propal.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 68170bd19df..a95e9c3b95f 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -128,7 +128,7 @@ if ($id > 0 || ! empty($ref)) if ($user->rights->commande->lire) { - $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client, c.rowid, c.total_ht as total_ht, c.ref,"; + $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client, c.rowid, d.total_ht as total_ht, c.ref,"; $sql .= " c.ref_client,"; $sql.= " c.date_commande, c.fk_statut as statut, c.facture, c.rowid as commandeid, d.qty"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index f5b362d5423..3ab51e75701 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -136,7 +136,7 @@ if ($id > 0 || ! empty($ref)) { if ($user->rights->fournisseur->commande->lire) { $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client,"; - $sql .= " c.rowid, c.total_ht as total_ht, c.ref,"; + $sql .= " c.rowid, d.total_ht as total_ht, c.ref,"; $sql .= " c.date_commande, c.fk_statut as statut, c.rowid as commandeid, d.qty"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user "; diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 8269a7f57da..7f1be2a4621 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -130,7 +130,7 @@ if ($id > 0 || ! empty($ref)) if ($user->rights->facture->lire) { $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client,"; - $sql.= " f.facnumber, f.total as total_ht,"; + $sql.= " f.facnumber, d.total_ht as total_ht,"; $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid, d.qty"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 362e3e1427e..81f23e8fa4c 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -130,7 +130,7 @@ if ($id > 0 || ! empty($ref)) if ($user->rights->fournisseur->facture->lire) { - $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client, f.ref, f.total_ht as total_ht,"; + $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client, f.ref, d.total_ht as total_ht,"; $sql .= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid, d.qty"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user "; diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index e8fc8e6ee27..ee717890123 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -127,7 +127,7 @@ if ($id > 0 || ! empty($ref)) print ''; if ($user->rights->propale->lire) { - $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, p.rowid as propalid, p.ref, p.total_ht as amount,"; + $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, p.rowid as propalid, p.ref, d.total_ht as amount,"; $sql .= " p.ref_client,"; $sql .= "p.datep, p.fk_statut as statut, d.qty"; if (! $user->rights->societe->client->voir && ! $socid) From 41b0b577435d9525f41bbfe4a21d7b303cbd8d55 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sun, 8 Feb 2015 11:01:27 +0100 Subject: [PATCH 04/63] review || GETPOST("button_removefilter") --- htdocs/product/stats/commande.php | 2 +- htdocs/product/stats/commande_fournisseur.php | 2 +- htdocs/product/stats/facture.php | 2 +- htdocs/product/stats/facture_fournisseur.php | 2 +- htdocs/product/stats/propal.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index a95e9c3b95f..2ae1dcd1582 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -61,7 +61,7 @@ if (! $sortfield) $sortfield="c.date_commande"; $search_month = GETPOST('search_month', 'aplha'); $search_year = GETPOST('search_year', 'int'); -if (GETPOST("button_removefilter_x")) { +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { $search_month=''; $search_year=''; } diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 3ab51e75701..3141b3266e9 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -67,7 +67,7 @@ if (! $sortfield) $search_month = GETPOST('search_month', 'aplha'); $search_year = GETPOST('search_year', 'int'); -if (GETPOST("button_removefilter_x")) { +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { $search_month = ''; $search_year = ''; } diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 7f1be2a4621..b59bc008f17 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -62,7 +62,7 @@ if (! $sortfield) $sortfield="f.datef"; $search_month = GETPOST('search_month', 'aplha'); $search_year = GETPOST('search_year', 'int'); -if (GETPOST("button_removefilter_x")) { +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { $search_month=''; $search_year=''; } diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 81f23e8fa4c..0feb415cc43 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -63,7 +63,7 @@ if (! $sortfield) $sortfield = "f.datef"; $search_month = GETPOST('search_month', 'aplha'); $search_year = GETPOST('search_year', 'int'); -if (GETPOST("button_removefilter_x")) { +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { $search_month = ''; $search_year = ''; } diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index ee717890123..50d7c952b6d 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -61,7 +61,7 @@ if (! $sortfield) $sortfield = "p.datep"; $search_month = GETPOST('search_month', 'aplha'); $search_year = GETPOST('search_year', 'int'); -if (GETPOST("button_removefilter_x")) { +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { $search_month = ''; $search_year = ''; } From db9d727eb8a45aa3aed8cdcf2ed3568476d63733 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 8 Feb 2015 12:36:55 +0100 Subject: [PATCH 05/63] FIX : Link to user was wrong on bank transaction card --- htdocs/compta/bank/ligne.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index fee53c412b8..4ca2b1eb1ee 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -360,7 +360,7 @@ if ($result) print ''; } else if ($links[$key]['type']=='user') { - print ''; + print ''; print img_object($langs->trans('ShowUser'),'user').' '; print $langs->trans("User"); print ''; From d9ac21ab822ede55f6090c86c40eb85da1bfa2a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 8 Feb 2015 16:54:41 +0100 Subject: [PATCH 06/63] Fix: [ bug #1822 ] SQL error in clientfourn.php report with PostgreSQL --- ChangeLog | 1 + htdocs/compta/resultat/clientfourn.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5870e55152d..349ac323ff9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,7 @@ English Dolibarr ChangeLog - Fix: [ bug #1812 ] SQL Error message while sending emailing with PostgreSQL datatabase - Fix: [ bug #1819 ] SQL error when searching for an invoice payment - Fix: [ bug #1827 ] Tax reports gives incorrect amounts when using external modules that create lines with special codes +- Fix: [ bug #1822 ] SQL error in clientfourn.php report with PostgreSQL ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 26589be3c5d..1e09ea0a8fe 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -551,7 +551,7 @@ $sql.= " WHERE p.entity = ".$conf->entity; if (! empty($date_start) && ! empty($date_end)) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; -$sql.= " GROUP BY u.rowid"; +$sql.= " GROUP BY u.rowid, p.label, p.datep, p.fk_user"; $sql.= " ORDER BY u.firstname"; dol_syslog("get payment salaries sql=".$sql); From 5747dbfe9becec1acc8acbcfd0d2d4c4bcd26b61 Mon Sep 17 00:00:00 2001 From: Arnaud Aujon Chevallier Date: Mon, 9 Feb 2015 13:55:43 +0100 Subject: [PATCH 07/63] FIXED : product webservice can now save barcode --- .../webservices/server_productorservice.php | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index c2eba3f9d1b..a4430ab7b58 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -452,6 +452,12 @@ function createProductOrService($authentication,$product) $error++; $errorcode='KO'; $errorlabel="You must choose between price or price_net to provide price."; } + if ($product['barcode'] && !$product['barcode_type']) + { + $errror++; $errorcode='KO' ; $errorlabel="You must set a barcode type when setting a barcode."; + } + + if (! $error) { @@ -473,6 +479,12 @@ function createProductOrService($authentication,$product) $newobject->price_base_type=$product['price_base_type']; $newobject->date_creation=$now; + if ($product['barcode']) + { + $newobject->barcode = $product['barcode']; + $newobject->barcode_type = $product['barcode_type']; + } + $newobject->stock_reel=$product['stock_real']; $newobject->pmp=$product['pmp']; $newobject->seuil_stock_alert=$product['stock_alert']; @@ -562,6 +574,11 @@ function updateProductOrService($authentication,$product) } + if ($product['barcode'] && !$product['barcode_type']) + { + $errror++; $errorcode='KO' ; $errorlabel="You must set a barcode type when setting a barcode."; + } + if (! $error) { include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -584,6 +601,12 @@ function updateProductOrService($authentication,$product) $newobject->price_base_type=$product['price_base_type']; $newobject->date_creation=$now; + if ($product['barcode']) + { + $newobject->barcode = $product['barcode']; + $newobject->barcode_type = $product['barcode_type']; + } + $newobject->stock_reel=$product['stock_real']; $newobject->pmp=$product['pmp']; $newobject->seuil_stock_alert=$product['stock_alert']; From 2483d96b331accf2ee23bfebbd46381e95748815 Mon Sep 17 00:00:00 2001 From: KreizIT Date: Mon, 9 Feb 2015 17:19:20 +0100 Subject: [PATCH 08/63] FIXED: #1829 POS not compatible with batch products --- htdocs/cashdesk/admin/cashdesk.php | 11 ++++++++++- htdocs/core/modules/modProductBatch.class.php | 10 +++++++++- htdocs/langs/en_US/admin.lang | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/htdocs/cashdesk/admin/cashdesk.php b/htdocs/cashdesk/admin/cashdesk.php index 1ddde37b98b..7571befb121 100644 --- a/htdocs/cashdesk/admin/cashdesk.php +++ b/htdocs/cashdesk/admin/cashdesk.php @@ -130,7 +130,16 @@ if (! empty($conf->stock->enabled)) $var=!$var; print ''.$langs->trans("CashDeskDoNotDecreaseStock").''; // Force warehouse (this is not a default value) print ''; - print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK',$conf->global->CASHDESK_NO_DECREASE_STOCK,1); + if (empty($conf->productbatch->enabled)) { + print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK',$conf->global->CASHDESK_NO_DECREASE_STOCK,1); + } + else + { + if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) { + $res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",1,'chaine',0,'',$conf->entity); + } + print $langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch'); + } print ''; $disabled=$conf->global->CASHDESK_NO_DECREASE_STOCK; diff --git a/htdocs/core/modules/modProductBatch.class.php b/htdocs/core/modules/modProductBatch.class.php index 4dd7d0a81ae..50d53f72c57 100644 --- a/htdocs/core/modules/modProductBatch.class.php +++ b/htdocs/core/modules/modProductBatch.class.php @@ -112,8 +112,16 @@ class modProductBatch extends DolibarrModules */ function init($options='') { + global $db,$conf; + $sql = array(); - + + if(! empty($conf->cashdesk->enabled)) { + if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) { + $res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",1,'chaine',0,'',$conf->entity); + } + } + return $this->_init($sql, $options); } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 59579237d33..3e9a705cd48 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1494,6 +1494,7 @@ CashDeskBankAccountForCB= Default account to use to receive payments by credit c CashDeskDoNotDecreaseStock=Disable stock decrease when a sell is done from Point of Sale CashDeskIdWareHouse=Force and restrict warehouse to use for stock decrease StockDecreaseForPointOfSaleDisabled=Stock decrease from Point Of Sale disabled +StockDecreaseForPointOfSaleDisabledbyBatch=Stock decrease in POS is not compatible with batch management CashDeskYouDidNotDisableStockDecease=You did not disable stock decrease when making a sell from Point Of Sale. So a warehouse is required. ##### Bookmark ##### BookmarkSetup=Bookmark module setup From 949f9e40a083cda147619fd5b16bda347eef9f1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 10 Feb 2015 00:20:47 +0100 Subject: [PATCH 09/63] Fix: [ bug #1832 ] SQL error when adding a product with no price defined to an object --- ChangeLog | 1 + htdocs/core/lib/functions.lib.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5870e55152d..4c5d250bf9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,7 @@ English Dolibarr ChangeLog - Fix: [ bug #1812 ] SQL Error message while sending emailing with PostgreSQL datatabase - Fix: [ bug #1819 ] SQL error when searching for an invoice payment - Fix: [ bug #1827 ] Tax reports gives incorrect amounts when using external modules that create lines with special codes +- Fix: [ bug #1832 ] SQL error when adding a product with no price defined to an object ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f6f09dd1567..2f1beda65dc 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2952,7 +2952,7 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") $sql = "SELECT t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type"; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty_seller->country_code."'"; - $sql .= " AND t.taux = ".$tva." AND t.active = 1"; + $sql .= " AND t.taux = ".(int)$tva." AND t.active = 1"; dol_syslog("get_localtax sql=".$sql); $resql=$db->query($sql); @@ -2988,7 +2988,7 @@ function getLocalTaxesFromRate($vatrate, $local, $thirdparty) $sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy"; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty->country_code."'"; - $sql .= " AND t.taux = ".$vatrate." AND t.active = 1"; + $sql .= " AND t.taux = ".(int)$vatrate." AND t.active = 1"; $resql=$db->query($sql); if ($resql) From 58a61e129498aeef2512d27351336772f98b4c7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 10 Feb 2015 00:23:32 +0100 Subject: [PATCH 10/63] Changed int typecast to float --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2f1beda65dc..121fbc769b7 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2952,7 +2952,7 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") $sql = "SELECT t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type"; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty_seller->country_code."'"; - $sql .= " AND t.taux = ".(int)$tva." AND t.active = 1"; + $sql .= " AND t.taux = ".(float)$tva." AND t.active = 1"; dol_syslog("get_localtax sql=".$sql); $resql=$db->query($sql); @@ -2988,7 +2988,7 @@ function getLocalTaxesFromRate($vatrate, $local, $thirdparty) $sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy"; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty->country_code."'"; - $sql .= " AND t.taux = ".(int)$vatrate." AND t.active = 1"; + $sql .= " AND t.taux = ".(float)$vatrate." AND t.active = 1"; $resql=$db->query($sql); if ($resql) From a9dc6bb3d7a8797787d2016f0d9413cb2f00172c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 10 Feb 2015 00:55:22 +0100 Subject: [PATCH 11/63] Fix: [ bug #1826 ] Supplier payment types are not translated in fourn/facture/paiement.php --- ChangeLog | 1 + htdocs/fourn/facture/paiement.php | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5870e55152d..eb0736c543d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,7 @@ English Dolibarr ChangeLog - Fix: [ bug #1812 ] SQL Error message while sending emailing with PostgreSQL datatabase - Fix: [ bug #1819 ] SQL error when searching for an invoice payment - Fix: [ bug #1827 ] Tax reports gives incorrect amounts when using external modules that create lines with special codes +- Fix: [ bug #1826 ] Supplier payment types are not translated in fourn/facture/paiement.php ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index b6a4c5a7925..a8576cff01d 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -5,6 +5,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015 Marcos García * * 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 @@ -447,7 +448,7 @@ if (empty($action)) $sql = 'SELECT p.rowid as pid, p.datep as dp, p.amount as pamount, p.num_paiement,'; $sql.= ' s.rowid as socid, s.nom,'; - $sql.= ' c.libelle as paiement_type,'; + $sql.= ' c.code as paiement_type, c.libelle as paiement_libelle,'; $sql.= ' ba.rowid as bid, ba.label,'; if (!$user->rights->societe->client->voir) $sql .= ' sc.fk_soc, sc.fk_user,'; $sql.= ' SUM(f.amount)'; @@ -486,7 +487,7 @@ if (empty($action)) { $sql .= " AND s.nom LIKE '%".$db->escape($search_company)."%'"; } - $sql.= " GROUP BY p.rowid, p.datep, p.amount, p.num_paiement, s.rowid, s.nom, c.libelle, ba.rowid, ba.label"; + $sql.= " GROUP BY p.rowid, p.datep, p.amount, p.num_paiement, s.rowid, s.nom, c.code, c.libelle, ba.rowid, ba.label"; if (!$user->rights->societe->client->voir) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1, $offset); @@ -558,7 +559,9 @@ if (empty($action)) else print ' '; print ''; - print ''.dol_trunc($objp->paiement_type.' '.$objp->num_paiement,32)."\n"; + $payment_type = $langs->trans("PaymentType".$objp->paiement_type)!=("PaymentType".$objp->paiement_type)?$langs->trans("PaymentType".$objp->paiement_type):$objp->paiement_libelle; + + print ''.$payment_type.' '.dol_trunc($objp->num_paiement,32)."\n"; print ''; if ($objp->bid) print ''.img_object($langs->trans("ShowAccount"),'account').' '.dol_trunc($objp->label,24).''; From f1d5e1ba7b082295c7603b6ff51d2598b50e75ce Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 10 Feb 2015 07:14:55 +0100 Subject: [PATCH 12/63] FIXED Correct typo on Changelog --- ChangeLog | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5870e55152d..df8918b6814 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,13 +4,13 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.6.3 compared to 3.6.2 ***** - Fix: ref_ext was not saved when recording a customer order from web service -- Fix: amarok is a bugged theme making dolidroid failed. We swith to eldy automatically with dolidroid. +- Fix: amarok is a bugged theme making dolidroid failed. We switch to eldy automatically with dolidroid. - Fix: [ bug #1788 ] Duplicated doActions hook in product/fournisseurs.php -- Fix: withdrawal create error if in the same month are deleted previus withdrawals. +- Fix: withdrawal create error if in the same month are deleted previous withdrawals. - Fix: [ bug #1801 ] FAC_FORCE_DATE_VALIDATION constant alters supplier invoice date given to numeration modules - Fix: [ bug #1802 ] SQL error when updating a task with PostgreSQL database - Fix: [ bug #1785 ] Start date is lost in Project > Linked objects -- Fix: [ bug #1804 ] SQL error when sending email without addresee +- Fix: [ bug #1804 ] SQL error when sending email without address - Fix: [ bug #1803 ] AJAX company contact input is not aligned - Fix: [ bug #1787 ] Incorrect behaviour of doActions hook - Fix: [ bug #1796 ] Unable to use numeration modules from an external module @@ -18,18 +18,18 @@ English Dolibarr ChangeLog - Fix: [ bug #1717 ] Sorting unpaid invoices by amount received brings due amount - Fix: [ bug #1784 ] MOTD doesn't show up in Amarok theme - Fix: Tracking number not visible on shipment pdf -- Fix: [ bug #1812 ] SQL Error message while sending emailing with PostgreSQL datatabase +- Fix: [ bug #1812 ] SQL Error message while sending emailing with PostgreSQL database - Fix: [ bug #1819 ] SQL error when searching for an invoice payment - Fix: [ bug #1827 ] Tax reports gives incorrect amounts when using external modules that create lines with special codes ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. - Fix: bug 1588 : relative discount. -- Fix: label of input method not tranlated. -- Fix: box of customer and propsects were not correctly disabled. +- Fix: label of input method not translated. +- Fix: box of customer and prospects were not correctly disabled. - Fix: [ bug #1618 ] PHP Error thrown when saving a barcode - Fix: Civility & birthdate wasn't save into adherent module. -- Fix: webservice Thirdparty parameter lastname for invidual creation is now lastname and not ref +- Fix: webservice Thirdparty parameter lastname for individual creation is now lastname and not ref - Fix: Chars - is no more allowed into value for code for extra fields. - Fix: [ bug #1622 ] Requesting holiday than spans across two years cause high CPU usage by Apache - Fix: [ bug #1595 ] Selected boolean extrafield in intervention creation page, does not save state @@ -56,14 +56,14 @@ For users: - Fix: Iban was used instead of Bic into SEPA file. - Fix: Must unaccent strings into SEPA file. - Fix: Extrafield feature select from table should try to translate multiple column when not needed -- Fix: cents for indian ruppes are calle paisa and paise. +- Fix: cents for indian ruppes are called paisa and paise. - Fix: Invoices payments may be older than invoices. - Fix: Withdrawal total amount is double - Fix: [ bug #1593 ] Spanish Localtax IRPF not being calculated since 3.6.0 in supplier invoices when adding a line - Fix: Web service categorie WDSL declaration is correct - Fix: ErrorBadValueForParamNotAString was displayed in virtual product if no base price defined - Fix: Category creation failed and no message output -- Fix: Lanf for Payment Type +- Fix: Lang for Payment Type - Fix: PHPCheckstyle 1.5.5 ***** ChangeLog for 3.6 compared to 3.5.* ***** @@ -85,12 +85,12 @@ For users: - New: Improved Opensurvey module: Added options to disable comments and disable public votes. Limit dates use calendar popup. - Description of survey use wysiwig editor. + Description of survey use wysiwyg editor. More information shown on result tab. Renamed "survey" into "poll" (better translation). - New: Add filter on text and status into survey list. Can also sort on id, text and date end. - New: The box "balance of bank accounts" show all opened accounts. -- New: Add option MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE to add sale represnative into public +- New: Add option MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE to add sale representative into public note of generated documents. - New: Add warning if supplier payment is higher that due amount. - New: Increase length of url into bookmark module. @@ -103,7 +103,7 @@ For users: - New: Add barcode fields into user database. - New: Add manager name (ceo, director, president...) into main company information page. - New: Add field url as product properties. -- New: More options to create a credit note (can be filled autatically according to remain to pay). +- New: More options to create a credit note (can be filled automatically according to remain to pay). - New: Can define custom fields for categories. - New: Prepare generation of SEPA files into module withdrawal. - New: [ task #1164 ] Add "Ref. supplier" search box in supplier orders @@ -120,7 +120,7 @@ For users: - New: [ task #926 ] Add extrafield feature on order lines. - New: [ task #927 ] Add extrafield feature on Proposal lines. - New: [ task #928 ] Add extrafield feature on invoice lines. -- New: Paypal/paybox email sent after backcall of a payment is now a formated and translated +- New: Paypal/paybox email sent after backcall of a payment is now a formatted and translated HTML content. For member subscription renewal, there is also a link to member. - New: When a subscription is recorded with invoice and payment: - the document (PDF) of invoice is also generated. @@ -171,11 +171,11 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f So check that return value is 0 to keep default standard behaviour after hook or 1 to disable default standard behaviour. - Properties "civilite_id" were renamed into "civility_id". -- Remove add_photo_web() that is ot used anymore by core code. +- Remove add_photo_web() that is not used anymore by core code. ***** ChangeLog for 3.5.7 compared to 3.5.6 ***** -Fix: Paypal link were broken dur to SSL v3 closed. +Fix: Paypal link were broken due to SSL v3 closed. Fix: [ bug #1769 ] Error when installing to a PostgreSQL DB that contains numbers Fix: [ bug #1752 ] Date filter of margins module, filters since 12H instead of 00H Fix: [ bug #1757 ] Sorting breaks product/service statistics @@ -194,7 +194,7 @@ Fix: Bad days and month reported by function. Fix: Bad margin calculation. ***** ChangeLog for 3.5.5 compared to 3.5.4 ***** -Fix: Holiday module was broken. Initializaion of amount of holidays failed. +Fix: Holiday module was broken. Initialization of amount of holidays failed. Fix: [ bug #1523 ] suite bug #1334 : filtre et ordre de tri conjoints ne s'appliquent pas. Fix: Fusion PDF button on unpaid invoice is no more displayed. Fix: Unpaid invoice launch fusion PDF action even if it is only search (with enter keyboard input instead of lens click). @@ -229,7 +229,7 @@ Fix: When using option MAIN_MAIL_ALLOW_SENDMAIL_F, a mail was sent to sender. Fix: Question about warehouse must not be done when module stock is disabled. Fix: Option STOCK_SUPPORTS_SERVICES was not correctly implemented (missing test at some places). -Fix: Renaming a project with uplaoded files failed. +Fix: Renaming a project with uploaded files failed. Fix: [ bug #1476 ] Invoice creation form loses invoice date when there is a validation error. Fix: [ bug #1431 ] Reception and Send supplier order box has a weird top margin. Fix: [ bug #1428 ] "Nothing" is shown in the middle of the screen in a supplier order. @@ -250,7 +250,7 @@ Fix: [ bug #1449 ] Trigger ORDER_CREATE, LINEORDER_DELETE, LINEORDER_UPDATE and Fix: [ bug #1450 ] Several Customer order's triggers do not report the error from the trigger handler. Fix: [ bug #1451 ] Interrupted order clone through trigger, loads nonexistent order. Fix: [ bug #1454 ] Mention de bas de page erroné -Fix: Do not display dictionnay for non activated module +Fix: Do not display dictionary for non activated module Fix: Link element from element project pages Fix: [ bug #1509 ] Expedition admin free text & watermark submit error Fix: [ bug #1349 ] AJAX contact selector does not work fine in Project card From 6531a5c6c7d54ebce2406b697af95dec17391f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 10 Feb 2015 09:44:27 +0100 Subject: [PATCH 13/63] Fix: [ bug #1830 ] Salaries payment only allows checking accounts --- ChangeLog | 1 + htdocs/compta/salaries/fiche.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5870e55152d..483fd023b1f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,7 @@ English Dolibarr ChangeLog - Fix: [ bug #1812 ] SQL Error message while sending emailing with PostgreSQL datatabase - Fix: [ bug #1819 ] SQL error when searching for an invoice payment - Fix: [ bug #1827 ] Tax reports gives incorrect amounts when using external modules that create lines with special codes +- Fix: [ bug #1830 ] Salaries payment only allows checking accounts ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/compta/salaries/fiche.php b/htdocs/compta/salaries/fiche.php index c46f83dd6fb..34a2b9b4435 100644 --- a/htdocs/compta/salaries/fiche.php +++ b/htdocs/compta/salaries/fiche.php @@ -248,7 +248,7 @@ if ($action == 'create') if (! empty($conf->banque->enabled)) { print ''.$langs->trans("Account").''; - $form->select_comptes($_POST["accountid"],"accountid",0,"courant=1",1); // Affiche liste des comptes courant + $form->select_comptes($_POST["accountid"],"accountid",0,'',1); print ''; } From 0d150b1d32af89ce1b277c5bb6dc5282a3fbe8c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 10 Feb 2015 10:25:59 +0100 Subject: [PATCH 14/63] Removed unused code, misc corrections and corrected PHPDoc problems. --- htdocs/accountancy/admin/fiscalyear.php | 1 - htdocs/accountancy/admin/fiscalyear_card.php | 4 ++-- .../class/accountancysystem.class.php | 4 ++-- .../class/accountingaccount.class.php | 21 +++++++------------ .../accountancy/class/bookkeeping.class.php | 21 +++++++------------ .../class/html.formventilation.class.php | 10 +++------ htdocs/accountancy/journal/bankjournal.php | 20 ++++++++---------- htdocs/accountancy/journal/sellsjournal.php | 2 -- htdocs/comm/action/class/ical.class.php | 2 +- htdocs/core/lib/accounting.lib.php | 8 +++---- htdocs/core/lib/fiscalyear.lib.php | 4 ++-- 11 files changed, 38 insertions(+), 59 deletions(-) diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 4dd005fca85..e269bafae6c 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -94,7 +94,6 @@ if ($result) while ($i < $num && $i < $max) { $obj = $db->fetch_object($result); - $fiscalyearstatic->ref=$obj->rowid; $fiscalyearstatic->id=$obj->rowid; print ''; print ''.img_object($langs->trans("ShowFiscalYear"),"technic").' '.$obj->rowid.''; diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index 423ac88b490..30cd7ae8777 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -226,7 +226,7 @@ else if ($id) // Ref print ""; print ''.$langs->trans("Ref").''; - print $object->ref; + print $object->rowid; print ''; // Label @@ -278,7 +278,7 @@ else if ($id) // Ref print ''.$langs->trans("Ref").''; - print $object->ref; + print $object->rowid; print ''; print $linkback; print ''; diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index 7ce2134d0d2..ab0765ff115 100644 --- a/htdocs/accountancy/class/accountancysystem.class.php +++ b/htdocs/accountancy/class/accountancysystem.class.php @@ -66,8 +66,8 @@ class AccountancySystem $id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_system"); if ($id > 0) { - $this->id = $id; - $result = $this->id; + $this->rowid = $id; + $result = $this->rowid; } else { $result = - 2; $this->error = "AccountancySystem::Create Erreur $result"; diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 24031b683b4..293338c3b73 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -123,7 +123,7 @@ class AccountingAccount */ function create($user, $notrigger = 0) { - global $conf, $langs; + global $conf; $error = 0; $now=dol_now(); @@ -190,7 +190,7 @@ class AccountingAccount if (! $error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accountingaccount"); - if (! $notrigger) { +// if (! $notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -200,7 +200,7 @@ class AccountingAccount // $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); // if ($result < 0) { $error++; $this->errors=$interface->errors; } // // End call triggers - } +// } } // Commit or rollback @@ -225,8 +225,6 @@ class AccountingAccount */ function update($user) { - global $langs; - $this->db->begin(); $sql = "UPDATE " . MAIN_DB_PREFIX . "accountingaccount "; @@ -294,7 +292,6 @@ class AccountingAccount */ function delete($user, $notrigger = 0) { - global $conf, $langs; $error = 0; $result = $this->checkUsage(); @@ -303,8 +300,8 @@ class AccountingAccount $this->db->begin(); - if (! $error) { - if (! $notrigger) { +// if (! $error) { +// if (! $notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -314,8 +311,8 @@ class AccountingAccount // $result=$interface->run_triggers('ACCOUNTANCY_ACCOUNT_DELETE',$this,$user,$langs,$conf); // if ($result < 0) { $error++; $this->errors=$interface->errors; } // // End call triggers - } - } +// } +// } if (! $error) { $sql = "DELETE FROM " . MAIN_DB_PREFIX . "accountingaccount"; @@ -392,8 +389,6 @@ class AccountingAccount */ function account_desactivate($id) { - global $langs; - $result = $this->checkUsage(); if ($result > 0) { @@ -427,8 +422,6 @@ class AccountingAccount */ function account_activate($id) { - global $langs; - $this->db->begin(); $sql = "UPDATE " . MAIN_DB_PREFIX . "accountingaccount "; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index a3a760b0570..9dcba514ae1 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -225,8 +225,6 @@ class BookKeeping */ function create($user='') { - global $conf, $user, $langs; - $this->piece_num = 0; // first check if line not yet in bookkeeping @@ -355,7 +353,6 @@ class BookKeeping */ function create_std($user, $notrigger = 0) { - global $conf, $langs; $error = 0; // Clean parameters @@ -445,7 +442,7 @@ class BookKeeping if (! $error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_bookkeeping"); - if (! $notrigger) { +// if (! $notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -455,7 +452,7 @@ class BookKeeping // $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); // if ($result < 0) { $error++; $this->errors=$interface->errors; } // // End call triggers - } +// } } // Commit or rollback @@ -481,7 +478,6 @@ class BookKeeping */ function update($user = 0, $notrigger = 0) { - global $conf, $langs; $error = 0; // Clean parameters @@ -550,8 +546,8 @@ class BookKeeping $this->errors[] = "Error " . $this->db->lasterror(); } - if (! $error) { - if (! $notrigger) { +// if (! $error) { +// if (! $notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -561,8 +557,8 @@ class BookKeeping // $result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); // if ($result < 0) { $error++; $this->errors=$interface->errors; } // // End call triggers - } - } +// } +// } // Commit or rollback if ($error) { @@ -587,7 +583,6 @@ class BookKeeping */ function delete($user, $notrigger = 0) { - global $conf, $langs; $error = 0; $this->db->begin(); @@ -642,10 +637,10 @@ class BookKeeping $sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping"; + dol_syslog(get_class($this) . "::export_bookkeping", LOG_DEBUG); + $resql = $this->db->query($sql); - dol_syslog(get_class($this) . "::export_bookkeping sql=" . $sql, LOG_DEBUG); - $resql = $this->db->query($sql); if ($resql) { $this->linesexport = array (); diff --git a/htdocs/accountancy/class/html.formventilation.class.php b/htdocs/accountancy/class/html.formventilation.class.php index 4e833862bd8..f2b6ba6346c 100644 --- a/htdocs/accountancy/class/html.formventilation.class.php +++ b/htdocs/accountancy/class/html.formventilation.class.php @@ -50,10 +50,6 @@ class FormVentilation extends Form */ function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey='') { - global $langs; - - $date_array = array (); - $sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping'; $sql .= ' ORDER BY import_key DESC'; @@ -100,7 +96,7 @@ class FormVentilation extends Form */ function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array()) { - global $conf, $user, $langs; + global $conf; $out = ''; @@ -161,7 +157,7 @@ class FormVentilation extends Form */ function select_pcgtype($selectid, $htmlname = 'pcg_type', $showempty = 0, $event = array()) { - global $conf, $user, $langs; + global $conf; $out = ''; @@ -217,7 +213,7 @@ class FormVentilation extends Form */ function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array()) { - global $conf, $user, $langs; + global $conf; $out = ''; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 5fc98690933..b9d3b9209f9 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -553,17 +553,15 @@ else // Bank foreach ( $tabbq[$key] as $k => $mt ) { - if (1) { - print ""; - print "" . $date . ""; - print "" . $reflabel . ""; - print "" . length_accountg($k) . ""; - print "" . $langs->trans('Bank') . ""; - print "" . $val["type_payment"] . ""; - print "" . ($mt >= 0 ? price($mt) : '') . ""; - print "" . ($mt < 0 ? price(- $mt) : '') . ""; - print ""; - } + print ""; + print "" . $date . ""; + print "" . $reflabel . ""; + print "" . length_accountg($k) . ""; + print "" . $langs->trans('Bank') . ""; + print "" . $val["type_payment"] . ""; + print "" . ($mt >= 0 ? price($mt) : '') . ""; + print "" . ($mt < 0 ? price(- $mt) : '') . ""; + print ""; } // Third party diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 4c260f9fa99..d80e8f36562 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -230,7 +230,6 @@ if ($action == 'writebookkeeping') { $bookkeeping->doc_type = 'customer_invoice'; $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_facturedet"]; - $bookkeeping->fk_compte = $compte->id; $bookkeeping->code_tiers = ''; $bookkeeping->numero_compte = $k; $bookkeeping->label_compte = $langs->trans("VAT"); @@ -420,7 +419,6 @@ if ($action == 'export_csv') { $invoicestatic->id = $key; $invoicestatic->ref = $val["ref"]; $invoicestatic->type = $val["type"]; - $invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32)); $date = dol_print_date($db->jdate($val["date"]), 'day'); diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index 2dd6ea2b125..da062176d13 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -261,7 +261,7 @@ class ICal */ function ical_rrule($value) { - $result=aray(); + $result=array(); $rrule = explode(';',$value); foreach ($rrule as $line) { diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index ea098ba10bb..6896912ae7d 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -26,10 +26,10 @@ /** * Prepare array with list of admin tabs * - * @param Object $object Object instance we show card + * @param AccountingAccount $object Object instance we show card * @return array Array of tabs to show */ -function admin_accounting_prepare_head($object=null) +function admin_accounting_prepare_head(AccountingAccount $object=null) { global $langs, $conf; @@ -65,10 +65,10 @@ function admin_accounting_prepare_head($object=null) /** * Prepare array with list of tabs * - * @param Object $object Accounting account + * @param AccountingAccount $object Accounting account * @return array Array of tabs to show */ -function accounting_prepare_head($object) +function accounting_prepare_head(AccountingAccount $object) { global $langs, $conf; diff --git a/htdocs/core/lib/fiscalyear.lib.php b/htdocs/core/lib/fiscalyear.lib.php index 5d27760b41f..37266b51495 100644 --- a/htdocs/core/lib/fiscalyear.lib.php +++ b/htdocs/core/lib/fiscalyear.lib.php @@ -24,10 +24,10 @@ /** * Prepare array with list of tabs * - * @param Object $object Object related to tabs + * @param Fiscalyear $object Object related to tabs * @return array Array of tabs to show */ -function fiscalyear_prepare_head($object) +function fiscalyear_prepare_head(Fiscalyear $object) { global $langs, $conf; From 157a6e109e2f992dd210f087d5c8e2c6a35c0780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 10 Feb 2015 10:45:48 +0100 Subject: [PATCH 15/63] Misc Adherents PHPDoc corrections --- htdocs/adherents/admin/adherent.php | 2 +- .../canvas/actions_adherentcard_common.class.php | 4 ++++ htdocs/adherents/card.php | 6 +++--- htdocs/adherents/card_subscriptions.php | 4 ++-- htdocs/adherents/class/adherent.class.php | 4 ---- htdocs/adherents/class/adherent_type.class.php | 7 +++++++ htdocs/adherents/list.php | 2 +- htdocs/adherents/type.php | 4 ++-- htdocs/compta/bank/class/account.class.php | 7 ++++++- htdocs/core/class/extrafields.class.php | 2 +- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/class/html.formcompany.class.php | 2 +- htdocs/core/class/ldap.class.php | 2 +- htdocs/core/lib/company.lib.php | 4 ++-- htdocs/core/lib/functions.lib.php | 8 ++++---- htdocs/core/lib/member.lib.php | 6 +++--- htdocs/mailmanspip/class/mailmanspip.class.php | 10 +++++----- 17 files changed, 44 insertions(+), 32 deletions(-) diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index f86e19050e4..1e445911b24 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -219,7 +219,7 @@ if ($conf->facture->enabled) print ''; print ''.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").''; print ''; - print $form->select_produits($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS, 'constvalue_ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS'); + $form->select_produits($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS, 'constvalue_ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS'); print ''; print ''; print ''; diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php index cf89e1f526c..9987f9bc530 100644 --- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php +++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php @@ -27,6 +27,10 @@ */ abstract class ActionsAdherentCardCommon { + /** + * Database handler + * @var DoliDB + */ var $db; var $dirmodule; var $targetmodule; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 3363bf34f65..d8a1a85debf 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1159,7 +1159,7 @@ else print ''.$langs->trans("LinkedToDolibarrUser").''; if ($object->user_id) { - print $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'none'); + $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'none'); } else print $langs->trans("NoDolibarrAccess"); print ''; @@ -1516,13 +1516,13 @@ else print ''; if ($action == 'editlogin') { - print $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'userid',''); + $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'userid',''); } else { if ($object->user_id) { - print $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'none'); + $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'none'); } else print $langs->trans("NoDolibarrAccess"); } diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 7b710ba9aca..17567f5ca84 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -674,13 +674,13 @@ if ($rowid) { $include=array($object->user_id,$user->id); }*/ - print $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'userid',''); + $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'userid',''); } else { if ($object->user_id) { - print $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'none'); + $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'none'); } else print $langs->trans("NoDolibarrAccess"); } diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 8b1a456ee79..214476299e5 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -641,10 +641,6 @@ class Adherent extends CommonObject */ function update_end_date($user) { - global $conf, $langs; - - $error=0; - $this->db->begin(); // Search for last subscription id and end date diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 5c340de1fdf..11c194526b2 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -36,6 +36,13 @@ class AdherentType extends CommonObject public $element = 'adherent_type'; var $id; + + /** + * @var int + * @deprecated Use rowid + */ + public $ref; + var $libelle; var $statut; var $cotisation; // Soumis a la cotisation diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index b70e212d2d2..7764b4d144e 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -152,7 +152,7 @@ $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $resql = $db->query($sql); - if ($resql) $nbtotalofrecords = $db->num_rows($result); + if ($resql) $nbtotalofrecords = $db->num_rows($resql); else dol_print_error($db); } // Add order and limit diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 0ffdc8b7e7f..96e13561825 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -92,7 +92,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) if ($adht->libelle) { - $id=$adht->create($user->id); + $id=$adht->create($user); if ($id > 0) { header("Location: ".$_SERVER["PHP_SELF"]); @@ -127,7 +127,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$adht); - $adht->update($user->id); + $adht->update($user); header("Location: ".$_SERVER["PHP_SELF"]."?rowid=".$_POST["rowid"]); exit; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 4343e2cb921..2c5c2451c8f 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -36,7 +36,12 @@ class Account extends CommonObject public $element='bank_account'; public $table_element='bank_account'; - var $rowid; // deprecated + /** + * //TODO: Discuss this. $rowid is preferred over $id + * @var + * @deprecated + */ + var $rowid; var $id; var $ref; var $label; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 1c7c3ffb634..544619892b5 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -590,7 +590,7 @@ class ExtraFields * @param string $value Value to show (for date type it must be in timestamp format) * @param string $moreparam To add more parametes on html input tag * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) - * @return void + * @return string */ function showInputField($key,$value,$moreparam='',$keyprefix='') { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7d2851f1b31..9ee6f3d5271 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4452,7 +4452,7 @@ class Form * Return HTML code to output a photo * * @param string $modulepart Key to define module concerned ('societe', 'userphoto', 'memberphoto') - * @param Object $object Object containing data to retrieve file name + * @param object $object Object containing data to retrieve file name * @param int $width Width of photo * @return string HTML code to output photo */ diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 87723c535f3..297d772b06c 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -709,7 +709,7 @@ class FormCompany * @param string $fields Fields * @param int $fieldsize Field size * @param int $disableautocomplete 1 To disable autocomplete features - * @return void + * @return string */ function select_ziptown($selected='', $htmlname='zipcode', $fields='', $fieldsize=0, $disableautocomplete=0) { diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index dc844ee3f02..ca0cbab3925 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -801,7 +801,7 @@ class Ldap * * @param string $dn DN entry key * @param string $filter Filter - * @return int <0 if KO, >0 if OK + * @return int|false|array <0 or false if KO, array if OK */ function getAttribute($dn,$filter) { diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 2d0ecc4ebf7..8c0038f785f 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -904,7 +904,7 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='') * @param Conf $conf Object conf * @param Translate $langs Object langs * @param DoliDB $db Object db - * @param Object $object Object third party or member + * @param Adherent|Societe $object Object third party or member * @param Contact $objcon Object contact * @param int $noprint Return string but does not output it * @return mixed Return html part or void if noprint is 1 @@ -1067,7 +1067,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0) * @param Conf $conf Object conf * @param Translate $langs Object langs * @param DoliDB $db Object db - * @param Object $object Object third party or member + * @param Adherent|Societe $object Object third party or member * @param Contact $objcon Object contact * @param int $noprint Return string but does not output it * @return mixed Return html part or void if noprint is 1 diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c3446eb7b15..4523a8fd143 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -657,7 +657,7 @@ function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto * @param int $notab 0=Add tab header, 1=no tab header. If you set this to 1, using dol_fiche_end() to close tab is not required. * @param string $picto Add a picto on tab title * @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto. - * @return void + * @return string */ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0) { @@ -739,7 +739,7 @@ function dol_fiche_end($notab=0) * Return tab footer of a card * * @param int $notab 0=Add tab footer, 1=no tab footer - * @return void + * @return string */ function dol_get_fiche_end($notab=0) { @@ -2647,7 +2647,7 @@ function print_fiche_titre($title, $mesg='', $picto='title.png', $pictoisfullpat * @param string $picto Icon to use before title (should be a 32x32 transparent png file) * @param int $pictoisfullpath 1=Icon name is a full absolute url of image * @param int $id To force an id on html objects - * @return void + * @return string */ function load_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath=0, $id='') { @@ -4639,7 +4639,7 @@ function picto_from_langcode($codelang) * * @param Conf $conf Object conf * @param Translate $langs Object langs - * @param Object|null $object Object object + * @param object|null $object Object object * @param array $head Object head * @param int $h New position to fill * @param string $type Value for object where objectvalue can be diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index 879478daf8d..19e9f08e94d 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -24,10 +24,10 @@ /** * Return array head with list of tabs to view object informations * - * @param Object $object Member + * @param Adherent $object Member * @return array head */ -function member_prepare_head($object) +function member_prepare_head(Adherent $object) { global $langs, $conf, $user; @@ -155,7 +155,7 @@ function member_admin_prepare_head() /** * Return array head with list of tabs to view object stats informations * - * @param Object $object Member or null + * @param Adherent $object Member or null * @return array head */ function member_stats_prepare_head($object) diff --git a/htdocs/mailmanspip/class/mailmanspip.class.php b/htdocs/mailmanspip/class/mailmanspip.class.php index 6e772b09c03..d874e539164 100644 --- a/htdocs/mailmanspip/class/mailmanspip.class.php +++ b/htdocs/mailmanspip/class/mailmanspip.class.php @@ -166,7 +166,7 @@ class MailmanSpip /** * Fonction qui donne les droits redacteurs dans spip * - * @param Object $object Object with data (->firstname, ->lastname, ->email and ->login) + * @param object $object Object with data (->firstname, ->lastname, ->email and ->login) * @return int =0 if KO, >0 if OK */ function add_to_spip($object) @@ -208,7 +208,7 @@ class MailmanSpip /** * Fonction qui enleve les droits redacteurs dans spip * - * @param Object $object Object with data (->login) + * @param object $object Object with data (->login) * @return int =0 if KO, >0 if OK */ function del_to_spip($object) @@ -247,7 +247,7 @@ class MailmanSpip /** * Fonction qui dit si cet utilisateur est un redacteur existant dans spip * - * @param Object $object Object with data (->login) + * @param object $object Object with data (->login) * @return int 1=exists, 0=does not exists, -1=error */ function is_in_spip($object) @@ -297,7 +297,7 @@ class MailmanSpip /** * Subscribe an email to all mailing-lists * - * @param Object $object Object with data (->email, ->pass, ->element, ->type) + * @param object $object Object with data (->email, ->pass, ->element, ->type) * @param array $listes To force mailing-list (string separated with ,) * @return int <0 if KO, >=0 if OK */ @@ -369,7 +369,7 @@ class MailmanSpip * Unsubscribe an email from all mailing-lists * Used when a user is resiliated * - * @param Object $object Object with data (->email, ->pass, ->element, ->type) + * @param object $object Object with data (->email, ->pass, ->element, ->type) * @param array $listes To force mailing-list (string separated with ,) * @return int <0 if KO, >=0 if OK */ From e21681a36933a81ca088d4b141801cc7814b196f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 10 Feb 2015 10:52:48 +0100 Subject: [PATCH 16/63] PHPDoc and misc fixes for Admin --- htdocs/admin/agenda_other.php | 2 +- htdocs/admin/barcode.php | 2 +- htdocs/admin/ihm.php | 6 ++++-- htdocs/admin/menus.php | 8 ++++---- htdocs/admin/menus/edit.php | 2 +- htdocs/admin/prelevement.php | 2 +- htdocs/admin/tools/dolibarr_export.php | 2 +- htdocs/admin/tools/eaccelerator.php | 2 +- htdocs/admin/tools/export.php | 1 - htdocs/admin/tools/listevents.php | 2 +- htdocs/compta/prelevement/class/bonprelevement.class.php | 2 +- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/class/html.formother.class.php | 4 ++-- htdocs/core/lib/ajax.lib.php | 2 +- htdocs/core/lib/functions.lib.php | 2 +- htdocs/core/lib/memory.lib.php | 2 +- 16 files changed, 22 insertions(+), 21 deletions(-) diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index a069a0718c9..eed8cf2c344 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -133,7 +133,7 @@ print ''."\n"; print ''.$langs->trans("AGENDA_DEFAULT_FILTER_TYPE").''."\n"; print ' '."\n"; print ''."\n"; -print $formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), 1); +$formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), 1); print ''."\n"; // AGENDA_DEFAULT_FILTER_STATUS diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 11341f632a2..ae1fbca0e99 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -328,7 +328,7 @@ if (! empty($conf->product->enabled)) print ""; print ''.$langs->trans("SetDefaultBarcodeTypeProducts").''; print ''; - print $formbarcode->select_barcode_type($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE,"PRODUIT_DEFAULT_BARCODE_TYPE",1); + $formbarcode->select_barcode_type($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE,"PRODUIT_DEFAULT_BARCODE_TYPE",1); print ''; print ''; print ""; diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index db0f9de94bb..1477ef5577b 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -117,7 +117,8 @@ if ($action == 'edit') // Edit clearstatcache(); $var=true; - print_fiche_titre($langs->trans("Language"),'','').'
'; + print_fiche_titre($langs->trans("Language"),'',''); + print '
'; print ''; print ''; print ''; @@ -299,7 +300,8 @@ else // Show $var=true; // Language - print_fiche_titre($langs->trans("Language"),'','').'
'; + print_fiche_titre($langs->trans("Language"),'',''); + print '
'; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
'; print ''; diff --git a/htdocs/admin/menus.php b/htdocs/admin/menus.php index 438c99adc97..d12cd517fa7 100644 --- a/htdocs/admin/menus.php +++ b/htdocs/admin/menus.php @@ -183,10 +183,10 @@ if ($action == 'edit') $var=!$var; print ''; print ''; print ''; print ''; @@ -194,10 +194,10 @@ if ($action == 'edit') $var=!$var; print ''; print ''; print ''; print ''; diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index ff015884bbc..f962592d5a5 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -299,7 +299,7 @@ if ($action == 'create') // Handler print ''; print ''; print ''; diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 3bff5c29118..fe7a9f73a20 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -149,7 +149,7 @@ print ''; // Bank account (from Banks module) print ''; print ''; // ICS diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 9d5317fdd88..aec78f8aaac 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -97,7 +97,7 @@ jQuery(document).ready(function() { if (jQuery("#select_sql_compat").val() == 'POSTGRESQL') { jQuery("#checkbox_dump_disable-add-locks").attr('checked',true); - }; + } }); query($sql); - $num_fields = $db->num_rows($result); while($row = $db->fetch_row($result)) { // For each row of data we print a line of INSERT diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index fe577419eaf..309bf1d935e 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -102,7 +102,7 @@ if ($action == 'confirm_purge' && $confirm == 'yes' && $user->admin) { $error++; dol_syslog($securityevent->error, LOG_ERR); - $db->rolback(); + $db->rollback(); } } diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 21417483b80..32820c19619 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1192,7 +1192,7 @@ class BonPrelevement extends CommonObject * Add a notification * * @param DoliDB $db database handler - * @param User $user notification user + * @param int $user notification user * @param string $action notification action * @return int 0 if OK, <0 if KO */ diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9ee6f3d5271..5448666dbdb 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3568,7 +3568,7 @@ class Form * * @param string $selected preselected currency code * @param string $htmlname name of HTML select list - * @return void + * @return string */ function selectCurrency($selected='',$htmlname='currency_id') { diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 4f0439d7b3c..fd5a07ffcba 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -590,7 +590,7 @@ class FormOther * @param int $showcolorbox 1=Show color code and color box, 0=Show only color code * @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813') * @param string $morecss Add css style into input field - * @return void + * @return string */ function selectColor($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='', $morecss='') { @@ -720,7 +720,7 @@ class FormOther * @param string $selected Preselected value * @param string $htmlname Nom de la zone select * @param int $useempty Affiche valeur vide dans liste - * @return void + * @return string */ function select_dayofweek($selected='',$htmlname='weekid',$useempty=0) { diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 74e715f7b4a..c891ee60a26 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -403,7 +403,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0) * @param int $entity Entity to set * @param int $revertonoff Revert on/off * @param bool $strict Use only "disabled" with delConstant and "enabled" with setConstant - * @return void + * @return string */ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4523a8fd143..2952ffd0b39 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2542,7 +2542,7 @@ function print_liste_field_titre($name, $file="", $field="", $begin="", $morepar * @param string $moreattrib Add more attributes on th ("" by defaut) * @param string $sortfield Current field used to sort * @param string $sortorder Current sort order - * @return void + * @return string */ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="") { diff --git a/htdocs/core/lib/memory.lib.php b/htdocs/core/lib/memory.lib.php index 24e2e05693a..a6fae1c7b1f 100644 --- a/htdocs/core/lib/memory.lib.php +++ b/htdocs/core/lib/memory.lib.php @@ -169,7 +169,7 @@ function dol_getshmopaddress($memoryid) /** * Return list of contents of all memory area shared * - * @return int 0=Nothing is done, <0 if KO, >0 if OK + * @return array */ function dol_listshmop() { From ca939bf8a59f4e281c68c493673caee3763ffb73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 10 Feb 2015 11:02:11 +0100 Subject: [PATCH 17/63] PHPDoc and misc fixes for several folders --- htdocs/asterisk/wrapper.php | 4 ++-- htdocs/barcode/codeinit.php | 6 ++++-- htdocs/barcode/printsheet.php | 2 +- htdocs/bookmarks/bookmarks.lib.php | 2 -- htdocs/bookmarks/list.php | 9 ++++++--- htdocs/cashdesk/tpl/validation2.tpl.php | 2 +- htdocs/categories/categorie.php | 4 ++-- htdocs/categories/class/categorie.class.php | 21 ++++++++++----------- htdocs/categories/photos.php | 4 +++- htdocs/core/class/html.form.class.php | 2 +- 10 files changed, 30 insertions(+), 26 deletions(-) diff --git a/htdocs/asterisk/wrapper.php b/htdocs/asterisk/wrapper.php index d0e3ec633a5..e0f115e31c5 100644 --- a/htdocs/asterisk/wrapper.php +++ b/htdocs/asterisk/wrapper.php @@ -41,7 +41,7 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); /** * Empty header * - * @return none + * @return void */ function llxHeader() { @@ -53,7 +53,7 @@ function llxHeader() /** * Empty footer * - * @return none + * @return void */ function llxFooter() { diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index 19fb5c193bb..546384a98bf 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -210,7 +210,8 @@ if ($conf->societe->enabled) { $nbno=$nbtotal=0; - print_fiche_titre($langs->trans("BarcodeInitForThirdparties"),'','').'
'."\n"; + print_fiche_titre($langs->trans("BarcodeInitForThirdparties"),'',''); + print '
'."\n"; $sql="SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."societe where barcode IS NULL or barcode = ''"; $resql=$db->query($sql); if ($resql) @@ -250,7 +251,8 @@ if ($conf->product->enabled || $conf->product->service) $nbno=$nbtotal=0; - print_fiche_titre($langs->trans("BarcodeInitForProductsOrServices"),'','').'
'."\n"; + print_fiche_titre($langs->trans("BarcodeInitForProductsOrServices"),'',''); + print '
'."\n"; $sql ="SELECT count(rowid) as nb, fk_product_type"; $sql.=" FROM ".MAIN_DB_PREFIX."product"; $sql.=" WHERE barcode IS NULL OR barcode = ''"; diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index 0ce692674b1..fd89390f3db 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -360,7 +360,7 @@ print '
'; print ' '.$langs->trans("FillBarCodeTypeAndValueFromProduct").'   '; print '
'; print '
'; -print $form->select_produits(GETPOST('productid'), 'productid', ''); +$form->select_produits(GETPOST('productid'), 'productid', ''); print '   '; print '
'; diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index a9d2d7eb6c0..ee6003d0119 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -38,8 +38,6 @@ function printBookmarksList($aDb, $aLangs) require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5; - $bookm = new Bookmark($db); - $langs->load("bookmarks"); $url= $_SERVER["PHP_SELF"].(! empty($_SERVER["QUERY_STRING"])?'?'.$_SERVER["QUERY_STRING"]:''); diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index 748a4d9b7fa..e00772a0af5 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -94,9 +94,12 @@ if ($resql) print "
"; //print ""; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bid","","",'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Title"),'','').""; - print_liste_field_titre($langs->trans("Link"),'','').""; - print_liste_field_titre($langs->trans("Target"),'','','','','align="center"').""; + print_liste_field_titre($langs->trans("Title"),'',''); + print ""; + print_liste_field_titre($langs->trans("Link"),'',''); + print ""; + print_liste_field_titre($langs->trans("Target"),'','','','','align="center"'); + print ""; print_liste_field_titre($langs->trans("Owner"),$_SERVER["PHP_SELF"],"u.lastname","","",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"b.dateb","","",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Position"),$_SERVER["PHP_SELF"],"b.position","","",'align="right"',$sortfield,$sortorder); diff --git a/htdocs/cashdesk/tpl/validation2.tpl.php b/htdocs/cashdesk/tpl/validation2.tpl.php index b00268d7b0a..7bc7999d377 100644 --- a/htdocs/cashdesk/tpl/validation2.tpl.php +++ b/htdocs/cashdesk/tpl/validation2.tpl.php @@ -31,7 +31,7 @@ $langs->load("bills"); function popupTicket() { largeur = 600; - hauteur = 500 + hauteur = 500; opt = 'width='+largeur+', height='+hauteur+', left='+(screen.width - largeur)/2+', top='+(screen.height-hauteur)/2+''; window.open('validation_ticket.php?facid=', 'trans('PrintTicket') ?>', opt); } diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index 61ab169029f..0746475ecec 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -278,7 +278,7 @@ if ($socid) // Address print ''; // Zip / Town @@ -609,7 +609,7 @@ else if ($id || $ref) * @param Object $object Object we want to see categories it can be classified into * @param int $typeid Type of category (0, 1, 2, 3) * @param int $socid Id thirdparty - * @param string $showclassifyform 1=Add form to 'Classify', 0=Do not show form to 'Classify' + * @param int $showclassifyform 1=Add form to 'Classify', 0=Do not show form to 'Classify' * @return int 0 */ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index de8d494f9fc..f5828ecdea7 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -297,7 +297,6 @@ class Categorie extends CommonObject // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('HookCategorydao')); $parameters=array(); - $action='update'; $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { @@ -334,7 +333,7 @@ class Categorie extends CommonObject * Delete a category from database * * @param User $user Object user that ask to delete - * @return void + * @return int <0 KO >0 OK */ function delete($user) { @@ -689,7 +688,9 @@ class Categorie extends CommonObject */ function containsObject($type, $object_id) { - $field = ''; $classname = ''; $category_table = ''; $object_table = ''; + $field = ''; + $category_table = ''; + if ($type == 'product') { $field = 'product'; } @@ -726,7 +727,7 @@ class Categorie extends CommonObject /** * Return childs of a category * - * @return void + * @return array|int <0 KO, array ok */ function get_filles() { @@ -1045,7 +1046,7 @@ class Categorie extends CommonObject * Retourne les categories de premier niveau (qui ne sont pas filles) * * @param int $type Type of category - * @return void + * @return array */ function get_main_categories($type=null) { @@ -1058,7 +1059,7 @@ class Categorie extends CommonObject * * @param string $sep Separator * @param string $url Url - * @return void + * @return array */ function print_all_ways($sep = " >> ", $url='') { @@ -1088,7 +1089,7 @@ class Categorie extends CommonObject /** * Retourne un tableau contenant la liste des categories meres * - * @return void + * @return int|array <0 KO, array OK */ function get_meres() { @@ -1123,7 +1124,7 @@ class Categorie extends CommonObject * Retourne dans un tableau tous les chemins possibles pour arriver a la categorie * en partant des categories principales, representes par des tableaux de categories * - * @return void + * @return array */ function get_all_ways() { @@ -1315,7 +1316,7 @@ class Categorie extends CommonObject $originImage = $dir . $file['name']; // Cree fichier en taille origine - $result=dol_move_uploaded_file($file['tmp_name'], $originImage, 1, 0, 0); + dol_move_uploaded_file($file['tmp_name'], $originImage, 1, 0, 0); if (file_exists($originImage)) { @@ -1560,8 +1561,6 @@ class Categorie extends CommonObject */ function initAsSpecimen() { - global $user,$langs,$conf; - dol_syslog(get_class($this)."::initAsSpecimen"); // Initialise parametres diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index c54d7d889b2..36a44f4bdda 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -66,7 +66,9 @@ if ($id > 0) if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) { - if ($object->id) $result = $object->add_photo($upload_dir, $_FILES['userfile']); + if ($object->id) { + $object->add_photo($upload_dir, $_FILES['userfile']); + } } if ($action == 'confirm_delete' && $_GET["file"] && $confirm == 'yes' && $user->rights->categorie->creer) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5448666dbdb..c02df68db2c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2794,7 +2794,7 @@ class Form * @param string $htmlname HTML field name * @param int $maxlength Maximum length for labels * @param int $excludeafterid Exclude all categories after this leaf in category tree. - * @return void + * @return string * @see select_categories */ function select_all_categories($type, $selected='', $htmlname="parent", $maxlength=64, $excludeafterid=0) From 023175b9f1ced2494560cea3b6fdb9037515987e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 10 Feb 2015 11:38:13 +0100 Subject: [PATCH 18/63] PHPDoc and misc fixes for several folders --- htdocs/comm/action/class/actioncomm.class.php | 96 +++++++++++++++---- .../comm/action/class/cactioncomm.class.php | 4 +- htdocs/comm/action/index.php | 2 +- htdocs/comm/action/listactions.php | 2 +- htdocs/comm/action/peruser.php | 2 +- htdocs/comm/card.php | 2 +- htdocs/comm/index.php | 2 +- htdocs/comm/mailing/cibles.php | 6 +- htdocs/comm/propal/class/propal.class.php | 36 ++++--- .../comm/propal/class/propalestats.class.php | 2 - htdocs/comm/prospect/class/prospect.class.php | 4 +- htdocs/comm/remx.php | 2 +- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/lib/company.lib.php | 8 +- htdocs/core/lib/emailing.lib.php | 4 +- htdocs/core/lib/functions.lib.php | 10 +- htdocs/societe/class/address.class.php | 14 ++- 17 files changed, 129 insertions(+), 69 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 09a2abf329a..ef771b8a9a4 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -37,27 +37,67 @@ class ActionComm extends CommonObject public $table_rowid = 'id'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + /** + * Id of the event + * @var int + */ var $id; + /** + * Id of the event. Use $id as possible + * @var int + */ + public $ref; + var $type_id; // Id into parent table llx_c_actioncomm (used only if option to use type is set) var $type_code; // Code into parent table llx_c_actioncomm (used only if option to use type is set). With default setup, should be AC_OTH_AUTO or AC_OTH. var $type; // Label into parent table llx_c_actioncomm (used only if option to use type is set) var $type_color; // Color into parent table llx_c_actioncomm (used only if option to use type is set) var $code; // Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...) + var $label; + /** + * @var string + * @deprecated Use $label + */ + public $libelle; + var $datec; // Date creation record (datec) var $datem; // Date modification record (tms) - var $author; // Object user that create action //deprecated - var $usermod; // Object user that modified action // deprecated + + /** + * Object user that create action + * @var User + * @deprecated + */ + var $author; + + /** + * Object user that modified action + * @var User + * @deprecated + */ + var $usermod; var $authorid; // Id user that create action var $usermodid; // Id user that modified action var $datep; // Date action start (datep) var $datef; // Date action end (datep2) - var $durationp = -1; // -1=Unkown duration // deprecated + + /** + * @var int -1=Unkown duration + * @deprecated + */ + var $durationp = -1; var $fulldayevent = 0; // 1=Event on full day - var $punctual = 1; // Milestone // deprecated. Milestone is already event with end date = start date + + /** + * Milestone + * @var int + * @deprecated Milestone is already event with end date = start date + */ + var $punctual = 1; var $percentage; // Percentage var $location; // Location @@ -68,14 +108,41 @@ class ActionComm extends CommonObject var $userassigned = array(); // Array of user ids var $userownerid; // Id of user owner var $userdoneid; // Id of user done - var $usertodo; // Object user of owner // deprecated - var $userdone; // Object user that did action // deprecated + + /** + * Object user of owner + * @var User + * @deprecated + */ + var $usertodo; + + /** + * Object user that did action + * @var User + * @deprecated + */ + var $userdone; var $socid; var $contactid; - var $societe; // Company linked to action (optional) - var $contact; // Contact linked to action (optional) - var $fk_project; // Id of project (optional) + + /** + * Company linked to action (optional) + * @var Societe|null + */ + var $societe; + + /** + * Contact linked to action (optional) + * @var Contact|null + */ + var $contact; + + /** + * Id of project (optional) + * @var int + */ + var $fk_project; // Properties for links to other objects var $fk_element; // Id of record @@ -95,8 +162,6 @@ class ActionComm extends CommonObject */ function __construct($db) { - global $langs; - $this->db = $db; $this->societe = new stdClass(); // deprecated @@ -239,7 +304,6 @@ class ActionComm extends CommonObject { if (! is_array($val)) // For backward compatibility when val=id { - $tmpid=$val; $val=array('id'=>$val); } @@ -421,9 +485,7 @@ class ActionComm extends CommonObject */ function fetch_userassigned() { - global $langs; - - $sql.="SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency"; + $sql ="SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency"; $sql.=" FROM ".MAIN_DB_PREFIX."actioncomm_resources"; $sql.=" WHERE element_type = 'user' AND fk_actioncomm = ".$this->id; $resql2=$this->db->query($sql); @@ -885,7 +947,7 @@ class ActionComm extends CommonObject * @param int $overwritepicto 1=Overwrite picto * @return string Chaine avec URL */ - function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto='') + function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto=0) { global $conf,$langs; @@ -1145,7 +1207,7 @@ class ActionComm extends CommonObject */ function initAsSpecimen() { - global $user,$langs,$conf,$user; + global $user; $now=dol_now(); diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 77dfea739e1..56465d45fdb 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -99,10 +99,10 @@ class CActionComm /** * Return list of event types: array(id=>label) or array(code=>label) * - * @param int $active 1 or 0 to filter on event state active or not ('' by default = no filter) + * @param string|int $active 1 or 0 to filter on event state active or not ('' by default = no filter) * @param string $idorcode 'id' or 'code' * @param string $excludetype Type to exclude - * @param string $onlyautoornot Group list by auto events or not + * @param int $onlyautoornot Group list by auto events or not * @return mixed Array of all event types if OK, <0 if KO */ function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 91e5dd9f1d2..d9d17a0ea71 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1144,7 +1144,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $ponct=($event->date_start_in_calendar == $event->date_end_in_calendar); // Define $color (Hex string like '0088FF') and $cssclass of event - $color=-1; $cssclass=''; $colorindex=-1; + $color=-1; $colorindex=-1; if (in_array($user->id, $keysofuserassigned)) { $nummytasks++; $cssclass='family_mytasks'; diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index b8c913df271..8fd26b52b7f 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -313,7 +313,7 @@ if ($resql) $actionstatic->id=$obj->id; $actionstatic->type_code=$obj->type_code; $actionstatic->type_label=$obj->type_label; - $actionstatic->libelle=$obj->label; + $actionstatic->label=$obj->label; print $actionstatic->getNomUrl(1,28); print ''; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 831a019d04e..3df77549609 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -804,7 +804,7 @@ $db->close(); * @param int $minheight Minimum height for each event. 60px by default. * @param boolean $showheader Show header * @param array $colorsbytype Array with colors by type - * @param string $var true or false for alternat style on tr/td + * @param bool $var true or false for alternat style on tr/td * @return void */ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $showheader=false, $colorsbytype=array(), $var=false) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 74e29fcd3b2..450a462c751 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -909,7 +909,7 @@ if ($id > 0) // Addresses list if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) && ! empty($conf->global->MAIN_REPEATADDRESSONEACHTAB)) { - $result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); + show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); } if (! empty($conf->global->MAIN_REPEATTASKONEACHTAB)) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 4129b561ed1..427b2201d52 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -434,7 +434,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TO while ($i < $num) { $obj = $db->fetch_object($resql); - print ""; + print ""; print ''; print ''; print ''; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index b1852785466..98c302f7320 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -250,7 +250,7 @@ if ($action == 'create') // Type print ''; print ''; // Currency @@ -547,7 +547,7 @@ else // Type print ''; print ''; // Currency diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 2c5c2451c8f..c3bf23bdf66 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -225,7 +225,7 @@ class Account extends CommonObject /** * Add an entry into table ".MAIN_DB_PREFIX."bank * - * @param timestamp $date Date operation + * @param int $date Date operation * @param string $oper 1,2,3,4... (deprecated) or TYP,VIR,PRE,LIQ,VAD,CB,CHQ... * @param string $label Descripton * @param float $amount Amount @@ -1293,7 +1293,7 @@ class AccountLine extends CommonObject $sql.= ")"; dol_syslog(get_class($this)."::update_conciliation", LOG_DEBUG); - $resql = $this->db->query($sql); + $this->db->query($sql); // No error check. Can fail if category already affected } diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index b9850a7f98f..ac9fa10ff12 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -384,7 +384,7 @@ if ($result) if ($user->rights->banque->modifier || $user->rights->banque->consolidate) { print ''; $var=false; print '"; print "\n"; print ""; print ''; print ""; @@ -344,7 +344,7 @@ else if ($id) // Type print ""; print ''; // Who diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 4eab354577a..36eb49f4ed8 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -376,11 +376,11 @@ class Deplacement extends CommonObject * List of types * * @param int $active Active or not - * @return void + * @return array */ function listOfTypes($active=1) { - global $conf,$langs; + global $langs; $ret=array(); diff --git a/htdocs/compta/dons/card.php b/htdocs/compta/dons/card.php index 5a4170e74fe..7bf909378b4 100644 --- a/htdocs/compta/dons/card.php +++ b/htdocs/compta/dons/card.php @@ -500,7 +500,7 @@ if (! empty($id) && $action != 'edit') // Payment mode print "\n"; print "".''; diff --git a/htdocs/compta/dons/class/don.class.php b/htdocs/compta/dons/class/don.class.php index 61e1b9cd926..a8f7c11d92b 100644 --- a/htdocs/compta/dons/class/don.class.php +++ b/htdocs/compta/dons/class/don.class.php @@ -450,7 +450,7 @@ class Don extends CommonObject function delete($rowid) { - $this->db-begin(); + $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."don WHERE rowid = $rowid AND fk_statut = 0;"; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 67ba28b4e47..5f1f3998b5d 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2736,7 +2736,7 @@ if ($action == 'create') } else { if ($absolute_creditnote > 0) // If not, link will be added later { - if ($object->statut == 0 && $object->type != TYPE_CREDIT_NOTE && $object->type != TYPE_DEPOSIT) + if ($object->statut == 0 && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT) print ' (' . $addabsolutediscount . ')
'; else print '. '; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index f6c0ab1a481..3c0bcf4319f 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -591,8 +591,7 @@ class FactureRec extends Facture parent::initAsSpecimen($option); - $this->usenewprice = 1; - + $this->usenewprice = 1; } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 42f0afc0bbb..d50079f78c8 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -59,6 +59,11 @@ class Facture extends CommonInvoice //! Id client var $socid; //! Objet societe client (to load with fetch_client method) + + /** + * Customer + * @var Societe + */ var $client; var $author; var $fk_user_author; @@ -82,7 +87,10 @@ class Facture extends CommonInvoice var $total_tva=0; var $total_ttc=0; var $revenuestamp; - var $note; // deprecated + /** + * @deprecated + */ + var $note; var $note_private; var $note_public; //! 0=draft, @@ -111,7 +119,10 @@ class Facture extends CommonInvoice var $fk_account; // Id of bank account var $fk_bank; // Field to store bank id to use when payment mode is withdraw var $modelpdf; - var $products=array(); // deprecated + /** + * @deprecated + */ + var $products=array(); var $lines=array(); var $line; var $extraparams=array(); @@ -1930,8 +1941,8 @@ class Facture extends CommonInvoice * @param double $txlocaltax2 Local tax 2 rate * @param int $fk_product Id of predefined product/service * @param double $remise_percent Percent of discount on line - * @param timestamp $date_start Date start of service - * @param timestamp $date_end Date end of service + * @param int $date_start Date start of service + * @param int $date_end Date end of service * @param int $ventil Code of dispatching into accountancy * @param int $info_bits Bits de type de lignes * @param int $fk_remise_except Id discount used @@ -2106,8 +2117,8 @@ class Facture extends CommonInvoice * @param double $pu Prix unitaire (HT ou TTC selon price_base_type) (> 0 even for credit note lines) * @param double $qty Quantity * @param double $remise_percent Pourcentage de remise de la ligne - * @param date $date_start Date de debut de validite du service - * @param date $date_end Date de fin de validite du service + * @param int $date_start Date de debut de validite du service + * @param int $date_end Date de fin de validite du service * @param double $txtva VAT Rate * @param double $txlocaltax1 Local tax 1 rate * @param double $txlocaltax2 Local tax 2 rate @@ -2946,7 +2957,7 @@ class Facture extends CommonInvoice /** * Supprime une demande de prelevement * - * @param Use $user utilisateur creant la demande + * @param User $user utilisateur creant la demande * @param int $did id de la demande a supprimer * @return int <0 if OK, >0 if KO */ diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index f4d6d767091..d0ce1609b2a 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -324,7 +324,7 @@ if ($action == 'remove_file') $langs->load("other"); $upload_dir = $diroutputpdf; $file = $upload_dir . '/' . GETPOST('file'); - $ret=dol_delete_file($file,0,0,0,''); + $ret=dol_delete_file($file); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); $action=''; @@ -482,7 +482,8 @@ if ($resql) $formmail = new FormMail($db); print '
'; - print_fiche_titre($langs->trans("SendRemind"),'','').'
'; + print_fiche_titre($langs->trans("SendRemind"),'',''); + print '
'; $topicmail="MailTopicSendRemindUnpaidInvoices"; $modelmail="facture_relance"; diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index e2c9c94595a..d6260d1b34d 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -249,10 +249,6 @@ class Localtax extends CommonObject */ function delete($user) { - global $conf, $langs; - - $error=0; - // Call trigger $result=$this->call_trigger('LOCALTAX_DELETE',$user); if ($result < 0) return -1; @@ -270,7 +266,6 @@ class Localtax extends CommonObject return -1; } - return 1; } diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index 7c34cec1ed4..90d6cbe8599 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -104,7 +104,7 @@ $fsearch.=' '; $fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': '; $fsearch.=' '; -$calc=MAIN_INFO_LOCALTAX_CALC.$local; +$calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local; // Affiche en-tete du rapport if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services { diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index b1b4aad7722..612014ac741 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -124,7 +124,7 @@ $fsearch.=' '; //$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': '; //$fsearch.=' '; -$calc=MAIN_INFO_LOCALTAX_CALC.$local; +$calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local; // Affiche en-tete du rapport if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services { diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index c922099cd0e..13414a5b915 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -315,7 +315,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $(\'.fieldrequireddyn\').addClass(\'fieldrequired\'); if ($(\'#fieldchqemetteur\').val() == \'\') { - var emetteur = ('.$facture->type.' == 2) ? \''.dol_escape_htmltag(MAIN_INFO_SOCIETE_NOM).'\' : jQuery(\'#thirdpartylabel\').val(); + var emetteur = ('.$facture->type.' == 2) ? \''.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM).'\' : jQuery(\'#thirdpartylabel\').val(); $(\'#fieldchqemetteur\').val(emetteur); } } diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 0c5eeca3689..f87689bd202 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -355,7 +355,7 @@ if ($action == 'new') print $form->select_date($filterdate,'fd',0,0,1,'',1,1); print ''; print ''; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
'.$langs->trans("DefaultMenuManager").''; - print $formadmin->select_menu(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?$conf->global->MAIN_MENU_STANDARD:$conf->global->MAIN_MENU_STANDARD_FORCED, 'MAIN_MENU_STANDARD', $dirstandard, empty($conf->global->MAIN_MENU_STANDARD_FORCED)?'':' disabled="disabled"'); + $formadmin->select_menu(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?$conf->global->MAIN_MENU_STANDARD:$conf->global->MAIN_MENU_STANDARD_FORCED, 'MAIN_MENU_STANDARD', $dirstandard, empty($conf->global->MAIN_MENU_STANDARD_FORCED)?'':' disabled="disabled"'); print ''; - print $formadmin->select_menu(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?$conf->global->MAIN_MENUFRONT_STANDARD:$conf->global->MAIN_MENUFRONT_STANDARD_FORCED, 'MAIN_MENUFRONT_STANDARD', $dirstandard, empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?'':' disabled="disabled"'); + $formadmin->select_menu(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?$conf->global->MAIN_MENUFRONT_STANDARD:$conf->global->MAIN_MENUFRONT_STANDARD_FORCED, 'MAIN_MENUFRONT_STANDARD', $dirstandard, empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?'':' disabled="disabled"'); print '
'.$langs->trans("DefaultMenuSmartphoneManager").''; - print $formadmin->select_menu(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?$conf->global->MAIN_MENU_SMARTPHONE:$conf->global->MAIN_MENU_SMARTPHONE_FORCED, 'MAIN_MENU_SMARTPHONE', array_merge($dirstandard,$dirsmartphone), empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?'':' disabled="disabled"'); + $formadmin->select_menu(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?$conf->global->MAIN_MENU_SMARTPHONE:$conf->global->MAIN_MENU_SMARTPHONE_FORCED, 'MAIN_MENU_SMARTPHONE', array_merge($dirstandard,$dirsmartphone), empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?'':' disabled="disabled"'); print ''; - print $formadmin->select_menu(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?$conf->global->MAIN_MENUFRONT_SMARTPHONE:$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED, 'MAIN_MENUFRONT_SMARTPHONE', array_merge($dirstandard,$dirsmartphone), empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?'':' disabled="disabled"'); + $formadmin->select_menu(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?$conf->global->MAIN_MENUFRONT_SMARTPHONE:$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED, 'MAIN_MENUFRONT_SMARTPHONE', array_merge($dirstandard,$dirsmartphone), empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?'':' disabled="disabled"'); print '
'.$langs->trans('MenuHandler').''; - print $formadmin->select_menu_families($menu_handler,'menu_handler',$dirmenu); + $formadmin->select_menu_families($menu_handler,'menu_handler',$dirmenu); print ''.$langs->trans('DetailMenuHandler').'
'.$langs->trans("BankToReceiveWithdraw").''; -print $form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT,'PRELEVEMENT_ID_BANKACCOUNT',0,"courant=1",1); +$form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT,'PRELEVEMENT_ID_BANKACCOUNT',0,"courant=1",1); print '
 
'.$langs->trans('Address').''; - print dol_print_address($soc->address,'gmap','thirdparty',$soc->id); + dol_print_address($soc->address,'gmap','thirdparty',$soc->id); print '
contratid."\">".img_object($langs->trans("ShowContract","contract"))." ".$obj->ref."
contratid."\">".img_object($langs->trans("ShowContract","contract"), 'contract')." ".$obj->ref."'; $companystatic->id=$objp->rowid; $companystatic->name=$objp->name; diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 75f2399017b..ff129a557e8 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -118,8 +118,7 @@ if ($action == 'add') if (GETPOST('clearlist')) { // Chargement de la classe - $classname = "MailingTargets"; - $obj = new $classname($db); + $obj = new MailingTargets($db); $obj->clear_target($id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); @@ -135,8 +134,7 @@ if ($action == 'delete') { if (!empty($id)) { - $classname = "MailingTargets"; - $obj = new $classname($db); + $obj = new MailingTargets($db); $obj->update_nb($id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 15ce2ccd330..ca4c51c3f4c 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -296,15 +296,15 @@ class Propal extends CommonObject * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) * * @param string $desc Description de la ligne - * @param double $pu_ht Prix unitaire - * @param double $qty Quantite - * @param double $txtva Taux de tva - * @param double $txlocaltax1 Local tax 1 rate - * @param double $txlocaltax2 Local tax 2 rate + * @param float $pu_ht Prix unitaire + * @param float $qty Quantite + * @param float $txtva Taux de tva + * @param float $txlocaltax1 Local tax 1 rate + * @param float $txlocaltax2 Local tax 2 rate * @param int $fk_product Id du produit/service predefini - * @param double $remise_percent Pourcentage de remise de la ligne + * @param float $remise_percent Pourcentage de remise de la ligne * @param string $price_base_type HT or TTC - * @param double $pu_ttc Prix unitaire TTC + * @param float $pu_ttc Prix unitaire TTC * @param int $info_bits Bits de type de lignes * @param int $type Type of line (product, service) * @param int $rang Position of line @@ -320,7 +320,7 @@ class Propal extends CommonObject * * @see add_product */ - function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_option=0) + function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_option=0) { global $mysoc; @@ -477,14 +477,14 @@ class Propal extends CommonObject * Update a proposal line * * @param int $rowid Id de la ligne - * @param double $pu Prix unitaire (HT ou TTC selon price_base_type) - * @param double $qty Quantity - * @param double $remise_percent Remise effectuee sur le produit - * @param double $txtva Taux de TVA - * @param double $txlocaltax1 Local tax 1 rate - * @param double $txlocaltax2 Local tax 2 rate + * @param float $pu Prix unitaire (HT ou TTC selon price_base_type) + * @param float $qty Quantity + * @param float $remise_percent Remise effectuee sur le produit + * @param float $txtva Taux de TVA + * @param float $txlocaltax1 Local tax 1 rate + * @param float $txlocaltax2 Local tax 2 rate * @param string $desc Description - * @param double $price_base_type HT ou TTC + * @param string $price_base_type HT ou TTC * @param int $info_bits Miscellaneous informations * @param int $special_code Special code (also used by externals modules!) * @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines). @@ -498,9 +498,9 @@ class Propal extends CommonObject * @param array $array_option extrafields array * @return int 0 if OK, <0 if KO */ - function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $date_start='', $date_end='', $array_option=0) + function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $date_start='', $date_end='', $array_option=0) { - global $conf,$user,$langs, $mysoc; + global $mysoc; dol_syslog(get_class($this)."::updateLine $rowid, $pu, $qty, $remise_percent, $txtva, $desc, $price_base_type, $info_bits"); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -1866,8 +1866,6 @@ class Propal extends CommonObject */ function set_draft($user) { - global $conf,$langs; - $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = 0"; $sql.= " WHERE rowid = ".$this->id; diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php index dc8501c37ba..97256c840b1 100644 --- a/htdocs/comm/propal/class/propalestats.class.php +++ b/htdocs/comm/propal/class/propalestats.class.php @@ -193,8 +193,6 @@ class PropaleStats extends Stats */ function getAllByProduct($year) { - global $user; - $sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg"; $sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product"; //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; diff --git a/htdocs/comm/prospect/class/prospect.class.php b/htdocs/comm/prospect/class/prospect.class.php index 19e56fe2cff..59f284408b8 100644 --- a/htdocs/comm/prospect/class/prospect.class.php +++ b/htdocs/comm/prospect/class/prospect.class.php @@ -41,8 +41,6 @@ class Prospect extends Societe */ function __construct($db) { - global $config; - $this->db = $db; return 0; @@ -56,7 +54,7 @@ class Prospect extends Societe */ function load_state_board() { - global $conf, $user; + global $user; $this->nb=array("customers" => 0,"prospects" => 0); $clause = "WHERE"; diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 79f952fe7fd..99bfcb3a072 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -534,7 +534,7 @@ if ($socid > 0) } else { - print dol_print_error($db); + dol_print_error($db); } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c02df68db2c..dd9018f5669 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3667,7 +3667,7 @@ class Form * Si vendeur et acheteur dans Communauté européenne et acheteur= entreprise alors TVA par défaut=0. Fin de règle. * Sinon la TVA proposee par defaut=0. Fin de regle. * @param bool $options_only Return options only (for ajax treatment) - * @return void + * @return string */ function load_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $idprod=0, $info_bits=0, $type='', $options_only=false) { diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 8c0038f785f..9e4c72d8299 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -32,10 +32,10 @@ /** * Return array of tabs to used on pages for third parties cards. * - * @param Object $object Object company shown + * @param Societe $object Object company shown * @return array Array of tabs */ -function societe_prepare_head($object) +function societe_prepare_head(Societe $object) { global $db, $langs, $conf, $user; $h = 0; @@ -545,7 +545,7 @@ function show_projects($conf,$langs,$db,$object,$backtopage='') * @param Conf $conf Object conf * @param Translate $langs Object langs * @param DoliDB $db Database handler - * @param Object $object Third party object + * @param Societe $object Third party object * @param string $backtopage Url to go once contact is created * @return void */ @@ -809,7 +809,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') * @param Conf $conf Object conf * @param Translate $langs Object langs * @param DoliDB $db Database handler - * @param Object $object Third party object + * @param Societe $object Third party object * @param string $backtopage Url to go once address is created * @return void */ diff --git a/htdocs/core/lib/emailing.lib.php b/htdocs/core/lib/emailing.lib.php index 239f36721ee..7ca2aba9db2 100644 --- a/htdocs/core/lib/emailing.lib.php +++ b/htdocs/core/lib/emailing.lib.php @@ -24,10 +24,10 @@ /** * Prepare array with list of tabs * - * @param Object $object Object related to tabs + * @param Mailing $object Object related to tabs * @return array Array of tabs to show */ -function emailing_prepare_head($object) +function emailing_prepare_head(Mailing $object) { global $user, $langs, $conf; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2952ffd0b39..6c3de564197 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3188,11 +3188,11 @@ function get_localtax_by_third($local) * Instead this function must be called when adding a line to get (array of localtax and type) and * provide it to the function calcul_price_total. * - * @param float $vatrate VAT Rate - * @param int $local Number of localtax (1 or 2, or 0 to return 1 & 2) - * @param int $buyer Company object - * @param int $seller Company object - * @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...) + * @param float $vatrate VAT Rate + * @param int $local Number of localtax (1 or 2, or 0 to return 1 & 2) + * @param Societe $buyer Company object + * @param Societe $seller Company object + * @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...) */ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller) { diff --git a/htdocs/societe/class/address.class.php b/htdocs/societe/class/address.class.php index 7b36423cb61..632e4aea5b6 100644 --- a/htdocs/societe/class/address.class.php +++ b/htdocs/societe/class/address.class.php @@ -47,6 +47,11 @@ class Address var $fax; var $note; + /** + * Adresses liees a la societe + * @var array + */ + public $lines; /** * Constructor @@ -391,7 +396,7 @@ class Address * * @param int $id id de la societe a supprimer * @param int $socid id third party - * @return void + * @return <0 KO >0 OK */ function delete($id,$socid) { @@ -403,10 +408,11 @@ class Address $result = $this->db->query($sql); - if (!$result) - { - print $this->db->error() . '
' . $sql; + if (!$result) { + return -1; } + + return 1; } /** From 0d6d98b3959cc8f565e22d630dcb486bec492b52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 10 Feb 2015 13:17:37 +0100 Subject: [PATCH 19/63] PHPDoc and misc fixes for several folders --- htdocs/commande/class/commande.class.php | 56 +++++++++---------- htdocs/commande/list.php | 2 +- htdocs/commande/orderstoinvoice.php | 2 +- htdocs/compta/bank/account.php | 2 +- htdocs/compta/bank/card.php | 4 +- htdocs/compta/bank/class/account.class.php | 4 +- htdocs/compta/bank/ligne.php | 2 +- htdocs/compta/bank/virement.php | 4 +- htdocs/compta/deplacement/card.php | 4 +- .../deplacement/class/deplacement.class.php | 4 +- htdocs/compta/dons/card.php | 2 +- htdocs/compta/dons/class/don.class.php | 2 +- htdocs/compta/facture.php | 2 +- .../facture/class/facture-rec.class.php | 3 +- htdocs/compta/facture/class/facture.class.php | 25 ++++++--- htdocs/compta/facture/impayees.php | 5 +- .../compta/localtax/class/localtax.class.php | 5 -- htdocs/compta/localtax/clients.php | 2 +- htdocs/compta/localtax/quadri_detail.php | 2 +- htdocs/compta/paiement.php | 2 +- htdocs/compta/paiement/cheque/card.php | 2 +- .../cheque/class/remisecheque.class.php | 42 +++++++------- .../compta/paiement/class/paiement.class.php | 2 +- .../class/bonprelevement.class.php | 12 ++-- .../class/ligneprelevement.class.php | 2 +- .../class/rejetprelevement.class.php | 6 +- .../sociales/class/chargesociales.class.php | 10 ++-- htdocs/compta/tva/quadri.php | 4 +- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/doleditor.class.php | 2 +- htdocs/core/class/html.formother.class.php | 4 +- htdocs/core/lib/bank.lib.php | 4 +- htdocs/core/lib/order.lib.php | 4 +- htdocs/core/lib/prelevement.lib.php | 4 +- htdocs/core/lib/tax.lib.php | 4 +- htdocs/core/lib/trip.lib.php | 4 +- 36 files changed, 123 insertions(+), 119 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 6c5b6c020c7..35834419a74 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -162,7 +162,6 @@ class Commande extends CommonOrder } $obj = new $classname(); - $numref = ""; $numref = $obj->getNextValue($soc,$this); if ($numref != "") @@ -1079,19 +1078,19 @@ class Commande extends CommonOrder * Add an order line into database (linked to product/service or not) * * @param string $desc Description of line - * @param double $pu_ht Unit price (without tax) - * @param double $qty Quantite - * @param double $txtva Taux de tva force, sinon -1 - * @param double $txlocaltax1 Local tax 1 rate - * @param double $txlocaltax2 Local tax 2 rate + * @param float $pu_ht Unit price (without tax) + * @param float $qty Quantite + * @param float $txtva Taux de tva force, sinon -1 + * @param float $txlocaltax1 Local tax 1 rate + * @param float $txlocaltax2 Local tax 2 rate * @param int $fk_product Id du produit/service predefini - * @param double $remise_percent Pourcentage de remise de la ligne + * @param float $remise_percent Pourcentage de remise de la ligne * @param int $info_bits Bits de type de lignes * @param int $fk_remise_except Id remise * @param string $price_base_type HT or TTC - * @param double $pu_ttc Prix unitaire TTC - * @param timestamp $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) - * @param timestamp $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) + * @param float $pu_ttc Prix unitaire TTC + * @param int $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) + * @param int $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) * @param int $type Type of line (0=product, 1=service) * @param int $rang Position of line * @param int $special_code Special code (also used by externals modules!) @@ -1285,16 +1284,16 @@ class Commande extends CommonOrder * $this->client must be loaded * * @param int $idproduct Product Id - * @param double $qty Quantity - * @param double $remise_percent Product discount relative - * @param timestamp $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) - * @param timestamp $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) + * @param float $qty Quantity + * @param float $remise_percent Product discount relative + * @param int $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) + * @param int $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) * @return void * * TODO Remplacer les appels a cette fonction par generation objet Ligne * insere dans tableau $this->products */ - function add_product($idproduct, $qty, $remise_percent=0, $date_start='', $date_end='') + function add_product($idproduct, $qty, $remise_percent=0.0, $date_start='', $date_end='') { global $conf, $mysoc; @@ -1692,7 +1691,6 @@ class Commande extends CommonOrder */ function loadExpeditions($filtre_statut=-1) { - $num=0; $this->expeditions = array(); $sql = 'SELECT cd.rowid, cd.fk_product,'; @@ -1961,7 +1959,7 @@ class Commande extends CommonOrder * Set the order date * * @param User $user Object user making change - * @param timestamp $date Date + * @param int $date Date * @return int <0 if KO, >0 if OK */ function set_date($user, $date) @@ -1995,7 +1993,7 @@ class Commande extends CommonOrder * Set the planned delivery date * * @param User $user Objet utilisateur qui modifie - * @param timestamp $date_livraison Date de livraison + * @param int $date_livraison Date de livraison * @return int <0 si ko, >0 si ok */ function set_date_livraison($user, $date_livraison) @@ -2324,16 +2322,16 @@ class Commande extends CommonOrder * * @param int $rowid Id of line to update * @param string $desc Description de la ligne - * @param double $pu Prix unitaire - * @param double $qty Quantity - * @param double $remise_percent Pourcentage de remise de la ligne - * @param double $txtva Taux TVA - * @param double $txlocaltax1 Local tax 1 rate - * @param double $txlocaltax2 Local tax 2 rate + * @param float $pu Prix unitaire + * @param float $qty Quantity + * @param float $remise_percent Pourcentage de remise de la ligne + * @param float $txtva Taux TVA + * @param float $txlocaltax1 Local tax 1 rate + * @param float $txlocaltax2 Local tax 2 rate * @param string $price_base_type HT or TTC * @param int $info_bits Miscellaneous informations on line - * @param timestamp $date_start Start date of the line - * @param timestamp $date_end End date of the line + * @param int $date_start Start date of the line + * @param int $date_end End date of the line * @param int $type Type of line (0=product, 1=service) * @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines). * @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules) @@ -2344,7 +2342,7 @@ class Commande extends CommonOrder * @param array $array_option extrafields array * @return int < 0 if KO, > 0 if OK */ - function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_option=0) + function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0,$txlocaltax2=0.0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_option=0) { global $conf, $mysoc; @@ -2578,6 +2576,8 @@ class Commande extends CommonOrder */ function update_extrafields($user) { + global $hookmanager, $conf; + $action='create'; // Actions on extra fields (by external module or standard code) @@ -3167,7 +3167,7 @@ class Commande extends CommonOrder */ public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { - global $conf,$user,$langs,$hookmanager; + global $conf,$langs; $langs->load("orders"); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index f42920850c2..0de3c54e1ba 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -500,7 +500,7 @@ if ($resql) } else { - print dol_print_error($db); + dol_print_error($db); } llxFooter(); diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 1009b030210..930fee833fa 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -696,7 +696,7 @@ if (($action != 'create' && $action != 'add') || !$error) } else { - print dol_print_error($db); + dol_print_error($db); } } diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 87b7d3e62c5..024e21510e1 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -432,7 +432,7 @@ if ($id > 0 || ! empty($ref)) print '
'; //$filtertype=array('TIP'=>'TIP','PRE'=>'PRE',...) $filtertype=''; - print $form->select_types_paiements($paiementtype,'paiementtype',$filtertype,2,1,1,8); + $form->select_types_paiements($paiementtype,'paiementtype',$filtertype,2,1,1,8); print '
'.$langs->trans("AccountType").''; - print $formbank->select_type_comptes_financiers(isset($_POST["type"])?$_POST["type"]:1,"type"); + $formbank->select_type_comptes_financiers(isset($_POST["type"])?$_POST["type"]:1,"type"); print '
'.$langs->trans("AccountType").''; - print $formbank->select_type_comptes_financiers((isset($_POST["type"])?$_POST["type"]:$account->type),"type"); + $formbank->select_type_comptes_financiers((isset($_POST["type"])?$_POST["type"]:$account->type),"type"); print '
'; - print $form->select_types_paiements($objp->fk_type,"value",'',2); + $form->select_types_paiements($objp->fk_type,"value",'',2); print ''; if ($objp->receiptid) { diff --git a/htdocs/compta/bank/virement.php b/htdocs/compta/bank/virement.php index 601db34c964..3881efd5c9b 100644 --- a/htdocs/compta/bank/virement.php +++ b/htdocs/compta/bank/virement.php @@ -167,11 +167,11 @@ print '
'; -print $form->select_comptes($account_from,'account_from',0,'',1); +$form->select_comptes($account_from,'account_from',0,'',1); print "\n"; -print $form->select_comptes($account_to,'account_to',0,'',1); +$form->select_comptes($account_to,'account_to',0,'',1); print ""; diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index 20433118bbf..407edf6332e 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -252,7 +252,7 @@ if ($action == 'create') print "
'.$langs->trans("Type").''; - print $form->select_type_fees(GETPOST('type','int'),'type',1); + $form->select_type_fees(GETPOST('type','int'),'type',1); print '
'.$langs->trans("Type").''; - print $form->select_type_fees(GETPOST('type','int')?GETPOST('type','int'):$object->type,'type',0); + $form->select_type_fees(GETPOST('type','int')?GETPOST('type','int'):$object->type,'type',0); print '
".$langs->trans("PaymentMode").""; - print $form->form_modes_reglement(null, $don->modepaiementid,'none'); + $form->form_modes_reglement(null, $don->modepaiementid,'none'); print "
'.$langs->trans("Status").''.$don->getLibStatut(4).'
'.$langs->trans("BankAccount").''; - print $form->select_comptes($filteraccountid,'accountid',0,'courant <> 2',1); + $form->select_comptes($filteraccountid,'accountid',0,'courant <> 2',1); print '
'; print '
'; diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 922ab54ac7c..36ef0e2a1e9 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -41,6 +41,8 @@ class RemiseCheque extends CommonObject //! Numero d'erreur Plage 1024-1279 var $errno; + public $statut; + /** * Constructor * @@ -274,7 +276,7 @@ class RemiseCheque extends CommonObject * Supprime la remise en base * * @param User $user Utilisateur qui effectue l'operation - * @return void + * @return int */ function delete($user='') { @@ -292,25 +294,23 @@ class RemiseCheque extends CommonObject { $num = $this->db->affected_rows($resql); - if ($num <> 1) - { - $this->errno = -2; - dol_syslog("Remisecheque::Delete Erreur Lecture ID ($this->errno)"); - } + if ($num <> 1) { + $this->errno = -2; + dol_syslog("Remisecheque::Delete Erreur Lecture ID ($this->errno)"); + } - if ( $this->errno === 0) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."bank"; - $sql.= " SET fk_bordereau = 0"; - $sql.= " WHERE fk_bordereau = '".$this->id."'"; + if ( $this->errno === 0) { + $sql = "UPDATE ".MAIN_DB_PREFIX."bank"; + $sql.= " SET fk_bordereau = 0"; + $sql.= " WHERE fk_bordereau = '".$this->id."'"; - $resql = $this->db->query($sql); - if (!$resql) - { - $this->errno = -1028; - dol_syslog("RemiseCheque::Delete ERREUR UPDATE ($this->errno)"); - } - } + $resql = $this->db->query($sql); + if (!$resql) + { + $this->errno = -1028; + dol_syslog("RemiseCheque::Delete ERREUR UPDATE ($this->errno)"); + } + } } if ($this->errno === 0) @@ -476,7 +476,7 @@ class RemiseCheque extends CommonObject * Build document * * @param string $model Model name - * @param Tranlsate $outputlangs Object langs + * @param Translate $outputlangs Object langs * @return int <0 if KO, >0 if OK */ function generatePdf($model, $outputlangs) @@ -693,7 +693,7 @@ class RemiseCheque extends CommonObject * Set the creation date * * @param User $user Object user - * @param timestamp $date Date creation + * @param int $date Date creation * @return int <0 if KO, >0 if OK */ function set_date($user, $date) @@ -727,7 +727,7 @@ class RemiseCheque extends CommonObject * Set the number of bordereau * * @param User $user Object user - * @param timestamp $number number of bordereau + * @param int $number number of bordereau * @return int <0 if KO, >0 if OK */ function set_number($user, $number) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 2fce476af78..e3fb7a3c824 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -573,7 +573,7 @@ class Paiement extends CommonObject /** * Updates the payment date * - * @param timestamp $date New date + * @param int $date New date * @return int <0 if KO, 0 if OK */ function update_date($date) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 32820c19619..3738abac4c7 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -403,7 +403,7 @@ class BonPrelevement extends CommonObject * Set withdrawal to credited status * * @param User $user id of user - * @param timestamp $date date of action + * @param int $date date of action * @return int >0 if OK, <0 if KO */ function set_infocredit($user, $date) @@ -525,7 +525,7 @@ class BonPrelevement extends CommonObject * Set withdrawal to transmited status * * @param User $user id of user - * @param timestamp $date date of action + * @param int $date date of action * @param string $method method of transmision to bank * @return int >0 if OK, <0 if KO */ @@ -667,9 +667,9 @@ class BonPrelevement extends CommonObject { $obj = $this->db->fetch_object($resql); - return $obj->nb; - $this->db->free($resql); + + return $obj->nb; } else { @@ -1167,7 +1167,7 @@ class BonPrelevement extends CommonObject /** * Delete a notification * - * @param User $user notification user + * @param int $user notification user * @param string $action notification action * @return int >0 if OK, <0 if KO */ @@ -1631,7 +1631,7 @@ class BonPrelevement extends CommonObject * Note: The tag PmtInf is opened here but closed into caller * * @param string $configuration conf - * @param date $ladate Date + * @param int $ladate Date * @param int $nombre 0 or 1 * @param float $total Total * @param string $CrLf End of line character diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php index 581fb3152af..2b71c5c8004 100644 --- a/htdocs/compta/prelevement/class/ligneprelevement.class.php +++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php @@ -61,7 +61,7 @@ class LignePrelevement * Recupere l'objet prelevement * * @param int $rowid id de la facture a recuperer - * @return void + * @return void|int */ function fetch($rowid) { diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index d0b467f294b..176a561378b 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -71,7 +71,7 @@ class RejetPrelevement * @param User $user User object * @param int $id Id * @param string $motif Motif - * @param timestamp $date_rejet Date rejet + * @param int $date_rejet Date rejet * @param int $bonid Bon id * @param int $facturation Facturation * @return void @@ -272,7 +272,7 @@ class RejetPrelevement /** * Retrieve the list of invoices * - * @return void + * @return array */ private function getListInvoices() { @@ -318,7 +318,7 @@ class RejetPrelevement * Retrieve withdrawal object * * @param int $rowid id of invoice to retrieve - * @return void + * @return int */ function fetch($rowid) { diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 1d684c65552..805558b4267 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -69,7 +69,7 @@ class ChargeSociales extends CommonObject * * @param int $id Id * @param string $ref Ref - * @return void + * @return int <0 KO >0 OK */ function fetch($id, $ref='') { @@ -99,13 +99,14 @@ class ChargeSociales extends CommonObject $this->paye = $obj->paye; $this->periode = $this->db->jdate($obj->periode); + $this->db->free($resql); + return 1; } else { return 0; } - $this->db->free($resql); } else { @@ -308,6 +309,7 @@ class ChargeSociales extends CommonObject if ($this->db->num_rows($result)) { $obj = $this->db->fetch_object($result); + $this->db->free($result); return $obj->amount; } else @@ -315,8 +317,6 @@ class ChargeSociales extends CommonObject return 0; } - $this->db->free($result); - } else { @@ -520,8 +520,6 @@ class ChargeSociales extends CommonObject */ function initAsSpecimen() { - global $user,$langs,$conf; - // Initialize parameters $this->id=0; $this->ref = 'SPECIMEN'; diff --git a/htdocs/compta/tva/quadri.php b/htdocs/compta/tva/quadri.php index f5d0065e7f3..4b399d65248 100644 --- a/htdocs/compta/tva/quadri.php +++ b/htdocs/compta/tva/quadri.php @@ -54,7 +54,7 @@ $result = restrictedArea($user, 'tax', '', '', 'charges'); * @param DoliDB $db Database handler * @param int $y Year * @param int $q Year quarter (1-4) - * @return void + * @return array */ function tva_coll($db,$y,$q) { @@ -122,7 +122,7 @@ function tva_coll($db,$y,$q) * @param DoliDB $db Database handler object * @param int $y Year * @param int $q Year quarter (1-4) - * @return void + * @return array */ function tva_paye($db, $y,$q) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 3e58e7b5c7d..c9ff161cef1 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -821,7 +821,7 @@ abstract class CommonObject * Update a specific field into database * * @param string $field Field to update - * @param mixte $value New value + * @param mixed $value New value * @param string $table To force other table element or element line (should not be used) * @param int $id To force other object id (should not be used) * @param string $format Data format ('text', 'date'). 'text' is used if not defined diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 6dc726b084e..d6e23beac70 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -142,7 +142,7 @@ class DolEditor * * @param int $noprint 1=Return HTML string instead of printing it to output * @param string $morejs Add more js. For example: ".on( \'saveSnapshot\', function(e) { alert(\'ee\'); });" - * @return void + * @return void|string */ function Create($noprint=0,$morejs='') { diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index fd5a07ffcba..b7971d52c53 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -761,7 +761,7 @@ class FormOther * @param string $selected Preselected value * @param string $htmlname Nom de la zone select * @param int $useempty Affiche valeur vide dans liste - * @return void + * @return string */ function select_month($selected='',$htmlname='monthid',$useempty=0) { @@ -803,7 +803,7 @@ class FormOther * @param int $offset Offset * @param int $invert Invert * @param string $option Option - * @return void + * @return string */ function select_year($selected='',$htmlname='yearid',$useempty=0, $min_year=10, $max_year=5, $offset=0, $invert=0, $option='') { diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 488a4c3a530..fdb7d0e76ec 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -27,10 +27,10 @@ /** * Prepare array with list of tabs * - * @param Object $object Object related to tabs + * @param Account $object Object related to tabs * @return array Array of tabs to show */ -function bank_prepare_head($object) +function bank_prepare_head(Account $object) { global $langs, $conf, $user; $h = 0; diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index abdf1b648a5..d30068a5e98 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -28,10 +28,10 @@ /** * Prepare array with list of tabs * - * @param Object $object Object related to tabs + * @param Commande $object Object related to tabs * @return array Array of tabs to show */ -function commande_prepare_head($object) +function commande_prepare_head(Commande $object) { global $langs, $conf, $user; if (! empty($conf->expedition->enabled)) $langs->load("sendings"); diff --git a/htdocs/core/lib/prelevement.lib.php b/htdocs/core/lib/prelevement.lib.php index 53f54d66f70..18608a55a04 100644 --- a/htdocs/core/lib/prelevement.lib.php +++ b/htdocs/core/lib/prelevement.lib.php @@ -28,10 +28,10 @@ /** * Prepare array with list of tabs * - * @param Object $object Object related to tabs + * @param BonPrelevement $object Object related to tabs * @return array Array of tabs to show */ -function prelevement_prepare_head($object) +function prelevement_prepare_head(BonPrelevement $object) { global $langs, $conf, $user; $langs->load("withdrawals"); diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index cc9478f5d61..be9cf9923c9 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -28,10 +28,10 @@ /** * Prepare array with list of tabs * - * @param Object $object Object related to tabs + * @param ChargeSociales $object Object related to tabs * @return array Array of tabs to show */ -function tax_prepare_head($object) +function tax_prepare_head(ChargeSociales $object) { global $langs, $conf; diff --git a/htdocs/core/lib/trip.lib.php b/htdocs/core/lib/trip.lib.php index 45619b10d6f..33f977bcf34 100644 --- a/htdocs/core/lib/trip.lib.php +++ b/htdocs/core/lib/trip.lib.php @@ -24,10 +24,10 @@ /** * Prepare array with list of tabs * - * @param Object $object Object related to tabs + * @param Deplacement $object Object related to tabs * @return array Array of tabs to show */ -function trip_prepare_head($object) +function trip_prepare_head(Deplacement $object) { global $langs, $conf; From 863c1f7a13cd73b4d1ee56a62ddf3bfc1338ff13 Mon Sep 17 00:00:00 2001 From: Arnaud Aujon Chevallier Date: Tue, 10 Feb 2015 13:21:36 +0100 Subject: [PATCH 20/63] fix typo in createOrder --- htdocs/webservices/server_order.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 8cd69b352a7..0c0d7559aec 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -640,7 +640,7 @@ function createOrder($authentication,$order) $newobject->statut=0; // We start with status draft $newobject->facturee=$order['facturee']; $newobject->fk_project=$order['project_id']; - $newObject->fk_delivery_address=$order['fk_delivery_address']; + $newobject->fk_delivery_address=$order['fk_delivery_address']; $newobject->cond_reglement_id=$order['cond_reglement_id']; $newobject->demand_reason_id=$order['demand_reason_id']; $newobject->date_creation=$now; From 530186c59d78ed847014c9cb17a601d80dd6ebe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 10 Feb 2015 13:32:00 +0100 Subject: [PATCH 21/63] PHPDoc and misc fixes for several folders --- htdocs/contact/class/contact.class.php | 2 -- htdocs/contrat/card.php | 2 +- htdocs/contrat/class/contrat.class.php | 11 +++++------ htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/vcard.class.php | 2 +- htdocs/core/lib/contact.lib.php | 4 ++-- htdocs/core/lib/contract.lib.php | 4 ++-- 7 files changed, 12 insertions(+), 15 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 6a7776b27bd..c906488b35b 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -996,8 +996,6 @@ class Contact extends CommonObject */ function initAsSpecimen() { - global $user,$langs; - // Get first id of existing company and save it into $socid $socid = 0; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe ORDER BY rowid LIMIT 1"; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index b2b99a9dde3..fdd0acfec74 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -659,7 +659,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->contr // Close all lines else if ($action == 'confirm_close' && $confirm == 'yes' && $user->rights->contrat->creer) { - $result = $object->cloture($user); + $object->cloture($user); } else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->contrat->supprimer) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 37be98fa2c4..d2bbe28726a 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -236,7 +236,6 @@ class Contrat extends CommonObject } $obj = new $classname(); - $numref = ""; $numref = $obj->getNextValue($soc,$this); if ( $numref != "") @@ -1589,11 +1588,11 @@ class Contrat extends CommonObject // Load $this->lines array // $this->fetch_lines(); - $newstatut=1; - foreach($this->lines as $key => $contractline) - { - // if ($contractline) // Loop on each service - } +// $newstatut=1; +// foreach($this->lines as $key => $contractline) +// { +// // if ($contractline) // Loop on each service +// } return 1; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c9ff161cef1..8a8258ca641 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2412,7 +2412,7 @@ abstract class CommonObject * TODO Move this into html.class.php * But for the moment we don't know if it's possible as we keep a method available on overloaded objects. * - * @return void + * @return int */ function showLinkedObjectBlock() { diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index 512aa011d98..bc9f9081a49 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -306,7 +306,7 @@ class vCard /** * permet d'obtenir une vcard * - * @return void + * @return string */ function getVCard() { diff --git a/htdocs/core/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php index 8d9ba9296a4..3eeca82c993 100644 --- a/htdocs/core/lib/contact.lib.php +++ b/htdocs/core/lib/contact.lib.php @@ -25,10 +25,10 @@ /** * Prepare array with list of tabs * - * @param Object $object Object related to tabs + * @param Contact $object Object related to tabs * @return array Array of tabs to show */ -function contact_prepare_head($object) +function contact_prepare_head(Contact $object) { global $langs, $conf, $user; diff --git a/htdocs/core/lib/contract.lib.php b/htdocs/core/lib/contract.lib.php index b7e82c6dbf2..fff83e4c4bc 100644 --- a/htdocs/core/lib/contract.lib.php +++ b/htdocs/core/lib/contract.lib.php @@ -25,10 +25,10 @@ /** * Prepare array with list of tabs * - * @param Object $object Object related to tabs + * @param Contrat $object Object related to tabs * @return array Array of tabs to show */ -function contract_prepare_head($object) +function contract_prepare_head(Contrat $object) { global $langs, $conf; $h = 0; From e485dd413dc3795e7fd86ccdd59edb1008646075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 10 Feb 2015 13:41:59 +0100 Subject: [PATCH 22/63] PHPDoc and misc fixes for several folders --- htdocs/core/lib/cron.lib.php | 4 ++-- htdocs/cron/class/cronjob.class.php | 29 +++++++++---------------- htdocs/ecm/class/ecmdirectory.class.php | 5 +---- htdocs/ecm/class/htmlecm.form.class.php | 2 +- 4 files changed, 14 insertions(+), 26 deletions(-) diff --git a/htdocs/core/lib/cron.lib.php b/htdocs/core/lib/cron.lib.php index 79e23e90089..c3867839e84 100644 --- a/htdocs/core/lib/cron.lib.php +++ b/htdocs/core/lib/cron.lib.php @@ -50,10 +50,10 @@ function cronadmin_prepare_head() /** * Return array of tabs to used on a cron job * - * @param Object $object Object cron + * @param Cronjob $object Object cron * @return array Array of tabs */ -function cron_prepare_head($object) +function cron_prepare_head(Cronjob $object) { global $langs, $conf, $user; $h = 0; diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index aaa69ec7f42..723660f1d9c 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -273,7 +273,6 @@ class Cronjob extends CommonObject */ function fetch($id) { - global $langs; $sql = "SELECT"; $sql.= " t.rowid,"; @@ -655,15 +654,14 @@ class Cronjob extends CommonObject */ function delete($user, $notrigger=0) { - global $conf, $langs; $error=0; $this->db->begin(); - if (! $error) - { - if (! $notrigger) - { +// if (! $error) +// { +// if (! $notrigger) +// { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -673,18 +671,18 @@ class Cronjob extends CommonObject //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); //if ($result < 0) { $error++; $this->errors=$interface->errors; } //// End call triggers - } - } +// } +// } - if (! $error) - { +// if (! $error) +// { $sql = "DELETE FROM ".MAIN_DB_PREFIX."cronjob"; $sql.= " WHERE rowid=".$this->id; dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - } +// } // Commit or rollback if ($error) @@ -803,12 +801,10 @@ class Cronjob extends CommonObject /** * Load object information * - * @return void + * @return int */ function info() { - global $langs; - $sql = "SELECT"; $sql.= " f.rowid, f.datec, f.tms, f.fk_user_mod, f.fk_user_author"; $sql.= " FROM ".MAIN_DB_PREFIX."cronjob as f"; @@ -849,7 +845,6 @@ class Cronjob extends CommonObject { global $langs, $conf; - $error=0; $now=dol_now(); $langs->load('cron'); @@ -935,7 +930,6 @@ class Cronjob extends CommonObject // Create Object for the call module $object = new $this->objectname($this->db); - $params_arr = array(); $params_arr = explode(", ",$this->params); if (!is_array($params_arr)) { @@ -978,7 +972,6 @@ class Cronjob extends CommonObject return -1; } dol_syslog(get_class($this) . "::run_jobs " . $this->libname . "::" . $this->methodename."(" . $this->params . ");", LOG_DEBUG); - $params_arr = array(); $params_arr = explode(", ", $this->params); if (!is_array($params_arr)) { @@ -1074,8 +1067,6 @@ class Cronjob extends CommonObject */ function reprogram_jobs($userlogin) { - global $langs, $conf; - dol_syslog(get_class($this)."::reprogram_jobs userlogin:$userlogin", LOG_DEBUG); require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 6c0de13d15b..d099d017ecd 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -244,8 +244,6 @@ class EcmDirectory // extends CommonObject */ function changeNbOfFiles($sign) { - global $conf, $langs; - // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET"; $sql.= " cachenbofdoc = cachenbofdoc ".$sign." 1"; @@ -320,7 +318,7 @@ class EcmDirectory // extends CommonObject * Delete object on database and/or on disk * * @param User $user User that delete - * @param int $mode 'all'=delete all, 'databaseonly'=only database entry, 'fileonly' (not implemented) + * @param string $mode 'all'=delete all, 'databaseonly'=only database entry, 'fileonly' (not implemented) * @return int <0 if KO, >0 if OK */ function delete($user, $mode='all') @@ -329,7 +327,6 @@ class EcmDirectory // extends CommonObject require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $error=0; - $result=0; if ($mode != 'databaseonly') $relativepath=$this->getRelativePath(1); // Ex: dir1/dir2/dir3 diff --git a/htdocs/ecm/class/htmlecm.form.class.php b/htdocs/ecm/class/htmlecm.form.class.php index 58286371941..87b4af190ae 100644 --- a/htdocs/ecm/class/htmlecm.form.class.php +++ b/htdocs/ecm/class/htmlecm.form.class.php @@ -51,7 +51,7 @@ class FormEcm * @param string $select_name Nom formulaire HTML * @return string String with HTML select */ - function select_all_sections($selected='',$select_name='') + function select_all_sections($selected=0,$select_name='') { global $langs; $langs->load("ecm"); From 2820bd24ac17495e00878911c57cbd38b6788d60 Mon Sep 17 00:00:00 2001 From: jean Date: Tue, 10 Feb 2015 16:03:31 +0100 Subject: [PATCH 23/63] fetch must contain an left join on c_actioncom for correct function --- htdocs/comm/action/class/actioncomm.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 09a2abf329a..4b8ab94d93d 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -337,7 +337,8 @@ class ActionComm extends CommonObject $sql.= " c.id as type_id, c.code as type_code, c.libelle,"; $sql.= " s.nom as socname,"; $sql.= " u.firstname, u.lastname as lastname"; - $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)"; + $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a "; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action=c.id "; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; $sql.= " WHERE a.fk_action=c.id"; From 1f31ff338ca8dafbdc73067ba8db2a4d2398e517 Mon Sep 17 00:00:00 2001 From: jean Date: Wed, 11 Feb 2015 14:39:32 +0100 Subject: [PATCH 24/63] correction for fetch sql --- htdocs/comm/action/class/actioncomm.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 4b8ab94d93d..10d8eeb32e1 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -341,9 +341,9 @@ class ActionComm extends CommonObject $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action=c.id "; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; - $sql.= " WHERE a.fk_action=c.id"; - if ($ref) $sql.= " AND a.id=".$ref; // No field ref, we use id - else $sql.= " AND a.id=".$id; + $sql.= " WHERE "; + if ($ref) $sql.= " a.id=".$ref; // No field ref, we use id + else $sql.= " a.id=".$id; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); From be56f767439fd89541fc6adea2ab02d2f48065fd Mon Sep 17 00:00:00 2001 From: Gauthier Date: Thu, 12 Feb 2015 12:56:21 +0100 Subject: [PATCH 25/63] FIX : Display error on dispatched quantity when we have several times same product in a supplier order --- .../fourn/class/fournisseur.commande.class.php | 6 +++--- htdocs/fourn/commande/dispatch.php | 17 ++++++++++------- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 2 ++ .../llx_commande_fournisseur_dispatch.sql | 1 + 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index d95816a1511..efc59943a23 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1272,7 +1272,7 @@ class CommandeFournisseur extends CommonOrder * @param string $batch Lot number * @return int <0 if KO, >0 if OK */ - function DispatchProduct($user, $product, $qty, $entrepot, $price=0, $comment='', $eatby='', $sellby='', $batch='') + function DispatchProduct($user, $product, $qty, $entrepot, $price=0, $comment='', $eatby='', $sellby='', $batch='', $fk_commandefourndet='') { global $conf; $error = 0; @@ -1292,8 +1292,8 @@ class CommandeFournisseur extends CommonOrder $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur_dispatch "; - $sql.= " (fk_commande,fk_product, qty, fk_entrepot, fk_user, datec) VALUES "; - $sql.= " ('".$this->id."','".$product."','".$qty."',".($entrepot>0?"'".$entrepot."'":"null").",'".$user->id."','".$this->db->idate($now)."')"; + $sql.= " (fk_commande,fk_product, qty, fk_entrepot, fk_user, datec, fk_commandefourndet) VALUES "; + $sql.= " ('".$this->id."','".$product."','".$qty."',".($entrepot>0?"'".$entrepot."'":"null").",'".$user->id."','".$this->db->idate($now)."','".$fk_commandefourndet."')"; dol_syslog(get_class($this)."::DispatchProduct", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index bea467340e6..d5ace69a09f 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -78,9 +78,10 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece $qty = "qty_".$reg[1]; $ent = "entrepot_".$reg[1]; $pu = "pu_".$reg[1]; // This is unit price including discount + $fk_commandefourndet = "fk_commandefourndet_".$reg[1]; if (GETPOST($ent,'int') > 0) { - $result = $commande->DispatchProduct($user, GETPOST($prod,'int'),GETPOST($qty), GETPOST($ent,'int'), GETPOST($pu), GETPOST("comment")); + $result = $commande->DispatchProduct($user, GETPOST($prod,'int'),GETPOST($qty), GETPOST($ent,'int'), GETPOST($pu), GETPOST("comment"), '', '', '', GETPOST($fk_commandefourndet, 'int')); } else { @@ -251,22 +252,23 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; - $sql = "SELECT cfd.fk_product, sum(cfd.qty) as qty"; + $sql = "SELECT l.rowid, cfd.fk_product, sum(cfd.qty) as qty"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as l on (l.rowid = cfd.fk_commandefourndet)"; $sql.= " WHERE cfd.fk_commande = ".$commande->id; - $sql.= " GROUP BY cfd.fk_product"; + $sql.= " GROUP BY l.rowid"; $resql = $db->query($sql); if ($resql) { while ( $row = $db->fetch_row($resql) ) { - $products_dispatched[$row[0]] = $row[1]; + $products_dispatched[$row[0]] = $row[2]; } $db->free($resql); } - $sql = "SELECT l.fk_product, l.subprice, l.remise_percent, SUM(l.qty) as qty,"; + $sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, SUM(l.qty) as qty,"; $sql.= " p.ref, p.label, p.tobatch"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product=p.rowid"; @@ -317,7 +319,7 @@ if ($id > 0 || ! empty($ref)) } else { - $remaintodispatch=($objp->qty - $products_dispatched[$objp->fk_product]); // Calculation of dispatched + $remaintodispatch=($objp->qty - $products_dispatched[$objp->rowid]); // Calculation of dispatched if ($remaintodispatch < 0) $remaintodispatch=0; if ($remaintodispatch) { @@ -343,7 +345,7 @@ if ($id > 0 || ! empty($ref)) print "\n"; print ''; - print ''; + print ''; if ( !(empty($conf->productbatch->enabled)) && $objp->tobatch==1) { print ''; @@ -361,6 +363,7 @@ if ($id > 0 || ! empty($ref)) print ''; } else { print ''; + print ''; print ''; } diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index 4421ad032eb..7199cd8ebf3 100755 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -1155,3 +1155,5 @@ ALTER TABLE llx_resource MODIFY COLUMN entity integer DEFAULT 1 NOT NULL; -- This request make mysql drop (mysql bug, so we add it at end): ALTER TABLE llx_product ADD CONSTRAINT fk_product_barcode_type FOREIGN KEY (fk_barcode_type) REFERENCES llx_c_barcode_type(rowid); +-- Add id commandefourndet in llx_commande_fournisseur_dispatch to correct /fourn/commande/dispatch.php display when several times same product in supplier order +ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN fk_commandefourndet INT(11) NOT NULL DEFAULT '0' AFTER fk_product; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql index 7eeb02ab5cf..1c2cd348a74 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql @@ -21,6 +21,7 @@ create table llx_commande_fournisseur_dispatch rowid integer AUTO_INCREMENT PRIMARY KEY, fk_commande integer, fk_product integer, + fk_commandefourndet integer, qty float, -- qty fk_entrepot integer, fk_user integer, From 09013c7e1c4c3f5e1fd641bcb668c51b842d9cbe Mon Sep 17 00:00:00 2001 From: Sof Date: Thu, 12 Feb 2015 13:00:22 +0100 Subject: [PATCH 26/63] FIX : Let ability to use IDPROF verifications even if new entry is "private" We do not check for duplicate or empty id_prof fields while inserting a new entry when verifications options are set to "ON" in the third party configuration panel. --- htdocs/societe/soc.php | 44 +++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index d0d9c9cbb47..23d9aa2d8e1 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -242,30 +242,34 @@ if (empty($reshook)) } // Check for duplicate or mandatory prof id - for ($i = 1; $i < 5; $i++) + // Only for companies + if (!($object->particulier || $private)) { - $slabel="idprof".$i; - $_POST[$slabel]=trim($_POST[$slabel]); - $vallabel=$_POST[$slabel]; - if ($vallabel && $object->id_prof_verifiable($i)) - { - if($object->id_prof_exists($i,$vallabel,$object->id)) + for ($i = 1; $i < 5; $i++) + { + $slabel="idprof".$i; + $_POST[$slabel]=trim($_POST[$slabel]); + $vallabel=$_POST[$slabel]; + if ($vallabel && $object->id_prof_verifiable($i)) + { + if($object->id_prof_exists($i,$vallabel,$object->id)) + { + $langs->load("errors"); + $error++; $errors[] = $langs->transcountry('ProfId'.$i, $object->country_code)." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel); + $action = (($action=='add'||$action=='create')?'create':'edit'); + } + } + + $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; + + if (! $vallabel && ! empty($conf->global->$idprof_mandatory)) { $langs->load("errors"); - $error++; $errors[] = $langs->transcountry('ProfId'.$i, $object->country_code)." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel); - $action = (($action=='add'||$action=='create')?'create':'edit'); + $error++; + $errors[] = $langs->trans("ErrorProdIdIsMandatory", $langs->transcountry('ProfId'.$i, $object->country_code)); + $action = (($action=='add'||$action=='create')?'create':'edit'); } - } - - $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; - - if (! $vallabel && ! empty($conf->global->$idprof_mandatory)) - { - $langs->load("errors"); - $error++; - $errors[] = $langs->trans("ErrorProdIdIsMandatory", $langs->transcountry('ProfId'.$i, $object->country_code)); - $action = (($action=='add'||$action=='create')?'create':'edit'); - } + } } } From 105e024c4869a51743670e31eba739b1e0bd3015 Mon Sep 17 00:00:00 2001 From: Gauthier Date: Thu, 12 Feb 2015 13:20:03 +0100 Subject: [PATCH 27/63] @param desc --- .../class/fournisseur.commande.class.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index efc59943a23..70514223c73 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1261,15 +1261,16 @@ class CommandeFournisseur extends CommonOrder /** * Add a product into a stock warehouse. * - * @param User $user User object making change - * @param int $product Id of product to dispatch - * @param double $qty Qty to dispatch - * @param int $entrepot Id of warehouse to add product - * @param double $price Unit Price for PMP value calculation (Unit price without Tax and taking into account discount) - * @param string $comment Comment for stock movement - * @param date $eatby eat-by date - * @param date $sellby sell-by date - * @param string $batch Lot number + * @param User $user User object making change + * @param int $product Id of product to dispatch + * @param double $qty Qty to dispatch + * @param int $entrepot Id of warehouse to add product + * @param double $price Unit Price for PMP value calculation (Unit price without Tax and taking into account discount) + * @param string $comment Comment for stock movement + * @param date $eatby eat-by date + * @param date $sellby sell-by date + * @param string $batch Lot number + * @param int $fk_commandefourndet Id of supplier order line * @return int <0 if KO, >0 if OK */ function DispatchProduct($user, $product, $qty, $entrepot, $price=0, $comment='', $eatby='', $sellby='', $batch='', $fk_commandefourndet='') From c3bf3c45d764780c23ca0857e55fc4ace22a8b86 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Fri, 13 Feb 2015 04:13:32 +0100 Subject: [PATCH 28/63] Update card.php Display amount and link to unpaid bill --- htdocs/comm/card.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index dc74935ce98..ac9ff663539 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -396,6 +396,10 @@ if ($id > 0) print $form->editfieldkey("OutstandingBill",'OutstandingBill',$object->outstanding_limit,$object,$user->rights->societe->creer); print ''; print ''; } From ebdb96b18cb699f360c773fb87d5b1fe51872c53 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 13 Feb 2015 06:20:08 +0100 Subject: [PATCH 29/63] FIXED All constants COMPTA_* was renamed in ACCOUNTING_* --- htdocs/accountancy/supplier/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index a85dd7a17d4..656afbd32cc 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -186,9 +186,9 @@ if ($result) { if (empty($objp->code_buy)) { $code_buy_notset = 'color:red'; if ($objp->type == 1) { - $objp->code_buy = (! empty($conf->global->COMPTA_SERVICE_BUY_ACCOUNT) ? $conf->global->COMPTA_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef")); + $objp->code_buy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef")); } else { - $objp->code_buy = (! empty($conf->global->COMPTA_PRODUCT_BUY_ACCOUNT) ? $conf->global->COMPTA_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef")); + $objp->code_buy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef")); } }else { $code_buy_notset = 'color:blue'; From 3d020056e09b6fd6909ca25246a72a928abf845f Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 13 Feb 2015 06:25:21 +0100 Subject: [PATCH 30/63] FIXED Remove old language key --- htdocs/langs/fr_FR/compta.lang | 8 -------- 1 file changed, 8 deletions(-) diff --git a/htdocs/langs/fr_FR/compta.lang b/htdocs/langs/fr_FR/compta.lang index e20b6efae12..6b29fa82fec 100644 --- a/htdocs/langs/fr_FR/compta.lang +++ b/htdocs/langs/fr_FR/compta.lang @@ -204,11 +204,3 @@ ACCOUNTING_ACCOUNT_SUPPLIER=Code comptable par défaut des tiers fournisseurs CloneTax=Cloner une charge sociale ConfirmCloneTax=Confirmer le clonage de la charge sociale CloneTaxForNextMonth=Cloner pour le mois suivant -COMPTA_PRODUCT_BUY_ACCOUNT=Code comptable par défaut pour l'achat de produits -COMPTA_PRODUCT_SOLD_ACCOUNT=Code comptable par défaut pour la vente de produits -COMPTA_SERVICE_BUY_ACCOUNT=Code comptable par défaut pour l'achat de services -COMPTA_SERVICE_SOLD_ACCOUNT=Code comptable par défaut pour la vente de services -COMPTA_VAT_ACCOUNT=Code comptable par défaut pour l'encaissement de TVA -COMPTA_VAT_BUY_ACCOUNT=Code comptable par défaut pour le versement de la TVA -COMPTA_ACCOUNT_CUSTOMER=Code comptable par défaut des tiers clients -COMPTA_ACCOUNT_SUPPLIER=Code comptable par défaut des tiers fournisseurs From 674585136e2f47a47ca3d1f97da574322ef894cb Mon Sep 17 00:00:00 2001 From: KreizIT Date: Sat, 14 Feb 2015 16:16:01 +0100 Subject: [PATCH 31/63] Fix inconsistent data --- htdocs/install/mysql/data/llx_00_c_country.sql | 2 +- htdocs/install/mysql/data/llx_10_c_regions.sql | 2 -- htdocs/install/mysql/data/llx_c_tva.sql | 4 ++-- htdocs/install/mysql/tables/llx_c_regions.sql | 2 +- htdocs/install/mysql/tables/llx_rights_def.sql | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql index a6c0efc77a6..9c83b70502a 100644 --- a/htdocs/install/mysql/data/llx_00_c_country.sql +++ b/htdocs/install/mysql/data/llx_00_c_country.sql @@ -270,4 +270,4 @@ INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (24 INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (244,'ME','MNE','Monténégro',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (245,'BL','BLM','Saint-Barthélemy',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (246,'MF','MAF','Saint-Martin',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (247,'BU', null, 'Burundi',1,0); + diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index 4415f5711bf..e1664384323 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -270,5 +270,3 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) v INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 12, 1215, '', 0, 'Laâyoune-Boujdour-Sakia el Hamra', 1); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 12, 1216, '', 0, 'Oued Ed-Dahab Lagouira', 1); --- Regions Tunisia (id country=10) -INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 10, 1001, '', 0, 'Algerie', 1); diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index e3f7e56cdc6..7b42efdae0e 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -187,8 +187,8 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (17 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1734, 173, '0','0','VAT Rate 0', 1); -- PERU (id country=181) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1841, 181, '18','0','VAT standard rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1843, 181, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1811, 181, '18','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1812, 181, '0','0','VAT Rate 0',1); -- POLAND (id country=184) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1841, 184, '20','0','VAT standard rate',1); diff --git a/htdocs/install/mysql/tables/llx_c_regions.sql b/htdocs/install/mysql/tables/llx_c_regions.sql index 9c677ee44f7..768a234dbbd 100644 --- a/htdocs/install/mysql/tables/llx_c_regions.sql +++ b/htdocs/install/mysql/tables/llx_c_regions.sql @@ -24,7 +24,7 @@ create table llx_c_regions fk_pays integer NOT NULL, cheflieu varchar(50), tncc integer, - nom varchar(50), + nom varchar(100), active tinyint DEFAULT 1 NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_rights_def.sql b/htdocs/install/mysql/tables/llx_rights_def.sql index 8bf85add124..297772730c7 100644 --- a/htdocs/install/mysql/tables/llx_rights_def.sql +++ b/htdocs/install/mysql/tables/llx_rights_def.sql @@ -19,7 +19,7 @@ create table llx_rights_def ( - id integer, + id integer NOT NULL, libelle varchar(255), module varchar(64), entity integer DEFAULT 1 NOT NULL, From 0c0c442248c42717cd5bf806fe9e98d4609ebf47 Mon Sep 17 00:00:00 2001 From: KreizIT Date: Sat, 14 Feb 2015 16:27:00 +0100 Subject: [PATCH 32/63] Make MS SQL working --- htdocs/core/db/mssql.class.php | 305 ++++++++++++++----- htdocs/install/etape1.php | 4 +- htdocs/install/etape2.php | 8 +- htdocs/install/mssql/functions/functions.sql | Bin 5010 -> 0 bytes 4 files changed, 241 insertions(+), 76 deletions(-) delete mode 100644 htdocs/install/mssql/functions/functions.sql diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 0f86f01693c..55f5dbe1458 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -89,6 +89,7 @@ class DoliDBMssql extends DoliDB // (La base Dolibarr a ete forcee en this->forcecharset a l'install) $this->connected = 1; $this->ok = 1; + } else { @@ -146,7 +147,7 @@ class DoliDBMssql extends DoliDB */ function select_db($database) { - return mssql_select_db($database, $this->db); + return @mssql_select_db($database, $this->db); } /** @@ -171,6 +172,18 @@ class DoliDBMssql extends DoliDB // les nouvelles version de Dolibarr car force par l'install Dolibarr. //$this->query('SET NAMES '.$this->forcecharset); //print "Resultat fonction connect: ".$this->db; + $set_options=array('SET ANSI_PADDING ON;', + "SET ANSI_NULLS ON;", + "SET ANSI_WARNINGS ON;", + "SET ARITHABORT ON;", + "SET CONCAT_NULL_YIELDS_NULL ON;", + "SET QUOTED_IDENTIFIER ON;" + ); + mssql_query(implode(' ',$set_options),$this->db); + + + + return $this->db; } @@ -224,19 +237,22 @@ class DoliDBMssql extends DoliDB */ function begin() { - if (! $this->transaction_opened) + + $res=mssql_query('select @@TRANCOUNT'); + $this->transaction_opened=mssql_result($res, 0, 0); + + if ($this->transaction_opened == 0) { - $ret=$this->query("BEGIN TRANSACTION"); + //return 1; //There is a mess with auto_commit and 'SET IMPLICIT_TRANSACTIONS ON' generate also a mess + $ret=mssql_query("SET IMPLICIT_TRANSACTIONS OFF;BEGIN TRANSACTION;",$this->db); if ($ret) { - $this->transaction_opened++; dol_syslog("BEGIN Transaction",LOG_DEBUG); } return $ret; } else { - $this->transaction_opened++; return 1; } } @@ -249,12 +265,15 @@ class DoliDBMssql extends DoliDB */ function commit($log='') { - if ($this->transaction_opened <= 1) + $res=mssql_query('select @@TRANCOUNT'); + $this->transaction_opened=mssql_result($res, 0, 0); + + if ($this->transaction_opened == 1) { - $ret=$this->query("COMMIT TRANSACTION"); + //return 1; //There is a mess with auto_commit and 'SET IMPLICIT_TRANSACTION ON' generate also a mess + $ret=mssql_query("COMMIT TRANSACTION",$this->db); if ($ret) { - $this->transaction_opened=0; dol_syslog("COMMIT Transaction",LOG_DEBUG); return 1; } @@ -263,11 +282,11 @@ class DoliDBMssql extends DoliDB return 0; } } - else + elseif ($this->transaction_opened > 1) { - $this->transaction_opened--; return 1; - } + } else + trigger_error("Commit requested but no transaction remain"); } /** @@ -278,18 +297,20 @@ class DoliDBMssql extends DoliDB */ function rollback($log='') { - if ($this->transaction_opened<=1) + $res=mssql_query('select @@TRANCOUNT'); + $this->transaction_opened=mssql_result($res, 0, 0); + + if ($this->transaction_opened == 1) { - $ret=$this->query("ROLLBACK TRANSACTION"); - $this->transaction_opened=0; + $ret=mssql_query("ROLLBACK TRANSACTION",$this->db); dol_syslog("ROLLBACK Transaction".($log?' '.$log:''),LOG_DEBUG); return $ret; } - else + elseif ($this->transaction_opened > 1) { - $this->transaction_opened--; return 1; - } + } else + trigger_error("Rollback requested but no transaction remain"); } /** @@ -304,54 +325,98 @@ class DoliDBMssql extends DoliDB function query($query,$usesavepoint=0,$type='auto') { $query = trim($query); + + if (preg_match('/^--/',$query)) return true; // Conversion syntaxe MySql vers MSDE. $query = str_ireplace("now()", "getdate()", $query); // Erreur SQL: cannot update timestamp field $query = str_ireplace(", tms = tms", "", $query); - // Voir si l'on peut directement utiliser $query = str_ireplace("file", "[file]", $query); - // au lieu des 3 lignes ci-dessous - $query = str_ireplace(".file", ".[file]", $query); - $query = str_ireplace(" file ", " [file] ", $query); - $query = str_ireplace(" file,", " [file],", $query); - // Idem file - $query = str_ireplace(".percent", ".[percent]", $query); - $query = str_ireplace(" percent ", " [percent] ", $query); - $query = str_ireplace("percent,", "[percent],", $query); - $query = str_ireplace("percent=", "[percent]=", $query); - $query = str_ireplace("\'", "''", $query); - - $itemfound = stripos($query, " limit "); - if ($itemfound !== false) { - // Extraire le nombre limite - $number = stristr($query, " limit "); - $number = substr($number, 7); - // Inserer l'instruction TOP et le nombre limite - $query = str_ireplace("select ", "select top ".$number." ", $query); - // Supprimer l'instruction MySql - $query = str_ireplace(" limit ".$number, "", $query); + $query=preg_replace("/([. ,\t(])(percent|file|public)([. ,=\t)])/","$1[$2]$3",$query); + + if ($type=="auto" || $type='dml') + { + $query=preg_replace('/AUTO_INCREMENT/i','IDENTITY',$query); + $query=preg_replace('/double/i','float',$query); + $query=preg_replace('/float\((.*)\)/','numeric($1)',$query); + $query=preg_replace('/([ \t])unsigned|IF NOT EXISTS[ \t]/i','$1',$query); + $query=preg_replace('/([ \t])(MEDIUM|TINY|LONG){0,1}TEXT([ \t,])/i',"$1VARCHAR(MAX)$3",$query); + + $matches=array(); + $original_query=''; + if (preg_match('/ALTER TABLE\h+(\w+?)\h+ADD\h+(?:(UNIQUE)|INDEX)\h+(?:INDEX)?\h*(\w+?)\h*\((.+)\)/is', $query,$matches)) + { + $original_query=$query; + $query="CREATE ".trim($matches[2])." INDEX [".trim($matches[3])."] ON [".trim($matches[1])."] (".trim($matches[4]).")"; + if ($matches[2]) { + //check if columun is nullable cause Sql server only allow 1 null value if unique index. + $fields=explode(",",trim($matches[4])); + $fields_clear=array_map('trim',$fields); + $infos=$this->GetFieldInformation(trim($matches[1]), $fields_clear); + $query_comp=array(); + foreach($infos as $fld) { + if ($fld->IS_NULLABLE == 'YES') { + $query_comp[]=$fld->COLUMN_NAME." IS NOT NULL"; + } + } + if ($query_comp) + $query.=" WHERE ".implode(" AND ",$query_comp); + } + } + else + { + if (preg_match('/ALTER TABLE\h+(\w+?)\h+ADD\h+PRIMARY\h+KEY\h+(\w+?)\h*\((.+)\)/is', $query, $matches)) + { + $original_query=$query; + $query="ALTER TABLE [".$matches[1]."] ADD CONSTRAINT [".$matches[2]."] PRIMARY KEY CLUSTERED (".$matches[3].")"; + } + } + } - $itemfound = stripos($query, " week("); - if ($itemfound !== false) { - // Recreer une requete sans instruction Mysql - $positionMySql = stripos($query, " week("); - $newquery = substr($query, 0, $positionMySql); - - // Recuperer la date passee en parametre - $extractvalue = stristr($query, " week("); - $extractvalue = substr($extractvalue, 6); - $positionMySql = stripos($extractvalue, ")"); - // Conserver la fin de la requete - $endofquery = substr($extractvalue, $positionMySql); - $extractvalue = substr($extractvalue, 0, $positionMySql); - - // Remplacer l'instruction MySql en Sql Server - // Inserer la date en parametre et le reste de la requete - $query = $newquery." DATEPART(week, ".$extractvalue.$endofquery; + if ($type=="auto" || $type='ddl') + { + $itemfound = stripos($query, " limit "); + if ($itemfound !== false) { + // Extraire le nombre limite + $number = stristr($query, " limit "); + $number = substr($number, 7); + // Inserer l'instruction TOP et le nombre limite + $query = str_ireplace("select ", "select top ".$number." ", $query); + // Supprimer l'instruction MySql + $query = str_ireplace(" limit ".$number, "", $query); + } + + $itemfound = stripos($query, " week("); + if ($itemfound !== false) { + // Recreer une requete sans instruction Mysql + $positionMySql = stripos($query, " week("); + $newquery = substr($query, 0, $positionMySql); + + // Recuperer la date passee en parametre + $extractvalue = stristr($query, " week("); + $extractvalue = substr($extractvalue, 6); + $positionMySql = stripos($extractvalue, ")"); + // Conserver la fin de la requete + $endofquery = substr($extractvalue, $positionMySql); + $extractvalue = substr($extractvalue, 0, $positionMySql); + + // Remplacer l'instruction MySql en Sql Server + // Inserer la date en parametre et le reste de la requete + $query = $newquery." DATEPART(week, ".$extractvalue.$endofquery; + } + if (preg_match('/^insert\h+(?:INTO)?\h*(\w+?)\h*\(.*\b(?:row)?id\b.*\)\h+VALUES/i',$query,$matches)) + { + //var_dump($query); + //var_dump($matches); + if (stripos($query,'llx_c_departements') !== false) var_dump($query); + $sql='SET IDENTITY_INSERT ['.trim($matches[1]).'] ON;'; + @mssql_query($sql, $this->db); + $post_query='SET IDENTITY_INSERT ['.trim($matches[1]).'] OFF;'; + + } } - //print ""; if (! in_array($query,array('BEGIN','COMMIT','ROLLBACK'))) dol_syslog('sql='.$query, LOG_DEBUG); @@ -365,6 +430,11 @@ class DoliDBMssql extends DoliDB { $ret = mssql_query($query, $this->db); } + + if (!empty($post_query)) + { + @mssql_query($post_query, $this->db); + } if (! preg_match("/^COMMIT/i",$query) && ! preg_match("/^ROLLBACK/i",$query)) { @@ -379,12 +449,13 @@ class DoliDBMssql extends DoliDB $this->lasterrno = $row["code"]; dol_syslog(get_class($this)."::query SQL Error query: ".$query, LOG_ERR); + if ($original_query) dol_syslog(get_class($this)."::query SQL Original query: ".$original_query, LOG_ERR); dol_syslog(get_class($this)."::query SQL Error message: ".$this->lasterror." (".$this->lasterrno.")", LOG_ERR); } $this->lastquery=$query; $this->_results = $ret; } - + return $ret; } @@ -539,7 +610,8 @@ class DoliDBMssql extends DoliDB 1146 => 'DB_ERROR_NOSUCHTABLE', 1216 => 'DB_ERROR_NO_PARENT', 1217 => 'DB_ERROR_CHILD_EXISTS', - 1451 => 'DB_ERROR_CHILD_EXISTS' + 1451 => 'DB_ERROR_CHILD_EXISTS', + 1913 => 'DB_ERROR_KEY_NAME_ALREADY_EXISTS' ); if (isset($errorcode_map[$this->lasterrno])) @@ -563,7 +635,7 @@ class DoliDBMssql extends DoliDB return 'Not connected. Check setup parameters in conf/conf.php file and your mssql client and server versions'; } else { - return mssql_get_last_message($this->db); + return mssql_get_last_message(); } } @@ -655,20 +727,35 @@ class DoliDBMssql extends DoliDB */ function DDLCreateDb($database,$charset='',$collation='',$owner='') { - if (empty($charset)) $charset=$this->forcecharset; + /*if (empty($charset)) $charset=$this->forcecharset; if (empty($collation)) $collation=$this->forcecollate; + */ +<<<<<<< Updated upstream // ALTER DATABASE dolibarr_db DEFAULT CHARACTER SET latin DEFAULT COLLATE latin1_swedish_ci $sql = 'CREATE DATABASE '.$database; $sql.= ' DEFAULT CHARACTER SET '.$charset.' DEFAULT COLLATE '.$collation; +======= + $sql = 'CREATE DATABASE '.$this->EscapeFieldName($database); + //TODO: Check if we need to force a charset + //$sql.= ' DEFAULT CHARACTER SET '.$charset.' DEFAULT COLLATE '.$collation; +>>>>>>> Stashed changes $ret=$this->query($sql); - if (! $ret) - { - // On reessaie pour compatibilite avec mssql < 5.0 - $sql = 'CREATE DATABASE '.$database; - $ret=$this->query($sql); - } - + + + $this->select_db($database); + $sql="CREATE USER [$owner] FOR LOGIN [$owner]"; + mssql_query($sql,$this->db); + $sql="ALTER ROLE [db_owner] ADD MEMBER [$owner]"; + mssql_query($sql,$this->db); + + //For version >=2008 + $sql="ALTER DATABASE [$database] SET ANSI_NULL_DEFAULT ON;"; + @mssql_query($sql,$this->db); + $sql="ALTER DATABASE [$database] SET ANSI_NULL ON;"; + @mssql_query($sql,$this->db); + + return $ret; } @@ -884,12 +971,40 @@ class DoliDBMssql extends DoliDB */ function DDLCreateUser($dolibarr_main_db_host,$dolibarr_main_db_user,$dolibarr_main_db_pass,$dolibarr_main_db_name) { - // FIXME: Dummy method - // TODO: Implement - // May help: http://msdn.microsoft.com/fr-fr/library/ms173463.aspx - - // Always fail for now - return -1; + $sql = "CREATE LOGIN ".$this->EscapeFieldName($dolibarr_main_db_user)." WITH PASSWORD='$dolibarr_main_db_pass'"; + dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log + $resql=$this->query($sql); + if (! $resql) + { + if ($this->lasterrno != '15025') + { + return -1; + } + else + { + // If user already exists, we continue to set permissions + dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING); + } + } + $sql="SELECT name from sys.databases where name='".$dolibarr_main_db_name."'"; + $ressql=$this->query($sql); + if (! $ressql) + { + dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING); + return -1; + } + else + { + if ($num) + { + $this->select_db($dolibarr_main_db_name); + $sql="CREATE USER [$dolibarr_main_db_user] FOR LOGIN [$dolibarr_main_db_user]"; + $this->query($sql); + $sql="ALTER ROLE [db_owner] ADD MEMBER [$dolibarr_main_db_user]"; + $this->query($sql); + } + } + return 1; } /** @@ -1003,5 +1118,49 @@ class DoliDBMssql extends DoliDB return array(); } + + /** + * Escape a field name according to escape's syntax + * + * @param string $fieldname Field's name to escape + * @return string field's name escaped + */ + function EscapeFieldName($fieldname) { + return "[".$fieldname."]"; + } + + + /** + * Get information on field + * + * @param string $table Table name which contains fields + * @param mixed $fields String for one field or array of string for multiple field + * @return boolean|multitype:object + */ + function GetFieldInformation($table,$fields) { + $sql="SELECT * from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='".$this->escape($table)."' AND COLUMN_NAME"; + if (is_array($fields)) + { + $where=" IN ('".implode("','",$fields)."')"; + } + else + { + $where="='".$this->escape($fields)."'"; + } + $result=array(); + $ret=mssql_query($sql.$where,$this->db); + if ($ret) + { + while($obj=mssql_fetch_object($ret)) + { + $result[]=$obj; + } + } + else + return false; + + return $result; + } + } diff --git a/htdocs/install/etape1.php b/htdocs/install/etape1.php index 20450760127..50d5ee27b55 100644 --- a/htdocs/install/etape1.php +++ b/htdocs/install/etape1.php @@ -175,7 +175,7 @@ if (! $error) } else { - $databasefortest='mssql'; + $databasefortest='master'; } } //print $_POST["db_type"].",".$_POST["db_host"].",$userroot,$passroot,$databasefortest,".$_POST["db_port"]; @@ -486,7 +486,7 @@ if (! $error && $db->connected && $action == "set") } else if ($conf->db->type == 'mssql') { - $databasefortest='mssql'; + $databasefortest='master'; } // Creation handler de base, verification du support et connexion diff --git a/htdocs/install/etape2.php b/htdocs/install/etape2.php index f97f1afaa9c..1f6c5244d84 100644 --- a/htdocs/install/etape2.php +++ b/htdocs/install/etape2.php @@ -1,6 +1,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2015 Cedric GROSS * * 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 @@ -192,6 +193,11 @@ if ($action == "set") { $buffer=preg_replace('/type=innodb/i','ENGINE=innodb',$buffer); } + else if ($conf->db->type == 'mssql') + { + $buffer=preg_replace('/type=innodb/i','',$buffer); + $buffer=preg_replace('/ENGINE=innodb/i','',$buffer); + } // Replace the prefix tables if ($dolibarr_main_db_prefix != 'llx_') @@ -219,7 +225,7 @@ if ($action == "set") else { print ""; print ''; $error++; diff --git a/htdocs/install/mssql/functions/functions.sql b/htdocs/install/mssql/functions/functions.sql deleted file mode 100644 index 1c2c76996dc312cc2440a2329d46530adb815d7c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5010 zcmd^@T~8ZF6o%)P{S|wMX%i@|s;DiAaBNIn5uC!KHu}P{PFwK@HC|1`A7Om&`$a_!Z=LAeVB$}xC+-{#$JuxEq=cY zU+{Ux>P^Tv9fq9s_uQDX%6T5~yvN;mx*sk$z2W364A`HB?QqH87vbN@>%!p{PU7E$ zd(JmwtMnn(Pc(8Lql;8pDB0b zYuTh7KRFD?;e_WyC`Lv#z}IPbjr23~`Z-TWNIEwPc`Zd_ahfb>a^rTv-r15qQAP{d z?uV{PpM~g$G_=@pjR)v7x%a(Q}U-Ay1qoU!Ip&GV`x67`0NSOpr6= zOgekKgzgbE@{_zDJ@G0WAfbVDmr@Te(dNiBk`9j8mOURs+vTIkceo`@g*Iu~gQ9`{ zNA{%M6Lw!i*X7nWbSW!Gl4}|@cpQo^3(b^ELTHMu8TJj#^Encof0XhTI%TZTuGNkC zMo|+!J%g1cLwlCr27FaJR1H@V`xu?0CdyG|!WCR&G(CFj>XAIxwyYmh$tk4KxVlvQo8+-5B_ci2g&rXBtYwJ{gFQ1m$yx{o-iQi?;$sko=y`U&bTYthw= z&k?%~JN=Bk7P30w6{{R%38`Z$?=QskoLJ`UpOTHz=z#U|Ss!!?na}xl$kQJRzHUzq z9X5&k2&&)ER~7OWt~o1pwh5=Imdf)czp4cj&SO>c`z_-ll!=>c+ceDSsaJVwVOx3D z;#B;%@ZC%FI^?drnW2j;i~aBdTgTX(BfGzHnulM(Y8v(noz?kdf$El9EiDp!Dc{tQ zC=a!W%dz>ljaQD@`8yvZ#3TtD$Y|mf@6i{w~QbwpmIb;K=OAjFjzjP$Cw zj^cG(n}r9P7UdT9K(OW`R$w^PU zHdk)Z-4e7FHpP8;UCqc(C6hIQYI5x_@Eq~^spRord!WqX1M0}wva-x6;d2?A%8mDP zd|lQq-%3HE*O)r1<|04#L1~mJ{BH75C8%bMVkAT_w2)qRFY+rzX`AQsjsc4 zyM$7c{Q?j1uKIHMKa!eN0sVKxKdK37_?)l)Lm(?^6+CGQQ&n0gdy6 Date: Sat, 14 Feb 2015 16:33:05 +0100 Subject: [PATCH 33/63] Fix typo --- htdocs/core/db/mssql.class.php | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 55f5dbe1458..e2d938da710 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2007 Regis Houssin * Copyright (C) 2007 Simon Desee + * Copyright (C) 2015 Cedric GROSS * * 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 @@ -89,7 +90,6 @@ class DoliDBMssql extends DoliDB // (La base Dolibarr a ete forcee en this->forcecharset a l'install) $this->connected = 1; $this->ok = 1; - } else { @@ -180,10 +180,7 @@ class DoliDBMssql extends DoliDB "SET QUOTED_IDENTIFIER ON;" ); mssql_query(implode(' ',$set_options),$this->db); - - - - + return $this->db; } @@ -455,7 +452,7 @@ class DoliDBMssql extends DoliDB $this->lastquery=$query; $this->_results = $ret; } - + return $ret; } @@ -731,17 +728,10 @@ class DoliDBMssql extends DoliDB if (empty($collation)) $collation=$this->forcecollate; */ -<<<<<<< Updated upstream - // ALTER DATABASE dolibarr_db DEFAULT CHARACTER SET latin DEFAULT COLLATE latin1_swedish_ci - $sql = 'CREATE DATABASE '.$database; - $sql.= ' DEFAULT CHARACTER SET '.$charset.' DEFAULT COLLATE '.$collation; -======= $sql = 'CREATE DATABASE '.$this->EscapeFieldName($database); //TODO: Check if we need to force a charset //$sql.= ' DEFAULT CHARACTER SET '.$charset.' DEFAULT COLLATE '.$collation; ->>>>>>> Stashed changes $ret=$this->query($sql); - $this->select_db($database); $sql="CREATE USER [$owner] FOR LOGIN [$owner]"; @@ -749,14 +739,12 @@ class DoliDBMssql extends DoliDB $sql="ALTER ROLE [db_owner] ADD MEMBER [$owner]"; mssql_query($sql,$this->db); - //For version >=2008 $sql="ALTER DATABASE [$database] SET ANSI_NULL_DEFAULT ON;"; @mssql_query($sql,$this->db); $sql="ALTER DATABASE [$database] SET ANSI_NULL ON;"; @mssql_query($sql,$this->db); - - - return $ret; + + return $ret; } /** From d1f73499e90e1a01d796ec9c9f12e02bddcf328e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 15 Feb 2015 15:01:28 +0100 Subject: [PATCH 34/63] Refactored dashboard indicator --- htdocs/adherents/class/adherent.class.php | 26 ++- htdocs/comm/action/class/actioncomm.class.php | 30 ++-- htdocs/comm/mailing/card.php | 4 +- htdocs/comm/propal/class/propal.class.php | 39 +++-- htdocs/commande/class/commande.class.php | 29 ++-- htdocs/compta/bank/class/account.class.php | 28 +-- htdocs/compta/facture/class/facture.class.php | 29 ++-- .../cheque/class/remisecheque.class.php | 27 ++- htdocs/contrat/class/contrat.class.php | 40 +++-- htdocs/core/class/BoardResponse.class.php | 69 ++++++++ .../class/fournisseur.commande.class.php | 24 ++- .../fourn/class/fournisseur.facture.class.php | 24 ++- htdocs/index.php | 161 ++++-------------- 13 files changed, 296 insertions(+), 234 deletions(-) create mode 100644 htdocs/core/class/BoardResponse.class.php diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 98d971acbd0..1f8ae82dcbd 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1725,17 +1725,15 @@ class Adherent extends CommonObject * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return int <0 if KO, >0 if OK + * @return BoardResponse|int <0 if KO, BoardResponse if OK */ function load_board($user) { - global $conf; - - $now=dol_now(); + global $conf, $langs; if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe - $this->nbtodo=$this->nbtodolate=0; + $now=dol_now(); $sql = "SELECT a.rowid, a.datefin"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a"; @@ -1746,12 +1744,24 @@ class Adherent extends CommonObject $resql=$this->db->query($sql); if ($resql) { + $langs->load("members"); + + $response = new BoardResponse(); + $response->warning_delay=$conf->adherent->cotisation->warning_delay/60/60/24; + $response->label=$langs->trans("MembersWithSubscriptionToReceive"); + $response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1'; + $response->img=img_object($langs->trans("Members"),"user"); + while ($obj=$this->db->fetch_object($resql)) { - $this->nbtodo++; - if ($this->db->jdate($obj->datefin) < ($now - $conf->adherent->cotisation->warning_delay)) $this->nbtodolate++; + $response->nbtodo++; + + if ($this->db->jdate($obj->datefin) < ($now - $conf->adherent->cotisation->warning_delay)) { + $response->nbtodolate++; + } } - return 1; + + return $response; } else { diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index b20a3afa3ea..d13f32f157c 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -712,18 +712,14 @@ class ActionComm extends CommonObject } /** - * Load indicators for dashboard (this->nbtodo and this->nbtodolate) + * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * - * @param User $user Objet user - * @return int <0 if KO, >0 if OK + * @param User $user Objet user + * @return BoardResponse|int <0 if KO, BoardResponse if OK */ function load_board($user) { - global $conf, $user; - - $now=dol_now(); - - $this->nbtodo=$this->nbtodolate=0; + global $conf, $user, $langs; $sql = "SELECT a.id, a.datep as dp"; $sql.= " FROM (".MAIN_DB_PREFIX."actioncomm as a"; @@ -739,13 +735,25 @@ class ActionComm extends CommonObject $resql=$this->db->query($sql); if ($resql) { + $now = dol_now(); + + $response = new BoardResponse(); + $response->warning_delay = $conf->actions->warning_delay/60/60/24; + $response->label = $langs->trans("ActionsToDo"); + $response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&mainmenu=agenda'; + $response->img = img_object($langs->trans("Actions"),"action"); + // This assignment in condition is not a bug. It allows walking the results. while ($obj=$this->db->fetch_object($resql)) { - $this->nbtodo++; - if (isset($obj->dp) && $this->db->jdate($obj->dp) < ($now - $conf->actions->warning_delay)) $this->nbtodolate++; + $response->nbtodo++; + + if (isset($obj->dp) && $this->db->jdate($obj->dp) < ($now - $conf->actions->warning_delay)) { + $response->nbtodolate++; + } } - return 1; + + return $response; } else { diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 267fde415f6..1a574fa434a 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -140,9 +140,7 @@ if (empty($reshook)) { if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) { - //TODO: What is this for? - // Pour des raisons de securite, on ne permet pas cette fonction via l'IHM, - // on affiche donc juste un message + // As security measure, we don't allow send from the GUI setEventMessage($langs->trans("MailingNeedCommand"), 'warnings'); setEventMessage('', 'warnings'); setEventMessage($langs->trans("MailingNeedCommand2"), 'warnings'); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 8fae698ba94..2c20e5ea1c7 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -116,10 +116,6 @@ class Propal extends CommonObject var $labelstatut=array(); var $labelstatut_short=array(); - // Pour board - var $nbtodo; - var $nbtodolate; - var $specimen; @@ -2349,15 +2345,12 @@ class Propal extends CommonObject * * @param User $user Object user * @param int $mode "opened" for proposal to close, "signed" for proposal to invoice - * @return int <0 if KO, >0 if OK + * @return BoardResponse|int <0 if KO, BoardResponse if OK */ function load_board($user,$mode) { - global $conf, $user; + global $conf, $user, $langs; - $now=dol_now(); - - $this->nbtodo=$this->nbtodolate=0; $clause = " WHERE"; $sql = "SELECT p.rowid, p.ref, p.datec as datec, p.fin_validite as datefin"; @@ -2376,25 +2369,43 @@ class Propal extends CommonObject $resql=$this->db->query($sql); if ($resql) { - if ($mode == 'opened') $delay_warning=$conf->propal->cloture->warning_delay; - if ($mode == 'signed') $delay_warning=$conf->propal->facturation->warning_delay; + $langs->load("propal"); + $now=dol_now(); + + if ($mode == 'opened') { + $delay_warning=$conf->propal->cloture->warning_delay; + $statut = 1; + $label = $langs->trans("PropalsToClose"); + } + if ($mode == 'signed') { + $delay_warning=$conf->propal->facturation->warning_delay; + $statut = 2; + $label = $langs->trans("PropalsToBill"); + } + + $response = new BoardResponse(); + $response->warning_delay = $delay_warning; + $response->label = $label; + $response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut; + $response->img = img_object($langs->trans("Propals"),"propal"); // This assignment in condition is not a bug. It allows walking the results. while ($obj=$this->db->fetch_object($resql)) { - $this->nbtodo++; + $response->nbtodo++; if ($mode == 'opened') { $datelimit = $this->db->jdate($obj->datefin); if ($datelimit < ($now - $delay_warning)) { - $this->nbtodolate++; + $response->nbtodolate++; } } // TODO Definir regle des propales a facturer en retard // if ($mode == 'signed' && ! count($this->FactureListeArray($obj->rowid))) $this->nbtodolate++; } - return 1; + + return $response; } else { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 27c320b3326..511af75a967 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -106,10 +106,6 @@ class Commande extends CommonOrder var $lines = array(); - // Pour board - var $nbtodo; - var $nbtodolate; - /** * Constructor @@ -2729,15 +2725,12 @@ class Commande extends CommonOrder * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user - * @return int <0 if KO, >0 if OK + * @return BoardResponse|int <0 if KO, BoardResponse if OK */ function load_board($user) { - global $conf, $user; + global $conf, $user, $langs; - $now=dol_now(); - - $this->nbtodo=$this->nbtodolate=0; $clause = " WHERE"; $sql = "SELECT c.rowid, c.date_creation as datec, c.date_livraison as delivery_date, c.fk_statut"; @@ -2756,14 +2749,26 @@ class Commande extends CommonOrder $resql=$this->db->query($sql); if ($resql) { + $now=dol_now(); + + $response = new BoardResponse(); + $response->warning_delay=$conf->commande->client->warning_delay/60/60/24; + $response->label=$langs->trans("OrdersToProcess"); + $response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3'; + $response->img=img_object($langs->trans("Orders"),"order"); + while ($obj=$this->db->fetch_object($resql)) { - $this->nbtodo++; + $response->nbtodo++; $date_to_test = empty($obj->delivery_date) ? $obj->datec : $obj->delivery_date; - if ($obj->fk_statut != 3 && $this->db->jdate($date_to_test) < ($now - $conf->commande->client->warning_delay)) $this->nbtodolate++; + + if ($obj->fk_statut != 3 && $this->db->jdate($date_to_test) < ($now - $conf->commande->client->warning_delay)) { + $response->nbtodolate++; + } } - return 1; + + return $response; } else { diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 598ccc2c8d8..c2929fb33a4 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -881,18 +881,14 @@ class Account extends CommonObject * * @param User $user Objet user * @param int $filteraccountid To get info for a particular account id - * @return int <0 if KO, 0=Nothing to show, >0 if OK + * @return BoardResponse|int <0 if KO, BoardResponse if OK */ function load_board($user,$filteraccountid=0) { - global $conf; + global $conf, $langs; if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe - $now=dol_now(); - - $this->nbtodo=$this->nbtodolate=0; - $sql = "SELECT b.rowid, b.datev as datefin"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b,"; $sql.= " ".MAIN_DB_PREFIX."bank_account as ba"; @@ -902,17 +898,27 @@ class Account extends CommonObject $sql.= " AND (ba.rappro = 1 AND ba.courant != 2)"; // Compte rapprochable if ($filteraccountid) $sql.=" AND ba.rowid = ".$filteraccountid; - //print $sql; $resql=$this->db->query($sql); if ($resql) { - $num=$this->db->num_rows($resql); + $langs->load("banks"); + $now=dol_now(); + + $response = new BoardResponse(); + $response->warning_delay=$conf->bank->rappro->warning_delay/60/60/24; + $response->label=$langs->trans("TransactionsToConciliate"); + $response->url=DOL_URL_ROOT.'/compta/bank/index.php?leftmenu=bank&mainmenu=bank'; + $response->img=img_object($langs->trans("TransactionsToConciliate"),"payment"); + while ($obj=$this->db->fetch_object($resql)) { - $this->nbtodo++; - if ($this->db->jdate($obj->datefin) < ($now - $conf->bank->rappro->warning_delay)) $this->nbtodolate++; + $response->nbtodo++; + if ($this->db->jdate($obj->datefin) < ($now - $conf->bank->rappro->warning_delay)) { + $response->nbtodolate++; + } } - return $num; + + return $response; } else { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 5c645783cc1..3bbf76c79fe 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -117,9 +117,6 @@ class Facture extends CommonInvoice var $lines=array(); var $line; var $extraparams=array(); - //! Pour board - var $nbtodo; - var $nbtodolate; var $specimen; var $fac_rec; @@ -3088,15 +3085,12 @@ class Facture extends CommonInvoice * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user - * @return int <0 if KO, >0 if OK + * @return BoardResponse|int <0 if KO, BoardResponse if OK */ function load_board($user) { - global $conf, $user; + global $conf, $user, $langs; - $now=dol_now(); - - $this->nbtodo=$this->nbtodolate=0; $clause = " WHERE"; $sql = "SELECT f.rowid, f.date_lim_reglement as datefin"; @@ -3115,12 +3109,25 @@ class Facture extends CommonInvoice $resql=$this->db->query($sql); if ($resql) { + $langs->load("bills"); + $now=dol_now(); + + $response = new BoardResponse(); + $response->warning_delay=$conf->facture->client->warning_delay/60/60/24; + $response->label=$langs->trans("CustomerBillsUnpaid"); + $response->url=DOL_URL_ROOT.'/compta/facture/impayees.php'; + $response->img=img_object($langs->trans("Bills"),"bill"); + while ($obj=$this->db->fetch_object($resql)) { - $this->nbtodo++; - if ($this->db->jdate($obj->datefin) < ($now - $conf->facture->client->warning_delay)) $this->nbtodolate++; + $response->nbtodo++; + + if ($this->db->jdate($obj->datefin) < ($now - $conf->facture->client->warning_delay)) { + $response->nbtodolate++; + } } - return 1; + + return $response; } else { diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 11a61874e7e..6bb1429d0a0 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -432,18 +432,14 @@ class RemiseCheque extends CommonObject * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return int <0 if KO, >0 if OK + * @return BoardResponse|int <0 if KO, BoardResponse if OK */ function load_board($user) { - global $conf; + global $conf, $langs; if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe - $now=dol_now(); - - $this->nbtodo=$this->nbtodolate=0; - $sql = "SELECT b.rowid, b.datev as datefin"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; @@ -456,12 +452,25 @@ class RemiseCheque extends CommonObject $resql=$this->db->query($sql); if ($resql) { + $langs->load("banks"); + $now=dol_now(); + + $response = new BoardResponse(); + $response->warning_delay=$conf->bank->cheque->warning_delay/60/60/24; + $response->label=$langs->trans("BankChecksToReceipt"); + $response->url=DOL_URL_ROOT.'/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=accountancy'; + $response->img=img_object($langs->trans("BankChecksToReceipt"),"payment"); + while ($obj=$this->db->fetch_object($resql)) { - $this->nbtodo++; - if ($this->db->jdate($obj->datefin) < ($now - $conf->bank->cheque->warning_delay)) $this->nbtodolate++; + $response->nbtodo++; + + if ($this->db->jdate($obj->datefin) < ($now - $conf->bank->cheque->warning_delay)) { + $response->nbtodolate++; + } } - return 1; + + return $response; } else { diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index bbecab53a30..19001edf92c 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1881,15 +1881,11 @@ class Contrat extends CommonObject * * @param User $user Objet user * @param string $mode "inactive" pour services a activer, "expired" pour services expires - * @return int <0 if KO, >0 if OK + * @return BoardResponse|int <0 if KO, BoardResponse if OK */ function load_board($user,$mode) { - global $conf, $user; - - $now=dol_now(); - - $this->nbtodo=$this->nbtodolate=0; + global $conf, $user, $langs; $this->from = " FROM ".MAIN_DB_PREFIX."contrat as c"; $this->from.= ", ".MAIN_DB_PREFIX."contratdet as cd"; @@ -1920,15 +1916,35 @@ class Contrat extends CommonObject $resql=$this->db->query($sql); if ($resql) { + $langs->load("contracts"); + $now=dol_now(); + + if ($mode == 'inactives') { + $warning_delay = $conf->contrat->services->inactifs->warning_delay; + $label = $langs->trans("BoardNotActivatedServices"); + $url = DOL_URL_ROOT.'/contrat/services.php?mainmenu=commercial&leftmenu=contracts&mode=0'; + } else { + $warning_delay = $conf->contrat->services->expires->warning_delay; + $url = DOL_URL_ROOT.'/contrat/services.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired'; + $label = $langs->trans("BoardRunningServices"); + } + + $response = new BoardResponse(); + $response->warning_delay = $warning_delay/60/60/24; + $response->label = $label; + $response->url = $url; + $response->img = img_object($langs->trans("Contract"),"contract"); + while ($obj=$this->db->fetch_object($resql)) { - $this->nbtodo++; - if ($mode == 'inactives') - if ($obj->datefin && $this->db->jdate($obj->datefin) < ($now - $conf->contrat->services->inactifs->warning_delay)) $this->nbtodolate++; - if ($mode == 'expired') - if ($obj->datefin && $this->db->jdate($obj->datefin) < ($now - $conf->contrat->services->expires->warning_delay)) $this->nbtodolate++; + $response->nbtodo++; + + if ($obj->datefin && $this->db->jdate($obj->datefin) < ($now - $warning_delay)) { + $response->nbtodolate++; + } } - return 1; + + return $response; } else { diff --git a/htdocs/core/class/BoardResponse.class.php b/htdocs/core/class/BoardResponse.class.php new file mode 100644 index 00000000000..9cf12e7a702 --- /dev/null +++ b/htdocs/core/class/BoardResponse.class.php @@ -0,0 +1,69 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/class/BoardResponse.class.php + * \brief Class that represents response of load_board functions + */ + +class BoardResponse +{ + + /** + * Image URL to represent the board item + * @var string + */ + public $img; + + /** + * Label of the warning + * @var string + */ + public $label; + + /** + * URL to list to do items + * @var string + */ + public $url; + + /** + * Delay time to mark an item as late + * @var int + */ + public $warning_delay; + + /** + * (optional) If set, to do late items will link to this url + * @var string + */ + public $lateurl; + + /** + * Number of items to do + * @var int + */ + public $nbtodo = 0; + + /** + * Number of to do items which are late + * @var int + */ + public $nbtodolate = 0; + +} \ No newline at end of file diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 64131be840b..c5765772c3b 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2000,15 +2000,12 @@ class CommandeFournisseur extends CommonOrder * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return int <0 if KO, >0 if OK + * @return BoardResponse|int <0 if KO, BoardResponse if OK */ function load_board($user) { - global $conf, $user; + global $conf, $user, $langs; - $now=dol_now(); - - $this->nbtodo=$this->nbtodolate=0; $clause = " WHERE"; $sql = "SELECT c.rowid, c.date_creation as datec, c.fk_statut,c.date_livraison as delivery_date"; @@ -2026,14 +2023,25 @@ class CommandeFournisseur extends CommonOrder $resql=$this->db->query($sql); if ($resql) { + $now=dol_now(); + + $response = new BoardResponse(); + $response->warning_delay=$conf->commande->fournisseur->warning_delay/60/60/24; + $response->label=$langs->trans("SuppliersOrdersToProcess"); + $response->url=DOL_URL_ROOT.'/fourn/commande/index.php'; + $response->img=img_object($langs->trans("Orders"),"order"); + while ($obj=$this->db->fetch_object($resql)) { - $this->nbtodo++; + $response->nbtodo++; $date_to_test = empty($obj->delivery_date) ? $obj->datec : $obj->delivery_date; - if ($obj->fk_statut != 3 && $this->db->jdate($date_to_test) < ($now - $conf->commande->fournisseur->warning_delay)) $this->nbtodolate++; + if ($obj->fk_statut != 3 && $this->db->jdate($date_to_test) < ($now - $conf->commande->fournisseur->warning_delay)) { + $response->nbtodolate++; + } } - return 1; + + return $response; } else { diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 71e5c320dfa..3b029eff79c 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1421,15 +1421,12 @@ class FactureFournisseur extends CommonInvoice * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user - * @return int <0 if KO, >0 if OK + * @return BoardResponse|int <0 if KO, BoardResponse if OK */ function load_board($user) { - global $conf, $user; + global $conf, $user, $langs; - $now=dol_now(); - - $this->nbtodo=$this->nbtodolate=0; $sql = 'SELECT ff.rowid, ff.date_lim_reglement as datefin'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as ff'; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -1442,13 +1439,24 @@ class FactureFournisseur extends CommonInvoice $resql=$this->db->query($sql); if ($resql) { + $langs->load("bills"); + $now=dol_now(); + + $response = new BoardResponse(); + $response->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24; + $response->label=$langs->trans("SupplierBillsToPay"); + $response->url=DOL_URL_ROOT.'/fourn/facture/list.php?filtre=paye:0'; + $response->img=img_object($langs->trans("Bills"),"bill"); + while ($obj=$this->db->fetch_object($resql)) { - $this->nbtodo++; - if (! empty($obj->datefin) && $this->db->jdate($obj->datefin) < ($now - $conf->facture->fournisseur->warning_delay)) $this->nbtodolate++; + $response->nbtodo++; + if (! empty($obj->datefin) && $this->db->jdate($obj->datefin) < ($now - $conf->facture->fournisseur->warning_delay)) { + $response->nbtodolate++; + } } $this->db->free($resql); - return 1; + return $response; } else { diff --git a/htdocs/index.php b/htdocs/index.php index 55252f6533f..9439e14995d 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -291,7 +291,8 @@ print '
'; * Dolibarr Working Board with weather */ $showweather=empty($conf->global->MAIN_DISABLE_METEO)?1:0; -$rowspan=0; + +//Array that contains all BoardResponse classes to process them $dashboardlines=array(); print '
'.$objp->qty.''.$products_dispatched[$objp->fk_product].''.$products_dispatched[$objp->rowid].''.img_picto_common($langs->trans('AddDispatchBatchLine'),'treemenu/plustop2.gif','onClick="AddLineBatch('.$i.')"').' '; print $form->editfieldval("OutstandingBill",'OutstandingBill',$object->outstanding_limit,$object,$user->rights->societe->creer,'amount',($object->outstanding_limit != '' ? price($object->outstanding_limit) : '')); + // display amount and link to unpaid bill + $outstandigBills = $object->get_OutstandingBill(); + if ($outstandigBills != 0) + print " / ".price($outstandigBills).''; print '
".$langs->trans("CreateTableAndPrimaryKey",$name); - print "
\n".$langs->trans("Request").' '.$requestnb.' : '.$buffer; + print "
\n".$langs->trans("Request").' '.$requestnb.' : '.$buffer.'
Executed query : '.$db->lastquery; print "\n
'.$langs->trans("ErrorSQL")." ".$db->errno()." ".$db->error().'
'."\n"; @@ -309,18 +310,14 @@ print ''."\n"; // Do not include sections without management permission // +require DOL_DOCUMENT_ROOT.'/core/class/BoardResponse.class.php'; + // Number of actions to do (late) if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read) { include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; $board=new ActionComm($db); - $board->load_board($user); - $board->warning_delay=$conf->actions->warning_delay/60/60/24; - $board->label=$langs->trans("ActionsToDo"); - $board->url=DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&mainmenu=agenda'; - $board->img=img_object($langs->trans("Actions"),"action"); - $rowspan++; - $dashboardlines[]=$board; + $dashboardlines[] = $board->load_board($user); } // Number of customer orders a deal @@ -328,13 +325,8 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) { include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $board=new Commande($db); - $board->load_board($user); - $board->warning_delay=$conf->commande->client->warning_delay/60/60/24; - $board->label=$langs->trans("OrdersToProcess"); - $board->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3'; - $board->img=img_object($langs->trans("Orders"),"order"); - $rowspan++; - $dashboardlines[]=$board; + + $dashboardlines[] = $board->load_board($user); } // Number of suppliers orders a deal @@ -342,172 +334,89 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; $board=new CommandeFournisseur($db); - $board->load_board($user); - $board->warning_delay=$conf->commande->fournisseur->warning_delay/60/60/24; - $board->label=$langs->trans("SuppliersOrdersToProcess"); - $board->url=DOL_URL_ROOT.'/fourn/commande/index.php'; - $board->img=img_object($langs->trans("Orders"),"order"); - $rowspan++; - $dashboardlines[]=$board; + + $dashboardlines[] = $board->load_board($user); } // Number of commercial proposals opened (expired) if (! empty($conf->propal->enabled) && $user->rights->propale->lire) { - $langs->load("propal"); - include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $board=new Propal($db); - $board->load_board($user,"opened"); - $board->warning_delay=$conf->propal->cloture->warning_delay/60/60/24; - $board->label=$langs->trans("PropalsToClose"); - $board->url=DOL_URL_ROOT.'/comm/propal/list.php?viewstatut=1'; - $board->img=img_object($langs->trans("Propals"),"propal"); - $rowspan++; - $dashboardlines[]=$board; -} + $dashboardlines[] = $board->load_board($user,"opened"); -// Number of commercial proposals CLOSED signed (billed) -if (! empty($conf->propal->enabled) && $user->rights->propale->lire) -{ - $langs->load("propal"); - - include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; - $board=new Propal($db); - $board->load_board($user,"signed"); - $board->warning_delay=$conf->propal->facturation->warning_delay/60/60/24; - $board->label=$langs->trans("PropalsToBill"); - $board->url=DOL_URL_ROOT.'/comm/propal/list.php?viewstatut=2'; - $board->img=img_object($langs->trans("Propals"),"propal"); - $rowspan++; - $dashboardlines[]=$board; + // Number of commercial proposals CLOSED signed (billed) + $dashboardlines[] = $board->load_board($user,"signed"); } // Number of services enabled (delayed) if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) { - $langs->load("contracts"); - include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; $board=new Contrat($db); - $board->load_board($user,"inactives"); - $board->warning_delay=$conf->contrat->services->inactifs->warning_delay/60/60/24; - $board->label=$langs->trans("BoardNotActivatedServices"); - $board->url=DOL_URL_ROOT.'/contrat/services.php?mainmenu=commercial&leftmenu=contracts&mode=0'; - $board->img=img_object($langs->trans("Contract"),"contract"); - $rowspan++; - $dashboardlines[]=$board; -} + $dashboardlines[] = $board->load_board($user,"inactives"); -// Number of active services (expired) -if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) -{ - $langs->load("contracts"); - - include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; - $board=new Contrat($db); - $board->load_board($user,"expired"); - $board->warning_delay=$conf->contrat->services->expires->warning_delay/60/60/24; - $board->label=$langs->trans("BoardRunningServices"); - $board->url=DOL_URL_ROOT.'/contrat/services.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired'; - $board->img=img_object($langs->trans("Contract"),"contract"); - $rowspan++; - $dashboardlines[]=$board; + // Number of active services (expired) + $dashboardlines[] = $board->load_board($user,"expired"); } // Number of invoices customers (has paid) if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { - $langs->load("bills"); - include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $board=new Facture($db); - $board->load_board($user); - $board->warning_delay=$conf->facture->client->warning_delay/60/60/24; - $board->label=$langs->trans("CustomerBillsUnpaid"); - $board->url=DOL_URL_ROOT.'/compta/facture/impayees.php'; - $board->img=img_object($langs->trans("Bills"),"bill"); - $rowspan++; - $dashboardlines[]=$board; + $dashboardlines[] = $board->load_board($user); } // Number of supplier invoices (has paid) if (! empty($conf->fournisseur->enabled) && ! empty($conf->facture->enabled) && $user->rights->facture->lire) { - $langs->load("bills"); - include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $board=new FactureFournisseur($db); - $board->load_board($user); - $board->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24; - $board->label=$langs->trans("SupplierBillsToPay"); - $board->url=DOL_URL_ROOT.'/fourn/facture/list.php?filtre=paye:0'; - $board->img=img_object($langs->trans("Bills"),"bill"); - $rowspan++; - $dashboardlines[]=$board; + $dashboardlines[] = $board->load_board($user); } // Number of transactions to conciliate if (! empty($conf->banque->enabled) && $user->rights->banque->lire && ! $user->societe_id) { - $langs->load("banks"); - include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $board=new Account($db); - $found=$board->load_board($user); - if ($found > 0) - { - $board->warning_delay=$conf->bank->rappro->warning_delay/60/60/24; - $board->label=$langs->trans("TransactionsToConciliate"); - $board->url=DOL_URL_ROOT.'/compta/bank/index.php?leftmenu=bank&mainmenu=bank'; - $board->img=img_object($langs->trans("TransactionsToConciliate"),"payment"); - $rowspan++; - $dashboardlines[]=$board; - } + $dashboardlines[] = $board->load_board($user); } // Number of cheque to send if (! empty($conf->banque->enabled) && $user->rights->banque->lire && ! $user->societe_id) { - $langs->load("banks"); - include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; $board=new RemiseCheque($db); - $board->load_board($user); - $board->warning_delay=$conf->bank->cheque->warning_delay/60/60/24; - $board->label=$langs->trans("BankChecksToReceipt"); - $board->url=DOL_URL_ROOT.'/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=accountancy'; - $board->img=img_object($langs->trans("BankChecksToReceipt"),"payment"); - $rowspan++; - $dashboardlines[]=$board; + $dashboardlines[] = $board->load_board($user); } // Number of foundation members if (! empty($conf->adherent->enabled) && $user->rights->adherent->lire && ! $user->societe_id) { - $langs->load("members"); - include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $board=new Adherent($db); - $board->load_board($user); - $board->warning_delay=$conf->adherent->cotisation->warning_delay/60/60/24; - $board->label=$langs->trans("MembersWithSubscriptionToReceive"); - $board->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1'; - $board->img=img_object($langs->trans("Members"),"user"); - $rowspan++; - $dashboardlines[]=$board; + $dashboardlines[] = $board->load_board($user); } // Calculate total nb of late $totallate=0; -foreach($dashboardlines as $key => $board) -{ - if ($board->nbtodolate > 0) $totallate+=$board->nbtodolate; -} - -// Show dashboard $var=true; -foreach($dashboardlines as $key => $board) + +$valid_dashboardlines = array_filter($dashboardlines, function ($board) { + return $board instanceof BoardResponse; +}); + +$rowspan = count($valid_dashboardlines); + +foreach($valid_dashboardlines as $board) { + if ($board->nbtodolate > 0) { + $totallate += $board->nbtodolate; + } + + // Show dashboard + $var=!$var; print ''; print ''; @@ -531,8 +440,6 @@ foreach($dashboardlines as $key => $board) if ($rowspan <= 2) $options='height="24"'; // Weather logo is smaller if dashboard has few elements else if ($rowspan <= 3) $options='height="48"'; // Weather logo is smaller if dashboard has few elements print showWeather($totallate,$text,$options); - //print showWeather(0,''); - //print showWeather(40,$text); print ''; $showweather=0; } From bab0163c44ce34516f1c828d8064ad43e3ecf88f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 15 Feb 2015 15:07:24 +0100 Subject: [PATCH 35/63] Missing Copyright info --- htdocs/adherents/class/adherent.class.php | 1 + htdocs/comm/action/class/actioncomm.class.php | 1 + htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/commande/class/commande.class.php | 2 +- htdocs/compta/bank/class/account.class.php | 1 + htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/compta/paiement/cheque/class/remisecheque.class.php | 1 + htdocs/contrat/class/contrat.class.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- htdocs/index.php | 1 + 11 files changed, 11 insertions(+), 6 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 1f8ae82dcbd..890458b9a30 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2014 Alexandre Spangaro + * Copyright (C) 2015 Marcos García * * 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 diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index d13f32f157c..c0628635374 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2015 Marcos García * * 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 diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 2c20e5ea1c7..cc24bcb219a 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -10,7 +10,7 @@ * Copyright (C) 2010-2011 Philippe Grand * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2013 Florian Henry - * Copyright (C) 2014 Marcos García + * Copyright (C) 2014-2015 Marcos García * * 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 diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 511af75a967..0b5df167931 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2011 Jean Heimburger * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2013 Florian Henry - * Copyright (C) 2014 Marcos García + * Copyright (C) 2014-2015 Marcos García * * 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 diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index c2929fb33a4..d2d9db7b378 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005-2010 Regis Houssin * Copytight (C) 2013 Florian Henry + * Copyright (C) 2015 Marcos García * * 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 diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 3bbf76c79fe..fe7d48ee6b4 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2012-2014 Christophe Battarel - * Copyright (C) 2012-2014 Marcos García + * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2013 Cedric Gross diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 6bb1429d0a0..66083d3a84d 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2007-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2015 Marcos García * * 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 diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 19001edf92c..14f406017ae 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013 Florian Henry - * Copyright (C) 2014 Marcos García + * Copyright (C) 2014-2015 Marcos García * * 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 diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index c5765772c3b..bebce59806a 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2010-2014 Philippe Grand - * Copyright (C) 2012-2014 Marcos García + * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador * diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 3b029eff79c..b9d77903b60 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Philippe Grand * Copyright (C) 2013 Florian Henry - * Copyright (C) 2014 Marcos García + * Copyright (C) 2014-2015 Marcos García * * 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 diff --git a/htdocs/index.php b/htdocs/index.php index 9439e14995d..f79413e51ab 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2015 Marcos García * * 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 From d5fd20e9119f148d82a8c67bd9f4f94e5a1182ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 15 Feb 2015 15:10:51 +0100 Subject: [PATCH 36/63] Renamed BoardResponse to WorkBoardResponse --- htdocs/adherents/class/adherent.class.php | 4 ++-- htdocs/comm/action/class/actioncomm.class.php | 4 ++-- htdocs/comm/propal/class/propal.class.php | 4 ++-- htdocs/commande/class/commande.class.php | 4 ++-- htdocs/compta/bank/class/account.class.php | 4 ++-- htdocs/compta/facture/class/facture.class.php | 4 ++-- .../compta/paiement/cheque/class/remisecheque.class.php | 4 ++-- htdocs/contrat/class/contrat.class.php | 4 ++-- ...oardResponse.class.php => WorkBoardResponse.class.php} | 4 ++-- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- htdocs/fourn/class/fournisseur.facture.class.php | 4 ++-- htdocs/index.php | 8 +++++--- 12 files changed, 27 insertions(+), 25 deletions(-) rename htdocs/core/class/{BoardResponse.class.php => WorkBoardResponse.class.php} (94%) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 890458b9a30..b275369be4e 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1726,7 +1726,7 @@ class Adherent extends CommonObject * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return BoardResponse|int <0 if KO, BoardResponse if OK + * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK */ function load_board($user) { @@ -1747,7 +1747,7 @@ class Adherent extends CommonObject { $langs->load("members"); - $response = new BoardResponse(); + $response = new WorkBoardResponse(); $response->warning_delay=$conf->adherent->cotisation->warning_delay/60/60/24; $response->label=$langs->trans("MembersWithSubscriptionToReceive"); $response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1'; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index c0628635374..e49b67604d5 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -716,7 +716,7 @@ class ActionComm extends CommonObject * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return BoardResponse|int <0 if KO, BoardResponse if OK + * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK */ function load_board($user) { @@ -738,7 +738,7 @@ class ActionComm extends CommonObject { $now = dol_now(); - $response = new BoardResponse(); + $response = new WorkBoardResponse(); $response->warning_delay = $conf->actions->warning_delay/60/60/24; $response->label = $langs->trans("ActionsToDo"); $response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&mainmenu=agenda'; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index cc24bcb219a..80cfb5b3266 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2345,7 +2345,7 @@ class Propal extends CommonObject * * @param User $user Object user * @param int $mode "opened" for proposal to close, "signed" for proposal to invoice - * @return BoardResponse|int <0 if KO, BoardResponse if OK + * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK */ function load_board($user,$mode) { @@ -2383,7 +2383,7 @@ class Propal extends CommonObject $label = $langs->trans("PropalsToBill"); } - $response = new BoardResponse(); + $response = new WorkBoardResponse(); $response->warning_delay = $delay_warning; $response->label = $label; $response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 0b5df167931..19fd5c98a2b 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2725,7 +2725,7 @@ class Commande extends CommonOrder * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user - * @return BoardResponse|int <0 if KO, BoardResponse if OK + * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK */ function load_board($user) { @@ -2751,7 +2751,7 @@ class Commande extends CommonOrder { $now=dol_now(); - $response = new BoardResponse(); + $response = new WorkBoardResponse(); $response->warning_delay=$conf->commande->client->warning_delay/60/60/24; $response->label=$langs->trans("OrdersToProcess"); $response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3'; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index d2d9db7b378..85a6ad24b85 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -882,7 +882,7 @@ class Account extends CommonObject * * @param User $user Objet user * @param int $filteraccountid To get info for a particular account id - * @return BoardResponse|int <0 if KO, BoardResponse if OK + * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK */ function load_board($user,$filteraccountid=0) { @@ -905,7 +905,7 @@ class Account extends CommonObject $langs->load("banks"); $now=dol_now(); - $response = new BoardResponse(); + $response = new WorkBoardResponse(); $response->warning_delay=$conf->bank->rappro->warning_delay/60/60/24; $response->label=$langs->trans("TransactionsToConciliate"); $response->url=DOL_URL_ROOT.'/compta/bank/index.php?leftmenu=bank&mainmenu=bank'; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index fe7d48ee6b4..71328871323 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3085,7 +3085,7 @@ class Facture extends CommonInvoice * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user - * @return BoardResponse|int <0 if KO, BoardResponse if OK + * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK */ function load_board($user) { @@ -3112,7 +3112,7 @@ class Facture extends CommonInvoice $langs->load("bills"); $now=dol_now(); - $response = new BoardResponse(); + $response = new WorkBoardResponse(); $response->warning_delay=$conf->facture->client->warning_delay/60/60/24; $response->label=$langs->trans("CustomerBillsUnpaid"); $response->url=DOL_URL_ROOT.'/compta/facture/impayees.php'; diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 66083d3a84d..88f9d573737 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -433,7 +433,7 @@ class RemiseCheque extends CommonObject * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return BoardResponse|int <0 if KO, BoardResponse if OK + * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK */ function load_board($user) { @@ -456,7 +456,7 @@ class RemiseCheque extends CommonObject $langs->load("banks"); $now=dol_now(); - $response = new BoardResponse(); + $response = new WorkBoardResponse(); $response->warning_delay=$conf->bank->cheque->warning_delay/60/60/24; $response->label=$langs->trans("BankChecksToReceipt"); $response->url=DOL_URL_ROOT.'/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=accountancy'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 14f406017ae..9a5afc0aea1 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1881,7 +1881,7 @@ class Contrat extends CommonObject * * @param User $user Objet user * @param string $mode "inactive" pour services a activer, "expired" pour services expires - * @return BoardResponse|int <0 if KO, BoardResponse if OK + * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK */ function load_board($user,$mode) { @@ -1929,7 +1929,7 @@ class Contrat extends CommonObject $label = $langs->trans("BoardRunningServices"); } - $response = new BoardResponse(); + $response = new WorkBoardResponse(); $response->warning_delay = $warning_delay/60/60/24; $response->label = $label; $response->url = $url; diff --git a/htdocs/core/class/BoardResponse.class.php b/htdocs/core/class/WorkBoardResponse.class.php similarity index 94% rename from htdocs/core/class/BoardResponse.class.php rename to htdocs/core/class/WorkBoardResponse.class.php index 9cf12e7a702..4cb0a1be0e7 100644 --- a/htdocs/core/class/BoardResponse.class.php +++ b/htdocs/core/class/WorkBoardResponse.class.php @@ -17,11 +17,11 @@ */ /** - * \file htdocs/core/class/BoardResponse.class.php + * \file htdocs/core/class/WorkBoardResponse.class.php * \brief Class that represents response of load_board functions */ -class BoardResponse +class WorkBoardResponse { /** diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index bebce59806a..300a1ad1260 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2000,7 +2000,7 @@ class CommandeFournisseur extends CommonOrder * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return BoardResponse|int <0 if KO, BoardResponse if OK + * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK */ function load_board($user) { @@ -2025,7 +2025,7 @@ class CommandeFournisseur extends CommonOrder { $now=dol_now(); - $response = new BoardResponse(); + $response = new WorkBoardResponse(); $response->warning_delay=$conf->commande->fournisseur->warning_delay/60/60/24; $response->label=$langs->trans("SuppliersOrdersToProcess"); $response->url=DOL_URL_ROOT.'/fourn/commande/index.php'; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index b9d77903b60..c8735362cca 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1421,7 +1421,7 @@ class FactureFournisseur extends CommonInvoice * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user - * @return BoardResponse|int <0 if KO, BoardResponse if OK + * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK */ function load_board($user) { @@ -1442,7 +1442,7 @@ class FactureFournisseur extends CommonInvoice $langs->load("bills"); $now=dol_now(); - $response = new BoardResponse(); + $response = new WorkBoardResponse(); $response->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24; $response->label=$langs->trans("SupplierBillsToPay"); $response->url=DOL_URL_ROOT.'/fourn/facture/list.php?filtre=paye:0'; diff --git a/htdocs/index.php b/htdocs/index.php index f79413e51ab..54cda381489 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -293,7 +293,7 @@ print '
'; */ $showweather=empty($conf->global->MAIN_DISABLE_METEO)?1:0; -//Array that contains all BoardResponse classes to process them +//Array that contains all WorkBoardResponse classes to process them $dashboardlines=array(); print '
'.$board->img.''.$board->label.''.$board->nbtodo.'
'."\n"; @@ -311,7 +311,7 @@ print ''."\n"; // Do not include sections without management permission // -require DOL_DOCUMENT_ROOT.'/core/class/BoardResponse.class.php'; +require DOL_DOCUMENT_ROOT.'/core/class/WorkBoardResponse.class.php'; // Number of actions to do (late) if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read) @@ -404,8 +404,10 @@ if (! empty($conf->adherent->enabled) && $user->rights->adherent->lire && ! $use $totallate=0; $var=true; +//Remove any invalid response +//load_board can return an integer if failed or WorkBoardResponse if OK $valid_dashboardlines = array_filter($dashboardlines, function ($board) { - return $board instanceof BoardResponse; + return $board instanceof WorkBoardResponse; }); $rowspan = count($valid_dashboardlines); From 8a7d4ea71d229dce3afaf82911ebb3f3cf49523a Mon Sep 17 00:00:00 2001 From: delcroix Patrick Date: Sun, 15 Feb 2015 17:01:47 +0100 Subject: [PATCH 37/63] export on user to be able to choose the user for reporting purpose (no column named Name in the user table) --- htdocs/core/modules/modProjet.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index 97ddc6afaba..4a534c937cc 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -194,7 +194,7 @@ class modProjet extends DolibarrModules 's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text', 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','p.description'=>"Text", 'pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Number",'pt.progress'=>"Number",'pt.description'=>"Text", - 'ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:Name",'ptt.note'=>"Text"); + 'ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text"); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company', 's.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company', From 05dc308e9156dcbb12e120c9fa573c9990f0a63e Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 16 Feb 2015 06:47:37 +0100 Subject: [PATCH 38/63] [T1728] Deactivate RIB suggest in proposals/invoices/orders --- ChangeLog | 1 + htdocs/core/lib/pdf.lib.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index d905ba24168..35720ebdabc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -106,6 +106,7 @@ For users: - Fix: [ bug #1535 ] Supplier invoice Extrafields are not shown - Fix: datepicker first day of week can be monday by setting into display setup - Fix: [ bug #575 ] GED doesn't works if there is "/" in a mask +- Fix: [ task #1728 ] Deactivate RIB suggest in proposals / invoices / orders For users, new experimental module (need to set feature level of instance to experimental to see them): - New: Module Accounting Expert to manage accountancy diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 794ba7ac2af..01ab5eeaf82 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -533,6 +533,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default $cury+=3; } + /* if (empty($onlynumber)) $pdf->line($curx+1, $cury+1, $curx+1, $cury+8); if ($usedetailedbban == 1) @@ -596,6 +597,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default $curx=$savcurx; $cury+=9; + */ } else { From 53dc28ddc399810853ca87d59aec8b77c55f45b7 Mon Sep 17 00:00:00 2001 From: damien clochard Date: Mon, 16 Feb 2015 11:01:08 +0100 Subject: [PATCH 39/63] There's only 2 sortable formats --- htdocs/langs/en_US/banks.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 10a5f5b3c14..c42503c0ecb 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -148,7 +148,7 @@ BackToAccount=Back to account ShowAllAccounts=Show for all accounts FutureTransaction=Transaction in futur. No way to conciliate. SelectChequeTransactionAndGenerate=Select/filter checks to include into the check deposit receipt and click on "Create". -InputReceiptNumber=Choose the bank statement related with the conciliation. Use a sortable numeric value (such as, YYYYMM) +InputReceiptNumber=Choose the bank statement related with the conciliation. Use a sortable numeric value: YYYYMM or YYYYMMDD EventualyAddCategory=Eventually, specify a category in which to classify the records ToConciliate=To conciliate? ThenCheckLinesAndConciliate=Then, check the lines present in the bank statement and click From c01281a538b300caa4d729ec094f8479190d1335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Mon, 16 Feb 2015 23:45:52 +0100 Subject: [PATCH 40/63] Renamed WorkBoardResponse::$late_url to WorkBoardResponse::$url_late --- htdocs/core/class/WorkBoardResponse.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/WorkBoardResponse.class.php b/htdocs/core/class/WorkBoardResponse.class.php index 4cb0a1be0e7..ae82c7e3a48 100644 --- a/htdocs/core/class/WorkBoardResponse.class.php +++ b/htdocs/core/class/WorkBoardResponse.class.php @@ -42,18 +42,18 @@ class WorkBoardResponse */ public $url; + /** + * (optional) If set, to do late items will link to this url + * @var string + */ + public $url_late; + /** * Delay time to mark an item as late * @var int */ public $warning_delay; - /** - * (optional) If set, to do late items will link to this url - * @var string - */ - public $lateurl; - /** * Number of items to do * @var int From fa55c60c35db0023e9763101445da545e0f7b35a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Mon, 16 Feb 2015 23:49:07 +0100 Subject: [PATCH 41/63] Renamed WorkBoardResponse to WorkboardResponse --- htdocs/adherents/class/adherent.class.php | 4 ++-- htdocs/comm/action/class/actioncomm.class.php | 4 ++-- htdocs/comm/propal/class/propal.class.php | 4 ++-- htdocs/commande/class/commande.class.php | 4 ++-- htdocs/compta/bank/class/account.class.php | 4 ++-- htdocs/compta/facture/class/facture.class.php | 4 ++-- .../compta/paiement/cheque/class/remisecheque.class.php | 4 ++-- htdocs/contrat/class/contrat.class.php | 4 ++-- ...oardResponse.class.php => WorkboardResponse.class.php} | 4 ++-- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- htdocs/fourn/class/fournisseur.facture.class.php | 4 ++-- htdocs/index.php | 8 ++++---- 12 files changed, 26 insertions(+), 26 deletions(-) rename htdocs/core/class/{WorkBoardResponse.class.php => WorkboardResponse.class.php} (94%) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index b275369be4e..9a385becff3 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1726,7 +1726,7 @@ class Adherent extends CommonObject * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ function load_board($user) { @@ -1747,7 +1747,7 @@ class Adherent extends CommonObject { $langs->load("members"); - $response = new WorkBoardResponse(); + $response = new WorkboardResponse(); $response->warning_delay=$conf->adherent->cotisation->warning_delay/60/60/24; $response->label=$langs->trans("MembersWithSubscriptionToReceive"); $response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1'; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index e49b67604d5..5cfe1dc7310 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -716,7 +716,7 @@ class ActionComm extends CommonObject * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ function load_board($user) { @@ -738,7 +738,7 @@ class ActionComm extends CommonObject { $now = dol_now(); - $response = new WorkBoardResponse(); + $response = new WorkboardResponse(); $response->warning_delay = $conf->actions->warning_delay/60/60/24; $response->label = $langs->trans("ActionsToDo"); $response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&mainmenu=agenda'; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 80cfb5b3266..edc6d7bfd94 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2345,7 +2345,7 @@ class Propal extends CommonObject * * @param User $user Object user * @param int $mode "opened" for proposal to close, "signed" for proposal to invoice - * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ function load_board($user,$mode) { @@ -2383,7 +2383,7 @@ class Propal extends CommonObject $label = $langs->trans("PropalsToBill"); } - $response = new WorkBoardResponse(); + $response = new WorkboardResponse(); $response->warning_delay = $delay_warning; $response->label = $label; $response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 19fd5c98a2b..d5c6b3f7715 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2725,7 +2725,7 @@ class Commande extends CommonOrder * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user - * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ function load_board($user) { @@ -2751,7 +2751,7 @@ class Commande extends CommonOrder { $now=dol_now(); - $response = new WorkBoardResponse(); + $response = new WorkboardResponse(); $response->warning_delay=$conf->commande->client->warning_delay/60/60/24; $response->label=$langs->trans("OrdersToProcess"); $response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3'; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 85a6ad24b85..a2d9aec8ad4 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -882,7 +882,7 @@ class Account extends CommonObject * * @param User $user Objet user * @param int $filteraccountid To get info for a particular account id - * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ function load_board($user,$filteraccountid=0) { @@ -905,7 +905,7 @@ class Account extends CommonObject $langs->load("banks"); $now=dol_now(); - $response = new WorkBoardResponse(); + $response = new WorkboardResponse(); $response->warning_delay=$conf->bank->rappro->warning_delay/60/60/24; $response->label=$langs->trans("TransactionsToConciliate"); $response->url=DOL_URL_ROOT.'/compta/bank/index.php?leftmenu=bank&mainmenu=bank'; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 71328871323..50a68b2c66a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3085,7 +3085,7 @@ class Facture extends CommonInvoice * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user - * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ function load_board($user) { @@ -3112,7 +3112,7 @@ class Facture extends CommonInvoice $langs->load("bills"); $now=dol_now(); - $response = new WorkBoardResponse(); + $response = new WorkboardResponse(); $response->warning_delay=$conf->facture->client->warning_delay/60/60/24; $response->label=$langs->trans("CustomerBillsUnpaid"); $response->url=DOL_URL_ROOT.'/compta/facture/impayees.php'; diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 88f9d573737..ddda11bb556 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -433,7 +433,7 @@ class RemiseCheque extends CommonObject * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ function load_board($user) { @@ -456,7 +456,7 @@ class RemiseCheque extends CommonObject $langs->load("banks"); $now=dol_now(); - $response = new WorkBoardResponse(); + $response = new WorkboardResponse(); $response->warning_delay=$conf->bank->cheque->warning_delay/60/60/24; $response->label=$langs->trans("BankChecksToReceipt"); $response->url=DOL_URL_ROOT.'/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=accountancy'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 9a5afc0aea1..3cd35db15b5 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1881,7 +1881,7 @@ class Contrat extends CommonObject * * @param User $user Objet user * @param string $mode "inactive" pour services a activer, "expired" pour services expires - * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ function load_board($user,$mode) { @@ -1929,7 +1929,7 @@ class Contrat extends CommonObject $label = $langs->trans("BoardRunningServices"); } - $response = new WorkBoardResponse(); + $response = new WorkboardResponse(); $response->warning_delay = $warning_delay/60/60/24; $response->label = $label; $response->url = $url; diff --git a/htdocs/core/class/WorkBoardResponse.class.php b/htdocs/core/class/WorkboardResponse.class.php similarity index 94% rename from htdocs/core/class/WorkBoardResponse.class.php rename to htdocs/core/class/WorkboardResponse.class.php index ae82c7e3a48..c36b50b421e 100644 --- a/htdocs/core/class/WorkBoardResponse.class.php +++ b/htdocs/core/class/WorkboardResponse.class.php @@ -17,11 +17,11 @@ */ /** - * \file htdocs/core/class/WorkBoardResponse.class.php + * \file htdocs/core/class/WorkboardResponse.class.php * \brief Class that represents response of load_board functions */ -class WorkBoardResponse +class WorkboardResponse { /** diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 300a1ad1260..4917ebd2779 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2000,7 +2000,7 @@ class CommandeFournisseur extends CommonOrder * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ function load_board($user) { @@ -2025,7 +2025,7 @@ class CommandeFournisseur extends CommonOrder { $now=dol_now(); - $response = new WorkBoardResponse(); + $response = new WorkboardResponse(); $response->warning_delay=$conf->commande->fournisseur->warning_delay/60/60/24; $response->label=$langs->trans("SuppliersOrdersToProcess"); $response->url=DOL_URL_ROOT.'/fourn/commande/index.php'; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index c8735362cca..d7252d188db 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1421,7 +1421,7 @@ class FactureFournisseur extends CommonInvoice * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user - * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ function load_board($user) { @@ -1442,7 +1442,7 @@ class FactureFournisseur extends CommonInvoice $langs->load("bills"); $now=dol_now(); - $response = new WorkBoardResponse(); + $response = new WorkboardResponse(); $response->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24; $response->label=$langs->trans("SupplierBillsToPay"); $response->url=DOL_URL_ROOT.'/fourn/facture/list.php?filtre=paye:0'; diff --git a/htdocs/index.php b/htdocs/index.php index 54cda381489..32b13c7a63f 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -293,7 +293,7 @@ print '
'; */ $showweather=empty($conf->global->MAIN_DISABLE_METEO)?1:0; -//Array that contains all WorkBoardResponse classes to process them +//Array that contains all WorkboardResponse classes to process them $dashboardlines=array(); print '
'."\n"; @@ -311,7 +311,7 @@ print ''."\n"; // Do not include sections without management permission // -require DOL_DOCUMENT_ROOT.'/core/class/WorkBoardResponse.class.php'; +require DOL_DOCUMENT_ROOT.'/core/class/WorkboardResponse.class.php'; // Number of actions to do (late) if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read) @@ -405,9 +405,9 @@ $totallate=0; $var=true; //Remove any invalid response -//load_board can return an integer if failed or WorkBoardResponse if OK +//load_board can return an integer if failed or WorkboardResponse if OK $valid_dashboardlines = array_filter($dashboardlines, function ($board) { - return $board instanceof WorkBoardResponse; + return $board instanceof WorkboardResponse; }); $rowspan = count($valid_dashboardlines); From 9d0ffb7e85d6e06d5ab861869b2a3e611e32784b Mon Sep 17 00:00:00 2001 From: frederic34 Date: Tue, 17 Feb 2015 10:23:31 +0100 Subject: [PATCH 42/63] Add php-iban and check IBAN --- htdocs/core/lib/bank.lib.php | 23 +++++++++++++++++++++++ htdocs/societe/rib.php | 10 +++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index e3fb787657b..77b92447d3f 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -123,6 +123,29 @@ function bank_admin_prepare_head($object) return $head; } +/** + * Check IBAN number informations for a bank account + * + * @param Account $account A bank account + * @return int True if informations are valid, false otherwise + */ +function checkIbanForAccount($account) +{ + require_once DOL_DOCUMENT_ROOT.'/includes/php-iban/oophp-iban.php'; + $iban = new Iban(); + $check = $iban->Verify($account->iban); + //print '
'.print_r($iban, true).'
'; + if ($check) { + //print '
OK
'; + return true; + } else { + //$suggest = $iban->MistranscriptionSuggestions($account->iban); + //print '
'.print_r($suggest, true).'
'; + return false; + } + +} + /** * Check account number informations for a bank account * diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index f57eb6a5b70..a615577a8c4 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -293,7 +293,15 @@ if ($socid && $action != 'edit' && $action != "create") } print '
'; - print ''; + print ''; print ''; print ''; From 07197f3ca08b5dad641ee21887c7fc4327abf573 Mon Sep 17 00:00:00 2001 From: frederic34 Date: Tue, 17 Feb 2015 10:24:37 +0100 Subject: [PATCH 43/63] Add libs --- htdocs/core/lib/bank.lib.php | 4 +- htdocs/includes/php-iban/LICENSE | 165 ++++++ .../includes/php-iban/docs/COMEDY-OF-ERRORS | 55 ++ ...d implementation guidelines SIG203V3.2.pdf | Bin 0 -> 229029 bytes htdocs/includes/php-iban/docs/HACKING | 63 +++ htdocs/includes/php-iban/docs/ISO13616.pdf | Bin 0 -> 141593 bytes htdocs/includes/php-iban/docs/LICENSE | 165 ++++++ htdocs/includes/php-iban/docs/README | 207 ++++++++ htdocs/includes/php-iban/docs/REGISTRY-URL | 17 + htdocs/includes/php-iban/docs/SEPA | 9 + htdocs/includes/php-iban/docs/TODO | 21 + .../includes/php-iban/mistranscriptions.txt | 49 ++ htdocs/includes/php-iban/oophp-iban.php | 157 ++++++ htdocs/includes/php-iban/php-iban.php | 486 ++++++++++++++++++ htdocs/includes/php-iban/registry.txt | 81 +++ 15 files changed, 1477 insertions(+), 2 deletions(-) create mode 100644 htdocs/includes/php-iban/LICENSE create mode 100644 htdocs/includes/php-iban/docs/COMEDY-OF-ERRORS create mode 100644 htdocs/includes/php-iban/docs/ECBS standard implementation guidelines SIG203V3.2.pdf create mode 100644 htdocs/includes/php-iban/docs/HACKING create mode 100644 htdocs/includes/php-iban/docs/ISO13616.pdf create mode 100644 htdocs/includes/php-iban/docs/LICENSE create mode 100644 htdocs/includes/php-iban/docs/README create mode 100644 htdocs/includes/php-iban/docs/REGISTRY-URL create mode 100644 htdocs/includes/php-iban/docs/SEPA create mode 100644 htdocs/includes/php-iban/docs/TODO create mode 100644 htdocs/includes/php-iban/mistranscriptions.txt create mode 100644 htdocs/includes/php-iban/oophp-iban.php create mode 100644 htdocs/includes/php-iban/php-iban.php create mode 100644 htdocs/includes/php-iban/registry.txt diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 77b92447d3f..36626ffcc94 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -132,8 +132,8 @@ function bank_admin_prepare_head($object) function checkIbanForAccount($account) { require_once DOL_DOCUMENT_ROOT.'/includes/php-iban/oophp-iban.php'; - $iban = new Iban(); - $check = $iban->Verify($account->iban); + $iban = new Iban($account->iban); + $check = $iban->Verify(); //print '
'.print_r($iban, true).'
'; if ($check) { //print '
OK
'; diff --git a/htdocs/includes/php-iban/LICENSE b/htdocs/includes/php-iban/LICENSE new file mode 100644 index 00000000000..65c5ca88a67 --- /dev/null +++ b/htdocs/includes/php-iban/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/htdocs/includes/php-iban/docs/COMEDY-OF-ERRORS b/htdocs/includes/php-iban/docs/COMEDY-OF-ERRORS new file mode 100644 index 00000000000..0eb3b8860ad --- /dev/null +++ b/htdocs/includes/php-iban/docs/COMEDY-OF-ERRORS @@ -0,0 +1,55 @@ +This file lists specific errors observed in the official IBAN specification. + +In addition to the specific errors, there persist basic outstanding +matters that cause issue for implementers: + - Non 1:1 mapping of records to countries (eg: French territories, etc.) + - Mixing of free text and hard data in specification fields + - Lack of validation of information in fields prior to publishing + - Lack of synchronisation between TXT and PDF versions of the registry + +2011-07-16 +---------- + - No information for Kuwait past sixth column + - Total absence of information regarding Kazakhstan + - '1.00001E+15' instead of a valid BBAN example for Lithuania + - Repeated IBAN example in human format instead of IBAN format- + specification for UAE + - Incorrect domestic example for Bulgaria, Kazakhstan, Latvia, + Lithuania, Luxembourg, Macedonia, Mauritius, Romania, San Marino + (complete, human-format IBAN instead of domestic example) + +Early 2012 +---------- + - Inconsistent record ordering (KW, KZ) + - Inconsistent capitalization (DK) + - Continued presence of incorrect domestic examples + +February 2013 +------------- + - Deployment of unparseable special values such as "Not in use" (FI). + - Still(!) missing a registry entry for 2010's 'new' entry of Khazakstan + +September 2013 +-------------- + - Azerbaijan, Brazil, Costa Rica, Palestine, Virgin Islands 'SEPA + Country' field in PDF (yes/no) is completely blank + +March 2014 +---------- + - In multiple cases, territories of a major country have a SEPA status + that differs from the parent jurisdiction. The IBAN specification as + previously released does not include individual records for these + territories, and thus cannot convey this important information. + - The IBAN registry's old URL is no longer publicly available! Its now + ends in a 404, and the apparent new home, located over at + http://www.swift.com/products_services/by_type/reference_data/iban_registry_iso13616 + does not have any content. The parent portion of this part of the + SWIFT website suggests the information may have been moved to a new + 'SWIFTRef' site, however that site appears to only peddle paid for + directories of BICs and similar. The new location after much + searching was found to be http://www.swift.com/products_services/bic_and_iban_format_registration_iban_format_r + +June 2014 +--------- + - The TXT registry records of QA and JO do not match those within the + PDF and are essentially spurious while looking roughly correct. Dang. diff --git a/htdocs/includes/php-iban/docs/ECBS standard implementation guidelines SIG203V3.2.pdf b/htdocs/includes/php-iban/docs/ECBS standard implementation guidelines SIG203V3.2.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c7c860aee67e0d718e9c87eee383c28d01c0c6f7 GIT binary patch literal 229029 zcmeF4d0bT0|NpNd%1GpbOKN>U$z0Ij&b>1OYK{u#f{L<;Yoths8zv}O=FQ4X&BTQa zO~+jpk=!zu8Z+Dw1zB9vF$EE{ki}%inLEET_ujeZqR06%Gr#UXlb_F{7%=WV=f2MS zzPIx{T}KDL+Z%sd>gm???!CN1x8|O1xUZ+LXWY~oZvFbX`HYC36O%CA6UV{#Lfm}b zjh&ScJPF`UmwR|<3KzH(4D-o9-;Q#No->WR82HL`m&~o1zVKI= zerWp2Pc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FnosTD&tvUGR80)D@APlA`doZ5SP&|nTSZ~3bv+f9weJtR%WoLJg%D25ZSZx za7@1emWJsWz|wF&hwNFUa}V<1Z2)nfg@f3`=mkqu(s7BMcudv>SHfgO1+GG1c>p?@ zANJ31KWNjWbU+I}Qa|iO=iyXLo`z+aRDTKqTPfAO!Vg*=o`-ae8R3|oMy9|xXXS&U zhP5BWRUQs3v@~DXbV%t6BC%A*hB~#x&H~j5d&m)IOF_jm?eNNG)B9fd+-?u3<&X*0yOI6`NCF zCBxekY7l9^VK*nk7czC0&fPEpV&Py8!uWBd$FLouu5|4QtSu%?NuPriW%DI&9btZ$ z-I$yVafXdIj9w-;A{^@vpdV{L9qePJZ2&Z7b1haDSvw;fD>FC-#$VBJla61Nif$#! z&qqL7VDlD6C6lqinK5ifdc5r+>Pp8O^p4W?8M0cE&I@4g=?<9u<%886!zcYz83iUCRcX<*yU^2MAd?GFrJhNl{+@1^_!!ZAF>J;@9sP&`%^gk!Qj z4snt4Nazo?4+u&m6`$XrSC-HQ=nsoU`P+bYmP+x8{G@dwKStwFkW2B3%4b*>A8!}j zUE^(JYl}N{MoxAW4k2mUW6T&I3s5tT18UmQ%WaGWdO>(^YcbFkQk-hI8U52@U v10Jq)Q>k5H1~`n&K;*;h{yv0oc+Gep7jGZo=o6?P!Kxb7t!v-4ozedRHYX#Z literal 0 HcmV?d00001 diff --git a/htdocs/includes/php-iban/docs/HACKING b/htdocs/includes/php-iban/docs/HACKING new file mode 100644 index 00000000000..dfc48f1ae5b --- /dev/null +++ b/htdocs/includes/php-iban/docs/HACKING @@ -0,0 +1,63 @@ +By unix tradition, this file outlines information that may be useful to +people who wish to modify the php-iban project. It outlines some basic +information around design decisions and other considerations. + + Procedural style + ---------------- + The code is written in PHP's original procedural style, and does + not require or assume any OO model. This is unix tradition and + should ease any integration pains due to objectspace mismatches. + In addition, it should make it easy for users both within an OO + or a procedural codebase to make use of the library. An OO wrapper + has been supplied to make things more familiar for those who are + only exposed to OO PHP: please try to keep it in synch with the + procedural (main) library where possible. + + Registry maintenance + -------------------- + The 'convert-registry.php' tool found in the 'utils/' subdirectory + is intended to assist with the automatic conversion of the SWIFT- + provided 'IBAN Registry' text files to the format required to + support php-iban execution. Why is there a new format, and why is it + distributed with php-iban instead of being generated on the fly + from SWIFT-provided data files? There are a few reasons: + + - Error correction + If errors are discovered in the official specification then they + can be resolved by us. There are (or have been) known errors + with the official IBAN Registry. (See COMEDY-OF-ERRORS) + + - Exclusion correction + If exclusions are discovered in the official specification then + they can be resolved by us. There are (or have been) known + exclusions from the official IBAN Registry. (See COMEDY-OF-ERRORS) + + - Efficiency + Because pattern matching is a core part of the functionality of + php-iban, and the pattern algorithms distributed by SWIFT are + (rather strangely) not in regular expression format, using their + files directly would result in a fairly significant startup + penalty as pattern conversion would be required (at each + invocation!) unless a caching strategy were deployed, which would + create additional complexity and sources of bugs (in addition, + due to the previous two points automatic conversion is not + presently possible ... and may never be!) + + - Maintainability + Distribution of a modified registry along with php-iban places + the burden of registry maintenance on with the package + maintainer(s) rather than with the user. This is better for + users who, if they really want, can still hack their local copy. + + Note that due to points one and two, the 'convert-registry.php' tool + is insufficient to produce a correct 'registry.txt' file. (You may + wish to review the differences between your newly generated file + and the original with the 'diff' tool in order to ascertain what + has changed.) + + A closing point on the registry: obviously, if any new fields are + added, then it is best to append them to the end of the registry + (rightmost, new field) in order to preserve backwards compatibility + instead of re-ordering the fields which would break older installs. + (The internal '_iban_load_registry()' function re-orders these fields + at load time in order to simplify runtime debugging, anyway.) diff --git a/htdocs/includes/php-iban/docs/ISO13616.pdf b/htdocs/includes/php-iban/docs/ISO13616.pdf new file mode 100644 index 0000000000000000000000000000000000000000..fa23285c4f773896fee58e41970274af10ec5fd4 GIT binary patch literal 141593 zcma&NQ;=rSwym4CZQHhO+qP|^(nh6GY1_7K+x`=kytQ_m9rs~9obxnhw3rVwW{enL zAFcIHt|TTw&&#Q9HAVU)18b2E1#VwA8m zb~6_4(?_ z@X`q|#4;KEu}w`B2y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i z>|>a3uGTz=t6RS zR{_jdt*?!={A|Q0m~MZNLBfUFJPh;YGk+hmx%6wOvx|{^I>;sG!T@etU{<%aD}0#E zxTc_JnMMrCnQoQL8ts5V_Z(mn+Gr%8^NRhPQMc9b^z&i6t?%0fH{cLX{tcq4EbP zsf~o!Zwss`=;iYlu9yd^mP$K9e_XZMZ3~{YUL~21=V`2T645eHF$K{`<_BQes$2k= z%B4btHz6yu&18-Vo-?Vt2+1LzFnV)Kb0pP12A&Z_6&7pzFh=HPXsi7_Fu50EIvFeA zA_5ts0`Mo}OkiW}C$VfYR$z==>xQw)KA;9#$4#bn!{k~wpa(+#m_HQ*GI(BPZ`hZK z^?>>%S~sFd>qZo5-H2kX8*KdkT0+h-*T3=f0Q|}MB7Cf{BMc$>Ljniq>G#KGsdXdD zRW5*Uzi8cn{}ZwTcZu|g%%9pPV)ABjA?%#$I{<} zF4MM!EuGL8xV2E_2VsIiB+uB-NL$6hgwiWuaxFt+GU<02Q+c*Q-lWE`x!jj={LmQm zUh)j}D za3A0Enc_QE;Gm0x-QDf(cfIc`d-mY>Kc4^i^H22gpMU-K>&6P`hYrrS<~5F$ngbvl P=U`jbxq0*M)1A)Wf3>z5 literal 0 HcmV?d00001 diff --git a/htdocs/includes/php-iban/docs/LICENSE b/htdocs/includes/php-iban/docs/LICENSE new file mode 100644 index 00000000000..fc8a5de7edf --- /dev/null +++ b/htdocs/includes/php-iban/docs/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/htdocs/includes/php-iban/docs/README b/htdocs/includes/php-iban/docs/README new file mode 100644 index 00000000000..e0deacd88f3 --- /dev/null +++ b/htdocs/includes/php-iban/docs/README @@ -0,0 +1,207 @@ +php-iban README +--------------- + +php-iban is a library for parsing and validating International Bank +Account Number (IBAN) information in PHP. + +It also validates Internet International Bank Account Number +(IIBAN) as specified at http://tools.ietf.org/html/draft-iiban-01 +(see also http://www.ifex-project.org/our-proposals/iiban) + +php-iban lives at http://code.google.com/p/php-iban + + What is an IBAN? + ---------------- + An IBAN is basically a standardised way of explaining a bank + account number that works across borders. Its structure is: + + + + + BBAN is the term used to describe the national-level format + for a bank account number, which varies between countries + (and was sometimes created just to get IBAN connectivity!). + Note that a BBAN may have its own checksum algorithm. + + IBAN provides basic protection, using the checksum, against + transcription (ie: human copying) errors. It also provides + a registry of valid destination countries and their BBAN + formats. Thus, when you ask php-iban to 'validate' an IBAN + it ensures that these checks are passed. However, it cannot + ensure that a bank account actually exists - the only party + who can do that is the receiving bank or country. + + IBAN was invented in Europe, however its usage is growing + rapidly to other parts of the world. Thus, the future of + this library looks pretty good. + + For further information, please see 'docs/ISO13616.pdf' or + visit Wikipedia at http://en.wikipedia.org/wiki/IBAN + + What is an IIBAN? + ----------------- + An Internet IBAN (IIBAN) identifies an internet-based financial + endpoint in a manner that is superset-compatible with the existing + European Committee for Banking Standards (ECBS) International Bank + Account Number (IBAN) standard [ISO13616]. + + For more information see http://tools.ietf.org/html/draft-iiban-00 + and http://www.ifex-project.org/our-proposals/iiban + + To disable IIBAN support from your installation, simply remove + the second ('AA|...') line from the top of the registry.txt file. + + Execution environment + --------------------- + At present the library merely requires a PHP engine to be present + and has no external dependencies. It is recommended that your + PHP engine is configured to disable verbose warnings for events + such as access of unknown array indexes, though this should be + standard on almost any PHP deployment today. Any PHP engine + in use today should be compatible, though PHP3 or PHP4 execution + environments may require minor modifications (specifically, + some string functions may have changed). + + Installation + ------------ + Simply copy 'php-iban.php' and 'registry.txt' to an appropriate + location for your project. The location of the files will affect + the 'require_once()' line used to load the library from your + codebase, and may have relevance security (see 'Security' below). + Note that 'php-iban.php' expects to find 'registry.txt' in the + same directory as itself. + + Security + -------- + Following best practice for library files, the location chosen + for the php-iban.php and registry.txt files should ideally be + outside of any web-accessible directories. Thus, if your + web project lives in /var/www/myproject/htdocs/ then it would + be preferably to place php-iban in /var/www/myproject or some + other directory that is not visible to regular web users. + + Secondly, neither file should be writable by the web server + itself in order to prevent compromise of the execution path + (ie: getting hacked). So, for example if your web server runs + as user 'www', group 'www', you can ensure that the web server + has minimal required privileges against the files as follows + (note that you will need to be root to execute these commands): + + # chown php-iban registry.txt # where is a + # non-root user that + # is not 'www'. + # chgrp www php-iban registry.txt # set group to 'www' + # chmod ugo-rwx php-iban registry.txt # remove privileges + # chmod g+r php-iban registry.txt # allow 'www' group + # to read the files + + Obviously the above do not apply if you are using PHP in a + non web-oriented project (eg: a cronjob or daemon), a usage + of the language that is apparently growing - but limited. + + Using the library + ----------------- + Basic invocation is as follows: + + # include the library + require_once('/path/to/php-iban.php'); # /path/to/ is optional + + # use some library function or other... + if(!verify_iban($iban_to_verify)) { + # blame the user... + } + + Note that because the library is designed in a procedural manner + rather than an object-oriented manner it should be easy to + integrate with a wide variety of established codebases and + PHP interpreter versions. + + Using the library's OO wrapper + ------------------------------ + Because many new PHP programmers seems to learn the language via + books that only teach OO based programming and are thus unfamiliar + with procedural PHP (and often relatively inexperienced as + programmers, too) an OO wrapper-library has been provided. + + ======================= READ THIS ================================= + However *you should avoid excessive use of OO*. For some thought + provoking discussions of the negative aspects of overusing OO, + please refer to 'Coders at Work' and 'The Art of UNIX Programming'. + (OO is great for some problems, but simply pointless for most.) + =================================================================== + + Anyway, to use the OO wrapper supplied, invocation is as follows: + + # include the OO wrapper to the library + require_once('/path/to/oophp-iban.php'); # /path/to is optional + + # instantiate an IBAN object + $myIban = new IBAN('AZ12345678901234'); + if(!$myIban->Verify()) { + # blame the user... + } + + Documentation + ------------- + There are three types of functions provided by the library: + + - IBAN-level functions + + These are functions that operate on an IBAN. All of these + functions accept either machine format or human format + IBANs as input. Typically they return facts about an IBAN + as their output (for example whether it is valid or not, + or the BBAN (national-level) portion of the IBAN), though + some of them may perform other functions (eg: fixing a + broken IBAN checksum). These functions are named 'iban_*' + with the exception of the most commonly used function, + 'verify_iban()', and excepting the country-level functions. + + (Regarding the object oriented wrapper - all of these + functions are implemented as methods on IBAN objects) + + - IBAN country-level functions + These functions return information about countries that are + part of the IBAN standard. They each take the two letter + ISO country code at the beginning of an IBAN as their + argument. They are named 'iban_country_*', with the + exception of 'iban_countries()' which returns a list of + the known IBAN countries. (For example, functions that + return an example IBAN or BBAN for the country, or the + name of the country.) + + (Regarding the object oriented wrapper - all of these + functions are implemented as methods on IBANCountry + objects, except for 'iban_countries()' which is + implemented as the Countries() method on the IBAN class) + + - Internal functions + These functions begin with '_iban_*' and can be ignored. + + (Regarding the object oriented wrapper - these functions + are not present) + + Please refer to either http://code.google.com/p/php-iban or the + commented source code of php-iban itself for the complete list of + which functions are available. Of course, in unix style one could + achieve the same in a pinch as follows (instant documentation!): + $ grep function php-iban.php + $ egrep '(Class|function)' oophp-iban.php + + Community + --------- + You are encouraged to contribute bugs, feedback and suggestions + through the project's website. + + Particularly if you deploy php-iban in a commercial setting, you are + STRONGLY encouraged to join the project's mailing list, which can + be found via the website. Joining the mailing list ensures that you + can be made aware of important updates. Important updates include: + - Updates to new registry editions (support new countries that have + been added to the IBAN system) + - Bug fixes + - Security updates + + The email list receives almost no traffic and as a 'Google Group' is + well protected from spam, so don't worry about junk in your inbox. + +Thanks for choosing php-iban! You have excellent taste in software ;) diff --git a/htdocs/includes/php-iban/docs/REGISTRY-URL b/htdocs/includes/php-iban/docs/REGISTRY-URL new file mode 100644 index 00000000000..58fb8c6dadb --- /dev/null +++ b/htdocs/includes/php-iban/docs/REGISTRY-URL @@ -0,0 +1,17 @@ +To get the latest ISO13616 IBAN registry, go to: + http://www.swift.com/products_services/bic_and_iban_format_registration_iban_format_r + +TXT format: + http://www.swift.com/dsp/resources/documents/IBAN_Registry.txt + +PDF format: + http://www.swift.com/dsp/resources/documents/IBAN_Registry.pdf + +Unfortunately, it has been noticed in 2011 that the official .txt file is +not an accurate representation of the PDF format specification, and lacks +some information. It is hoped that in future SWIFT will be more careful to +publish only correct standards information. + +It has been noted in 2014 that this is still the case. + +(For more information on this subject, see the HACKING file) diff --git a/htdocs/includes/php-iban/docs/SEPA b/htdocs/includes/php-iban/docs/SEPA new file mode 100644 index 00000000000..8310ff1cfb0 --- /dev/null +++ b/htdocs/includes/php-iban/docs/SEPA @@ -0,0 +1,9 @@ +Interpreting the SEPA Field +=========================== + +Note that some IIBAN providers may in fact provide SEPA connectivity. + +Thus, implementers are reminded to consider the reported SEPA status +of a country within the registry as confirming rather than negating +the potential SEPA status of a potential financial institution who +may be party to a proposed transaction. diff --git a/htdocs/includes/php-iban/docs/TODO b/htdocs/includes/php-iban/docs/TODO new file mode 100644 index 00000000000..906ab7e3fb6 --- /dev/null +++ b/htdocs/includes/php-iban/docs/TODO @@ -0,0 +1,21 @@ +TODO +---- + + - Finnish record suggests position at which to pad domestic account + numbers in order to reach a BBAN / IBAN, this data could be of + some use for certain applications and would be nice to include + - Addition of information regarding preferred human-level formatting + for each country's BBAN - worthwhile? + - Addition of 'date effective' information for records such as BH + and the UAE that published data in advance of deployment + - Support for calculating or validating any known national (sub- + BBAN-level) checksum algorithms? + - URLs to national-level BBAN format specifications + - Consider adding a library of localised forms and abbreviations + for account number portions, for example Austria and Germany seem + to have 'Kontonummer' (KTO) for account number, and 'Bankleitzah' + (BLZ) for bank identifier. This could assist greatly with + deployments requiring international and/or constrained input. + - Consider building a library of national-level bank or payment + institution identifier codes. This would be rather large and an + optional extension and would be in competition with SWIFTRef. diff --git a/htdocs/includes/php-iban/mistranscriptions.txt b/htdocs/includes/php-iban/mistranscriptions.txt new file mode 100644 index 00000000000..7593475ff6f --- /dev/null +++ b/htdocs/includes/php-iban/mistranscriptions.txt @@ -0,0 +1,49 @@ + ; formalities + input-roman = number / letter + number = c-0 / c-1 / c-2 / c-3 / c-4 / c-5 / c-6 / c-7 / c-8 / c-9 + letter = c-a / c-b / c-c / c-d / c-e / c-f / c-g / c-h / c-i / c-j + / c-k / c-l / c-m / c-n / c-o / c-p / c-q / c-r / c-s + / c-t / c-u / c-v / c-w / c-x / c-y / c-z + + ; possible sources of mistranscribed numbers + c-0 = "O" / "6" / "D" / "G" + c-1 = "I" / "L" / "7" / "2" / "Z" + c-2 = "Z" / "7" / "P" / "E" / "1" + c-3 = "8" / "B" + c-4 = "G" / "U" + c-5 = "S" / "7" + c-6 = "0" / "O" / "8" / "G" / "C" / "B" / "D" + c-7 = "J" / "I" / "1" / "L" + c-8 = "B" / "3" / "6" + c-9 = "G" / "Y" / "O" / "0" / "D" + + ; possible sources of mistranscribed letters + c-a = "G" / "Q" / "O" / "0" + c-b = "6" / "3" / "8" / "P" / "0" / "O" + c-c = "R" / "6" / "I" / "L" / "O" / "0" + c-d = "0" / "O" / "9" / "Q" / "G" / "6" / "A" + c-e = "F" / "G" / "0" / "2" / "K" / "Z" / "S" / "O" + c-f = "E" / "K" / "T" / "P" / "Y" / "4" / "B" / "7" / "1" + c-g = "9" / "Q" / "8" / "6" / "0" / "C" / "4" / "O" + c-h = "B" / "N" / "A" / "4" / "6" / "M" / "W" / "F" / "R" / "T" / "X" + c-i = "1" / "L" / "7" / "J" / "2" / "T" / "Z" + c-j = "I" / "7" / "2" / "9" / "1" / "U" / "T" / "Q" / "P" / "Y" / "Z" + / "L" / "S" + c-k = "F" / "X" / "H" / "R" + c-l = "1" / "2" / "7" / "C" / "I" / "J" / "R" / "T" / "Y" / "Z" + c-m = "H" / "8" / "E" / "3" / "N" / "V" / "W" + c-n = "H" / "R" / "C" / "2" / "4" / "M" / "O" / "P" / "K" / "T" / "Z" + c-o = "0" / "6" / "9" / "A" / "D" / "G" / "C" / "E" / "B" / "N" / "P" + / "Q" / "R" + c-p = "F" / "4" / "8" / "2" / "B" / "J" / "R" / "N" / "O" / "T" / "Y" + c-q = "O" / "G" / "9" / "Y" / "1" / "7" / "L" + c-r = "K" / "B" / "V" / "C" / "1" / "L" / "2" + c-s = "5" / "6" / "9" / "B" / "G" / "Q" / "A" / "Y" + c-t = "1" / "4" / "7" / "F" / "I" / "J" / "L" / "P" / "X" / "Y" + c-u = "V" / "N" / "A" / "4" / "9" / "W" / "Y" + c-v = "U" / "R" / "N" + c-w = "M" / "N" / "U" / "V" + c-x = "K" / "F" / "4" / "T" / "V" / "Y" + c-y = "G" / "V" / "J" / "I" / "4" / "9" / "T" / "F" / "Q" / "1" + c-z = "2" / "1" / "L" / "R" / "I" / "7" / "V" / "3" / "4" + diff --git a/htdocs/includes/php-iban/oophp-iban.php b/htdocs/includes/php-iban/oophp-iban.php new file mode 100644 index 00000000000..76e3cd0d06b --- /dev/null +++ b/htdocs/includes/php-iban/oophp-iban.php @@ -0,0 +1,157 @@ +iban = $iban; + } + + public function Verify($iban='') { + if($iban!='') { return verify_iban($iban); } + return verify_iban($this->iban); + # we could throw exceptions of various types, but why - does it really + # add anything? possibly some slightly better user feedback potential. + # however, this can be written by hand by performing individual checks + # ala the code in verify_iban() itself where required, which is likely + # almost never. for the increased complexity and + # maintenance/documentation cost, i say, therefore: no. no exceptions. + } + + public function MistranscriptionSuggestions() { + return iban_mistranscription_suggestions($this->iban); + } + + public function MachineFormat() { + return iban_to_machine_format($this->iban); + } + + public function HumanFormat() { + return iban_to_human_format($this->iban); + } + + public function Country($iban='') { + return iban_get_country_part($this->iban); + } + + public function Checksum($iban='') { + return iban_get_checksum_part($this->iban); + } + + public function BBAN() { + return iban_get_bban_part($this->iban); + } + + public function VerifyChecksum() { + return iban_verify_checksum($this->iban); + } + + public function FindChecksum() { + return iban_find_checksum($this->iban); + } + + public function SetChecksum() { + $this->iban = iban_set_checksum($this->iban); + } + + public function ChecksumStringReplace() { + return iban_checksum_string_replace($this->iban); + } + + public function Parts() { + return iban_get_parts($this->iban); + } + + public function Bank() { + return iban_get_bank_part($this->iban); + } + + public function Branch() { + return iban_get_branch_part($this->iban); + } + + public function Account() { + return iban_get_account_part($this->iban); + } + + public function Countries() { + return iban_countries(); + } +} + +# IBANCountry +Class IBANCountry { + + # constructor with code + function __construct($code = '') { + $this->code = $code; + } + + public function Name() { + return iban_country_get_country_name($this->code); + } + + public function DomesticExample() { + return iban_country_get_domestic_example($this->code); + } + + public function BBANExample() { + return iban_country_get_bban_example($this->code); + } + + public function BBANFormatSWIFT() { + return iban_country_get_bban_format_swift($this->code); + } + + public function BBANFormatRegex() { + return iban_country_get_bban_format_regex($this->code); + } + + public function BBANLength() { + return iban_country_get_bban_length($this->code); + } + + public function IBANExample() { + return iban_country_get_iban_example($this->code); + } + + public function IBANFormatSWIFT() { + return iban_country_get_iban_format_swift($this->code); + } + + public function IBANFormatRegex() { + return iban_country_get_iban_format_regex($this->code); + } + + public function IBANLength() { + return iban_country_get_iban_length($this->code); + } + + public function BankIDStartOffset() { + return iban_country_get_bankid_start_offset($this->code); + } + + public function BankIDStopOffset() { + return iban_country_get_bankid_stop_offset($this->code); + } + + public function BranchIDStartOffset() { + return iban_country_get_branchid_start_offset($this->code); + } + + public function BranchIDStopOffset() { + return iban_country_get_branchid_stop_offset($this->code); + } + + public function RegistryEdition() { + return iban_country_get_registry_edition($this->code); + } + + public function IsSEPA() { + return iban_country_is_sepa($this->code); + } + +} + +?> diff --git a/htdocs/includes/php-iban/php-iban.php b/htdocs/includes/php-iban/php-iban.php new file mode 100644 index 00000000000..e4ef4d8dd1d --- /dev/null +++ b/htdocs/includes/php-iban/php-iban.php @@ -0,0 +1,486 @@ +0) && (($i+1)%4==0)) { $human_iban .= ' '; } + } + return $human_iban; +} + +# Get the country part from an IBAN +function iban_get_country_part($iban) { + $iban = iban_to_machine_format($iban); + return substr($iban,0,2); +} + +# Get the checksum part from an IBAN +function iban_get_checksum_part($iban) { + $iban = iban_to_machine_format($iban); + return substr($iban,2,2); +} + +# Get the BBAN part from an IBAN +function iban_get_bban_part($iban) { + $iban = iban_to_machine_format($iban); + return substr($iban,4); +} + +# Check the checksum of an IBAN - code modified from Validate_Finance PEAR class +function iban_verify_checksum($iban) { + # convert to machine format + $iban = iban_to_machine_format($iban); + # move first 4 chars (countrycode and checksum) to the end of the string + $tempiban = substr($iban, 4).substr($iban, 0, 4); + # subsitutute chars + $tempiban = iban_checksum_string_replace($tempiban); + # mod97-10 + $result = iban_mod97_10($tempiban); + # checkvalue of 1 indicates correct IBAN checksum + if ($result != 1) { + return false; + } + return true; +} + +# Find the correct checksum for an IBAN +# $iban The IBAN whose checksum should be calculated +function iban_find_checksum($iban) { + $iban = iban_to_machine_format($iban); + # move first 4 chars to right + $left = substr($iban,0,2) . '00'; # but set right-most 2 (checksum) to '00' + $right = substr($iban,4); + # glue back together + $tmp = $right . $left; + # convert letters using conversion table + $tmp = iban_checksum_string_replace($tmp); + # get mod97-10 output + $checksum = iban_mod97_10_checksum($tmp); + # return 98 minus the mod97-10 output, left zero padded to two digits + return str_pad((98-$checksum),2,'0',STR_PAD_LEFT); +} + +# Set the correct checksum for an IBAN +# $iban IBAN whose checksum should be set +function iban_set_checksum($iban) { + $iban = iban_to_machine_format($iban); + return substr($iban,0,2) . iban_find_checksum($iban) . substr($iban,4); +} + +# Character substitution required for IBAN MOD97-10 checksum validation/generation +# $s Input string (IBAN) +function iban_checksum_string_replace($s) { + $iban_replace_chars = range('A','Z'); + foreach (range(10,35) as $tempvalue) { $iban_replace_values[]=strval($tempvalue); } + return str_replace($iban_replace_chars,$iban_replace_values,$s); +} + +# Same as below but actually returns resulting checksum +function iban_mod97_10_checksum($numeric_representation) { + $checksum = intval(substr($numeric_representation, 0, 1)); + for ($position = 1; $position < strlen($numeric_representation); $position++) { + $checksum *= 10; + $checksum += intval(substr($numeric_representation,$position,1)); + $checksum %= 97; + } + return $checksum; +} + +# Perform MOD97-10 checksum calculation ('Germanic-level effiency' version - thanks Chris!) +function iban_mod97_10($numeric_representation) { + global $__disable_iiban_gmp_extension; + # prefer php5 gmp extension if available + if(!($__disable_iiban_gmp_extension) && function_exists('gmp_intval')) { return gmp_intval(gmp_mod(gmp_init($numeric_representation, 10),'97')) === 1; } + +/* + # old manual processing (~16x slower) + $checksum = intval(substr($numeric_representation, 0, 1)); + for ($position = 1; $position < strlen($numeric_representation); $position++) { + $checksum *= 10; + $checksum += intval(substr($numeric_representation,$position,1)); + $checksum %= 97; + } + return $checksum; + */ + + # new manual processing (~3x slower) + $length = strlen($numeric_representation); + $rest = ""; + $position = 0; + while ($position < $length) { + $value = 9-strlen($rest); + $n = $rest . substr($numeric_representation,$position,$value); + $rest = $n % 97; + $position = $position + $value; + } + return ($rest === 1); +} + +# Get an array of all the parts from an IBAN +function iban_get_parts($iban) { + return array( + 'country' => iban_get_country_part($iban), + 'checksum' => iban_get_checksum_part($iban), + 'bban' => iban_get_bban_part($iban), + 'bank' => iban_get_bank_part($iban), + 'country' => iban_get_country_part($iban), + 'branch' => iban_get_branch_part($iban), + 'account' => iban_get_account_part($iban) + ); +} + +# Get the Bank ID (institution code) from an IBAN +function iban_get_bank_part($iban) { + $iban = iban_to_machine_format($iban); + $country = iban_get_country_part($iban); + $start = iban_country_get_bankid_start_offset($country); + $stop = iban_country_get_bankid_stop_offset($country); + if($start!=''&&$stop!='') { + $bban = iban_get_bban_part($iban); + return substr($bban,$start,($stop-$start+1)); + } + return ''; +} + +# Get the Branch ID (sort code) from an IBAN +function iban_get_branch_part($iban) { + $iban = iban_to_machine_format($iban); + $country = iban_get_country_part($iban); + $start = iban_country_get_branchid_start_offset($country); + $stop = iban_country_get_branchid_stop_offset($country); + if($start!=''&&$stop!='') { + $bban = iban_get_bban_part($iban); + return substr($bban,$start,($stop-$start+1)); + } + return ''; +} + +# Get the (branch-local) account ID from an IBAN +function iban_get_account_part($iban) { + $iban = iban_to_machine_format($iban); + $country = iban_get_country_part($iban); + $start = iban_country_get_branchid_stop_offset($country); + if($start=='') { + $start = iban_country_get_bankid_stop_offset($country); + } + if($start!='') { + $bban = iban_get_bban_part($iban); + return substr($bban,$start+1); + } + return ''; +} + +# Get the name of an IBAN country +function iban_country_get_country_name($iban_country) { + return _iban_country_get_info($iban_country,'country_name'); +} + +# Get the domestic example for an IBAN country +function iban_country_get_domestic_example($iban_country) { + return _iban_country_get_info($iban_country,'domestic_example'); +} + +# Get the BBAN example for an IBAN country +function iban_country_get_bban_example($iban_country) { + return _iban_country_get_info($iban_country,'bban_example'); +} + +# Get the BBAN format (in SWIFT format) for an IBAN country +function iban_country_get_bban_format_swift($iban_country) { + return _iban_country_get_info($iban_country,'bban_format_swift'); +} + +# Get the BBAN format (as a regular expression) for an IBAN country +function iban_country_get_bban_format_regex($iban_country) { + return _iban_country_get_info($iban_country,'bban_format_regex'); +} + +# Get the BBAN length for an IBAN country +function iban_country_get_bban_length($iban_country) { + return _iban_country_get_info($iban_country,'bban_length'); +} + +# Get the IBAN example for an IBAN country +function iban_country_get_iban_example($iban_country) { + return _iban_country_get_info($iban_country,'iban_example'); +} + +# Get the IBAN format (in SWIFT format) for an IBAN country +function iban_country_get_iban_format_swift($iban_country) { + return _iban_country_get_info($iban_country,'iban_format_swift'); +} + +# Get the IBAN format (as a regular expression) for an IBAN country +function iban_country_get_iban_format_regex($iban_country) { + return _iban_country_get_info($iban_country,'iban_format_regex'); +} + +# Get the IBAN length for an IBAN country +function iban_country_get_iban_length($iban_country) { + return _iban_country_get_info($iban_country,'iban_length'); +} + +# Get the BBAN Bank ID start offset for an IBAN country +function iban_country_get_bankid_start_offset($iban_country) { + return _iban_country_get_info($iban_country,'bban_bankid_start_offset'); +} + +# Get the BBAN Bank ID stop offset for an IBAN country +function iban_country_get_bankid_stop_offset($iban_country) { + return _iban_country_get_info($iban_country,'bban_bankid_stop_offset'); +} + +# Get the BBAN Branch ID start offset for an IBAN country +function iban_country_get_branchid_start_offset($iban_country) { + return _iban_country_get_info($iban_country,'bban_branchid_start_offset'); +} + +# Get the BBAN Branch ID stop offset for an IBAN country +function iban_country_get_branchid_stop_offset($iban_country) { + return _iban_country_get_info($iban_country,'bban_branchid_stop_offset'); +} + +# Get the registry edition for an IBAN country +function iban_country_get_registry_edition($iban_country) { + return _iban_country_get_info($iban_country,'registry_edition'); +} + +# Is the IBAN country a SEPA member? +function iban_country_is_sepa($iban_country) { + return _iban_country_get_info($iban_country,'country_sepa'); +} + +# Get the list of all IBAN countries +function iban_countries() { + global $_iban_registry; + return array_keys($_iban_registry); +} + +# Given an incorrect IBAN, return an array of zero or more checksum-valid +# suggestions for what the user might have meant, based upon common +# mistranscriptions. +function iban_mistranscription_suggestions($incorrect_iban) { + + # abort on ridiculous length input (but be liberal) + $length = strlen($incorrect_iban); + if($length<5 || $length>34) { return array('(length bad)'); } + + # abort if mistranscriptions data is unable to load + if(!_iban_load_mistranscriptions()) { return array('(failed to load)'); } + + # init + global $_iban_mistranscriptions; + $suggestions = array(); + + # we have a string of approximately IBAN-like length. + # ... now let's make suggestions. + $numbers = array('0','1','2','3','4','5','6','7','8','9'); + for($i=0;$i<$length;$i++) { + # get the character at this position + $character = substr($incorrect_iban,$i,1); + # for each known transcription error resulting in this character + foreach($_iban_mistranscriptions[$character] as $possible_origin) { + # if we're: + # - in the first 2 characters (country) and the possible replacement + # is a letter + # - in the 3rd or 4th characters (checksum) and the possible + # replacement is a number + # - later in the string + if(($i<2 && !in_array($possible_origin,$numbers)) || + ($i>=2 && $i<=3 && in_array($possible_origin,$numbers)) || + $i>3) { + # construct a possible IBAN using this possible origin for the + # mistranscribed character, replaced at this position only + $possible_iban = substr($incorrect_iban,0,$i) . $possible_origin . substr($incorrect_iban,$i+1); + # if the checksum passes, return it as a possibility + if(verify_iban($possible_iban)) { + array_push($suggestions,$possible_iban); + } + } + } + } + + # now we check for the type of mistransposition case where all of + # the characters of a certain type within a string were mistransposed. + # - first generate a character frequency table + $char_freqs = array(); + for($i=0;$i$freq) { + # if the character occurs more than once + if($freq>1) { + # check the 'all occurrences of were mistranscribed' case + foreach($_iban_mistranscriptions[$char] as $possible_origin) { + $possible_iban = str_replace($char,$possible_origin,$incorrect_iban); + if(verify_iban($possible_iban)) { + array_push($suggestions,$possible_iban); + } + } + } + } + + return $suggestions; +} + + +##### internal use functions - safe to ignore ###### + +# Load the IBAN registry from disk. +global $_iban_registry; +$_iban_registry = array(); +_iban_load_registry(); +function _iban_load_registry() { + global $_iban_registry; + # if the registry is not yet loaded, or has been corrupted, reload + if(!is_array($_iban_registry) || count($_iban_registry)<1) { + $data = file_get_contents(dirname(__FILE__) . '/registry.txt'); + $lines = explode("\n",$data); + array_shift($lines); # drop leading description line + # loop through lines + foreach($lines as $line) { + if($line!='') { + # split to fields + $old_display_errors_value = ini_get('display_errors'); + ini_set('display_errors',false); + $old_error_reporting_value = ini_get('error_reporting'); + ini_set('error_reporting',false); + list($country,$country_name,$domestic_example,$bban_example,$bban_format_swift,$bban_format_regex,$bban_length,$iban_example,$iban_format_swift,$iban_format_regex,$iban_length,$bban_bankid_start_offset,$bban_bankid_stop_offset,$bban_branchid_start_offset,$bban_branchid_stop_offset,$registry_edition,$country_sepa) = explode('|',$line); + ini_set('display_errors',$old_display_errors_value); + ini_set('error_reporting',$old_error_reporting_value); + # assign to registry + $_iban_registry[$country] = array( + 'country' => $country, + 'country_name' => $country_name, + 'country_sepa' => $country_sepa, + 'domestic_example' => $domestic_example, + 'bban_example' => $bban_example, + 'bban_format_swift' => $bban_format_swift, + 'bban_format_regex' => $bban_format_regex, + 'bban_length' => $bban_length, + 'iban_example' => $iban_example, + 'iban_format_swift' => $iban_format_swift, + 'iban_format_regex' => $iban_format_regex, + 'iban_length' => $iban_length, + 'bban_bankid_start_offset' => $bban_bankid_start_offset, + 'bban_bankid_stop_offset' => $bban_bankid_stop_offset, + 'bban_branchid_start_offset' => $bban_branchid_start_offset, + 'bban_branchid_stop_offset' => $bban_branchid_stop_offset, + 'registry_edition' => $registry_edition + ); + } + } + } +} + +# Get information from the IBAN registry by example IBAN / code combination +function _iban_get_info($iban,$code) { + $country = iban_get_country_part($iban); + return _iban_country_get_info($country,$code); +} + +# Get information from the IBAN registry by country / code combination +function _iban_country_get_info($country,$code) { + global $_iban_registry; + $country = strtoupper($country); + $code = strtolower($code); + if(array_key_exists($country,$_iban_registry)) { + if(array_key_exists($code,$_iban_registry[$country])) { + return $_iban_registry[$country][$code]; + } + } + return false; +} + +# Load common mistranscriptions from disk. +function _iban_load_mistranscriptions() { + global $_iban_mistranscriptions; + # do not reload if already present + if(is_array($_iban_mistranscriptions) && count($_iban_mistranscriptions) == 36) { return true; } + $_iban_mistranscriptions = array(); + $file = dirname(__FILE__) . '/mistranscriptions.txt'; + if(!file_exists($file) || !is_readable($file)) { return false; } + $data = file_get_contents($file); + $lines = explode("\n",$data); + foreach($lines as $line) { + # match lines with ' c- = ' where x is a word-like character + if(preg_match('/^ *c-(\w) = (.*?)$/',$line,$matches)) { + # normalize the character to upper case + $character = strtoupper($matches[1]); + # break the possible origins list at '/', strip quotes & spaces + $chars = explode(' ',str_replace('"','',preg_replace('/ *?\/ *?/','',$matches[2]))); + # assign as possible mistranscriptions for that character + $_iban_mistranscriptions[$character] = $chars; + } + } + return true; +} + +?> diff --git a/htdocs/includes/php-iban/registry.txt b/htdocs/includes/php-iban/registry.txt new file mode 100644 index 00000000000..ffe714139dd --- /dev/null +++ b/htdocs/includes/php-iban/registry.txt @@ -0,0 +1,81 @@ +country_code|country_name|domestic_example|bban_example|bban_format_swift|bban_format_regex|bban_length|iban_example|iban_format_swift|iban_format_regex|iban_length|bban_bankid_start_offset|bban_bankid_stop_offset|bban_branchid_start_offset|bban_branchid_stop_offset|registry_edition|country_sepa +AA|IIBAN (Internet)|0011123Z5678|0011123Z5678|12!a|^[A-Z0-9]{12}$|12|AA120011123Z5678|AA2!n12!a|^AA(\d{2})([A-Z0-9]{12})$|16|0|3|||N/A|0 +AL|Albania|0000000235698741|212110090000000235698741|8!n16!c|^(\d{8})([A-Za-z0-9]{16})$|24|AL47212110090000000235698741|AL2!n8!n16!c|^AL(\d{2})(\d{8})([A-Za-z0-9]{16})$|28|0|2|3|6|2011-06-20|0 +AD|Andorra|2030200359100100|00012030200359100100|4!n4!n12!c|^(\d{4})(\d{4})([A-Za-z0-9]{12})$|20|AD1200012030200359100100|AD2!n4!n4!n12!c|^AD(\d{2})(\d{4})(\d{4})([A-Za-z0-9]{12})$|24|0|3|4|7|2011-06-20|0 +AT|Austria|19043-234573201|1904300234573201|5!n11!n|^(\d{5})(\d{11})$|16|AT611904300234573201|AT2!n5!n11!n|^AT(\d{2})(\d{5})(\d{11})$|20|0|4|||2011-06-20|1 +AX|Aland Islands|123456-785|12345600000785|6!n7!n1!n|^(\d{6})(\d{7})(\d{1})$|14|AX2112345600000785|AX2!n6!n7!n1!n|^AX(\d{2})(\d{6})(\d{7})(\d{1})$|18|0|2|||2013-09-05|1 +AZ|Azerbaijan|NABZ00000000137010001944|NABZ00000000137010001944|4!a20!c|^([A-Z]{4})([A-Za-z0-9]{20})$|24|AZ21NABZ00000000137010001944|AZ2!n4!a20!c|^AZ(\d{2})([A-Z]{4})([A-Za-z0-9]{20})$|28|0|3|||2012-05-29|0 +BH|Bahrain|00001299123456|BMAG00001299123456|4!a14!c|^([A-Z]{4})([A-Za-z0-9]{14})$|22|BH67BMAG00001299123456|BH2!n4!a14!c|^BH(\d{2})([A-Z]{4})([A-Za-z0-9]{14})$|22|0|3|||2012-05-29|0 +BE|Belgium|539-0075470-34|539007547034|3!n7!n2!n|^(\d{3})(\d{7})(\d{2})$|12|BE68539007547034|BE2!n3!n7!n2!n|^BE(\d{2})(\d{3})(\d{7})(\d{2})$|16|0|2|||2011-06-20|1 +BA|Bosnia and Herzegovina|199-044-00012002-79|1990440001200279|3!n3!n8!n2!n|^(\d{3})(\d{3})(\d{8})(\d{2})$|16|BA391290079401028494|BA2!n3!n3!n8!n2!n|^BA(\d{2})(\d{3})(\d{3})(\d{8})(\d{2})$|20|0|2|3|5|2011-06-20|0 +BR|Brazil|0009795493C1|00360305000010009795493P1|8!n5!n10!n1!a1!c|^(\d{8})(\d{5})(\d{10})([A-Z]{1})([A-Za-z0-9]{1})$|25|BR2300360305000010009795493P1BR1800000000141455123924100C2|BR2!n8!n5!n10!n1!a1!c|^BR(\d{2})(\d{8})(\d{5})(\d{10})([A-Z]{1})([A-Za-z0-9]{1})$|29|0|7|8|12|2013-06-20|0 +BG|Bulgaria|BNBG 9661 1020 3456 78|BNBG96611020345678|4!a4!n2!n8!c|^([A-Z]{4})(\d{4})(\d{2})([A-Za-z0-9]{8})$|18|BG80BNBG96611020345678|BG2!n4!a4!n2!n8!c|^BG(\d{2})([A-Z]{4})(\d{4})(\d{2})([A-Za-z0-9]{8})$|22|0|3|4|7|2011-06-20|1 +CR|Costa Rica|1026284066|15202001026284066|3!n14!n|^(\d{3})(\d{14})$|7|CR91202001026284066|CR2!n3!n14!n|^CR(\d{2})(\d{3})(\d{14})$|21|0|2|||2012-05-29|0 +HR|Croatia|1001005-1863000160|10010051863000160|7!n10!n|^(\d{7})(\d{10})$|17|HR1210010051863000160|HR2!n7!n10!n|^HR(\d{2})(\d{7})(\d{10})$|21|0|6|||2011-06-20|1 +CY|Cyprus|1200527600|002001280000001200527600|3!n5!n16!c|^(\d{3})(\d{5})([A-Za-z0-9]{16})$|24|CY17002001280000001200527600|CY2!n3!n5!n16!c|^CY(\d{2})(\d{3})(\d{5})([A-Za-z0-9]{16})$|28|0|2|3|7|2011-06-20|1 +CZ|Czech Republic|19-2000145399/0800|08000000192000145399|4!n6!n10!n|^(\d{4})(\d{6})(\d{10})$|20|CZ6508000000192000145399|CZ2!n4!n6!n10!n|^CZ(\d{2})(\d{4})(\d{6})(\d{10})$|24|0|3|4|9|2011-06-20|1 +DK|Denmark|0040 0440116243, 6460 0001631634, 6471 0001000206|00400440116243, 64600001631634, 64710001000206|4!n9!n1!n|^(\d{4})(\d{9})(\d{1})$|14|DK5000400440116243|DK2!n4!n9!n1!n|^DK(\d{2})(\d{4})(\d{9})(\d{1})$|18|0|3|||2011-06-20|1 +FO|Faroe Islands|0040 0440116243, 6460 0001631634, 6471 0001000206|00400440116243, 64600001631634, 64710001000206|4!n9!n1!n|^(\d{4})(\d{9})(\d{1})$|14|FO2000400440116243|FO2!n4!n9!n1!n|^FO(\d{2})(\d{4})(\d{9})(\d{1})$|18|0|3|||2011-06-20|0 +GL|Greenland|0040 0440116243, 6460 0001631634, 6471 0001000206|00400440116243, 64600001631634, 64710001000206|4!n9!n1!n|^(\d{4})(\d{9})(\d{1})$|14|GL2000400440116243|GL2!n4!n9!n1!n|^GL(\d{2})(\d{4})(\d{9})(\d{1})$|18|0|3|||2011-06-20|0 +DO|Dominican Republic|1212453611324|AGR00000001212453611324|4!c20!n|^([A-Za-z0-9]{4})(\d{20})$|24|DO28BAGR00000001212453611324|DO2!n4!c20!n|^DO(\d{2})([A-Za-z0-9]{4})(\d{20})$|28|0|3|||2011-06-20|0 +EE|Estonia|221020145685|2200221020145685|2!n2!n11!n1!n|^(\d{2})(\d{2})(\d{11})(\d{1})$|16|EE382200221020145685|EE2!n2!n2!n11!n1!n|^EE(\d{2})(\d{2})(\d{2})(\d{11})(\d{1})$|20|0|1|||2011-06-20|1 +FI|Finland|123456-785|12345600000785|6!n7!n1!n|^(\d{6})(\d{7})(\d{1})$|14|FI2112345600000785|FI2!n6!n7!n1!n|^FI(\d{2})(\d{6})(\d{7})(\d{1})$|18|0|2|||2013-08-05|1 +FR|France|20041 01005 0500013M026 06|20041010050500013M02606|5!n5!n11!c2!n|^(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|23|FR1420041010050500013M02606|FR2!n5!n5!n11!c2!n|^FR(\d{2})(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|27|0|4|5|9|2013-08-28|1 +BL|Saint Barthelemy|20041 01005 0500013M026 06|20041010050500013M02606|5!n5!n11!c2!n|^(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|23|BL9820041010050500013M02606|BL2!n5!n5!n11!c2!n|^BL(\d{2})(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|27|0|4|5|9|2013-02-08|0 +GF|French Guyana|20041 01005 0500013M026 06|20041010050500013M02606|5!n5!n11!c2!n|^(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|23|GF4120041010050500013M02606|GF2!n5!n5!n11!c2!n|^GF(\d{2})(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|27|0|4|5|9|2013-08-28|1 +GP|Guadelope|20041 01005 0500013M026 06|20041010050500013M02606|5!n5!n11!c2!n|^(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|23|GP1120041010050500013M02606|GP2!n5!n5!n11!c2!n|^GP(\d{2})(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|27|0|4|5|9|2013-08-28|1 +MF|Saint Martin (French Part)|20041 01005 0500013M026 06|20041010050500013M02606|5!n5!n11!c2!n|^(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|23|MF9820041010050500013M02606|MF2!n5!n5!n11!c2!n|^MF(\d{2})(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|27|0|4|5|9|2013-02-08|0 +MQ|Martinique|20041 01005 0500013M026 06|20041010050500013M02606|5!n5!n11!c2!n|^(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|23|MQ5120041010050500013M02606|MQ2!n5!n5!n11!c2!n|^MQ(\d{2})(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|27|0|4|5|9|2013-08-28|1 +RE|Reunion|20041 01005 0500013M026 06|20041010050500013M02606|5!n5!n11!c2!n|^(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|23|RE4220041010050500013M02606|RE2!n5!n5!n11!c2!n|^RE(\d{2})(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|27|0|4|5|9|2013-08-28|1 +PF|French Polynesia|20041 01005 0500013M026 06|20041010050500013M02606|5!n5!n11!c2!n|^(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|23|PF5720041010050500013M02606|PF2!n5!n5!n11!c2!n|^PF(\d{2})(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|27|0|4|5|9|2011-06-20|0 +TF|French Southern Territories|20041 01005 0500013M026 06|20041010050500013M02606|5!n5!n11!c2!n|^(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|23|TF2120041010050500013M02606|TF2!n5!n5!n11!c2!n|^TF(\d{2})(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|27|0|4|5|9|2011-06-20|0 +YT|Mayotte|20041 01005 0500013M026 06|20041010050500013M02606|5!n5!n11!c2!n|^(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|23|YT3120041010050500013M02606|YT2!n5!n5!n11!c2!n|^YT(\d{2})(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|27|0|4|5|9|2013-08-28|1 +NC|New Caledonia|20041 01005 0500013M026 06|20041010050500013M02606|5!n5!n11!c2!n|^(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|23|NC8420041010050500013M02606|NC2!n5!n5!n11!c2!n|^NC(\d{2})(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|27|0|4|5|9|2011-06-20|0 +PM|Saint Pierre et Miquelon|20041 01005 0500013M026 06|20041010050500013M02606|5!n5!n11!c2!n|^(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|23|PM3620041010050500013M02606|PM2!n5!n5!n11!c2!n|^PM(\d{2})(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|27|0|4|5|9|2013-08-28|1 +WF|Wallis and Futuna Islands|20041 01005 0500013M026 06|20041010050500013M02606|5!n5!n11!c2!n|^(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|23|WF9120041010050500013M02606|WF2!n5!n5!n11!c2!n|^WF(\d{2})(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|27|0|4|5|9|2011-06-20|0 +GE|Georgia|0000000101904917|NB0000000101904917|2!a16!n|^([A-Z]{2})(\d{16})$|18|GE29NB0000000101904917|GE2!n2!a16!n|^GE(\d{2})([A-Z]{2})(\d{16})$|22|0|1|||2011-06-20|0 +DE|Germany|37040044-532013000|370400440532013000|8!n10!n|^(\d{8})(\d{10})$|18|DE89370400440532013000|DE2!n8!n10!n|^DE(\d{2})(\d{8})(\d{10})$|22|0|7|||2011-06-20|1 +GI|Gibraltar|0000 00007099 453|NWBK000000007099453|4!a15!c|^([A-Z]{4})([A-Za-z0-9]{15})$|19|GI75NWBK000000007099453|GI2!n4!a15!c|^GI(\d{2})([A-Z]{4})([A-Za-z0-9]{15})$|23|0|3|||2011-06-20|1 +GR|Greece|01250000000012300695|01101250000000012300695|3!n4!n16!c|^(\d{3})(\d{4})([A-Za-z0-9]{16})$|23|GR1601101250000000012300695|GR2!n3!n4!n16!c|^GR(\d{2})(\d{3})(\d{4})([A-Za-z0-9]{16})$|27|0|2|3|6|2011-06-20|1 +GT|Guatemala|01020000001210029690|TRAJ01020000001210029690|4!c20!c|^([A-Za-z0-9]{4})([A-Za-z0-9]{20})$|24|GT82TRAJ01020000001210029690|GT2!n4!c20!c|^GT(\d{2})([A-Za-z0-9]{4})([A-Za-z0-9]{20})$|28|0|3|||2012-05-29|0 +HU|Hungary|11773016-11111018-00000000|117730161111101800000000|3!n4!n1!n15!n1!n|^(\d{3})(\d{4})(\d{1})(\d{15})(\d{1})$|24|HU42117730161111101800000000|HU2!n3!n4!n1!n15!n1!n|^HU(\d{2})(\d{3})(\d{4})(\d{1})(\d{15})(\d{1})$|28|0|2|3|6|2011-06-20|1 +IS|Iceland|0159-26-007654-551073-0339|0159260076545510730339|4!n2!n6!n10!n|^(\d{4})(\d{2})(\d{6})(\d{10})$|22|IS140159260076545510730339|IS2!n4!n2!n6!n10!n|^IS(\d{2})(\d{4})(\d{2})(\d{6})(\d{10})$|26|0|3|6|11|2011-06-20|1 +IE|Ireland|93-11-52 12345678|AIBK93115212345678|4!a6!n8!n|^([A-Z]{4})(\d{6})(\d{8})$|18|IE29AIBK93115212345678|IE2!n4!a6!n8!n|^IE(\d{2})([A-Z]{4})(\d{6})(\d{8})$|22|0|3|4|9|2011-06-20|1 +IL|Israel|10-800-99999999|100800000099999000|3!n3!n13!n|^(\d{3})(\d{3})(\d{13})$|19|IL620108000000099999999|IL2!n3!n3!n13!n|^IL(\d{2})(\d{3})(\d{3})(\d{13})$|23|0|2|3|5|2011-06-20|0 +IT|Italy|X 05428 11101 000000123456|X0542811101000000123456|1!a5!n5!n12!c|^([A-Z]{1})(\d{5})(\d{5})([A-Za-z0-9]{12})$|23|IT60X0542811101000000123456|IT2!n1!a5!n5!n12!c|^IT(\d{2})([A-Z]{1})(\d{5})(\d{5})([A-Za-z0-9]{12})$|27|0|5|6|10|2011-06-20|1 +JO|Jordan|1310000302|CBJO0010000000000131000302|4!a4!n18!c|^([A-Z]{4})(\d{4})([A-Za-z0-9]{18})$|26|JO94CBJO0010000000000131000302|JO2!n4!a4!n18!c|^JO(\d{2})([A-Z]{4})(\d{4})([A-Za-z0-9]{18})$|30|0|3|4|7|2014-06-05|0 +KZ|Kazakhstan|KZ86 125K ZT50 0410 0100|125KZT5004100100|3!n13!c|^(\d{3})([A-Za-z0-9]{13})$|16|KZ07|KZ2!n3!n13!c|^KZ(\d{2})(\d{3})([A-Za-z0-9]{13})$||0|2|||2014-06-05|0 +KW|Kuwait|CBKU0000000000001234560101|CBKU0000000000001234560101|4!a22!c|^([A-Z]{4})([A-Za-z0-9]{22})$|26|KW81CBKU0000000000001234560101|KW2!n4!a22!n|^KW(\d{2})([A-Z]{4})(\d{22})$|30|0|3|||2011-06-20|0 +LV|Latvia|BANK 0000 4351 9500 1|BANK0000435195001|4!a13!c|^([A-Z]{4})([A-Za-z0-9]{13})$|17|LV80BANK0000435195001|LV2!n4!a13!c|^LV(\d{2})([A-Z]{4})([A-Za-z0-9]{13})$|21|0|3|||2011-06-20|1 +LB|Lebanon|01 001 901229114|0999 0000 0001 0019 0122 9114|4!n20!c|^(\d{4})([A-Za-z0-9]{20})$|24|LB62099900000001001901229114|LB2!n4!n20!c|^LB(\d{2})(\d{4})([A-Za-z0-9]{20})$|28|0|3|||2011-06-20|0 +LI|Liechtenstein|8810 2324013AA|088100002324013AA|5!n12!c|^(\d{5})([A-Za-z0-9]{12})$|19|LI21088100002324013AA|LI2!n5!n12!c|^LI(\d{2})(\d{5})([A-Za-z0-9]{12})$|21|0|4|||2012-05-29|1 +LT|Lithuania|1000 0111 0100 1000|10000011101001000|5!n11!n|^(\d{5})(\d{11})$|16|LT121000011101001000|LT2!n5!n11!n|^LT(\d{2})(\d{5})(\d{11})$|20|0|4|||2011-06-20|1 +LU|Luxembourg|0019 4006 4475 0000|0019400644750000|3!n13!c|^(\d{3})([A-Za-z0-9]{13})$|16|LU280019400644750000|LU2!n3!n13!c|^LU(\d{2})(\d{3})([A-Za-z0-9]{13})$|20|0|2|||2011-06-20|1 +MK|Macedonia|300 0000000424 25|250120000058984|3!n10!c2!n|^(\d{3})([A-Za-z0-9]{10})(\d{2})$|15|MK07250120000058984|MK2!n3!n10!c2!n|^MK(\d{2})(\d{3})([A-Za-z0-9]{10})(\d{2})$|19|0|2|||2012-05-29|0 +MT|Malta|12345MTLCAST001S|MALT011000012345MTLCAST001S|4!a5!n18!c|^([A-Z]{4})(\d{5})([A-Za-z0-9]{18})$|27|MT84MALT011000012345MTLCAST001S|MT2!n4!a5!n18!c|^MT(\d{2})([A-Z]{4})(\d{5})([A-Za-z0-9]{18})$|31|0|3|4|8|2011-06-20|1 +MR|Mauritania|00020 00101 00001234567 53|00020001010000123456753|5!n5!n11!n2!n|^(\d{5})(\d{5})(\d{11})(\d{2})$|23|MR1300020001010000123456753|MR135!n5!n11!n2!n|^MR13(\d{5})(\d{5})(\d{11})(\d{2})$|27|0|4|5|9|2011-06-20|0 +MU|Mauritius|BOMM 0101 1010 3030 0200 000M UR|BOMM0101101030300200000MUR|4!a2!n2!n12!n3!n3!a|^([A-Z]{4})(\d{2})(\d{2})(\d{12})(\d{3})([A-Z]{3})$|26|MU17BOMM0101101030300200000MUR|MU2!n4!a2!n2!n12!n3!n3!a|^MU(\d{2})([A-Z]{4})(\d{2})(\d{2})(\d{12})(\d{3})([A-Z]{3})$|30|0|5|6|7|2011-06-20|0 +MD|Moldova|00225100013104168|AG000225100013104168|2!c18!c|^([A-Za-z0-9]{2})([A-Za-z0-9]{18})$|20|MD24AG000225100013104168|MD2!n20!c|^MD(\d{2})([A-Za-z0-9]{20})$|24|0|1|||2012-09-09|0 +MC|Monaco|0011111000h|11222 00001 01234567890 30|5!n5!n11!c2!n|^(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|23|MC5811222000010123456789030|MC2!n5!n5!n11!c2!n|^MC(\d{2})(\d{5})(\d{5})([A-Za-z0-9]{11})(\d{2})$|27|0|4|5|9|2011-06-20|1 +ME|Montenegro|505 0000123456789 51|505000012345678951|3!n13!n2!n|^(\d{3})(\d{13})(\d{2})$|18|ME25505000012345678951|ME2!n3!n13!n2!n|^ME(\d{2})(\d{3})(\d{13})(\d{2})$|22|0|2|||2011-06-20|0 +NL|The Netherlands|041 71 64 300|ABNA0417164300|4!a10!n|^([A-Z]{4})(\d{10})$|14|NL91ABNA0417164300|NL2!n4!a10!n|^NL(\d{2})([A-Z]{4})(\d{10})$|18|0|3|4|3|2013-06-20|1 +NO|Norway|8601 11 17947|86011117947|4!n6!n1!n|^(\d{4})(\d{6})(\d{1})$|11|NO9386011117947|NO2!n4!n6!n1!n|^NO(\d{2})(\d{4})(\d{6})(\d{1})$|15|0|3|||2011-06-20|1 +PK|Pakistan|00260101036360|SCBL0000001123456702|4!a16!c|^([A-Z]{4})([A-Za-z0-9]{16})$|20|PK36SCBL0000001123456702|PK2!n4!a16!c|^PK(\d{2})([A-Z]{4})([A-Za-z0-9]{16})$|24|0|3|||2012-05-29|0 +PL|Poland|61 1090 1014 0000 0712 1981 2874|109010140000071219812874|8!n16!n|^(\d{8})(\d{16})$|24|PL61109010140000071219812874|PL2!n8!n16n|^PL(\d{2})(\d{8})(\d{1,16})$|28|0|7|||2011-06-20|1 +PS|Palestine|400123456702|PALS000000000400123456702|4!a21!c|^([A-Z]{4})([A-Za-z0-9]{21})$|25|PS92PALS000000000400123456702|PS2!n4!a21!c|^PS(\d{2})([A-Z]{4})([A-Za-z0-9]{21})$|29|0|3|||2013-09-05|0 +PT|Portugal|0002.0123.12345678901.54|000201231234567890154|4!n4!n11!n2!n|^(\d{4})(\d{4})(\d{11})(\d{2})$|21|PT50000201231234567890154|PT2!n4!n4!n11!n2!n|^PT(\d{2})(\d{4})(\d{4})(\d{11})(\d{2})$|25|0|3|4|7|2013-09-05|1 +QA|Qatar|QA58DOHB00001234567890ABCDEFG|DOHB00001234567890ABCDEFG|4!a4!n17!c|^([A-Z]{4})(\d{4})([A-Za-z0-9]{17})$|29|QA58DOHB00001234567890ABCDEFG|QA2!n4!a4!n17!c|^QA(\d{2})([A-Z]{4})(\d{4})([A-Za-z0-9]{17})$|29|0|3|4|7|2014-06-05|0 +RO|Romania|AAAA 1B31 0075 9384 0000|AAAA1B31007593840000|4!a16!c|^([A-Z]{4})([A-Za-z0-9]{16})$|20|RO49AAAA1B31007593840000|RO2!n4!a16!c|^RO(\d{2})([A-Z]{4})([A-Za-z0-9]{16})$|24|0|3|||2011-06-20|1 +SM|San Marino|U032 2509 8000 0000 0270 100|U0322509800000000270100|1!a5!n5!n12!c|^([A-Z]{1})(\d{5})(\d{5})([A-Za-z0-9]{12})$|23|SM86U0322509800000000270100|SM2!n1!a5!n5!n12!c|^SM(\d{2})([A-Z]{1})(\d{5})(\d{5})([A-Za-z0-9]{12})$|27|0|5|6|10|2011-06-20|1 +SA|Saudi Arabia|608010167519|80000000608010167519|2!n18!c|^(\d{2})([A-Za-z0-9]{18})$|20|SA0380000000608010167519|SA2!n2!n18!c|^SA(\d{2})(\d{2})([A-Za-z0-9]{18})$|24|0|1|||2012-05-29|0 +RS|Serbia|260-0056010016113-79|260005601001611379|3!n13!n2!n|^(\d{3})(\d{13})(\d{2})$|18|RS35260005601001611379|RS2!n3!n13!n2!n|^RS(\d{2})(\d{3})(\d{13})(\d{2})$|22|0|2|||2011-06-20|0 +SK|Slovak Republic|19-8742637541/1200|12000000198742637541|4!n6!n10!n|^(\d{4})(\d{6})(\d{10})$|20|SK3112000000198742637541|SK2!n4!n6!n10!n|^SK(\d{2})(\d{4})(\d{6})(\d{10})$|24|0|3|4|9|2011-06-20|1 +SI|Slovenia|2633 0001 2039 086|263300012039086|5!n8!n2!n|^(\d{5})(\d{8})(\d{2})$|15|SI56191000000123438|SI2!n5!n8!n2!n|^SI(\d{2})(\d{5})(\d{8})(\d{2})$|19|0|1|2|4|2012-09-09|1 +ES|Spain|2100 0418 45 0200051332|21000418450200051332|4!n4!n1!n1!n10!n|^(\d{4})(\d{4})(\d{1})(\d{1})(\d{10})$|20|ES9121000418450200051332|ES2!n4!n4!n1!n1!n10!n|^ES(\d{2})(\d{4})(\d{4})(\d{1})(\d{1})(\d{10})$|24|0|3|4|7|2013-09-05|1 +SE|Sweden|1234 12 3456 1|5000 0000 0583 9825 7466|3!n16!n1!n|^(\d{3})(\d{16})(\d{1})$|20|SE4550000000058398257466|SE2!n3!n16!n1!n|^SE(\d{2})(\d{3})(\d{16})(\d{1})$|24|0|2|||2011-06-20|1 +CH|Switzerland|762 1162-3852.957|00762011623852957|5!n12!c|^(\d{5})([A-Za-z0-9]{12})$|17|CH9300762011623852957|CH2!n5!n12!c|^CH(\d{2})(\d{5})([A-Za-z0-9]{12})$|21|0|4|||2011-06-20|1 +TN|Tunisia|10 006 0351835984788 31|10006035183598478831|2!n3!n13!n2!n|^(\d{2})(\d{3})(\d{13})(\d{2})$|20|TN5910006035183598478831|TN592!n3!n13!n2!n|^TN59(\d{2})(\d{3})(\d{13})(\d{2})$|24|0|1|2|4|2011-06-20|0 +TR|Turkey|0061 01299 1234567890123456789|0006100519786457841326|5!n1!c16!c|^(\d{5})([A-Za-z0-9]{1})([A-Za-z0-9]{16})$|22|TR330006100519786457841326|TR2!n5!n1!c16!c|^TR(\d{2})(\d{5})([A-Za-z0-9]{1})([A-Za-z0-9]{16})$|26|0|4|||2011-06-20|0 +AE|United Arab Emirates|1234567890123456|0331234567890123456|3!n16!n|^(\d{3})(\d{16})$|19|AE070331234567890123456|AE2!n3!n16!n|^AE(\d{2})(\d{3})(\d{16})$|23|0|2|||2011-06-20|0 +GB|United Kingdom|60-16-13 31926819|NWBK60161331926819|4!a6!n8!n|^([A-Z]{4})(\d{6})(\d{8})$|18|GB29NWBK60161331926819|GB2!n4!a6!n8!n|^GB(\d{2})([A-Z]{4})(\d{6})(\d{8})$|22|0|3|4|9|2011-06-20|1 +VG|British Virgin Islands|00000 12 345 678 901|VPVG0000012345678901|4!a16!n|^([A-Z]{4})(\d{16})$|20|VG96VPVG0000012345678901|VG2!n4!a16!n|^VG(\d{2})([A-Z]{4})(\d{16})$|24|0|3|||2012-05-29|0 From 685b8d722da219fff1e4f913acf2c3fac6d21dd8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Feb 2015 16:46:37 +0100 Subject: [PATCH 44/63] Fix: Bad hook name --- htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php | 2 +- htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/fr_FR/admin.lang | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 29bd483b39b..ddd10e56457 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -200,7 +200,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $hookmanager->initHooks(array('pdfgeneration')); $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); global $action; - $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $nblignes = count($object->lines); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 6f9449f209d..1d2085dcbf7 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -624,7 +624,7 @@ Permission181=Read supplier orders Permission182=Create/modify supplier orders Permission183=Validate supplier orders Permission184=Approve supplier orders -Permission185=Order supplier orders +Permission185=Order or cancel supplier orders Permission186=Receive supplier orders Permission187=Close supplier orders Permission188=Cancel supplier orders diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 355878e9901..4475fe60771 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -631,7 +631,7 @@ Permission181=Consulter les commandes fournisseurs Permission182=Créer/modifier les commandes fournisseurs Permission183=Valider les commandes fournisseurs Permission184=Approuver les commandes fournisseurs -Permission185=Passer les commandes fournisseurs +Permission185=Passer les commandes fournisseurs et les annuler Permission186=Accuser réception des commandes fournisseurs Permission187=Clôturer les commandes fournisseurs Permission188=Annuler les commandes fournisseurs From f652cf4e97b0aec7c5a9c7b6cd33dcec75783aa4 Mon Sep 17 00:00:00 2001 From: frederic34 Date: Tue, 17 Feb 2015 17:02:38 +0100 Subject: [PATCH 45/63] Add translation for IBAN Valid or not --- htdocs/compta/bank/bankid_fr.php | 10 +++++++++- htdocs/langs/en_US/banks.lang | 2 ++ htdocs/societe/rib.php | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/bank/bankid_fr.php b/htdocs/compta/bank/bankid_fr.php index 03f0babe75d..1b3d5b89d0d 100644 --- a/htdocs/compta/bank/bankid_fr.php +++ b/htdocs/compta/bank/bankid_fr.php @@ -245,7 +245,15 @@ if (($_GET["id"] || $_GET["ref"]) && $action != 'edit') if ($account->getCountryCode() == 'IN') $bickey="SWIFT"; print '

'; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 10a5f5b3c14..7358f25e6f4 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -33,6 +33,8 @@ AllTime=From start Reconciliation=Reconciliation RIB=Bank Account Number IBAN=IBAN number +IbanValid=Valid IBAN +IbanNotValid=Not Valid IBAN BIC=BIC/SWIFT number StandingOrders=Standing orders StandingOrder=Standing order diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index a615577a8c4..ad3eea735fb 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -296,9 +296,9 @@ if ($socid && $action != 'edit' && $action != "create") print ''; From ad67fe50a3c7ae642c4d8f17161fe659aafc3b33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Feb 2015 17:21:41 +0100 Subject: [PATCH 46/63] Correct management when delivery date is universal time format. --- .../supplier_order/pdf/pdf_muscadet.modules.php | 4 +++- htdocs/fourn/class/fournisseur.commande.class.php | 6 +++--- htdocs/fourn/commande/card.php | 10 +++++++--- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 2 ++ .../install/mysql/tables/llx_commande_fournisseur.sql | 4 ++-- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index ddd10e56457..e628013cb3e 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -1011,7 +1011,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } $pdf->SetTextColor(0,0,60); - if (! empty($object->date_livraison)) $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : " . dol_print_date($object->date_livraison,"day",false,$outputlangs,true), '', 'R'); + $usehourmin='day'; + if ( empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin='dayhour'; + if (! empty($object->date_livraison)) $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : " . dol_print_date($object->date_livraison,$usehourmin,false,$outputlangs,true), '', 'R'); $posy+=5; $pdf->SetTextColor(0,0,60); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index d95816a1511..6ba464b0a18 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1609,9 +1609,9 @@ class CommandeFournisseur extends CommonOrder /** * Set the planned delivery date * - * @param User $user Objet utilisateur qui modifie - * @param timestamp $date_livraison Date de livraison - * @return int <0 si ko, >0 si ok + * @param User $user Objet user making change + * @param timestamp $date_livraison Planned delivery date + * @return int <0 if KO, >0 if OK */ function set_date_livraison($user, $date_livraison) { diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 022b46f6a9b..ef78a9981c1 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -144,7 +144,7 @@ if ($action == 'setbankaccount' && $user->rights->fournisseur->commande->creer) // date de livraison if ($action == 'setdate_livraison' && $user->rights->fournisseur->commande->creer) { - $datelivraison=dol_mktime(0, 0, 0, GETPOST('liv_month','int'), GETPOST('liv_day','int'),GETPOST('liv_year','int')); + $datelivraison=dol_mktime(GETPOST('liv_hour','int'), GETPOST('liv_min','int'), GETPOST('liv_sec','int'), GETPOST('liv_month','int'), GETPOST('liv_day','int'),GETPOST('liv_year','int')); $result=$object->set_date_livraison($user,$datelivraison); if ($result < 0) @@ -1588,13 +1588,17 @@ elseif (! empty($object->id)) print '
'; print ''; print ''; - $form->select_date($object->date_livraison?$object->date_livraison:-1,'liv_','','','',"setdate_livraison"); + $usehourmin=0; + if (! empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin=1; + $form->select_date($object->date_livraison?$object->date_livraison:-1,'liv_',$usehourmin,$usehourmin,'',"setdate_livraison"); print ''; print ''; } else { - print $object->date_livraison ? dol_print_date($object->date_livraison,'daytext') : ' '; + $usehourmin='day'; + if (! empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin='dayhour'; + print $object->date_livraison ? dol_print_date($object->date_livraison, $usehourmin) : ' '; } print ''; diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index 22a65167e6f..0a9213a3d73 100755 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -210,6 +210,8 @@ ALTER TABLE llx_product_price ADD INDEX idx_product_price_fk_product (fk_produc DELETE from llx_product_price where fk_product NOT IN (SELECT rowid from llx_product); ALTER TABLE llx_product_price ADD CONSTRAINT fk_product_price_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); +ALTER TABLE llx_commande_fournisseur MODIFY COLUMN date_livraison datetime; + ALTER TABLE llx_commande_fournisseur ADD COLUMN fk_account integer AFTER date_livraison; ALTER TABLE llx_facture_fourn ADD COLUMN fk_account integer AFTER fk_projet; diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql index ff87110c72a..f9f440d0db4 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql @@ -55,11 +55,11 @@ create table llx_commande_fournisseur note_public text, model_pdf varchar(255), - date_livraison date default NULL, + date_livraison datetime default NULL, fk_account integer, -- bank account fk_cond_reglement integer, -- condition de reglement fk_mode_reglement integer, -- mode de reglement - fk_input_method integer default 0, + fk_input_method integer default 0, import_key varchar(14), extraparams varchar(255) -- for stock other parameters with json format From 1e1543403b7277da9bb4ee7d89d6cac366da6678 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Feb 2015 19:49:17 +0100 Subject: [PATCH 47/63] New: Add option SUPPLIER_ORDER_AUTOADD_USER_CONTACT to automatically set user approving as contact following supplier order. --- htdocs/commande/card.php | 83 +++++++++++-------- htdocs/core/class/commonobject.class.php | 4 +- .../class/fournisseur.commande.class.php | 15 +++- htdocs/fourn/commande/card.php | 14 ++-- 4 files changed, 72 insertions(+), 44 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 918244528cc..bda67f809fa 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -137,8 +137,10 @@ if (empty($reshook)) } // Reopen a closed order - else if ($action == 'reopen' && $user->rights->commande->creer) { - if ($object->statut == 3) { + else if ($action == 'reopen' && $user->rights->commande->creer) + { + if ($object->statut == 3) + { $result = $object->set_reopen($user); if ($result > 0) { @@ -153,21 +155,26 @@ if (empty($reshook)) } // Suppression de la commande - else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->commande->supprimer) { + else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->commande->supprimer) + { $result = $object->delete($user); - if ($result > 0) { + if ($result > 0) + { header('Location: index.php'); exit; } - else { + else + { setEventMessage($object->error, 'errors'); } } // Remove a product line - else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->commande->creer) { + else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->commande->creer) + { $result = $object->deleteline($lineid); - if ($result > 0) { + if ($result > 0) + { // Define output language $outputlangs = $langs; $newlang = ''; @@ -194,12 +201,14 @@ if (empty($reshook)) } // Categorisation dans projet - else if ($action == 'classin' && $user->rights->commande->creer) { + else if ($action == 'classin' && $user->rights->commande->creer) + { $object->setProject(GETPOST('projectid')); } // Add order - else if ($action == 'add' && $user->rights->commande->creer) { + else if ($action == 'add' && $user->rights->commande->creer) + { $datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); @@ -239,7 +248,8 @@ if (empty($reshook)) $object->contactid = GETPOST('contactid'); // If creation from another object of another module (Example: origin=propal, originid=1) - if (! empty($origin) && ! empty($originid)) { + if (! empty($origin) && ! empty($originid)) + { // Parse element/subelement (ex: project_task) $element = $subelement = $origin; if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) { @@ -301,37 +311,37 @@ if (empty($reshook)) for($i = 0; $i < $num; $i ++) { - $label = (! empty($lines [$i]->label) ? $lines [$i]->label : ''); - $desc = (! empty($lines [$i]->desc) ? $lines [$i]->desc : $lines [$i]->libelle); - $product_type = (! empty($lines [$i]->product_type) ? $lines [$i]->product_type : 0); + $label = (! empty($lines[$i]->label) ? $lines[$i]->label : ''); + $desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : $lines[$i]->libelle); + $product_type = (! empty($lines[$i]->product_type) ? $lines[$i]->product_type : 0); // Dates // TODO mutualiser - $date_start = $lines [$i]->date_debut_prevue; - if ($lines [$i]->date_debut_reel) - $date_start = $lines [$i]->date_debut_reel; - if ($lines [$i]->date_start) - $date_start = $lines [$i]->date_start; - $date_end = $lines [$i]->date_fin_prevue; - if ($lines [$i]->date_fin_reel) - $date_end = $lines [$i]->date_fin_reel; - if ($lines [$i]->date_end) - $date_end = $lines [$i]->date_end; + $date_start = $lines[$i]->date_debut_prevue; + if ($lines[$i]->date_debut_reel) + $date_start = $lines[$i]->date_debut_reel; + if ($lines[$i]->date_start) + $date_start = $lines[$i]->date_start; + $date_end = $lines[$i]->date_fin_prevue; + if ($lines[$i]->date_fin_reel) + $date_end = $lines[$i]->date_fin_reel; + if ($lines[$i]->date_end) + $date_end = $lines[$i]->date_end; // Reset fk_parent_line for no child products and special product - if (($lines [$i]->product_type != 9 && empty($lines [$i]->fk_parent_line)) || $lines [$i]->product_type == 9) { + if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) { $fk_parent_line = 0; } // Extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines [$i], 'fetch_optionals')) // For avoid conflicts if + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if // trigger used { - $lines [$i]->fetch_optionals($lines [$i]->rowid); - $array_option = $lines [$i]->array_options; + $lines[$i]->fetch_optionals($lines[$i]->rowid); + $array_option = $lines[$i]->array_options; } - $result = $object->addline($desc, $lines [$i]->subprice, $lines [$i]->qty, $lines [$i]->tva_tx, $lines [$i]->localtax1_tx, $lines [$i]->localtax2_tx, $lines [$i]->fk_product, $lines [$i]->remise_percent, $lines [$i]->info_bits, $lines [$i]->fk_remise_except, 'HT', 0, $date_start, $date_end, $product_type, $lines [$i]->rang, $lines [$i]->special_code, $fk_parent_line, $lines [$i]->fk_fournprice, $lines [$i]->pa_ht, $label, $array_option); + $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $date_start, $date_end, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_option); if ($result < 0) { $error ++; @@ -339,7 +349,7 @@ if (empty($reshook)) } // Defined the new fk_parent_line - if ($result > 0 && $lines [$i]->product_type == 9) { + if ($result > 0 && $lines[$i]->product_type == 9) { $fk_parent_line = $result; } } @@ -385,8 +395,10 @@ if (empty($reshook)) } // Insert default contacts if defined - if ($object_id > 0) { - if (GETPOST('contactid')) { + if ($object_id > 0) + { + if (GETPOST('contactid')) + { $result = $object->add_contact(GETPOST('contactid'), 'CUSTOMER', 'external'); if ($result < 0) { setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors'); @@ -399,7 +411,8 @@ if (empty($reshook)) } // End of object creation, we show it - if ($object_id > 0 && ! $error) { + if ($object_id > 0 && ! $error) + { $db->commit(); header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object_id); exit(); @@ -1594,7 +1607,8 @@ if ($action == 'create' && $user->rights->commande->creer) /* * Confirmation de la validation */ - if ($action == 'validate') { + if ($action == 'validate') + { // on verifie si l'objet est en numerotation provisoire $ref = substr($object->ref, 1, 4); if ($ref == 'PROV') { @@ -1604,7 +1618,8 @@ if ($action == 'create' && $user->rights->commande->creer) } $text = $langs->trans('ConfirmValidateOrder', $numref); - if (! empty($conf->notification->enabled)) { + if (! empty($conf->notification->enabled)) + { require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; $notify = new Notify($db); $text .= '
'; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index aed2aa3b224..b886a382b1e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -175,8 +175,8 @@ abstract class CommonObject /** * Add a link between element $this->element and a contact * - * @param int $fk_socpeople Id of contact to link - * @param int $type_contact Type of contact (code or id). For example: SALESREPFOLL + * @param int $fk_socpeople Id of thirdparty contact (if source = 'external') or id of user (if souce = 'internal') to link + * @param int $type_contact Type of contact (code or id). Must be if or code found into table llx_c_type_contact. For example: SALESREPFOLL * @param int $source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user) * @param int $notrigger Disable all triggers * @return int <0 if KO, >0 if OK diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 64131be840b..2914ca95620 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -613,7 +613,7 @@ class CommandeFournisseur extends CommonOrder } /** - * Accept an order + * Approve a supplier order * * @param User $user Object user * @param int $idwarehouse Id of warhouse for stock change @@ -659,6 +659,15 @@ class CommandeFournisseur extends CommonOrder { $this->log($user, 2, time()); // Statut 2 + if (! empty($conf->global->SUPPLIER_ORDER_AUTOADD_USER_CONTACT)) + { + $result=$this->add_contact($user->id, 'SALESREPFOLL', 'internal', 1); + if ($result < 0) + { + $error++; + } + } + // If stock is incremented on validate order, we must increment it if (! $error && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER)) { @@ -967,8 +976,8 @@ class CommandeFournisseur extends CommonOrder dol_syslog(get_class($this)."::create", LOG_DEBUG); if ($this->db->query($sql)) { - // On logue creation pour historique - $this->log($user, 0, time()); + // Add entry into log + $this->log($user, 0, $now); if (! $error) { diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index ed276d7b328..f449c7f1098 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2014 Juanjo Menent @@ -1601,13 +1601,13 @@ elseif (! empty($object->id)) } print ''; - + // Delai livraison jours print '
'; print ''; print ''; print ''; - + // Project if (! empty($conf->projet->enabled)) { @@ -2232,8 +2232,12 @@ elseif (! empty($object->id)) if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->commande->creer)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_order_advance->validate))) { - print ''.$langs->trans('Validate').''; + $tmpbuttonlabel=$langs->trans('Validate'); + if ($user->rights->fournisseur->commande->approuver) $tmpbuttonlabel = $langs->trans("ValidateAndApprove"); + + print ''; + print $tmpbuttonlabel; + print ''; } } From 4bbbff8d69cdab251c1e1770d0ee59c76c1aa76d Mon Sep 17 00:00:00 2001 From: frederic34 Date: Tue, 17 Feb 2015 17:37:32 +0100 Subject: [PATCH 48/63] Add BIC/SWIFT Validation --- htdocs/compta/bank/bankid_fr.php | 10 +++++++++- htdocs/core/lib/bank.lib.php | 23 ++++++++++++++++++----- htdocs/langs/en_US/banks.lang | 6 ++++-- htdocs/societe/rib.php | 10 +++++++++- 4 files changed, 40 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/bank/bankid_fr.php b/htdocs/compta/bank/bankid_fr.php index 1b3d5b89d0d..f20d70ef14f 100644 --- a/htdocs/compta/bank/bankid_fr.php +++ b/htdocs/compta/bank/bankid_fr.php @@ -256,7 +256,15 @@ if (($_GET["id"] || $_GET["ref"]) && $action != 'edit') print ''; print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; print '
'.$langs->trans("IBAN").''.$account->iban.'
'.$account->iban . ' '; + if (! empty($account->iban)) { + if (! checkIbanForAccount($account)) { + print img_picto($langs->trans("NotValid"),'warning'); + } else { + print img_picto($langs->trans("IsValid"),'info'); + } + } + print '
'.$langs->trans("BIC").''.$account->bic.'
'.$langs->trans($ibankey).''.$account->iban.'
'.$account->iban.' '; + if (! empty($account->iban)) { + if (! checkIbanForAccount($account)) { + print img_picto($langs->trans("IbanNotValid"),'warning'); + } else { + print img_picto($langs->trans("IbanValid"),'info'); + } + } + print '
'.$langs->trans($bickey).''.$account->bic.'
'.$account->iban . ' '; if (! empty($account->iban)) { if (! checkIbanForAccount($account)) { - print img_picto($langs->trans("NotValid"),'warning'); + print img_picto($langs->trans("IbanNotValid"),'warning'); } else { - print img_picto($langs->trans("IsValid"),'info'); + print img_picto($langs->trans("IbanValid"),'info'); } } print '
'.$langs->trans('NbDaysToDelivery').' '.img_picto($langs->trans('DescNbDaysToDelivery'), 'info', 'style="cursor:help"').''.$object->getMaxDeliveryTimeDay($langs).'
'.$langs->trans($bickey).''.$account->bic.'
'.$account->bic.' '; + if (! empty($account->bic)) { + if (! checkSwiftForAccount($account)) { + print img_picto($langs->trans("SwiftNotValid"),'warning'); + } else { + print img_picto($langs->trans("SwiftValid"),'info'); + } + } + print '
'.$langs->trans("BankAccountDomiciliation").''; print nl2br($account->domiciliation); diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 36626ffcc94..db6b9d5b8aa 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -121,7 +121,24 @@ function bank_admin_prepare_head($object) complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank_admin', 'remove'); return $head; - } +} + +/** + * Check SWIFT informations for a bank account + * + * @param Account $account A bank account + * @return int True if informations are valid, false otherwise + */ +function checkSwiftForAccount($account) +{ + $swift = $account->bic; + if (eregi("^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$", $swift)) { + return true; + } else { + return false; + } + +} /** * Check IBAN number informations for a bank account @@ -134,13 +151,9 @@ function checkIbanForAccount($account) require_once DOL_DOCUMENT_ROOT.'/includes/php-iban/oophp-iban.php'; $iban = new Iban($account->iban); $check = $iban->Verify(); - //print '
'.print_r($iban, true).'
'; if ($check) { - //print '
OK
'; return true; } else { - //$suggest = $iban->MistranscriptionSuggestions($account->iban); - //print '
'.print_r($suggest, true).'
'; return false; } diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 7358f25e6f4..dfa0934ce70 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -33,9 +33,11 @@ AllTime=From start Reconciliation=Reconciliation RIB=Bank Account Number IBAN=IBAN number -IbanValid=Valid IBAN -IbanNotValid=Not Valid IBAN +IbanValid=IBAN is Valid +IbanNotValid=IBAN is Not Valid BIC=BIC/SWIFT number +SwiftValid=BIC/SWIFT is Valid +SwiftNotValid=BIC/SWIFT is Not Valid StandingOrders=Standing orders StandingOrder=Standing order Withdrawals=Withdrawals diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index ad3eea735fb..2a21f6cdc87 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -304,7 +304,15 @@ if ($socid && $action != 'edit' && $action != "create") print '
'.$langs->trans("BIC").''.$account->bic.'
'.$account->bic.' '; + if (! empty($account->bic)) { + if (! checkSwiftForAccount($account)) { + print img_picto($langs->trans("SwiftNotValid"),'warning'); + } else { + print img_picto($langs->trans("SwiftValid"),'info'); + } + } + print '
'.$langs->trans("BankAccountDomiciliation").''; print $account->domiciliation; From cbe49df090d5e34dcdef9254b36bb6cb38cca9c7 Mon Sep 17 00:00:00 2001 From: frederic34 Date: Wed, 18 Feb 2015 16:07:59 +0100 Subject: [PATCH 49/63] Add copyright --- COPYRIGHT | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/COPYRIGHT b/COPYRIGHT index 1631f85d321..cf31432caf0 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -21,6 +21,7 @@ GeoIP 1.4 LGPL-2.1+ Yes NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package) odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files PHPExcel 1.7.8 LGPL-2.1+ Yes Read/Write XLS files, read ODS files +php-iban 1.4.6 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests TCPDF 6.0.093 LGPL-3+ Yes PDF generation @@ -54,7 +55,10 @@ Copyright --------- Copyright (C) 2015 +- Laurent Destailleur - Marcos García +- Alexandre Spangaro +- Frederic France Copyright (C) 2014 - Laurent Destailleur @@ -67,6 +71,7 @@ Copyright (C) 2014 - Maxime Kohlhaas - Juanjo Menent - Alexandre Spangaro +- Frederic France Copyright (C) 2013 - Christophe Battarel From fe50a585fc75ea801e8a3b9ac09f73c93eca0c07 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Feb 2015 18:47:01 +0100 Subject: [PATCH 50/63] Fix: removed deprecated menu --- htdocs/install/mysql/migration/3.7.0-3.8.0.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 831185a9203..a697096874a 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -19,6 +19,10 @@ -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); +-- Remove menu entries of removed or renamed modules +DELETE FROM llx_menu where module = 'printipp'; + + ALTER TABLE llx_bank ADD INDEX idx_bank_num_releve(num_releve); From cc1d506614ca9e0267f3d6335cd71aa2b65c8719 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Feb 2015 21:01:17 +0100 Subject: [PATCH 51/63] Miscelaneous debug on barcode features. --- htdocs/admin/barcode.php | 5 +- htdocs/barcode/codeinit.php | 7 ++- htdocs/commande/contact.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 4 +- htdocs/core/modules/DolibarrModules.class.php | 7 ++- htdocs/cron/card.php | 2 +- htdocs/cron/info.php | 2 +- htdocs/install/upgrade2.php | 62 +++++++++++++------ htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/en_US/cron.lang | 1 + htdocs/langs/en_US/errors.lang | 2 +- 11 files changed, 61 insertions(+), 35 deletions(-) diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 11341f632a2..725d53dd1c3 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2013 Juanjo Menent * @@ -430,6 +430,5 @@ print ''; print "
"; -$db->close(); - llxFooter(); +$db->close(); diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index 19fb5c193bb..a2e24685017 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -27,6 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $langs->load("admin"); $langs->load("members"); $langs->load("errors"); +$langs->load("other"); // Choice of print year or current year. $now = dol_now(); @@ -229,7 +230,7 @@ if ($conf->societe->enabled) } else dol_print_error($db); - print $langs->trans("CurrentlyNWithoutBarCode", $nbno, $nbtotal, $langs->transnoentitiesnoconv("Thirdparties")).'
'."\n"; + print $langs->trans("CurrentlyNWithoutBarCode", $nbno, $nbtotal, $langs->transnoentitiesnoconv("ThirdParties")).'
'."\n"; print '
product->enabled || $conf->product->service) $nbno=$nbtotal=0; print_fiche_titre($langs->trans("BarcodeInitForProductsOrServices"),'','').'
'."\n"; - $sql ="SELECT count(rowid) as nb, fk_product_type"; + $sql ="SELECT count(rowid) as nb, fk_product_type, datec"; $sql.=" FROM ".MAIN_DB_PREFIX."product"; $sql.=" WHERE barcode IS NULL OR barcode = ''"; - $sql.=" GROUP BY fk_product_type"; + $sql.=" GROUP BY fk_product_type, datec"; $sql.=" ORDER BY datec"; $resql=$db->query($sql); if ($resql) diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index c36f19c166b..6a322e8681e 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -221,5 +221,5 @@ if ($id > 0 || ! empty($ref)) } -$db->close(); llxFooter(); +$db->close(); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 1ae0d46343b..c88c8375a41 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -217,8 +217,8 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) // Tools - $tmpentry=array('enabled'=>(! empty($conf->mailing->enabled) || ! empty($conf->export->enabled) || ! empty($conf->import->enabled) || ! empty($conf->opensurvey->enabled)), - 'perms'=>(! empty($user->rights->mailing->lire) || ! empty($user->rights->export->lire) || ! empty($user->rights->import->run) || ! empty($user->rights->opensurvey->read)), + $tmpentry=array('enabled'=>(! empty($conf->barcode->enabled) || ! empty($conf->mailing->enabled) || ! empty($conf->export->enabled) || ! empty($conf->import->enabled) || ! empty($conf->opensurvey->enabled)), + 'perms'=>(! empty($conf->barcode->enabled) || ! empty($user->rights->mailing->lire) || ! empty($user->rights->export->lire) || ! empty($user->rights->import->run) || ! empty($user->rights->opensurvey->read)), 'module'=>'mailing|export|import|opensurvey'); $showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal); if ($showmode) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 91b6e57a9b5..045bb1ddbcf 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -193,7 +193,9 @@ abstract class DolibarrModules * Inserts all informations into database * * @param string[] $array_sql SQL requests to be executed when enabling module - * @param string $options String with options when disabling module ('newboxdefonly|noboxes') + * @param string $options String with options when disabling module: + * 'noboxes' = Do not insert boxes + * 'newboxdefonly' = For boxes, insert def of boxes only and not boxes activation * * @return int 1 if OK, 0 if KO */ @@ -279,7 +281,8 @@ abstract class DolibarrModules * Disable function. Deletes the module constant and boxes from the database. * * @param string[] $array_sql SQL requests to be executed when module is disabled - * @param string $options Options when disabling module ('newboxdefonly|noboxes') + * @param string $options Options when disabling module: + * 'newboxdefonly|noboxes' = We don't remove boxes. * * @return int 1 if OK, 0 if KO */ diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index a826264c94e..f3c7d0363bb 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -227,7 +227,7 @@ llxHeader('',$langs->trans("CronAdd")); if ($action=='edit' || empty($action) || $action=='delete' || $action=='execute') { $head=cron_prepare_head($object); - print dol_get_fiche_head($head, 'card', $langs->trans("CronTask"), 0, 'bill'); + print dol_get_fiche_head($head, 'card', $langs->trans("CronTask"), 0, 'cron'); } elseif ($action=='create') { diff --git a/htdocs/cron/info.php b/htdocs/cron/info.php index 53489d69f5a..ceec1d34adb 100644 --- a/htdocs/cron/info.php +++ b/htdocs/cron/info.php @@ -46,7 +46,7 @@ $object->info($id); $head = cron_prepare_head($object); -dol_fiche_head($head, 'info', $langs->trans("CronTask"), 0, 'bill'); +dol_fiche_head($head, 'info', $langs->trans("CronTask"), 0, 'cron'); print ''; - print '\n"; + $payment_type = $langs->trans("PaymentType".$objp->paiement_type)!=("PaymentType".$objp->paiement_type)?$langs->trans("PaymentType".$objp->paiement_type):$objp->paiement_libelle; + + print '\n"; print ', $tbodyStart = $rowMin; - $tbodyEnd = $rowMax; $theadStart = $theadEnd = 0; // default: no no if ($sheet->getPageSetup()->isRowsToRepeatAtTopSet()) { $rowsToRepeatAtTop = $sheet->getPageSetup()->getRowsToRepeatAtTop(); @@ -429,7 +428,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { while($column++ < $dimension[1][0]) { // Cell exists? if ($sheet->cellExistsByColumnAndRow($column, $row)) { - $rowData[$column] = $sheet->getCellByColumnAndRow($column, $row); + $rowData[$column] = PHPExcel_Cell::stringFromColumnIndex($column) . $row; } else { $rowData[$column] = ''; } @@ -441,12 +440,11 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { if ($row == $theadEnd) { $html .= ' ' . PHP_EOL; } - - // ? - if ($row == $tbodyEnd) { - $html .= ' ' . PHP_EOL; - } } + $html .= $this->_extendRowsForChartsAndImages($sheet, $row); + + // Close table body. + $html .= ' ' . PHP_EOL; // Write table footer $html .= $this->_generateTableFooter(); @@ -470,13 +468,13 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { * Generate sheet tabs * * @return string - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function generateNavigation() { // PHPExcel object known? if (is_null($this->_phpExcel)) { - throw new Exception('Internal PHPExcel object not set to an instance of an object.'); + throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); } // Fetch sheets @@ -508,15 +506,65 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { return $html; } + private function _extendRowsForChartsAndImages(PHPExcel_Worksheet $pSheet, $row) { + $rowMax = $row; + $colMax = 'A'; + if ($this->_includeCharts) { + foreach ($pSheet->getChartCollection() as $chart) { + if ($chart instanceof PHPExcel_Chart) { + $chartCoordinates = $chart->getTopLeftPosition(); + $chartTL = PHPExcel_Cell::coordinateFromString($chartCoordinates['cell']); + $chartCol = PHPExcel_Cell::columnIndexFromString($chartTL[0]); + if ($chartTL[1] > $rowMax) { + $rowMax = $chartTL[1]; + if ($chartCol > PHPExcel_Cell::columnIndexFromString($colMax)) { + $colMax = $chartTL[0]; + } + } + } + } + } + + foreach ($pSheet->getDrawingCollection() as $drawing) { + if ($drawing instanceof PHPExcel_Worksheet_Drawing) { + $imageTL = PHPExcel_Cell::coordinateFromString($drawing->getCoordinates()); + $imageCol = PHPExcel_Cell::columnIndexFromString($imageTL[0]); + if ($imageTL[1] > $rowMax) { + $rowMax = $imageTL[1]; + if ($imageCol > PHPExcel_Cell::columnIndexFromString($colMax)) { + $colMax = $imageTL[0]; + } + } + } + } + $html = ''; + $colMax++; + while ($row < $rowMax) { + $html .= ''; + for ($col = 'A'; $col != $colMax; ++$col) { + $html .= ''; + } + ++$row; + $html .= ''; + } + return $html; + } + + /** * Generate image tag in cell * * @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet * @param string $coordinates Cell coordinates * @return string - * @throws Exception + * @throws PHPExcel_Writer_Exception */ - private function _writeImageTagInCell(PHPExcel_Worksheet $pSheet, $coordinates) { + private function _writeImageInCell(PHPExcel_Worksheet $pSheet, $coordinates) { // Construct HTML $html = ''; @@ -543,7 +591,74 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { $filename = htmlspecialchars($filename); $html .= PHP_EOL; - $html .= ' ' . PHP_EOL; + if ((!$this->_embedImages) || ($this->_isPdf)) { + $imageData = $filename; + } else { + $imageDetails = getimagesize($filename); + if ($fp = fopen($filename,"rb", 0)) { + $picture = fread($fp,filesize($filename)); + fclose($fp); + // base64 encode the binary data, then break it + // into chunks according to RFC 2045 semantics + $base64 = chunk_split(base64_encode($picture)); + $imageData = 'data:'.$imageDetails['mime'].';base64,' . $base64; + } else { + $imageData = $filename; + } + } + + $html .= '
'; + $html .= ''; + $html .= '
'; + } + } + } + + // Return + return $html; + } + + /** + * Generate chart tag in cell + * + * @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet + * @param string $coordinates Cell coordinates + * @return string + * @throws PHPExcel_Writer_Exception + */ + private function _writeChartInCell(PHPExcel_Worksheet $pSheet, $coordinates) { + // Construct HTML + $html = ''; + + // Write charts + foreach ($pSheet->getChartCollection() as $chart) { + if ($chart instanceof PHPExcel_Chart) { + $chartCoordinates = $chart->getTopLeftPosition(); + if ($chartCoordinates['cell'] == $coordinates) { + $chartFileName = PHPExcel_Shared_File::sys_get_temp_dir().'/'.uniqid().'.png'; + if (!$chart->render($chartFileName)) { + return; + } + + $html .= PHP_EOL; + $imageDetails = getimagesize($chartFileName); + if ($fp = fopen($chartFileName,"rb", 0)) { + $picture = fread($fp,filesize($chartFileName)); + fclose($fp); + // base64 encode the binary data, then break it + // into chunks according to RFC 2045 semantics + $base64 = chunk_split(base64_encode($picture)); + $imageData = 'data:'.$imageDetails['mime'].';base64,' . $base64; + + $html .= '
'; + $html .= '' . PHP_EOL; + $html .= '
'; + + unlink($chartFileName); + } } } } @@ -557,12 +672,12 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { * * @param boolean $generateSurroundingHTML Generate surrounding HTML tags? () * @return string - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function generateStyles($generateSurroundingHTML = true) { // PHPExcel object known? if (is_null($this->_phpExcel)) { - throw new Exception('Internal PHPExcel object not set to an instance of an object.'); + throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); } // Build CSS @@ -598,12 +713,12 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { * * @param boolean $generateSurroundingHTML Generate surrounding HTML style? (html { }) * @return array - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function buildCSS($generateSurroundingHTML = true) { // PHPExcel object known? if (is_null($this->_phpExcel)) { - throw new Exception('Internal PHPExcel object not set to an instance of an object.'); + throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); } // Cached? @@ -851,7 +966,10 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { */ private function _createCSSStyleBorder(PHPExcel_Style_Border $pStyle) { // Create CSS - $css = $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB(); +// $css = $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB(); + // Create CSS - add !important to non-none border styles for merged cells + $borderStyle = $this->_mapBorderStyle($pStyle->getBorderStyle()); + $css = $borderStyle . ' #' . $pStyle->getColor()->getRGB() . (($borderStyle == 'none') ? '' : ' !important'); // Return return $css; @@ -894,25 +1012,26 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { * * @param PHPExcel_Worksheet $pSheet The worksheet for the table we are writing * @return string - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _generateTableHeader($pSheet) { $sheetIndex = $pSheet->getParent()->getIndex($pSheet); // Construct HTML $html = ''; - + $html .= $this->_setMargins($pSheet); + if (!$this->_useInlineCss) { - $gridlines = $pSheet->getShowGridLines() ? ' gridlines' : ''; + $gridlines = $pSheet->getShowGridlines() ? ' gridlines' : ''; $html .= '
'; dol_print_object_info($object); diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 86ab911c71b..a7226c1621d 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -367,19 +367,21 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) // Reload modules (this must be always and only into last targeted version) $listofmodule=array( 'MAIN_MODULE_AGENDA', - 'MAIN_MODULE_SOCIETE', - 'MAIN_MODULE_PRODUIT', - 'MAIN_MODULE_SERVICE', + 'MAIN_MODULE_BARCODE', + 'MAIN_MODULE_CRON', 'MAIN_MODULE_COMMANDE', - 'MAIN_MODULE_FACTURE', - 'MAIN_MODULE_FOURNISSEUR', - 'MAIN_MODULE_USER', 'MAIN_MODULE_DEPLACEMENT', 'MAIN_MODULE_DON', 'MAIN_MODULE_ECM', - 'MAIN_MODULE_PAYBOX', - 'MAIN_MODULE_OPENSURVEY' - ); + 'MAIN_MODULE_FACTURE', + 'MAIN_MODULE_FOURNISSEUR', + 'MAIN_MODULE_OPENSURVEY', + 'MAIN_MODULE_PAYBOX', + 'MAIN_MODULE_PRODUIT', + 'MAIN_MODULE_SOCIETE', + 'MAIN_MODULE_SERVICE', + 'MAIN_MODULE_USER' + ); migrate_reload_modules($db,$langs,$conf,$listofmodule); // Reload menus (this must be always and only into last targeted version) @@ -3773,6 +3775,26 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) $mod->init('newboxdefonly'); } } + if ($moduletoreload == 'MAIN_MODULE_BARCODE') + { + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Barcode"); + $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modBarcode.class.php'; + if ($res) { + $mod=new modBarcode($db); + $mod->remove('noboxes'); + $mod->init('newboxdefonly'); + } + } + if ($moduletoreload == 'MAIN_MODULE_CRON') + { + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Cron"); + $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modCron.class.php'; + if ($res) { + $mod=new modCron($db); + $mod->remove('noboxes'); + $mod->init('newboxdefonly'); + } + } if ($moduletoreload == 'MAIN_MODULE_SOCIETE') { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Societe"); @@ -3833,17 +3855,6 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) $mod->init('newboxdefonly'); } } - - if ($moduletoreload == 'MAIN_MODULE_USER') // Permission has changed into 3.0 - { - dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module User"); - $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modUser.class.php'; - if ($res) { - $mod=new modUser($db); - //$mod->remove('noboxes'); // We need to remove because id of module has changed - $mod->init('newboxdefonly'); - } - } if ($moduletoreload == 'MAIN_MODULE_DEPLACEMENT') // Permission has changed into 3.0 { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Deplacement"); @@ -3894,6 +3905,17 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) $mod->init('newboxdefonly'); } } + if ($moduletoreload == 'MAIN_MODULE_USER') // Permission has changed into 3.0 + { + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module User"); + $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modUser.class.php'; + if ($res) { + $mod=new modUser($db); + //$mod->remove('noboxes'); // We need to remove because id of module has changed + $mod->init('newboxdefonly'); + } + } + } } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 1d2085dcbf7..009c7dd774c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1374,7 +1374,7 @@ BarcodeDescUPC=Barcode of type UPC BarcodeDescISBN=Barcode of type ISBN BarcodeDescC39=Barcode of type C39 BarcodeDescC128=Barcode of type C128 -GenbarcodeLocation=Bar code generation command line tool (used by internal engine for some bar code types) +GenbarcodeLocation=Bar code generation command line tool (used by internal engine for some bar code types). Must be compatible with "genbarcode".
For example: /usr/local/bin/genbarcode BarcodeInternalEngine=Internal engine BarCodeNumberManager=Manager to auto define barcode numbers ##### Prelevements ##### diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang index 5432c5b5b52..31e701f1e2d 100644 --- a/htdocs/langs/en_US/cron.lang +++ b/htdocs/langs/en_US/cron.lang @@ -84,3 +84,4 @@ CronType_command=Shell command CronMenu=Cron CronCannotLoadClass=Cannot load class %s or object %s UseMenuModuleToolsToAddCronJobs=Go into menu "Home - Modules tools - Job list" to see and edit scheduled jobs. +TaskDisabled=Task disabled diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 0187c567eb6..a2d73817bf1 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -25,7 +25,7 @@ ErrorFromToAccountsMustDiffers=Source and targets bank accounts must be differen ErrorBadThirdPartyName=Bad value for third party name ErrorProdIdIsMandatory=The %s is mandatory ErrorBadCustomerCodeSyntax=Bad syntax for customer code -ErrorBadBarCodeSyntax=Bad syntax for bar code +ErrorBadBarCodeSyntax=Bad syntax for bar code. May be you set a bad barcode type or you defined a barcode mask for numbering that does not match value scanned. ErrorCustomerCodeRequired=Customer code required ErrorBarCodeRequired=Bar code required ErrorCustomerCodeAlreadyUsed=Customer code already used From c2f5b24a9d09d76ad2867cc84600bf39441e305a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Feb 2015 22:40:13 +0100 Subject: [PATCH 52/63] Better text --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 8ba499a7ae1..dcef2941d94 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1512,7 +1512,7 @@ CashDeskThirdPartyForSell=Default generic third party to use for sells CashDeskBankAccountForSell=Default account to use to receive cash payments CashDeskBankAccountForCheque= Default account to use to receive payments by cheque CashDeskBankAccountForCB= Default account to use to receive payments by credit cards -CashDeskDoNotDecreaseStock=Disable stock decrease when a sell is done from Point of Sale +CashDeskDoNotDecreaseStock=Disable stock decrease when a sell is done from Point of Sale (if "no", stock decrease is done for each sell done from POS, whatever is option set into module Stock). CashDeskIdWareHouse=Force and restrict warehouse to use for stock decrease StockDecreaseForPointOfSaleDisabled=Stock decrease from Point Of Sale disabled CashDeskYouDidNotDisableStockDecease=You did not disable stock decrease when making a sell from Point Of Sale. So a warehouse is required. From fc415fc3c918b83c8cdb256506ace18a1dd6cc12 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Feb 2015 22:44:42 +0100 Subject: [PATCH 53/63] Fix: [ bug #1826 ] Supplier payment types are not translated in fourn/facture/paiement.php --- ChangeLog | 1 + htdocs/fourn/facture/paiement.php | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 16073f9658c..51dd2ff268a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,7 @@ English Dolibarr ChangeLog - Fix: [ bug #1827 ] Tax reports gives incorrect amounts when using external modules that create lines with special codes - Fix: [ bug #1822 ] SQL error in clientfourn.php report with PostgreSQL - Fix: [ bug #1832 ] SQL error when adding a product with no price defined to an object +- Fix: [ bug #1826 ] Supplier payment types are not translated in fourn/facture/paiement.php ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index b6a4c5a7925..a8576cff01d 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -5,6 +5,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015 Marcos García * * 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 @@ -447,7 +448,7 @@ if (empty($action)) $sql = 'SELECT p.rowid as pid, p.datep as dp, p.amount as pamount, p.num_paiement,'; $sql.= ' s.rowid as socid, s.nom,'; - $sql.= ' c.libelle as paiement_type,'; + $sql.= ' c.code as paiement_type, c.libelle as paiement_libelle,'; $sql.= ' ba.rowid as bid, ba.label,'; if (!$user->rights->societe->client->voir) $sql .= ' sc.fk_soc, sc.fk_user,'; $sql.= ' SUM(f.amount)'; @@ -486,7 +487,7 @@ if (empty($action)) { $sql .= " AND s.nom LIKE '%".$db->escape($search_company)."%'"; } - $sql.= " GROUP BY p.rowid, p.datep, p.amount, p.num_paiement, s.rowid, s.nom, c.libelle, ba.rowid, ba.label"; + $sql.= " GROUP BY p.rowid, p.datep, p.amount, p.num_paiement, s.rowid, s.nom, c.code, c.libelle, ba.rowid, ba.label"; if (!$user->rights->societe->client->voir) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1, $offset); @@ -558,7 +559,9 @@ if (empty($action)) else print ' '; print '
'.dol_trunc($objp->paiement_type.' '.$objp->num_paiement,32)."'.$payment_type.' '.dol_trunc($objp->num_paiement,32)."'; if ($objp->bid) print ''.img_object($langs->trans("ShowAccount"),'account').' '.dol_trunc($objp->label,24).''; From bd9c168e3cace14d28bb6662a5b6a24d68a22709 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Feb 2015 23:42:39 +0100 Subject: [PATCH 54/63] Doxygen --- htdocs/core/modules/expensereport/doc/pdf_standard.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 8b84ff505ec..2ce272af9ef 100755 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -739,7 +739,7 @@ class pdf_ extends ModeleExpenseReport /** * Show footer of page. Need this->emetteur object * - * @param PDF &$pdf PDF + * @param PDF $pdf PDF * @param Object $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text From b73f1eb82786ce30041598e5862f8c273c5ac051 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 19 Feb 2015 08:40:38 +0100 Subject: [PATCH 55/63] Update account.class.php --- htdocs/compta/bank/class/account.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 16a9c45cc2a..1db6ec18cc6 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -910,6 +910,8 @@ class Account extends CommonObject $langs->load("banks"); $now=dol_now(); + require_once DOL_DOCUMENT_ROOT.'/core/class/WorkboardResponse.class.php'; + $response = new WorkboardResponse(); $response->warning_delay=$conf->bank->rappro->warning_delay/60/60/24; $response->label=$langs->trans("TransactionsToConciliate"); From 9be3e79a72ae381fec7ceb6a68f9a89011f60068 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 20 Feb 2015 05:01:44 +0100 Subject: [PATCH 56/63] Align the version of AdoDb-Date library --- COPYRIGHT | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/COPYRIGHT b/COPYRIGHT index cf31432caf0..320d4dcd4f4 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -12,7 +12,7 @@ Dolibarr uses some external libraries released under different licenses. This is Component Version License GPL Compatible Usage ------------------------------------------------------------------------------------- PHP libraries: -AdoDb-Date 0.32 Modified BSD License Yes Date convertion (not into rpm package) +AdoDb-Date 0.33 Modified BSD License Yes Date convertion (not into rpm package) ChromePHP 4.3.3 Apache Software License 2.0 Yes Return server log to chrome browser console CKEditor 4.3.3 LGPL-2.1+ Yes Editor WYSIWYG FPDI 1.4.2 Apache Software License 2.0 Yes PDF templates management From 014f255f22ca256a354e526ea85a17b363611bf9 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 20 Feb 2015 05:09:07 +0100 Subject: [PATCH 57/63] Update FPDF_TPL library to 1.2.3 --- COPYRIGHT | 2 +- htdocs/includes/fpdfi/fpdf_tpl.php | 49 ++++++++++++++++++------------ 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/COPYRIGHT b/COPYRIGHT index 320d4dcd4f4..05651d8b0e4 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -16,7 +16,7 @@ AdoDb-Date 0.33 Modified BSD License Yes ChromePHP 4.3.3 Apache Software License 2.0 Yes Return server log to chrome browser console CKEditor 4.3.3 LGPL-2.1+ Yes Editor WYSIWYG FPDI 1.4.2 Apache Software License 2.0 Yes PDF templates management -FPDF_TPL 1.2 Apache Software License 2.0 Yes PDF templates management +FPDF_TPL 1.2.3 Apache Software License 2.0 Yes PDF templates management GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package) NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package) odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files diff --git a/htdocs/includes/fpdfi/fpdf_tpl.php b/htdocs/includes/fpdfi/fpdf_tpl.php index 6e234bf9321..8482ba336ed 100644 --- a/htdocs/includes/fpdfi/fpdf_tpl.php +++ b/htdocs/includes/fpdfi/fpdf_tpl.php @@ -1,8 +1,8 @@ $this->rMargin, 'o_h' => $this->h, 'o_w' => $this->w, + 'o_FontFamily' => $this->FontFamily, + 'o_FontStyle' => $this->FontStyle, + 'o_FontSizePt' => $this->FontSizePt, + 'o_FontSize' => $this->FontSize, 'buffer' => '', 'x' => $x, 'y' => $y, @@ -121,6 +125,13 @@ class FPDF_TPL extends FPDF { $this->SetXY($x + $this->lMargin, $y + $this->tMargin); $this->SetRightMargin($this->w - $w + $this->rMargin); + if ($this->CurrentFont) { + $fontkey = $this->FontFamily . $this->FontStyle; + $this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey]; + + $this->_out(sprintf('BT /F%d %.2f Tf ET', $this->CurrentFont['i'], $this->FontSizePt)); + } + return $this->tpl; } @@ -148,6 +159,15 @@ class FPDF_TPL extends FPDF { $this->w = $tpl['o_w']; $this->SetAutoPageBreak($tpl['o_AutoPageBreak'], $tpl['o_bMargin']); + $this->FontFamily = $tpl['o_FontFamily']; + $this->FontStyle = $tpl['o_FontStyle']; + $this->FontSizePt = $tpl['o_FontSizePt']; + $this->FontSize = $tpl['o_FontSize']; + + $fontkey = $this->FontFamily . $this->FontStyle; + if ($fontkey) + $this->CurrentFont =& $this->fonts[$fontkey]; + return $this->tpl; } else { return false; @@ -213,13 +233,6 @@ class FPDF_TPL extends FPDF { $this->_out(sprintf('q %.4F 0 0 %.4F %.4F %.4F cm', $tData['scaleX'], $tData['scaleY'], $tData['tx'] * $this->k, $tData['ty'] * $this->k)); // Translate $this->_out(sprintf('%s%d Do Q', $this->tplprefix, $tplidx)); - // reset font in the outer graphic state - if ($this->FontFamily) { - $family = $this->FontFamily; - $this->FontFamily = ''; - $this->SetFont($family); - } - $this->lastUsedTemplateData = $tData; return array('w' => $_w, 'h' => $_h); @@ -236,7 +249,7 @@ class FPDF_TPL extends FPDF { * @return array The height and width of the template */ function getTemplateSize($tplidx, $_w = 0, $_h = 0) { - if (!$this->tpls[$tplidx]) + if (!isset($this->tpls[$tplidx])) return false; $tpl =& $this->tpls[$tplidx]; @@ -265,12 +278,6 @@ class FPDF_TPL extends FPDF { return call_user_func_array(array($this, 'TCPDF::SetFont'), $args); } - /** - * force the resetting of font changes in a template - */ - if ($this->_intpl) - $this->FontFamily = ''; - parent::SetFont($family, $style, $size); $fontkey = $this->FontFamily . $this->FontStyle; @@ -285,7 +292,11 @@ class FPDF_TPL extends FPDF { /** * See FPDF/TCPDF-Documentation ;-) */ - function Image($file, $x = null, $y = null, $w = 0, $h = 0, $type = '', $link = '') { + function Image( + $file, $x = '', $y = '', $w = 0, $h = 0, $type = '', $link = '', $align = '', $resize = false, + $dpi = 300, $palign = '', $ismask = false, $imgmask = false, $border = 0, $fitbox = false, + $hidden = false, $fitonpage = false, $alt = false, $altimgs = array() + ) { if (is_subclass_of($this, 'TCPDF')) { $args = func_get_args(); return call_user_func_array(array($this, 'TCPDF::Image'), $args); @@ -306,7 +317,7 @@ class FPDF_TPL extends FPDF { * * AddPage is not available when you're "in" a template. */ - function AddPage($orientation = '', $format = '') { + function AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false) { if (is_subclass_of($this, 'TCPDF')) { $args = func_get_args(); return call_user_func_array(array($this, 'TCPDF::AddPage'), $args); @@ -321,7 +332,7 @@ class FPDF_TPL extends FPDF { /** * Preserve adding Links in Templates ...won't work */ - function Link($x, $y, $w, $h, $link) { + function Link($x, $y, $w, $h, $link, $spaces = 0) { if (is_subclass_of($this, 'TCPDF')) { $args = func_get_args(); return call_user_func_array(array($this, 'TCPDF::Link'), $args); From 0205848a0e09f3ccdf81e6af1199975713aefd23 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 20 Feb 2015 05:21:18 +0100 Subject: [PATCH 58/63] Update FPDI library to 1.5.2 Contain FPDF_TPL natively --- COPYRIGHT | 3 +- .../includes/fpdfi/filters/FilterASCII85.php | 157 +- .../fpdfi/filters/FilterASCIIHexDecode.php | 52 + htdocs/includes/fpdfi/filters/FilterLZW.php | 278 +-- htdocs/includes/fpdfi/fpdf_tpl.php | 601 ++++--- htdocs/includes/fpdfi/fpdi.php | 544 +++--- htdocs/includes/fpdfi/fpdi2tcpdf_bridge.php | 167 -- htdocs/includes/fpdfi/fpdi_bridge.php | 215 +++ htdocs/includes/fpdfi/fpdi_pdf_parser.php | 420 ++--- htdocs/includes/fpdfi/pdf_context.php | 219 ++- htdocs/includes/fpdfi/pdf_parser.php | 1590 +++++++++-------- 11 files changed, 2391 insertions(+), 1855 deletions(-) create mode 100644 htdocs/includes/fpdfi/filters/FilterASCIIHexDecode.php delete mode 100644 htdocs/includes/fpdfi/fpdi2tcpdf_bridge.php create mode 100644 htdocs/includes/fpdfi/fpdi_bridge.php diff --git a/COPYRIGHT b/COPYRIGHT index 05651d8b0e4..8ce95782942 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -15,8 +15,7 @@ PHP libraries: AdoDb-Date 0.33 Modified BSD License Yes Date convertion (not into rpm package) ChromePHP 4.3.3 Apache Software License 2.0 Yes Return server log to chrome browser console CKEditor 4.3.3 LGPL-2.1+ Yes Editor WYSIWYG -FPDI 1.4.2 Apache Software License 2.0 Yes PDF templates management -FPDF_TPL 1.2.3 Apache Software License 2.0 Yes PDF templates management +FPDI 1.5.2 Apache Software License 2.0 Yes PDF templates management GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package) NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package) odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files diff --git a/htdocs/includes/fpdfi/filters/FilterASCII85.php b/htdocs/includes/fpdfi/filters/FilterASCII85.php index 01402ba1dc6..59bc845f3c9 100644 --- a/htdocs/includes/fpdfi/filters/FilterASCII85.php +++ b/htdocs/includes/fpdfi/filters/FilterASCII85.php @@ -1,8 +1,8 @@ ord('~'), + 'z' => ord('z'), + 'u' => ord('u'), + 'z' => ord('z'), + '!' => ord('!') + ); -if (!class_exists('FilterASCII85', false)) { + $out = ''; + $state = 0; + $chn = null; - class FilterASCII85 { - - function error($msg) { - die($msg); - } - - function decode($in) { - $out = ''; - $state = 0; - $chn = null; - - $l = strlen($in); - - for ($k = 0; $k < $l; ++$k) { - $ch = ord($in[$k]) & 0xff; - - if ($ch == ORD_tilde) { - break; - } - if (preg_match('/^\s$/',chr($ch))) { - continue; - } - if ($ch == ORD_z && $state == 0) { - $out .= chr(0) . chr(0) . chr(0) . chr(0); - continue; - } - if ($ch < ORD_exclmark || $ch > ORD_u) { - return $this->error('Illegal character in ASCII85Decode.'); - } - - $chn[$state++] = $ch - ORD_exclmark; - - if ($state == 5) { - $state = 0; - $r = 0; - for ($j = 0; $j < 5; ++$j) - $r = $r * 85 + $chn[$j]; - $out .= chr($r >> 24); - $out .= chr($r >> 16); - $out .= chr($r >> 8); - $out .= chr($r); - } + $l = strlen($in); + + for ($k = 0; $k < $l; ++$k) { + $ch = ord($in[$k]) & 0xff; + + if ($ch == $ord['~']) { + break; } - $r = 0; - - if ($state == 1) - return $this->error('Illegal length in ASCII85Decode.'); - if ($state == 2) { - $r = $chn[0] * 85 * 85 * 85 * 85 + ($chn[1]+1) * 85 * 85 * 85; - $out .= chr($r >> 24); + if (preg_match('/^\s$/',chr($ch))) { + continue; } - else if ($state == 3) { - $r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + ($chn[2]+1) * 85 * 85; - $out .= chr($r >> 24); - $out .= chr($r >> 16); + if ($ch == $ord['z'] && $state == 0) { + $out .= chr(0) . chr(0) . chr(0) . chr(0); + continue; } - else if ($state == 4) { - $r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + $chn[2] * 85 * 85 + ($chn[3]+1) * 85 ; + if ($ch < $ord['!'] || $ch > $ord['u']) { + throw new Exception('Illegal character in ASCII85Decode.'); + } + + $chn[$state++] = $ch - $ord['!']; + + if ($state == 5) { + $state = 0; + $r = 0; + for ($j = 0; $j < 5; ++$j) + $r = $r * 85 + $chn[$j]; $out .= chr($r >> 24); $out .= chr($r >> 16); $out .= chr($r >> 8); + $out .= chr($r); } - - return $out; } - - function encode($in) { - return $this->error("ASCII85 encoding not implemented."); + $r = 0; + + if ($state == 1) { + throw new Exception('Illegal length in ASCII85Decode.'); } + + if ($state == 2) { + $r = $chn[0] * 85 * 85 * 85 * 85 + ($chn[1]+1) * 85 * 85 * 85; + $out .= chr($r >> 24); + + } else if ($state == 3) { + $r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + ($chn[2]+1) * 85 * 85; + $out .= chr($r >> 24); + $out .= chr($r >> 16); + + } else if ($state == 4) { + $r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + $chn[2] * 85 * 85 + ($chn[3]+1) * 85 ; + $out .= chr($r >> 24); + $out .= chr($r >> 16); + $out .= chr($r >> 8); + } + + return $out; } -} + + /** + * NOT IMPLEMENTED + * + * @param string $in + * @return string + * @throws LogicException + */ + public function encode($in) + { + throw new LogicException("ASCII85 encoding not implemented."); + } +} \ No newline at end of file diff --git a/htdocs/includes/fpdfi/filters/FilterASCIIHexDecode.php b/htdocs/includes/fpdfi/filters/FilterASCIIHexDecode.php new file mode 100644 index 00000000000..4040302d32c --- /dev/null +++ b/htdocs/includes/fpdfi/filters/FilterASCIIHexDecode.php @@ -0,0 +1,52 @@ +')); + if ((strlen($data) % 2) == 1) { + $data .= '0'; + } + + return pack('H*', $data); + } + + /** + * Converts a string into ASCII hexadecimal representation. + * + * @param string $data The input string + * @param boolean $leaveEOD + * @return string + */ + public function encode($data, $leaveEOD = false) + { + return current(unpack('H*', $data)) . ($leaveEOD ? '' : '>'); + } +} \ No newline at end of file diff --git a/htdocs/includes/fpdfi/filters/FilterLZW.php b/htdocs/includes/fpdfi/filters/FilterLZW.php index 292461d248d..b4dfbe82be2 100644 --- a/htdocs/includes/fpdfi/filters/FilterLZW.php +++ b/htdocs/includes/fpdfi/filters/FilterLZW.php @@ -1,8 +1,8 @@ error('LZW flavour not supported.'); - } - - $this->initsTable(); - - $this->data = $data; - $this->dataLength = strlen($data); - - // Initialize pointers - $this->bytePointer = 0; - $this->bitPointer = 0; - - $this->nextData = 0; - $this->nextBits = 0; - - $oldCode = 0; - - $string = ''; - $uncompData = ''; - - while (($code = $this->getNextCode()) != 257) { - if ($code == 256) { - $this->initsTable(); - $code = $this->getNextCode(); - - if ($code == 257) { - break; - } - - $uncompData .= $this->sTable[$code]; + + $this->_initsTable(); + + $this->_data = $data; + $this->_dataLength = strlen($data); + + // Initialize pointers + $this->_bytePointer = 0; + $this->_bitPointer = 0; + + $this->_nextData = 0; + $this->_nextBits = 0; + + $oldCode = 0; + + $unCompData = ''; + + while (($code = $this->_getNextCode()) != 257) { + if ($code == 256) { + $this->_initsTable(); + $code = $this->_getNextCode(); + + if ($code == 257) { + break; + } + + if (!isset($this->_sTable[$code])) { + throw new Exception('Error while decompression LZW compressed data.'); + } + + $unCompData .= $this->_sTable[$code]; + $oldCode = $code; + + } else { + + if ($code < $this->_tIdx) { + $string = $this->_sTable[$code]; + $unCompData .= $string; + + $this->_addStringToTable($this->_sTable[$oldCode], $string[0]); $oldCode = $code; - } else { - - if ($code < $this->tIdx) { - $string = $this->sTable[$code]; - $uncompData .= $string; - - $this->addStringToTable($this->sTable[$oldCode], $string[0]); - $oldCode = $code; - } else { - $string = $this->sTable[$oldCode]; - $string = $string . $string[0]; - $uncompData .= $string; - - $this->addStringToTable($string); - $oldCode = $code; - } + $string = $this->_sTable[$oldCode]; + $string = $string . $string[0]; + $unCompData .= $string; + + $this->_addStringToTable($string); + $oldCode = $code; } } - - return $uncompData; } - - - /** - * Initialize the string table. - */ - function initsTable() { - $this->sTable = array(); - - for ($i = 0; $i < 256; $i++) - $this->sTable[$i] = chr($i); - - $this->tIdx = 258; - $this->bitsToGet = 9; - } - - /** - * Add a new string to the string table. - */ - function addStringToTable ($oldString, $newString='') { - $string = $oldString.$newString; - - // Add this new String to the table - $this->sTable[$this->tIdx++] = $string; - - if ($this->tIdx == 511) { - $this->bitsToGet = 10; - } else if ($this->tIdx == 1023) { - $this->bitsToGet = 11; - } else if ($this->tIdx == 2047) { - $this->bitsToGet = 12; - } - } - - // Returns the next 9, 10, 11 or 12 bits - function getNextCode() { - if ($this->bytePointer == $this->dataLength) { - return 257; - } - - $this->nextData = ($this->nextData << 8) | (ord($this->data[$this->bytePointer++]) & 0xff); - $this->nextBits += 8; - - if ($this->nextBits < $this->bitsToGet) { - $this->nextData = ($this->nextData << 8) | (ord($this->data[$this->bytePointer++]) & 0xff); - $this->nextBits += 8; - } - - $code = ($this->nextData >> ($this->nextBits - $this->bitsToGet)) & $this->andTable[$this->bitsToGet-9]; - $this->nextBits -= $this->bitsToGet; - - return $code; - } - - function encode($in) { - $this->error("LZW encoding not implemented."); + + return $unCompData; + } + + + /** + * Initialize the string table. + */ + protected function _initsTable() + { + $this->_sTable = array(); + + for ($i = 0; $i < 256; $i++) + $this->_sTable[$i] = chr($i); + + $this->_tIdx = 258; + $this->_bitsToGet = 9; + } + + /** + * Add a new string to the string table. + */ + protected function _addStringToTable($oldString, $newString = '') + { + $string = $oldString . $newString; + + // Add this new String to the table + $this->_sTable[$this->_tIdx++] = $string; + + if ($this->_tIdx == 511) { + $this->_bitsToGet = 10; + } else if ($this->_tIdx == 1023) { + $this->_bitsToGet = 11; + } else if ($this->_tIdx == 2047) { + $this->_bitsToGet = 12; } } -} + + /** + * Returns the next 9, 10, 11 or 12 bits + * + * @return int + */ + protected function _getNextCode() + { + if ($this->_bytePointer == $this->_dataLength) { + return 257; + } + + $this->_nextData = ($this->_nextData << 8) | (ord($this->_data[$this->_bytePointer++]) & 0xff); + $this->_nextBits += 8; + + if ($this->_nextBits < $this->_bitsToGet) { + $this->_nextData = ($this->_nextData << 8) | (ord($this->_data[$this->_bytePointer++]) & 0xff); + $this->_nextBits += 8; + } + + $code = ($this->_nextData >> ($this->_nextBits - $this->_bitsToGet)) & $this->_andTable[$this->_bitsToGet-9]; + $this->_nextBits -= $this->_bitsToGet; + + return $code; + } + + /** + * NOT IMPLEMENTED + * + * @param string $in + * @return string + * @throws LogicException + */ + public function encode($in) + { + throw new LogicException("LZW encoding not implemented."); + } +} \ No newline at end of file diff --git a/htdocs/includes/fpdfi/fpdf_tpl.php b/htdocs/includes/fpdfi/fpdf_tpl.php index 8482ba336ed..5da77aff0e0 100644 --- a/htdocs/includes/fpdfi/fpdf_tpl.php +++ b/htdocs/includes/fpdfi/fpdf_tpl.php @@ -1,8 +1,8 @@ Error('This method is only usable with FPDF. Use TCPDF methods startTemplate() instead.'); - return; - } - - if ($this->page <= 0) - $this->error("You have to add a page to fpdf first!"); + public function beginTemplate($x = null, $y = null, $w = null, $h = null) + { + if (is_subclass_of($this, 'TCPDF')) { + throw new LogicException('This method is only usable with FPDF. Use TCPDF methods startTemplate() instead.'); + } + + if ($this->page <= 0) { + throw new LogicException("You have to add at least a page first!"); + } if ($x == null) $x = 0; @@ -93,7 +106,7 @@ class FPDF_TPL extends FPDF { // Save settings $this->tpl++; - $tpl =& $this->tpls[$this->tpl]; + $tpl =& $this->_tpls[$this->tpl]; $tpl = array( 'o_x' => $this->x, 'o_y' => $this->y, @@ -116,41 +129,43 @@ class FPDF_TPL extends FPDF { ); $this->SetAutoPageBreak(false); - - // Define own high and width to calculate possitions correct + + // Define own high and width to calculate correct positions $this->h = $h; $this->w = $w; - $this->_intpl = true; + $this->_inTpl = true; $this->SetXY($x + $this->lMargin, $y + $this->tMargin); $this->SetRightMargin($this->w - $w + $this->rMargin); if ($this->CurrentFont) { - $fontkey = $this->FontFamily . $this->FontStyle; - $this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey]; - - $this->_out(sprintf('BT /F%d %.2f Tf ET', $this->CurrentFont['i'], $this->FontSizePt)); + $fontKey = $this->FontFamily . $this->FontStyle; + if ($fontKey) { + $this->_res['tpl'][$this->tpl]['fonts'][$fontKey] =& $this->fonts[$fontKey]; + $this->_out(sprintf('BT /F%d %.2F Tf ET', $this->CurrentFont['i'], $this->FontSizePt)); + } } - + return $this->tpl; } - + /** - * End Template + * End template. * - * This method ends a template and reset initiated variables on beginTemplate. + * This method ends a template and reset initiated variables collected in {@link beginTemplate()}. * - * @return mixed If a template is opened, the ID is returned. If not a false is returned. + * @return int|boolean If a template is opened, the id is returned. If not a false is returned. */ - function endTemplate() { - if (is_subclass_of($this, 'TCPDF')) { - $args = func_get_args(); - return call_user_func_array(array($this, 'TCPDF::endTemplate'), $args); + public function endTemplate() + { + if (is_subclass_of($this, 'TCPDF')) { + $args = func_get_args(); + return call_user_func_array(array($this, 'TCPDF::endTemplate'), $args); } - - if ($this->_intpl) { - $this->_intpl = false; - $tpl =& $this->tpls[$this->tpl]; + + if ($this->_inTpl) { + $this->_inTpl = false; + $tpl = $this->_tpls[$this->tpl]; $this->SetXY($tpl['o_x'], $tpl['o_y']); $this->tMargin = $tpl['o_tMargin']; $this->lMargin = $tpl['o_lMargin']; @@ -158,226 +173,285 @@ class FPDF_TPL extends FPDF { $this->h = $tpl['o_h']; $this->w = $tpl['o_w']; $this->SetAutoPageBreak($tpl['o_AutoPageBreak'], $tpl['o_bMargin']); - + $this->FontFamily = $tpl['o_FontFamily']; - $this->FontStyle = $tpl['o_FontStyle']; - $this->FontSizePt = $tpl['o_FontSizePt']; - $this->FontSize = $tpl['o_FontSize']; - - $fontkey = $this->FontFamily . $this->FontStyle; - if ($fontkey) - $this->CurrentFont =& $this->fonts[$fontkey]; - + $this->FontStyle = $tpl['o_FontStyle']; + $this->FontSizePt = $tpl['o_FontSizePt']; + $this->FontSize = $tpl['o_FontSize']; + + $fontKey = $this->FontFamily . $this->FontStyle; + if ($fontKey) + $this->CurrentFont =& $this->fonts[$fontKey]; + return $this->tpl; } else { return false; } } - + /** - * Use a Template in current Page or other Template + * Use a template in current page or other template. * * You can use a template in a page or in another template. - * You can give the used template a new size like you use the Image()-method. - * All parameters are optional. The width or height is calculated automaticaly + * You can give the used template a new size. + * All parameters are optional. The width or height is calculated automatically * if one is given. If no parameter is given the origin size as defined in - * beginTemplate() is used. + * {@link beginTemplate()} method is used. + * * The calculated or used width and height are returned as an array. * - * @param int $tplidx A valid template-Id - * @param int $_x The x-position - * @param int $_y The y-position - * @param int $_w The new width of the template - * @param int $_h The new height of the template - * @retrun array The height and width of the template + * @param int $tplIdx A valid template-id + * @param int $x The x-position + * @param int $y The y-position + * @param int $w The new width of the template + * @param int $h The new height of the template + * @return array The height and width of the template (array('w' => ..., 'h' => ...)) + * @throws LogicException|InvalidArgumentException */ - function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0) { - if ($this->page <= 0) - $this->error('You have to add a page first!'); - - if (!isset($this->tpls[$tplidx])) - $this->error('Template does not exist!'); - - if ($this->_intpl) { - $this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx]; + public function useTemplate($tplIdx, $x = null, $y = null, $w = 0, $h = 0) + { + if ($this->page <= 0) { + throw new LogicException('You have to add at least a page first!'); } - - $tpl =& $this->tpls[$tplidx]; - $w = $tpl['w']; - $h = $tpl['h']; - - if ($_x == null) - $_x = 0; - if ($_y == null) - $_y = 0; - - $_x += $tpl['x']; - $_y += $tpl['y']; - - $wh = $this->getTemplateSize($tplidx, $_w, $_h); - $_w = $wh['w']; - $_h = $wh['h']; - - $tData = array( + + if (!isset($this->_tpls[$tplIdx])) { + throw new InvalidArgumentException('Template does not exist!'); + } + + if ($this->_inTpl) { + $this->_res['tpl'][$this->tpl]['tpls'][$tplIdx] =& $this->_tpls[$tplIdx]; + } + + $tpl = $this->_tpls[$tplIdx]; + $_w = $tpl['w']; + $_h = $tpl['h']; + + if ($x == null) { + $x = 0; + } + + if ($y == null) { + $y = 0; + } + + $x += $tpl['x']; + $y += $tpl['y']; + + $wh = $this->getTemplateSize($tplIdx, $w, $h); + $w = $wh['w']; + $h = $wh['h']; + + $tplData = array( 'x' => $this->x, 'y' => $this->y, - 'w' => $_w, - 'h' => $_h, - 'scaleX' => ($_w / $w), - 'scaleY' => ($_h / $h), - 'tx' => $_x, - 'ty' => ($this->h - $_y - $_h), - 'lty' => ($this->h - $_y - $_h) - ($this->h - $h) * ($_h / $h) + 'w' => $w, + 'h' => $h, + 'scaleX' => ($w / $_w), + 'scaleY' => ($h / $_h), + 'tx' => $x, + 'ty' => ($this->h - $y - $h), + 'lty' => ($this->h - $y - $h) - ($this->h - $_h) * ($h / $_h) ); - - $this->_out(sprintf('q %.4F 0 0 %.4F %.4F %.4F cm', $tData['scaleX'], $tData['scaleY'], $tData['tx'] * $this->k, $tData['ty'] * $this->k)); // Translate - $this->_out(sprintf('%s%d Do Q', $this->tplprefix, $tplidx)); - $this->lastUsedTemplateData = $tData; - - return array('w' => $_w, 'h' => $_h); + $this->_out(sprintf('q %.4F 0 0 %.4F %.4F %.4F cm', + $tplData['scaleX'], $tplData['scaleY'], $tplData['tx'] * $this->k, $tplData['ty'] * $this->k) + ); // Translate + $this->_out(sprintf('%s%d Do Q', $this->tplPrefix, $tplIdx)); + + $this->lastUsedTemplateData = $tplData; + + return array('w' => $w, 'h' => $h); } - + /** - * Get The calculated Size of a Template + * Get the calculated size of a template. * * If one size is given, this method calculates the other one. * - * @param int $tplidx A valid template-Id - * @param int $_w The width of the template - * @param int $_h The height of the template - * @return array The height and width of the template + * @param int $tplIdx A valid template-id + * @param int $w The width of the template + * @param int $h The height of the template + * @return array The height and width of the template (array('w' => ..., 'h' => ...)) */ - function getTemplateSize($tplidx, $_w = 0, $_h = 0) { - if (!isset($this->tpls[$tplidx])) + public function getTemplateSize($tplIdx, $w = 0, $h = 0) + { + if (!isset($this->_tpls[$tplIdx])) return false; - $tpl =& $this->tpls[$tplidx]; - $w = $tpl['w']; - $h = $tpl['h']; - - if ($_w == 0 and $_h == 0) { - $_w = $w; - $_h = $h; + $tpl = $this->_tpls[$tplIdx]; + $_w = $tpl['w']; + $_h = $tpl['h']; + + if ($w == 0 && $h == 0) { + $w = $_w; + $h = $_h; } - if($_w == 0) - $_w = $_h * $w / $h; - if($_h == 0) - $_h = $_w * $h / $w; - - return array("w" => $_w, "h" => $_h); + if ($w == 0) + $w = $h * $_w / $_h; + if($h == 0) + $h = $w * $_h / $_w; + + return array("w" => $w, "h" => $h); } - + /** - * See FPDF/TCPDF-Documentation ;-) + * Sets the font used to print character strings. + * + * See FPDF/TCPDF documentation. + * + * @see http://fpdf.org/en/doc/setfont.htm + * @see http://www.tcpdf.org/doc/code/classTCPDF.html#afd56e360c43553830d543323e81bc045 */ - public function SetFont($family, $style = '', $size = 0) { + public function SetFont($family, $style = '', $size = null, $fontfile = '', $subset = 'default', $out = true) + { if (is_subclass_of($this, 'TCPDF')) { - $args = func_get_args(); - return call_user_func_array(array($this, 'TCPDF::SetFont'), $args); + $args = func_get_args(); + return call_user_func_array(array($this, 'TCPDF::SetFont'), $args); } - + parent::SetFont($family, $style, $size); - + $fontkey = $this->FontFamily . $this->FontStyle; - - if ($this->_intpl) { + + if ($this->_inTpl) { $this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey]; } else { $this->_res['page'][$this->page]['fonts'][$fontkey] =& $this->fonts[$fontkey]; } } - + /** - * See FPDF/TCPDF-Documentation ;-) + * Puts an image. + * + * See FPDF/TCPDF documentation. + * + * @see http://fpdf.org/en/doc/image.htm + * @see http://www.tcpdf.org/doc/code/classTCPDF.html#a714c2bee7d6b39d4d6d304540c761352 */ - function Image( - $file, $x = '', $y = '', $w = 0, $h = 0, $type = '', $link = '', $align = '', $resize = false, - $dpi = 300, $palign = '', $ismask = false, $imgmask = false, $border = 0, $fitbox = false, - $hidden = false, $fitonpage = false, $alt = false, $altimgs = array() - ) { + public function Image( + $file, $x = '', $y = '', $w = 0, $h = 0, $type = '', $link = '', $align = '', $resize = false, + $dpi = 300, $palign = '', $ismask = false, $imgmask = false, $border = 0, $fitbox = false, + $hidden = false, $fitonpage = false, $alt = false, $altimgs = array() + ) + { if (is_subclass_of($this, 'TCPDF')) { - $args = func_get_args(); - return call_user_func_array(array($this, 'TCPDF::Image'), $args); + $args = func_get_args(); + return call_user_func_array(array($this, 'TCPDF::Image'), $args); } - + $ret = parent::Image($file, $x, $y, $w, $h, $type, $link); - if ($this->_intpl) { + if ($this->_inTpl) { $this->_res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file]; } else { $this->_res['page'][$this->page]['images'][$file] =& $this->images[$file]; } - + return $ret; } - + /** - * See FPDF-Documentation ;-) + * Adds a new page to the document. * - * AddPage is not available when you're "in" a template. + * See FPDF/TCPDF documentation. + * + * This method cannot be used if you'd started a template. + * + * @see http://fpdf.org/en/doc/addpage.htm + * @see http://www.tcpdf.org/doc/code/classTCPDF.html#a5171e20b366b74523709d84c349c1ced */ - function AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false) { - if (is_subclass_of($this, 'TCPDF')) { - $args = func_get_args(); - return call_user_func_array(array($this, 'TCPDF::AddPage'), $args); + public function AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false) + { + if (is_subclass_of($this, 'TCPDF')) { + $args = func_get_args(); + return call_user_func_array(array($this, 'TCPDF::AddPage'), $args); } - - if ($this->_intpl) - $this->Error('Adding pages in templates isn\'t possible!'); - + + if ($this->_inTpl) { + throw new LogicException('Adding pages in templates is not possible!'); + } + parent::AddPage($orientation, $format); } /** - * Preserve adding Links in Templates ...won't work + * Puts a link on a rectangular area of the page. + * + * Overwritten because adding links in a template will not work. + * + * @see http://fpdf.org/en/doc/link.htm + * @see http://www.tcpdf.org/doc/code/classTCPDF.html#ab87bf1826384fbfe30eb499d42f1d994 */ - function Link($x, $y, $w, $h, $link, $spaces = 0) { + public function Link($x, $y, $w, $h, $link, $spaces = 0) + { if (is_subclass_of($this, 'TCPDF')) { - $args = func_get_args(); - return call_user_func_array(array($this, 'TCPDF::Link'), $args); + $args = func_get_args(); + return call_user_func_array(array($this, 'TCPDF::Link'), $args); } - - if ($this->_intpl) - $this->Error('Using links in templates aren\'t possible!'); - + + if ($this->_inTpl) { + throw new LogicException('Using links in templates is not posible!'); + } + parent::Link($x, $y, $w, $h, $link); } - - function AddLink() { - if (is_subclass_of($this, 'TCPDF')) { - $args = func_get_args(); - return call_user_func_array(array($this, 'TCPDF::AddLink'), $args); + + /** + * Creates a new internal link and returns its identifier. + * + * Overwritten because adding links in a template will not work. + * + * @see http://fpdf.org/en/doc/addlink.htm + * @see http://www.tcpdf.org/doc/code/classTCPDF.html#a749522038ed7786c3e1701435dcb891e + */ + public function AddLink() + { + if (is_subclass_of($this, 'TCPDF')) { + $args = func_get_args(); + return call_user_func_array(array($this, 'TCPDF::AddLink'), $args); } - - if ($this->_intpl) - $this->Error('Adding links in templates aren\'t possible!'); + + if ($this->_inTpl) { + throw new LogicException('Adding links in templates is not possible!'); + } + return parent::AddLink(); } - - function SetLink($link, $y = 0, $page = -1) { - if (is_subclass_of($this, 'TCPDF')) { - $args = func_get_args(); - return call_user_func_array(array($this, 'TCPDF::SetLink'), $args); + + /** + * Defines the page and position a link points to. + * + * Overwritten because adding links in a template will not work. + * + * @see http://fpdf.org/en/doc/setlink.htm + * @see http://www.tcpdf.org/doc/code/classTCPDF.html#ace5be60e7857953ea5e2b89cb90df0ae + */ + public function SetLink($link, $y = 0, $page = -1) + { + if (is_subclass_of($this, 'TCPDF')) { + $args = func_get_args(); + return call_user_func_array(array($this, 'TCPDF::SetLink'), $args); } - - if ($this->_intpl) - $this->Error('Setting links in templates aren\'t possible!'); + + if ($this->_inTpl) { + throw new LogicException('Setting links in templates is not possible!'); + } + parent::SetLink($link, $y, $page); } - - /** - * Private Method that writes the form xobjects - */ - function _putformxobjects() { - $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; - reset($this->tpls); - foreach($this->tpls AS $tplidx => $tpl) { - $p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer']; - $this->_newobj(); - $this->tpls[$tplidx]['n'] = $this->n; - $this->_out('<<'.$filter.'/Type /XObject'); + /** + * Writes the form XObjects to the PDF document. + */ + protected function _putformxobjects() + { + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + reset($this->_tpls); + + foreach($this->_tpls AS $tplIdx => $tpl) { + $this->_newobj(); + $this->_tpls[$tplIdx]['n'] = $this->n; + $this->_out('<<'.$filter.'/Type /XObject'); $this->_out('/Subtype /Form'); $this->_out('/FormType 1'); $this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]', @@ -390,69 +464,90 @@ class FPDF_TPL extends FPDF { // ury ($tpl['h'] - $tpl['y']) * $this->k )); - + if ($tpl['x'] != 0 || $tpl['y'] != 0) { $this->_out(sprintf('/Matrix [1 0 0 1 %.5F %.5F]', - -$tpl['x'] * $this->k * 2, $tpl['y'] * $this->k * 2 + -$tpl['x'] * $this->k * 2, $tpl['y'] * $this->k * 2 )); } - - $this->_out('/Resources '); + $this->_out('/Resources '); $this->_out('<_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { - $this->_out('/Font <<'); - foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) - $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); - $this->_out('>>'); + + if (isset($this->_res['tpl'][$tplIdx])) { + $res = $this->_res['tpl'][$tplIdx]; + if (isset($res['fonts']) && count($res['fonts'])) { + $this->_out('/Font <<'); + + foreach($res['fonts'] as $font) { + $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); + } + + $this->_out('>>'); + } + + if(isset($res['images']) || isset($res['tpls'])) { + $this->_out('/XObject <<'); + + if (isset($res['images'])) { + foreach($res['images'] as $image) + $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); + } + + if (isset($res['tpls'])) { + foreach($res['tpls'] as $i => $_tpl) + $this->_out($this->tplPrefix . $i . ' ' . $_tpl['n'] . ' 0 R'); + } + + $this->_out('>>'); + } } - if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || - isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) - { - $this->_out('/XObject <<'); - if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { - foreach($this->_res['tpl'][$tplidx]['images'] as $image) - $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); - } - if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { - foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) - $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); - } - $this->_out('>>'); - } - $this->_out('>>'); - - $this->_out('/Length ' . strlen($p) . ' >>'); - $this->_putstream($p); - $this->_out('endobj'); + + $this->_out('>>'); + + $buffer = ($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer']; + $this->_out('/Length ' . strlen($buffer) . ' >>'); + $this->_putstream($buffer); + $this->_out('endobj'); } } - + /** - * Overwritten to add _putformxobjects() after _putimages() + * Output images. * + * Overwritten to add {@link _putformxobjects()} after _putimages(). */ - function _putimages() { + public function _putimages() + { parent::_putimages(); $this->_putformxobjects(); } - - function _putxobjectdict() { + + /** + * Writes the references of XObject resources to the document. + * + * Overwritten to add the the templates to the XObject resource dictionary. + */ + public function _putxobjectdict() + { parent::_putxobjectdict(); - - if (count($this->tpls)) { - foreach($this->tpls as $tplidx => $tpl) { - $this->_out(sprintf('%s%d %d 0 R', $this->tplprefix, $tplidx, $tpl['n'])); - } + + foreach($this->_tpls as $tplIdx => $tpl) { + $this->_out(sprintf('%s%d %d 0 R', $this->tplPrefix, $tplIdx, $tpl['n'])); } } /** - * Private Method + * Writes bytes to the resulting document. + * + * Overwritten to delegate the data to the template buffer. + * + * @param string $s */ - function _out($s) { - if ($this->state == 2 && $this->_intpl) { - $this->tpls[$this->tpl]['buffer'] .= $s . "\n"; + public function _out($s) + { + if ($this->state == 2 && $this->_inTpl) { + $this->_tpls[$this->tpl]['buffer'] .= $s . "\n"; } else { parent::_out($s); } diff --git a/htdocs/includes/fpdfi/fpdi.php b/htdocs/includes/fpdfi/fpdi.php index f6ba91f96de..957c50531e6 100644 --- a/htdocs/includes/fpdfi/fpdi.php +++ b/htdocs/includes/fpdfi/fpdi.php @@ -1,8 +1,8 @@ current_filename = $filename; + public function setSourceFile($filename) + { + $_filename = realpath($filename); + if (false !== $_filename) + $filename = $_filename; + + $this->currentFilename = $filename; - if (!isset($this->parsers[$filename])) + if (!isset($this->parsers[$filename])) { $this->parsers[$filename] = $this->_getPdfParser($filename); - $this->current_parser =& $this->parsers[$filename]; + $this->setPdfVersion( + max($this->getPdfVersion(), $this->parsers[$filename]->getPdfVersion()) + ); + } + + $this->currentParser =& $this->parsers[$filename]; return $this->parsers[$filename]->getPageCount(); } @@ -99,53 +122,80 @@ class FPDI extends FPDF_TPL { * @param string $filename * @return fpdi_pdf_parser */ - function _getPdfParser($filename) { - return new fpdi_pdf_parser($filename, $this); + protected function _getPdfParser($filename) + { + require_once('fpdi_pdf_parser.php'); + return new fpdi_pdf_parser($filename); } /** - * Get the current PDF version + * Get the current PDF version. * * @return string */ - function getPDFVersion() { + public function getPdfVersion() + { return $this->PDFVersion; } - /** - * Set the PDF version + /** + * Set the PDF version. * - * @return string + * @param string $version */ - function setPDFVersion($version = '1.3') { - $this->PDFVersion = $version; - } + public function setPdfVersion($version = '1.3') + { + $this->PDFVersion = sprintf('%.1F', $version); + } /** - * Import a page + * Import a page. * - * @param int $pageno pagenumber - * @return int Index of imported page - to use with fpdf_tpl::useTemplate() + * The second parameter defines the bounding box that should be used to transform the page into a + * form XObject. + * + * Following values are available: MediaBox, CropBox, BleedBox, TrimBox, ArtBox. + * If a box is not especially defined its default box will be used: + * + *
    + *
  • CropBox: Default -> MediaBox
  • + *
  • BleedBox: Default -> CropBox
  • + *
  • TrimBox: Default -> CropBox
  • + *
  • ArtBox: Default -> CropBox
  • + *
+ * + * It is possible to get the used page box by the {@link getLastUsedPageBox()} method. + * + * @param int $pageNo The page number + * @param string $boxName The boundary box to use when transforming the page into a form XObject + * @param boolean $groupXObject Define the form XObject as a group XObject to support transparency (if used) + * @return int An id of the imported page/template to use with e.g. fpdf_tpl::useTemplate() + * @throws LogicException|InvalidArgumentException + * @see getLastUsedPageBox() */ - function importPage($pageno, $boxName = '/CropBox') { - if ($this->_intpl) { - return $this->error('Please import the desired pages before creating a new template.'); + public function importPage($pageNo, $boxName = 'CropBox', $groupXObject = true) + { + if ($this->_inTpl) { + throw new LogicException('Please import the desired pages before creating a new template.'); } - $fn = $this->current_filename; - - // check if page already imported - $pageKey = $fn . '-' . ((int)$pageno) . $boxName; - if (isset($this->_importedPages[$pageKey])) - return $this->_importedPages[$pageKey]; - - $parser =& $this->parsers[$fn]; - $parser->setPageno($pageno); + $fn = $this->currentFilename; + $boxName = '/' . ltrim($boxName, '/'); - if (!in_array($boxName, $parser->availableBoxes)) - return $this->Error(sprintf('Unknown box: %s', $boxName)); + // check if page already imported + $pageKey = $fn . '-' . ((int)$pageNo) . $boxName; + if (isset($this->_importedPages[$pageKey])) { + return $this->_importedPages[$pageKey]; + } + + $parser = $this->parsers[$fn]; + $parser->setPageNo($pageNo); + + if (!in_array($boxName, $parser->availableBoxes)) { + throw new InvalidArgumentException(sprintf('Unknown box: %s', $boxName)); + } - $pageboxes = $parser->getPageBoxes($pageno, $this->k); + $pageBoxes = $parser->getPageBoxes($pageNo, $this->k); /** * MediaBox @@ -154,35 +204,39 @@ class FPDI extends FPDF_TPL { * TrimBox: Default -> CropBox * ArtBox: Default -> CropBox */ - if (!isset($pageboxes[$boxName]) && ($boxName == '/BleedBox' || $boxName == '/TrimBox' || $boxName == '/ArtBox')) + if (!isset($pageBoxes[$boxName]) && ($boxName == '/BleedBox' || $boxName == '/TrimBox' || $boxName == '/ArtBox')) $boxName = '/CropBox'; - if (!isset($pageboxes[$boxName]) && $boxName == '/CropBox') + if (!isset($pageBoxes[$boxName]) && $boxName == '/CropBox') $boxName = '/MediaBox'; - if (!isset($pageboxes[$boxName])) + if (!isset($pageBoxes[$boxName])) return false; $this->lastUsedPageBox = $boxName; - $box = $pageboxes[$boxName]; + $box = $pageBoxes[$boxName]; $this->tpl++; - $this->tpls[$this->tpl] = array(); - $tpl =& $this->tpls[$this->tpl]; - $tpl['parser'] =& $parser; + $this->_tpls[$this->tpl] = array(); + $tpl =& $this->_tpls[$this->tpl]; + $tpl['parser'] = $parser; $tpl['resources'] = $parser->getPageResources(); $tpl['buffer'] = $parser->getContent(); $tpl['box'] = $box; - + $tpl['groupXObject'] = $groupXObject; + if ($groupXObject) { + $this->setPdfVersion(max($this->getPdfVersion(), 1.4)); + } + // To build an array that can be used by PDF_TPL::useTemplate() - $this->tpls[$this->tpl] = array_merge($this->tpls[$this->tpl], $box); + $this->_tpls[$this->tpl] = array_merge($this->_tpls[$this->tpl], $box); - // An imported page will start at 0,0 everytime. Translation will be set in _putformxobjects() + // An imported page will start at 0,0 all the time. Translation will be set in _putformxobjects() $tpl['x'] = 0; $tpl['y'] = 0; // handle rotated pages - $rotation = $parser->getPageRotation($pageno); + $rotation = $parser->getPageRotation($pageNo); $tpl['_rotationAngle'] = 0; if (isset($rotation[1]) && ($angle = $rotation[1] % 360) != 0) { $steps = $angle / 90; @@ -204,18 +258,41 @@ class FPDI extends FPDF_TPL { } /** - * Returns the last used page box + * Returns the last used page boundary box. * - * @return string + * @return string The used boundary box: MediaBox, CropBox, BleedBox, TrimBox or ArtBox */ - function getLastUsedPageBox() { + public function getLastUsedPageBox() + { return $this->lastUsedPageBox; } - - - function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0, $adjustPageSize = false) { - if ($adjustPageSize == true && is_null($_x) && is_null($_y)) { - $size = $this->getTemplateSize($tplidx, $_w, $_h); + + /** + * Use a template or imported page in current page or other template. + * + * You can use a template in a page or in another template. + * You can give the used template a new size. All parameters are optional. + * The width or height is calculated automatically if one is given. If no + * parameter is given the origin size as defined in beginTemplate() or of + * the imported page is used. + * + * The calculated or used width and height are returned as an array. + * + * @param int $tplIdx A valid template-id + * @param int $x The x-position + * @param int $y The y-position + * @param int $w The new width of the template + * @param int $h The new height of the template + * @param boolean $adjustPageSize If set to true the current page will be resized to fit the dimensions + * of the template + * + * @return array The height and width of the template (array('w' => ..., 'h' => ...)) + * @throws LogicException|InvalidArgumentException + */ + public function useTemplate($tplIdx, $x = null, $y = null, $w = 0, $h = 0, $adjustPageSize = false) + { + if ($adjustPageSize == true && is_null($x) && is_null($y)) { + $size = $this->getTemplateSize($tplIdx, $w, $h); $orientation = $size['w'] > $size['h'] ? 'L' : 'P'; $size = array($size['w'], $size['h']); @@ -224,22 +301,21 @@ class FPDI extends FPDF_TPL { } else { $size = $this->_getpagesize($size); - if($orientation!=$this->CurOrientation || $size[0]!=$this->CurPageSize[0] || $size[1]!=$this->CurPageSize[1]) - { + if($orientation != $this->CurOrientation || + $size[0] != $this->CurPageSize[0] || + $size[1] != $this->CurPageSize[1] + ) { // New size or orientation - if($orientation=='P') - { + if ($orientation=='P') { $this->w = $size[0]; $this->h = $size[1]; - } - else - { + } else { $this->w = $size[1]; $this->h = $size[0]; } - $this->wPt = $this->w*$this->k; - $this->hPt = $this->h*$this->k; - $this->PageBreakTrigger = $this->h-$this->bMargin; + $this->wPt = $this->w * $this->k; + $this->hPt = $this->h * $this->k; + $this->PageBreakTrigger = $this->h - $this->bMargin; $this->CurOrientation = $orientation; $this->CurPageSize = $size; $this->PageSizes[$this->page] = array($this->wPt, $this->hPt); @@ -248,54 +324,57 @@ class FPDI extends FPDF_TPL { } $this->_out('q 0 J 1 w 0 j 0 G 0 g'); // reset standard values - $s = parent::useTemplate($tplidx, $_x, $_y, $_w, $_h); + $size = parent::useTemplate($tplIdx, $x, $y, $w, $h); $this->_out('Q'); - return $s; + return $size; } /** - * Private method, that rebuilds all needed objects of source files + * Copy all imported objects to the resulting document. */ - function _putimportedobjects() { - if (is_array($this->parsers) && count($this->parsers) > 0) { - foreach($this->parsers AS $filename => $p) { - $this->current_parser =& $this->parsers[$filename]; - if (isset($this->_obj_stack[$filename]) && is_array($this->_obj_stack[$filename])) { - while(($n = key($this->_obj_stack[$filename])) !== null) { - $nObj = $this->current_parser->pdf_resolve_object($this->current_parser->c, $this->_obj_stack[$filename][$n][1]); - - $this->_newobj($this->_obj_stack[$filename][$n][0]); - - if ($nObj[0] == PDF_TYPE_STREAM) { - $this->pdf_write_value($nObj); - } else { - $this->pdf_write_value($nObj[1]); - } - - $this->_out('endobj'); - $this->_obj_stack[$filename][$n] = null; // free memory - unset($this->_obj_stack[$filename][$n]); - reset($this->_obj_stack[$filename]); - } + protected function _putimportedobjects() + { + foreach($this->parsers AS $filename => $p) { + $this->currentParser =& $p; + if (!isset($this->_objStack[$filename]) || !is_array($this->_objStack[$filename])) { + continue; + } + while(($n = key($this->_objStack[$filename])) !== null) { + try { + $nObj = $this->currentParser->resolveObject($this->_objStack[$filename][$n][1]); + } catch (Exception $e) { + $nObj = array(pdf_parser::TYPE_OBJECT, pdf_parser::TYPE_NULL); } + + $this->_newobj($this->_objStack[$filename][$n][0]); + + if ($nObj[0] == pdf_parser::TYPE_STREAM) { + $this->_writeValue($nObj); + } else { + $this->_writeValue($nObj[1]); + } + + $this->_out("\nendobj"); + $this->_objStack[$filename][$n] = null; // free memory + unset($this->_objStack[$filename][$n]); + reset($this->_objStack[$filename]); } } } - - + /** - * Private Method that writes the form xobjects + * Writes the form XObjects to the PDF document. */ - function _putformxobjects() { - $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; - reset($this->tpls); - foreach($this->tpls AS $tplidx => $tpl) { - $p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer']; - $this->_newobj(); - $cN = $this->n; // TCPDF/Protection: rem current "n" + protected function _putformxobjects() + { + $filter = ($this->compress) ? '/Filter /FlateDecode ' : ''; + reset($this->_tpls); + foreach($this->_tpls AS $tplIdx => $tpl) { + $this->_newobj(); + $currentN = $this->n; // TCPDF/Protection: rem current "n" - $this->tpls[$tplidx]['n'] = $this->n; + $this->_tpls[$tplIdx]['n'] = $this->n; $this->_out('<<' . $filter . '/Type /XObject'); $this->_out('/Subtype /Form'); $this->_out('/FormType 1'); @@ -318,8 +397,8 @@ class FPDI extends FPDF_TPL { if ($tpl['_rotationAngle'] <> 0) { $angle = $tpl['_rotationAngle'] * M_PI/180; - $c=cos($angle); - $s=sin($angle); + $c = cos($angle); + $s = sin($angle); switch($tpl['_rotationAngle']) { case -90: @@ -353,87 +432,107 @@ class FPDI extends FPDF_TPL { $this->_out('/Resources '); if (isset($tpl['resources'])) { - $this->current_parser =& $tpl['parser']; - $this->pdf_write_value($tpl['resources']); // "n" will be changed + $this->currentParser = $tpl['parser']; + $this->_writeValue($tpl['resources']); // "n" will be changed } else { + $this->_out('<_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { - $this->_out('/Font <<'); - foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) - $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); - $this->_out('>>'); - } - if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || - isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) - { - $this->_out('/XObject <<'); - if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { - foreach($this->_res['tpl'][$tplidx]['images'] as $image) - $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); + if (isset($this->_res['tpl'][$tplIdx])) { + $res = $this->_res['tpl'][$tplIdx]; + + if (isset($res['fonts']) && count($res['fonts'])) { + $this->_out('/Font <<'); + foreach ($res['fonts'] as $font) + $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); + $this->_out('>>'); } - if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { - foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) - $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); + if (isset($res['images']) && count($res['images']) || + isset($res['tpls']) && count($res['tpls'])) + { + $this->_out('/XObject <<'); + if (isset($res['images'])) { + foreach ($res['images'] as $image) + $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); + } + if (isset($res['tpls'])) { + foreach ($res['tpls'] as $i => $_tpl) + $this->_out($this->tplPrefix . $i . ' ' . $_tpl['n'] . ' 0 R'); + } + $this->_out('>>'); } $this->_out('>>'); - } - $this->_out('>>'); + } } - $nN = $this->n; // TCPDF: rem new "n" - $this->n = $cN; // TCPDF: reset to current "n" + if (isset($tpl['groupXObject']) && $tpl['groupXObject']) { + $this->_out('/Group <>'); + } + + $newN = $this->n; // TCPDF: rem new "n" + $this->n = $currentN; // TCPDF: reset to current "n" + + $buffer = ($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer']; + if (is_subclass_of($this, 'TCPDF')) { - $p = $this->_getrawstream($p); - $this->_out('/Length ' . strlen($p) . ' >>'); - $this->_out("stream\n" . $p . "\nendstream"); + $buffer = $this->_getrawstream($buffer); + $this->_out('/Length ' . strlen($buffer) . ' >>'); + $this->_out("stream\n" . $buffer . "\nendstream"); } else { - $this->_out('/Length ' . strlen($p) . ' >>'); - $this->_putstream($p); + $this->_out('/Length ' . strlen($buffer) . ' >>'); + $this->_putstream($buffer); } $this->_out('endobj'); - $this->n = $nN; // TCPDF: reset to new "n" + $this->n = $newN; // TCPDF: reset to new "n" } $this->_putimportedobjects(); } /** + * Creates and optionally write the object definition to the document. + * * Rewritten to handle existing own defined objects + * + * @param bool $objId + * @param bool $onlyNewObj + * @return bool|int */ - function _newobj($obj_id = false, $onlynewobj = false) { - if (!$obj_id) { - $obj_id = ++$this->n; + public function _newobj($objId = false, $onlyNewObj = false) + { + if (!$objId) { + $objId = ++$this->n; } //Begin a new object - if (!$onlynewobj) { - $this->offsets[$obj_id] = is_subclass_of($this, 'TCPDF') ? $this->bufferlen : strlen($this->buffer); - $this->_out($obj_id . ' 0 obj'); - $this->_current_obj_id = $obj_id; // for later use with encryption + if (!$onlyNewObj) { + $this->offsets[$objId] = is_subclass_of($this, 'TCPDF') ? $this->bufferlen : strlen($this->buffer); + $this->_out($objId . ' 0 obj'); + $this->_currentObjId = $objId; // for later use with encryption } - return $obj_id; + return $objId; } /** - * Writes a value + * Writes a PDF value to the resulting document. + * * Needed to rebuild the source document * * @param mixed $value A PDF-Value. Structure of values see cases in this method */ - function pdf_write_value(&$value) + protected function _writeValue(&$value) { if (is_subclass_of($this, 'TCPDF')) { - parent::pdf_write_value($value); + parent::_prepareValue($value); } switch ($value[0]) { - case PDF_TYPE_TOKEN: + case pdf_parser::TYPE_TOKEN: $this->_straightOut($value[1] . ' '); break; - case PDF_TYPE_NUMERIC: - case PDF_TYPE_REAL: + case pdf_parser::TYPE_NUMERIC: + case pdf_parser::TYPE_REAL: if (is_float($value[1]) && $value[1] != 0) { $this->_straightOut(rtrim(rtrim(sprintf('%F', $value[1]), '0'), '.') . ' '); } else { @@ -441,20 +540,20 @@ class FPDI extends FPDF_TPL { } break; - case PDF_TYPE_ARRAY: + case pdf_parser::TYPE_ARRAY: // An array. Output the proper // structure and move on. $this->_straightOut('['); for ($i = 0; $i < count($value[1]); $i++) { - $this->pdf_write_value($value[1][$i]); + $this->_writeValue($value[1][$i]); } $this->_out(']'); break; - case PDF_TYPE_DICTIONARY: + case pdf_parser::TYPE_DICTIONARY: // A dictionary. $this->_straightOut('<<'); @@ -463,55 +562,54 @@ class FPDI extends FPDF_TPL { while (list($k, $v) = each($value[1])) { $this->_straightOut($k . ' '); - $this->pdf_write_value($v); + $this->_writeValue($v); } $this->_straightOut('>>'); break; - case PDF_TYPE_OBJREF: + case pdf_parser::TYPE_OBJREF: // An indirect object reference // Fill the object stack if needed - $cpfn =& $this->current_parser->filename; - - if (!isset($this->_don_obj_stack[$cpfn][$value[1]])) { + $cpfn =& $this->currentParser->filename; + if (!isset($this->_doneObjStack[$cpfn][$value[1]])) { $this->_newobj(false, true); - $this->_obj_stack[$cpfn][$value[1]] = array($this->n, $value); - $this->_don_obj_stack[$cpfn][$value[1]] = array($this->n, $value); // Value is maybee obsolete!!! + $this->_objStack[$cpfn][$value[1]] = array($this->n, $value); + $this->_doneObjStack[$cpfn][$value[1]] = array($this->n, $value); } - $objid = $this->_don_obj_stack[$cpfn][$value[1]][0]; + $objId = $this->_doneObjStack[$cpfn][$value[1]][0]; - $this->_out($objid . ' 0 R'); + $this->_out($objId . ' 0 R'); break; - case PDF_TYPE_STRING: + case pdf_parser::TYPE_STRING: // A string. $this->_straightOut('(' . $value[1] . ')'); break; - case PDF_TYPE_STREAM: + case pdf_parser::TYPE_STREAM: // A stream. First, output the // stream dictionary, then the // stream data itself. - $this->pdf_write_value($value[1]); + $this->_writeValue($value[1]); $this->_out('stream'); $this->_out($value[2][1]); - $this->_out('endstream'); + $this->_straightOut("endstream"); break; - case PDF_TYPE_HEX: + case pdf_parser::TYPE_HEX: $this->_straightOut('<' . $value[1] . '>'); break; - case PDF_TYPE_BOOLEAN: + case pdf_parser::TYPE_BOOLEAN: $this->_straightOut($value[1] ? 'true ' : 'false '); break; - case PDF_TYPE_NULL: + case pdf_parser::TYPE_NULL: // The null object. $this->_straightOut('null '); @@ -521,51 +619,77 @@ class FPDI extends FPDF_TPL { /** - * Modified so not each call will add a newline to the output. + * Modified _out() method so not each call will add a newline to the output. */ - function _straightOut($s) { + protected function _straightOut($s) + { if (!is_subclass_of($this, 'TCPDF')) { - if($this->state==2) + if ($this->state == 2) { $this->pages[$this->page] .= $s; - else + } else { $this->buffer .= $s; + } + } else { if ($this->state == 2) { - if (isset($this->footerlen[$this->page]) AND ($this->footerlen[$this->page] > 0)) { + if ($this->inxobj) { + // we are inside an XObject template + $this->xobjects[$this->xobjid]['outdata'] .= $s; + } else if ((!$this->InFooter) AND isset($this->footerlen[$this->page]) AND ($this->footerlen[$this->page] > 0)) { // puts data before page footer - $page = substr($this->getPageBuffer($this->page), 0, -$this->footerlen[$this->page]); - $footer = substr($this->getPageBuffer($this->page), -$this->footerlen[$this->page]); - $this->setPageBuffer($this->page, $page . ' ' . $s . "\n" . $footer); + $pagebuff = $this->getPageBuffer($this->page); + $page = substr($pagebuff, 0, -$this->footerlen[$this->page]); + $footer = substr($pagebuff, -$this->footerlen[$this->page]); + $this->setPageBuffer($this->page, $page . $s . $footer); + // update footer position + $this->footerpos[$this->page] += strlen($s); } else { + // set page data $this->setPageBuffer($this->page, $s, true); } - } else { + } else if ($this->state > 0) { + // set general data $this->setBuffer($s); } } } /** - * rewritten to close opened parsers + * Ends the document * + * Overwritten to close opened parsers */ - function _enddoc() { + public function _enddoc() + { parent::_enddoc(); $this->_closeParsers(); } /** - * close all files opened by parsers + * Close all files opened by parsers. + * + * @return boolean */ - function _closeParsers() { - if ($this->state > 2 && count($this->parsers) > 0) { - foreach ($this->parsers as $k => $_){ - $this->parsers[$k]->closeFile(); - $this->parsers[$k] = null; - unset($this->parsers[$k]); - } + protected function _closeParsers() + { + if ($this->state > 2) { + $this->cleanUp(); return true; } + return false; } + + /** + * Removes cycled references and closes the file handles of the parser objects. + */ + public function cleanUp() + { + while (($parser = array_pop($this->parsers)) !== null) { + /** + * @var fpdi_pdf_parser $parser + */ + $parser->closeFile(); + } + } } \ No newline at end of file diff --git a/htdocs/includes/fpdfi/fpdi2tcpdf_bridge.php b/htdocs/includes/fpdfi/fpdi2tcpdf_bridge.php deleted file mode 100644 index 8a031a38c69..00000000000 --- a/htdocs/includes/fpdfi/fpdi2tcpdf_bridge.php +++ /dev/null @@ -1,167 +0,0 @@ -_out($this->_getstream($s)); - } - - function _getxobjectdict() { - $out = parent::_getxobjectdict(); - if (count($this->tpls)) { - foreach($this->tpls as $tplidx => $tpl) { - $out .= sprintf('%s%d %d 0 R', $this->tplprefix, $tplidx, $tpl['n']); - } - } - - return $out; - } - - /** - * Encryption of imported data by FPDI - * - * @param array $value - */ - function pdf_write_value(&$value) { - switch ($value[0]) { - case PDF_TYPE_STRING: - if ($this->encrypted) { - $value[1] = $this->_unescape($value[1]); - $value[1] = $this->_encrypt_data($this->_current_obj_id, $value[1]); - $value[1] = $this->_escape($value[1]); - } - break; - - case PDF_TYPE_STREAM: - if ($this->encrypted) { - $value[2][1] = $this->_encrypt_data($this->_current_obj_id, $value[2][1]); - $value[1][1]['/Length'] = array( - PDF_TYPE_NUMERIC, - strlen($value[2][1]) - ); - } - break; - - case PDF_TYPE_HEX: - if ($this->encrypted) { - $value[1] = $this->hex2str($value[1]); - $value[1] = $this->_encrypt_data($this->_current_obj_id, $value[1]); - - // remake hexstring of encrypted string - $value[1] = $this->str2hex($value[1]); - } - break; - } - } - - /** - * Unescapes a PDF string - * - * @param string $s - * @return string - */ - function _unescape($s) { - $out = ''; - for ($count = 0, $n = strlen($s); $count < $n; $count++) { - if ($s[$count] != '\\' || $count == $n-1) { - $out .= $s[$count]; - } else { - switch ($s[++$count]) { - case ')': - case '(': - case '\\': - $out .= $s[$count]; - break; - case 'f': - $out .= chr(0x0C); - break; - case 'b': - $out .= chr(0x08); - break; - case 't': - $out .= chr(0x09); - break; - case 'r': - $out .= chr(0x0D); - break; - case 'n': - $out .= chr(0x0A); - break; - case "\r": - if ($count != $n-1 && $s[$count+1] == "\n") - $count++; - break; - case "\n": - break; - default: - // Octal-Values - if (ord($s[$count]) >= ord('0') && - ord($s[$count]) <= ord('9')) { - $oct = ''. $s[$count]; - - if (ord($s[$count+1]) >= ord('0') && - ord($s[$count+1]) <= ord('9')) { - $oct .= $s[++$count]; - - if (ord($s[$count+1]) >= ord('0') && - ord($s[$count+1]) <= ord('9')) { - $oct .= $s[++$count]; - } - } - - $out .= chr(octdec($oct)); - } else { - $out .= $s[$count]; - } - } - } - } - return $out; - } - - /** - * Hexadecimal to string - * - * @param string $hex - * @return string - */ - function hex2str($hex) { - return pack('H*', str_replace(array("\r", "\n", ' '), '', $hex)); - } - - /** - * String to hexadecimal - * - * @param string $str - * @return string - */ - function str2hex($str) { - return current(unpack('H*', $str)); - } -} \ No newline at end of file diff --git a/htdocs/includes/fpdfi/fpdi_bridge.php b/htdocs/includes/fpdfi/fpdi_bridge.php new file mode 100644 index 00000000000..f89822d9510 --- /dev/null +++ b/htdocs/includes/fpdfi/fpdi_bridge.php @@ -0,0 +1,215 @@ +_tpls as $tplIdx => $tpl) { + $out .= sprintf('%s%d %d 0 R', $this->tplPrefix, $tplIdx, $tpl['n']); + } + + return $out; + } + + /** + * Writes a PDF value to the resulting document. + * + * Prepares the value for encryption of imported data by FPDI + * + * @param array $value + */ + protected function _prepareValue(&$value) + { + switch ($value[0]) { + case pdf_parser::TYPE_STRING: + if ($this->encrypted) { + $value[1] = $this->_unescape($value[1]); + $value[1] = $this->_encrypt_data($this->_currentObjId, $value[1]); + $value[1] = TCPDF_STATIC::_escape($value[1]); + } + break; + + case pdf_parser::TYPE_STREAM: + if ($this->encrypted) { + $value[2][1] = $this->_encrypt_data($this->_currentObjId, $value[2][1]); + $value[1][1]['/Length'] = array( + pdf_parser::TYPE_NUMERIC, + strlen($value[2][1]) + ); + } + break; + + case pdf_parser::TYPE_HEX: + if ($this->encrypted) { + $value[1] = $this->hex2str($value[1]); + $value[1] = $this->_encrypt_data($this->_currentObjId, $value[1]); + + // remake hexstring of encrypted string + $value[1] = $this->str2hex($value[1]); + } + break; + } + } + + /** + * Un-escapes a PDF string + * + * @param string $s + * @return string + */ + protected function _unescape($s) + { + $out = ''; + for ($count = 0, $n = strlen($s); $count < $n; $count++) { + if ($s[$count] != '\\' || $count == $n-1) { + $out .= $s[$count]; + } else { + switch ($s[++$count]) { + case ')': + case '(': + case '\\': + $out .= $s[$count]; + break; + case 'f': + $out .= chr(0x0C); + break; + case 'b': + $out .= chr(0x08); + break; + case 't': + $out .= chr(0x09); + break; + case 'r': + $out .= chr(0x0D); + break; + case 'n': + $out .= chr(0x0A); + break; + case "\r": + if ($count != $n-1 && $s[$count+1] == "\n") + $count++; + break; + case "\n": + break; + default: + // Octal-Values + if (ord($s[$count]) >= ord('0') && + ord($s[$count]) <= ord('9')) { + $oct = ''. $s[$count]; + + if (ord($s[$count+1]) >= ord('0') && + ord($s[$count+1]) <= ord('9')) { + $oct .= $s[++$count]; + + if (ord($s[$count+1]) >= ord('0') && + ord($s[$count+1]) <= ord('9')) { + $oct .= $s[++$count]; + } + } + + $out .= chr(octdec($oct)); + } else { + $out .= $s[$count]; + } + } + } + } + return $out; + } + + /** + * Hexadecimal to string + * + * @param string $data + * @return string + */ + public function hex2str($data) + { + $data = preg_replace('/[^0-9A-Fa-f]/', '', rtrim($data, '>')); + if ((strlen($data) % 2) == 1) { + $data .= '0'; + } + + return pack('H*', $data); + } + + /** + * String to hexadecimal + * + * @param string $str + * @return string + */ + public function str2hex($str) + { + return current(unpack('H*', $str)); + } + } +} \ No newline at end of file diff --git a/htdocs/includes/fpdfi/fpdi_pdf_parser.php b/htdocs/includes/fpdfi/fpdi_pdf_parser.php index 9da790507f3..9e76341b0cd 100644 --- a/htdocs/includes/fpdfi/fpdi_pdf_parser.php +++ b/htdocs/includes/fpdfi/fpdi_pdf_parser.php @@ -1,8 +1,8 @@ fpdi =& $fpdi; - - parent::pdf_parser($filename); + public function __construct($filename) + { + parent::__construct($filename); // resolve Pages-Dictonary - $pages = $this->pdf_resolve_object($this->c, $this->root[1][1]['/Pages']); + $pages = $this->resolveObject($this->_root[1][1]['/Pages']); // Read pages - $this->read_pages($this->c, $pages, $this->pages); + $this->_readPages($pages, $this->_pages); // count pages; - $this->page_count = count($this->pages); + $this->_pageCount = count($this->_pages); } /** - * Overwrite parent::error() - * - * @param string $msg Error-Message - */ - function error($msg) { - $this->fpdi->error($msg); - } - - /** - * Get pagecount from sourcefile + * Get page count from source file. * * @return int */ - function getPageCount() { - return $this->page_count; + public function getPageCount() + { + return $this->_pageCount; } - /** - * Set pageno + * Set the page number. * - * @param int $pageno Pagenumber to use + * @param int $pageNo Page number to use + * @throws InvalidArgumentException */ - function setPageno($pageno) { - $pageno = ((int) $pageno) - 1; + public function setPageNo($pageNo) + { + $pageNo = ((int) $pageNo) - 1; - if ($pageno < 0 || $pageno >= $this->getPageCount()) { - $this->fpdi->error('Pagenumber is wrong!'); + if ($pageNo < 0 || $pageNo >= $this->getPageCount()) { + throw new InvalidArgumentException('Invalid page number!'); } - $this->pageno = $pageno; + $this->pageNo = $pageNo; } /** * Get page-resources from current page * - * @return array + * @return array|boolean */ - function getPageResources() { - return $this->_getPageResources($this->pages[$this->pageno]); + public function getPageResources() + { + return $this->_getPageResources($this->_pages[$this->pageNo]); } /** - * Get page-resources from /Page + * Get page-resources from a /Page dictionary. * * @param array $obj Array of pdf-data + * @return array|boolean */ - function _getPageResources ($obj) { // $obj = /Page - $obj = $this->pdf_resolve_object($this->c, $obj); + protected function _getPageResources($obj) + { + $obj = $this->resolveObject($obj); // If the current object has a resources // dictionary associated with it, we use // it. Otherwise, we move back to its // parent object. - if (isset ($obj[1][1]['/Resources'])) { - $res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Resources']); - if ($res[0] == PDF_TYPE_OBJECT) + if (isset($obj[1][1]['/Resources'])) { + $res = $this->resolveObject($obj[1][1]['/Resources']); + if ($res[0] == pdf_parser::TYPE_OBJECT) return $res[1]; return $res; - } else { - if (!isset ($obj[1][1]['/Parent'])) { - return false; - } else { - $res = $this->_getPageResources($obj[1][1]['/Parent']); - if ($res[0] == PDF_TYPE_OBJECT) - return $res[1]; - return $res; - } } + + if (!isset($obj[1][1]['/Parent'])) { + return false; + } + + $res = $this->_getPageResources($obj[1][1]['/Parent']); + if ($res[0] == pdf_parser::TYPE_OBJECT) + return $res[1]; + return $res; } - /** - * Get content of current page + * Get content of current page. * - * If more /Contents is an array, the streams are concated + * If /Contents is an array, the streams are concatenated * * @return string */ - function getContent() { + public function getContent() + { $buffer = ''; - if (isset($this->pages[$this->pageno][1][1]['/Contents'])) { - $contents = $this->_getPageContent($this->pages[$this->pageno][1][1]['/Contents']); - foreach($contents AS $tmp_content) { - $buffer .= $this->_rebuildContentStream($tmp_content) . ' '; + if (isset($this->_pages[$this->pageNo][1][1]['/Contents'])) { + $contents = $this->_getPageContent($this->_pages[$this->pageNo][1][1]['/Contents']); + foreach ($contents AS $tmpContent) { + $buffer .= $this->_unFilterStream($tmpContent) . ' '; } } return $buffer; } - - + /** - * Resolve all content-objects + * Resolve all content objects. * - * @param array $content_ref + * @param array $contentRef * @return array */ - function _getPageContent($content_ref) { + protected function _getPageContent($contentRef) + { $contents = array(); - if ($content_ref[0] == PDF_TYPE_OBJREF) { - $content = $this->pdf_resolve_object($this->c, $content_ref); - if ($content[1][0] == PDF_TYPE_ARRAY) { + if ($contentRef[0] == pdf_parser::TYPE_OBJREF) { + $content = $this->resolveObject($contentRef); + if ($content[1][0] == pdf_parser::TYPE_ARRAY) { $contents = $this->_getPageContent($content[1]); } else { $contents[] = $content; } - } else if ($content_ref[0] == PDF_TYPE_ARRAY) { - foreach ($content_ref[1] AS $tmp_content_ref) { - $contents = array_merge($contents,$this->_getPageContent($tmp_content_ref)); + } else if ($contentRef[0] == pdf_parser::TYPE_ARRAY) { + foreach ($contentRef[1] AS $tmp_content_ref) { + $contents = array_merge($contents, $this->_getPageContent($tmp_content_ref)); } } return $contents; } - /** - * Rebuild content-streams + * Get a boundary box from a page * - * @param array $obj - * @return string - */ - function _rebuildContentStream($obj) { - $filters = array(); - - if (isset($obj[1][1]['/Filter'])) { - $_filter = $obj[1][1]['/Filter']; - - if ($_filter[0] == PDF_TYPE_OBJREF) { - $tmpFilter = $this->pdf_resolve_object($this->c, $_filter); - $_filter = $tmpFilter[1]; - } - - if ($_filter[0] == PDF_TYPE_TOKEN) { - $filters[] = $_filter; - } else if ($_filter[0] == PDF_TYPE_ARRAY) { - $filters = $_filter[1]; - } - } - - $stream = $obj[2][1]; - - foreach ($filters AS $_filter) { - switch ($_filter[1]) { - case '/FlateDecode': - case '/Fl': - // $stream .= "\x0F\x0D"; // in an errorious stream this suffix could work - // $stream .= "\x0A"; - // $stream .= "\x0D"; - if (function_exists('gzuncompress')) { - $stream = (strlen($stream) > 0) ? @gzuncompress($stream) : ''; - } else { - $this->error(sprintf('To handle %s filter, please compile php with zlib support.',$_filter[1])); - } - - if ($stream === false) { - $this->error('Error while decompressing stream.'); - } - break; - case '/LZWDecode': - include_once('filters/FilterLZW_FPDI.php'); - $decoder = new FilterLZW_FPDI($this->fpdi); - $stream = $decoder->decode($stream); - break; - case '/ASCII85Decode': - include_once('filters/FilterASCII85_FPDI.php'); - $decoder = new FilterASCII85_FPDI($this->fpdi); - $stream = $decoder->decode($stream); - break; - case null: - $stream = $stream; - break; - default: - $this->error(sprintf('Unsupported Filter: %s',$_filter[1])); - } - } - - return $stream; - } - - - /** - * Get a Box from a page - * Arrayformat is same as used by fpdf_tpl + * Array format is same as used by FPDF_TPL. * - * @param array $page a /Page - * @param string $box_index Type of Box @see $availableBoxes + * @param array $page a /Page dictionary + * @param string $boxIndex Type of box {see {@link $availableBoxes}) * @param float Scale factor from user space units to points - * @return array + * + * @return array|boolean */ - function getPageBox($page, $box_index, $k) { - $page = $this->pdf_resolve_object($this->c, $page); + protected function _getPageBox($page, $boxIndex, $k) + { + $page = $this->resolveObject($page); $box = null; - if (isset($page[1][1][$box_index])) - $box =& $page[1][1][$box_index]; + if (isset($page[1][1][$boxIndex])) { + $box = $page[1][1][$boxIndex]; + } - if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) { - $tmp_box = $this->pdf_resolve_object($this->c, $box); + if (!is_null($box) && $box[0] == pdf_parser::TYPE_OBJREF) { + $tmp_box = $this->resolveObject($box); $box = $tmp_box[1]; } - if (!is_null($box) && $box[0] == PDF_TYPE_ARRAY) { - $b =& $box[1]; - return array('x' => $b[0][1] / $k, - 'y' => $b[1][1] / $k, - 'w' => abs($b[0][1] - $b[2][1]) / $k, - 'h' => abs($b[1][1] - $b[3][1]) / $k, - 'llx' => min($b[0][1], $b[2][1]) / $k, - 'lly' => min($b[1][1], $b[3][1]) / $k, - 'urx' => max($b[0][1], $b[2][1]) / $k, - 'ury' => max($b[1][1], $b[3][1]) / $k, - ); - } else if (!isset ($page[1][1]['/Parent'])) { + if (!is_null($box) && $box[0] == pdf_parser::TYPE_ARRAY) { + $b = $box[1]; + return array( + 'x' => $b[0][1] / $k, + 'y' => $b[1][1] / $k, + 'w' => abs($b[0][1] - $b[2][1]) / $k, + 'h' => abs($b[1][1] - $b[3][1]) / $k, + 'llx' => min($b[0][1], $b[2][1]) / $k, + 'lly' => min($b[1][1], $b[3][1]) / $k, + 'urx' => max($b[0][1], $b[2][1]) / $k, + 'ury' => max($b[1][1], $b[3][1]) / $k, + ); + } else if (!isset($page[1][1]['/Parent'])) { return false; } else { - return $this->getPageBox($this->pdf_resolve_object($this->c, $page[1][1]['/Parent']), $box_index, $k); + return $this->_getPageBox($this->resolveObject($page[1][1]['/Parent']), $boxIndex, $k); } } /** - * Get all page boxes by page no + * Get all page boundary boxes by page number * - * @param int The page number - * @param float Scale factor from user space units to points + * @param int $pageNo The page number + * @param float $k Scale factor from user space units to points * @return array + * @throws InvalidArgumentException */ - function getPageBoxes($pageno, $k) { - return $this->_getPageBoxes($this->pages[$pageno - 1], $k); + public function getPageBoxes($pageNo, $k) + { + if (!isset($this->_pages[$pageNo - 1])) { + throw new InvalidArgumentException('Page ' . $pageNo . ' does not exists.'); + } + + return $this->_getPageBoxes($this->_pages[$pageNo - 1], $k); } /** - * Get all boxes from /Page + * Get all boxes from /Page dictionary * - * @param array a /Page + * @param array $page A /Page dictionary + * @param float $k Scale factor from user space units to points * @return array */ - function _getPageBoxes($page, $k) { + protected function _getPageBoxes($page, $k) + { $boxes = array(); foreach($this->availableBoxes AS $box) { - if ($_box = $this->getPageBox($page, $box, $k)) { + if ($_box = $this->_getPageBox($page, $box, $k)) { $boxes[$box] = $_box; } } @@ -334,75 +276,79 @@ class fpdi_pdf_parser extends pdf_parser { } /** - * Get the page rotation by pageno + * Get the page rotation by page number * - * @param integer $pageno + * @param integer $pageNo + * @throws InvalidArgumentException * @return array */ - function getPageRotation($pageno) { - return $this->_getPageRotation($this->pages[$pageno - 1]); + public function getPageRotation($pageNo) + { + if (!isset($this->_pages[$pageNo - 1])) { + throw new InvalidArgumentException('Page ' . $pageNo . ' does not exists.'); + } + + return $this->_getPageRotation($this->_pages[$pageNo - 1]); } - - function _getPageRotation($obj) { // $obj = /Page - $obj = $this->pdf_resolve_object($this->c, $obj); - if (isset ($obj[1][1]['/Rotate'])) { - $res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Rotate']); - if ($res[0] == PDF_TYPE_OBJECT) + + /** + * Get the rotation value of a page + * + * @param array $obj A /Page dictionary + * @return array|bool + */ + protected function _getPageRotation($obj) + { + $obj = $this->resolveObject($obj); + if (isset($obj[1][1]['/Rotate'])) { + $res = $this->resolveObject($obj[1][1]['/Rotate']); + if ($res[0] == pdf_parser::TYPE_OBJECT) return $res[1]; return $res; - } else { - if (!isset ($obj[1][1]['/Parent'])) { - return false; - } else { - $res = $this->_getPageRotation($obj[1][1]['/Parent']); - if ($res[0] == PDF_TYPE_OBJECT) - return $res[1]; - return $res; - } } - } - - /** - * Read all /Page(es) - * - * @param object pdf_context - * @param array /Pages - * @param array the result-array - */ - function read_pages(&$c, &$pages, &$result) { - // Get the kids dictionary - $_kids = $this->pdf_resolve_object ($c, $pages[1][1]['/Kids']); - - if (!is_array($_kids)) - $this->error('Cannot find /Kids in current /Page-Dictionary'); - - if ($_kids[1][0] == PDF_TYPE_ARRAY) { - $kids = $_kids[1][1]; - } else { - $kids = $_kids[1]; + + if (!isset($obj[1][1]['/Parent'])) { + return false; } - + + $res = $this->_getPageRotation($obj[1][1]['/Parent']); + if ($res[0] == pdf_parser::TYPE_OBJECT) + return $res[1]; + + return $res; + } + + /** + * Read all pages + * + * @param array $pages /Pages dictionary + * @param array $result The result array + * @throws Exception + */ + protected function _readPages(&$pages, &$result) + { + // Get the kids dictionary + $_kids = $this->resolveObject($pages[1][1]['/Kids']); + + if (!is_array($_kids)) { + throw new Exception('Cannot find /Kids in current /Page-Dictionary'); + } + + if ($_kids[0] === self::TYPE_OBJECT) { + $_kids = $_kids[1]; + } + + $kids = $_kids[1]; + foreach ($kids as $v) { - $pg = $this->pdf_resolve_object ($c, $v); + $pg = $this->resolveObject($v); if ($pg[1][1]['/Type'][1] === '/Pages') { // If one of the kids is an embedded // /Pages array, resolve it as well. - $this->read_pages($c, $pg, $result); + $this->_readPages($pg, $result); } else { $result[] = $pg; } } } - - - - /** - * Get PDF-Version - * - * And reset the PDF Version used in FPDI if needed - */ - function getPDFVersion() { - parent::getPDFVersion(); - $this->fpdi->setPDFVersion(max($this->fpdi->getPDFVersion(), $this->pdfVersion)); - } } \ No newline at end of file diff --git a/htdocs/includes/fpdfi/pdf_context.php b/htdocs/includes/fpdfi/pdf_context.php index 78b7b4ae6de..88f3aedefff 100644 --- a/htdocs/includes/fpdfi/pdf_context.php +++ b/htdocs/includes/fpdfi/pdf_context.php @@ -1,8 +1,8 @@ file =& $f; - if (is_string($this->file)) - $this->_mode = 1; - $this->reset(); - } - - // Optionally move the file - // pointer to a new location - // and reset the buffered data - - function reset($pos = null, $l = 100) { - if ($this->_mode == 0) { - if (!is_null ($pos)) { - fseek ($this->file, $pos); - } - - $this->buffer = $l > 0 ? fread($this->file, $l) : ''; - $this->length = strlen($this->buffer); - if ($this->length < $l) - $this->increase_length($l - $this->length); - } else { - $this->buffer = $this->file; - $this->length = strlen($this->buffer); - } - $this->offset = 0; - $this->stack = array(); - } - - // Make sure that there is at least one - // character beyond the current offset in - // the buffer to prevent the tokenizer - // from attempting to access data that does - // not exist - - function ensure_content() { - if ($this->offset >= $this->length - 1) { - return $this->increase_length(); - } else { - return true; - } - } - - // Forcefully read more data into the buffer - - function increase_length($l = 100) { - if ($this->_mode == 0 && feof($this->file)) { - return false; - } else if ($this->_mode == 0) { - $totalLength = $this->length + $l; - do { - $toRead = $totalLength - $this->length; - if ($toRead < 1) - break; - - $this->buffer .= fread($this->file, $toRead); - } while ((($this->length = strlen($this->buffer)) != $totalLength) && !feof($this->file)); - - return true; - } else { - return false; - } - } +/** + * Class pdf_context + */ +class pdf_context +{ + /** + * Mode + * + * @var integer 0 = file | 1 = string + */ + protected $_mode = 0; + + /** + * @var resource|string + */ + public $file; + + /** + * @var string + */ + public $buffer; + + /** + * @var integer + */ + public $offset; + + /** + * @var integer + */ + public $length; + + /** + * @var array + */ + public $stack; + + /** + * The constructor + * + * @param resource $f + */ + public function __construct(&$f) + { + $this->file =& $f; + if (is_string($this->file)) + $this->_mode = 1; + + $this->reset(); + } + + /** + * Get the position in the file stream + * + * @return int + */ + public function getPos() + { + if ($this->_mode == 0) { + return ftell($this->file); + } else { + return 0; + } + } + + /** + * Reset the position in the file stream. + * + * Optionally move the file pointer to a new location and reset the buffered data. + * + * @param null $pos + * @param int $l + */ + public function reset($pos = null, $l = 100) + { + if ($this->_mode == 0) { + if (!is_null($pos)) { + fseek ($this->file, $pos); + } + + $this->buffer = $l > 0 ? fread($this->file, $l) : ''; + $this->length = strlen($this->buffer); + if ($this->length < $l) + $this->increaseLength($l - $this->length); + } else { + $this->buffer = $this->file; + $this->length = strlen($this->buffer); + } + $this->offset = 0; + $this->stack = array(); + } + + /** + * Make sure that there is at least one character beyond the current offset in the buffer. + * + * To prevent the tokenizer from attempting to access data that does not exist. + * + * @return bool + */ + public function ensureContent() + { + if ($this->offset >= $this->length - 1) { + return $this->increaseLength(); + } else { + return true; + } + } + + /** + * Forcefully read more data into the buffer + * + * @param int $l + * @return bool + */ + public function increaseLength($l = 100) + { + if ($this->_mode == 0 && feof($this->file)) { + return false; + } else if ($this->_mode == 0) { + $totalLength = $this->length + $l; + do { + $toRead = $totalLength - $this->length; + if ($toRead < 1) + break; + + $this->buffer .= fread($this->file, $toRead); + } while ((($this->length = strlen($this->buffer)) != $totalLength) && !feof($this->file)); + + return true; + } else { + return false; + } } } \ No newline at end of file diff --git a/htdocs/includes/fpdfi/pdf_parser.php b/htdocs/includes/fpdfi/pdf_parser.php index 238e10c0def..a1c82dec23c 100644 --- a/htdocs/includes/fpdfi/pdf_parser.php +++ b/htdocs/includes/fpdfi/pdf_parser.php @@ -1,8 +1,8 @@ filename = $filename; - - $this->f = @fopen($this->filename, 'rb'); - - if (!$this->f) - $this->error(sprintf('Cannot open %s !', $filename)); - - $this->getPDFVersion(); - - $this->c = new pdf_context($this->f); - - // Read xref-Data - $this->xref = array(); - $this->pdf_read_xref($this->xref, $this->pdf_find_xref()); - - // Check for Encryption - $this->getEncryption(); - - // Read root - $this->pdf_read_root(); + /** + * Type constant + * + * @var integer + */ + const TYPE_NUMERIC = 1; + + /** + * Type constant + * + * @var integer + */ + const TYPE_TOKEN = 2; + + /** + * Type constant + * + * @var integer + */ + const TYPE_HEX = 3; + + /** + * Type constant + * + * @var integer + */ + const TYPE_STRING = 4; + + /** + * Type constant + * + * @var integer + */ + const TYPE_DICTIONARY = 5; + + /** + * Type constant + * + * @var integer + */ + const TYPE_ARRAY = 6; + + /** + * Type constant + * + * @var integer + */ + const TYPE_OBJDEC = 7; + + /** + * Type constant + * + * @var integer + */ + const TYPE_OBJREF = 8; + + /** + * Type constant + * + * @var integer + */ + const TYPE_OBJECT = 9; + + /** + * Type constant + * + * @var integer + */ + const TYPE_STREAM = 10; + + /** + * Type constant + * + * @var integer + */ + const TYPE_BOOLEAN = 11; + + /** + * Type constant + * + * @var integer + */ + const TYPE_REAL = 12; + + /** + * Define the amount of byte in which the initial keyword of a PDF document should be searched. + * + * @var int + */ + static public $searchForStartxrefLength = 5500; + + /** + * Filename + * + * @var string + */ + public $filename; + + /** + * File resource + * + * @var resource + */ + protected $_f; + + /** + * PDF Context + * + * @var pdf_context + */ + protected $_c; + + /** + * xref-Data + * + * @var array + */ + protected $_xref; + + /** + * Data of the Root object + * + * @var array + */ + protected $_root; + + /** + * PDF version of the loaded document + * + * @var string + */ + protected $_pdfVersion; + + /** + * For reading encrypted documents and xref/object streams are in use + * + * @var boolean + */ + protected $_readPlain = true; + + /** + * The current read object + * + * @var array + */ + protected $_currentObj; + + /** + * Constructor + * + * @param string $filename Source filename + * @throws InvalidArgumentException + */ + public function __construct($filename) + { + $this->filename = $filename; + + $this->_f = @fopen($this->filename, 'rb'); + + if (!$this->_f) { + throw new InvalidArgumentException(sprintf('Cannot open %s !', $filename)); } - - /** - * Close the opened file - */ - function closeFile() { - if (isset($this->f) && is_resource($this->f)) { - fclose($this->f); - unset($this->f); - } - } - - /** - * Print Error and die - * - * @param string $msg Error-Message - */ - function error($msg) { - die('PDF-Parser Error: ' . $msg); - } - - /** - * Check Trailer for Encryption - */ - function getEncryption() { - if (isset($this->xref['trailer'][1]['/Encrypt'])) { - $this->error('File is encrypted!'); - } - } - - /** - * Find/Return /Root - * - * @return array - */ - function pdf_find_root() { - if ($this->xref['trailer'][1]['/Root'][0] != PDF_TYPE_OBJREF) { - $this->error('Wrong Type of Root-Element! Must be an indirect reference'); - } - - return $this->xref['trailer'][1]['/Root']; - } - - /** - * Read the /Root - */ - function pdf_read_root() { - // read root - $this->root = $this->pdf_resolve_object($this->c, $this->pdf_find_root()); - } - - /** - * Get PDF-Version - * - * And reset the PDF Version used in FPDI if needed - */ - function getPDFVersion() { - fseek($this->f, 0); - preg_match('/\d\.\d/',fread($this->f, 16), $m); - if (isset($m[0])) - $this->pdfVersion = $m[0]; - return $this->pdfVersion; - } - - /** - * Find the xref-Table - */ - function pdf_find_xref() { - $toRead = 1500; - - $stat = fseek ($this->f, -$toRead, SEEK_END); - if ($stat === -1) { - fseek ($this->f, 0); - } - $data = fread($this->f, $toRead); - - $pos = strlen($data) - strpos(strrev($data), strrev('startxref')); - $data = substr($data, $pos); - - if (!preg_match('/\s*(\d+).*$/s', $data, $matches)) { - $this->error('Unable to find pointer to xref table'); - } - - return (int) $matches[1]; - } - - /** - * Read xref-table - * - * @param array $result Array of xref-table - * @param integer $offset of xref-table - */ - function pdf_read_xref(&$result, $offset) { - $o_pos = $offset-min(20, $offset); - fseek($this->f, $o_pos); // set some bytes backwards to fetch errorious docs - - $data = fread($this->f, 100); - - $xrefPos = strrpos($data, 'xref'); - - if ($xrefPos === false) { - fseek($this->f, $offset); - $c = new pdf_context($this->f); - $xrefStreamObjDec = $this->pdf_read_value($c); - - if (is_array($xrefStreamObjDec) && isset($xrefStreamObjDec[0]) && $xrefStreamObjDec[0] == PDF_TYPE_OBJDEC) { - $this->error(sprintf('This document (%s) probably uses a compression technique which is not supported by the free parser shipped with FPDI.', $this->filename)); - } else { - $this->error('Unable to find xref table.'); - } - } - - if (!isset($result['xref_location'])) { - $result['xref_location'] = $o_pos + $xrefPos; - $result['max_object'] = 0; - } - - $cylces = -1; - $bytesPerCycle = 100; - - fseek($this->f, $o_pos = $o_pos + $xrefPos + 4); // set the handle directly after the "xref"-keyword - $data = fread($this->f, $bytesPerCycle); - - while (($trailerPos = strpos($data, 'trailer', max($bytesPerCycle * $cylces++, 0))) === false && !feof($this->f)) { - $data .= fread($this->f, $bytesPerCycle); - } - - if ($trailerPos === false) { - $this->error('Trailer keyword not found after xref table'); - } - - $data = substr($data, 0, $trailerPos); - - // get Line-Ending - preg_match_all("/(\r\n|\n|\r)/", substr($data, 0, 100), $m); // check the first 100 bytes for linebreaks - - $differentLineEndings = count(array_unique($m[0])); - if ($differentLineEndings > 1) { - $lines = preg_split("/(\r\n|\n|\r)/", $data, -1, PREG_SPLIT_NO_EMPTY); - } else { - $lines = explode($m[0][1], $data); - } - - $data = $differentLineEndings = $m = null; - unset($data, $differentLineEndings, $m); - - $linesCount = count($lines); - - $start = 1; - - for ($i = 0; $i < $linesCount; $i++) { - $line = trim($lines[$i]); - if ($line) { - $pieces = explode(' ', $line); - $c = count($pieces); - switch($c) { - case 2: - $start = (int)$pieces[0]; - $end = $start + (int)$pieces[1]; - if ($end > $result['max_object']) - $result['max_object'] = $end; - break; - case 3: - if (!isset($result['xref'][$start])) - $result['xref'][$start] = array(); - - if (!array_key_exists($gen = (int) $pieces[1], $result['xref'][$start])) { - $result['xref'][$start][$gen] = $pieces[2] == 'n' ? (int) $pieces[0] : null; - } - $start++; - break; - default: - $this->error('Unexpected data in xref table'); - } - } - } - - $lines = $pieces = $line = $start = $end = $gen = null; - unset($lines, $pieces, $line, $start, $end, $gen); - - fseek($this->f, $o_pos + $trailerPos + 7); - - $c = new pdf_context($this->f); - $trailer = $this->pdf_read_value($c); - - $c = null; - unset($c); - - if (!isset($result['trailer'])) { - $result['trailer'] = $trailer; - } - - if (isset($trailer[1]['/Prev'])) { - $this->pdf_read_xref($result, $trailer[1]['/Prev'][1]); - } - - $trailer = null; - unset($trailer); - - return true; - } - - /** - * Reads an Value - * - * @param object $c pdf_context - * @param string $token a Token - * @return mixed - */ - function pdf_read_value(&$c, $token = null) { - if (is_null($token)) { - $token = $this->pdf_read_token($c); - } - - if ($token === false) { - return false; - } - - switch ($token) { - case '<': - // This is a hex string. - // Read the value, then the terminator - - $pos = $c->offset; - - while(1) { - - $match = strpos ($c->buffer, '>', $pos); - - // If you can't find it, try - // reading more data from the stream - - if ($match === false) { - if (!$c->increase_length()) { - return false; - } else { - continue; - } - } - - $result = substr ($c->buffer, $c->offset, $match - $c->offset); - $c->offset = $match + 1; - - return array (PDF_TYPE_HEX, $result); - } - - break; - case '<<': - // This is a dictionary. - - $result = array(); - - // Recurse into this function until we reach - // the end of the dictionary. - while (($key = $this->pdf_read_token($c)) !== '>>') { - if ($key === false) { - return false; - } - - if (($value = $this->pdf_read_value($c)) === false) { - return false; - } - - // Catch missing value - if ($value[0] == PDF_TYPE_TOKEN && $value[1] == '>>') { - $result[$key] = array(PDF_TYPE_NULL); - break; - } - - $result[$key] = $value; - } - - return array (PDF_TYPE_DICTIONARY, $result); - - case '[': - // This is an array. - - $result = array(); - - // Recurse into this function until we reach - // the end of the array. - while (($token = $this->pdf_read_token($c)) !== ']') { - if ($token === false) { - return false; - } - - if (($value = $this->pdf_read_value($c, $token)) === false) { - return false; - } - - $result[] = $value; - } - - return array (PDF_TYPE_ARRAY, $result); - - case '(' : - // This is a string - $pos = $c->offset; - - $openBrackets = 1; - do { - for (; $openBrackets != 0 && $pos < $c->length; $pos++) { - switch (ord($c->buffer[$pos])) { - case 0x28: // '(' - $openBrackets++; - break; - case 0x29: // ')' - $openBrackets--; - break; - case 0x5C: // backslash - $pos++; - } - } - } while($openBrackets != 0 && $c->increase_length()); - - $result = substr($c->buffer, $c->offset, $pos - $c->offset - 1); - $c->offset = $pos; - - return array (PDF_TYPE_STRING, $result); - - case 'stream': - $o_pos = ftell($c->file)-strlen($c->buffer); - $o_offset = $c->offset; - - $c->reset($startpos = $o_pos + $o_offset); - - $e = 0; // ensure line breaks in front of the stream - if ($c->buffer[0] == chr(10) || $c->buffer[0] == chr(13)) - $e++; - if ($c->buffer[1] == chr(10) && $c->buffer[0] != chr(10)) - $e++; - - if ($this->actual_obj[1][1]['/Length'][0] == PDF_TYPE_OBJREF) { - $tmp_c = new pdf_context($this->f); - $tmp_length = $this->pdf_resolve_object($tmp_c, $this->actual_obj[1][1]['/Length']); - $length = $tmp_length[1][1]; - } else { - $length = $this->actual_obj[1][1]['/Length'][1]; - } - - if ($length > 0) { - $c->reset($startpos + $e,$length); - $v = $c->buffer; - } else { - $v = ''; - } - $c->reset($startpos + $e + $length + 9); // 9 = strlen("endstream") - - return array(PDF_TYPE_STREAM, $v); - - default : - if (is_numeric ($token)) { - // A numeric token. Make sure that - // it is not part of something else. - if (($tok2 = $this->pdf_read_token ($c)) !== false) { - if (is_numeric ($tok2)) { - - // Two numeric tokens in a row. - // In this case, we're probably in - // front of either an object reference - // or an object specification. - // Determine the case and return the data - if (($tok3 = $this->pdf_read_token ($c)) !== false) { - switch ($tok3) { - case 'obj': - return array (PDF_TYPE_OBJDEC, (int) $token, (int) $tok2); - case 'R': - return array (PDF_TYPE_OBJREF, (int) $token, (int) $tok2); - } - // If we get to this point, that numeric value up - // there was just a numeric value. Push the extra - // tokens back into the stack and return the value. - array_push ($c->stack, $tok3); - } - } - - array_push ($c->stack, $tok2); - } - - if ($token === (string)((int)$token)) - return array (PDF_TYPE_NUMERIC, (int)$token); - else - return array (PDF_TYPE_REAL, (float)$token); - } else if ($token == 'true' || $token == 'false') { - return array (PDF_TYPE_BOOLEAN, $token == 'true'); - } else if ($token == 'null') { - return array (PDF_TYPE_NULL); - } else { - // Just a token. Return it. - return array (PDF_TYPE_TOKEN, $token); - } - } - } - - /** - * Resolve an object - * - * @param object $c pdf_context - * @param array $obj_spec The object-data - * @param boolean $encapsulate Must set to true, cause the parsing and fpdi use this method only without this para - */ - function pdf_resolve_object(&$c, $obj_spec, $encapsulate = true) { - // Exit if we get invalid data - if (!is_array($obj_spec)) { - $ret = false; - return $ret; - } - - if ($obj_spec[0] == PDF_TYPE_OBJREF) { - - // This is a reference, resolve it - if (isset($this->xref['xref'][$obj_spec[1]][$obj_spec[2]])) { - - // Save current file position - // This is needed if you want to resolve - // references while you're reading another object - // (e.g.: if you need to determine the length - // of a stream) - - $old_pos = ftell($c->file); - - // Reposition the file pointer and - // load the object header. - - $c->reset($this->xref['xref'][$obj_spec[1]][$obj_spec[2]]); - - $header = $this->pdf_read_value($c); - - if ($header[0] != PDF_TYPE_OBJDEC || $header[1] != $obj_spec[1] || $header[2] != $obj_spec[2]) { - $toSearchFor = $obj_spec[1] . ' ' . $obj_spec[2] . ' obj'; - if (preg_match('/' . $toSearchFor . '/', $c->buffer)) { - $c->offset = strpos($c->buffer, $toSearchFor) + strlen($toSearchFor); - // reset stack - $c->stack = array(); - } else { - $this->error("Unable to find object ({$obj_spec[1]}, {$obj_spec[2]}) at expected location"); - } - } - - // If we're being asked to store all the information - // about the object, we add the object ID and generation - // number for later use - $result = array(); - $this->actual_obj =& $result; - if ($encapsulate) { - $result = array ( - PDF_TYPE_OBJECT, - 'obj' => $obj_spec[1], - 'gen' => $obj_spec[2] - ); - } - - // Now simply read the object data until - // we encounter an end-of-object marker - while(1) { - $value = $this->pdf_read_value($c); - if ($value === false || count($result) > 4) { - // in this case the parser coudn't find an endobj so we break here - break; - } - - if ($value[0] == PDF_TYPE_TOKEN && $value[1] === 'endobj') { - break; - } - - $result[] = $value; - } - - $c->reset($old_pos); - - if (isset($result[2][0]) && $result[2][0] == PDF_TYPE_STREAM) { - $result[0] = PDF_TYPE_STREAM; - } - - return $result; - } - } else { - return $obj_spec; - } - } - - - - /** - * Reads a token from the file - * - * @param object $c pdf_context - * @return mixed - */ - function pdf_read_token(&$c) - { - // If there is a token available - // on the stack, pop it out and - // return it. - - if (count($c->stack)) { - return array_pop($c->stack); - } - - // Strip away any whitespace - - do { - if (!$c->ensure_content()) { - return false; - } - $c->offset += strspn($c->buffer, " \n\r\t", $c->offset); - } while ($c->offset >= $c->length - 1); - - // Get the first character in the stream - - $char = $c->buffer[$c->offset++]; - - switch ($char) { - - case '[': - case ']': - case '(': - case ')': - - // This is either an array or literal string - // delimiter, Return it - - return $char; - - case '<': - case '>': - - // This could either be a hex string or - // dictionary delimiter. Determine the - // appropriate case and return the token - - if ($c->buffer[$c->offset] == $char) { - if (!$c->ensure_content()) { - return false; - } - $c->offset++; - return $char . $char; - } else { - return $char; - } - - case '%': - - // This is a comment - jump over it! - - $pos = $c->offset; - while(1) { - $match = preg_match("/(\r\n|\r|\n)/", $c->buffer, $m, PREG_OFFSET_CAPTURE, $pos); - if ($match === 0) { - if (!$c->increase_length()) { - return false; - } else { - continue; - } - } - - $c->offset = $m[0][1]+strlen($m[0][0]); - - return $this->pdf_read_token($c); - } - - default: - - // This is "another" type of token (probably - // a dictionary entry or a numeric value) - // Find the end and return it. - - if (!$c->ensure_content()) { - return false; - } - - while(1) { - - // Determine the length of the token - - $pos = strcspn($c->buffer, " %[]<>()\r\n\t/", $c->offset); - - if ($c->offset + $pos <= $c->length - 1) { - break; - } else { - // If the script reaches this point, - // the token may span beyond the end - // of the current buffer. Therefore, - // we increase the size of the buffer - // and try again--just to be safe. - - $c->increase_length(); - } - } - - $result = substr($c->buffer, $c->offset - 1, $pos + 1); - - $c->offset += $pos; - return $result; - } + + $this->getPdfVersion(); + + require_once('pdf_context.php'); + $this->_c = new pdf_context($this->_f); + + // Read xref-Data + $this->_xref = array(); + $this->_readXref($this->_xref, $this->_findXref()); + + // Check for Encryption + $this->getEncryption(); + + // Read root + $this->_readRoot(); + } + + /** + * Destructor + */ + public function __destruct() + { + $this->closeFile(); + } + + /** + * Close the opened file + */ + public function closeFile() + { + if (isset($this->_f) && is_resource($this->_f)) { + fclose($this->_f); + unset($this->_f); } } -} + + /** + * Check Trailer for Encryption + * + * @throws Exception + */ + public function getEncryption() + { + if (isset($this->_xref['trailer'][1]['/Encrypt'])) { + throw new Exception('File is encrypted!'); + } + } + + /** + * Get PDF-Version + * + * @return string + */ + public function getPdfVersion() + { + if ($this->_pdfVersion === null) { + fseek($this->_f, 0); + preg_match('/\d\.\d/', fread($this->_f, 16), $m); + if (isset($m[0])) + $this->_pdfVersion = $m[0]; + } + + return $this->_pdfVersion; + } + + /** + * Read the /Root dictionary + */ + protected function _readRoot() + { + if ($this->_xref['trailer'][1]['/Root'][0] != self::TYPE_OBJREF) { + throw new Exception('Wrong Type of Root-Element! Must be an indirect reference'); + } + + $this->_root = $this->resolveObject($this->_xref['trailer'][1]['/Root']); + } + + /** + * Find the xref table + * + * @return integer + * @throws Exception + */ + protected function _findXref() + { + $toRead = self::$searchForStartxrefLength; + + $stat = fseek($this->_f, -$toRead, SEEK_END); + if ($stat === -1) { + fseek($this->_f, 0); + } + + $data = fread($this->_f, $toRead); + + $keywordPos = strpos(strrev($data), strrev('startxref')); + if (false === $keywordPos) { + $keywordPos = strpos(strrev($data), strrev('startref')); + } + + if (false === $keywordPos) { + throw new Exception('Unable to find "startxref" keyword.'); + } + + $pos = strlen($data) - $keywordPos; + $data = substr($data, $pos); + + if (!preg_match('/\s*(\d+).*$/s', $data, $matches)) { + throw new Exception('Unable to find pointer to xref table.'); + } + + return (int) $matches[1]; + } + + /** + * Read the xref table + * + * @param array $result Array of xref table entries + * @param integer $offset of xref table + * @return boolean + * @throws Exception + */ + protected function _readXref(&$result, $offset) + { + $tempPos = $offset - min(20, $offset); + fseek($this->_f, $tempPos); // set some bytes backwards to fetch corrupted docs + + $data = fread($this->_f, 100); + + $xrefPos = strrpos($data, 'xref'); + + if ($xrefPos === false) { + $this->_c->reset($offset); + $xrefStreamObjDec = $this->_readValue($this->_c); + + if (is_array($xrefStreamObjDec) && isset($xrefStreamObjDec[0]) && $xrefStreamObjDec[0] == self::TYPE_OBJDEC) { + throw new Exception( + sprintf( + 'This document (%s) probably uses a compression technique which is not supported by the ' . + 'free parser shipped with FPDI. (See https://www.setasign.com/fpdi-pdf-parser for more details)', + $this->filename + ) + ); + } else { + throw new Exception('Unable to find xref table.'); + } + } + + if (!isset($result['xrefLocation'])) { + $result['xrefLocation'] = $tempPos + $xrefPos; + $result['maxObject'] = 0; + } + + $cycles = -1; + $bytesPerCycle = 100; + + fseek($this->_f, $tempPos = $tempPos + $xrefPos + 4); // set the handle directly after the "xref"-keyword + $data = fread($this->_f, $bytesPerCycle); + + while (($trailerPos = strpos($data, 'trailer', max($bytesPerCycle * $cycles++, 0))) === false && !feof($this->_f)) { + $data .= fread($this->_f, $bytesPerCycle); + } + + if ($trailerPos === false) { + throw new Exception('Trailer keyword not found after xref table'); + } + + $data = ltrim(substr($data, 0, $trailerPos)); + + // get Line-Ending + preg_match_all("/(\r\n|\n|\r)/", substr($data, 0, 100), $m); // check the first 100 bytes for line breaks + + $differentLineEndings = count(array_unique($m[0])); + if ($differentLineEndings > 1) { + $lines = preg_split("/(\r\n|\n|\r)/", $data, -1, PREG_SPLIT_NO_EMPTY); + } else { + $lines = explode($m[0][0], $data); + } + + $data = $differentLineEndings = $m = null; + unset($data, $differentLineEndings, $m); + + $linesCount = count($lines); + + $start = 1; + + for ($i = 0; $i < $linesCount; $i++) { + $line = trim($lines[$i]); + if ($line) { + $pieces = explode(' ', $line); + $c = count($pieces); + switch($c) { + case 2: + $start = (int)$pieces[0]; + $end = $start + (int)$pieces[1]; + if ($end > $result['maxObject']) + $result['maxObject'] = $end; + break; + case 3: + if (!isset($result['xref'][$start])) + $result['xref'][$start] = array(); + + if (!array_key_exists($gen = (int) $pieces[1], $result['xref'][$start])) { + $result['xref'][$start][$gen] = $pieces[2] == 'n' ? (int) $pieces[0] : null; + } + $start++; + break; + default: + throw new Exception('Unexpected data in xref table'); + } + } + } + + $lines = $pieces = $line = $start = $end = $gen = null; + unset($lines, $pieces, $line, $start, $end, $gen); + + $this->_c->reset($tempPos + $trailerPos + 7); + $trailer = $this->_readValue($this->_c); + + if (!isset($result['trailer'])) { + $result['trailer'] = $trailer; + } + + if (isset($trailer[1]['/Prev'])) { + $this->_readXref($result, $trailer[1]['/Prev'][1]); + } + + $trailer = null; + unset($trailer); + + return true; + } + + /** + * Reads a PDF value + * + * @param pdf_context $c + * @param string $token A token + * @return mixed + */ + protected function _readValue(&$c, $token = null) + { + if (is_null($token)) { + $token = $this->_readToken($c); + } + + if ($token === false) { + return false; + } + + switch ($token) { + case '<': + // This is a hex string. + // Read the value, then the terminator + + $pos = $c->offset; + + while(1) { + + $match = strpos ($c->buffer, '>', $pos); + + // If you can't find it, try + // reading more data from the stream + + if ($match === false) { + if (!$c->increaseLength()) { + return false; + } else { + continue; + } + } + + $result = substr ($c->buffer, $c->offset, $match - $c->offset); + $c->offset = $match + 1; + + return array (self::TYPE_HEX, $result); + } + break; + + case '<<': + // This is a dictionary. + + $result = array(); + + // Recurse into this function until we reach + // the end of the dictionary. + while (($key = $this->_readToken($c)) !== '>>') { + if ($key === false) { + return false; + } + + if (($value = $this->_readValue($c)) === false) { + return false; + } + + // Catch missing value + if ($value[0] == self::TYPE_TOKEN && $value[1] == '>>') { + $result[$key] = array(self::TYPE_NULL); + break; + } + + $result[$key] = $value; + } + + return array (self::TYPE_DICTIONARY, $result); + + case '[': + // This is an array. + + $result = array(); + + // Recurse into this function until we reach + // the end of the array. + while (($token = $this->_readToken($c)) !== ']') { + if ($token === false) { + return false; + } + + if (($value = $this->_readValue($c, $token)) === false) { + return false; + } + + $result[] = $value; + } + + return array (self::TYPE_ARRAY, $result); + + case '(': + // This is a string + $pos = $c->offset; + + $openBrackets = 1; + do { + for (; $openBrackets != 0 && $pos < $c->length; $pos++) { + switch (ord($c->buffer[$pos])) { + case 0x28: // '(' + $openBrackets++; + break; + case 0x29: // ')' + $openBrackets--; + break; + case 0x5C: // backslash + $pos++; + } + } + } while($openBrackets != 0 && $c->increaseLength()); + + $result = substr($c->buffer, $c->offset, $pos - $c->offset - 1); + $c->offset = $pos; + + return array (self::TYPE_STRING, $result); + + case 'stream': + $tempPos = $c->getPos() - strlen($c->buffer); + $tempOffset = $c->offset; + + $c->reset($startPos = $tempPos + $tempOffset); + + $e = 0; // ensure line breaks in front of the stream + if ($c->buffer[0] == chr(10) || $c->buffer[0] == chr(13)) + $e++; + if ($c->buffer[1] == chr(10) && $c->buffer[0] != chr(10)) + $e++; + + if ($this->_currentObj[1][1]['/Length'][0] == self::TYPE_OBJREF) { + $tmpLength = $this->resolveObject($this->_currentObj[1][1]['/Length']); + $length = $tmpLength[1][1]; + } else { + $length = $this->_currentObj[1][1]['/Length'][1]; + } + + if ($length > 0) { + $c->reset($startPos + $e, $length); + $v = $c->buffer; + } else { + $v = ''; + } + + $c->reset($startPos + $e + $length); + $endstream = $this->_readToken($c); + + if ($endstream != 'endstream') { + $c->reset($startPos + $e + $length + 9); // 9 = strlen("endstream") + // We don't throw an error here because the next + // round trip will start at a new offset + } + + return array(self::TYPE_STREAM, $v); + + default : + if (is_numeric($token)) { + // A numeric token. Make sure that + // it is not part of something else. + if (($tok2 = $this->_readToken($c)) !== false) { + if (is_numeric($tok2)) { + + // Two numeric tokens in a row. + // In this case, we're probably in + // front of either an object reference + // or an object specification. + // Determine the case and return the data + if (($tok3 = $this->_readToken($c)) !== false) { + switch ($tok3) { + case 'obj': + return array(self::TYPE_OBJDEC, (int)$token, (int)$tok2); + case 'R': + return array(self::TYPE_OBJREF, (int)$token, (int)$tok2); + } + // If we get to this point, that numeric value up + // there was just a numeric value. Push the extra + // tokens back into the stack and return the value. + array_push($c->stack, $tok3); + } + } + + array_push($c->stack, $tok2); + } + + if ($token === (string)((int)$token)) + return array(self::TYPE_NUMERIC, (int)$token); + else + return array(self::TYPE_REAL, (float)$token); + } else if ($token == 'true' || $token == 'false') { + return array(self::TYPE_BOOLEAN, $token == 'true'); + } else if ($token == 'null') { + return array(self::TYPE_NULL); + } else { + // Just a token. Return it. + return array(self::TYPE_TOKEN, $token); + } + } + } + + /** + * Resolve an object + * + * @param array $objSpec The object-data + * @return array|boolean + * @throws Exception + */ + public function resolveObject($objSpec) + { + $c = $this->_c; + + // Exit if we get invalid data + if (!is_array($objSpec)) { + return false; + } + + if ($objSpec[0] == self::TYPE_OBJREF) { + + // This is a reference, resolve it + if (isset($this->_xref['xref'][$objSpec[1]][$objSpec[2]])) { + + // Save current file position + // This is needed if you want to resolve + // references while you're reading another object + // (e.g.: if you need to determine the length + // of a stream) + + $oldPos = $c->getPos(); + + // Reposition the file pointer and + // load the object header. + + $c->reset($this->_xref['xref'][$objSpec[1]][$objSpec[2]]); + + $header = $this->_readValue($c); + + if ($header[0] != self::TYPE_OBJDEC || $header[1] != $objSpec[1] || $header[2] != $objSpec[2]) { + $toSearchFor = $objSpec[1] . ' ' . $objSpec[2] . ' obj'; + if (preg_match('/' . $toSearchFor . '/', $c->buffer)) { + $c->offset = strpos($c->buffer, $toSearchFor) + strlen($toSearchFor); + // reset stack + $c->stack = array(); + } else { + throw new Exception( + sprintf("Unable to find object (%s, %s) at expected location.", $objSpec[1], $objSpec[2]) + ); + } + } + + // If we're being asked to store all the information + // about the object, we add the object ID and generation + // number for later use + $result = array ( + self::TYPE_OBJECT, + 'obj' => $objSpec[1], + 'gen' => $objSpec[2] + ); + + $this->_currentObj =& $result; + + // Now simply read the object data until + // we encounter an end-of-object marker + while (true) { + $value = $this->_readValue($c); + if ($value === false || count($result) > 4) { + // in this case the parser couldn't find an "endobj" so we break here + break; + } + + if ($value[0] == self::TYPE_TOKEN && $value[1] === 'endobj') { + break; + } + + $result[] = $value; + } + + $c->reset($oldPos); + + if (isset($result[2][0]) && $result[2][0] == self::TYPE_STREAM) { + $result[0] = self::TYPE_STREAM; + } + + } else { + throw new Exception( + sprintf("Unable to find object (%s, %s) at expected location.", $objSpec[1], $objSpec[2]) + ); + } + + return $result; + } else { + return $objSpec; + } + } + + /** + * Reads a token from the context + * + * @param pdf_context $c + * @return mixed + */ + protected function _readToken($c) + { + // If there is a token available + // on the stack, pop it out and + // return it. + + if (count($c->stack)) { + return array_pop($c->stack); + } + + // Strip away any whitespace + + do { + if (!$c->ensureContent()) { + return false; + } + $c->offset += strspn($c->buffer, "\x20\x0A\x0C\x0D\x09\x00", $c->offset); + } while ($c->offset >= $c->length - 1); + + // Get the first character in the stream + + $char = $c->buffer[$c->offset++]; + + switch ($char) { + + case '[': + case ']': + case '(': + case ')': + + // This is either an array or literal string + // delimiter, Return it + + return $char; + + case '<': + case '>': + + // This could either be a hex string or + // dictionary delimiter. Determine the + // appropriate case and return the token + + if ($c->buffer[$c->offset] == $char) { + if (!$c->ensureContent()) { + return false; + } + $c->offset++; + return $char . $char; + } else { + return $char; + } + + case '%': + + // This is a comment - jump over it! + + $pos = $c->offset; + while(1) { + $match = preg_match("/(\r\n|\r|\n)/", $c->buffer, $m, PREG_OFFSET_CAPTURE, $pos); + if ($match === 0) { + if (!$c->increaseLength()) { + return false; + } else { + continue; + } + } + + $c->offset = $m[0][1] + strlen($m[0][0]); + + return $this->_readToken($c); + } + + default: + + // This is "another" type of token (probably + // a dictionary entry or a numeric value) + // Find the end and return it. + + if (!$c->ensureContent()) { + return false; + } + + while(1) { + + // Determine the length of the token + + $pos = strcspn($c->buffer, "\x20%[]<>()/\x0A\x0C\x0D\x09\x00", $c->offset); + + if ($c->offset + $pos <= $c->length - 1) { + break; + } else { + // If the script reaches this point, + // the token may span beyond the end + // of the current buffer. Therefore, + // we increase the size of the buffer + // and try again--just to be safe. + + $c->increaseLength(); + } + } + + $result = substr($c->buffer, $c->offset - 1, $pos + 1); + + $c->offset += $pos; + + return $result; + } + } + + /** + * Un-filter a stream object + * + * @param array $obj + * @return string + * @throws Exception + */ + protected function _unFilterStream($obj) + { + $filters = array(); + + if (isset($obj[1][1]['/Filter'])) { + $filter = $obj[1][1]['/Filter']; + + if ($filter[0] == pdf_parser::TYPE_OBJREF) { + $tmpFilter = $this->resolveObject($filter); + $filter = $tmpFilter[1]; + } + + if ($filter[0] == pdf_parser::TYPE_TOKEN) { + $filters[] = $filter; + } else if ($filter[0] == pdf_parser::TYPE_ARRAY) { + $filters = $filter[1]; + } + } + + $stream = $obj[2][1]; + + foreach ($filters AS $filter) { + switch ($filter[1]) { + case '/FlateDecode': + case '/Fl': + if (function_exists('gzuncompress')) { + $oStream = $stream; + $stream = (strlen($stream) > 0) ? @gzuncompress($stream) : ''; + } else { + throw new Exception( + sprintf('To handle %s filter, please compile php with zlib support.', $filter[1]) + ); + } + + if ($stream === false) { + $tries = 0; + while ($tries < 8 && ($stream === false || strlen($stream) < strlen($oStream))) { + $oStream = substr($oStream, 1); + $stream = @gzinflate($oStream); + $tries++; + } + + if ($stream === false) { + throw new Exception('Error while decompressing stream.'); + } + } + break; + case '/LZWDecode': + require_once('filters/FilterLZW.php'); + $decoder = new FilterLZW(); + $stream = $decoder->decode($stream); + break; + case '/ASCII85Decode': + require_once('filters/FilterASCII85.php'); + $decoder = new FilterASCII85(); + $stream = $decoder->decode($stream); + break; + case '/ASCIIHexDecode': + require_once('filters/FilterASCIIHexDecode.php'); + $decoder = new FilterASCIIHexDecode(); + $stream = $decoder->decode($stream); + break; + case null: + break; + default: + throw new Exception(sprintf('Unsupported Filter: %s', $filter[1])); + } + } + + return $stream; + } +} \ No newline at end of file From 50990bc8623745a458484f26134dda91ff450367 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 20 Feb 2015 05:50:36 +0100 Subject: [PATCH 59/63] Update PHPExcel library to 1.8.0 --- COPYRIGHT | 2 +- htdocs/includes/phpexcel/PHPExcel.php | 1572 +++-- .../includes/phpexcel/PHPExcel/Autoloader.php | 84 +- .../PHPExcel/CachedObjectStorage/APC.php | 405 +- .../CachedObjectStorage/CacheBase.php | 131 +- .../PHPExcel/CachedObjectStorage/DiscISAM.php | 40 +- .../PHPExcel/CachedObjectStorage/ICache.php | 16 +- .../PHPExcel/CachedObjectStorage/Igbinary.php | 36 +- .../PHPExcel/CachedObjectStorage/Memcache.php | 54 +- .../PHPExcel/CachedObjectStorage/Memory.php | 32 +- .../CachedObjectStorage/MemoryGZip.php | 36 +- .../CachedObjectStorage/MemorySerialized.php | 36 +- .../PHPExcel/CachedObjectStorage/PHPTemp.php | 36 +- .../PHPExcel/CachedObjectStorage/SQLite.php | 76 +- .../PHPExcel/CachedObjectStorage/SQLite3.php | 154 +- .../PHPExcel/CachedObjectStorage/Wincache.php | 50 +- .../PHPExcel/CachedObjectStorageFactory.php | 404 +- .../CalcEngine/CyclicReferenceStack.php | 98 + .../phpexcel/PHPExcel/CalcEngine/Logger.php | 153 + .../phpexcel/PHPExcel/Calculation.php | 1032 ++-- .../PHPExcel/Calculation/Database.php | 8 +- .../PHPExcel/Calculation/DateTime.php | 38 +- .../PHPExcel/Calculation/Engineering.php | 29 +- .../PHPExcel/Calculation/Exception.php | 10 +- .../PHPExcel/Calculation/ExceptionHandler.php | 8 +- .../PHPExcel/Calculation/Financial.php | 96 +- .../PHPExcel/Calculation/FormulaParser.php | 16 +- .../PHPExcel/Calculation/FormulaToken.php | 8 +- .../PHPExcel/Calculation/Function.php | 16 +- .../PHPExcel/Calculation/Functions.php | 115 +- .../phpexcel/PHPExcel/Calculation/Logical.php | 8 +- .../PHPExcel/Calculation/LookupRef.php | 123 +- .../PHPExcel/Calculation/MathTrig.php | 35 +- .../PHPExcel/Calculation/Statistical.php | 31 +- .../PHPExcel/Calculation/TextData.php | 58 +- .../PHPExcel/Calculation/Token/Stack.php | 70 +- htdocs/includes/phpexcel/PHPExcel/Cell.php | 160 +- .../PHPExcel/Cell/AdvancedValueBinder.php | 284 +- .../phpexcel/PHPExcel/Cell/DataType.php | 148 +- .../phpexcel/PHPExcel/Cell/DataValidation.php | 674 +- .../PHPExcel/Cell/DefaultValueBinder.php | 112 +- .../phpexcel/PHPExcel/Cell/Hyperlink.php | 155 +- .../phpexcel/PHPExcel/Cell/IValueBinder.php | 26 +- htdocs/includes/phpexcel/PHPExcel/Chart.php | 34 +- .../phpexcel/PHPExcel/Chart/DataSeries.php | 19 +- .../PHPExcel/Chart/DataSeriesValues.php | 16 +- .../phpexcel/PHPExcel/Chart/Exception.php | 10 +- .../phpexcel/PHPExcel/Chart/Layout.php | 42 +- .../phpexcel/PHPExcel/Chart/Legend.php | 8 +- .../phpexcel/PHPExcel/Chart/PlotArea.php | 13 +- .../PHPExcel/Chart/Renderer/jpgraph.php | 54 +- .../phpexcel/PHPExcel/Chart/Title.php | 11 +- htdocs/includes/phpexcel/PHPExcel/Comment.php | 224 +- .../phpexcel/PHPExcel/DocumentProperties.php | 1041 ++-- .../phpexcel/PHPExcel/DocumentSecurity.php | 8 +- .../includes/phpexcel/PHPExcel/Exception.php | 40 +- .../includes/phpexcel/PHPExcel/HashTable.php | 18 +- .../phpexcel/PHPExcel/IComparable.php | 6 +- .../includes/phpexcel/PHPExcel/IOFactory.php | 34 +- .../includes/phpexcel/PHPExcel/NamedRange.php | 11 +- .../phpexcel/PHPExcel/Reader/Abstract.php | 227 + .../includes/phpexcel/PHPExcel/Reader/CSV.php | 242 +- .../PHPExcel/Reader/DefaultReadFilter.php | 8 +- .../phpexcel/PHPExcel/Reader/Excel2003XML.php | 154 +- .../phpexcel/PHPExcel/Reader/Excel2007.php | 747 ++- .../PHPExcel/Reader/Excel2007/Chart.php | 16 +- .../PHPExcel/Reader/Excel2007/Theme.php | 8 +- .../phpexcel/PHPExcel/Reader/Excel5.php | 648 +- .../PHPExcel/Reader/Excel5/Escher.php | 8 +- .../phpexcel/PHPExcel/Reader/Excel5/MD5.php | 221 + .../phpexcel/PHPExcel/Reader/Excel5/RC4.php | 88 + .../phpexcel/PHPExcel/Reader/Exception.php | 52 + .../phpexcel/PHPExcel/Reader/Gnumeric.php | 269 +- .../phpexcel/PHPExcel/Reader/HTML.php | 139 +- .../phpexcel/PHPExcel/Reader/IReadFilter.php | 8 +- .../phpexcel/PHPExcel/Reader/IReader.php | 14 +- .../phpexcel/PHPExcel/Reader/OOCalc.php | 1066 ++-- .../phpexcel/PHPExcel/Reader/SYLK.php | 112 +- .../phpexcel/PHPExcel/ReferenceHelper.php | 507 +- .../includes/phpexcel/PHPExcel/RichText.php | 179 +- .../PHPExcel/RichText/ITextElement.php | 6 +- .../phpexcel/PHPExcel/RichText/Run.php | 8 +- .../PHPExcel/RichText/TextElement.php | 6 +- .../includes/phpexcel/PHPExcel/Settings.php | 563 +- .../phpexcel/PHPExcel/Shared/CodePage.php | 21 +- .../phpexcel/PHPExcel/Shared/Date.php | 131 +- .../phpexcel/PHPExcel/Shared/Drawing.php | 8 +- .../phpexcel/PHPExcel/Shared/Escher.php | 8 +- .../PHPExcel/Shared/Escher/DgContainer.php | 8 +- .../Escher/DgContainer/SpgrContainer.php | 8 +- .../DgContainer/SpgrContainer/SpContainer.php | 8 +- .../PHPExcel/Shared/Escher/DggContainer.php | 8 +- .../Escher/DggContainer/BstoreContainer.php | 8 +- .../DggContainer/BstoreContainer/BSE.php | 8 +- .../DggContainer/BstoreContainer/BSE/Blip.php | 8 +- .../phpexcel/PHPExcel/Shared/Excel5.php | 22 +- .../phpexcel/PHPExcel/Shared/File.php | 49 +- .../phpexcel/PHPExcel/Shared/Font.php | 32 +- .../Shared/JAMA/CholeskyDecomposition.php | 8 +- .../PHPExcel/Shared/JAMA/LUDecomposition.php | 12 +- .../phpexcel/PHPExcel/Shared/JAMA/Matrix.php | 124 +- .../PHPExcel/Shared/JAMA/QRDecomposition.php | 6 +- .../Shared/JAMA/examples/LMQuadTest.php | 116 - .../JAMA/examples/LagrangeInterpolation.php | 59 - .../JAMA/examples/LagrangeInterpolation2.php | 59 - .../JAMA/examples/LevenbergMarquardt.php | 185 - .../JAMA/examples/MagicSquareExample.php | 182 - .../PHPExcel/Shared/JAMA/examples/Stats.php | 1605 ----- .../Shared/JAMA/examples/benchmark.php | 263 - .../PHPExcel/Shared/JAMA/examples/polyfit.php | 73 - .../PHPExcel/Shared/JAMA/examples/tile.php | 78 - .../PHPExcel/Shared/JAMA/tests/TestMatrix.php | 415 -- .../PHPExcel/Shared/JAMA/utils/Maths.php | 2 +- .../includes/phpexcel/PHPExcel/Shared/OLE.php | 6 +- .../Shared/OLE/ChainedBlockStream.php | 21 +- .../phpexcel/PHPExcel/Shared/OLE/PPS/Root.php | 4 +- .../phpexcel/PHPExcel/Shared/OLERead.php | 70 +- .../PHPExcel/Shared/PasswordHasher.php | 21 +- .../phpexcel/PHPExcel/Shared/String.php | 98 +- .../phpexcel/PHPExcel/Shared/TimeZone.php | 140 + .../phpexcel/PHPExcel/Shared/XMLWriter.php | 8 +- .../phpexcel/PHPExcel/Shared/ZipArchive.php | 71 +- .../PHPExcel/Shared/ZipStreamWrapper.php | 28 +- .../PHPExcel/Shared/trend/bestFitClass.php | 8 +- .../Shared/trend/exponentialBestFitClass.php | 8 +- .../Shared/trend/linearBestFitClass.php | 8 +- .../Shared/trend/logarithmicBestFitClass.php | 8 +- .../Shared/trend/polynomialBestFitClass.php | 8 +- .../Shared/trend/powerBestFitClass.php | 8 +- .../PHPExcel/Shared/trend/trendClass.php | 8 +- htdocs/includes/phpexcel/PHPExcel/Style.php | 1020 ++-- .../phpexcel/PHPExcel/Style/Alignment.php | 156 +- .../phpexcel/PHPExcel/Style/Border.php | 172 +- .../phpexcel/PHPExcel/Style/Borders.php | 158 +- .../phpexcel/PHPExcel/Style/Color.php | 113 +- .../phpexcel/PHPExcel/Style/Conditional.php | 10 +- .../includes/phpexcel/PHPExcel/Style/Fill.php | 118 +- .../includes/phpexcel/PHPExcel/Style/Font.php | 158 +- .../phpexcel/PHPExcel/Style/NumberFormat.php | 300 +- .../phpexcel/PHPExcel/Style/Protection.php | 121 +- .../phpexcel/PHPExcel/Style/Supervisor.php | 132 + .../includes/phpexcel/PHPExcel/Worksheet.php | 5428 +++++++++-------- .../PHPExcel/Worksheet/AutoFilter.php | 39 +- .../PHPExcel/Worksheet/AutoFilter/Column.php | 31 +- .../Worksheet/AutoFilter/Column/Rule.php | 20 +- .../PHPExcel/Worksheet/BaseDrawing.php | 14 +- .../PHPExcel/Worksheet/CellIterator.php | 8 +- .../PHPExcel/Worksheet/ColumnDimension.php | 12 +- .../phpexcel/PHPExcel/Worksheet/Drawing.php | 12 +- .../PHPExcel/Worksheet/Drawing/Shadow.php | 10 +- .../PHPExcel/Worksheet/HeaderFooter.php | 16 +- .../Worksheet/HeaderFooterDrawing.php | 12 +- .../PHPExcel/Worksheet/MemoryDrawing.php | 8 +- .../PHPExcel/Worksheet/PageMargins.php | 8 +- .../phpexcel/PHPExcel/Worksheet/PageSetup.php | 36 +- .../PHPExcel/Worksheet/Protection.php | 8 +- .../phpexcel/PHPExcel/Worksheet/Row.php | 8 +- .../PHPExcel/Worksheet/RowDimension.php | 12 +- .../PHPExcel/Worksheet/RowIterator.php | 8 +- .../phpexcel/PHPExcel/Worksheet/SheetView.php | 20 +- .../phpexcel/PHPExcel/WorksheetIterator.php | 89 +- .../phpexcel/PHPExcel/Writer/Abstract.php | 158 + .../includes/phpexcel/PHPExcel/Writer/CSV.php | 75 +- .../phpexcel/PHPExcel/Writer/Excel2007.php | 197 +- .../PHPExcel/Writer/Excel2007/Chart.php | 82 +- .../PHPExcel/Writer/Excel2007/Comments.php | 16 +- .../Writer/Excel2007/ContentTypes.php | 56 +- .../PHPExcel/Writer/Excel2007/DocProps.php | 14 +- .../PHPExcel/Writer/Excel2007/Drawing.php | 22 +- .../PHPExcel/Writer/Excel2007/Rels.php | 42 +- .../PHPExcel/Writer/Excel2007/RelsRibbon.php | 77 + .../PHPExcel/Writer/Excel2007/RelsVBA.php | 72 + .../PHPExcel/Writer/Excel2007/StringTable.php | 20 +- .../PHPExcel/Writer/Excel2007/Style.php | 43 +- .../PHPExcel/Writer/Excel2007/Theme.php | 16 +- .../PHPExcel/Writer/Excel2007/Workbook.php | 46 +- .../PHPExcel/Writer/Excel2007/Worksheet.php | 81 +- .../PHPExcel/Writer/Excel2007/WriterPart.php | 16 +- .../phpexcel/PHPExcel/Writer/Excel5.php | 50 +- .../PHPExcel/Writer/Excel5/BIFFwriter.php | 10 +- .../PHPExcel/Writer/Excel5/Escher.php | 8 +- .../phpexcel/PHPExcel/Writer/Excel5/Font.php | 8 +- .../PHPExcel/Writer/Excel5/Parser.php | 57 +- .../PHPExcel/Writer/Excel5/Workbook.php | 22 +- .../PHPExcel/Writer/Excel5/Worksheet.php | 787 ++- .../phpexcel/PHPExcel/Writer/Excel5/Xf.php | 11 +- .../phpexcel/PHPExcel/Writer/Exception.php | 52 + .../phpexcel/PHPExcel/Writer/HTML.php | 301 +- .../phpexcel/PHPExcel/Writer/IWriter.php | 59 +- .../includes/phpexcel/PHPExcel/Writer/PDF.php | 110 +- .../phpexcel/PHPExcel/Writer/PDF/Core.php | 523 +- .../phpexcel/PHPExcel/Writer/PDF/DomPDF.php | 188 +- .../phpexcel/PHPExcel/Writer/PDF/mPDF.php | 201 +- .../phpexcel/PHPExcel/Writer/PDF/tcPDF.php | 217 +- .../phpexcel/PHPExcel/locale/bg/config | 49 + .../phpexcel/PHPExcel/locale/cs/config | 8 +- .../phpexcel/PHPExcel/locale/cs/functions | 8 +- .../phpexcel/PHPExcel/locale/da/config | 8 +- .../phpexcel/PHPExcel/locale/da/functions | 8 +- .../phpexcel/PHPExcel/locale/de/config | 8 +- .../phpexcel/PHPExcel/locale/de/functions | 8 +- .../phpexcel/PHPExcel/locale/en/uk/config | 8 +- .../phpexcel/PHPExcel/locale/es/config | 8 +- .../phpexcel/PHPExcel/locale/es/functions | 8 +- .../phpexcel/PHPExcel/locale/fi/config | 8 +- .../phpexcel/PHPExcel/locale/fi/functions | 8 +- .../phpexcel/PHPExcel/locale/fr/config | 8 +- .../phpexcel/PHPExcel/locale/fr/functions | 8 +- .../phpexcel/PHPExcel/locale/hu/config | 8 +- .../phpexcel/PHPExcel/locale/hu/functions | 8 +- .../phpexcel/PHPExcel/locale/it/config | 8 +- .../phpexcel/PHPExcel/locale/it/functions | 8 +- .../phpexcel/PHPExcel/locale/nl/config | 8 +- .../phpexcel/PHPExcel/locale/nl/functions | 8 +- .../phpexcel/PHPExcel/locale/no/config | 8 +- .../phpexcel/PHPExcel/locale/no/functions | 8 +- .../phpexcel/PHPExcel/locale/pl/config | 8 +- .../phpexcel/PHPExcel/locale/pl/functions | 8 +- .../phpexcel/PHPExcel/locale/pt/br/config | 8 +- .../phpexcel/PHPExcel/locale/pt/br/functions | 2 +- .../phpexcel/PHPExcel/locale/pt/config | 8 +- .../phpexcel/PHPExcel/locale/pt/functions | 2 +- .../phpexcel/PHPExcel/locale/ru/config | 8 +- .../phpexcel/PHPExcel/locale/ru/functions | 8 +- .../phpexcel/PHPExcel/locale/sv/config | 8 +- .../phpexcel/PHPExcel/locale/sv/functions | 2 +- .../phpexcel/PHPExcel/locale/tr/config | 8 +- .../phpexcel/PHPExcel/locale/tr/functions | 8 +- htdocs/includes/phpexcel/changelog.txt | 139 +- htdocs/includes/phpexcel/install.txt | 18 +- 230 files changed, 15081 insertions(+), 14862 deletions(-) create mode 100644 htdocs/includes/phpexcel/PHPExcel/CalcEngine/CyclicReferenceStack.php create mode 100644 htdocs/includes/phpexcel/PHPExcel/CalcEngine/Logger.php create mode 100644 htdocs/includes/phpexcel/PHPExcel/Reader/Abstract.php create mode 100644 htdocs/includes/phpexcel/PHPExcel/Reader/Excel5/MD5.php create mode 100644 htdocs/includes/phpexcel/PHPExcel/Reader/Excel5/RC4.php create mode 100644 htdocs/includes/phpexcel/PHPExcel/Reader/Exception.php delete mode 100644 htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/LMQuadTest.php delete mode 100644 htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/LagrangeInterpolation.php delete mode 100644 htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/LagrangeInterpolation2.php delete mode 100644 htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/LevenbergMarquardt.php delete mode 100644 htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/MagicSquareExample.php delete mode 100644 htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/Stats.php delete mode 100644 htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/benchmark.php delete mode 100644 htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/polyfit.php delete mode 100644 htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/tile.php delete mode 100644 htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/tests/TestMatrix.php create mode 100644 htdocs/includes/phpexcel/PHPExcel/Shared/TimeZone.php create mode 100644 htdocs/includes/phpexcel/PHPExcel/Style/Supervisor.php create mode 100644 htdocs/includes/phpexcel/PHPExcel/Writer/Abstract.php create mode 100644 htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/RelsRibbon.php create mode 100644 htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/RelsVBA.php create mode 100644 htdocs/includes/phpexcel/PHPExcel/Writer/Exception.php create mode 100644 htdocs/includes/phpexcel/PHPExcel/locale/bg/config diff --git a/COPYRIGHT b/COPYRIGHT index cf31432caf0..eec322ef052 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -20,7 +20,7 @@ FPDF_TPL 1.2 Apache Software License 2.0 Yes GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package) NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package) odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files -PHPExcel 1.7.8 LGPL-2.1+ Yes Read/Write XLS files, read ODS files +PHPExcel 1.8.0 LGPL-2.1+ Yes Read/Write XLS files, read ODS files php-iban 1.4.6 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests TCPDF 6.0.093 LGPL-3+ Yes PDF generation diff --git a/htdocs/includes/phpexcel/PHPExcel.php b/htdocs/includes/phpexcel/PHPExcel.php index f0b39e7961a..bf6f60f5fd0 100644 --- a/htdocs/includes/phpexcel/PHPExcel.php +++ b/htdocs/includes/phpexcel/PHPExcel.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,16 +20,16 @@ * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.8.0, 2014-03-02 */ /** PHPExcel root directory */ if (!defined('PHPEXCEL_ROOT')) { - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/'); + require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); } @@ -38,165 +38,441 @@ if (!defined('PHPEXCEL_ROOT')) { * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel { - /** - * Document properties + /** + * Unique ID + * + * @var string + */ + private $_uniqueID; + + /** + * Document properties + * + * @var PHPExcel_DocumentProperties + */ + private $_properties; + + /** + * Document security + * + * @var PHPExcel_DocumentSecurity + */ + private $_security; + + /** + * Collection of Worksheet objects + * + * @var PHPExcel_Worksheet[] + */ + private $_workSheetCollection = array(); + + /** + * Calculation Engine * - * @var PHPExcel_DocumentProperties + * @var PHPExcel_Calculation */ - private $_properties; + private $_calculationEngine = NULL; + + /** + * Active sheet index + * + * @var int + */ + private $_activeSheetIndex = 0; + + /** + * Named ranges + * + * @var PHPExcel_NamedRange[] + */ + private $_namedRanges = array(); + + /** + * CellXf supervisor + * + * @var PHPExcel_Style + */ + private $_cellXfSupervisor; + + /** + * CellXf collection + * + * @var PHPExcel_Style[] + */ + private $_cellXfCollection = array(); + + /** + * CellStyleXf collection + * + * @var PHPExcel_Style[] + */ + private $_cellStyleXfCollection = array(); /** - * Document security - * - * @var PHPExcel_DocumentSecurity - */ - private $_security; + * _hasMacros : this workbook have macros ? + * + * @var bool + */ + private $_hasMacros = FALSE; /** - * Collection of Worksheet objects - * - * @var PHPExcel_Worksheet[] - */ - private $_workSheetCollection = array(); + * _macrosCode : all macros code (the vbaProject.bin file, this include form, code, etc.), NULL if no macro + * + * @var binary + */ + private $_macrosCode=NULL; + /** + * _macrosCertificate : if macros are signed, contains vbaProjectSignature.bin file, NULL if not signed + * + * @var binary + */ + private $_macrosCertificate=NULL; /** - * Active sheet index - * - * @var int - */ - private $_activeSheetIndex = 0; + * _ribbonXMLData : NULL if workbook is'nt Excel 2007 or not contain a customized UI + * + * @var NULL|string + */ + private $_ribbonXMLData=NULL; /** - * Named ranges - * - * @var PHPExcel_NamedRange[] - */ - private $_namedRanges = array(); + * _ribbonBinObjects : NULL if workbook is'nt Excel 2007 or not contain embedded objects (picture(s)) for Ribbon Elements + * ignored if $_ribbonXMLData is null + * + * @var NULL|array + */ + private $_ribbonBinObjects=NULL; /** - * CellXf supervisor - * - * @var PHPExcel_Style - */ - private $_cellXfSupervisor; + * The workbook has macros ? + * + * @return true if workbook has macros, false if not + */ + public function hasMacros(){ + return $this->_hasMacros; + } /** - * CellXf collection - * - * @var PHPExcel_Style[] - */ - private $_cellXfCollection = array(); + * Define if a workbook has macros + * + * @param true|false + */ + public function setHasMacros($hasMacros=false){ + $this->_hasMacros=(bool)$hasMacros; + } /** - * CellStyleXf collection - * - * @var PHPExcel_Style[] - */ - private $_cellStyleXfCollection = array(); + * Set the macros code + * + * @param binary string|null + */ + public function setMacrosCode($MacrosCode){ + $this->_macrosCode=$MacrosCode; + $this->setHasMacros(!is_null($MacrosCode)); + } /** + * Return the macros code + * + * @return binary|null + */ + public function getMacrosCode(){ + return $this->_macrosCode; + } + + /** + * Set the macros certificate + * + * @param binary|null + */ + public function setMacrosCertificate($Certificate=NULL){ + $this->_macrosCertificate=$Certificate; + } + + /** + * Is the project signed ? + * + * @return true|false + */ + public function hasMacrosCertificate(){ + return !is_null($this->_macrosCertificate); + } + + /** + * Return the macros certificate + * + * @return binary|null + */ + public function getMacrosCertificate(){ + return $this->_macrosCertificate; + } + + /** + * Remove all macros, certificate from spreadsheet + * + * @param none + * @return void + */ + public function discardMacros(){ + $this->_hasMacros=false; + $this->_macrosCode=NULL; + $this->_macrosCertificate=NULL; + } + + /** + * set ribbon XML data + * + */ + public function setRibbonXMLData($Target=NULL, $XMLData=NULL){ + if(!is_null($Target) && !is_null($XMLData)){ + $this->_ribbonXMLData=array('target'=>$Target, 'data'=>$XMLData); + }else{ + $this->_ribbonXMLData=NULL; + } + } + + /** + * retrieve ribbon XML Data + * + * return string|null|array + */ + public function getRibbonXMLData($What='all'){//we need some constants here... + $ReturnData=NULL; + $What=strtolower($What); + switch($What){ + case 'all': + $ReturnData=$this->_ribbonXMLData; + break; + case 'target': + case 'data': + if(is_array($this->_ribbonXMLData) && array_key_exists($What,$this->_ribbonXMLData)){ + $ReturnData=$this->_ribbonXMLData[$What]; + }//else $ReturnData stay at null + break; + }//default: $ReturnData at null + return $ReturnData; + } + + /** + * store binaries ribbon objects (pictures) + * + */ + public function setRibbonBinObjects($BinObjectsNames=NULL, $BinObjectsData=NULL){ + if(!is_null($BinObjectsNames) && !is_null($BinObjectsData)){ + $this->_ribbonBinObjects=array('names'=>$BinObjectsNames, 'data'=>$BinObjectsData); + }else{ + $this->_ribbonBinObjects=NULL; + } + } + /** + * return the extension of a filename. Internal use for a array_map callback (php<5.3 don't like lambda function) + * + */ + private function _getExtensionOnly($ThePath){ + return pathinfo($ThePath, PATHINFO_EXTENSION); + } + + /** + * retrieve Binaries Ribbon Objects + * + */ + public function getRibbonBinObjects($What='all'){ + $ReturnData=NULL; + $What=strtolower($What); + switch($What){ + case 'all': + return $this->_ribbonBinObjects; + break; + case 'names': + case 'data': + if(is_array($this->_ribbonBinObjects) && array_key_exists($What, $this->_ribbonBinObjects)){ + $ReturnData=$this->_ribbonBinObjects[$What]; + } + break; + case 'types': + if(is_array($this->_ribbonBinObjects) && array_key_exists('data', $this->_ribbonBinObjects) && is_array($this->_ribbonBinObjects['data'])){ + $tmpTypes=array_keys($this->_ribbonBinObjects['data']); + $ReturnData=array_unique(array_map(array($this,'_getExtensionOnly'), $tmpTypes)); + }else + $ReturnData=array();//the caller want an array... not null if empty + break; + } + return $ReturnData; + } + + /** + * This workbook have a custom UI ? + * + * @return true|false + */ + public function hasRibbon(){ + return !is_null($this->_ribbonXMLData); + } + + /** + * This workbook have additionnal object for the ribbon ? + * + * @return true|false + */ + public function hasRibbonBinObjects(){ + return !is_null($this->_ribbonBinObjects); + } + + /** + * Check if a sheet with a specified code name already exists + * + * @param string $pSheetCodeName Name of the worksheet to check + * @return boolean + */ + public function sheetCodeNameExists($pSheetCodeName) + { + return ($this->getSheetByCodeName($pSheetCodeName) !== NULL); + } + + /** + * Get sheet by code name. Warning : sheet don't have always a code name ! + * + * @param string $pName Sheet name + * @return PHPExcel_Worksheet + */ + public function getSheetByCodeName($pName = '') + { + $worksheetCount = count($this->_workSheetCollection); + for ($i = 0; $i < $worksheetCount; ++$i) { + if ($this->_workSheetCollection[$i]->getCodeName() == $pName) { + return $this->_workSheetCollection[$i]; + } + } + + return null; + } + + /** * Create a new PHPExcel with one Worksheet */ public function __construct() { + $this->_uniqueID = uniqid(); + $this->_calculationEngine = PHPExcel_Calculation::getInstance($this); + // Initialise worksheet collection and add one worksheet $this->_workSheetCollection = array(); $this->_workSheetCollection[] = new PHPExcel_Worksheet($this); $this->_activeSheetIndex = 0; - // Create document properties - $this->_properties = new PHPExcel_DocumentProperties(); + // Create document properties + $this->_properties = new PHPExcel_DocumentProperties(); - // Create document security - $this->_security = new PHPExcel_DocumentSecurity(); + // Create document security + $this->_security = new PHPExcel_DocumentSecurity(); - // Set named ranges - $this->_namedRanges = array(); + // Set named ranges + $this->_namedRanges = array(); - // Create the cellXf supervisor - $this->_cellXfSupervisor = new PHPExcel_Style(true); - $this->_cellXfSupervisor->bindParent($this); + // Create the cellXf supervisor + $this->_cellXfSupervisor = new PHPExcel_Style(true); + $this->_cellXfSupervisor->bindParent($this); - // Create the default style - $this->addCellXf(new PHPExcel_Style); - $this->addCellStyleXf(new PHPExcel_Style); - } + // Create the default style + $this->addCellXf(new PHPExcel_Style); + $this->addCellStyleXf(new PHPExcel_Style); + } + /** + * Code to execute when this worksheet is unset() + * + */ + public function __destruct() { + PHPExcel_Calculation::unsetInstance($this); + $this->disconnectWorksheets(); + } // function __destruct() + + /** + * Disconnect all worksheets from this PHPExcel workbook object, + * typically so that the PHPExcel object can be unset + * + */ + public function disconnectWorksheets() + { + $worksheet = NULL; + foreach($this->_workSheetCollection as $k => &$worksheet) { + $worksheet->disconnectCells(); + $this->_workSheetCollection[$k] = null; + } + unset($worksheet); + $this->_workSheetCollection = array(); + } /** - * Disconnect all worksheets from this PHPExcel workbook object, - * typically so that the PHPExcel object can be unset + * Return the calculation engine for this worksheet * + * @return PHPExcel_Calculation */ - public function disconnectWorksheets() { - foreach($this->_workSheetCollection as $k => &$worksheet) { - $worksheet->disconnectCells(); - $this->_workSheetCollection[$k] = null; - } - unset($worksheet); - $this->_workSheetCollection = array(); - } - - /** - * Get properties - * - * @return PHPExcel_DocumentProperties - */ - public function getProperties() + public function getCalculationEngine() { - return $this->_properties; - } + return $this->_calculationEngine; + } // function getCellCacheController() - /** - * Set properties - * - * @param PHPExcel_DocumentProperties $pValue - */ - public function setProperties(PHPExcel_DocumentProperties $pValue) - { - $this->_properties = $pValue; - } + /** + * Get properties + * + * @return PHPExcel_DocumentProperties + */ + public function getProperties() + { + return $this->_properties; + } - /** - * Get security - * - * @return PHPExcel_DocumentSecurity - */ - public function getSecurity() - { - return $this->_security; - } + /** + * Set properties + * + * @param PHPExcel_DocumentProperties $pValue + */ + public function setProperties(PHPExcel_DocumentProperties $pValue) + { + $this->_properties = $pValue; + } - /** - * Set security - * - * @param PHPExcel_DocumentSecurity $pValue - */ - public function setSecurity(PHPExcel_DocumentSecurity $pValue) - { - $this->_security = $pValue; - } + /** + * Get security + * + * @return PHPExcel_DocumentSecurity + */ + public function getSecurity() + { + return $this->_security; + } - /** - * Get active sheet - * - * @return PHPExcel_Worksheet - */ - public function getActiveSheet() - { - return $this->_workSheetCollection[$this->_activeSheetIndex]; - } + /** + * Set security + * + * @param PHPExcel_DocumentSecurity $pValue + */ + public function setSecurity(PHPExcel_DocumentSecurity $pValue) + { + $this->_security = $pValue; + } + + /** + * Get active sheet + * + * @return PHPExcel_Worksheet + */ + public function getActiveSheet() + { + return $this->_workSheetCollection[$this->_activeSheetIndex]; + } /** * Create sheet and add it to this workbook * - * @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last) + * @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last) * @return PHPExcel_Worksheet - * @throws Exception + * @throws PHPExcel_Exception */ public function createSheet($iSheetIndex = NULL) { @@ -206,33 +482,35 @@ class PHPExcel } /** - * Chech if a sheet with a specified name already exists + * Check if a sheet with a specified name already exists * - * @param string $pSheetName Name of the worksheet to check + * @param string $pSheetName Name of the worksheet to check * @return boolean */ public function sheetNameExists($pSheetName) { - return ($this->getSheetByName($pSheetName) !== NULL); + return ($this->getSheetByName($pSheetName) !== NULL); } /** * Add sheet * - * @param PHPExcel_Worksheet $pSheet - * @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last) + * @param PHPExcel_Worksheet $pSheet + * @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last) * @return PHPExcel_Worksheet - * @throws Exception + * @throws PHPExcel_Exception */ public function addSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = NULL) { - if ($this->sheetNameExists($pSheet->getTitle())) { - throw new Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename this worksheet first."); - } + if ($this->sheetNameExists($pSheet->getTitle())) { + throw new PHPExcel_Exception( + "Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename this worksheet first." + ); + } if($iSheetIndex === NULL) { if ($this->_activeSheetIndex < 0) { - $this->_activeSheetIndex = 0; + $this->_activeSheetIndex = 0; } $this->_workSheetCollection[] = $pSheet; } else { @@ -244,104 +522,120 @@ class PHPExcel array($pSheet) ); - // Adjust active sheet index if necessary - if ($this->_activeSheetIndex >= $iSheetIndex) { - ++$this->_activeSheetIndex; - } + // Adjust active sheet index if necessary + if ($this->_activeSheetIndex >= $iSheetIndex) { + ++$this->_activeSheetIndex; + } } - return $pSheet; + + if ($pSheet->getParent() === null) { + $pSheet->rebindParent($this); + } + + return $pSheet; } - /** - * Remove sheet by index - * - * @param int $pIndex Active sheet index - * @throws Exception - */ - public function removeSheetByIndex($pIndex = 0) - { - if ($pIndex > count($this->_workSheetCollection) - 1) { - throw new Exception("Sheet index is out of bounds."); - } else { - array_splice($this->_workSheetCollection, $pIndex, 1); - } - // Adjust active sheet index if necessary - if (($this->_activeSheetIndex >= $pIndex) && - ($pIndex > count($this->_workSheetCollection) - 1)) { - --$this->_activeSheetIndex; - } + /** + * Remove sheet by index + * + * @param int $pIndex Active sheet index + * @throws PHPExcel_Exception + */ + public function removeSheetByIndex($pIndex = 0) + { - } + $numSheets = count($this->_workSheetCollection); - /** - * Get sheet by index - * - * @param int $pIndex Sheet index - * @return PHPExcel_Worksheet - * @throws Exception - */ - public function getSheet($pIndex = 0) - { - if ($pIndex > count($this->_workSheetCollection) - 1) { - throw new Exception("Sheet index is out of bounds."); - } else { - return $this->_workSheetCollection[$pIndex]; - } - } + if ($pIndex > $numSheets - 1) { + throw new PHPExcel_Exception( + "You tried to remove a sheet by the out of bounds index: {$pIndex}. The actual number of sheets is {$numSheets}." + ); + } else { + array_splice($this->_workSheetCollection, $pIndex, 1); + } + // Adjust active sheet index if necessary + if (($this->_activeSheetIndex >= $pIndex) && + ($pIndex > count($this->_workSheetCollection) - 1)) { + --$this->_activeSheetIndex; + } - /** - * Get all sheets - * - * @return PHPExcel_Worksheet[] - */ - public function getAllSheets() - { - return $this->_workSheetCollection; - } - - /** - * Get sheet by name - * - * @param string $pName Sheet name - * @return PHPExcel_Worksheet - * @throws Exception - */ - public function getSheetByName($pName = '') - { - $worksheetCount = count($this->_workSheetCollection); - for ($i = 0; $i < $worksheetCount; ++$i) { - if ($this->_workSheetCollection[$i]->getTitle() == $pName) { - return $this->_workSheetCollection[$i]; - } - } - - return null; - } - - /** - * Get index for sheet - * - * @param PHPExcel_Worksheet $pSheet - * @return Sheet index - * @throws Exception - */ - public function getIndex(PHPExcel_Worksheet $pSheet) - { - foreach ($this->_workSheetCollection as $key => $value) { - if ($value->getHashCode() == $pSheet->getHashCode()) { - return $key; - } - } - } + } /** - * Set index for sheet by sheet name. - * - * @param string $sheetName Sheet name to modify index for - * @param int $newIndex New index for the sheet - * @return New sheet index - * @throws Exception - */ + * Get sheet by index + * + * @param int $pIndex Sheet index + * @return PHPExcel_Worksheet + * @throws PHPExcel_Exception + */ + public function getSheet($pIndex = 0) + { + + $numSheets = count($this->_workSheetCollection); + + if ($pIndex > $numSheets - 1) { + throw new PHPExcel_Exception( + "Your requested sheet index: {$pIndex} is out of bounds. The actual number of sheets is {$numSheets}." + ); + } else { + return $this->_workSheetCollection[$pIndex]; + } + } + + /** + * Get all sheets + * + * @return PHPExcel_Worksheet[] + */ + public function getAllSheets() + { + return $this->_workSheetCollection; + } + + /** + * Get sheet by name + * + * @param string $pName Sheet name + * @return PHPExcel_Worksheet + */ + public function getSheetByName($pName = '') + { + $worksheetCount = count($this->_workSheetCollection); + for ($i = 0; $i < $worksheetCount; ++$i) { + if ($this->_workSheetCollection[$i]->getTitle() === $pName) { + return $this->_workSheetCollection[$i]; + } + } + + return NULL; + } + + /** + * Get index for sheet + * + * @param PHPExcel_Worksheet $pSheet + * @return Sheet index + * @throws PHPExcel_Exception + */ + public function getIndex(PHPExcel_Worksheet $pSheet) + { + foreach ($this->_workSheetCollection as $key => $value) { + if ($value->getHashCode() == $pSheet->getHashCode()) { + return $key; + } + } + + throw new PHPExcel_Exception("Sheet does not exist."); + } + + /** + * Set index for sheet by sheet name. + * + * @param string $sheetName Sheet name to modify index for + * @param int $newIndex New index for the sheet + * @return New sheet index + * @throws PHPExcel_Exception + */ public function setIndexByName($sheetName, $newIndex) { $oldIndex = $this->getIndex($this->getSheetByName($sheetName)); @@ -349,475 +643,497 @@ class PHPExcel $this->_workSheetCollection, $oldIndex, 1 - ); + ); array_splice( $this->_workSheetCollection, $newIndex, 0, $pSheet - ); + ); return $newIndex; } - /** - * Get sheet count - * - * @return int - */ - public function getSheetCount() - { - return count($this->_workSheetCollection); - } + /** + * Get sheet count + * + * @return int + */ + public function getSheetCount() + { + return count($this->_workSheetCollection); + } - /** - * Get active sheet index - * - * @return int Active sheet index - */ - public function getActiveSheetIndex() - { - return $this->_activeSheetIndex; - } + /** + * Get active sheet index + * + * @return int Active sheet index + */ + public function getActiveSheetIndex() + { + return $this->_activeSheetIndex; + } - /** - * Set active sheet index - * - * @param int $pIndex Active sheet index - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function setActiveSheetIndex($pIndex = 0) - { - if ($pIndex > count($this->_workSheetCollection) - 1) { - throw new Exception("Active sheet index is out of bounds."); - } else { - $this->_activeSheetIndex = $pIndex; - } - return $this->getActiveSheet(); - } + /** + * Set active sheet index + * + * @param int $pIndex Active sheet index + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function setActiveSheetIndex($pIndex = 0) + { + $numSheets = count($this->_workSheetCollection); - /** - * Set active sheet index by name - * - * @param string $pValue Sheet title - * @return PHPExcel_Worksheet - * @throws Exception - */ - public function setActiveSheetIndexByName($pValue = '') - { - if (($worksheet = $this->getSheetByName($pValue)) instanceof PHPExcel_Worksheet) { - $this->setActiveSheetIndex($this->getIndex($worksheet)); - return $worksheet; - } + if ($pIndex > $numSheets - 1) { + throw new PHPExcel_Exception( + "You tried to set a sheet active by the out of bounds index: {$pIndex}. The actual number of sheets is {$numSheets}." + ); + } else { + $this->_activeSheetIndex = $pIndex; + } + return $this->getActiveSheet(); + } - throw new Exception('Workbook does not contain sheet:' . $pValue); - } + /** + * Set active sheet index by name + * + * @param string $pValue Sheet title + * @return PHPExcel_Worksheet + * @throws PHPExcel_Exception + */ + public function setActiveSheetIndexByName($pValue = '') + { + if (($worksheet = $this->getSheetByName($pValue)) instanceof PHPExcel_Worksheet) { + $this->setActiveSheetIndex($this->getIndex($worksheet)); + return $worksheet; + } - /** - * Get sheet names - * - * @return string[] - */ - public function getSheetNames() - { - $returnValue = array(); - $worksheetCount = $this->getSheetCount(); - for ($i = 0; $i < $worksheetCount; ++$i) { - $returnValue[] = $this->getSheet($i)->getTitle(); - } + throw new PHPExcel_Exception('Workbook does not contain sheet:' . $pValue); + } - return $returnValue; - } + /** + * Get sheet names + * + * @return string[] + */ + public function getSheetNames() + { + $returnValue = array(); + $worksheetCount = $this->getSheetCount(); + for ($i = 0; $i < $worksheetCount; ++$i) { + $returnValue[] = $this->getSheet($i)->getTitle(); + } - /** - * Add external sheet - * - * @param PHPExcel_Worksheet $pSheet External sheet to add - * @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last) - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function addExternalSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = null) { - if ($this->sheetNameExists($pSheet->getTitle())) { - throw new Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first."); - } + return $returnValue; + } - // count how many cellXfs there are in this workbook currently, we will need this below - $countCellXfs = count($this->_cellXfCollection); + /** + * Add external sheet + * + * @param PHPExcel_Worksheet $pSheet External sheet to add + * @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last) + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function addExternalSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = null) { + if ($this->sheetNameExists($pSheet->getTitle())) { + throw new PHPExcel_Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first."); + } - // copy all the shared cellXfs from the external workbook and append them to the current - foreach ($pSheet->getParent()->getCellXfCollection() as $cellXf) { - $this->addCellXf(clone $cellXf); - } + // count how many cellXfs there are in this workbook currently, we will need this below + $countCellXfs = count($this->_cellXfCollection); - // move sheet to this workbook - $pSheet->rebindParent($this); + // copy all the shared cellXfs from the external workbook and append them to the current + foreach ($pSheet->getParent()->getCellXfCollection() as $cellXf) { + $this->addCellXf(clone $cellXf); + } - // update the cellXfs - foreach ($pSheet->getCellCollection(false) as $cellID) { - $cell = $pSheet->getCell($cellID); - $cell->setXfIndex( $cell->getXfIndex() + $countCellXfs ); - } + // move sheet to this workbook + $pSheet->rebindParent($this); - return $this->addSheet($pSheet, $iSheetIndex); - } + // update the cellXfs + foreach ($pSheet->getCellCollection(false) as $cellID) { + $cell = $pSheet->getCell($cellID); + $cell->setXfIndex( $cell->getXfIndex() + $countCellXfs ); + } - /** - * Get named ranges - * - * @return PHPExcel_NamedRange[] - */ - public function getNamedRanges() { - return $this->_namedRanges; - } + return $this->addSheet($pSheet, $iSheetIndex); + } - /** - * Add named range - * - * @param PHPExcel_NamedRange $namedRange - * @return PHPExcel - */ - public function addNamedRange(PHPExcel_NamedRange $namedRange) { - if ($namedRange->getScope() == null) { - // global scope - $this->_namedRanges[$namedRange->getName()] = $namedRange; - } else { - // local scope - $this->_namedRanges[$namedRange->getScope()->getTitle().'!'.$namedRange->getName()] = $namedRange; - } - return true; - } + /** + * Get named ranges + * + * @return PHPExcel_NamedRange[] + */ + public function getNamedRanges() { + return $this->_namedRanges; + } - /** - * Get named range - * - * @param string $namedRange - * @param PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope - * @return PHPExcel_NamedRange|null - */ - public function getNamedRange($namedRange, PHPExcel_Worksheet $pSheet = null) { - $returnValue = null; + /** + * Add named range + * + * @param PHPExcel_NamedRange $namedRange + * @return PHPExcel + */ + public function addNamedRange(PHPExcel_NamedRange $namedRange) { + if ($namedRange->getScope() == null) { + // global scope + $this->_namedRanges[$namedRange->getName()] = $namedRange; + } else { + // local scope + $this->_namedRanges[$namedRange->getScope()->getTitle().'!'.$namedRange->getName()] = $namedRange; + } + return true; + } - if ($namedRange != '' && ($namedRange !== NULL)) { - // first look for global defined name - if (isset($this->_namedRanges[$namedRange])) { - $returnValue = $this->_namedRanges[$namedRange]; - } + /** + * Get named range + * + * @param string $namedRange + * @param PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope + * @return PHPExcel_NamedRange|null + */ + public function getNamedRange($namedRange, PHPExcel_Worksheet $pSheet = null) { + $returnValue = null; - // then look for local defined name (has priority over global defined name if both names exist) - if (($pSheet !== NULL) && isset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange])) { - $returnValue = $this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange]; - } - } + if ($namedRange != '' && ($namedRange !== NULL)) { + // first look for global defined name + if (isset($this->_namedRanges[$namedRange])) { + $returnValue = $this->_namedRanges[$namedRange]; + } - return $returnValue; - } + // then look for local defined name (has priority over global defined name if both names exist) + if (($pSheet !== NULL) && isset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange])) { + $returnValue = $this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange]; + } + } - /** - * Remove named range - * - * @param string $namedRange - * @param PHPExcel_Worksheet|null $pSheet Scope: use null for global scope. - * @return PHPExcel - */ - public function removeNamedRange($namedRange, PHPExcel_Worksheet $pSheet = null) { - if ($pSheet === NULL) { - if (isset($this->_namedRanges[$namedRange])) { - unset($this->_namedRanges[$namedRange]); - } - } else { - if (isset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange])) { - unset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange]); - } - } - return $this; - } + return $returnValue; + } - /** - * Get worksheet iterator - * - * @return PHPExcel_WorksheetIterator - */ - public function getWorksheetIterator() { - return new PHPExcel_WorksheetIterator($this); - } + /** + * Remove named range + * + * @param string $namedRange + * @param PHPExcel_Worksheet|null $pSheet Scope: use null for global scope. + * @return PHPExcel + */ + public function removeNamedRange($namedRange, PHPExcel_Worksheet $pSheet = null) { + if ($pSheet === NULL) { + if (isset($this->_namedRanges[$namedRange])) { + unset($this->_namedRanges[$namedRange]); + } + } else { + if (isset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange])) { + unset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange]); + } + } + return $this; + } - /** - * Copy workbook (!= clone!) - * - * @return PHPExcel - */ - public function copy() { - $copied = clone $this; + /** + * Get worksheet iterator + * + * @return PHPExcel_WorksheetIterator + */ + public function getWorksheetIterator() { + return new PHPExcel_WorksheetIterator($this); + } - $worksheetCount = count($this->_workSheetCollection); - for ($i = 0; $i < $worksheetCount; ++$i) { - $this->_workSheetCollection[$i] = $this->_workSheetCollection[$i]->copy(); - $this->_workSheetCollection[$i]->rebindParent($this); - } + /** + * Copy workbook (!= clone!) + * + * @return PHPExcel + */ + public function copy() { + $copied = clone $this; - return $copied; - } + $worksheetCount = count($this->_workSheetCollection); + for ($i = 0; $i < $worksheetCount; ++$i) { + $this->_workSheetCollection[$i] = $this->_workSheetCollection[$i]->copy(); + $this->_workSheetCollection[$i]->rebindParent($this); + } - /** - * Implement PHP __clone to create a deep clone, not just a shallow copy. - */ - public function __clone() { - foreach($this as $key => $val) { - if (is_object($val) || (is_array($val))) { - $this->{$key} = unserialize(serialize($val)); - } - } - } + return $copied; + } - /** - * Get the workbook collection of cellXfs - * - * @return PHPExcel_Style[] - */ - public function getCellXfCollection() - { - return $this->_cellXfCollection; - } + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + foreach($this as $key => $val) { + if (is_object($val) || (is_array($val))) { + $this->{$key} = unserialize(serialize($val)); + } + } + } - /** - * Get cellXf by index - * - * @param int $pIndex - * @return PHPExcel_Style - */ - public function getCellXfByIndex($pIndex = 0) - { - return $this->_cellXfCollection[$pIndex]; - } + /** + * Get the workbook collection of cellXfs + * + * @return PHPExcel_Style[] + */ + public function getCellXfCollection() + { + return $this->_cellXfCollection; + } - /** - * Get cellXf by hash code - * - * @param string $pValue - * @return PHPExcel_Style|false - */ - public function getCellXfByHashCode($pValue = '') - { - foreach ($this->_cellXfCollection as $cellXf) { - if ($cellXf->getHashCode() == $pValue) { - return $cellXf; - } - } - return false; - } + /** + * Get cellXf by index + * + * @param int $pIndex + * @return PHPExcel_Style + */ + public function getCellXfByIndex($pIndex = 0) + { + return $this->_cellXfCollection[$pIndex]; + } - /** - * Get default style - * - * @return PHPExcel_Style - * @throws Exception - */ - public function getDefaultStyle() - { - if (isset($this->_cellXfCollection[0])) { - return $this->_cellXfCollection[0]; - } - throw new Exception('No default style found for this workbook'); - } + /** + * Get cellXf by hash code + * + * @param string $pValue + * @return PHPExcel_Style|false + */ + public function getCellXfByHashCode($pValue = '') + { + foreach ($this->_cellXfCollection as $cellXf) { + if ($cellXf->getHashCode() == $pValue) { + return $cellXf; + } + } + return false; + } - /** - * Add a cellXf to the workbook - * - * @param PHPExcel_Style $style - */ - public function addCellXf(PHPExcel_Style $style) - { - $this->_cellXfCollection[] = $style; - $style->setIndex(count($this->_cellXfCollection) - 1); - } + /** + * Check if style exists in style collection + * + * @param PHPExcel_Style $pCellStyle + * @return boolean + */ + public function cellXfExists($pCellStyle = null) + { + return in_array($pCellStyle, $this->_cellXfCollection, true); + } - /** - * Remove cellXf by index. It is ensured that all cells get their xf index updated. - * - * @param int $pIndex Index to cellXf - * @throws Exception - */ - public function removeCellXfByIndex($pIndex = 0) - { - if ($pIndex > count($this->_cellXfCollection) - 1) { - throw new Exception("CellXf index is out of bounds."); - } else { - // first remove the cellXf - array_splice($this->_cellXfCollection, $pIndex, 1); + /** + * Get default style + * + * @return PHPExcel_Style + * @throws PHPExcel_Exception + */ + public function getDefaultStyle() + { + if (isset($this->_cellXfCollection[0])) { + return $this->_cellXfCollection[0]; + } + throw new PHPExcel_Exception('No default style found for this workbook'); + } - // then update cellXf indexes for cells - foreach ($this->_workSheetCollection as $worksheet) { - foreach ($worksheet->getCellCollection(false) as $cellID) { - $cell = $worksheet->getCell($cellID); - $xfIndex = $cell->getXfIndex(); - if ($xfIndex > $pIndex ) { - // decrease xf index by 1 - $cell->setXfIndex($xfIndex - 1); - } else if ($xfIndex == $pIndex) { - // set to default xf index 0 - $cell->setXfIndex(0); - } - } - } - } - } + /** + * Add a cellXf to the workbook + * + * @param PHPExcel_Style $style + */ + public function addCellXf(PHPExcel_Style $style) + { + $this->_cellXfCollection[] = $style; + $style->setIndex(count($this->_cellXfCollection) - 1); + } - /** - * Get the cellXf supervisor - * - * @return PHPExcel_Style - */ - public function getCellXfSupervisor() - { - return $this->_cellXfSupervisor; - } + /** + * Remove cellXf by index. It is ensured that all cells get their xf index updated. + * + * @param int $pIndex Index to cellXf + * @throws PHPExcel_Exception + */ + public function removeCellXfByIndex($pIndex = 0) + { + if ($pIndex > count($this->_cellXfCollection) - 1) { + throw new PHPExcel_Exception("CellXf index is out of bounds."); + } else { + // first remove the cellXf + array_splice($this->_cellXfCollection, $pIndex, 1); - /** - * Get the workbook collection of cellStyleXfs - * - * @return PHPExcel_Style[] - */ - public function getCellStyleXfCollection() - { - return $this->_cellStyleXfCollection; - } + // then update cellXf indexes for cells + foreach ($this->_workSheetCollection as $worksheet) { + foreach ($worksheet->getCellCollection(false) as $cellID) { + $cell = $worksheet->getCell($cellID); + $xfIndex = $cell->getXfIndex(); + if ($xfIndex > $pIndex ) { + // decrease xf index by 1 + $cell->setXfIndex($xfIndex - 1); + } else if ($xfIndex == $pIndex) { + // set to default xf index 0 + $cell->setXfIndex(0); + } + } + } + } + } - /** - * Get cellStyleXf by index - * - * @param int $pIndex - * @return PHPExcel_Style - */ - public function getCellStyleXfByIndex($pIndex = 0) - { - return $this->_cellStyleXfCollection[$pIndex]; - } + /** + * Get the cellXf supervisor + * + * @return PHPExcel_Style + */ + public function getCellXfSupervisor() + { + return $this->_cellXfSupervisor; + } - /** - * Get cellStyleXf by hash code - * - * @param string $pValue - * @return PHPExcel_Style|false - */ - public function getCellStyleXfByHashCode($pValue = '') - { - foreach ($this->_cellXfStyleCollection as $cellStyleXf) { - if ($cellStyleXf->getHashCode() == $pValue) { - return $cellStyleXf; - } - } - return false; - } + /** + * Get the workbook collection of cellStyleXfs + * + * @return PHPExcel_Style[] + */ + public function getCellStyleXfCollection() + { + return $this->_cellStyleXfCollection; + } - /** - * Add a cellStyleXf to the workbook - * - * @param PHPExcel_Style $pStyle - */ - public function addCellStyleXf(PHPExcel_Style $pStyle) - { - $this->_cellStyleXfCollection[] = $pStyle; - $pStyle->setIndex(count($this->_cellStyleXfCollection) - 1); - } + /** + * Get cellStyleXf by index + * + * @param int $pIndex + * @return PHPExcel_Style + */ + public function getCellStyleXfByIndex($pIndex = 0) + { + return $this->_cellStyleXfCollection[$pIndex]; + } - /** - * Remove cellStyleXf by index - * - * @param int $pIndex - * @throws Exception - */ - public function removeCellStyleXfByIndex($pIndex = 0) - { - if ($pIndex > count($this->_cellStyleXfCollection) - 1) { - throw new Exception("CellStyleXf index is out of bounds."); - } else { - array_splice($this->_cellStyleXfCollection, $pIndex, 1); - } - } + /** + * Get cellStyleXf by hash code + * + * @param string $pValue + * @return PHPExcel_Style|false + */ + public function getCellStyleXfByHashCode($pValue = '') + { + foreach ($this->_cellXfStyleCollection as $cellStyleXf) { + if ($cellStyleXf->getHashCode() == $pValue) { + return $cellStyleXf; + } + } + return false; + } - /** - * Eliminate all unneeded cellXf and afterwards update the xfIndex for all cells - * and columns in the workbook - */ - public function garbageCollect() - { - // how many references are there to each cellXf ? - $countReferencesCellXf = array(); - foreach ($this->_cellXfCollection as $index => $cellXf) { - $countReferencesCellXf[$index] = 0; - } + /** + * Add a cellStyleXf to the workbook + * + * @param PHPExcel_Style $pStyle + */ + public function addCellStyleXf(PHPExcel_Style $pStyle) + { + $this->_cellStyleXfCollection[] = $pStyle; + $pStyle->setIndex(count($this->_cellStyleXfCollection) - 1); + } - foreach ($this->getWorksheetIterator() as $sheet) { + /** + * Remove cellStyleXf by index + * + * @param int $pIndex + * @throws PHPExcel_Exception + */ + public function removeCellStyleXfByIndex($pIndex = 0) + { + if ($pIndex > count($this->_cellStyleXfCollection) - 1) { + throw new PHPExcel_Exception("CellStyleXf index is out of bounds."); + } else { + array_splice($this->_cellStyleXfCollection, $pIndex, 1); + } + } - // from cells - foreach ($sheet->getCellCollection(false) as $cellID) { - $cell = $sheet->getCell($cellID); - ++$countReferencesCellXf[$cell->getXfIndex()]; - } + /** + * Eliminate all unneeded cellXf and afterwards update the xfIndex for all cells + * and columns in the workbook + */ + public function garbageCollect() + { + // how many references are there to each cellXf ? + $countReferencesCellXf = array(); + foreach ($this->_cellXfCollection as $index => $cellXf) { + $countReferencesCellXf[$index] = 0; + } - // from row dimensions - foreach ($sheet->getRowDimensions() as $rowDimension) { - if ($rowDimension->getXfIndex() !== null) { - ++$countReferencesCellXf[$rowDimension->getXfIndex()]; - } - } + foreach ($this->getWorksheetIterator() as $sheet) { - // from column dimensions - foreach ($sheet->getColumnDimensions() as $columnDimension) { - ++$countReferencesCellXf[$columnDimension->getXfIndex()]; - } - } + // from cells + foreach ($sheet->getCellCollection(false) as $cellID) { + $cell = $sheet->getCell($cellID); + ++$countReferencesCellXf[$cell->getXfIndex()]; + } - // remove cellXfs without references and create mapping so we can update xfIndex - // for all cells and columns - $countNeededCellXfs = 0; - foreach ($this->_cellXfCollection as $index => $cellXf) { - if ($countReferencesCellXf[$index] > 0 || $index == 0) { // we must never remove the first cellXf - ++$countNeededCellXfs; - } else { - unset($this->_cellXfCollection[$index]); - } - $map[$index] = $countNeededCellXfs - 1; - } - $this->_cellXfCollection = array_values($this->_cellXfCollection); + // from row dimensions + foreach ($sheet->getRowDimensions() as $rowDimension) { + if ($rowDimension->getXfIndex() !== null) { + ++$countReferencesCellXf[$rowDimension->getXfIndex()]; + } + } - // update the index for all cellXfs - foreach ($this->_cellXfCollection as $i => $cellXf) { - $cellXf->setIndex($i); - } + // from column dimensions + foreach ($sheet->getColumnDimensions() as $columnDimension) { + ++$countReferencesCellXf[$columnDimension->getXfIndex()]; + } + } - // make sure there is always at least one cellXf (there should be) - if (empty($this->_cellXfCollection)) { - $this->_cellXfCollection[] = new PHPExcel_Style(); - } + // remove cellXfs without references and create mapping so we can update xfIndex + // for all cells and columns + $countNeededCellXfs = 0; + foreach ($this->_cellXfCollection as $index => $cellXf) { + if ($countReferencesCellXf[$index] > 0 || $index == 0) { // we must never remove the first cellXf + ++$countNeededCellXfs; + } else { + unset($this->_cellXfCollection[$index]); + } + $map[$index] = $countNeededCellXfs - 1; + } + $this->_cellXfCollection = array_values($this->_cellXfCollection); - // update the xfIndex for all cells, row dimensions, column dimensions - foreach ($this->getWorksheetIterator() as $sheet) { + // update the index for all cellXfs + foreach ($this->_cellXfCollection as $i => $cellXf) { + $cellXf->setIndex($i); + } - // for all cells - foreach ($sheet->getCellCollection(false) as $cellID) { - $cell = $sheet->getCell($cellID); - $cell->setXfIndex( $map[$cell->getXfIndex()] ); - } + // make sure there is always at least one cellXf (there should be) + if (empty($this->_cellXfCollection)) { + $this->_cellXfCollection[] = new PHPExcel_Style(); + } - // for all row dimensions - foreach ($sheet->getRowDimensions() as $rowDimension) { - if ($rowDimension->getXfIndex() !== null) { - $rowDimension->setXfIndex( $map[$rowDimension->getXfIndex()] ); - } - } + // update the xfIndex for all cells, row dimensions, column dimensions + foreach ($this->getWorksheetIterator() as $sheet) { - // for all column dimensions - foreach ($sheet->getColumnDimensions() as $columnDimension) { - $columnDimension->setXfIndex( $map[$columnDimension->getXfIndex()] ); - } - } + // for all cells + foreach ($sheet->getCellCollection(false) as $cellID) { + $cell = $sheet->getCell($cellID); + $cell->setXfIndex( $map[$cell->getXfIndex()] ); + } - // also do garbage collection for all the sheets - foreach ($this->getWorksheetIterator() as $sheet) { - $sheet->garbageCollect(); - } - } + // for all row dimensions + foreach ($sheet->getRowDimensions() as $rowDimension) { + if ($rowDimension->getXfIndex() !== null) { + $rowDimension->setXfIndex( $map[$rowDimension->getXfIndex()] ); + } + } + + // for all column dimensions + foreach ($sheet->getColumnDimensions() as $columnDimension) { + $columnDimension->setXfIndex( $map[$columnDimension->getXfIndex()] ); + } + + // also do garbage collection for all the sheets + $sheet->garbageCollect(); + } + } + + /** + * Return the unique ID value assigned to this spreadsheet workbook + * + * @return string + */ + public function getID() { + return $this->_uniqueID; + } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Autoloader.php b/htdocs/includes/phpexcel/PHPExcel/Autoloader.php index 15193278b63..a36dfcc905e 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Autoloader.php +++ b/htdocs/includes/phpexcel/PHPExcel/Autoloader.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,18 +20,18 @@ * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ PHPExcel_Autoloader::Register(); -// As we always try to run the autoloader before anything else, we can use it to do a few -// simple checks and initialisations -PHPExcel_Shared_ZipStreamWrapper::register(); +// As we always try to run the autoloader before anything else, we can use it to do a few +// simple checks and initialisations +//PHPExcel_Shared_ZipStreamWrapper::register(); // check mbstring.func_overload if (ini_get('mbstring.func_overload') & 2) { - throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).'); + throw new PHPExcel_Exception('Multibyte function overloading in PHP must be disabled for string functions (2).'); } PHPExcel_Shared_String::buildCharacterSets(); @@ -39,47 +39,47 @@ PHPExcel_Shared_String::buildCharacterSets(); /** * PHPExcel_Autoloader * - * @category PHPExcel - * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @category PHPExcel + * @package PHPExcel + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Autoloader { - /** - * Register the Autoloader with SPL - * - */ - public static function Register() { - if (function_exists('__autoload')) { - // Register any existing autoloader function with SPL, so we don't get any clashes - spl_autoload_register('__autoload'); - } - // Register ourselves with SPL - return spl_autoload_register(array('PHPExcel_Autoloader', 'Load')); - } // function Register() + /** + * Register the Autoloader with SPL + * + */ + public static function Register() { + if (function_exists('__autoload')) { + // Register any existing autoloader function with SPL, so we don't get any clashes + spl_autoload_register('__autoload'); + } + // Register ourselves with SPL + return spl_autoload_register(array('PHPExcel_Autoloader', 'Load')); + } // function Register() - /** - * Autoload a class identified by name - * - * @param string $pClassName Name of the object to load - */ - public static function Load($pClassName){ - if ((class_exists($pClassName,FALSE)) || (strpos($pClassName, 'PHPExcel') !== 0)) { - // Either already loaded, or not a PHPExcel class request - return FALSE; - } + /** + * Autoload a class identified by name + * + * @param string $pClassName Name of the object to load + */ + public static function Load($pClassName){ + if ((class_exists($pClassName,FALSE)) || (strpos($pClassName, 'PHPExcel') !== 0)) { + // Either already loaded, or not a PHPExcel class request + return FALSE; + } - $pClassFilePath = PHPEXCEL_ROOT . - str_replace('_',DIRECTORY_SEPARATOR,$pClassName) . - '.php'; + $pClassFilePath = PHPEXCEL_ROOT . + str_replace('_',DIRECTORY_SEPARATOR,$pClassName) . + '.php'; - if ((file_exists($pClassFilePath) === false) || (is_readable($pClassFilePath) === false)) { - // Can't load - return FALSE; - } + if ((file_exists($pClassFilePath) === FALSE) || (is_readable($pClassFilePath) === FALSE)) { + // Can't load + return FALSE; + } - require($pClassFilePath); - } // function Load() + require($pClassFilePath); + } // function Load() -} \ No newline at end of file +} diff --git a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/APC.php b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/APC.php index 9dab5581480..0fbf8874c5e 100644 --- a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/APC.php +++ b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/APC.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.8.0, 2014-03-02 */ @@ -31,250 +31,265 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { - /** - * Prefix used to uniquely identify cache data for this worksheet - * - * @access private - * @var string - */ - private $_cachePrefix = null; + /** + * Prefix used to uniquely identify cache data for this worksheet + * + * @access private + * @var string + */ + private $_cachePrefix = null; - /** - * Cache timeout - * - * @access private - * @var integer - */ - private $_cacheTime = 600; + /** + * Cache timeout + * + * @access private + * @var integer + */ + private $_cacheTime = 600; /** * Store cell data in cache for the current cell object if it's "dirty", * and the 'nullify' the current cell object * - * @access private - * @return void - * @throws Exception + * @access private + * @return void + * @throws PHPExcel_Exception */ - private function _storeData() { - if ($this->_currentCellIsDirty) { - $this->_currentObject->detach(); + protected function _storeData() { + if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { + $this->_currentObject->detach(); - if (!apc_store($this->_cachePrefix.$this->_currentObjectID.'.cache',serialize($this->_currentObject),$this->_cacheTime)) { - $this->__destruct(); - throw new Exception('Failed to store cell '.$this->_currentObjectID.' in APC'); - } - $this->_currentCellIsDirty = false; - } - $this->_currentObjectID = $this->_currentObject = null; - } // function _storeData() + if (!apc_store($this->_cachePrefix.$this->_currentObjectID.'.cache',serialize($this->_currentObject),$this->_cacheTime)) { + $this->__destruct(); + throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in APC'); + } + $this->_currentCellIsDirty = false; + } + $this->_currentObjectID = $this->_currentObject = null; + } // function _storeData() /** * Add or Update a cell in cache identified by coordinate address * - * @access public - * @param string $pCoord Coordinate address of the cell to update - * @param PHPExcel_Cell $cell Cell to update - * @return void - * @throws Exception + * @access public + * @param string $pCoord Coordinate address of the cell to update + * @param PHPExcel_Cell $cell Cell to update + * @return void + * @throws PHPExcel_Exception */ - public function addCacheData($pCoord, PHPExcel_Cell $cell) { - if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { - $this->_storeData(); - } - $this->_cellCache[$pCoord] = true; + public function addCacheData($pCoord, PHPExcel_Cell $cell) { + if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { + $this->_storeData(); + } + $this->_cellCache[$pCoord] = true; - $this->_currentObjectID = $pCoord; - $this->_currentObject = $cell; - $this->_currentCellIsDirty = true; + $this->_currentObjectID = $pCoord; + $this->_currentObject = $cell; + $this->_currentCellIsDirty = true; - return $cell; - } // function addCacheData() + return $cell; + } // function addCacheData() - /** - * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? - * - * @access public - * @param string $pCoord Coordinate address of the cell to check - * @return void - * @return boolean - */ - public function isDataSet($pCoord) { - // Check if the requested entry is the current object, or exists in the cache - if (parent::isDataSet($pCoord)) { - if ($this->_currentObjectID == $pCoord) { - return true; - } - // Check if the requested entry still exists in apc - $success = apc_fetch($this->_cachePrefix.$pCoord.'.cache'); - if ($success === false) { - // Entry no longer exists in APC, so clear it from the cache array - parent::deleteCacheData($pCoord); - throw new Exception('Cell entry '.$pCoord.' no longer exists in APC'); - } - return true; - } - return false; - } // function isDataSet() + /** + * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? + * + * @access public + * @param string $pCoord Coordinate address of the cell to check + * @return void + * @return boolean + */ + public function isDataSet($pCoord) { + // Check if the requested entry is the current object, or exists in the cache + if (parent::isDataSet($pCoord)) { + if ($this->_currentObjectID == $pCoord) { + return true; + } + // Check if the requested entry still exists in apc + $success = apc_fetch($this->_cachePrefix.$pCoord.'.cache'); + if ($success === FALSE) { + // Entry no longer exists in APC, so clear it from the cache array + parent::deleteCacheData($pCoord); + throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache'); + } + return true; + } + return false; + } // function isDataSet() /** * Get cell at a specific coordinate * - * @access public - * @param string $pCoord Coordinate of the cell - * @throws Exception - * @return PHPExcel_Cell Cell that was found, or null if not found + * @access public + * @param string $pCoord Coordinate of the cell + * @throws PHPExcel_Exception + * @return PHPExcel_Cell Cell that was found, or null if not found */ - public function getCacheData($pCoord) { - if ($pCoord === $this->_currentObjectID) { - return $this->_currentObject; - } - $this->_storeData(); + public function getCacheData($pCoord) { + if ($pCoord === $this->_currentObjectID) { + return $this->_currentObject; + } + $this->_storeData(); - // Check if the entry that has been requested actually exists - if (parent::isDataSet($pCoord)) { - $obj = apc_fetch($this->_cachePrefix.$pCoord.'.cache'); - if ($obj === false) { - // Entry no longer exists in APC, so clear it from the cache array - parent::deleteCacheData($pCoord); - throw new Exception('Cell entry '.$pCoord.' no longer exists in APC'); - } - } else { - // Return null if requested entry doesn't exist in cache - return null; + // Check if the entry that has been requested actually exists + if (parent::isDataSet($pCoord)) { + $obj = apc_fetch($this->_cachePrefix.$pCoord.'.cache'); + if ($obj === FALSE) { + // Entry no longer exists in APC, so clear it from the cache array + parent::deleteCacheData($pCoord); + throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache'); + } + } else { + // Return null if requested entry doesn't exist in cache + return null; + } + + // Set current entry to the requested entry + $this->_currentObjectID = $pCoord; + $this->_currentObject = unserialize($obj); + // Re-attach this as the cell's parent + $this->_currentObject->attach($this); + + // Return requested entry + return $this->_currentObject; + } // function getCacheData() + + + /** + * Get a list of all cell addresses currently held in cache + * + * @return array of string + */ + public function getCellList() { + if ($this->_currentObjectID !== null) { + $this->_storeData(); } - // Set current entry to the requested entry - $this->_currentObjectID = $pCoord; - $this->_currentObject = unserialize($obj); - // Re-attach the parent worksheet - $this->_currentObject->attach($this->_parent); - - // Return requested entry - return $this->_currentObject; - } // function getCacheData() + return parent::getCellList(); + } /** * Delete a cell in cache identified by coordinate address * - * @access public - * @param string $pCoord Coordinate address of the cell to delete - * @throws Exception + * @access public + * @param string $pCoord Coordinate address of the cell to delete + * @throws PHPExcel_Exception */ - public function deleteCacheData($pCoord) { - // Delete the entry from APC - apc_delete($this->_cachePrefix.$pCoord.'.cache'); + public function deleteCacheData($pCoord) { + // Delete the entry from APC + apc_delete($this->_cachePrefix.$pCoord.'.cache'); - // Delete the entry from our cell address array - parent::deleteCacheData($pCoord); - } // function deleteCacheData() + // Delete the entry from our cell address array + parent::deleteCacheData($pCoord); + } // function deleteCacheData() - /** - * Clone the cell collection - * - * @access public - * @param PHPExcel_Worksheet $parent The new worksheet - * @return void - */ - public function copyCellCollection(PHPExcel_Worksheet $parent) { - parent::copyCellCollection($parent); - // Get a new id for the new file name - $baseUnique = $this->_getUniqueID(); - $newCachePrefix = substr(md5($baseUnique),0,8).'.'; - $cacheList = $this->getCellList(); - foreach($cacheList as $cellID) { - if ($cellID != $this->_currentObjectID) { - $obj = apc_fetch($this->_cachePrefix.$cellID.'.cache'); - if ($obj === false) { - // Entry no longer exists in APC, so clear it from the cache array - parent::deleteCacheData($cellID); - throw new Exception('Cell entry '.$cellID.' no longer exists in APC'); - } - if (!apc_store($newCachePrefix.$cellID.'.cache',$obj,$this->_cacheTime)) { - $this->__destruct(); - throw new Exception('Failed to store cell '.$cellID.' in APC'); - } - } - } - $this->_cachePrefix = $newCachePrefix; - } // function copyCellCollection() + /** + * Clone the cell collection + * + * @access public + * @param PHPExcel_Worksheet $parent The new worksheet + * @throws PHPExcel_Exception + * @return void + */ + public function copyCellCollection(PHPExcel_Worksheet $parent) { + parent::copyCellCollection($parent); + // Get a new id for the new file name + $baseUnique = $this->_getUniqueID(); + $newCachePrefix = substr(md5($baseUnique),0,8).'.'; + $cacheList = $this->getCellList(); + foreach($cacheList as $cellID) { + if ($cellID != $this->_currentObjectID) { + $obj = apc_fetch($this->_cachePrefix.$cellID.'.cache'); + if ($obj === FALSE) { + // Entry no longer exists in APC, so clear it from the cache array + parent::deleteCacheData($cellID); + throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in APC'); + } + if (!apc_store($newCachePrefix.$cellID.'.cache',$obj,$this->_cacheTime)) { + $this->__destruct(); + throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in APC'); + } + } + } + $this->_cachePrefix = $newCachePrefix; + } // function copyCellCollection() - /** - * Clear the cell collection and disconnect from our parent - * - * @return void - */ - public function unsetWorksheetCells() { - if ($this->_currentObject !== NULL) { - $this->_currentObject->detach(); - $this->_currentObject = $this->_currentObjectID = null; - } + /** + * Clear the cell collection and disconnect from our parent + * + * @return void + */ + public function unsetWorksheetCells() { + if ($this->_currentObject !== NULL) { + $this->_currentObject->detach(); + $this->_currentObject = $this->_currentObjectID = null; + } - // Flush the APC cache - $this->__destruct(); + // Flush the APC cache + $this->__destruct(); - $this->_cellCache = array(); + $this->_cellCache = array(); - // detach ourself from the worksheet, so that it can then delete this object successfully - $this->_parent = null; - } // function unsetWorksheetCells() + // detach ourself from the worksheet, so that it can then delete this object successfully + $this->_parent = null; + } // function unsetWorksheetCells() - /** - * Initialise this new cell collection - * - * @param PHPExcel_Worksheet $parent The worksheet for this cell collection - * @param array of mixed $arguments Additional initialisation arguments - */ - public function __construct(PHPExcel_Worksheet $parent, $arguments) { - $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600; + /** + * Initialise this new cell collection + * + * @param PHPExcel_Worksheet $parent The worksheet for this cell collection + * @param array of mixed $arguments Additional initialisation arguments + */ + public function __construct(PHPExcel_Worksheet $parent, $arguments) { + $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600; - if ($this->_cachePrefix === NULL) { - $baseUnique = $this->_getUniqueID(); - $this->_cachePrefix = substr(md5($baseUnique),0,8).'.'; - $this->_cacheTime = $cacheTime; + if ($this->_cachePrefix === NULL) { + $baseUnique = $this->_getUniqueID(); + $this->_cachePrefix = substr(md5($baseUnique),0,8).'.'; + $this->_cacheTime = $cacheTime; - parent::__construct($parent); - } - } // function __construct() + parent::__construct($parent); + } + } // function __construct() - /** - * Destroy this cell collection - */ - public function __destruct() { - $cacheList = $this->getCellList(); - foreach($cacheList as $cellID) { - apc_delete($this->_cachePrefix.$cellID.'.cache'); - } - } // function __destruct() + /** + * Destroy this cell collection + */ + public function __destruct() { + $cacheList = $this->getCellList(); + foreach($cacheList as $cellID) { + apc_delete($this->_cachePrefix.$cellID.'.cache'); + } + } // function __destruct() - /** - * Identify whether the caching method is currently available - * Some methods are dependent on the availability of certain extensions being enabled in the PHP build - * - * @return boolean - */ - public static function cacheMethodIsAvailable() { - if (!function_exists('apc_store')) { - return false; - } - if (apc_sma_info() === false) { - return false; - } + /** + * Identify whether the caching method is currently available + * Some methods are dependent on the availability of certain extensions being enabled in the PHP build + * + * @return boolean + */ + public static function cacheMethodIsAvailable() { + if (!function_exists('apc_store')) { + return FALSE; + } + if (apc_sma_info() === FALSE) { + return FALSE; + } - return true; - } + return TRUE; + } } diff --git a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/CacheBase.php b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/CacheBase.php index d2eea08bb97..84a0416c3b6 100644 --- a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/CacheBase.php +++ b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/CacheBase.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ abstract class PHPExcel_CachedObjectStorage_CacheBase { @@ -86,6 +86,16 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase { } // function __construct() + /** + * Return the parent worksheet for this cell collection + * + * @return PHPExcel_Worksheet + */ + public function getParent() + { + return $this->_parent; + } + /** * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? * @@ -101,12 +111,33 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase { } // function isDataSet() + /** + * Move a cell object from one address to another + * + * @param string $fromAddress Current address of the cell to move + * @param string $toAddress Destination address of the cell to move + * @return boolean + */ + public function moveCell($fromAddress, $toAddress) { + if ($fromAddress === $this->_currentObjectID) { + $this->_currentObjectID = $toAddress; + } + $this->_currentCellIsDirty = true; + if (isset($this->_cellCache[$fromAddress])) { + $this->_cellCache[$toAddress] = &$this->_cellCache[$fromAddress]; + unset($this->_cellCache[$fromAddress]); + } + + return TRUE; + } // function moveCell() + + /** * Add or Update a cell in cache * * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function updateCacheData(PHPExcel_Cell $cell) { return $this->addCacheData($cell->getCoordinate(),$cell); @@ -117,7 +148,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase { * Delete a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to delete - * @throws Exception + * @throws PHPExcel_Exception */ public function deleteCacheData($pCoord) { if ($pCoord === $this->_currentObjectID) { @@ -151,7 +182,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase { public function getSortedCellList() { $sortKeys = array(); foreach ($this->getCellList() as $coord) { - list($column,$row) = sscanf($coord,'%[A-Z]%d'); + sscanf($coord,'%[A-Z]%d', $column, $row); $sortKeys[sprintf('%09d%3s',$row,$column)] = $coord; } ksort($sortKeys); @@ -172,7 +203,7 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase { $col = array('A' => '1A'); $row = array(1); foreach ($this->getCellList() as $coord) { - list($c,$r) = sscanf($coord,'%[A-Z]%d'); + sscanf($coord,'%[A-Z]%d', $c, $r); $row[$r] = $r; $col[$c] = strlen($c).$c; } @@ -188,26 +219,87 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase { } + /** + * Return the cell address of the currently active cell object + * + * @return string + */ + public function getCurrentAddress() + { + return $this->_currentObjectID; + } + + /** + * Return the column address of the currently active cell object + * + * @return string + */ + public function getCurrentColumn() + { + sscanf($this->_currentObjectID, '%[A-Z]%d', $column, $row); + return $column; + } + + /** + * Return the row address of the currently active cell object + * + * @return string + */ + public function getCurrentRow() + { + sscanf($this->_currentObjectID, '%[A-Z]%d', $column, $row); + return $row; + } + /** * Get highest worksheet column * - * @return string Highest column name + * @param string $row Return the highest column for the specified row, + * or the highest column of any row if no row number is passed + * @return string Highest column name */ - public function getHighestColumn() + public function getHighestColumn($row = null) { - $colRow = $this->getHighestRowAndColumn(); - return $colRow['column']; - } + if ($row == null) { + $colRow = $this->getHighestRowAndColumn(); + return $colRow['column']; + } + + $columnList = array(1); + foreach ($this->getCellList() as $coord) { + sscanf($coord,'%[A-Z]%d', $c, $r); + if ($r != $row) { + continue; + } + $columnList[] = PHPExcel_Cell::columnIndexFromString($c); + } + return PHPExcel_Cell::stringFromColumnIndex(max($columnList) - 1); + } /** * Get highest worksheet row * - * @return int Highest row number + * @param string $column Return the highest row for the specified column, + * or the highest row of any column if no column letter is passed + * @return int Highest row number */ - public function getHighestRow() + public function getHighestRow($column = null) { - $colRow = $this->getHighestRowAndColumn(); - return $colRow['row']; + if ($column == null) { + $colRow = $this->getHighestRowAndColumn(); + return $colRow['row']; + } + + $rowList = array(0); + foreach ($this->getCellList() as $coord) { + sscanf($coord,'%[A-Z]%d', $c, $r); + if ($c != $column) { + continue; + } + $rowList[] = $r; + } + + return max($rowList); } @@ -232,9 +324,12 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase { * @return void */ public function copyCellCollection(PHPExcel_Worksheet $parent) { + $this->_currentCellIsDirty; + $this->_storeData(); + $this->_parent = $parent; if (($this->_currentObject !== NULL) && (is_object($this->_currentObject))) { - $this->_currentObject->attach($parent); + $this->_currentObject->attach($this); } } // function copyCellCollection() diff --git a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/DiscISAM.php b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/DiscISAM.php index 805dc063ace..492abea8526 100644 --- a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/DiscISAM.php +++ b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/DiscISAM.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { @@ -40,14 +40,14 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage * * @var string */ - private $_fileName = null; + private $_fileName = NULL; /** * File handle for this cache file * * @var resource */ - private $_fileHandle = null; + private $_fileHandle = NULL; /** * Directory/Folder where the cache file is located @@ -62,10 +62,10 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage * and the 'nullify' the current cell object * * @return void - * @throws Exception + * @throws PHPExcel_Exception */ - private function _storeData() { - if ($this->_currentCellIsDirty) { + protected function _storeData() { + if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { $this->_currentObject->detach(); fseek($this->_fileHandle,0,SEEK_END); @@ -86,7 +86,7 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { @@ -105,7 +105,7 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { @@ -124,14 +124,28 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage $this->_currentObjectID = $pCoord; fseek($this->_fileHandle,$this->_cellCache[$pCoord]['ptr']); $this->_currentObject = unserialize(fread($this->_fileHandle,$this->_cellCache[$pCoord]['sz'])); - // Re-attach the parent worksheet - $this->_currentObject->attach($this->_parent); + // Re-attach this as the cell's parent + $this->_currentObject->attach($this); // Return requested entry return $this->_currentObject; } // function getCacheData() + /** + * Get a list of all cell addresses currently held in cache + * + * @return array of string + */ + public function getCellList() { + if ($this->_currentObjectID !== null) { + $this->_storeData(); + } + + return parent::getCellList(); + } + + /** * Clone the cell collection * diff --git a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/ICache.php b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/ICache.php index 56f621a597b..c3f2c14d74b 100644 --- a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/ICache.php +++ b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/ICache.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ interface PHPExcel_CachedObjectStorage_ICache { @@ -41,7 +41,7 @@ interface PHPExcel_CachedObjectStorage_ICache * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell); @@ -50,7 +50,7 @@ interface PHPExcel_CachedObjectStorage_ICache * * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function updateCacheData(PHPExcel_Cell $cell); @@ -59,7 +59,7 @@ interface PHPExcel_CachedObjectStorage_ICache * * @param string $pCoord Coordinate address of the cell to retrieve * @return PHPExcel_Cell Cell that was found, or null if not found - * @throws Exception + * @throws PHPExcel_Exception */ public function getCacheData($pCoord); @@ -67,7 +67,7 @@ interface PHPExcel_CachedObjectStorage_ICache * Delete a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to delete - * @throws Exception + * @throws PHPExcel_Exception */ public function deleteCacheData($pCoord); diff --git a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/Igbinary.php b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/Igbinary.php index fc2f1129917..c3056de1fb6 100644 --- a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/Igbinary.php +++ b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/Igbinary.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { @@ -40,10 +40,10 @@ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage * and the 'nullify' the current cell object * * @return void - * @throws Exception + * @throws PHPExcel_Exception */ - private function _storeData() { - if ($this->_currentCellIsDirty) { + protected function _storeData() { + if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { $this->_currentObject->detach(); $this->_cellCache[$this->_currentObjectID] = igbinary_serialize($this->_currentObject); @@ -59,7 +59,7 @@ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { @@ -78,7 +78,7 @@ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { @@ -96,14 +96,28 @@ class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage // Set current entry to the requested entry $this->_currentObjectID = $pCoord; $this->_currentObject = igbinary_unserialize($this->_cellCache[$pCoord]); - // Re-attach the parent worksheet - $this->_currentObject->attach($this->_parent); + // Re-attach this as the cell's parent + $this->_currentObject->attach($this); // Return requested entry return $this->_currentObject; } // function getCacheData() + /** + * Get a list of all cell addresses currently held in cache + * + * @return array of string + */ + public function getCellList() { + if ($this->_currentObjectID !== null) { + $this->_storeData(); + } + + return parent::getCellList(); + } + + /** * Clear the cell collection and disconnect from our parent * diff --git a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/Memcache.php b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/Memcache.php index 23d6957281f..9061a31a1d1 100644 --- a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/Memcache.php +++ b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/Memcache.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { @@ -62,17 +62,17 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage * and the 'nullify' the current cell object * * @return void - * @throws Exception + * @throws PHPExcel_Exception */ - private function _storeData() { - if ($this->_currentCellIsDirty) { + protected function _storeData() { + if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { $this->_currentObject->detach(); $obj = serialize($this->_currentObject); if (!$this->_memcache->replace($this->_cachePrefix.$this->_currentObjectID.'.cache',$obj,NULL,$this->_cacheTime)) { if (!$this->_memcache->add($this->_cachePrefix.$this->_currentObjectID.'.cache',$obj,NULL,$this->_cacheTime)) { $this->__destruct(); - throw new Exception('Failed to store cell '.$this->_currentObjectID.' in MemCache'); + throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in MemCache'); } } $this->_currentCellIsDirty = false; @@ -87,7 +87,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { @@ -121,7 +121,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage if ($success === false) { // Entry no longer exists in Memcache, so clear it from the cache array parent::deleteCacheData($pCoord); - throw new Exception('Cell entry '.$pCoord.' no longer exists in MemCache'); + throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in MemCache'); } return true; } @@ -133,7 +133,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { @@ -148,7 +148,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage if ($obj === false) { // Entry no longer exists in Memcache, so clear it from the cache array parent::deleteCacheData($pCoord); - throw new Exception('Cell entry '.$pCoord.' no longer exists in MemCache'); + throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in MemCache'); } } else { // Return null if requested entry doesn't exist in cache @@ -158,19 +158,33 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage // Set current entry to the requested entry $this->_currentObjectID = $pCoord; $this->_currentObject = unserialize($obj); - // Re-attach the parent worksheet - $this->_currentObject->attach($this->_parent); + // Re-attach this as the cell's parent + $this->_currentObject->attach($this); // Return requested entry return $this->_currentObject; } // function getCacheData() + /** + * Get a list of all cell addresses currently held in cache + * + * @return array of string + */ + public function getCellList() { + if ($this->_currentObjectID !== null) { + $this->_storeData(); + } + + return parent::getCellList(); + } + + /** * Delete a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to delete - * @throws Exception + * @throws PHPExcel_Exception */ public function deleteCacheData($pCoord) { // Delete the entry from Memcache @@ -199,11 +213,11 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage if ($obj === false) { // Entry no longer exists in Memcache, so clear it from the cache array parent::deleteCacheData($cellID); - throw new Exception('Cell entry '.$cellID.' no longer exists in MemCache'); + throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in MemCache'); } if (!$this->_memcache->add($newCachePrefix.$cellID.'.cache',$obj,NULL,$this->_cacheTime)) { $this->__destruct(); - throw new Exception('Failed to store cell '.$cellID.' in MemCache'); + throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in MemCache'); } } } @@ -250,7 +264,7 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage // Set a new Memcache object and connect to the Memcache server $this->_memcache = new Memcache(); if (!$this->_memcache->addServer($memcacheServer, $memcachePort, false, 50, 5, 5, true, array($this, 'failureCallback'))) { - throw new Exception('Could not connect to MemCache server at '.$memcacheServer.':'.$memcachePort); + throw new PHPExcel_Exception('Could not connect to MemCache server at '.$memcacheServer.':'.$memcachePort); } $this->_cacheTime = $cacheTime; @@ -264,10 +278,10 @@ class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage * * @param string $host Memcache server * @param integer $port Memcache port - * @throws Exception + * @throws PHPExcel_Exception */ public function failureCallback($host, $port) { - throw new Exception('memcache '.$host.':'.$port.' failed'); + throw new PHPExcel_Exception('memcache '.$host.':'.$port.' failed'); } diff --git a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/Memory.php b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/Memory.php index 36f42fb6ccf..20cd59f64a3 100644 --- a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/Memory.php +++ b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/Memory.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,20 +31,32 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { + /** + * Dummy method callable from CacheBase, but unused by Memory cache + * + * @return void + */ + protected function _storeData() { + } // function _storeData() + /** * Add or Update a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update - * @return void - * @throws Exception + * @return PHPExcel_Cell + * @throws PHPExcel_Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell) { $this->_cellCache[$pCoord] = $cell; + + // Set current entry to the new/updated entry + $this->_currentObjectID = $pCoord; + return $cell; } // function addCacheData() @@ -53,16 +65,20 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { // Check if the entry that has been requested actually exists if (!isset($this->_cellCache[$pCoord])) { + $this->_currentObjectID = NULL; // Return null if requested entry doesn't exist in cache return null; } + // Set current entry to the requested entry + $this->_currentObjectID = $pCoord; + // Return requested entry return $this->_cellCache[$pCoord]; } // function getCacheData() @@ -80,7 +96,7 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C $newCollection = array(); foreach($this->_cellCache as $k => &$cell) { $newCollection[$k] = clone $cell; - $newCollection[$k]->attach($parent); + $newCollection[$k]->attach($this); } $this->_cellCache = $newCollection; diff --git a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/MemoryGZip.php b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/MemoryGZip.php index ee8e95eb2b5..692c1bfcb6a 100644 --- a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/MemoryGZip.php +++ b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/MemoryGZip.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { @@ -40,10 +40,10 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora * and the 'nullify' the current cell object * * @return void - * @throws Exception + * @throws PHPExcel_Exception */ - private function _storeData() { - if ($this->_currentCellIsDirty) { + protected function _storeData() { + if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { $this->_currentObject->detach(); $this->_cellCache[$this->_currentObjectID] = gzdeflate(serialize($this->_currentObject)); @@ -59,7 +59,7 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { @@ -78,7 +78,7 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { @@ -96,14 +96,28 @@ class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStora // Set current entry to the requested entry $this->_currentObjectID = $pCoord; $this->_currentObject = unserialize(gzinflate($this->_cellCache[$pCoord])); - // Re-attach the parent worksheet - $this->_currentObject->attach($this->_parent); + // Re-attach this as the cell's parent + $this->_currentObject->attach($this); // Return requested entry return $this->_currentObject; } // function getCacheData() + /** + * Get a list of all cell addresses currently held in cache + * + * @return array of string + */ + public function getCellList() { + if ($this->_currentObjectID !== null) { + $this->_storeData(); + } + + return parent::getCellList(); + } + + /** * Clear the cell collection and disconnect from our parent * diff --git a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/MemorySerialized.php b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/MemorySerialized.php index d6b09b530e8..fdd021a8dd2 100644 --- a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/MemorySerialized.php +++ b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/MemorySerialized.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { @@ -40,10 +40,10 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec * and the 'nullify' the current cell object * * @return void - * @throws Exception + * @throws PHPExcel_Exception */ - private function _storeData() { - if ($this->_currentCellIsDirty) { + protected function _storeData() { + if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { $this->_currentObject->detach(); $this->_cellCache[$this->_currentObjectID] = serialize($this->_currentObject); @@ -59,7 +59,7 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { @@ -78,7 +78,7 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { @@ -96,14 +96,28 @@ class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjec // Set current entry to the requested entry $this->_currentObjectID = $pCoord; $this->_currentObject = unserialize($this->_cellCache[$pCoord]); - // Re-attach the parent worksheet - $this->_currentObject->attach($this->_parent); + // Re-attach this as the cell's parent + $this->_currentObject->attach($this); // Return requested entry return $this->_currentObject; } // function getCacheData() + /** + * Get a list of all cell addresses currently held in cache + * + * @return array of string + */ + public function getCellList() { + if ($this->_currentObjectID !== null) { + $this->_storeData(); + } + + return parent::getCellList(); + } + + /** * Clear the cell collection and disconnect from our parent * diff --git a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/PHPTemp.php b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/PHPTemp.php index 8dbbe92e8c2..b00c19bbb4a 100644 --- a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/PHPTemp.php +++ b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/PHPTemp.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { @@ -54,10 +54,10 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_ * and the 'nullify' the current cell object * * @return void - * @throws Exception + * @throws PHPExcel_Exception */ - private function _storeData() { - if ($this->_currentCellIsDirty) { + protected function _storeData() { + if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { $this->_currentObject->detach(); fseek($this->_fileHandle,0,SEEK_END); @@ -78,7 +78,7 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_ * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { @@ -97,7 +97,7 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_ * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { @@ -116,14 +116,28 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_ $this->_currentObjectID = $pCoord; fseek($this->_fileHandle,$this->_cellCache[$pCoord]['ptr']); $this->_currentObject = unserialize(fread($this->_fileHandle,$this->_cellCache[$pCoord]['sz'])); - // Re-attach the parent worksheet - $this->_currentObject->attach($this->_parent); + // Re-attach this as the cell's parent + $this->_currentObject->attach($this); // Return requested entry return $this->_currentObject; } // function getCacheData() + /** + * Get a list of all cell addresses currently held in cache + * + * @return array of string + */ + public function getCellList() { + if ($this->_currentObjectID !== null) { + $this->_storeData(); + } + + return parent::getCellList(); + } + + /** * Clone the cell collection * diff --git a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/SQLite.php b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/SQLite.php index e4bf469e0fc..75b99c68a66 100644 --- a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/SQLite.php +++ b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/SQLite.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { @@ -54,14 +54,14 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C * and the 'nullify' the current cell object * * @return void - * @throws Exception + * @throws PHPExcel_Exception */ - private function _storeData() { - if ($this->_currentCellIsDirty) { + protected function _storeData() { + if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { $this->_currentObject->detach(); if (!$this->_DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES('".$this->_currentObjectID."','".sqlite_escape_string(serialize($this->_currentObject))."')")) - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); $this->_currentCellIsDirty = false; } $this->_currentObjectID = $this->_currentObject = null; @@ -74,7 +74,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { @@ -93,7 +93,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { @@ -105,7 +105,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C $query = "SELECT value FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; $cellResultSet = $this->_DBHandle->query($query,SQLITE_ASSOC); if ($cellResultSet === false) { - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); } elseif ($cellResultSet->numRows() == 0) { // Return null if requested entry doesn't exist in cache return null; @@ -116,8 +116,8 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C $cellResult = $cellResultSet->fetchSingle(); $this->_currentObject = unserialize($cellResult); - // Re-attach the parent worksheet - $this->_currentObject->attach($this->_parent); + // Re-attach this as the cell's parent + $this->_currentObject->attach($this); // Return requested entry return $this->_currentObject; @@ -139,7 +139,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C $query = "SELECT id FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; $cellResultSet = $this->_DBHandle->query($query,SQLITE_ASSOC); if ($cellResultSet === false) { - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); } elseif ($cellResultSet->numRows() == 0) { // Return null if requested entry doesn't exist in cache return false; @@ -152,7 +152,7 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C * Delete a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to delete - * @throws Exception + * @throws PHPExcel_Exception */ public function deleteCacheData($pCoord) { if ($pCoord === $this->_currentObjectID) { @@ -163,22 +163,52 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C // Check if the requested entry exists in the cache $query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; if (!$this->_DBHandle->queryExec($query)) - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); $this->_currentCellIsDirty = false; } // function deleteCacheData() + /** + * Move a cell object from one address to another + * + * @param string $fromAddress Current address of the cell to move + * @param string $toAddress Destination address of the cell to move + * @return boolean + */ + public function moveCell($fromAddress, $toAddress) { + if ($fromAddress === $this->_currentObjectID) { + $this->_currentObjectID = $toAddress; + } + + $query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$toAddress."'"; + $result = $this->_DBHandle->exec($query); + if ($result === false) + throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); + + $query = "UPDATE kvp_".$this->_TableName." SET id='".$toAddress."' WHERE id='".$fromAddress."'"; + $result = $this->_DBHandle->exec($query); + if ($result === false) + throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); + + return TRUE; + } // function moveCell() + + /** * Get a list of all cell addresses currently held in cache * * @return array of string */ public function getCellList() { + if ($this->_currentObjectID !== null) { + $this->_storeData(); + } + $query = "SELECT id FROM kvp_".$this->_TableName; $cellIdsResult = $this->_DBHandle->unbufferedQuery($query,SQLITE_ASSOC); if ($cellIdsResult === false) - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); $cellKeys = array(); foreach($cellIdsResult as $row) { @@ -196,11 +226,14 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C * @return void */ public function copyCellCollection(PHPExcel_Worksheet $parent) { + $this->_currentCellIsDirty; + $this->_storeData(); + // Get a new id for the new table name $tableName = str_replace('.','_',$this->_getUniqueID()); if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) AS SELECT * FROM kvp_'.$this->_TableName)) - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); // Copy the existing cell cache file $this->_TableName = $tableName; @@ -238,9 +271,9 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C $this->_DBHandle = new SQLiteDatabase($_DBName); if ($this->_DBHandle === false) - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); + throw new PHPExcel_Exception(sqlite_error_string($this->_DBHandle->lastError())); } } // function __construct() @@ -249,6 +282,9 @@ class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_C * Destroy this cell collection */ public function __destruct() { + if (!is_null($this->_DBHandle)) { + $this->_DBHandle->queryExec('DROP TABLE kvp_'.$this->_TableName); + } $this->_DBHandle = null; } // function __destruct() diff --git a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/SQLite3.php b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/SQLite3.php index ead6e91f87f..bcfe159bda9 100644 --- a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/SQLite3.php +++ b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/SQLite3.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { @@ -49,23 +49,50 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ */ private $_DBHandle = null; + /** + * Prepared statement for a SQLite3 select query + * + * @var SQLite3Stmt + */ + private $_selectQuery; + + /** + * Prepared statement for a SQLite3 insert query + * + * @var SQLite3Stmt + */ + private $_insertQuery; + + /** + * Prepared statement for a SQLite3 update query + * + * @var SQLite3Stmt + */ + private $_updateQuery; + + /** + * Prepared statement for a SQLite3 delete query + * + * @var SQLite3Stmt + */ + private $_deleteQuery; + /** * Store cell data in cache for the current cell object if it's "dirty", * and the 'nullify' the current cell object * * @return void - * @throws Exception + * @throws PHPExcel_Exception */ - private function _storeData() { - if ($this->_currentCellIsDirty) { + protected function _storeData() { + if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { $this->_currentObject->detach(); - $query = $this->_DBHandle->prepare("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES(:id,:data)"); - $query->bindValue('id',$this->_currentObjectID,SQLITE3_TEXT); - $query->bindValue('data',serialize($this->_currentObject),SQLITE3_BLOB); - $result = $query->execute(); + $this->_insertQuery->bindValue('id',$this->_currentObjectID,SQLITE3_TEXT); + $this->_insertQuery->bindValue('data',serialize($this->_currentObject),SQLITE3_BLOB); + $result = $this->_insertQuery->execute(); if ($result === false) - throw new Exception($this->_DBHandle->lastErrorMsg()); + throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); $this->_currentCellIsDirty = false; } $this->_currentObjectID = $this->_currentObject = null; @@ -78,7 +105,7 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { @@ -97,7 +124,7 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { @@ -106,21 +133,23 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ } $this->_storeData(); - $query = "SELECT value FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; - $cellResult = $this->_DBHandle->querySingle($query); - if ($cellResult === false) { - throw new Exception($this->_DBHandle->lastErrorMsg()); - } elseif (is_null($cellResult)) { + $this->_selectQuery->bindValue('id',$pCoord,SQLITE3_TEXT); + $cellResult = $this->_selectQuery->execute(); + if ($cellResult === FALSE) { + throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); + } + $cellData = $cellResult->fetchArray(SQLITE3_ASSOC); + if ($cellData === FALSE) { // Return null if requested entry doesn't exist in cache - return null; + return NULL; } // Set current entry to the requested entry $this->_currentObjectID = $pCoord; - $this->_currentObject = unserialize($cellResult); - // Re-attach the parent worksheet - $this->_currentObject->attach($this->_parent); + $this->_currentObject = unserialize($cellData['value']); + // Re-attach this as the cell's parent + $this->_currentObject->attach($this); // Return requested entry return $this->_currentObject; @@ -135,19 +164,18 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ */ public function isDataSet($pCoord) { if ($pCoord === $this->_currentObjectID) { - return true; + return TRUE; } // Check if the requested entry exists in the cache - $query = "SELECT id FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; - $cellResult = $this->_DBHandle->querySingle($query); - if ($cellResult === false) { - throw new Exception($this->_DBHandle->lastErrorMsg()); - } elseif (is_null($cellResult)) { - // Return null if requested entry doesn't exist in cache - return false; + $this->_selectQuery->bindValue('id',$pCoord,SQLITE3_TEXT); + $cellResult = $this->_selectQuery->execute(); + if ($cellResult === FALSE) { + throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); } - return true; + $cellData = $cellResult->fetchArray(SQLITE3_ASSOC); + + return ($cellData === FALSE) ? FALSE : TRUE; } // function isDataSet() @@ -155,34 +183,65 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ * Delete a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to delete - * @throws Exception + * @throws PHPExcel_Exception */ public function deleteCacheData($pCoord) { if ($pCoord === $this->_currentObjectID) { $this->_currentObject->detach(); - $this->_currentObjectID = $this->_currentObject = null; + $this->_currentObjectID = $this->_currentObject = NULL; } // Check if the requested entry exists in the cache - $query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; - $result = $this->_DBHandle->exec($query); - if ($result === false) - throw new Exception($this->_DBHandle->lastErrorMsg()); + $this->_deleteQuery->bindValue('id',$pCoord,SQLITE3_TEXT); + $result = $this->_deleteQuery->execute(); + if ($result === FALSE) + throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); - $this->_currentCellIsDirty = false; + $this->_currentCellIsDirty = FALSE; } // function deleteCacheData() + /** + * Move a cell object from one address to another + * + * @param string $fromAddress Current address of the cell to move + * @param string $toAddress Destination address of the cell to move + * @return boolean + */ + public function moveCell($fromAddress, $toAddress) { + if ($fromAddress === $this->_currentObjectID) { + $this->_currentObjectID = $toAddress; + } + + $this->_deleteQuery->bindValue('id',$toAddress,SQLITE3_TEXT); + $result = $this->_deleteQuery->execute(); + if ($result === false) + throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); + + $this->_updateQuery->bindValue('toid',$toAddress,SQLITE3_TEXT); + $this->_updateQuery->bindValue('fromid',$fromAddress,SQLITE3_TEXT); + $result = $this->_updateQuery->execute(); + if ($result === false) + throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); + + return TRUE; + } // function moveCell() + + /** * Get a list of all cell addresses currently held in cache * * @return array of string */ public function getCellList() { + if ($this->_currentObjectID !== null) { + $this->_storeData(); + } + $query = "SELECT id FROM kvp_".$this->_TableName; $cellIdsResult = $this->_DBHandle->query($query); if ($cellIdsResult === false) - throw new Exception($this->_DBHandle->lastErrorMsg()); + throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); $cellKeys = array(); while ($row = $cellIdsResult->fetchArray(SQLITE3_ASSOC)) { @@ -200,11 +259,14 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ * @return void */ public function copyCellCollection(PHPExcel_Worksheet $parent) { + $this->_currentCellIsDirty; + $this->_storeData(); + // Get a new id for the new table name $tableName = str_replace('.','_',$this->_getUniqueID()); if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) AS SELECT * FROM kvp_'.$this->_TableName)) - throw new Exception($this->_DBHandle->lastErrorMsg()); + throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); // Copy the existing cell cache file $this->_TableName = $tableName; @@ -242,10 +304,15 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ $this->_DBHandle = new SQLite3($_DBName); if ($this->_DBHandle === false) - throw new Exception($this->_DBHandle->lastErrorMsg()); + throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) - throw new Exception($this->_DBHandle->lastErrorMsg()); + throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg()); } + + $this->_selectQuery = $this->_DBHandle->prepare("SELECT value FROM kvp_".$this->_TableName." WHERE id = :id"); + $this->_insertQuery = $this->_DBHandle->prepare("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES(:id,:data)"); + $this->_updateQuery = $this->_DBHandle->prepare("UPDATE kvp_".$this->_TableName." SET id=:toId WHERE id=:fromId"); + $this->_deleteQuery = $this->_DBHandle->prepare("DELETE FROM kvp_".$this->_TableName." WHERE id = :id"); } // function __construct() @@ -254,6 +321,7 @@ class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_ */ public function __destruct() { if (!is_null($this->_DBHandle)) { + $this->_DBHandle->exec('DROP TABLE kvp_'.$this->_TableName); $this->_DBHandle->close(); } $this->_DBHandle = null; diff --git a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/Wincache.php b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/Wincache.php index ba8b0458062..96dca6627fb 100644 --- a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/Wincache.php +++ b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorage/Wincache.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { @@ -55,22 +55,22 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage * and the 'nullify' the current cell object * * @return void - * @throws Exception + * @throws PHPExcel_Exception */ - private function _storeData() { - if ($this->_currentCellIsDirty) { + protected function _storeData() { + if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) { $this->_currentObject->detach(); $obj = serialize($this->_currentObject); if (wincache_ucache_exists($this->_cachePrefix.$this->_currentObjectID.'.cache')) { if (!wincache_ucache_set($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) { $this->__destruct(); - throw new Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache'); + throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache'); } } else { if (!wincache_ucache_add($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) { $this->__destruct(); - throw new Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache'); + throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache'); } } $this->_currentCellIsDirty = false; @@ -86,7 +86,7 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage * @param string $pCoord Coordinate address of the cell to update * @param PHPExcel_Cell $cell Cell to update * @return void - * @throws Exception + * @throws PHPExcel_Exception */ public function addCacheData($pCoord, PHPExcel_Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { @@ -119,7 +119,7 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage if ($success === false) { // Entry no longer exists in Wincache, so clear it from the cache array parent::deleteCacheData($pCoord); - throw new Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); + throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); } return true; } @@ -131,7 +131,7 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage * Get cell at a specific coordinate * * @param string $pCoord Coordinate of the cell - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Cell Cell that was found, or null if not found */ public function getCacheData($pCoord) { @@ -148,7 +148,7 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage if ($success === false) { // Entry no longer exists in WinCache, so clear it from the cache array parent::deleteCacheData($pCoord); - throw new Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); + throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); } } else { // Return null if requested entry doesn't exist in cache @@ -158,19 +158,33 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage // Set current entry to the requested entry $this->_currentObjectID = $pCoord; $this->_currentObject = unserialize($obj); - // Re-attach the parent worksheet - $this->_currentObject->attach($this->_parent); + // Re-attach this as the cell's parent + $this->_currentObject->attach($this); // Return requested entry return $this->_currentObject; } // function getCacheData() + /** + * Get a list of all cell addresses currently held in cache + * + * @return array of string + */ + public function getCellList() { + if ($this->_currentObjectID !== null) { + $this->_storeData(); + } + + return parent::getCellList(); + } + + /** * Delete a cell in cache identified by coordinate address * * @param string $pCoord Coordinate address of the cell to delete - * @throws Exception + * @throws PHPExcel_Exception */ public function deleteCacheData($pCoord) { // Delete the entry from Wincache @@ -200,11 +214,11 @@ class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage if ($success === false) { // Entry no longer exists in WinCache, so clear it from the cache array parent::deleteCacheData($cellID); - throw new Exception('Cell entry '.$cellID.' no longer exists in Wincache'); + throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in Wincache'); } if (!wincache_ucache_add($newCachePrefix.$cellID.'.cache', $obj, $this->_cacheTime)) { $this->__destruct(); - throw new Exception('Failed to store cell '.$cellID.' in Wincache'); + throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in Wincache'); } } } diff --git a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorageFactory.php b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorageFactory.php index 51019f7bdc5..6c3ec15cf2f 100644 --- a/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorageFactory.php +++ b/htdocs/includes/phpexcel/PHPExcel/CachedObjectStorageFactory.php @@ -3,7 +3,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,220 +20,232 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @package PHPExcel_CachedObjectStorage + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.8.0, 2014-03-02 */ /** * PHPExcel_CachedObjectStorageFactory * - * @category PHPExcel - * @package PHPExcel_CachedObjectStorage - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @category PHPExcel + * @package PHPExcel_CachedObjectStorage + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_CachedObjectStorageFactory { - const cache_in_memory = 'Memory'; - const cache_in_memory_gzip = 'MemoryGZip'; - const cache_in_memory_serialized = 'MemorySerialized'; - const cache_igbinary = 'Igbinary'; - const cache_to_discISAM = 'DiscISAM'; - const cache_to_apc = 'APC'; - const cache_to_memcache = 'Memcache'; - const cache_to_phpTemp = 'PHPTemp'; - const cache_to_wincache = 'Wincache'; - const cache_to_sqlite = 'SQLite'; - const cache_to_sqlite3 = 'SQLite3'; + const cache_in_memory = 'Memory'; + const cache_in_memory_gzip = 'MemoryGZip'; + const cache_in_memory_serialized = 'MemorySerialized'; + const cache_igbinary = 'Igbinary'; + const cache_to_discISAM = 'DiscISAM'; + const cache_to_apc = 'APC'; + const cache_to_memcache = 'Memcache'; + const cache_to_phpTemp = 'PHPTemp'; + const cache_to_wincache = 'Wincache'; + const cache_to_sqlite = 'SQLite'; + const cache_to_sqlite3 = 'SQLite3'; - /** - * Name of the method used for cell cacheing - * - * @var string - */ - private static $_cacheStorageMethod = NULL; + /** + * Name of the method used for cell cacheing + * + * @var string + */ + private static $_cacheStorageMethod = NULL; - /** - * Name of the class used for cell cacheing - * - * @var string - */ - private static $_cacheStorageClass = NULL; + /** + * Name of the class used for cell cacheing + * + * @var string + */ + private static $_cacheStorageClass = NULL; - /** - * List of all possible cache storage methods - * - * @var string[] - */ - private static $_storageMethods = array( - self::cache_in_memory, - self::cache_in_memory_gzip, - self::cache_in_memory_serialized, - self::cache_igbinary, - self::cache_to_phpTemp, - self::cache_to_discISAM, - self::cache_to_apc, - self::cache_to_memcache, - self::cache_to_wincache, - self::cache_to_sqlite, - self::cache_to_sqlite3, - ); + /** + * List of all possible cache storage methods + * + * @var string[] + */ + private static $_storageMethods = array( + self::cache_in_memory, + self::cache_in_memory_gzip, + self::cache_in_memory_serialized, + self::cache_igbinary, + self::cache_to_phpTemp, + self::cache_to_discISAM, + self::cache_to_apc, + self::cache_to_memcache, + self::cache_to_wincache, + self::cache_to_sqlite, + self::cache_to_sqlite3, + ); - /** - * Default arguments for each cache storage method - * - * @var array of mixed array - */ - private static $_storageMethodDefaultParameters = array( - self::cache_in_memory => array( - ), - self::cache_in_memory_gzip => array( - ), - self::cache_in_memory_serialized => array( - ), - self::cache_igbinary => array( - ), - self::cache_to_phpTemp => array( 'memoryCacheSize' => '1MB' - ), - self::cache_to_discISAM => array( 'dir' => NULL - ), - self::cache_to_apc => array( 'cacheTime' => 600 - ), - self::cache_to_memcache => array( 'memcacheServer' => 'localhost', - 'memcachePort' => 11211, - 'cacheTime' => 600 - ), - self::cache_to_wincache => array( 'cacheTime' => 600 - ), - self::cache_to_sqlite => array( - ), - self::cache_to_sqlite3 => array( - ), - ); + /** + * Default arguments for each cache storage method + * + * @var array of mixed array + */ + private static $_storageMethodDefaultParameters = array( + self::cache_in_memory => array( + ), + self::cache_in_memory_gzip => array( + ), + self::cache_in_memory_serialized => array( + ), + self::cache_igbinary => array( + ), + self::cache_to_phpTemp => array( 'memoryCacheSize' => '1MB' + ), + self::cache_to_discISAM => array( 'dir' => NULL + ), + self::cache_to_apc => array( 'cacheTime' => 600 + ), + self::cache_to_memcache => array( 'memcacheServer' => 'localhost', + 'memcachePort' => 11211, + 'cacheTime' => 600 + ), + self::cache_to_wincache => array( 'cacheTime' => 600 + ), + self::cache_to_sqlite => array( + ), + self::cache_to_sqlite3 => array( + ), + ); - /** - * Arguments for the active cache storage method - * - * @var array of mixed array - */ - private static $_storageMethodParameters = array(); + /** + * Arguments for the active cache storage method + * + * @var array of mixed array + */ + private static $_storageMethodParameters = array(); - /** - * Return the current cache storage method - * - * @return string|NULL - **/ - public static function getCacheStorageMethod() + /** + * Return the current cache storage method + * + * @return string|NULL + **/ + public static function getCacheStorageMethod() + { + return self::$_cacheStorageMethod; + } // function getCacheStorageMethod() + + + /** + * Return the current cache storage class + * + * @return PHPExcel_CachedObjectStorage_ICache|NULL + **/ + public static function getCacheStorageClass() + { + return self::$_cacheStorageClass; + } // function getCacheStorageClass() + + + /** + * Return the list of all possible cache storage methods + * + * @return string[] + **/ + public static function getAllCacheStorageMethods() + { + return self::$_storageMethods; + } // function getCacheStorageMethods() + + + /** + * Return the list of all available cache storage methods + * + * @return string[] + **/ + public static function getCacheStorageMethods() + { + $activeMethods = array(); + foreach(self::$_storageMethods as $storageMethod) { + $cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $storageMethod; + if (call_user_func(array($cacheStorageClass, 'cacheMethodIsAvailable'))) { + $activeMethods[] = $storageMethod; + } + } + return $activeMethods; + } // function getCacheStorageMethods() + + + /** + * Identify the cache storage method to use + * + * @param string $method Name of the method to use for cell cacheing + * @param array of mixed $arguments Additional arguments to pass to the cell caching class + * when instantiating + * @return boolean + **/ + public static function initialize($method = self::cache_in_memory, $arguments = array()) + { + if (!in_array($method,self::$_storageMethods)) { + return FALSE; + } + + $cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method; + if (!call_user_func(array( $cacheStorageClass, + 'cacheMethodIsAvailable'))) { + return FALSE; + } + + self::$_storageMethodParameters[$method] = self::$_storageMethodDefaultParameters[$method]; + foreach($arguments as $k => $v) { + if (array_key_exists($k, self::$_storageMethodParameters[$method])) { + self::$_storageMethodParameters[$method][$k] = $v; + } + } + + if (self::$_cacheStorageMethod === NULL) { + self::$_cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $method; + self::$_cacheStorageMethod = $method; + } + return TRUE; + } // function initialize() + + + /** + * Initialise the cache storage + * + * @param PHPExcel_Worksheet $parent Enable cell caching for this worksheet + * @return PHPExcel_CachedObjectStorage_ICache + **/ + public static function getInstance(PHPExcel_Worksheet $parent) + { + $cacheMethodIsAvailable = TRUE; + if (self::$_cacheStorageMethod === NULL) { + $cacheMethodIsAvailable = self::initialize(); + } + + if ($cacheMethodIsAvailable) { + $instance = new self::$_cacheStorageClass( $parent, + self::$_storageMethodParameters[self::$_cacheStorageMethod] + ); + if ($instance !== NULL) { + return $instance; + } + } + + return FALSE; + } // function getInstance() + + + /** + * Clear the cache storage + * + **/ + public static function finalize() { - return self::$_cacheStorageMethod; - } // function getCacheStorageMethod() + self::$_cacheStorageMethod = NULL; + self::$_cacheStorageClass = NULL; + self::$_storageMethodParameters = array(); + } - - /** - * Return the current cache storage class - * - * @return PHPExcel_CachedObjectStorage_ICache|NULL - **/ - public static function getCacheStorageClass() - { - return self::$_cacheStorageClass; - } // function getCacheStorageClass() - - - /** - * Return the list of all possible cache storage methods - * - * @return string[] - **/ - public static function getAllCacheStorageMethods() - { - return self::$_storageMethods; - } // function getCacheStorageMethods() - - - /** - * Return the list of all available cache storage methods - * - * @return string[] - **/ - public static function getCacheStorageMethods() - { - $activeMethods = array(); - foreach(self::$_storageMethods as $storageMethod) { - $cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $storageMethod; - if (call_user_func(array($cacheStorageClass, 'cacheMethodIsAvailable'))) { - $activeMethods[] = $storageMethod; - } - } - return $activeMethods; - } // function getCacheStorageMethods() - - - /** - * Identify the cache storage method to use - * - * @param string $method Name of the method to use for cell cacheing - * @param array of mixed $arguments Additional arguments to pass to the cell caching class - * when instantiating - * @return boolean - **/ - public static function initialize($method = self::cache_in_memory, $arguments = array()) - { - if (!in_array($method,self::$_storageMethods)) { - return FALSE; - } - - $cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method; - if (!call_user_func(array( $cacheStorageClass, - 'cacheMethodIsAvailable'))) { - return FALSE; - } - - self::$_storageMethodParameters[$method] = self::$_storageMethodDefaultParameters[$method]; - foreach($arguments as $k => $v) { - if (isset(self::$_storageMethodParameters[$method][$k])) { - self::$_storageMethodParameters[$method][$k] = $v; - } - } - - if (self::$_cacheStorageMethod === NULL) { - self::$_cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $method; - self::$_cacheStorageMethod = $method; - } - return TRUE; - } // function initialize() - - - /** - * Initialise the cache storage - * - * @param PHPExcel_Worksheet $parent Enable cell caching for this worksheet - * @return PHPExcel_CachedObjectStorage_ICache - **/ - public static function getInstance(PHPExcel_Worksheet $parent) - { - $cacheMethodIsAvailable = TRUE; - if (self::$_cacheStorageMethod === NULL) { - $cacheMethodIsAvailable = self::initialize(); - } - - if ($cacheMethodIsAvailable) { - $instance = new self::$_cacheStorageClass( $parent, - self::$_storageMethodParameters[self::$_cacheStorageMethod] - ); - if ($instance !== NULL) { - return $instance; - } - } - - return FALSE; - } // function getInstance() - -} \ No newline at end of file +} diff --git a/htdocs/includes/phpexcel/PHPExcel/CalcEngine/CyclicReferenceStack.php b/htdocs/includes/phpexcel/PHPExcel/CalcEngine/CyclicReferenceStack.php new file mode 100644 index 00000000000..02591935a4b --- /dev/null +++ b/htdocs/includes/phpexcel/PHPExcel/CalcEngine/CyclicReferenceStack.php @@ -0,0 +1,98 @@ +_stack); + } + + /** + * Push a new entry onto the stack + * + * @param mixed $value + */ + public function push($value) { + $this->_stack[] = $value; + } // function push() + + /** + * Pop the last entry from the stack + * + * @return mixed + */ + public function pop() { + return array_pop($this->_stack); + } // function pop() + + /** + * Test to see if a specified entry exists on the stack + * + * @param mixed $value The value to test + */ + public function onStack($value) { + return in_array($value, $this->_stack); + } + + /** + * Clear the stack + */ + public function clear() { + $this->_stack = array(); + } // function push() + + /** + * Return an array of all entries on the stack + * + * @return mixed[] + */ + public function showStack() { + return $this->_stack; + } + +} // class PHPExcel_CalcEngine_CyclicReferenceStack diff --git a/htdocs/includes/phpexcel/PHPExcel/CalcEngine/Logger.php b/htdocs/includes/phpexcel/PHPExcel/CalcEngine/Logger.php new file mode 100644 index 00000000000..2048df3e515 --- /dev/null +++ b/htdocs/includes/phpexcel/PHPExcel/CalcEngine/Logger.php @@ -0,0 +1,153 @@ +_cellStack = $stack; + } + + /** + * Enable/Disable Calculation engine logging + * + * @param boolean $pValue + */ + public function setWriteDebugLog($pValue = FALSE) { + $this->_writeDebugLog = $pValue; + } + + /** + * Return whether calculation engine logging is enabled or disabled + * + * @return boolean + */ + public function getWriteDebugLog() { + return $this->_writeDebugLog; + } + + /** + * Enable/Disable echoing of debug log information + * + * @param boolean $pValue + */ + public function setEchoDebugLog($pValue = FALSE) { + $this->_echoDebugLog = $pValue; + } + + /** + * Return whether echoing of debug log information is enabled or disabled + * + * @return boolean + */ + public function getEchoDebugLog() { + return $this->_echoDebugLog; + } + + /** + * Write an entry to the calculation engine debug log + */ + public function writeDebugLog() { + // Only write the debug log if logging is enabled + if ($this->_writeDebugLog) { + $message = implode(func_get_args()); + $cellReference = implode(' -> ', $this->_cellStack->showStack()); + if ($this->_echoDebugLog) { + echo $cellReference, + ($this->_cellStack->count() > 0 ? ' => ' : ''), + $message, + PHP_EOL; + } + $this->_debugLog[] = $cellReference . + ($this->_cellStack->count() > 0 ? ' => ' : '') . + $message; + } + } // function _writeDebug() + + /** + * Clear the calculation engine debug log + */ + public function clearLog() { + $this->_debugLog = array(); + } // function flushLogger() + + /** + * Return the calculation engine debug log + * + * @return string[] + */ + public function getLog() { + return $this->_debugLog; + } // function flushLogger() + +} // class PHPExcel_CalcEngine_Logger + diff --git a/htdocs/includes/phpexcel/PHPExcel/Calculation.php b/htdocs/includes/phpexcel/PHPExcel/Calculation.php index 65d4f3d1027..b609b0d8921 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Calculation.php +++ b/htdocs/includes/phpexcel/PHPExcel/Calculation.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -53,11 +53,11 @@ if (!defined('CALCULATION_REGEXP_CELLREF')) { /** - * PHPExcel_Calculation (Singleton) + * PHPExcel_Calculation (Multiton) * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Calculation { @@ -96,13 +96,29 @@ class PHPExcel_Calculation { private static $_instance; + /** + * Instance of the workbook this Calculation Engine is using + * + * @access private + * @var PHPExcel + */ + private $_workbook; + + /** + * List of instances of the calculation engine that we've instantiated for individual workbooks + * + * @access private + * @var PHPExcel_Calculation[] + */ + private static $_workbookSets; + /** * Calculation cache * * @access private * @var array */ - private static $_calculationCache = array (); + private $_calculationCache = array (); /** @@ -111,16 +127,7 @@ class PHPExcel_Calculation { * @access private * @var boolean */ - private static $_calculationCacheEnabled = true; - - - /** - * Calculation cache expiration time - * - * @access private - * @var float - */ - private static $_calculationCacheExpirationTime = 15; + private $_calculationCacheEnabled = TRUE; /** @@ -130,10 +137,10 @@ class PHPExcel_Calculation { * @access private * @var array */ - private static $_operators = array('+' => true, '-' => true, '*' => true, '/' => true, - '^' => true, '&' => true, '%' => false, '~' => false, - '>' => true, '<' => true, '=' => true, '>=' => true, - '<=' => true, '<>' => true, '|' => true, ':' => true + private static $_operators = array('+' => TRUE, '-' => TRUE, '*' => TRUE, '/' => TRUE, + '^' => TRUE, '&' => TRUE, '%' => FALSE, '~' => FALSE, + '>' => TRUE, '<' => TRUE, '=' => TRUE, '>=' => TRUE, + '<=' => TRUE, '<>' => TRUE, '|' => TRUE, ':' => TRUE ); @@ -143,12 +150,21 @@ class PHPExcel_Calculation { * @access private * @var array */ - private static $_binaryOperators = array('+' => true, '-' => true, '*' => true, '/' => true, - '^' => true, '&' => true, '>' => true, '<' => true, - '=' => true, '>=' => true, '<=' => true, '<>' => true, - '|' => true, ':' => true + private static $_binaryOperators = array('+' => TRUE, '-' => TRUE, '*' => TRUE, '/' => TRUE, + '^' => TRUE, '&' => TRUE, '>' => TRUE, '<' => TRUE, + '=' => TRUE, '>=' => TRUE, '<=' => TRUE, '<>' => TRUE, + '|' => TRUE, ':' => TRUE ); + /** + * The debug log generated by the calculation engine + * + * @access private + * @var PHPExcel_CalcEngine_Logger + * + */ + private $debugLog; + /** * Flag to determine how formula errors should be handled * If true, then a user error will be triggered @@ -158,7 +174,7 @@ class PHPExcel_Calculation { * @var boolean * */ - public $suppressFormulaErrors = false; + public $suppressFormulaErrors = FALSE; /** * Error message for any error that was raised/thrown by the calculation engine @@ -167,31 +183,7 @@ class PHPExcel_Calculation { * @var string * */ - public $formulaError = null; - - /** - * Flag to determine whether a debug log should be generated by the calculation engine - * If true, then a debug log will be generated - * If false, then a debug log will not be generated - * - * @access public - * @var boolean - * - */ - public $writeDebugLog = false; - - /** - * Flag to determine whether a debug log should be echoed by the calculation engine - * If true, then a debug log will be echoed - * If false, then a debug log will not be echoed - * A debug log can only be echoed if it is generated - * - * @access public - * @var boolean - * - */ - public $echoDebugLog = false; - + public $formulaError = NULL; /** * An array of the nested cell references accessed by the calculation engine, used for the debug log @@ -200,39 +192,85 @@ class PHPExcel_Calculation { * @var array of string * */ - private $debugLogStack = array(); + private $_cyclicReferenceStack; /** - * The debug log generated by the calculation engine + * Current iteration counter for cyclic formulae + * If the value is 0 (or less) then cyclic formulae will throw an exception, + * otherwise they will iterate to the limit defined here before returning a result * - * @access public - * @var array of string + * @var integer * */ - public $debugLog = array(); private $_cyclicFormulaCount = 0; + private $_cyclicFormulaCell = ''; + + /** + * Number of iterations for cyclic formulae + * + * @var integer + * + */ public $cyclicFormulaCount = 0; - - private $_savedPrecision = 12; + /** + * Precision used for calculations + * + * @var integer + * + */ + private $_savedPrecision = 14; + /** + * The current locale setting + * + * @var string + * + */ private static $_localeLanguage = 'en_us'; // US English (default locale) + + /** + * List of available locale settings + * Note that this is read for the locale subdirectory only when requested + * + * @var string[] + * + */ private static $_validLocaleLanguages = array( 'en' // English (default language) ); + /** + * Locale-specific argument separator for function arguments + * + * @var string + * + */ private static $_localeArgumentSeparator = ','; private static $_localeFunctions = array(); + + /** + * Locale-specific translations for Excel constants (True, False and Null) + * + * @var string[] + * + */ public static $_localeBoolean = array( 'TRUE' => 'TRUE', 'FALSE' => 'FALSE', 'NULL' => 'NULL' ); - // Constant conversion from text name/value to actual (datatyped) value - private static $_ExcelConstants = array('TRUE' => true, - 'FALSE' => false, - 'NULL' => null + /** + * Excel constant string translations to their PHP equivalents + * Constant conversion from text name/value to actual (datatyped) value + * + * @var string[] + * + */ + private static $_ExcelConstants = array('TRUE' => TRUE, + 'FALSE' => FALSE, + 'NULL' => NULL ); // PHPExcel functions @@ -404,7 +442,7 @@ class PHPExcel_Calculation { 'COLUMN' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, 'functionCall' => 'PHPExcel_Calculation_LookupRef::COLUMN', 'argumentCount' => '-1', - 'passByReference' => array(true) + 'passByReference' => array(TRUE) ), 'COLUMNS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, 'functionCall' => 'PHPExcel_Calculation_LookupRef::COLUMNS', @@ -803,7 +841,7 @@ class PHPExcel_Calculation { 'argumentCount' => '1,2' ), 'HLOOKUP' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, - 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', + 'functionCall' => 'PHPExcel_Calculation_LookupRef::HLOOKUP', 'argumentCount' => '3,4' ), 'HOUR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_DATE_AND_TIME, @@ -813,7 +851,7 @@ class PHPExcel_Calculation { 'HYPERLINK' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, 'functionCall' => 'PHPExcel_Calculation_LookupRef::HYPERLINK', 'argumentCount' => '1,2', - 'passCellReference'=> true + 'passCellReference'=> TRUE ), 'HYPGEOMDIST' => array('category' => PHPExcel_Calculation_Function::CATEGORY_STATISTICAL, 'functionCall' => 'PHPExcel_Calculation_Statistical::HYPGEOMDIST', @@ -902,7 +940,7 @@ class PHPExcel_Calculation { 'INDIRECT' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, 'functionCall' => 'PHPExcel_Calculation_LookupRef::INDIRECT', 'argumentCount' => '1,2', - 'passCellReference'=> true + 'passCellReference'=> TRUE ), 'INFO' => array('category' => PHPExcel_Calculation_Function::CATEGORY_INFORMATION, 'functionCall' => 'PHPExcel_Calculation_Functions::DUMMY', @@ -1219,8 +1257,8 @@ class PHPExcel_Calculation { 'OFFSET' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, 'functionCall' => 'PHPExcel_Calculation_LookupRef::OFFSET', 'argumentCount' => '3,5', - 'passCellReference'=> true, - 'passByReference' => array(true) + 'passCellReference'=> TRUE, + 'passByReference' => array(TRUE) ), 'OR' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOGICAL, 'functionCall' => 'PHPExcel_Calculation_Logical::LOGICAL_OR', @@ -1365,7 +1403,7 @@ class PHPExcel_Calculation { 'ROW' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, 'functionCall' => 'PHPExcel_Calculation_LookupRef::ROW', 'argumentCount' => '-1', - 'passByReference' => array(true) + 'passByReference' => array(TRUE) ), 'ROWS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_LOOKUP_AND_REFERENCE, 'functionCall' => 'PHPExcel_Calculation_LookupRef::ROWS', @@ -1680,20 +1718,20 @@ class PHPExcel_Calculation { - private function __construct() { - $localeFileDirectory = PHPEXCEL_ROOT.'PHPExcel/locale/'; - foreach (glob($localeFileDirectory.'/*',GLOB_ONLYDIR) as $filename) { - $filename = substr($filename,strlen($localeFileDirectory)+1); - if ($filename != 'en') { - self::$_validLocaleLanguages[] = $filename; - } - } - - $setPrecision = (PHP_INT_SIZE == 4) ? 12 : 16; + private function __construct(PHPExcel $workbook = NULL) { + $setPrecision = (PHP_INT_SIZE == 4) ? 14 : 16; $this->_savedPrecision = ini_get('precision'); if ($this->_savedPrecision < $setPrecision) { ini_set('precision',$setPrecision); } + + if ($workbook !== NULL) { + self::$_workbookSets[$workbook->getID()] = $this; + } + + $this->_workbook = $workbook; + $this->_cyclicReferenceStack = new PHPExcel_CalcEngine_CyclicReferenceStack(); + $this->_debugLog = new PHPExcel_CalcEngine_Logger($this->_cyclicReferenceStack); } // function __construct() @@ -1703,13 +1741,32 @@ class PHPExcel_Calculation { } } + private static function _loadLocales() { + $localeFileDirectory = PHPEXCEL_ROOT.'PHPExcel/locale/'; + foreach (glob($localeFileDirectory.'/*',GLOB_ONLYDIR) as $filename) { + $filename = substr($filename,strlen($localeFileDirectory)+1); + if ($filename != 'en') { + self::$_validLocaleLanguages[] = $filename; + } + } + } + /** * Get an instance of this class * * @access public + * @param PHPExcel $workbook Injected workbook for working with a PHPExcel object, + * or NULL to create a standalone claculation engine * @return PHPExcel_Calculation */ - public static function getInstance() { + public static function getInstance(PHPExcel $workbook = NULL) { + if ($workbook !== NULL) { + if (isset(self::$_workbookSets[$workbook->getID()])) { + return self::$_workbookSets[$workbook->getID()]; + } + return new PHPExcel_Calculation($workbook); + } + if (!isset(self::$_instance) || (self::$_instance === NULL)) { self::$_instance = new PHPExcel_Calculation(); } @@ -1717,6 +1774,19 @@ class PHPExcel_Calculation { return self::$_instance; } // function getInstance() + /** + * Unset an instance of this class + * + * @access public + * @param PHPExcel $workbook Injected workbook identifying the instance to unset + */ + public static function unsetInstance(PHPExcel $workbook = NULL) { + if ($workbook !== NULL) { + if (isset(self::$_workbookSets[$workbook->getID()])) { + unset(self::$_workbookSets[$workbook->getID()]); + } + } + } /** * Flush the calculation cache for any existing instance of this class @@ -1725,21 +1795,29 @@ class PHPExcel_Calculation { * @access public * @return null */ - public static function flushInstance() { - if (isset(self::$_instance) && (self::$_instance !== NULL)) { - self::$_instance->clearCalculationCache(); - } + public function flushInstance() { + $this->clearCalculationCache(); } // function flushInstance() + /** + * Get the debuglog for this claculation engine instance + * + * @access public + * @return PHPExcel_CalcEngine_Logger + */ + public function getDebugLog() { + return $this->_debugLog; + } + /** * __clone implementation. Cloning should not be allowed in a Singleton! * * @access public - * @throws Exception + * @throws PHPExcel_Calculation_Exception */ public final function __clone() { - throw new Exception ('Cloning a Singleton is not allowed!'); + throw new PHPExcel_Calculation_Exception ('Cloning the calculation engine is not allowed!'); } // function __clone() @@ -1775,10 +1853,10 @@ class PHPExcel_Calculation { ($returnType == self::RETURN_ARRAY_AS_ERROR) || ($returnType == self::RETURN_ARRAY_AS_ARRAY)) { self::$returnArrayAsType = $returnType; - return true; + return TRUE; } - return false; - } // function setExcelCalendar() + return FALSE; + } // function setArrayReturnType() /** @@ -1789,7 +1867,7 @@ class PHPExcel_Calculation { */ public static function getArrayReturnType() { return self::$returnArrayAsType; - } // function getExcelCalendar() + } // function getArrayReturnType() /** @@ -1799,18 +1877,17 @@ class PHPExcel_Calculation { * @return boolean */ public function getCalculationCacheEnabled() { - return self::$_calculationCacheEnabled; + return $this->_calculationCacheEnabled; } // function getCalculationCacheEnabled() - /** * Enable/disable calculation cache * * @access public * @param boolean $pValue */ - public function setCalculationCacheEnabled($pValue = true) { - self::$_calculationCacheEnabled = $pValue; + public function setCalculationCacheEnabled($pValue = TRUE) { + $this->_calculationCacheEnabled = $pValue; $this->clearCalculationCache(); } // function setCalculationCacheEnabled() @@ -1819,7 +1896,7 @@ class PHPExcel_Calculation { * Enable calculation cache */ public function enableCalculationCache() { - $this->setCalculationCacheEnabled(true); + $this->setCalculationCacheEnabled(TRUE); } // function enableCalculationCache() @@ -1827,7 +1904,7 @@ class PHPExcel_Calculation { * Disable calculation cache */ public function disableCalculationCache() { - $this->setCalculationCacheEnabled(false); + $this->setCalculationCacheEnabled(FALSE); } // function disableCalculationCache() @@ -1835,30 +1912,32 @@ class PHPExcel_Calculation { * Clear calculation cache */ public function clearCalculationCache() { - self::$_calculationCache = array(); + $this->_calculationCache = array(); } // function clearCalculationCache() + /** + * Clear calculation cache for a specified worksheet + * + * @param string $worksheetName + */ + public function clearCalculationCacheForWorksheet($worksheetName) { + if (isset($this->_calculationCache[$worksheetName])) { + unset($this->_calculationCache[$worksheetName]); + } + } // function clearCalculationCacheForWorksheet() /** - * Get calculation cache expiration time + * Rename calculation cache for a specified worksheet * - * @return float + * @param string $fromWorksheetName + * @param string $toWorksheetName */ - public function getCalculationCacheExpirationTime() { - return self::$_calculationCacheExpirationTime; - } // getCalculationCacheExpirationTime() - - - /** - * Set calculation cache expiration time - * - * @param float $pValue - */ - public function setCalculationCacheExpirationTime($pValue = 15) { - self::$_calculationCacheExpirationTime = $pValue; - } // function setCalculationCacheExpirationTime() - - + public function renameCalculationCacheForWorksheet($fromWorksheetName, $toWorksheetName) { + if (isset($this->_calculationCache[$fromWorksheetName])) { + $this->_calculationCache[$toWorksheetName] = &$this->_calculationCache[$fromWorksheetName]; + unset($this->_calculationCache[$fromWorksheetName]); + } + } // function renameCalculationCacheForWorksheet() /** @@ -1874,15 +1953,19 @@ class PHPExcel_Calculation { /** * Set the locale code * + * @param string $locale The locale to use for formula translation * @return boolean */ - public function setLocale($locale='en_us') { + public function setLocale($locale = 'en_us') { // Identify our locale and language $language = $locale = strtolower($locale); - if (strpos($locale,'_') !== false) { + if (strpos($locale,'_') !== FALSE) { list($language) = explode('_',$locale); } + if (count(self::$_validLocaleLanguages) == 1) + self::_loadLocales(); + // Test whether we have any language data for this language (any locale) if (in_array($language,self::$_validLocaleLanguages)) { // initialise language/locale settings @@ -1897,14 +1980,14 @@ class PHPExcel_Calculation { // If there isn't a locale specific function file, look for a language specific function file $functionNamesFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.'functions'; if (!file_exists($functionNamesFile)) { - return false; + return FALSE; } } // Retrieve the list of locale or language specific function names $localeFunctions = file($functionNamesFile,FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); foreach ($localeFunctions as $localeFunction) { list($localeFunction) = explode('##',$localeFunction); // Strip out comments - if (strpos($localeFunction,'=') !== false) { + if (strpos($localeFunction,'=') !== FALSE) { list($fName,$lfName) = explode('=',$localeFunction); $fName = trim($fName); $lfName = trim($lfName); @@ -1925,7 +2008,7 @@ class PHPExcel_Calculation { $localeSettings = file($configFile,FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); foreach ($localeSettings as $localeSetting) { list($localeSetting) = explode('##',$localeSetting); // Strip out comments - if (strpos($localeSetting,'=') !== false) { + if (strpos($localeSetting,'=') !== FALSE) { list($settingName,$settingValue) = explode('=',$localeSetting); $settingName = strtoupper(trim($settingName)); switch ($settingName) { @@ -1939,11 +2022,11 @@ class PHPExcel_Calculation { } self::$functionReplaceFromExcel = self::$functionReplaceToExcel = - self::$functionReplaceFromLocale = self::$functionReplaceToLocale = null; + self::$functionReplaceFromLocale = self::$functionReplaceToLocale = NULL; self::$_localeLanguage = $locale; - return true; + return TRUE; } - return false; + return FALSE; } // function setLocale() @@ -1953,9 +2036,9 @@ class PHPExcel_Calculation { for ($i = 0; $i < $strlen; ++$i) { $chr = mb_substr($formula,$i,1); switch ($chr) { - case '{' : $inBraces = true; + case '{' : $inBraces = TRUE; break; - case '}' : $inBraces = false; + case '}' : $inBraces = FALSE; break; case $fromSeparator : if (!$inBraces) { @@ -1969,13 +2052,13 @@ class PHPExcel_Calculation { private static function _translateFormula($from,$to,$formula,$fromSeparator,$toSeparator) { // Convert any Excel function names to the required language if (self::$_localeLanguage !== 'en_us') { - $inBraces = false; + $inBraces = FALSE; // If there is the possibility of braces within a quoted string, then we don't treat those as matrix indicators - if (strpos($formula,'"') !== false) { + if (strpos($formula,'"') !== FALSE) { // So instead we skip replacing in any quoted strings by only replacing in every other array element after we've exploded // the formula $temp = explode('"',$formula); - $i = false; + $i = FALSE; foreach($temp as &$value) { // Only count/replace in alternating array entries if ($i = !$i) { @@ -1996,8 +2079,8 @@ class PHPExcel_Calculation { return $formula; } - private static $functionReplaceFromExcel = null; - private static $functionReplaceToLocale = null; + private static $functionReplaceFromExcel = NULL; + private static $functionReplaceToLocale = NULL; public function _translateFormulaToLocale($formula) { if (self::$functionReplaceFromExcel === NULL) { @@ -2025,8 +2108,8 @@ class PHPExcel_Calculation { } // function _translateFormulaToLocale() - private static $functionReplaceFromLocale = null; - private static $functionReplaceToExcel = null; + private static $functionReplaceFromLocale = NULL; + private static $functionReplaceToExcel = NULL; public function _translateFormulaToEnglish($formula) { if (self::$functionReplaceFromLocale === NULL) { @@ -2120,13 +2203,13 @@ class PHPExcel_Calculation { * @access public * @param PHPExcel_Cell $pCell Cell to calculate * @return mixed - * @throws Exception + * @throws PHPExcel_Calculation_Exception */ - public function calculate(PHPExcel_Cell $pCell = null) { + public function calculate(PHPExcel_Cell $pCell = NULL) { try { return $this->calculateCellValue($pCell); - } catch (Exception $e) { - throw(new Exception($e->getMessage())); + } catch (PHPExcel_Exception $e) { + throw new PHPExcel_Calculation_Exception($e->getMessage()); } } // function calculate() @@ -2138,35 +2221,33 @@ class PHPExcel_Calculation { * @param PHPExcel_Cell $pCell Cell to calculate * @param Boolean $resetLog Flag indicating whether the debug log should be reset or not * @return mixed - * @throws Exception + * @throws PHPExcel_Calculation_Exception */ - public function calculateCellValue(PHPExcel_Cell $pCell = null, $resetLog = true) { - if ($resetLog) { - // Initialise the logging settings if requested - $this->formulaError = null; - $this->debugLog = $this->debugLogStack = array(); - $this->_cyclicFormulaCount = 1; - - $returnArrayAsType = self::$returnArrayAsType; - self::$returnArrayAsType = self::RETURN_ARRAY_AS_ARRAY; - } - - // Read the formula from the cell + public function calculateCellValue(PHPExcel_Cell $pCell = NULL, $resetLog = TRUE) { if ($pCell === NULL) { return NULL; } + $returnArrayAsType = self::$returnArrayAsType; if ($resetLog) { - self::$returnArrayAsType = $returnArrayAsType; + // Initialise the logging settings if requested + $this->formulaError = null; + $this->_debugLog->clearLog(); + $this->_cyclicReferenceStack->clear(); + $this->_cyclicFormulaCount = 1; + + self::$returnArrayAsType = self::RETURN_ARRAY_AS_ARRAY; } + // Execute the calculation for the cell formula try { $result = self::_unwrapResult($this->_calculateFormulaValue($pCell->getValue(), $pCell->getCoordinate(), $pCell)); - } catch (Exception $e) { - throw(new Exception($e->getMessage())); + } catch (PHPExcel_Exception $e) { + throw new PHPExcel_Calculation_Exception($e->getMessage()); } if ((is_array($result)) && (self::$returnArrayAsType != self::RETURN_ARRAY_AS_ARRAY)) { + self::$returnArrayAsType = $returnArrayAsType; $testResult = PHPExcel_Calculation_Functions::flattenArray($result); if (self::$returnArrayAsType == self::RETURN_ARRAY_AS_ERROR) { return PHPExcel_Calculation_Functions::VALUE(); @@ -2187,6 +2268,8 @@ class PHPExcel_Calculation { } $result = array_shift($testResult); } + self::$returnArrayAsType = $returnArrayAsType; + if ($result === NULL) { return 0; @@ -2202,7 +2285,7 @@ class PHPExcel_Calculation { * * @param string $formula Formula to parse * @return array - * @throws Exception + * @throws PHPExcel_Calculation_Exception */ public function parseFormula($formula) { // Basic validation that this is indeed a formula @@ -2220,33 +2303,57 @@ class PHPExcel_Calculation { /** * Calculate the value of a formula * - * @param string $formula Formula to parse + * @param string $formula Formula to parse + * @param string $cellID Address of the cell to calculate + * @param PHPExcel_Cell $pCell Cell to calculate * @return mixed - * @throws Exception + * @throws PHPExcel_Calculation_Exception */ - public function calculateFormula($formula, $cellID=null, PHPExcel_Cell $pCell = null) { + public function calculateFormula($formula, $cellID=NULL, PHPExcel_Cell $pCell = NULL) { // Initialise the logging settings $this->formulaError = null; - $this->debugLog = $this->debugLogStack = array(); + $this->_debugLog->clearLog(); + $this->_cyclicReferenceStack->clear(); // Disable calculation cacheing because it only applies to cell calculations, not straight formulae // But don't actually flush any cache $resetCache = $this->getCalculationCacheEnabled(); - self::$_calculationCacheEnabled = false; + $this->_calculationCacheEnabled = FALSE; // Execute the calculation try { $result = self::_unwrapResult($this->_calculateFormulaValue($formula, $cellID, $pCell)); - } catch (Exception $e) { - throw(new Exception($e->getMessage())); + } catch (PHPExcel_Exception $e) { + throw new PHPExcel_Calculation_Exception($e->getMessage()); } // Reset calculation cacheing to its previous state - self::$_calculationCacheEnabled = $resetCache; + $this->_calculationCacheEnabled = $resetCache; return $result; } // function calculateFormula() + public function getValueFromCache($worksheetName, $cellID, &$cellValue) { + // Is calculation cacheing enabled? + // Is the value present in calculation cache? +//echo 'Test cache for ',$worksheetName,'!',$cellID,PHP_EOL; + $this->_debugLog->writeDebugLog('Testing cache value for cell ', $worksheetName, '!', $cellID); + if (($this->_calculationCacheEnabled) && (isset($this->_calculationCache[$worksheetName][$cellID]))) { +//echo 'Retrieve from cache',PHP_EOL; + $this->_debugLog->writeDebugLog('Retrieving value for cell ', $worksheetName, '!', $cellID, ' from cache'); + // Return the cached result + $cellValue = $this->_calculationCache[$worksheetName][$cellID]; + return TRUE; + } + return FALSE; + } + + public function saveValueToCache($worksheetName, $cellID, $cellValue) { + if ($this->_calculationCacheEnabled) { + $this->_calculationCache[$worksheetName][$cellID] = $cellValue; + } + } + /** * Parse a cell formula and calculate its value * @@ -2254,57 +2361,26 @@ class PHPExcel_Calculation { * @param string $cellID The ID (e.g. A3) of the cell that we are calculating * @param PHPExcel_Cell $pCell Cell to calculate * @return mixed - * @throws Exception + * @throws PHPExcel_Calculation_Exception */ public function _calculateFormulaValue($formula, $cellID=null, PHPExcel_Cell $pCell = null) { -// echo ''.$cellID.'
'; $cellValue = ''; // Basic validation that this is indeed a formula - // We simply return the "cell value" (formula) if not + // We simply return the cell value if not $formula = trim($formula); if ($formula{0} != '=') return self::_wrapResult($formula); $formula = ltrim(substr($formula,1)); if (!isset($formula{0})) return self::_wrapResult($formula); - $wsTitle = "\x00Wrk"; - if ($pCell !== NULL) { - $pCellParent = $pCell->getParent(); - if ($pCellParent !== NULL) { - $wsTitle = $pCellParent->getTitle(); - } - } - // Is calculation cacheing enabled? - if ($cellID !== NULL) { - if (self::$_calculationCacheEnabled) { - // Is the value present in calculation cache? -// echo 'Testing cache value
'; - if (isset(self::$_calculationCache[$wsTitle][$cellID])) { -// echo 'Value is in cache
'; - $this->_writeDebug('Testing cache value for cell '.$cellID); - // Is cache still valid? - if ((microtime(true) - self::$_calculationCache[$wsTitle][$cellID]['time']) < self::$_calculationCacheExpirationTime) { -// echo 'Cache time is still valid
'; - $this->_writeDebug('Retrieving value for '.$cellID.' from cache'); - // Return the cached result - $returnValue = self::$_calculationCache[$wsTitle][$cellID]['data']; -// echo 'Retrieving data value of '.$returnValue.' for '.$cellID.' from cache
'; - if (is_array($returnValue)) { - $returnValue = PHPExcel_Calculation_Functions::flattenArray($returnValue); - return array_shift($returnValue); - } - return $returnValue; - } else { -// echo 'Cache has expired
'; - $this->_writeDebug('Cache value for '.$cellID.' has expired'); - // Clear the cache if it's no longer valid - unset(self::$_calculationCache[$wsTitle][$cellID]); - } - } - } + $pCellParent = ($pCell !== NULL) ? $pCell->getWorksheet() : NULL; + $wsTitle = ($pCellParent !== NULL) ? $pCellParent->getTitle() : "\x00Wrk"; + + if (($cellID !== NULL) && ($this->getValueFromCache($wsTitle, $cellID, $cellValue))) { + return $cellValue; } - if ((in_array($wsTitle.'!'.$cellID,$this->debugLogStack)) && ($wsTitle != "\x00Wrk")) { + if (($wsTitle{0} !== "\x00") && ($this->_cyclicReferenceStack->onStack($wsTitle.'!'.$cellID))) { if ($this->cyclicFormulaCount <= 0) { return $this->_raiseFormulaError('Cyclic Reference in Formula'); } elseif (($this->_cyclicFormulaCount >= $this->cyclicFormulaCount) && @@ -2322,17 +2398,15 @@ class PHPExcel_Calculation { } } } - $this->debugLogStack[] = $wsTitle.'!'.$cellID; + // Parse the formula onto the token stack and calculate the value + $this->_cyclicReferenceStack->push($wsTitle.'!'.$cellID); $cellValue = $this->_processTokenStack($this->_parseFormula($formula, $pCell), $cellID, $pCell); - array_pop($this->debugLogStack); + $this->_cyclicReferenceStack->pop(); // Save to calculation cache if ($cellID !== NULL) { - if (self::$_calculationCacheEnabled) { - self::$_calculationCache[$wsTitle][$cellID]['time'] = microtime(true); - self::$_calculationCache[$wsTitle][$cellID]['data'] = $cellValue; - } + $this->saveValueToCache($wsTitle, $cellID, $cellValue); } // Return the calculated value @@ -2407,11 +2481,20 @@ class PHPExcel_Calculation { /** * Ensure that paired matrix operands are both matrices of the same size * - * @param mixed &$matrix1 First matrix operand - * @param mixed &$matrix2 Second matrix operand + * @param mixed &$matrix1 First matrix operand + * @param mixed &$matrix2 Second matrix operand + * @param integer $matrix1Rows Row size of first matrix operand + * @param integer $matrix1Columns Column size of first matrix operand + * @param integer $matrix2Rows Row size of second matrix operand + * @param integer $matrix2Columns Column size of second matrix operand */ private static function _resizeMatricesShrink(&$matrix1,&$matrix2,$matrix1Rows,$matrix1Columns,$matrix2Rows,$matrix2Columns) { if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) { + if ($matrix2Rows < $matrix1Rows) { + for ($i = $matrix2Rows; $i < $matrix1Rows; ++$i) { + unset($matrix1[$i]); + } + } if ($matrix2Columns < $matrix1Columns) { for ($i = 0; $i < $matrix1Rows; ++$i) { for ($j = $matrix2Columns; $j < $matrix1Columns; ++$j) { @@ -2419,14 +2502,14 @@ class PHPExcel_Calculation { } } } - if ($matrix2Rows < $matrix1Rows) { - for ($i = $matrix2Rows; $i < $matrix1Rows; ++$i) { - unset($matrix1[$i]); - } - } } if (($matrix1Columns < $matrix2Columns) || ($matrix1Rows < $matrix2Rows)) { + if ($matrix1Rows < $matrix2Rows) { + for ($i = $matrix1Rows; $i < $matrix2Rows; ++$i) { + unset($matrix2[$i]); + } + } if ($matrix1Columns < $matrix2Columns) { for ($i = 0; $i < $matrix2Rows; ++$i) { for ($j = $matrix1Columns; $j < $matrix2Columns; ++$j) { @@ -2434,11 +2517,6 @@ class PHPExcel_Calculation { } } } - if ($matrix1Rows < $matrix2Rows) { - for ($i = $matrix1Rows; $i < $matrix2Rows; ++$i) { - unset($matrix2[$i]); - } - } } } // function _resizeMatricesShrink() @@ -2448,6 +2526,10 @@ class PHPExcel_Calculation { * * @param mixed &$matrix1 First matrix operand * @param mixed &$matrix2 Second matrix operand + * @param integer $matrix1Rows Row size of first matrix operand + * @param integer $matrix1Columns Column size of first matrix operand + * @param integer $matrix2Rows Row size of second matrix operand + * @param integer $matrix2Columns Column size of second matrix operand */ private static function _resizeMatricesExtend(&$matrix1,&$matrix2,$matrix1Rows,$matrix1Columns,$matrix2Rows,$matrix2Columns) { if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) { @@ -2493,7 +2575,7 @@ class PHPExcel_Calculation { * @return mixed */ private function _showValue($value) { - if ($this->writeDebugLog) { + if ($this->_debugLog->getWriteDebugLog()) { $testArray = PHPExcel_Calculation_Functions::flattenArray($value); if (count($testArray) == 1) { $value = array_pop($testArray); @@ -2528,7 +2610,7 @@ class PHPExcel_Calculation { * @return mixed */ private function _showTypeDetails($value) { - if ($this->writeDebugLog) { + if ($this->_debugLog->getWriteDebugLog()) { $testArray = PHPExcel_Calculation_Functions::flattenArray($value); if (count($testArray) == 1) { $value = array_pop($testArray); @@ -2563,15 +2645,15 @@ class PHPExcel_Calculation { static $matrixReplaceTo = array('MKMATRIX(MKMATRIX(','),MKMATRIX(','))'); // Convert any Excel matrix references to the MKMATRIX() function - if (strpos($formula,'{') !== false) { + if (strpos($formula,'{') !== FALSE) { // If there is the possibility of braces within a quoted string, then we don't treat those as matrix indicators - if (strpos($formula,'"') !== false) { + if (strpos($formula,'"') !== FALSE) { // So instead we skip replacing in any quoted strings by only replacing in every other array element after we've exploded // the formula $temp = explode('"',$formula); // Open and Closed counts used for trapping mismatched braces in the formula $openCount = $closeCount = 0; - $i = false; + $i = FALSE; foreach($temp as &$value) { // Only count/replace in alternating array entries if ($i = !$i) { @@ -2614,49 +2696,52 @@ class PHPExcel_Calculation { } // function _mkMatrix() + // Binary Operators + // These operators always work on two values + // Array key is the operator, the value indicates whether this is a left or right associative operator + private static $_operatorAssociativity = array( + '^' => 0, // Exponentiation + '*' => 0, '/' => 0, // Multiplication and Division + '+' => 0, '-' => 0, // Addition and Subtraction + '&' => 0, // Concatenation + '|' => 0, ':' => 0, // Intersect and Range + '>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0 // Comparison + ); + + // Comparison (Boolean) Operators + // These operators work on two values, but always return a boolean result + private static $_comparisonOperators = array('>' => TRUE, '<' => TRUE, '=' => TRUE, '>=' => TRUE, '<=' => TRUE, '<>' => TRUE); + + // Operator Precedence + // This list includes all valid operators, whether binary (including boolean) or unary (such as %) + // Array key is the operator, the value is its precedence + private static $_operatorPrecedence = array( + ':' => 8, // Range + '|' => 7, // Intersect + '~' => 6, // Negation + '%' => 5, // Percentage + '^' => 4, // Exponentiation + '*' => 3, '/' => 3, // Multiplication and Division + '+' => 2, '-' => 2, // Addition and Subtraction + '&' => 1, // Concatenation + '>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0 // Comparison + ); + // Convert infix to postfix notation - private function _parseFormula($formula, PHPExcel_Cell $pCell = null) { - if (($formula = self::_convertMatrixReferences(trim($formula))) === false) { + private function _parseFormula($formula, PHPExcel_Cell $pCell = NULL) { + if (($formula = self::_convertMatrixReferences(trim($formula))) === FALSE) { return FALSE; } // If we're using cell caching, then $pCell may well be flushed back to the cache (which detaches the parent worksheet), // so we store the parent worksheet so that we can re-attach it when necessary - $pCellParent = ($pCell !== NULL) ? $pCell->getParent() : NULL; - - // Binary Operators - // These operators always work on two values - // Array key is the operator, the value indicates whether this is a left or right associative operator - $operatorAssociativity = array('^' => 0, // Exponentiation - '*' => 0, '/' => 0, // Multiplication and Division - '+' => 0, '-' => 0, // Addition and Subtraction - '&' => 0, // Concatenation - '|' => 0, ':' => 0, // Intersect and Range - '>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0 // Comparison - ); - // Comparison (Boolean) Operators - // These operators work on two values, but always return a boolean result - $comparisonOperators = array('>' => true, '<' => true, '=' => true, '>=' => true, '<=' => true, '<>' => true); - - // Operator Precedence - // This list includes all valid operators, whether binary (including boolean) or unary (such as %) - // Array key is the operator, the value is its precedence - $operatorPrecedence = array(':' => 8, // Range - '|' => 7, // Intersect - '~' => 6, // Negation - '%' => 5, // Percentage - '^' => 4, // Exponentiation - '*' => 3, '/' => 3, // Multiplication and Division - '+' => 2, '-' => 2, // Addition and Subtraction - '&' => 1, // Concatenation - '>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0 // Comparison - ); + $pCellParent = ($pCell !== NULL) ? $pCell->getWorksheet() : NULL; $regexpMatchString = '/^('.self::CALCULATION_REGEXP_FUNCTION. + '|'.self::CALCULATION_REGEXP_CELLREF. '|'.self::CALCULATION_REGEXP_NUMBER. '|'.self::CALCULATION_REGEXP_STRING. '|'.self::CALCULATION_REGEXP_OPENBRACE. - '|'.self::CALCULATION_REGEXP_CELLREF. '|'.self::CALCULATION_REGEXP_NAMEDRANGE. '|'.self::CALCULATION_REGEXP_ERROR. ')/si'; @@ -2665,55 +2750,55 @@ class PHPExcel_Calculation { $index = 0; $stack = new PHPExcel_Calculation_Token_Stack; $output = array(); - $expectingOperator = false; // We use this test in syntax-checking the expression to determine when a + $expectingOperator = FALSE; // We use this test in syntax-checking the expression to determine when a // - is a negation or + is a positive operator rather than an operation - $expectingOperand = false; // We use this test in syntax-checking the expression to determine whether an operand + $expectingOperand = FALSE; // We use this test in syntax-checking the expression to determine whether an operand // should be null in a function call // The guts of the lexical parser // Loop through the formula extracting each operator and operand in turn - while(true) { -// echo 'Assessing Expression '.substr($formula, $index).'
'; + while(TRUE) { +//echo 'Assessing Expression '.substr($formula, $index),PHP_EOL; $opCharacter = $formula{$index}; // Get the first character of the value at the current index position -// echo 'Initial character of expression block is '.$opCharacter.'
'; - if ((isset($comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset($comparisonOperators[$formula{$index+1}]))) { +//echo 'Initial character of expression block is '.$opCharacter,PHP_EOL; + if ((isset(self::$_comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset(self::$_comparisonOperators[$formula{$index+1}]))) { $opCharacter .= $formula{++$index}; -// echo 'Initial character of expression block is comparison operator '.$opCharacter.'
'; +//echo 'Initial character of expression block is comparison operator '.$opCharacter.PHP_EOL; } // Find out if we're currently at the beginning of a number, variable, cell reference, function, parenthesis or operand $isOperandOrFunction = preg_match($regexpMatchString, substr($formula, $index), $match); -// echo '$isOperandOrFunction is '.(($isOperandOrFunction) ? 'True' : 'False').'
'; -// var_dump($match); +//echo '$isOperandOrFunction is '.(($isOperandOrFunction) ? 'True' : 'False').PHP_EOL; +//var_dump($match); if ($opCharacter == '-' && !$expectingOperator) { // Is it a negation instead of a minus? -// echo 'Element is a Negation operator
'; +//echo 'Element is a Negation operator',PHP_EOL; $stack->push('Unary Operator','~'); // Put a negation on the stack ++$index; // and drop the negation symbol } elseif ($opCharacter == '%' && $expectingOperator) { -// echo 'Element is a Percentage operator
'; +//echo 'Element is a Percentage operator',PHP_EOL; $stack->push('Unary Operator','%'); // Put a percentage on the stack ++$index; } elseif ($opCharacter == '+' && !$expectingOperator) { // Positive (unary plus rather than binary operator plus) can be discarded? -// echo 'Element is a Positive number, not Plus operator
'; +//echo 'Element is a Positive number, not Plus operator',PHP_EOL; ++$index; // Drop the redundant plus symbol } elseif ((($opCharacter == '~') || ($opCharacter == '|')) && (!$isOperandOrFunction)) { // We have to explicitly deny a tilde or pipe, because they are legal return $this->_raiseFormulaError("Formula Error: Illegal character '~'"); // on the stack but not in the input expression } elseif ((isset(self::$_operators[$opCharacter]) or $isOperandOrFunction) && $expectingOperator) { // Are we putting an operator on the stack? -// echo 'Element with value '.$opCharacter.' is an Operator
'; +//echo 'Element with value '.$opCharacter.' is an Operator',PHP_EOL; while($stack->count() > 0 && ($o2 = $stack->last()) && isset(self::$_operators[$o2['value']]) && - @($operatorAssociativity[$opCharacter] ? $operatorPrecedence[$opCharacter] < $operatorPrecedence[$o2['value']] : $operatorPrecedence[$opCharacter] <= $operatorPrecedence[$o2['value']])) { + @(self::$_operatorAssociativity[$opCharacter] ? self::$_operatorPrecedence[$opCharacter] < self::$_operatorPrecedence[$o2['value']] : self::$_operatorPrecedence[$opCharacter] <= self::$_operatorPrecedence[$o2['value']])) { $output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output } $stack->push('Binary Operator',$opCharacter); // Finally put our current operator onto the stack ++$index; - $expectingOperator = false; + $expectingOperator = FALSE; } elseif ($opCharacter == ')' && $expectingOperator) { // Are we expecting to close a parenthesis? -// echo 'Element is a Closing bracket
'; - $expectingOperand = false; +//echo 'Element is a Closing bracket',PHP_EOL; + $expectingOperand = FALSE; while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last ( if ($o2 === NULL) return $this->_raiseFormulaError('Formula Error: Unexpected closing brace ")"'); else $output[] = $o2; @@ -2721,65 +2806,65 @@ class PHPExcel_Calculation { $d = $stack->last(2); if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $d['value'], $matches)) { // Did this parenthesis just close a function? $functionName = $matches[1]; // Get the function name -// echo 'Closed Function is '.$functionName.'
'; +//echo 'Closed Function is '.$functionName,PHP_EOL; $d = $stack->pop(); $argumentCount = $d['value']; // See how many arguments there were (argument count is the next value stored on the stack) -// if ($argumentCount == 0) { -// echo 'With no arguments
'; -// } elseif ($argumentCount == 1) { -// echo 'With 1 argument
'; -// } else { -// echo 'With '.$argumentCount.' arguments
'; -// } +//if ($argumentCount == 0) { +// echo 'With no arguments',PHP_EOL; +//} elseif ($argumentCount == 1) { +// echo 'With 1 argument',PHP_EOL; +//} else { +// echo 'With '.$argumentCount.' arguments',PHP_EOL; +//} $output[] = $d; // Dump the argument count on the output $output[] = $stack->pop(); // Pop the function and push onto the output if (isset(self::$_controlFunctions[$functionName])) { -// echo 'Built-in function '.$functionName.'
'; +//echo 'Built-in function '.$functionName,PHP_EOL; $expectedArgumentCount = self::$_controlFunctions[$functionName]['argumentCount']; $functionCall = self::$_controlFunctions[$functionName]['functionCall']; } elseif (isset(self::$_PHPExcelFunctions[$functionName])) { -// echo 'PHPExcel function '.$functionName.'
'; +//echo 'PHPExcel function '.$functionName,PHP_EOL; $expectedArgumentCount = self::$_PHPExcelFunctions[$functionName]['argumentCount']; $functionCall = self::$_PHPExcelFunctions[$functionName]['functionCall']; } else { // did we somehow push a non-function on the stack? this should never happen return $this->_raiseFormulaError("Formula Error: Internal error, non-function on stack"); } // Check the argument count - $argumentCountError = false; + $argumentCountError = FALSE; if (is_numeric($expectedArgumentCount)) { if ($expectedArgumentCount < 0) { -// echo '$expectedArgumentCount is between 0 and '.abs($expectedArgumentCount).'
'; +//echo '$expectedArgumentCount is between 0 and '.abs($expectedArgumentCount),PHP_EOL; if ($argumentCount > abs($expectedArgumentCount)) { - $argumentCountError = true; + $argumentCountError = TRUE; $expectedArgumentCountString = 'no more than '.abs($expectedArgumentCount); } } else { -// echo '$expectedArgumentCount is numeric '.$expectedArgumentCount.'
'; +//echo '$expectedArgumentCount is numeric '.$expectedArgumentCount,PHP_EOL; if ($argumentCount != $expectedArgumentCount) { - $argumentCountError = true; + $argumentCountError = TRUE; $expectedArgumentCountString = $expectedArgumentCount; } } } elseif ($expectedArgumentCount != '*') { $isOperandOrFunction = preg_match('/(\d*)([-+,])(\d*)/',$expectedArgumentCount,$argMatch); -// print_r($argMatch); -// echo '
'; +//print_r($argMatch); +//echo PHP_EOL; switch ($argMatch[2]) { case '+' : if ($argumentCount < $argMatch[1]) { - $argumentCountError = true; + $argumentCountError = TRUE; $expectedArgumentCountString = $argMatch[1].' or more '; } break; case '-' : if (($argumentCount < $argMatch[1]) || ($argumentCount > $argMatch[3])) { - $argumentCountError = true; + $argumentCountError = TRUE; $expectedArgumentCountString = 'between '.$argMatch[1].' and '.$argMatch[3]; } break; case ',' : if (($argumentCount != $argMatch[1]) && ($argumentCount != $argMatch[3])) { - $argumentCountError = true; + $argumentCountError = TRUE; $expectedArgumentCountString = 'either '.$argMatch[1].' or '.$argMatch[3]; } break; @@ -2792,7 +2877,7 @@ class PHPExcel_Calculation { ++$index; } elseif ($opCharacter == ',') { // Is this the separator for function arguments? -// echo 'Element is a Function argument separator
'; +//echo 'Element is a Function argument separator',PHP_EOL; while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last ( if ($o2 === NULL) return $this->_raiseFormulaError("Formula Error: Unexpected ,"); else $output[] = $o2; // pop the argument expression stuff and push onto the output @@ -2800,7 +2885,7 @@ class PHPExcel_Calculation { // If we've a comma when we're expecting an operand, then what we actually have is a null operand; // so push a null onto the stack if (($expectingOperand) || (!$expectingOperator)) { - $output[] = array('type' => 'NULL Value', 'value' => self::$_ExcelConstants['NULL'], 'reference' => null); + $output[] = array('type' => 'NULL Value', 'value' => self::$_ExcelConstants['NULL'], 'reference' => NULL); } // make sure there was a function $d = $stack->last(2); @@ -2809,8 +2894,8 @@ class PHPExcel_Calculation { $d = $stack->pop(); $stack->push($d['type'],++$d['value'],$d['reference']); // increment the argument count $stack->push('Brace', '('); // put the ( back on, we'll need to pop back to it again - $expectingOperator = false; - $expectingOperand = true; + $expectingOperator = FALSE; + $expectingOperand = TRUE; ++$index; } elseif ($opCharacter == '(' && !$expectingOperator) { @@ -2819,8 +2904,8 @@ class PHPExcel_Calculation { ++$index; } elseif ($isOperandOrFunction && !$expectingOperator) { // do we now have a function/variable/number? - $expectingOperator = true; - $expectingOperand = false; + $expectingOperator = TRUE; + $expectingOperand = FALSE; $val = $match[1]; $length = strlen($val); // echo 'Element with value '.$val.' is an Operand, Variable, Constant, String, Number, Cell Reference or Function
'; @@ -2833,14 +2918,14 @@ class PHPExcel_Calculation { $ax = preg_match('/^\s*(\s*\))/i', substr($formula, $index+$length), $amatch); if ($ax) { $stack->push('Operand Count for Function '.strtoupper($val).')', 0); - $expectingOperator = true; + $expectingOperator = TRUE; } else { $stack->push('Operand Count for Function '.strtoupper($val).')', 1); - $expectingOperator = false; + $expectingOperator = FALSE; } $stack->push('Brace', '('); } else { // it's a var w/ implicit multiplication - $output[] = array('type' => 'Value', 'value' => $matches[1], 'reference' => null); + $output[] = array('type' => 'Value', 'value' => $matches[1], 'reference' => NULL); } } elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $val, $matches)) { // echo 'Element '.$val.' is a Cell reference
'; @@ -2865,7 +2950,7 @@ class PHPExcel_Calculation { } $output[] = array('type' => 'Cell Reference', 'value' => $val, 'reference' => $val); -// $expectingOperator = false; +// $expectingOperator = FALSE; } else { // it's a variable, constant, string, number or boolean // echo 'Element is a Variable, Constant, String, Number or Boolean
'; // If the last entry on the stack was a : operator, then we may have a row or column range reference @@ -2873,12 +2958,12 @@ class PHPExcel_Calculation { if ($testPrevOp['value'] == ':') { $startRowColRef = $output[count($output)-1]['value']; $rangeWS1 = ''; - if (strpos('!',$startRowColRef) !== false) { + if (strpos('!',$startRowColRef) !== FALSE) { list($rangeWS1,$startRowColRef) = explode('!',$startRowColRef); } if ($rangeWS1 != '') $rangeWS1 .= '!'; $rangeWS2 = $rangeWS1; - if (strpos('!',$val) !== false) { + if (strpos('!',$val) !== FALSE) { list($rangeWS2,$val) = explode('!',$val); } if ($rangeWS2 != '') $rangeWS2 .= '!'; @@ -2897,14 +2982,14 @@ class PHPExcel_Calculation { } } - $localeConstant = false; + $localeConstant = FALSE; if ($opCharacter == '"') { // echo 'Element is a String
'; // UnEscape any quotes within the string $val = self::_wrapResult(str_replace('""','"',self::_unwrapResult($val))); } elseif (is_numeric($val)) { // echo 'Element is a Number
'; - if ((strpos($val,'.') !== false) || (stripos($val,'e') !== false) || ($val > PHP_INT_MAX) || ($val < -PHP_INT_MAX)) { + if ((strpos($val,'.') !== FALSE) || (stripos($val,'e') !== FALSE) || ($val > PHP_INT_MAX) || ($val < -PHP_INT_MAX)) { // echo 'Casting '.$val.' to float
'; $val = (float) $val; } else { @@ -2915,11 +3000,11 @@ class PHPExcel_Calculation { $excelConstant = trim(strtoupper($val)); // echo 'Element '.$excelConstant.' is an Excel Constant
'; $val = self::$_ExcelConstants[$excelConstant]; - } elseif (($localeConstant = array_search(trim(strtoupper($val)), self::$_localeBoolean)) !== false) { + } elseif (($localeConstant = array_search(trim(strtoupper($val)), self::$_localeBoolean)) !== FALSE) { // echo 'Element '.$localeConstant.' is an Excel Constant
'; $val = self::$_ExcelConstants[$localeConstant]; } - $details = array('type' => 'Value', 'value' => $val, 'reference' => null); + $details = array('type' => 'Value', 'value' => $val, 'reference' => NULL); if ($localeConstant) { $details['localeValue'] = $localeConstant; } $output[] = $details; } @@ -2929,9 +3014,9 @@ class PHPExcel_Calculation { ++$index; } elseif ($opCharacter == ')') { // miscellaneous error checking if ($expectingOperand) { - $output[] = array('type' => 'NULL Value', 'value' => self::$_ExcelConstants['NULL'], 'reference' => null); - $expectingOperand = false; - $expectingOperator = true; + $output[] = array('type' => 'NULL Value', 'value' => self::$_ExcelConstants['NULL'], 'reference' => NULL); + $expectingOperand = FALSE; + $expectingOperator = TRUE; } else { return $this->_raiseFormulaError("Formula Error: Unexpected ')'"); } @@ -2967,17 +3052,17 @@ class PHPExcel_Calculation { while($stack->count() > 0 && ($o2 = $stack->last()) && isset(self::$_operators[$o2['value']]) && - @($operatorAssociativity[$opCharacter] ? $operatorPrecedence[$opCharacter] < $operatorPrecedence[$o2['value']] : $operatorPrecedence[$opCharacter] <= $operatorPrecedence[$o2['value']])) { + @(self::$_operatorAssociativity[$opCharacter] ? self::$_operatorPrecedence[$opCharacter] < self::$_operatorPrecedence[$o2['value']] : self::$_operatorPrecedence[$opCharacter] <= self::$_operatorPrecedence[$o2['value']])) { $output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output } $stack->push('Binary Operator','|'); // Put an Intersect Operator on the stack - $expectingOperator = false; + $expectingOperator = FALSE; } } } while (($op = $stack->pop()) !== NULL) { // pop everything off the stack and push onto output - if ((is_array($opCharacter) && $opCharacter['value'] == '(') || ($opCharacter === '(')) + if ((is_array($op) && $op['value'] == '(') || ($op === '(')) return $this->_raiseFormulaError("Formula Error: Expecting ')'"); // if there are any opening braces on the stack, then braces were unbalanced $output[] = $op; } @@ -3001,11 +3086,12 @@ class PHPExcel_Calculation { } // evaluate postfix notation - private function _processTokenStack($tokens, $cellID = null, PHPExcel_Cell $pCell = null) { - if ($tokens == false) return false; + private function _processTokenStack($tokens, $cellID = NULL, PHPExcel_Cell $pCell = NULL) { + if ($tokens == FALSE) return FALSE; - // If we're using cell caching, then $pCell may well be flushed back to the cache (which detaches the parent worksheet), - // so we store the parent worksheet so that we can re-attach it when necessary + // If we're using cell caching, then $pCell may well be flushed back to the cache (which detaches the parent cell collection), + // so we store the parent cell collection so that we can re-attach it when necessary + $pCellWorksheet = ($pCell !== NULL) ? $pCell->getWorksheet() : NULL; $pCellParent = ($pCell !== NULL) ? $pCell->getParent() : null; $stack = new PHPExcel_Calculation_Token_Stack; @@ -3027,9 +3113,9 @@ class PHPExcel_Calculation { // Log what we're doing if ($token == ':') { - $this->_writeDebug('Evaluating Range '.$this->_showValue($operand1Data['reference']).$token.$this->_showValue($operand2Data['reference'])); + $this->_debugLog->writeDebugLog('Evaluating Range ', $this->_showValue($operand1Data['reference']), ' ', $token, ' ', $this->_showValue($operand2Data['reference'])); } else { - $this->_writeDebug('Evaluating '.$this->_showValue($operand1).' '.$token.' '.$this->_showValue($operand2)); + $this->_debugLog->writeDebugLog('Evaluating ', $this->_showValue($operand1), ' ', $token, ' ', $this->_showValue($operand2)); } // Process the operation in the appropriate manner @@ -3046,12 +3132,12 @@ class PHPExcel_Calculation { // Binary Operators case ':' : // Range $sheet1 = $sheet2 = ''; - if (strpos($operand1Data['reference'],'!') !== false) { + if (strpos($operand1Data['reference'],'!') !== FALSE) { list($sheet1,$operand1Data['reference']) = explode('!',$operand1Data['reference']); } else { - $sheet1 = ($pCellParent !== NULL) ? $pCellParent->getTitle() : ''; + $sheet1 = ($pCellParent !== NULL) ? $pCellWorksheet->getTitle() : ''; } - if (strpos($operand2Data['reference'],'!') !== false) { + if (strpos($operand2Data['reference'],'!') !== FALSE) { list($sheet2,$operand2Data['reference']) = explode('!',$operand2Data['reference']); } else { $sheet2 = $sheet1; @@ -3085,13 +3171,13 @@ class PHPExcel_Calculation { } $cellRef = PHPExcel_Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.PHPExcel_Cell::stringFromColumnIndex(max($oCol)).max($oRow); if ($pCellParent !== NULL) { - $cellValue = $this->extractCellRange($cellRef, $pCellParent->getParent()->getSheetByName($sheet1), false); + $cellValue = $this->extractCellRange($cellRef, $this->_workbook->getSheetByName($sheet1), FALSE); } else { return $this->_raiseFormulaError('Unable to access Cell Reference'); } $stack->push('Cell Reference',$cellValue,$cellRef); } else { - $stack->push('Error',PHPExcel_Calculation_Functions::REF(),null); + $stack->push('Error',PHPExcel_Calculation_Functions::REF(),NULL); } break; @@ -3129,14 +3215,14 @@ class PHPExcel_Calculation { // Perform the required operation against the operand 1 matrix, passing in operand 2 $matrixResult = $matrix->concat($operand2); $result = $matrixResult->getArray(); - } catch (Exception $ex) { - $this->_writeDebug('JAMA Matrix Exception: '.$ex->getMessage()); + } catch (PHPExcel_Exception $ex) { + $this->_debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage()); $result = '#VALUE!'; } } else { $result = '"'.str_replace('""','"',self::_unwrapResult($operand1,'"').self::_unwrapResult($operand2,'"')).'"'; } - $this->_writeDebug('Evaluation Result is '.$this->_showTypeDetails($result)); + $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->_showTypeDetails($result)); $stack->push('Value',$result); break; case '|' : // Intersect @@ -3150,7 +3236,7 @@ class PHPExcel_Calculation { } } $cellRef = PHPExcel_Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.PHPExcel_Cell::stringFromColumnIndex(max($oCol)).max($oRow); - $this->_writeDebug('Evaluation Result is '.$this->_showTypeDetails($cellIntersect)); + $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->_showTypeDetails($cellIntersect)); $stack->push('Value',$cellIntersect,$cellRef); break; } @@ -3162,11 +3248,11 @@ class PHPExcel_Calculation { $arg = $arg['value']; if ($token === '~') { // echo 'Token is a negation operator
'; - $this->_writeDebug('Evaluating Negation of '.$this->_showValue($arg)); + $this->_debugLog->writeDebugLog('Evaluating Negation of ', $this->_showValue($arg)); $multiplier = -1; } else { // echo 'Token is a percentile operator
'; - $this->_writeDebug('Evaluating Percentile of '.$this->_showValue($arg)); + $this->_debugLog->writeDebugLog('Evaluating Percentile of ', $this->_showValue($arg)); $multiplier = 0.01; } if (is_array($arg)) { @@ -3175,18 +3261,18 @@ class PHPExcel_Calculation { $matrix1 = new PHPExcel_Shared_JAMA_Matrix($arg); $matrixResult = $matrix1->arrayTimesEquals($multiplier); $result = $matrixResult->getArray(); - } catch (Exception $ex) { - $this->_writeDebug('JAMA Matrix Exception: '.$ex->getMessage()); + } catch (PHPExcel_Exception $ex) { + $this->_debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage()); $result = '#VALUE!'; } - $this->_writeDebug('Evaluation Result is '.$this->_showTypeDetails($result)); + $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->_showTypeDetails($result)); $stack->push('Value',$result); } else { $this->_executeNumericBinaryOperation($cellID,$multiplier,$arg,'*','arrayTimesEquals',$stack); } } elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $token, $matches)) { - $cellRef = null; + $cellRef = NULL; // echo 'Element '.$token.' is a Cell reference
'; if (isset($matches[8])) { // echo 'Reference is a Range of cells
'; @@ -3197,29 +3283,29 @@ class PHPExcel_Calculation { $cellRef = $matches[6].$matches[7].':'.$matches[9].$matches[10]; if ($matches[2] > '') { $matches[2] = trim($matches[2],"\"'"); - if ((strpos($matches[2],'[') !== false) || (strpos($matches[2],']') !== false)) { + if ((strpos($matches[2],'[') !== FALSE) || (strpos($matches[2],']') !== FALSE)) { // It's a Reference to an external workbook (not currently supported) return $this->_raiseFormulaError('Unable to access External Workbook'); } $matches[2] = trim($matches[2],"\"'"); // echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'
'; - $this->_writeDebug('Evaluating Cell Range '.$cellRef.' in worksheet '.$matches[2]); + $this->_debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in worksheet ', $matches[2]); if ($pCellParent !== NULL) { - $cellValue = $this->extractCellRange($cellRef, $pCellParent->getParent()->getSheetByName($matches[2]), false); + $cellValue = $this->extractCellRange($cellRef, $this->_workbook->getSheetByName($matches[2]), FALSE); } else { return $this->_raiseFormulaError('Unable to access Cell Reference'); } - $this->_writeDebug('Evaluation Result for cells '.$cellRef.' in worksheet '.$matches[2].' is '.$this->_showTypeDetails($cellValue)); + $this->_debugLog->writeDebugLog('Evaluation Result for cells ', $cellRef, ' in worksheet ', $matches[2], ' is ', $this->_showTypeDetails($cellValue)); // $cellRef = $matches[2].'!'.$cellRef; } else { // echo '$cellRef='.$cellRef.' in current worksheet
'; - $this->_writeDebug('Evaluating Cell Range '.$cellRef.' in current worksheet'); + $this->_debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in current worksheet'); if ($pCellParent !== NULL) { - $cellValue = $this->extractCellRange($cellRef, $pCellParent, false); + $cellValue = $this->extractCellRange($cellRef, $pCellWorksheet, FALSE); } else { return $this->_raiseFormulaError('Unable to access Cell Reference'); } - $this->_writeDebug('Evaluation Result for cells '.$cellRef.' is '.$this->_showTypeDetails($cellValue)); + $this->_debugLog->writeDebugLog('Evaluation Result for cells ', $cellRef, ' is ', $this->_showTypeDetails($cellValue)); } } } else { @@ -3231,34 +3317,35 @@ class PHPExcel_Calculation { $cellRef = $matches[6].$matches[7]; if ($matches[2] > '') { $matches[2] = trim($matches[2],"\"'"); - if ((strpos($matches[2],'[') !== false) || (strpos($matches[2],']') !== false)) { + if ((strpos($matches[2],'[') !== FALSE) || (strpos($matches[2],']') !== FALSE)) { // It's a Reference to an external workbook (not currently supported) return $this->_raiseFormulaError('Unable to access External Workbook'); } // echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'
'; - $this->_writeDebug('Evaluating Cell '.$cellRef.' in worksheet '.$matches[2]); + $this->_debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in worksheet ', $matches[2]); if ($pCellParent !== NULL) { - if ($pCellParent->getParent()->getSheetByName($matches[2])->cellExists($cellRef)) { - $cellValue = $this->extractCellRange($cellRef, $pCellParent->getParent()->getSheetByName($matches[2]), false); + $cellSheet = $this->_workbook->getSheetByName($matches[2]); + if ($cellSheet && $cellSheet->cellExists($cellRef)) { + $cellValue = $this->extractCellRange($cellRef, $this->_workbook->getSheetByName($matches[2]), FALSE); $pCell->attach($pCellParent); } else { - $cellValue = null; + $cellValue = NULL; } } else { return $this->_raiseFormulaError('Unable to access Cell Reference'); } - $this->_writeDebug('Evaluation Result for cell '.$cellRef.' in worksheet '.$matches[2].' is '.$this->_showTypeDetails($cellValue)); + $this->_debugLog->writeDebugLog('Evaluation Result for cell ', $cellRef, ' in worksheet ', $matches[2], ' is ', $this->_showTypeDetails($cellValue)); // $cellRef = $matches[2].'!'.$cellRef; } else { // echo '$cellRef='.$cellRef.' in current worksheet
'; - $this->_writeDebug('Evaluating Cell '.$cellRef.' in current worksheet'); - if ($pCellParent->cellExists($cellRef)) { - $cellValue = $this->extractCellRange($cellRef, $pCellParent, false); + $this->_debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in current worksheet'); + if ($pCellParent->isDataSet($cellRef)) { + $cellValue = $this->extractCellRange($cellRef, $pCellWorksheet, FALSE); $pCell->attach($pCellParent); } else { - $cellValue = null; + $cellValue = NULL; } - $this->_writeDebug('Evaluation Result for cell '.$cellRef.' is '.$this->_showTypeDetails($cellValue)); + $this->_debugLog->writeDebugLog('Evaluation Result for cell ', $cellRef, ' is ', $this->_showTypeDetails($cellValue)); } } } @@ -3271,7 +3358,7 @@ class PHPExcel_Calculation { $argCount = $stack->pop(); $argCount = $argCount['value']; if ($functionName != 'MKMATRIX') { - $this->_writeDebug('Evaluating Function '.self::_localeFunc($functionName).'() with '.(($argCount == 0) ? 'no' : $argCount).' argument'.(($argCount == 1) ? '' : 's')); + $this->_debugLog->writeDebugLog('Evaluating Function ', self::_localeFunc($functionName), '() with ', (($argCount == 0) ? 'no' : $argCount), ' argument', (($argCount == 1) ? '' : 's')); } if ((isset(self::$_PHPExcelFunctions[$functionName])) || (isset(self::$_controlFunctions[$functionName]))) { // function if (isset(self::$_PHPExcelFunctions[$functionName])) { @@ -3314,30 +3401,30 @@ class PHPExcel_Calculation { // print_r($args); // echo '
'; if ($functionName != 'MKMATRIX') { - if ($this->writeDebugLog) { + if ($this->_debugLog->getWriteDebugLog()) { krsort($argArrayVals); - $this->_writeDebug('Evaluating '. self::_localeFunc($functionName).'( '.implode(self::$_localeArgumentSeparator.' ',PHPExcel_Calculation_Functions::flattenArray($argArrayVals)).' )'); + $this->_debugLog->writeDebugLog('Evaluating ', self::_localeFunc($functionName), '( ', implode(self::$_localeArgumentSeparator.' ',PHPExcel_Calculation_Functions::flattenArray($argArrayVals)), ' )'); } } // Process each argument in turn, building the return value as an array // if (($argCount == 1) && (is_array($args[1])) && ($functionName != 'MKMATRIX')) { // $operand1 = $args[1]; -// $this->_writeDebug('Argument is a matrix: '.$this->_showValue($operand1)); +// $this->_debugLog->writeDebugLog('Argument is a matrix: ', $this->_showValue($operand1)); // $result = array(); // $row = 0; // foreach($operand1 as $args) { // if (is_array($args)) { // foreach($args as $arg) { -// $this->_writeDebug('Evaluating '.self::_localeFunc($functionName).'( '.$this->_showValue($arg).' )'); +// $this->_debugLog->writeDebugLog('Evaluating ', self::_localeFunc($functionName), '( ', $this->_showValue($arg), ' )'); // $r = call_user_func_array($functionCall,$arg); -// $this->_writeDebug('Evaluation Result for '.self::_localeFunc($functionName).'() function call is '.$this->_showTypeDetails($r)); +// $this->_debugLog->writeDebugLog('Evaluation Result for ', self::_localeFunc($functionName), '() function call is ', $this->_showTypeDetails($r)); // $result[$row][] = $r; // } // ++$row; // } else { -// $this->_writeDebug('Evaluating '.self::_localeFunc($functionName).'( '.$this->_showValue($args).' )'); +// $this->_debugLog->writeDebugLog('Evaluating ', self::_localeFunc($functionName), '( ', $this->_showValue($args), ' )'); // $r = call_user_func_array($functionCall,$args); -// $this->_writeDebug('Evaluation Result for '.self::_localeFunc($functionName).'() function call is '.$this->_showTypeDetails($r)); +// $this->_debugLog->writeDebugLog('Evaluation Result for ', self::_localeFunc($functionName), '() function call is ', $this->_showTypeDetails($r)); // $result[] = $r; // } // } @@ -3346,7 +3433,7 @@ class PHPExcel_Calculation { if ($passCellReference) { $args[] = $pCell; } - if (strpos($functionCall,'::') !== false) { + if (strpos($functionCall,'::') !== FALSE) { $result = call_user_func_array(explode('::',$functionCall),$args); } else { foreach($args as &$arg) { @@ -3357,7 +3444,7 @@ class PHPExcel_Calculation { } // } if ($functionName != 'MKMATRIX') { - $this->_writeDebug('Evaluation Result for '.self::_localeFunc($functionName).'() function call is '.$this->_showTypeDetails($result)); + $this->_debugLog->writeDebugLog('Evaluation Result for ', self::_localeFunc($functionName), '() function call is ', $this->_showTypeDetails($result)); } $stack->push('Value',self::_wrapResult($result)); } @@ -3368,7 +3455,7 @@ class PHPExcel_Calculation { $excelConstant = strtoupper($token); // echo 'Token is a PHPExcel constant: '.$excelConstant.'
'; $stack->push('Constant Value',self::$_ExcelConstants[$excelConstant]); - $this->_writeDebug('Evaluating Constant '.$excelConstant.' as '.$this->_showTypeDetails(self::$_ExcelConstants[$excelConstant])); + $this->_debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->_showTypeDetails(self::$_ExcelConstants[$excelConstant])); } elseif ((is_numeric($token)) || ($token === NULL) || (is_bool($token)) || ($token == '') || ($token{0} == '"') || ($token{0} == '#')) { // echo 'Token is a number, boolean, string, null or an Excel error
'; $stack->push('Value',$token); @@ -3377,10 +3464,10 @@ class PHPExcel_Calculation { // echo 'Token is a named range
'; $namedRange = $matches[6]; // echo 'Named Range is '.$namedRange.'
'; - $this->_writeDebug('Evaluating Named Range '.$namedRange); - $cellValue = $this->extractNamedRange($namedRange, ((null !== $pCell) ? $pCellParent : null), false); + $this->_debugLog->writeDebugLog('Evaluating Named Range ', $namedRange); + $cellValue = $this->extractNamedRange($namedRange, ((NULL !== $pCell) ? $pCellWorksheet : NULL), FALSE); $pCell->attach($pCellParent); - $this->_writeDebug('Evaluation Result for named range '.$namedRange.' is '.$this->_showTypeDetails($cellValue)); + $this->_debugLog->writeDebugLog('Evaluation Result for named range ', $namedRange, ' is ', $this->_showTypeDetails($cellValue)); $stack->push('Named Range',$cellValue,$namedRange); } else { return $this->_raiseFormulaError("undefined variable '$token'"); @@ -3399,7 +3486,14 @@ class PHPExcel_Calculation { } // function _processTokenStack() - private function _validateBinaryOperand($cellID,&$operand,&$stack) { + private function _validateBinaryOperand($cellID, &$operand, &$stack) { + if (is_array($operand)) { + if ((count($operand, COUNT_RECURSIVE) - count($operand)) == 1) { + do { + $operand = array_pop($operand); + } while (is_array($operand)); + } + } // Numbers, matrices and booleans can pass straight through, as they're already valid if (is_string($operand)) { // We only need special validations for the operand if it is a string @@ -3410,36 +3504,36 @@ class PHPExcel_Calculation { // If not a numeric, test to see if the value is an Excel error, and so can't be used in normal binary operations if ($operand > '' && $operand{0} == '#') { $stack->push('Value', $operand); - $this->_writeDebug('Evaluation Result is '.$this->_showTypeDetails($operand)); - return false; + $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->_showTypeDetails($operand)); + return FALSE; } elseif (!PHPExcel_Shared_String::convertToNumberIfFraction($operand)) { // If not a numeric or a fraction, then it's a text string, and so can't be used in mathematical binary operations $stack->push('Value', '#VALUE!'); - $this->_writeDebug('Evaluation Result is a '.$this->_showTypeDetails('#VALUE!')); - return false; + $this->_debugLog->writeDebugLog('Evaluation Result is a ', $this->_showTypeDetails('#VALUE!')); + return FALSE; } } } // return a true if the value of the operand is one that we can use in normal binary operations - return true; + return TRUE; } // function _validateBinaryOperand() - private function _executeBinaryComparisonOperation($cellID,$operand1,$operand2,$operation,&$stack,$recursingArrays=false) { + private function _executeBinaryComparisonOperation($cellID, $operand1, $operand2, $operation, &$stack, $recursingArrays=FALSE) { // If we're dealing with matrix operations, we want a matrix result if ((is_array($operand1)) || (is_array($operand2))) { $result = array(); if ((is_array($operand1)) && (!is_array($operand2))) { foreach($operand1 as $x => $operandData) { - $this->_writeDebug('Evaluating Comparison '.$this->_showValue($operandData).' '.$operation.' '.$this->_showValue($operand2)); + $this->_debugLog->writeDebugLog('Evaluating Comparison ', $this->_showValue($operandData), ' ', $operation, ' ', $this->_showValue($operand2)); $this->_executeBinaryComparisonOperation($cellID,$operandData,$operand2,$operation,$stack); $r = $stack->pop(); $result[$x] = $r['value']; } } elseif ((!is_array($operand1)) && (is_array($operand2))) { foreach($operand2 as $x => $operandData) { - $this->_writeDebug('Evaluating Comparison '.$this->_showValue($operand1).' '.$operation.' '.$this->_showValue($operandData)); + $this->_debugLog->writeDebugLog('Evaluating Comparison ', $this->_showValue($operand1), ' ', $operation, ' ', $this->_showValue($operandData)); $this->_executeBinaryComparisonOperation($cellID,$operand1,$operandData,$operation,$stack); $r = $stack->pop(); $result[$x] = $r['value']; @@ -3447,32 +3541,54 @@ class PHPExcel_Calculation { } else { if (!$recursingArrays) { self::_checkMatrixOperands($operand1,$operand2,2); } foreach($operand1 as $x => $operandData) { - $this->_writeDebug('Evaluating Comparison '.$this->_showValue($operandData).' '.$operation.' '.$this->_showValue($operand2[$x])); - $this->_executeBinaryComparisonOperation($cellID,$operandData,$operand2[$x],$operation,$stack,true); + $this->_debugLog->writeDebugLog('Evaluating Comparison ', $this->_showValue($operandData), ' ', $operation, ' ', $this->_showValue($operand2[$x])); + $this->_executeBinaryComparisonOperation($cellID,$operandData,$operand2[$x],$operation,$stack,TRUE); $r = $stack->pop(); $result[$x] = $r['value']; } } // Log the result details - $this->_writeDebug('Comparison Evaluation Result is '.$this->_showTypeDetails($result)); + $this->_debugLog->writeDebugLog('Comparison Evaluation Result is ', $this->_showTypeDetails($result)); // And push the result onto the stack $stack->push('Array',$result); - return true; + return TRUE; } // Simple validate the two operands if they are string values if (is_string($operand1) && $operand1 > '' && $operand1{0} == '"') { $operand1 = self::_unwrapResult($operand1); } if (is_string($operand2) && $operand2 > '' && $operand2{0} == '"') { $operand2 = self::_unwrapResult($operand2); } + // Use case insensitive comparaison if not OpenOffice mode + if (PHPExcel_Calculation_Functions::getCompatibilityMode() != PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) + { + if (is_string($operand1)) { + $operand1 = strtoupper($operand1); + } + + if (is_string($operand2)) { + $operand2 = strtoupper($operand2); + } + } + + $useLowercaseFirstComparison = is_string($operand1) && is_string($operand2) && PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE; + // execute the necessary operation switch ($operation) { // Greater than case '>': - $result = ($operand1 > $operand2); + if ($useLowercaseFirstComparison) { + $result = $this->strcmpLowercaseFirst($operand1, $operand2) > 0; + } else { + $result = ($operand1 > $operand2); + } break; // Less than case '<': - $result = ($operand1 < $operand2); + if ($useLowercaseFirstComparison) { + $result = $this->strcmpLowercaseFirst($operand1, $operand2) < 0; + } else { + $result = ($operand1 < $operand2); + } break; // Equality case '=': @@ -3480,11 +3596,19 @@ class PHPExcel_Calculation { break; // Greater than or equal case '>=': - $result = ($operand1 >= $operand2); + if ($useLowercaseFirstComparison) { + $result = $this->strcmpLowercaseFirst($operand1, $operand2) >= 0; + } else { + $result = ($operand1 >= $operand2); + } break; // Less than or equal case '<=': - $result = ($operand1 <= $operand2); + if ($useLowercaseFirstComparison) { + $result = $this->strcmpLowercaseFirst($operand1, $operand2) <= 0; + } else { + $result = ($operand1 <= $operand2); + } break; // Inequality case '<>': @@ -3493,109 +3617,102 @@ class PHPExcel_Calculation { } // Log the result details - $this->_writeDebug('Evaluation Result is '.$this->_showTypeDetails($result)); + $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->_showTypeDetails($result)); // And push the result onto the stack $stack->push('Value',$result); - return true; + return TRUE; } // function _executeBinaryComparisonOperation() + /** + * Compare two strings in the same way as strcmp() except that lowercase come before uppercase letters + * @param string $str1 + * @param string $str2 + * @return integer + */ + private function strcmpLowercaseFirst($str1, $str2) + { + $from = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; + $to = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + $inversedStr1 = strtr($str1, $from, $to); + $inversedStr2 = strtr($str2, $from, $to); + + return strcmp($inversedStr1, $inversedStr2); + } private function _executeNumericBinaryOperation($cellID,$operand1,$operand2,$operation,$matrixFunction,&$stack) { // Validate the two operands - if (!$this->_validateBinaryOperand($cellID,$operand1,$stack)) return false; - if (!$this->_validateBinaryOperand($cellID,$operand2,$stack)) return false; + if (!$this->_validateBinaryOperand($cellID,$operand1,$stack)) return FALSE; + if (!$this->_validateBinaryOperand($cellID,$operand2,$stack)) return FALSE; - $executeMatrixOperation = false; // If either of the operands is a matrix, we need to treat them both as matrices // (converting the other operand to a matrix if need be); then perform the required // matrix operation if ((is_array($operand1)) || (is_array($operand2))) { - // Ensure that both operands are arrays/matrices - $executeMatrixOperation = true; - $mSize = array(); - list($mSize[],$mSize[],$mSize[],$mSize[]) = self::_checkMatrixOperands($operand1,$operand2,2); + // Ensure that both operands are arrays/matrices of the same size + self::_checkMatrixOperands($operand1, $operand2, 2); - // But if they're both single cell matrices, then we can treat them as simple values - if (array_sum($mSize) == 4) { - $executeMatrixOperation = false; - $operand1 = $operand1[0][0]; - $operand2 = $operand2[0][0]; - } - } - - if ($executeMatrixOperation) { try { // Convert operand 1 from a PHP array to a matrix $matrix = new PHPExcel_Shared_JAMA_Matrix($operand1); // Perform the required operation against the operand 1 matrix, passing in operand 2 $matrixResult = $matrix->$matrixFunction($operand2); $result = $matrixResult->getArray(); - } catch (Exception $ex) { - $this->_writeDebug('JAMA Matrix Exception: '.$ex->getMessage()); + } catch (PHPExcel_Exception $ex) { + $this->_debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage()); $result = '#VALUE!'; } } else { if ((PHPExcel_Calculation_Functions::getCompatibilityMode() != PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) && - ((is_string($operand1) && !is_numeric($operand1)) || (is_string($operand2) && !is_numeric($operand2)))) { + ((is_string($operand1) && !is_numeric($operand1) && strlen($operand1)>0) || + (is_string($operand2) && !is_numeric($operand2) && strlen($operand2)>0))) { $result = PHPExcel_Calculation_Functions::VALUE(); } else { // If we're dealing with non-matrix operations, execute the necessary operation switch ($operation) { // Addition case '+': - $result = $operand1+$operand2; + $result = $operand1 + $operand2; break; // Subtraction case '-': - $result = $operand1-$operand2; + $result = $operand1 - $operand2; break; // Multiplication case '*': - $result = $operand1*$operand2; + $result = $operand1 * $operand2; break; // Division case '/': if ($operand2 == 0) { // Trap for Divide by Zero error $stack->push('Value','#DIV/0!'); - $this->_writeDebug('Evaluation Result is '.$this->_showTypeDetails('#DIV/0!')); - return false; + $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->_showTypeDetails('#DIV/0!')); + return FALSE; } else { - $result = $operand1/$operand2; + $result = $operand1 / $operand2; } break; // Power case '^': - $result = pow($operand1,$operand2); + $result = pow($operand1, $operand2); break; } } } // Log the result details - $this->_writeDebug('Evaluation Result is '.$this->_showTypeDetails($result)); + $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->_showTypeDetails($result)); // And push the result onto the stack $stack->push('Value',$result); - return true; + return TRUE; } // function _executeNumericBinaryOperation() - private function _writeDebug($message) { - // Only write the debug log if logging is enabled - if ($this->writeDebugLog) { - if ($this->echoDebugLog) { - echo implode(' -> ',$this->debugLogStack).' -> '.$message,'
'; - } - $this->debugLog[] = implode(' -> ',$this->debugLogStack).' -> '.$message; - } - } // function _writeDebug() - - // trigger an error, but nicely, if need be protected function _raiseFormulaError($errorMessage) { $this->formulaError = $errorMessage; - $this->debugLogStack = array(); - if (!$this->suppressFormulaErrors) throw new Exception($errorMessage); + $this->_cyclicReferenceStack->clear(); + if (!$this->suppressFormulaErrors) throw new PHPExcel_Calculation_Exception($errorMessage); trigger_error($errorMessage, E_USER_ERROR); } // function _raiseFormulaError() @@ -3603,49 +3720,51 @@ class PHPExcel_Calculation { /** * Extract range values * - * @param string &$pRange String based range representation + * @param string &$pRange String based range representation * @param PHPExcel_Worksheet $pSheet Worksheet + * @param boolean $resetLog Flag indicating whether calculation log should be reset or not * @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned. - * @throws Exception + * @throws PHPExcel_Calculation_Exception */ - public function extractCellRange(&$pRange = 'A1', PHPExcel_Worksheet $pSheet = null, $resetLog=true) { + public function extractCellRange(&$pRange = 'A1', PHPExcel_Worksheet $pSheet = NULL, $resetLog = TRUE) { // Return value $returnValue = array (); -// echo 'extractCellRange('.$pRange.')
'; +// echo 'extractCellRange('.$pRange.')',PHP_EOL; if ($pSheet !== NULL) { -// echo 'Passed sheet name is '.$pSheet->getTitle().'
'; -// echo 'Range reference is '.$pRange.'
'; + $pSheetName = $pSheet->getTitle(); +// echo 'Passed sheet name is '.$pSheetName.PHP_EOL; +// echo 'Range reference is '.$pRange.PHP_EOL; if (strpos ($pRange, '!') !== false) { -// echo '$pRange reference includes sheet reference
'; - $worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pRange, true); - $pSheet = $pSheet->getParent()->getSheetByName($worksheetReference[0]); -// echo 'New sheet name is '.$pSheet->getTitle().'
'; - $pRange = $worksheetReference[1]; -// echo 'Adjusted Range reference is '.$pRange.'
'; +// echo '$pRange reference includes sheet reference',PHP_EOL; + list($pSheetName,$pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true); +// echo 'New sheet name is '.$pSheetName,PHP_EOL; +// echo 'Adjusted Range reference is '.$pRange,PHP_EOL; + $pSheet = $this->_workbook->getSheetByName($pSheetName); } // Extract range $aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange); - $pRange = $pSheet->getTitle().'!'.$pRange; + $pRange = $pSheetName.'!'.$pRange; if (!isset($aReferences[1])) { // Single cell in range - list($currentCol,$currentRow) = sscanf($aReferences[0],'%[A-Z]%d'); + sscanf($aReferences[0],'%[A-Z]%d', $currentCol, $currentRow); + $cellValue = NULL; if ($pSheet->cellExists($aReferences[0])) { $returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog); } else { - $returnValue[$currentRow][$currentCol] = null; + $returnValue[$currentRow][$currentCol] = NULL; } } else { // Extract cell data for all cells in the range foreach ($aReferences as $reference) { // Extract range - list($currentCol,$currentRow) = sscanf($reference,'%[A-Z]%d'); - + sscanf($reference,'%[A-Z]%d', $currentCol, $currentRow); + $cellValue = NULL; if ($pSheet->cellExists($reference)) { $returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog); } else { - $returnValue[$currentRow][$currentCol] = null; + $returnValue[$currentRow][$currentCol] = NULL; } } } @@ -3662,23 +3781,24 @@ class PHPExcel_Calculation { * @param string &$pRange String based range representation * @param PHPExcel_Worksheet $pSheet Worksheet * @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned. - * @throws Exception + * @param boolean $resetLog Flag indicating whether calculation log should be reset or not + * @throws PHPExcel_Calculation_Exception */ - public function extractNamedRange(&$pRange = 'A1', PHPExcel_Worksheet $pSheet = null, $resetLog=true) { + public function extractNamedRange(&$pRange = 'A1', PHPExcel_Worksheet $pSheet = NULL, $resetLog = TRUE) { // Return value $returnValue = array (); // echo 'extractNamedRange('.$pRange.')
'; if ($pSheet !== NULL) { -// echo 'Current sheet name is '.$pSheet->getTitle().'
'; + $pSheetName = $pSheet->getTitle(); +// echo 'Current sheet name is '.$pSheetName.'
'; // echo 'Range reference is '.$pRange.'
'; if (strpos ($pRange, '!') !== false) { -// echo '$pRange reference includes sheet reference
'; - $worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pRange, true); - $pSheet = $pSheet->getParent()->getSheetByName($worksheetReference[0]); -// echo 'New sheet name is '.$pSheet->getTitle().'
'; - $pRange = $worksheetReference[1]; -// echo 'Adjusted Range reference is '.$pRange.'
'; +// echo '$pRange reference includes sheet reference',PHP_EOL; + list($pSheetName,$pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true); +// echo 'New sheet name is '.$pSheetName,PHP_EOL; +// echo 'Adjusted Range reference is '.$pRange,PHP_EOL; + $pSheet = $this->_workbook->getSheetByName($pSheetName); } // Named range? @@ -3713,10 +3833,11 @@ class PHPExcel_Calculation { if (!isset($aReferences[1])) { // Single cell (or single column or row) in range list($currentCol,$currentRow) = PHPExcel_Cell::coordinateFromString($aReferences[0]); + $cellValue = NULL; if ($pSheet->cellExists($aReferences[0])) { $returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog); } else { - $returnValue[$currentRow][$currentCol] = null; + $returnValue[$currentRow][$currentCol] = NULL; } } else { // Extract cell data for all cells in the range @@ -3724,10 +3845,11 @@ class PHPExcel_Calculation { // Extract range list($currentCol,$currentRow) = PHPExcel_Cell::coordinateFromString($reference); // echo 'NAMED RANGE: $currentCol='.$currentCol.' $currentRow='.$currentRow.'
'; + $cellValue = NULL; if ($pSheet->cellExists($reference)) { $returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog); } else { - $returnValue[$currentRow][$currentCol] = null; + $returnValue[$currentRow][$currentCol] = NULL; } } } @@ -3751,7 +3873,7 @@ class PHPExcel_Calculation { if (isset(self::$_PHPExcelFunctions[$pFunction])) { return (self::$_PHPExcelFunctions[$pFunction]['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY'); } else { - return false; + return FALSE; } } // function isImplemented() diff --git a/htdocs/includes/phpexcel/PHPExcel/Calculation/Database.php b/htdocs/includes/phpexcel/PHPExcel/Calculation/Database.php index 4a6c8f72c9a..c3e86d761cb 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Calculation/Database.php +++ b/htdocs/includes/phpexcel/PHPExcel/Calculation/Database.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -41,7 +41,7 @@ if (!defined('PHPEXCEL_ROOT')) { * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Calculation_Database { diff --git a/htdocs/includes/phpexcel/PHPExcel/Calculation/DateTime.php b/htdocs/includes/phpexcel/PHPExcel/Calculation/DateTime.php index 3b5dc45aaaa..debd1315073 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Calculation/DateTime.php +++ b/htdocs/includes/phpexcel/PHPExcel/Calculation/DateTime.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -41,7 +41,7 @@ if (!defined('PHPEXCEL_ROOT')) { * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Calculation_DateTime { @@ -56,6 +56,18 @@ class PHPExcel_Calculation_DateTime { } // function _isLeapYear() + /** + * Return the number of days between two dates based on a 360 day calendar + * + * @param integer $startDay Day of month of the start date + * @param integer $startMonth Month of the start date + * @param integer $startYear Year of the start date + * @param integer $endDay Day of month of the start date + * @param integer $endMonth Month of the start date + * @param integer $endYear Year of the start date + * @param boolean $methodUS Whether to use the US method or the European method of calculation + * @return integer Number of days between the start date and the end date + */ private static function _dateDiff360($startDay, $startMonth, $startYear, $endDay, $endMonth, $endYear, $methodUS) { if ($startDay == 31) { --$startDay; @@ -92,7 +104,7 @@ class PHPExcel_Calculation_DateTime { (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC)) { return PHPExcel_Calculation_Functions::VALUE(); } - if ((is_object($dateValue)) && ($dateValue instanceof PHPExcel_Shared_Date::$dateTimeObjectType)) { + if ((is_object($dateValue)) && ($dateValue instanceof DateTime)) { $dateValue = PHPExcel_Shared_Date::PHPToExcel($dateValue); } else { $saveReturnDateType = PHPExcel_Calculation_Functions::getReturnDateType(); @@ -238,6 +250,10 @@ class PHPExcel_Calculation_DateTime { * Excel Function: * DATE(year,month,day) * + * PHPExcel is a lot more forgiving than MS Excel when passing non numeric values to this function. + * A Month name or abbreviation (English only at this point) such as 'January' or 'Jan' will still be accepted, + * as will a day value with a suffix (e.g. '21st' rather than simply 21); again only English language. + * * @access public * @category Date/Time Functions * @param integer $year The value of the year argument can include one to four digits. @@ -278,6 +294,14 @@ class PHPExcel_Calculation_DateTime { $month = PHPExcel_Calculation_Functions::flattenSingleValue($month); $day = PHPExcel_Calculation_Functions::flattenSingleValue($day); + if (($month !== NULL) && (!is_numeric($month))) { + $month = PHPExcel_Shared_Date::monthStringToNumber($month); + } + + if (($day !== NULL) && (!is_numeric($day))) { + $day = PHPExcel_Shared_Date::dayStringToNumber($day); + } + $year = ($year !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($year) : 0; $month = ($month !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($month) : 0; $day = ($day !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($day) : 0; @@ -720,6 +744,10 @@ class PHPExcel_Calculation_DateTime { return PHPExcel_Calculation_Functions::VALUE(); } + if (!is_bool($method)) { + return PHPExcel_Calculation_Functions::VALUE(); + } + // Execute function $PHPStartDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($startDate); $startDay = $PHPStartDateObject->format('j'); diff --git a/htdocs/includes/phpexcel/PHPExcel/Calculation/Engineering.php b/htdocs/includes/phpexcel/PHPExcel/Calculation/Engineering.php index cfaffafbab5..7e32aa87081 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Calculation/Engineering.php +++ b/htdocs/includes/phpexcel/PHPExcel/Calculation/Engineering.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -45,7 +45,7 @@ define('EULER', 2.71828182845904523536); * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Calculation_Engineering { @@ -741,8 +741,6 @@ class PHPExcel_Calculation_Engineering { /** - * _cleanComplex - * * Cleans the leading characters in a complex number string * * @param string $complexNumber The complex number to clean @@ -756,20 +754,25 @@ class PHPExcel_Calculation_Engineering { return $complexNumber; } - - private static function _nbrConversionFormat($xVal,$places) { + /** + * Formats a number base string value with leading zeroes + * + * @param string $xVal The "number" to pad + * @param integer $places The length that we want to pad this value + * @return string The padded "number" + */ + private static function _nbrConversionFormat($xVal, $places) { if (!is_null($places)) { if (strlen($xVal) <= $places) { - return substr(str_pad($xVal,$places,'0',STR_PAD_LEFT),-10); + return substr(str_pad($xVal, $places, '0', STR_PAD_LEFT), -10); } else { return PHPExcel_Calculation_Functions::NaN(); } } - return substr($xVal,-10); + return substr($xVal, -10); } // function _nbrConversionFormat() - /** * BESSELI * @@ -1932,7 +1935,7 @@ class PHPExcel_Calculation_Engineering { /** * IMLOG2 * - * Returns the common logarithm (base 10) of a complex number in x + yi or x + yj text format. + * Returns the base-2 logarithm of a complex number in x + yi or x + yj text format. * * Excel Function: * IMLOG2(complexNumber) @@ -2356,7 +2359,6 @@ class PHPExcel_Calculation_Engineering { * Returns an array of units of measure, for a specified conversion group, or for all groups * * @param string $group The group whose units of measure you want to retrieve - * * @return array */ public static function getConversionGroupUnits($group = NULL) { @@ -2373,6 +2375,7 @@ class PHPExcel_Calculation_Engineering { /** * getConversionGroupUnitDetails * + * @param string $group The group whose units of measure you want to retrieve * @return array */ public static function getConversionGroupUnitDetails($group = NULL) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Calculation/Exception.php b/htdocs/includes/phpexcel/PHPExcel/Calculation/Exception.php index 31aa287a2a4..037f7884af1 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Calculation/Exception.php +++ b/htdocs/includes/phpexcel/PHPExcel/Calculation/Exception.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,9 +31,9 @@ * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Calculation_Exception extends Exception { +class PHPExcel_Calculation_Exception extends PHPExcel_Exception { /** * Error handler callback * diff --git a/htdocs/includes/phpexcel/PHPExcel/Calculation/ExceptionHandler.php b/htdocs/includes/phpexcel/PHPExcel/Calculation/ExceptionHandler.php index 8b89a8fd6f7..389f6477834 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Calculation/ExceptionHandler.php +++ b/htdocs/includes/phpexcel/PHPExcel/Calculation/ExceptionHandler.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ /** @@ -30,7 +30,7 @@ * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Calculation_ExceptionHandler { /** diff --git a/htdocs/includes/phpexcel/PHPExcel/Calculation/Financial.php b/htdocs/includes/phpexcel/PHPExcel/Calculation/Financial.php index 8534258e863..525b172109a 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Calculation/Financial.php +++ b/htdocs/includes/phpexcel/PHPExcel/Calculation/Financial.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -48,7 +48,7 @@ define('FINANCIAL_PRECISION', 1.0e-08); * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Calculation_Financial { @@ -1206,13 +1206,22 @@ class PHPExcel_Calculation_Financial { /** * FVSCHEDULE * + * Returns the future value of an initial principal after applying a series of compound interest rates. + * Use FVSCHEDULE to calculate the future value of an investment with a variable or adjustable rate. + * + * Excel Function: + * FVSCHEDULE(principal,schedule) + * + * @param float $principal The present value. + * @param float[] $schedule An array of interest rates to apply. + * @return float */ public static function FVSCHEDULE($principal, $schedule) { $principal = PHPExcel_Calculation_Functions::flattenSingleValue($principal); $schedule = PHPExcel_Calculation_Functions::flattenArray($schedule); - foreach($schedule as $n) { - $principal *= 1 + $n; + foreach($schedule as $rate) { + $principal *= 1 + $rate; } return $principal; @@ -1227,13 +1236,13 @@ class PHPExcel_Calculation_Financial { * Excel Function: * INTRATE(settlement,maturity,investment,redemption[,basis]) * - * @param mixed settlement The security's settlement date. + * @param mixed $settlement The security's settlement date. * The security settlement date is the date after the issue date when the security is traded to the buyer. - * @param mixed maturity The security's maturity date. + * @param mixed $maturity The security's maturity date. * The maturity date is the date when the security expires. - * @param integer investment The amount invested in the security. - * @param integer redemption The amount to be received at maturity. - * @param integer basis The type of day count to use. + * @param integer $investment The amount invested in the security. + * @param integer $redemption The amount to be received at maturity. + * @param integer $basis The type of day count to use. * 0 or omitted US (NASD) 30/360 * 1 Actual/actual * 2 Actual/360 @@ -1273,6 +1282,9 @@ class PHPExcel_Calculation_Financial { * * Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate. * + * Excel Function: + * IPMT(rate,per,nper,pv[,fv][,type]) + * * @param float $rate Interest rate per period * @param int $per Period for which we want to find the interest * @param int $nper Number of periods @@ -1302,7 +1314,25 @@ class PHPExcel_Calculation_Financial { return $interestAndPrincipal[0]; } // function IPMT() - + /** + * IRR + * + * Returns the internal rate of return for a series of cash flows represented by the numbers in values. + * These cash flows do not have to be even, as they would be for an annuity. However, the cash flows must occur + * at regular intervals, such as monthly or annually. The internal rate of return is the interest rate received + * for an investment consisting of payments (negative values) and income (positive values) that occur at regular + * periods. + * + * Excel Function: + * IRR(values[,guess]) + * + * @param float[] $values An array or a reference to cells that contain numbers for which you want + * to calculate the internal rate of return. + * Values must contain at least one positive value and one negative value to + * calculate the internal rate of return. + * @param float $guess A number that you guess is close to the result of IRR + * @return float + */ public static function IRR($values, $guess = 0.1) { if (!is_array($values)) return PHPExcel_Calculation_Functions::VALUE(); $values = PHPExcel_Calculation_Functions::flattenArray($values); @@ -1336,28 +1366,30 @@ class PHPExcel_Calculation_Financial { $dx *= 0.5; $x_mid = $rtb + $dx; $f_mid = self::NPV($x_mid, $values); - if ($f_mid <= 0.0) $rtb = $x_mid; - if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION)) return $x_mid; + if ($f_mid <= 0.0) + $rtb = $x_mid; + if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION)) + return $x_mid; } return PHPExcel_Calculation_Functions::VALUE(); } // function IRR() /** - * ISPMT + * ISPMT * - * Returns the interest payment for an investment based on an interest rate and a constant payment schedule. + * Returns the interest payment for an investment based on an interest rate and a constant payment schedule. * - * Excel Function: - * =ISPMT(interest_rate, period, number_payments, PV) + * Excel Function: + * =ISPMT(interest_rate, period, number_payments, PV) * - * interest_rate is the interest rate for the investment + * interest_rate is the interest rate for the investment * - * period is the period to calculate the interest rate. It must be betweeen 1 and number_payments. + * period is the period to calculate the interest rate. It must be betweeen 1 and number_payments. * - * number_payments is the number of payments for the annuity + * number_payments is the number of payments for the annuity * - * PV is the loan amount or present value of the payments + * PV is the loan amount or present value of the payments */ public static function ISPMT() { // Return value @@ -1384,6 +1416,22 @@ class PHPExcel_Calculation_Financial { } // function ISPMT() + /** + * MIRR + * + * Returns the modified internal rate of return for a series of periodic cash flows. MIRR considers both + * the cost of the investment and the interest received on reinvestment of cash. + * + * Excel Function: + * MIRR(values,finance_rate, reinvestment_rate) + * + * @param float[] $values An array or a reference to cells that contain a series of payments and + * income occurring at regular intervals. + * Payments are negative value, income is positive values. + * @param float $finance_rate The interest rate you pay on the money used in the cash flows + * @param float $reinvestment_rate The interest rate you receive on the cash flows as you reinvest them + * @return float + */ public static function MIRR($values, $finance_rate, $reinvestment_rate) { if (!is_array($values)) return PHPExcel_Calculation_Functions::VALUE(); $values = PHPExcel_Calculation_Functions::flattenArray($values); @@ -1475,14 +1523,11 @@ class PHPExcel_Calculation_Financial { } } // function NPER() - /** * NPV * * Returns the Net Present Value of a cash flow series given a discount rate. * - * @param float Discount interest rate - * @param array Cash flow series * @return float */ public static function NPV() { @@ -1505,7 +1550,6 @@ class PHPExcel_Calculation_Financial { return $returnValue; } // function NPV() - /** * PMT * diff --git a/htdocs/includes/phpexcel/PHPExcel/Calculation/FormulaParser.php b/htdocs/includes/phpexcel/PHPExcel/Calculation/FormulaParser.php index 7318a5b74b4..754a638d4ca 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Calculation/FormulaParser.php +++ b/htdocs/includes/phpexcel/PHPExcel/Calculation/FormulaParser.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -54,7 +54,7 @@ PARTLY BASED ON: * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Calculation_FormulaParser { /* Character constants */ @@ -93,13 +93,13 @@ class PHPExcel_Calculation_FormulaParser { * Create a new PHPExcel_Calculation_FormulaParser * * @param string $pFormula Formula to parse - * @throws Exception + * @throws PHPExcel_Calculation_Exception */ public function __construct($pFormula = '') { // Check parameters if (is_null($pFormula)) { - throw new Exception("Invalid parameter passed: formula"); + throw new PHPExcel_Calculation_Exception("Invalid parameter passed: formula"); } // Initialise values @@ -122,13 +122,13 @@ class PHPExcel_Calculation_FormulaParser { * * @param int $pId Token id * @return string - * @throws Exception + * @throws PHPExcel_Calculation_Exception */ public function getToken($pId = 0) { if (isset($this->_tokens[$pId])) { return $this->_tokens[$pId]; } else { - throw new Exception("Token with id $pId does not exist."); + throw new PHPExcel_Calculation_Exception("Token with id $pId does not exist."); } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Calculation/FormulaToken.php b/htdocs/includes/phpexcel/PHPExcel/Calculation/FormulaToken.php index b8a2571aebf..fd5e2e530fd 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Calculation/FormulaToken.php +++ b/htdocs/includes/phpexcel/PHPExcel/Calculation/FormulaToken.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -55,7 +55,7 @@ PARTLY BASED ON: * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Calculation_FormulaToken { /* Token types */ diff --git a/htdocs/includes/phpexcel/PHPExcel/Calculation/Function.php b/htdocs/includes/phpexcel/PHPExcel/Calculation/Function.php index 88f8c3b5471..7299834eb69 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Calculation/Function.php +++ b/htdocs/includes/phpexcel/PHPExcel/Calculation/Function.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Calculation_Function { /* Function categories */ @@ -74,7 +74,7 @@ class PHPExcel_Calculation_Function { * @param string $pCategory Category (represented by CATEGORY_*) * @param string $pExcelName Excel function name * @param string $pPHPExcelName PHPExcel function mapping - * @throws Exception + * @throws PHPExcel_Calculation_Exception */ public function __construct($pCategory = NULL, $pExcelName = NULL, $pPHPExcelName = NULL) { @@ -84,7 +84,7 @@ class PHPExcel_Calculation_Function { $this->_excelName = $pExcelName; $this->_phpExcelName = $pPHPExcelName; } else { - throw new Exception("Invalid parameters passed."); + throw new PHPExcel_Calculation_Exception("Invalid parameters passed."); } } @@ -101,13 +101,13 @@ class PHPExcel_Calculation_Function { * Set Category (represented by CATEGORY_*) * * @param string $value - * @throws Exception + * @throws PHPExcel_Calculation_Exception */ public function setCategory($value = null) { if (!is_null($value)) { $this->_category = $value; } else { - throw new Exception("Invalid parameter passed."); + throw new PHPExcel_Calculation_Exception("Invalid parameter passed."); } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Calculation/Functions.php b/htdocs/includes/phpexcel/PHPExcel/Calculation/Functions.php index e0a5629559d..71bfa19b6a1 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Calculation/Functions.php +++ b/htdocs/includes/phpexcel/PHPExcel/Calculation/Functions.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -54,7 +54,7 @@ define('PRECISION', 8.88E-016); * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Calculation_Functions { @@ -270,7 +270,7 @@ class PHPExcel_Calculation_Functions { * * @access public * @category Error Returns - * @return string #REF! + * @return string #NULL! */ public static function NULL() { return self::$_errorCodes['null']; @@ -308,13 +308,20 @@ class PHPExcel_Calculation_Functions { public static function _ifCondition($condition) { $condition = PHPExcel_Calculation_Functions::flattenSingleValue($condition); + if (!isset($condition{0})) + $condition = '=""'; if (!in_array($condition{0},array('>', '<', '='))) { if (!is_numeric($condition)) { $condition = PHPExcel_Calculation::_wrapResult(strtoupper($condition)); } return '='.$condition; } else { preg_match('/([<>=]+)(.*)/',$condition,$matches); list(,$operator,$operand) = $matches; - if (!is_numeric($operand)) { $operand = PHPExcel_Calculation::_wrapResult(strtoupper($operand)); } + + if (!is_numeric($operand)) { + $operand = str_replace('"', '""', $operand); + $operand = PHPExcel_Calculation::_wrapResult(strtoupper($operand)); + } + return $operator.$operand; } } // function _ifCondition() @@ -489,7 +496,7 @@ class PHPExcel_Calculation_Functions { * @return string Version information */ public static function VERSION() { - return 'PHPExcel 1.7.8, 2012-10-12'; + return 'PHPExcel 1.8.0, 2014-03-02'; } // function VERSION() @@ -687,100 +694,6 @@ if (!function_exists('atanh')) { } // function atanh() } -if (!function_exists('money_format')) { - function money_format($format, $number) { - $regex = array( '/%((?:[\^!\-]|\+|\(|\=.)*)([0-9]+)?(?:#([0-9]+))?', - '(?:\.([0-9]+))?([in%])/' - ); - $regex = implode('', $regex); - if (setlocale(LC_MONETARY, null) == '') { - setlocale(LC_MONETARY, ''); - } - $locale = localeconv(); - $number = floatval($number); - if (!preg_match($regex, $format, $fmatch)) { - trigger_error("No format specified or invalid format", E_USER_WARNING); - return $number; - } - $flags = array( 'fillchar' => preg_match('/\=(.)/', $fmatch[1], $match) ? $match[1] : ' ', - 'nogroup' => preg_match('/\^/', $fmatch[1]) > 0, - 'usesignal' => preg_match('/\+|\(/', $fmatch[1], $match) ? $match[0] : '+', - 'nosimbol' => preg_match('/\!/', $fmatch[1]) > 0, - 'isleft' => preg_match('/\-/', $fmatch[1]) > 0 - ); - $width = trim($fmatch[2]) ? (int)$fmatch[2] : 0; - $left = trim($fmatch[3]) ? (int)$fmatch[3] : 0; - $right = trim($fmatch[4]) ? (int)$fmatch[4] : $locale['int_frac_digits']; - $conversion = $fmatch[5]; - $positive = true; - if ($number < 0) { - $positive = false; - $number *= -1; - } - $letter = $positive ? 'p' : 'n'; - $prefix = $suffix = $cprefix = $csuffix = $signal = ''; - if (!$positive) { - $signal = $locale['negative_sign']; - switch (true) { - case $locale['n_sign_posn'] == 0 || $flags['usesignal'] == '(': - $prefix = '('; - $suffix = ')'; - break; - case $locale['n_sign_posn'] == 1: - $prefix = $signal; - break; - case $locale['n_sign_posn'] == 2: - $suffix = $signal; - break; - case $locale['n_sign_posn'] == 3: - $cprefix = $signal; - break; - case $locale['n_sign_posn'] == 4: - $csuffix = $signal; - break; - } - } - if (!$flags['nosimbol']) { - $currency = $cprefix; - $currency .= ($conversion == 'i' ? $locale['int_curr_symbol'] : $locale['currency_symbol']); - $currency .= $csuffix; - $currency = iconv('ISO-8859-1','UTF-8',$currency); - } else { - $currency = ''; - } - $space = $locale["{$letter}_sep_by_space"] ? ' ' : ''; - - if (!isset($locale['mon_decimal_point']) || empty($locale['mon_decimal_point'])) { - $locale['mon_decimal_point'] = (!isset($locale['decimal_point']) || empty($locale['decimal_point'])) ? - $locale['decimal_point'] : - '.'; - } - - $number = number_format($number, $right, $locale['mon_decimal_point'], $flags['nogroup'] ? '' : $locale['mon_thousands_sep'] ); - $number = explode($locale['mon_decimal_point'], $number); - - $n = strlen($prefix) + strlen($currency); - if ($left > 0 && $left > $n) { - if ($flags['isleft']) { - $number[0] .= str_repeat($flags['fillchar'], $left - $n); - } else { - $number[0] = str_repeat($flags['fillchar'], $left - $n) . $number[0]; - } - } - $number = implode($locale['mon_decimal_point'], $number); - if ($locale["{$letter}_cs_precedes"]) { - $number = $prefix . $currency . $space . $number . $suffix; - } else { - $number = $prefix . $number . $space . $currency . $suffix; - } - if ($width > 0) { - $number = str_pad($number, $width, $flags['fillchar'], $flags['isleft'] ? STR_PAD_RIGHT : STR_PAD_LEFT); - } - $format = str_replace($fmatch[0], $number, $format); - return $format; - } // function money_format() -} - // // Strangely, PHP doesn't have a mb_str_replace multibyte function diff --git a/htdocs/includes/phpexcel/PHPExcel/Calculation/Logical.php b/htdocs/includes/phpexcel/PHPExcel/Calculation/Logical.php index 80f2a2650d9..bb206a14257 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Calculation/Logical.php +++ b/htdocs/includes/phpexcel/PHPExcel/Calculation/Logical.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -41,7 +41,7 @@ if (!defined('PHPEXCEL_ROOT')) { * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Calculation_Logical { diff --git a/htdocs/includes/phpexcel/PHPExcel/Calculation/LookupRef.php b/htdocs/includes/phpexcel/PHPExcel/Calculation/LookupRef.php index c8246903f2e..e1285d90409 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Calculation/LookupRef.php +++ b/htdocs/includes/phpexcel/PHPExcel/Calculation/LookupRef.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -41,7 +41,7 @@ if (!defined('PHPEXCEL_ROOT')) { * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Calculation_LookupRef { @@ -251,8 +251,9 @@ class PHPExcel_Calculation_LookupRef { * * @access public * @category Logical Functions - * @param string $linkURL Value to check, is also the value returned when no error - * @param string $displayName Value to return when testValue is an error condition + * @param string $linkURL Value to check, is also the value returned when no error + * @param string $displayName Value to return when testValue is an error condition + * @param PHPExcel_Cell $pCell The cell to set the hyperlink in * @return mixed The value of $displayName (or $linkURL if $displayName was blank) */ public static function HYPERLINK($linkURL = '', $displayName = null, PHPExcel_Cell $pCell = null) { @@ -287,13 +288,14 @@ class PHPExcel_Calculation_LookupRef { * * NOTE - INDIRECT() does not yet support the optional a1 parameter introduced in Excel 2010 * - * @param cellAddress An array or array formula, or a reference to a range of cells for which you want the number of rows + * @param cellAddress $cellAddress The cell address of the current cell (containing this formula) + * @param PHPExcel_Cell $pCell The current cell (containing this formula) * @return mixed The cells referenced by cellAddress * * @todo Support for the optional a1 parameter introduced in Excel 2010 * */ - public static function INDIRECT($cellAddress=Null, PHPExcel_Cell $pCell = null) { + public static function INDIRECT($cellAddress = NULL, PHPExcel_Cell $pCell = NULL) { $cellAddress = PHPExcel_Calculation_Functions::flattenSingleValue($cellAddress); if (is_null($cellAddress) || $cellAddress === '') { return PHPExcel_Calculation_Functions::REF(); @@ -307,29 +309,30 @@ class PHPExcel_Calculation_LookupRef { if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) || ((!is_null($cellAddress2)) && (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress2, $matches)))) { - if (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $cellAddress1, $matches)) { return PHPExcel_Calculation_Functions::REF(); } - if (strpos($cellAddress,'!') !== false) { - list($sheetName,$cellAddress) = explode('!',$cellAddress); - $pSheet = $pCell->getParent()->getParent()->getSheetByName($sheetName); + if (strpos($cellAddress,'!') !== FALSE) { + list($sheetName, $cellAddress) = explode('!',$cellAddress); + $sheetName = trim($sheetName, "'"); + $pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName); } else { - $pSheet = $pCell->getParent(); + $pSheet = $pCell->getWorksheet(); } - return PHPExcel_Calculation::getInstance()->extractNamedRange($cellAddress, $pSheet, False); + return PHPExcel_Calculation::getInstance()->extractNamedRange($cellAddress, $pSheet, FALSE); } - if (strpos($cellAddress,'!') !== false) { + if (strpos($cellAddress,'!') !== FALSE) { list($sheetName,$cellAddress) = explode('!',$cellAddress); - $pSheet = $pCell->getParent()->getParent()->getSheetByName($sheetName); + $sheetName = trim($sheetName, "'"); + $pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName); } else { - $pSheet = $pCell->getParent(); + $pSheet = $pCell->getWorksheet(); } - return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, False); + return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, FALSE); } // function INDIRECT() @@ -373,9 +376,10 @@ class PHPExcel_Calculation_LookupRef { return PHPExcel_Calculation_Functions::REF(); } - $sheetName = null; + $sheetName = NULL; if (strpos($cellAddress,"!")) { list($sheetName,$cellAddress) = explode("!",$cellAddress); + $sheetName = trim($sheetName, "'"); } if (strpos($cellAddress,":")) { list($startCell,$endCell) = explode(":",$cellAddress); @@ -416,10 +420,10 @@ class PHPExcel_Calculation_LookupRef { $cellAddress .= ':'.$endCellColumn.$endCellRow; } - if ($sheetName !== null) { - $pSheet = $pCell->getParent()->getParent()->getSheetByName($sheetName); + if ($sheetName !== NULL) { + $pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName); } else { - $pSheet = $pCell->getParent(); + $pSheet = $pCell->getWorksheet(); } return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, False); @@ -458,7 +462,7 @@ class PHPExcel_Calculation_LookupRef { return PHPExcel_Calculation_Functions::VALUE(); } $chosenEntry = floor($chosenEntry); - if (($chosenEntry <= 0) || ($chosenEntry > $entryCount)) { + if (($chosenEntry < 0) || ($chosenEntry > $entryCount)) { return PHPExcel_Calculation_Functions::VALUE(); } @@ -717,7 +721,8 @@ class PHPExcel_Calculation_LookupRef { $rowNumber = $rowValue = False; foreach($lookup_array as $rowKey => $rowData) { - if (strtolower($rowData[$firstColumn]) > strtolower($lookup_value)) { + if ((is_numeric($lookup_value) && is_numeric($rowData[$firstColumn]) && ($rowData[$firstColumn] > $lookup_value)) || + (!is_numeric($lookup_value) && !is_numeric($rowData[$firstColumn]) && (strtolower($rowData[$firstColumn]) > strtolower($lookup_value)))) { break; } $rowNumber = $rowKey; @@ -730,7 +735,11 @@ class PHPExcel_Calculation_LookupRef { return PHPExcel_Calculation_Functions::NA(); } else { // otherwise return the appropriate value - return $lookup_array[$rowNumber][$returnColumn]; + $result = $lookup_array[$rowNumber][$returnColumn]; + if ((is_numeric($lookup_value) && is_numeric($result)) || + (!is_numeric($lookup_value) && !is_numeric($result))) { + return $result; + } } } @@ -738,6 +747,70 @@ class PHPExcel_Calculation_LookupRef { } // function VLOOKUP() +/** + * HLOOKUP + * The HLOOKUP function searches for value in the top-most row of lookup_array and returns the value in the same column based on the index_number. + * @param lookup_value The value that you want to match in lookup_array + * @param lookup_array The range of cells being searched + * @param index_number The row number in table_array from which the matching value must be returned. The first row is 1. + * @param not_exact_match Determines if you are looking for an exact match based on lookup_value. + * @return mixed The value of the found cell + */ + public static function HLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match=true) { + $lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value); + $index_number = PHPExcel_Calculation_Functions::flattenSingleValue($index_number); + $not_exact_match = PHPExcel_Calculation_Functions::flattenSingleValue($not_exact_match); + + // index_number must be greater than or equal to 1 + if ($index_number < 1) { + return PHPExcel_Calculation_Functions::VALUE(); + } + + // index_number must be less than or equal to the number of columns in lookup_array + if ((!is_array($lookup_array)) || (empty($lookup_array))) { + return PHPExcel_Calculation_Functions::REF(); + } else { + $f = array_keys($lookup_array); + $firstRow = array_pop($f); + if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) { + return PHPExcel_Calculation_Functions::REF(); + } else { + $columnKeys = array_keys($lookup_array[$firstRow]); + $firstkey = $f[0] - 1; + $returnColumn = $firstkey + $index_number; + $firstColumn = array_shift($f); + } + } + + if (!$not_exact_match) { + $firstRowH = asort($lookup_array[$firstColumn]); + } + + $rowNumber = $rowValue = False; + foreach($lookup_array[$firstColumn] as $rowKey => $rowData) { + if ((is_numeric($lookup_value) && is_numeric($rowData) && ($rowData > $lookup_value)) || + (!is_numeric($lookup_value) && !is_numeric($rowData) && (strtolower($rowData) > strtolower($lookup_value)))) { + break; + } + $rowNumber = $rowKey; + $rowValue = $rowData; + } + + if ($rowNumber !== false) { + if ((!$not_exact_match) && ($rowValue != $lookup_value)) { + // if an exact match is required, we have what we need to return an appropriate response + return PHPExcel_Calculation_Functions::NA(); + } else { + // otherwise return the appropriate value + $result = $lookup_array[$returnColumn][$rowNumber]; + return $result; + } + } + + return PHPExcel_Calculation_Functions::NA(); + } // function HLOOKUP() + + /** * LOOKUP * The LOOKUP function searches for value either from a one-row or one-column range or from an array. diff --git a/htdocs/includes/phpexcel/PHPExcel/Calculation/MathTrig.php b/htdocs/includes/phpexcel/PHPExcel/Calculation/MathTrig.php index 79c573b2774..10930552b35 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Calculation/MathTrig.php +++ b/htdocs/includes/phpexcel/PHPExcel/Calculation/MathTrig.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -41,7 +41,7 @@ if (!defined('PHPEXCEL_ROOT')) { * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Calculation_MathTrig { @@ -79,7 +79,7 @@ class PHPExcel_Calculation_MathTrig { * ATAN2 * * This function calculates the arc tangent of the two variables x and y. It is similar to - * calculating the arc tangent of y x, except that the signs of both arguments are used + * calculating the arc tangent of y ÷ x, except that the signs of both arguments are used * to determine the quadrant of the result. * The arctangent is the angle from the x-axis to a line containing the origin (0, 0) and a * point with coordinates (xCoordinate, yCoordinate). The angle is given in radians between @@ -495,13 +495,13 @@ class PHPExcel_Calculation_MathTrig { * * @access public * @category Mathematical and Trigonometric Functions - * @param float $value The positive real number for which you want the logarithm + * @param float $number The positive real number for which you want the logarithm * @param float $base The base of the logarithm. If base is omitted, it is assumed to be 10. * @return float */ public static function LOG_BASE($number = NULL, $base = 10) { $number = PHPExcel_Calculation_Functions::flattenSingleValue($number); - $base = (is_null($base)) ? 10 : (float) PHPExcel_Calculation_Functions::flattenSingleValue($base); + $base = (is_null($base)) ? 10 : (float) PHPExcel_Calculation_Functions::flattenSingleValue($base); if ((!is_numeric($base)) || (!is_numeric($number))) return PHPExcel_Calculation_Functions::VALUE(); @@ -547,7 +547,7 @@ class PHPExcel_Calculation_MathTrig { try { $matrix = new PHPExcel_Shared_JAMA_Matrix($matrixData); return $matrix->det(); - } catch (Exception $ex) { + } catch (PHPExcel_Exception $ex) { return PHPExcel_Calculation_Functions::VALUE(); } } // function MDETERM() @@ -589,7 +589,7 @@ class PHPExcel_Calculation_MathTrig { try { $matrix = new PHPExcel_Shared_JAMA_Matrix($matrixData); return $matrix->inverse()->getArray(); - } catch (Exception $ex) { + } catch (PHPExcel_Exception $ex) { return PHPExcel_Calculation_Functions::VALUE(); } } // function MINVERSE() @@ -642,7 +642,7 @@ class PHPExcel_Calculation_MathTrig { } return $matrixA->times($matrixB)->getArray(); - } catch (Exception $ex) { + } catch (PHPExcel_Exception $ex) { return PHPExcel_Calculation_Functions::VALUE(); } } // function MMULT() @@ -1164,7 +1164,11 @@ class PHPExcel_Calculation_MathTrig { $condition = PHPExcel_Calculation_Functions::_ifCondition($condition); // Loop through arguments foreach ($aArgs as $key => $arg) { - if (!is_numeric($arg)) { $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); } + if (!is_numeric($arg)) { + $arg = str_replace('"', '""', $arg); + $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); + } + $testCondition = '='.$arg.$condition; if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { // Is it a value within our criteria @@ -1252,7 +1256,8 @@ class PHPExcel_Calculation_MathTrig { /** * SUMX2MY2 * - * @param mixed $value Value to check + * @param mixed[] $matrixData1 Matrix #1 + * @param mixed[] $matrixData2 Matrix #2 * @return float */ public static function SUMX2MY2($matrixData1,$matrixData2) { @@ -1281,7 +1286,8 @@ class PHPExcel_Calculation_MathTrig { /** * SUMX2PY2 * - * @param mixed $value Value to check + * @param mixed[] $matrixData1 Matrix #1 + * @param mixed[] $matrixData2 Matrix #2 * @return float */ public static function SUMX2PY2($matrixData1,$matrixData2) { @@ -1310,7 +1316,8 @@ class PHPExcel_Calculation_MathTrig { /** * SUMXMY2 * - * @param mixed $value Value to check + * @param mixed[] $matrixData1 Matrix #1 + * @param mixed[] $matrixData2 Matrix #2 * @return float */ public static function SUMXMY2($matrixData1,$matrixData2) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Calculation/Statistical.php b/htdocs/includes/phpexcel/PHPExcel/Calculation/Statistical.php index 2fbb163ef7b..32b9c781d9c 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Calculation/Statistical.php +++ b/htdocs/includes/phpexcel/PHPExcel/Calculation/Statistical.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -57,7 +57,7 @@ define('SQRT2PI', 2.5066282746310005024157652848110452530069867406099); * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Calculation_Statistical { @@ -834,6 +834,7 @@ class PHPExcel_Calculation_Statistical { * @category Mathematical and Trigonometric Functions * @param mixed $arg,... Data values * @param string $condition The criteria that defines which cells will be checked. + * @param mixed[] $averageArgs Data values * @return float */ public static function AVERAGEIF($aArgs,$condition,$averageArgs = array()) { @@ -912,6 +913,8 @@ class PHPExcel_Calculation_Statistical { * @param float $probability Probability at which you want to evaluate the distribution * @param float $alpha Parameter to the distribution * @param float $beta Parameter to the distribution + * @param float $rMin Minimum value + * @param float $rMax Maximum value * @param boolean $cumulative * @return float * @@ -1954,9 +1957,9 @@ class PHPExcel_Calculation_Statistical { * @param boolean A logical value specifying whether to return additional regression statistics. * @return array */ - public static function LINEST($yValues,$xValues=null,$const=True,$stats=False) { - $const = (is_null($const)) ? True : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const); - $stats = (is_null($stats)) ? False : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($stats); + public static function LINEST($yValues, $xValues = NULL, $const = TRUE, $stats = FALSE) { + $const = (is_null($const)) ? TRUE : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const); + $stats = (is_null($stats)) ? FALSE : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($stats); if (is_null($xValues)) $xValues = range(1,count(PHPExcel_Calculation_Functions::flattenArray($yValues))); if (!self::_checkTrendArrays($yValues,$xValues)) { @@ -2059,7 +2062,9 @@ class PHPExcel_Calculation_Statistical { * * Returns the inverse of the normal cumulative distribution * - * @param float $value + * @param float $probability + * @param float $mean + * @param float $stdDev * @return float * * @todo Try implementing P J Acklam's refinement algorithm for greater @@ -2088,6 +2093,8 @@ class PHPExcel_Calculation_Statistical { * with parameters mean and standard_dev. * * @param float $value + * @param float $mean + * @param float $stdDev * @return float */ public static function LOGNORMDIST($value, $mean, $stdDev) { @@ -3621,14 +3628,14 @@ class PHPExcel_Calculation_Statistical { * Returns the Weibull distribution. Use this distribution in reliability * analysis, such as calculating a device's mean time to failure. * - * @param float $value - * @param float $alpha Alpha Parameter - * @param float $beta Beta Parameter + * @param float $dataSet + * @param float $m0 Alpha Parameter + * @param float $sigma Beta Parameter * @param boolean $cumulative * @return float * */ - public static function ZTEST($dataSet, $m0, $sigma=null) { + public static function ZTEST($dataSet, $m0, $sigma = NULL) { $dataSet = PHPExcel_Calculation_Functions::flattenArrayIndexed($dataSet); $m0 = PHPExcel_Calculation_Functions::flattenSingleValue($m0); $sigma = PHPExcel_Calculation_Functions::flattenSingleValue($sigma); diff --git a/htdocs/includes/phpexcel/PHPExcel/Calculation/TextData.php b/htdocs/includes/phpexcel/PHPExcel/Calculation/TextData.php index 3289645f519..d1ba2728e0f 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Calculation/TextData.php +++ b/htdocs/includes/phpexcel/PHPExcel/Calculation/TextData.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -41,7 +41,7 @@ if (!defined('PHPEXCEL_ROOT')) { * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Calculation_TextData { @@ -89,7 +89,7 @@ class PHPExcel_Calculation_TextData { /** * TRIMNONPRINTABLE * - * @param mixed $value Value to check + * @param mixed $stringValue Value to check * @return string */ public static function TRIMNONPRINTABLE($stringValue = '') { @@ -113,7 +113,7 @@ class PHPExcel_Calculation_TextData { /** * TRIMSPACES * - * @param mixed $value Value to check + * @param mixed $stringValue Value to check * @return string */ public static function TRIMSPACES($stringValue = '') { @@ -133,7 +133,7 @@ class PHPExcel_Calculation_TextData { /** * ASCIICODE * - * @param string $character Value + * @param string $characters Value * @return int */ public static function ASCIICODE($characters) { @@ -208,16 +208,17 @@ class PHPExcel_Calculation_TextData { } $decimals = floor($decimals); + $mask = '$#,##0'; if ($decimals > 0) { - return money_format('%.'.$decimals.'n',$value); + $mask .= '.' . str_repeat('0',$decimals); } else { $round = pow(10,abs($decimals)); if ($value < 0) { $round = 0-$round; } - $value = PHPExcel_Calculation_MathTrig::MROUND($value,$round); - // The implementation of money_format used if the standard PHP function is not available can't handle decimal places of 0, - // so we display to 1 dp and chop off that character and the decimal separator using substr - return substr(money_format('%.1n',$value),0,-2); + $value = PHPExcel_Calculation_MathTrig::MROUND($value, $round); } + + return PHPExcel_Style_NumberFormat::toFormattedString($value, $mask); + } // function DOLLAR() @@ -296,7 +297,9 @@ class PHPExcel_Calculation_TextData { /** * FIXEDFORMAT * - * @param mixed $value Value to check + * @param mixed $value Value to check + * @param integer $decimals + * @param boolean $no_commas * @return boolean */ public static function FIXEDFORMAT($value, $decimals = 2, $no_commas = FALSE) { @@ -407,7 +410,6 @@ class PHPExcel_Calculation_TextData { * STRINGLENGTH * * @param string $value Value - * @param int $chars Number of characters * @return string */ public static function STRINGLENGTH($value = '') { @@ -440,11 +442,7 @@ class PHPExcel_Calculation_TextData { $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); } - if (function_exists('mb_convert_case')) { - return mb_convert_case($mixedCaseString, MB_CASE_LOWER, 'UTF-8'); - } else { - return strtoupper($mixedCaseString); - } + return PHPExcel_Shared_String::StrToLower($mixedCaseString); } // function LOWERCASE() @@ -463,11 +461,7 @@ class PHPExcel_Calculation_TextData { $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); } - if (function_exists('mb_convert_case')) { - return mb_convert_case($mixedCaseString, MB_CASE_UPPER, 'UTF-8'); - } else { - return strtoupper($mixedCaseString); - } + return PHPExcel_Shared_String::StrToUpper($mixedCaseString); } // function UPPERCASE() @@ -486,20 +480,17 @@ class PHPExcel_Calculation_TextData { $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); } - if (function_exists('mb_convert_case')) { - return mb_convert_case($mixedCaseString, MB_CASE_TITLE, 'UTF-8'); - } else { - return ucwords($mixedCaseString); - } + return PHPExcel_Shared_String::StrToTitle($mixedCaseString); } // function PROPERCASE() /** * REPLACE * - * @param string $value Value - * @param int $start Start character - * @param int $chars Number of characters + * @param string $oldText String to modify + * @param int $start Start character + * @param int $chars Number of characters + * @param string $newText String to replace in defined position * @return string */ public static function REPLACE($oldText = '', $start = 1, $chars = null, $newText) { @@ -565,7 +556,7 @@ class PHPExcel_Calculation_TextData { /** * RETURNSTRING * - * @param mixed $value Value to check + * @param mixed $testValue Value to check * @return boolean */ public static function RETURNSTRING($testValue = '') { @@ -582,6 +573,7 @@ class PHPExcel_Calculation_TextData { * TEXTFORMAT * * @param mixed $value Value to check + * @param string $format Format mask to use * @return boolean */ public static function TEXTFORMAT($value,$format) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Calculation/Token/Stack.php b/htdocs/includes/phpexcel/PHPExcel/Calculation/Token/Stack.php index ea7efa0c923..821f3bd280e 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Calculation/Token/Stack.php +++ b/htdocs/includes/phpexcel/PHPExcel/Calculation/Token/Stack.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,24 +20,53 @@ * * @category PHPExcel * @package PHPExcel_Calculation - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ +/** + * PHPExcel_Calculation_Token_Stack + * + * @category PHPExcel_Calculation_Token_Stack + * @package PHPExcel_Calculation + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) + */ class PHPExcel_Calculation_Token_Stack { + /** + * The parser stack for formulae + * + * @var mixed[] + */ private $_stack = array(); + + /** + * Count of entries in the parser stack + * + * @var integer + */ private $_count = 0; + /** + * Return the number of entries on the stack + * + * @return integer + */ public function count() { return $this->_count; } // function count() - - public function push($type,$value,$reference=null) { + /** + * Push a new entry onto the stack + * + * @param mixed $type + * @param mixed $value + * @param mixed $reference + */ + public function push($type, $value, $reference = NULL) { $this->_stack[$this->_count++] = array('type' => $type, 'value' => $value, 'reference' => $reference @@ -50,24 +79,37 @@ class PHPExcel_Calculation_Token_Stack { } } // function push() - + /** + * Pop the last entry from the stack + * + * @return mixed + */ public function pop() { if ($this->_count > 0) { return $this->_stack[--$this->_count]; } - return null; + return NULL; } // function pop() - - public function last($n=1) { - if ($this->_count-$n < 0) { - return null; + /** + * Return an entry from the stack without removing it + * + * @param integer $n number indicating how far back in the stack we want to look + * @return mixed + */ + public function last($n = 1) { + if ($this->_count - $n < 0) { + return NULL; } - return $this->_stack[$this->_count-$n]; + return $this->_stack[$this->_count - $n]; } // function last() - - function __construct() { + /** + * Clear the stack + */ + function clear() { + $this->_stack = array(); + $this->_count = 0; } } // class PHPExcel_Calculation_Token_Stack diff --git a/htdocs/includes/phpexcel/PHPExcel/Cell.php b/htdocs/includes/phpexcel/PHPExcel/Cell.php index 75996f2942f..1788559fd30 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Cell.php +++ b/htdocs/includes/phpexcel/PHPExcel/Cell.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Cell - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Cell - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Cell { @@ -50,20 +50,6 @@ class PHPExcel_Cell */ private static $_valueBinder = NULL; - /** - * Column of the cell - * - * @var string - */ - private $_column; - - /** - * Row of the cell - * - * @var int - */ - private $_row; - /** * Value of the cell * @@ -93,7 +79,7 @@ class PHPExcel_Cell /** * Parent worksheet * - * @var PHPExcel_Worksheet + * @var PHPExcel_CachedObjectStorage_CacheBase */ private $_parent; @@ -117,7 +103,8 @@ class PHPExcel_Cell * @return void **/ public function notifyCacheController() { - $this->_parent->getCellCacheController()->updateCacheData($this); + $this->_parent->updateCacheData($this); + return $this; } @@ -125,7 +112,9 @@ class PHPExcel_Cell $this->_parent = NULL; } - public function attach($parent) { + public function attach(PHPExcel_CachedObjectStorage_CacheBase $parent) { + + $this->_parent = $parent; } @@ -133,24 +122,18 @@ class PHPExcel_Cell /** * Create a new Cell * - * @param string $pColumn - * @param int $pRow * @param mixed $pValue * @param string $pDataType * @param PHPExcel_Worksheet $pSheet * @throws PHPExcel_Exception */ - public function __construct($pColumn = 'A', $pRow = 1, $pValue = NULL, $pDataType = NULL, PHPExcel_Worksheet $pSheet = NULL) + public function __construct($pValue = NULL, $pDataType = NULL, PHPExcel_Worksheet $pSheet = NULL) { - // Initialise cell coordinate - $this->_column = strtoupper($pColumn); - $this->_row = $pRow; - // Initialise cell value $this->_value = $pValue; - // Set worksheet - $this->_parent = $pSheet; + // Set worksheet cache + $this->_parent = $pSheet->getCellCacheController(); // Set datatype? if ($pDataType !== NULL) { @@ -174,7 +157,7 @@ class PHPExcel_Cell */ public function getColumn() { - return $this->_column; + return $this->_parent->getCurrentColumn(); } /** @@ -184,7 +167,7 @@ class PHPExcel_Cell */ public function getRow() { - return $this->_row; + return $this->_parent->getCurrentRow(); } /** @@ -194,7 +177,7 @@ class PHPExcel_Cell */ public function getCoordinate() { - return $this->_column . $this->_row; + return $this->_parent->getCurrentAddress(); } /** @@ -216,7 +199,7 @@ class PHPExcel_Cell { return (string) PHPExcel_Style_NumberFormat::toFormattedString( $this->getCalculatedValue(), - $this->_parent->getParent()->getCellXfByIndex($this->getXfIndex()) + $this->getWorksheet()->getParent()->getCellXfByIndex($this->getXfIndex()) ->getNumberFormat()->getFormatCode() ); } @@ -250,10 +233,12 @@ class PHPExcel_Cell { // set the value according to data type switch ($pDataType) { + case PHPExcel_Cell_DataType::TYPE_NULL: + $this->_value = $pValue; + break; case PHPExcel_Cell_DataType::TYPE_STRING2: $pDataType = PHPExcel_Cell_DataType::TYPE_STRING; case PHPExcel_Cell_DataType::TYPE_STRING: - case PHPExcel_Cell_DataType::TYPE_NULL: case PHPExcel_Cell_DataType::TYPE_INLINE: $this->_value = PHPExcel_Cell_DataType::checkString($pValue); break; @@ -285,43 +270,48 @@ class PHPExcel_Cell * * @deprecated Since version 1.7.8 for planned changes to cell for array formula handling * + * @param boolean $resetLog Whether the calculation engine logger should be reset or not * @return mixed * @throws PHPExcel_Exception */ public function getCalculatedValue($resetLog = TRUE) { -// echo 'Cell '.$this->getCoordinate().' value is a '.$this->_dataType.' with a value of '.$this->getValue().'
'; +//echo 'Cell '.$this->getCoordinate().' value is a '.$this->_dataType.' with a value of '.$this->getValue().PHP_EOL; if ($this->_dataType == PHPExcel_Cell_DataType::TYPE_FORMULA) { try { -// echo 'Cell value for '.$this->getCoordinate().' is a formula: Calculating value
'; - $result = PHPExcel_Calculation::getInstance()->calculateCellValue($this,$resetLog); -// echo $this->getCoordinate().' calculation result is '.$result.'
'; - } catch ( Exception $ex ) { +//echo 'Cell value for '.$this->getCoordinate().' is a formula: Calculating value'.PHP_EOL; + $result = PHPExcel_Calculation::getInstance( + $this->getWorksheet()->getParent() + )->calculateCellValue($this,$resetLog); +//echo $this->getCoordinate().' calculation result is '.$result.PHP_EOL; + // We don't yet handle array returns + if (is_array($result)) { + while (is_array($result)) { + $result = array_pop($result); + } + } + } catch ( PHPExcel_Exception $ex ) { if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->_calculatedValue !== NULL)) { -// echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().'
'; +//echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL; return $this->_calculatedValue; // Fallback for calculations referencing external files. } -// echo 'Calculation Exception: '.$ex->getMessage().'
'; +//echo 'Calculation Exception: '.$ex->getMessage().PHP_EOL; $result = '#N/A'; - throw( - new PHPExcel_Exception( - $this->getParent()->getTitle().'!'.$this->getCoordinate().' -> '.$ex->getMessage() - ) + throw new PHPExcel_Calculation_Exception( + $this->getWorksheet()->getTitle().'!'.$this->getCoordinate().' -> '.$ex->getMessage() ); } if ($result === '#Not Yet Implemented') { -// echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().'
'; +//echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL; return $this->_calculatedValue; // Fallback if calculation engine does not support the formula. } -// echo 'Returning calculated value of '.$result.' for cell '.$this->getCoordinate().'
'; +//echo 'Returning calculated value of '.$result.' for cell '.$this->getCoordinate().PHP_EOL; return $result; + } elseif($this->_value instanceof PHPExcel_RichText) { +// echo 'Cell value for '.$this->getCoordinate().' is rich text: Returning data value of '.$this->_value.'
'; + return $this->_value->getPlainText(); } - -// if ($this->_value === NULL) { -// echo 'Cell '.$this->getCoordinate().' has no value, formula or otherwise
'; -// return NULL; -// } // echo 'Cell value for '.$this->getCoordinate().' is not a formula: Returning data value of '.$this->_value.'
'; return $this->_value; } @@ -382,6 +372,16 @@ class PHPExcel_Cell return $this->notifyCacheController(); } + /** + * Identify if the cell contains a formula + * + * @return boolean + */ + public function isFormula() + { + return $this->_dataType == PHPExcel_Cell_DataType::TYPE_FORMULA; + } + /** * Does this cell contain Data validation rules? * @@ -394,7 +394,7 @@ class PHPExcel_Cell throw new PHPExcel_Exception('Cannot check for data validation when cell is not bound to a worksheet'); } - return $this->_parent->dataValidationExists($this->getCoordinate()); + return $this->getWorksheet()->dataValidationExists($this->getCoordinate()); } /** @@ -409,7 +409,7 @@ class PHPExcel_Cell throw new PHPExcel_Exception('Cannot get data validation for cell that is not bound to a worksheet'); } - return $this->_parent->getDataValidation($this->getCoordinate()); + return $this->getWorksheet()->getDataValidation($this->getCoordinate()); } /** @@ -425,7 +425,7 @@ class PHPExcel_Cell throw new PHPExcel_Exception('Cannot set data validation for cell that is not bound to a worksheet'); } - $this->_parent->setDataValidation($this->getCoordinate(), $pDataValidation); + $this->getWorksheet()->setDataValidation($this->getCoordinate(), $pDataValidation); return $this->notifyCacheController(); } @@ -442,7 +442,7 @@ class PHPExcel_Cell throw new PHPExcel_Exception('Cannot check for hyperlink when cell is not bound to a worksheet'); } - return $this->_parent->hyperlinkExists($this->getCoordinate()); + return $this->getWorksheet()->hyperlinkExists($this->getCoordinate()); } /** @@ -457,7 +457,7 @@ class PHPExcel_Cell throw new PHPExcel_Exception('Cannot get hyperlink for cell that is not bound to a worksheet'); } - return $this->_parent->getHyperlink($this->getCoordinate()); + return $this->getWorksheet()->getHyperlink($this->getCoordinate()); } /** @@ -473,7 +473,7 @@ class PHPExcel_Cell throw new PHPExcel_Exception('Cannot set hyperlink for cell that is not bound to a worksheet'); } - $this->_parent->setHyperlink($this->getCoordinate(), $pHyperlink); + $this->getWorksheet()->setHyperlink($this->getCoordinate(), $pHyperlink); return $this->notifyCacheController(); } @@ -481,12 +481,31 @@ class PHPExcel_Cell /** * Get parent worksheet * - * @return PHPExcel_Worksheet + * @return PHPExcel_CachedObjectStorage_CacheBase */ public function getParent() { return $this->_parent; } + /** + * Get parent worksheet + * + * @return PHPExcel_Worksheet + */ + public function getWorksheet() { + return $this->_parent->getParent(); + } + + /** + * Get cell style + * + * @return PHPExcel_Style + */ + public function getStyle() + { + return $this->getWorksheet()->getParent()->getCellXfByIndex($this->getXfIndex()); + } + /** * Re-bind parent * @@ -494,7 +513,7 @@ class PHPExcel_Cell * @return PHPExcel_Cell */ public function rebindParent(PHPExcel_Worksheet $parent) { - $this->_parent = $parent; + $this->_parent = $parent->getCellCacheController(); return $this->notifyCacheController(); } @@ -727,7 +746,6 @@ class PHPExcel_Cell * * @param string $pString * @return int Column index (base 1 !!!) - * @throws Exception */ public static function columnIndexFromString($pString = 'A') { @@ -825,8 +843,8 @@ class PHPExcel_Cell // Range... list($rangeStart, $rangeEnd) = $range; - list($startCol, $startRow) = sscanf($rangeStart,'%[A-Z]%d'); - list($endCol, $endRow) = sscanf($rangeEnd,'%[A-Z]%d'); + sscanf($rangeStart,'%[A-Z]%d', $startCol, $startRow); + sscanf($rangeEnd,'%[A-Z]%d', $endCol, $endRow); $endCol++; // Current data @@ -848,7 +866,7 @@ class PHPExcel_Cell // Sort the result by column and row $sortKeys = array(); foreach (array_unique($returnValue) as $coord) { - list($column,$row) = sscanf($coord,'%[A-Z]%d'); + sscanf($coord,'%[A-Z]%d', $column, $row); $sortKeys[sprintf('%3s%09d',$column,$row)] = $coord; } ksort($sortKeys); @@ -861,16 +879,16 @@ class PHPExcel_Cell * Compare 2 cells * * @param PHPExcel_Cell $a Cell a - * @param PHPExcel_Cell $a Cell b + * @param PHPExcel_Cell $b Cell b * @return int Result of comparison (always -1 or 1, never zero!) */ public static function compareCells(PHPExcel_Cell $a, PHPExcel_Cell $b) { - if ($a->_row < $b->_row) { + if ($a->getRow() < $b->getRow()) { return -1; - } elseif ($a->_row > $b->_row) { + } elseif ($a->getRow() > $b->getRow()) { return 1; - } elseif (self::columnIndexFromString($a->_column) < self::columnIndexFromString($b->_column)) { + } elseif (self::columnIndexFromString($a->getColumn()) < self::columnIndexFromString($b->getColumn())) { return -1; } else { return 1; @@ -894,11 +912,11 @@ class PHPExcel_Cell * Set value binder to use * * @param PHPExcel_Cell_IValueBinder $binder - * @throws Exception + * @throws PHPExcel_Exception */ public static function setValueBinder(PHPExcel_Cell_IValueBinder $binder = NULL) { if ($binder === NULL) { - throw new Exception("A PHPExcel_Cell_IValueBinder is required for PHPExcel to function correctly."); + throw new PHPExcel_Exception("A PHPExcel_Cell_IValueBinder is required for PHPExcel to function correctly."); } self::$_valueBinder = $binder; diff --git a/htdocs/includes/phpexcel/PHPExcel/Cell/AdvancedValueBinder.php b/htdocs/includes/phpexcel/PHPExcel/Cell/AdvancedValueBinder.php index 3603f5ee61d..00a2b57fa12 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Cell/AdvancedValueBinder.php +++ b/htdocs/includes/phpexcel/PHPExcel/Cell/AdvancedValueBinder.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,19 +20,19 @@ * * @category PHPExcel * @package PHPExcel_Cell - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.8.0, 2014-03-02 */ /** PHPExcel root directory */ if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); + require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); } @@ -41,150 +41,152 @@ if (!defined('PHPEXCEL_ROOT')) { * * @category PHPExcel * @package PHPExcel_Cell - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder { - /** - * Bind value to a cell - * - * @param PHPExcel_Cell $cell Cell to bind value to - * @param mixed $value Value to bind in cell - * @return boolean - */ - public function bindValue(PHPExcel_Cell $cell, $value = null) - { - // sanitize UTF-8 strings - if (is_string($value)) { - $value = PHPExcel_Shared_String::SanitizeUTF8($value); - } + /** + * Bind value to a cell + * + * @param PHPExcel_Cell $cell Cell to bind value to + * @param mixed $value Value to bind in cell + * @return boolean + */ + public function bindValue(PHPExcel_Cell $cell, $value = null) + { + // sanitize UTF-8 strings + if (is_string($value)) { + $value = PHPExcel_Shared_String::SanitizeUTF8($value); + } - // Find out data type - $dataType = parent::dataTypeForValue($value); + // Find out data type + $dataType = parent::dataTypeForValue($value); - // Style logic - strings - if ($dataType === PHPExcel_Cell_DataType::TYPE_STRING && !$value instanceof PHPExcel_RichText) { - // Test for booleans using locale-setting - if ($value == PHPExcel_Calculation::getTRUE()) { - $cell->setValueExplicit( TRUE, PHPExcel_Cell_DataType::TYPE_BOOL); - return true; - } elseif($value == PHPExcel_Calculation::getFALSE()) { - $cell->setValueExplicit( FALSE, PHPExcel_Cell_DataType::TYPE_BOOL); - return true; - } + // Style logic - strings + if ($dataType === PHPExcel_Cell_DataType::TYPE_STRING && !$value instanceof PHPExcel_RichText) { + // Test for booleans using locale-setting + if ($value == PHPExcel_Calculation::getTRUE()) { + $cell->setValueExplicit( TRUE, PHPExcel_Cell_DataType::TYPE_BOOL); + return true; + } elseif($value == PHPExcel_Calculation::getFALSE()) { + $cell->setValueExplicit( FALSE, PHPExcel_Cell_DataType::TYPE_BOOL); + return true; + } - // Check for number in scientific format - if (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NUMBER.'$/', $value)) { - $cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); - return true; - } + // Check for number in scientific format + if (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NUMBER.'$/', $value)) { + $cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); + return true; + } - // Check for fraction - if (preg_match('/^([+-]?) *([0-9]*)\s?\/\s*([0-9]*)$/', $value, $matches)) { - // Convert value to number - $value = $matches[2] / $matches[3]; - if ($matches[1] == '-') $value = 0 - $value; - $cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); - // Set style - $cell->getParent()->getStyle( $cell->getCoordinate() ) - ->getNumberFormat()->setFormatCode( '??/??' ); - return true; - } elseif (preg_match('/^([+-]?)([0-9]*) +([0-9]*)\s?\/\s*([0-9]*)$/', $value, $matches)) { - // Convert value to number - $value = $matches[2] + ($matches[3] / $matches[4]); - if ($matches[1] == '-') $value = 0 - $value; - $cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); - // Set style - $cell->getParent()->getStyle( $cell->getCoordinate() ) - ->getNumberFormat()->setFormatCode( '# ??/??' ); - return true; - } + // Check for fraction + if (preg_match('/^([+-]?)\s*([0-9]+)\s?\/\s*([0-9]+)$/', $value, $matches)) { + // Convert value to number + $value = $matches[2] / $matches[3]; + if ($matches[1] == '-') $value = 0 - $value; + $cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); + // Set style + $cell->getWorksheet()->getStyle( $cell->getCoordinate() ) + ->getNumberFormat()->setFormatCode( '??/??' ); + return true; + } elseif (preg_match('/^([+-]?)([0-9]*) +([0-9]*)\s?\/\s*([0-9]*)$/', $value, $matches)) { + // Convert value to number + $value = $matches[2] + ($matches[3] / $matches[4]); + if ($matches[1] == '-') $value = 0 - $value; + $cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); + // Set style + $cell->getWorksheet()->getStyle( $cell->getCoordinate() ) + ->getNumberFormat()->setFormatCode( '# ??/??' ); + return true; + } - // Check for percentage - if (preg_match('/^\-?[0-9]*\.?[0-9]*\s?\%$/', $value)) { - // Convert value to number - $value = (float) str_replace('%', '', $value) / 100; - $cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); - // Set style - $cell->getParent()->getStyle( $cell->getCoordinate() ) - ->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00 ); - return true; - } + // Check for percentage + if (preg_match('/^\-?[0-9]*\.?[0-9]*\s?\%$/', $value)) { + // Convert value to number + $value = (float) str_replace('%', '', $value) / 100; + $cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); + // Set style + $cell->getWorksheet()->getStyle( $cell->getCoordinate() ) + ->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00 ); + return true; + } - // Check for currency - $currencyCode = PHPExcel_Shared_String::getCurrencyCode(); - if (preg_match('/^'.preg_quote($currencyCode).' *(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $value)) { - // Convert value to number - $value = (float) trim(str_replace(array($currencyCode,','), '', $value)); - $cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); - // Set style - $cell->getParent()->getStyle( $cell->getCoordinate() ) - ->getNumberFormat()->setFormatCode( - str_replace('$', $currencyCode, PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE ) - ); - return true; - } elseif (preg_match('/^\$ *(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $value)) { - // Convert value to number - $value = (float) trim(str_replace(array('$',','), '', $value)); - $cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); - // Set style - $cell->getParent()->getStyle( $cell->getCoordinate() ) - ->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE ); - return true; - } + // Check for currency + $currencyCode = PHPExcel_Shared_String::getCurrencyCode(); + $decimalSeparator = PHPExcel_Shared_String::getDecimalSeparator(); + $thousandsSeparator = PHPExcel_Shared_String::getThousandsSeparator(); + if (preg_match('/^'.preg_quote($currencyCode).' *(\d{1,3}('.preg_quote($thousandsSeparator).'\d{3})*|(\d+))('.preg_quote($decimalSeparator).'\d{2})?$/', $value)) { + // Convert value to number + $value = (float) trim(str_replace(array($currencyCode, $thousandsSeparator, $decimalSeparator), array('', '', '.'), $value)); + $cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); + // Set style + $cell->getWorksheet()->getStyle( $cell->getCoordinate() ) + ->getNumberFormat()->setFormatCode( + str_replace('$', $currencyCode, PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE ) + ); + return true; + } elseif (preg_match('/^\$ *(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $value)) { + // Convert value to number + $value = (float) trim(str_replace(array('$',','), '', $value)); + $cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); + // Set style + $cell->getWorksheet()->getStyle( $cell->getCoordinate() ) + ->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE ); + return true; + } - // Check for time without seconds e.g. '9:45', '09:45' - if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d$/', $value)) { - // Convert value to number - list($h, $m) = explode(':', $value); - $days = $h / 24 + $m / 1440; - $cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC); - // Set style - $cell->getParent()->getStyle( $cell->getCoordinate() ) - ->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3 ); - return true; - } + // Check for time without seconds e.g. '9:45', '09:45' + if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d$/', $value)) { + // Convert value to number + list($h, $m) = explode(':', $value); + $days = $h / 24 + $m / 1440; + $cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC); + // Set style + $cell->getWorksheet()->getStyle( $cell->getCoordinate() ) + ->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3 ); + return true; + } - // Check for time with seconds '9:45:59', '09:45:59' - if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d:[0-5]\d$/', $value)) { - // Convert value to number - list($h, $m, $s) = explode(':', $value); - $days = $h / 24 + $m / 1440 + $s / 86400; - // Convert value to number - $cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC); - // Set style - $cell->getParent()->getStyle( $cell->getCoordinate() ) - ->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4 ); - return true; - } + // Check for time with seconds '9:45:59', '09:45:59' + if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d:[0-5]\d$/', $value)) { + // Convert value to number + list($h, $m, $s) = explode(':', $value); + $days = $h / 24 + $m / 1440 + $s / 86400; + // Convert value to number + $cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC); + // Set style + $cell->getWorksheet()->getStyle( $cell->getCoordinate() ) + ->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4 ); + return true; + } - // Check for datetime, e.g. '2008-12-31', '2008-12-31 15:59', '2008-12-31 15:59:10' - if (($d = PHPExcel_Shared_Date::stringToExcel($value)) !== false) { - // Convert value to number - $cell->setValueExplicit($d, PHPExcel_Cell_DataType::TYPE_NUMERIC); - // Determine style. Either there is a time part or not. Look for ':' - if (strpos($value, ':') !== false) { - $formatCode = 'yyyy-mm-dd h:mm'; - } else { - $formatCode = 'yyyy-mm-dd'; - } - $cell->getParent()->getStyle( $cell->getCoordinate() ) - ->getNumberFormat()->setFormatCode($formatCode); - return true; - } + // Check for datetime, e.g. '2008-12-31', '2008-12-31 15:59', '2008-12-31 15:59:10' + if (($d = PHPExcel_Shared_Date::stringToExcel($value)) !== false) { + // Convert value to number + $cell->setValueExplicit($d, PHPExcel_Cell_DataType::TYPE_NUMERIC); + // Determine style. Either there is a time part or not. Look for ':' + if (strpos($value, ':') !== false) { + $formatCode = 'yyyy-mm-dd h:mm'; + } else { + $formatCode = 'yyyy-mm-dd'; + } + $cell->getWorksheet()->getStyle( $cell->getCoordinate() ) + ->getNumberFormat()->setFormatCode($formatCode); + return true; + } - // Check for newline character "\n" - if (strpos($value, "\n") !== FALSE) { - $value = PHPExcel_Shared_String::SanitizeUTF8($value); - $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING); - // Set style - $cell->getParent()->getStyle( $cell->getCoordinate() ) - ->getAlignment()->setWrapText(TRUE); - return true; - } - } + // Check for newline character "\n" + if (strpos($value, "\n") !== FALSE) { + $value = PHPExcel_Shared_String::SanitizeUTF8($value); + $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING); + // Set style + $cell->getWorksheet()->getStyle( $cell->getCoordinate() ) + ->getAlignment()->setWrapText(TRUE); + return true; + } + } - // Not bound yet? Use parent... - return parent::bindValue($cell, $value); - } + // Not bound yet? Use parent... + return parent::bindValue($cell, $value); + } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Cell/DataType.php b/htdocs/includes/phpexcel/PHPExcel/Cell/DataType.php index a833a5a44e3..85765426b89 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Cell/DataType.php +++ b/htdocs/includes/phpexcel/PHPExcel/Cell/DataType.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Cell - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.8.0, 2014-03-02 */ @@ -31,84 +31,92 @@ * * @category PHPExcel * @package PHPExcel_Cell - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Cell_DataType { - /* Data types */ - const TYPE_STRING2 = 'str'; - const TYPE_STRING = 's'; - const TYPE_FORMULA = 'f'; - const TYPE_NUMERIC = 'n'; - const TYPE_BOOL = 'b'; - const TYPE_NULL = 'null'; - const TYPE_INLINE = 'inlineStr'; - const TYPE_ERROR = 'e'; + /* Data types */ + const TYPE_STRING2 = 'str'; + const TYPE_STRING = 's'; + const TYPE_FORMULA = 'f'; + const TYPE_NUMERIC = 'n'; + const TYPE_BOOL = 'b'; + const TYPE_NULL = 'null'; + const TYPE_INLINE = 'inlineStr'; + const TYPE_ERROR = 'e'; - /** - * List of error codes - * - * @var array - */ - private static $_errorCodes = array('#NULL!' => 0, '#DIV/0!' => 1, '#VALUE!' => 2, '#REF!' => 3, '#NAME?' => 4, '#NUM!' => 5, '#N/A' => 6); + /** + * List of error codes + * + * @var array + */ + private static $_errorCodes = array( + '#NULL!' => 0, + '#DIV/0!' => 1, + '#VALUE!' => 2, + '#REF!' => 3, + '#NAME?' => 4, + '#NUM!' => 5, + '#N/A' => 6 + ); - /** - * Get list of error codes - * - * @return array - */ - public static function getErrorCodes() { - return self::$_errorCodes; - } + /** + * Get list of error codes + * + * @return array + */ + public static function getErrorCodes() { + return self::$_errorCodes; + } - /** - * DataType for value - * - * @deprecated Replaced by PHPExcel_Cell_IValueBinder infrastructure - * @param mixed $pValue - * @return int - */ - public static function dataTypeForValue($pValue = null) { - return PHPExcel_Cell_DefaultValueBinder::dataTypeForValue($pValue); - } + /** + * DataType for value + * + * @deprecated Replaced by PHPExcel_Cell_IValueBinder infrastructure, will be removed in version 1.8.0 + * @param mixed $pValue + * @return string + */ + public static function dataTypeForValue($pValue = null) { + return PHPExcel_Cell_DefaultValueBinder::dataTypeForValue($pValue); + } - /** - * Check a string that it satisfies Excel requirements - * - * @param mixed Value to sanitize to an Excel string - * @return mixed Sanitized value - */ - public static function checkString($pValue = null) - { - if ($pValue instanceof PHPExcel_RichText) { - // TODO: Sanitize Rich-Text string (max. character count is 32,767) - return $pValue; - } + /** + * Check a string that it satisfies Excel requirements + * + * @param mixed Value to sanitize to an Excel string + * @return mixed Sanitized value + */ + public static function checkString($pValue = null) + { + if ($pValue instanceof PHPExcel_RichText) { + // TODO: Sanitize Rich-Text string (max. character count is 32,767) + return $pValue; + } - // string must never be longer than 32,767 characters, truncate if necessary - $pValue = PHPExcel_Shared_String::Substring($pValue, 0, 32767); + // string must never be longer than 32,767 characters, truncate if necessary + $pValue = PHPExcel_Shared_String::Substring($pValue, 0, 32767); - // we require that newline is represented as "\n" in core, not as "\r\n" or "\r" - $pValue = str_replace(array("\r\n", "\r"), "\n", $pValue); + // we require that newline is represented as "\n" in core, not as "\r\n" or "\r" + $pValue = str_replace(array("\r\n", "\r"), "\n", $pValue); - return $pValue; - } + return $pValue; + } - /** - * Check a value that it is a valid error code - * - * @param mixed Value to sanitize to an Excel error code - * @return string Sanitized value - */ - public static function checkErrorCode($pValue = null) - { - $pValue = (string)$pValue; + /** + * Check a value that it is a valid error code + * + * @param mixed Value to sanitize to an Excel error code + * @return string Sanitized value + */ + public static function checkErrorCode($pValue = null) + { + $pValue = (string) $pValue; - if ( !array_key_exists($pValue, self::$_errorCodes) ) { - $pValue = '#NULL!'; - } + if ( !array_key_exists($pValue, self::$_errorCodes) ) { + $pValue = '#NULL!'; + } - return $pValue; - } + return $pValue; + } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Cell/DataValidation.php b/htdocs/includes/phpexcel/PHPExcel/Cell/DataValidation.php index 01b1edb7e52..3174a3fe44a 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Cell/DataValidation.php +++ b/htdocs/includes/phpexcel/PHPExcel/Cell/DataValidation.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Cell - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.8.0, 2014-03-02 */ @@ -31,34 +31,34 @@ * * @category PHPExcel * @package PHPExcel_Cell - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Cell_DataValidation { - /* Data validation types */ - const TYPE_NONE = 'none'; - const TYPE_CUSTOM = 'custom'; - const TYPE_DATE = 'date'; - const TYPE_DECIMAL = 'decimal'; - const TYPE_LIST = 'list'; - const TYPE_TEXTLENGTH = 'textLength'; - const TYPE_TIME = 'time'; - const TYPE_WHOLE = 'whole'; + /* Data validation types */ + const TYPE_NONE = 'none'; + const TYPE_CUSTOM = 'custom'; + const TYPE_DATE = 'date'; + const TYPE_DECIMAL = 'decimal'; + const TYPE_LIST = 'list'; + const TYPE_TEXTLENGTH = 'textLength'; + const TYPE_TIME = 'time'; + const TYPE_WHOLE = 'whole'; - /* Data validation error styles */ - const STYLE_STOP = 'stop'; - const STYLE_WARNING = 'warning'; - const STYLE_INFORMATION = 'information'; + /* Data validation error styles */ + const STYLE_STOP = 'stop'; + const STYLE_WARNING = 'warning'; + const STYLE_INFORMATION = 'information'; - /* Data validation operators */ - const OPERATOR_BETWEEN = 'between'; - const OPERATOR_EQUAL = 'equal'; - const OPERATOR_GREATERTHAN = 'greaterThan'; - const OPERATOR_GREATERTHANOREQUAL = 'greaterThanOrEqual'; - const OPERATOR_LESSTHAN = 'lessThan'; - const OPERATOR_LESSTHANOREQUAL = 'lessThanOrEqual'; - const OPERATOR_NOTBETWEEN = 'notBetween'; - const OPERATOR_NOTEQUAL = 'notEqual'; + /* Data validation operators */ + const OPERATOR_BETWEEN = 'between'; + const OPERATOR_EQUAL = 'equal'; + const OPERATOR_GREATERTHAN = 'greaterThan'; + const OPERATOR_GREATERTHANOREQUAL = 'greaterThanOrEqual'; + const OPERATOR_LESSTHAN = 'lessThan'; + const OPERATOR_LESSTHANOREQUAL = 'lessThanOrEqual'; + const OPERATOR_NOTBETWEEN = 'notBetween'; + const OPERATOR_NOTEQUAL = 'notEqual'; /** * Formula 1 @@ -153,322 +153,320 @@ class PHPExcel_Cell_DataValidation /** * Create a new PHPExcel_Cell_DataValidation - * - * @throws Exception */ public function __construct() { - // Initialise member variables - $this->_formula1 = ''; - $this->_formula2 = ''; - $this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE; - $this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP; - $this->_operator = ''; - $this->_allowBlank = false; - $this->_showDropDown = false; - $this->_showInputMessage = false; - $this->_showErrorMessage = false; - $this->_errorTitle = ''; - $this->_error = ''; - $this->_promptTitle = ''; - $this->_prompt = ''; + // Initialise member variables + $this->_formula1 = ''; + $this->_formula2 = ''; + $this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE; + $this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP; + $this->_operator = ''; + $this->_allowBlank = FALSE; + $this->_showDropDown = FALSE; + $this->_showInputMessage = FALSE; + $this->_showErrorMessage = FALSE; + $this->_errorTitle = ''; + $this->_error = ''; + $this->_promptTitle = ''; + $this->_prompt = ''; } - /** - * Get Formula 1 - * - * @return string - */ - public function getFormula1() { - return $this->_formula1; - } - - /** - * Set Formula 1 - * - * @param string $value - * @return PHPExcel_Cell_DataValidation - */ - public function setFormula1($value = '') { - $this->_formula1 = $value; - return $this; - } - - /** - * Get Formula 2 - * - * @return string - */ - public function getFormula2() { - return $this->_formula2; - } - - /** - * Set Formula 2 - * - * @param string $value - * @return PHPExcel_Cell_DataValidation - */ - public function setFormula2($value = '') { - $this->_formula2 = $value; - return $this; - } - - /** - * Get Type - * - * @return string - */ - public function getType() { - return $this->_type; - } - - /** - * Set Type - * - * @param string $value - * @return PHPExcel_Cell_DataValidation - */ - public function setType($value = PHPExcel_Cell_DataValidation::TYPE_NONE) { - $this->_type = $value; - return $this; - } - - /** - * Get Error style - * - * @return string - */ - public function getErrorStyle() { - return $this->_errorStyle; - } - - /** - * Set Error style - * - * @param string $value - * @return PHPExcel_Cell_DataValidation - */ - public function setErrorStyle($value = PHPExcel_Cell_DataValidation::STYLE_STOP) { - $this->_errorStyle = $value; - return $this; - } - - /** - * Get Operator - * - * @return string - */ - public function getOperator() { - return $this->_operator; - } - - /** - * Set Operator - * - * @param string $value - * @return PHPExcel_Cell_DataValidation - */ - public function setOperator($value = '') { - $this->_operator = $value; - return $this; - } - - /** - * Get Allow Blank - * - * @return boolean - */ - public function getAllowBlank() { - return $this->_allowBlank; - } - - /** - * Set Allow Blank - * - * @param boolean $value - * @return PHPExcel_Cell_DataValidation - */ - public function setAllowBlank($value = false) { - $this->_allowBlank = $value; - return $this; - } - - /** - * Get Show DropDown - * - * @return boolean - */ - public function getShowDropDown() { - return $this->_showDropDown; - } - - /** - * Set Show DropDown - * - * @param boolean $value - * @return PHPExcel_Cell_DataValidation - */ - public function setShowDropDown($value = false) { - $this->_showDropDown = $value; - return $this; - } - - /** - * Get Show InputMessage - * - * @return boolean - */ - public function getShowInputMessage() { - return $this->_showInputMessage; - } - - /** - * Set Show InputMessage - * - * @param boolean $value - * @return PHPExcel_Cell_DataValidation - */ - public function setShowInputMessage($value = false) { - $this->_showInputMessage = $value; - return $this; - } - - /** - * Get Show ErrorMessage - * - * @return boolean - */ - public function getShowErrorMessage() { - return $this->_showErrorMessage; - } - - /** - * Set Show ErrorMessage - * - * @param boolean $value - * @return PHPExcel_Cell_DataValidation - */ - public function setShowErrorMessage($value = false) { - $this->_showErrorMessage = $value; - return $this; - } - - /** - * Get Error title - * - * @return string - */ - public function getErrorTitle() { - return $this->_errorTitle; - } - - /** - * Set Error title - * - * @param string $value - * @return PHPExcel_Cell_DataValidation - */ - public function setErrorTitle($value = '') { - $this->_errorTitle = $value; - return $this; - } - - /** - * Get Error - * - * @return string - */ - public function getError() { - return $this->_error; - } - - /** - * Set Error - * - * @param string $value - * @return PHPExcel_Cell_DataValidation - */ - public function setError($value = '') { - $this->_error = $value; - return $this; - } - - /** - * Get Prompt title - * - * @return string - */ - public function getPromptTitle() { - return $this->_promptTitle; - } - - /** - * Set Prompt title - * - * @param string $value - * @return PHPExcel_Cell_DataValidation - */ - public function setPromptTitle($value = '') { - $this->_promptTitle = $value; - return $this; - } - - /** - * Get Prompt - * - * @return string - */ - public function getPrompt() { - return $this->_prompt; - } - - /** - * Set Prompt - * - * @param string $value - * @return PHPExcel_Cell_DataValidation - */ - public function setPrompt($value = '') { - $this->_prompt = $value; - return $this; - } - - /** - * Get hash code - * - * @return string Hash code - */ - public function getHashCode() { - return md5( - $this->_formula1 - . $this->_formula2 - . $this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE - . $this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP - . $this->_operator - . ($this->_allowBlank ? 't' : 'f') - . ($this->_showDropDown ? 't' : 'f') - . ($this->_showInputMessage ? 't' : 'f') - . ($this->_showErrorMessage ? 't' : 'f') - . $this->_errorTitle - . $this->_error - . $this->_promptTitle - . $this->_prompt - . __CLASS__ - ); + /** + * Get Formula 1 + * + * @return string + */ + public function getFormula1() { + return $this->_formula1; } - /** - * Implement PHP __clone to create a deep clone, not just a shallow copy. - */ - public function __clone() { - $vars = get_object_vars($this); - foreach ($vars as $key => $value) { - if (is_object($value)) { - $this->$key = clone $value; - } else { - $this->$key = $value; - } - } - } + /** + * Set Formula 1 + * + * @param string $value + * @return PHPExcel_Cell_DataValidation + */ + public function setFormula1($value = '') { + $this->_formula1 = $value; + return $this; + } + + /** + * Get Formula 2 + * + * @return string + */ + public function getFormula2() { + return $this->_formula2; + } + + /** + * Set Formula 2 + * + * @param string $value + * @return PHPExcel_Cell_DataValidation + */ + public function setFormula2($value = '') { + $this->_formula2 = $value; + return $this; + } + + /** + * Get Type + * + * @return string + */ + public function getType() { + return $this->_type; + } + + /** + * Set Type + * + * @param string $value + * @return PHPExcel_Cell_DataValidation + */ + public function setType($value = PHPExcel_Cell_DataValidation::TYPE_NONE) { + $this->_type = $value; + return $this; + } + + /** + * Get Error style + * + * @return string + */ + public function getErrorStyle() { + return $this->_errorStyle; + } + + /** + * Set Error style + * + * @param string $value + * @return PHPExcel_Cell_DataValidation + */ + public function setErrorStyle($value = PHPExcel_Cell_DataValidation::STYLE_STOP) { + $this->_errorStyle = $value; + return $this; + } + + /** + * Get Operator + * + * @return string + */ + public function getOperator() { + return $this->_operator; + } + + /** + * Set Operator + * + * @param string $value + * @return PHPExcel_Cell_DataValidation + */ + public function setOperator($value = '') { + $this->_operator = $value; + return $this; + } + + /** + * Get Allow Blank + * + * @return boolean + */ + public function getAllowBlank() { + return $this->_allowBlank; + } + + /** + * Set Allow Blank + * + * @param boolean $value + * @return PHPExcel_Cell_DataValidation + */ + public function setAllowBlank($value = false) { + $this->_allowBlank = $value; + return $this; + } + + /** + * Get Show DropDown + * + * @return boolean + */ + public function getShowDropDown() { + return $this->_showDropDown; + } + + /** + * Set Show DropDown + * + * @param boolean $value + * @return PHPExcel_Cell_DataValidation + */ + public function setShowDropDown($value = false) { + $this->_showDropDown = $value; + return $this; + } + + /** + * Get Show InputMessage + * + * @return boolean + */ + public function getShowInputMessage() { + return $this->_showInputMessage; + } + + /** + * Set Show InputMessage + * + * @param boolean $value + * @return PHPExcel_Cell_DataValidation + */ + public function setShowInputMessage($value = false) { + $this->_showInputMessage = $value; + return $this; + } + + /** + * Get Show ErrorMessage + * + * @return boolean + */ + public function getShowErrorMessage() { + return $this->_showErrorMessage; + } + + /** + * Set Show ErrorMessage + * + * @param boolean $value + * @return PHPExcel_Cell_DataValidation + */ + public function setShowErrorMessage($value = false) { + $this->_showErrorMessage = $value; + return $this; + } + + /** + * Get Error title + * + * @return string + */ + public function getErrorTitle() { + return $this->_errorTitle; + } + + /** + * Set Error title + * + * @param string $value + * @return PHPExcel_Cell_DataValidation + */ + public function setErrorTitle($value = '') { + $this->_errorTitle = $value; + return $this; + } + + /** + * Get Error + * + * @return string + */ + public function getError() { + return $this->_error; + } + + /** + * Set Error + * + * @param string $value + * @return PHPExcel_Cell_DataValidation + */ + public function setError($value = '') { + $this->_error = $value; + return $this; + } + + /** + * Get Prompt title + * + * @return string + */ + public function getPromptTitle() { + return $this->_promptTitle; + } + + /** + * Set Prompt title + * + * @param string $value + * @return PHPExcel_Cell_DataValidation + */ + public function setPromptTitle($value = '') { + $this->_promptTitle = $value; + return $this; + } + + /** + * Get Prompt + * + * @return string + */ + public function getPrompt() { + return $this->_prompt; + } + + /** + * Set Prompt + * + * @param string $value + * @return PHPExcel_Cell_DataValidation + */ + public function setPrompt($value = '') { + $this->_prompt = $value; + return $this; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + return md5( + $this->_formula1 + . $this->_formula2 + . $this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE + . $this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP + . $this->_operator + . ($this->_allowBlank ? 't' : 'f') + . ($this->_showDropDown ? 't' : 'f') + . ($this->_showInputMessage ? 't' : 'f') + . ($this->_showErrorMessage ? 't' : 'f') + . $this->_errorTitle + . $this->_error + . $this->_promptTitle + . $this->_prompt + . __CLASS__ + ); + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Cell/DefaultValueBinder.php b/htdocs/includes/phpexcel/PHPExcel/Cell/DefaultValueBinder.php index f520cc5ed7a..f1880faa790 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Cell/DefaultValueBinder.php +++ b/htdocs/includes/phpexcel/PHPExcel/Cell/DefaultValueBinder.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,19 +20,19 @@ * * @category PHPExcel * @package PHPExcel_Cell - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.8.0, 2014-03-02 */ /** PHPExcel root directory */ if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); + require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); } @@ -41,66 +41,66 @@ if (!defined('PHPEXCEL_ROOT')) { * * @category PHPExcel * @package PHPExcel_Cell - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder { - /** - * Bind value to a cell - * - * @param PHPExcel_Cell $cell Cell to bind value to - * @param mixed $value Value to bind in cell - * @return boolean - */ - public function bindValue(PHPExcel_Cell $cell, $value = null) - { - // sanitize UTF-8 strings - if (is_string($value)) { - $value = PHPExcel_Shared_String::SanitizeUTF8($value); - } + /** + * Bind value to a cell + * + * @param PHPExcel_Cell $cell Cell to bind value to + * @param mixed $value Value to bind in cell + * @return boolean + */ + public function bindValue(PHPExcel_Cell $cell, $value = null) + { + // sanitize UTF-8 strings + if (is_string($value)) { + $value = PHPExcel_Shared_String::SanitizeUTF8($value); + } - // Set value explicit - $cell->setValueExplicit( $value, self::dataTypeForValue($value) ); + // Set value explicit + $cell->setValueExplicit( $value, self::dataTypeForValue($value) ); - // Done! - return true; - } + // Done! + return TRUE; + } - /** - * DataType for value - * - * @param mixed $pValue - * @return int - */ - public static function dataTypeForValue($pValue = null) { - // Match the value against a few data types - if (is_null($pValue)) { - return PHPExcel_Cell_DataType::TYPE_NULL; + /** + * DataType for value + * + * @param mixed $pValue + * @return string + */ + public static function dataTypeForValue($pValue = null) { + // Match the value against a few data types + if (is_null($pValue)) { + return PHPExcel_Cell_DataType::TYPE_NULL; - } elseif ($pValue === '') { - return PHPExcel_Cell_DataType::TYPE_STRING; + } elseif ($pValue === '') { + return PHPExcel_Cell_DataType::TYPE_STRING; - } elseif ($pValue instanceof PHPExcel_RichText) { - return PHPExcel_Cell_DataType::TYPE_INLINE; + } elseif ($pValue instanceof PHPExcel_RichText) { + return PHPExcel_Cell_DataType::TYPE_INLINE; - } elseif ($pValue{0} === '=' && strlen($pValue) > 1) { - return PHPExcel_Cell_DataType::TYPE_FORMULA; + } elseif ($pValue{0} === '=' && strlen($pValue) > 1) { + return PHPExcel_Cell_DataType::TYPE_FORMULA; - } elseif (is_bool($pValue)) { - return PHPExcel_Cell_DataType::TYPE_BOOL; + } elseif (is_bool($pValue)) { + return PHPExcel_Cell_DataType::TYPE_BOOL; - } elseif (is_float($pValue) || is_int($pValue)) { - return PHPExcel_Cell_DataType::TYPE_NUMERIC; + } elseif (is_float($pValue) || is_int($pValue)) { + return PHPExcel_Cell_DataType::TYPE_NUMERIC; - } elseif (preg_match('/^\-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)$/', $pValue)) { - return PHPExcel_Cell_DataType::TYPE_NUMERIC; + } elseif (preg_match('/^\-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)$/', $pValue)) { + return PHPExcel_Cell_DataType::TYPE_NUMERIC; - } elseif (is_string($pValue) && array_key_exists($pValue, PHPExcel_Cell_DataType::getErrorCodes())) { - return PHPExcel_Cell_DataType::TYPE_ERROR; + } elseif (is_string($pValue) && array_key_exists($pValue, PHPExcel_Cell_DataType::getErrorCodes())) { + return PHPExcel_Cell_DataType::TYPE_ERROR; - } else { - return PHPExcel_Cell_DataType::TYPE_STRING; + } else { + return PHPExcel_Cell_DataType::TYPE_STRING; - } - } + } + } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Cell/Hyperlink.php b/htdocs/includes/phpexcel/PHPExcel/Cell/Hyperlink.php index 9dc13042aa5..06edfad0b69 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Cell/Hyperlink.php +++ b/htdocs/includes/phpexcel/PHPExcel/Cell/Hyperlink.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Cell - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.8.0, 2014-03-02 */ @@ -31,97 +31,96 @@ * * @category PHPExcel * @package PHPExcel_Cell - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Cell_Hyperlink { - /** - * URL to link the cell to - * - * @var string - */ - private $_url; + /** + * URL to link the cell to + * + * @var string + */ + private $_url; - /** - * Tooltip to display on the hyperlink - * - * @var string - */ - private $_tooltip; + /** + * Tooltip to display on the hyperlink + * + * @var string + */ + private $_tooltip; /** * Create a new PHPExcel_Cell_Hyperlink * - * @param string $pUrl Url to link the cell to - * @param string $pTooltip Tooltip to display on the hyperlink - * @throws Exception + * @param string $pUrl Url to link the cell to + * @param string $pTooltip Tooltip to display on the hyperlink */ public function __construct($pUrl = '', $pTooltip = '') { - // Initialise member variables - $this->_url = $pUrl; - $this->_tooltip = $pTooltip; + // Initialise member variables + $this->_url = $pUrl; + $this->_tooltip = $pTooltip; } - /** - * Get URL - * - * @return string - */ - public function getUrl() { - return $this->_url; - } + /** + * Get URL + * + * @return string + */ + public function getUrl() { + return $this->_url; + } - /** - * Set URL - * - * @param string $value - * @return PHPExcel_Cell_Hyperlink - */ - public function setUrl($value = '') { - $this->_url = $value; - return $this; - } + /** + * Set URL + * + * @param string $value + * @return PHPExcel_Cell_Hyperlink + */ + public function setUrl($value = '') { + $this->_url = $value; + return $this; + } - /** - * Get tooltip - * - * @return string - */ - public function getTooltip() { - return $this->_tooltip; - } + /** + * Get tooltip + * + * @return string + */ + public function getTooltip() { + return $this->_tooltip; + } - /** - * Set tooltip - * - * @param string $value - * @return PHPExcel_Cell_Hyperlink - */ - public function setTooltip($value = '') { - $this->_tooltip = $value; - return $this; - } + /** + * Set tooltip + * + * @param string $value + * @return PHPExcel_Cell_Hyperlink + */ + public function setTooltip($value = '') { + $this->_tooltip = $value; + return $this; + } - /** - * Is this hyperlink internal? (to another sheet) - * - * @return boolean - */ - public function isInternal() { - return strpos($this->_url, 'sheet://') !== false; - } + /** + * Is this hyperlink internal? (to another worksheet) + * + * @return boolean + */ + public function isInternal() { + return strpos($this->_url, 'sheet://') !== false; + } - /** - * Get hash code - * - * @return string Hash code - */ - public function getHashCode() { - return md5( - $this->_url - . $this->_tooltip - . __CLASS__ - ); + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + return md5( + $this->_url + . $this->_tooltip + . __CLASS__ + ); } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Cell/IValueBinder.php b/htdocs/includes/phpexcel/PHPExcel/Cell/IValueBinder.php index 4070b674c77..bc7b468b9cd 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Cell/IValueBinder.php +++ b/htdocs/includes/phpexcel/PHPExcel/Cell/IValueBinder.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Cell - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.8.0, 2014-03-02 */ @@ -31,16 +31,16 @@ * * @category PHPExcel * @package PHPExcel_Cell - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ interface PHPExcel_Cell_IValueBinder { - /** - * Bind value to a cell - * - * @param PHPExcel_Cell $cell Cell to bind value to - * @param mixed $value Value to bind in cell - * @return boolean - */ - public function bindValue(PHPExcel_Cell $cell, $value = null); + /** + * Bind value to a cell + * + * @param PHPExcel_Cell $cell Cell to bind value to + * @param mixed $value Value to bind in cell + * @return boolean + */ + public function bindValue(PHPExcel_Cell $cell, $value = NULL); } diff --git a/htdocs/includes/phpexcel/PHPExcel/Chart.php b/htdocs/includes/phpexcel/PHPExcel/Chart.php index 4fa4cddb2df..9d251b8fd49 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Chart.php +++ b/htdocs/includes/phpexcel/PHPExcel/Chart.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Chart - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Chart - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Chart { @@ -184,7 +184,7 @@ class PHPExcel_Chart * Set Worksheet * * @param PHPExcel_Worksheet $pValue - * @throws Exception + * @throws PHPExcel_Chart_Exception * @return PHPExcel_Chart */ public function setWorksheet(PHPExcel_Worksheet $pValue = null) { @@ -378,6 +378,13 @@ class PHPExcel_Chart return $this; } + /** + * Set the offset position within the Top Left cell for the chart + * + * @param integer $xOffset + * @param integer $yOffset + * @return PHPExcel_Chart + */ public function setTopLeftOffset($xOffset=null,$yOffset=null) { if (!is_null($xOffset)) $this->setTopLeftXOffset($xOffset); @@ -387,6 +394,11 @@ class PHPExcel_Chart return $this; } + /** + * Get the offset position within the Top Left cell for the chart + * + * @return integer[] + */ public function getTopLeftOffset() { return array( 'X' => $this->_topLeftXOffset, 'Y' => $this->_topLeftYOffset @@ -458,6 +470,13 @@ class PHPExcel_Chart return $this->_bottomRightCellRef; } + /** + * Set the offset position within the Bottom Right cell for the chart + * + * @param integer $xOffset + * @param integer $yOffset + * @return PHPExcel_Chart + */ public function setBottomRightOffset($xOffset=null,$yOffset=null) { if (!is_null($xOffset)) $this->setBottomRightXOffset($xOffset); @@ -467,6 +486,11 @@ class PHPExcel_Chart return $this; } + /** + * Get the offset position within the Bottom Right cell for the chart + * + * @return integer[] + */ public function getBottomRightOffset() { return array( 'X' => $this->_bottomRightXOffset, 'Y' => $this->_bottomRightYOffset diff --git a/htdocs/includes/phpexcel/PHPExcel/Chart/DataSeries.php b/htdocs/includes/phpexcel/PHPExcel/Chart/DataSeries.php index 16e5e23194f..f5391aae995 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Chart/DataSeries.php +++ b/htdocs/includes/phpexcel/PHPExcel/Chart/DataSeries.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Chart - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Chart - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Chart_DataSeries { @@ -52,6 +52,7 @@ class PHPExcel_Chart_DataSeries const TYPE_RADARCHART = 'radarChart'; const TYPE_BUBBLECHART = 'bubbleChart'; const TYPE_STOCKCHART = 'stockChart'; + const TYPE_CANDLECHART = self::TYPE_STOCKCHART; // Synonym const GROUPING_CLUSTERED = 'clustered'; const GROUPING_STACKED = 'stacked'; @@ -169,9 +170,11 @@ class PHPExcel_Chart_DataSeries * Set Plot Type * * @param string $plotType + * @return PHPExcel_Chart_DataSeries */ public function setPlotType($plotType = '') { $this->_plotType = $plotType; + return $this; } /** @@ -187,9 +190,11 @@ class PHPExcel_Chart_DataSeries * Set Plot Grouping Type * * @param string $groupingType + * @return PHPExcel_Chart_DataSeries */ public function setPlotGrouping($groupingType = null) { $this->_plotGrouping = $groupingType; + return $this; } /** @@ -205,9 +210,11 @@ class PHPExcel_Chart_DataSeries * Set Plot Direction * * @param string $plotDirection + * @return PHPExcel_Chart_DataSeries */ public function setPlotDirection($plotDirection = null) { $this->_plotDirection = $plotDirection; + return $this; } /** @@ -280,9 +287,11 @@ class PHPExcel_Chart_DataSeries * Set Plot Style * * @param string $plotStyle + * @return PHPExcel_Chart_DataSeries */ public function setPlotStyle($plotStyle = null) { $this->_plotStyle = $plotStyle; + return $this; } /** @@ -331,9 +340,11 @@ class PHPExcel_Chart_DataSeries * Set Smooth Line * * @param boolean $smoothLine + * @return PHPExcel_Chart_DataSeries */ public function setSmoothLine($smoothLine = TRUE) { $this->_smoothLine = $smoothLine; + return $this; } public function refresh(PHPExcel_Worksheet $worksheet) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Chart/DataSeriesValues.php b/htdocs/includes/phpexcel/PHPExcel/Chart/DataSeriesValues.php index e49d0c79a84..930542b5601 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Chart/DataSeriesValues.php +++ b/htdocs/includes/phpexcel/PHPExcel/Chart/DataSeriesValues.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Chart - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Chart - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Chart_DataSeriesValues { @@ -279,7 +279,7 @@ class PHPExcel_Chart_DataSeriesValues public function refresh(PHPExcel_Worksheet $worksheet, $flatten = TRUE) { if ($this->_dataSource !== NULL) { - $calcEngine = PHPExcel_Calculation::getInstance(); + $calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent()); $newDataValues = PHPExcel_Calculation::_unwrapResult( $calcEngine->_calculateFormulaValue( '='.$this->_dataSource, @@ -289,6 +289,12 @@ class PHPExcel_Chart_DataSeriesValues ); if ($flatten) { $this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues); + foreach($this->_dataValues as &$dataValue) { + if ((!empty($dataValue)) && ($dataValue[0] == '#')) { + $dataValue = 0.0; + } + } + unset($dataValue); } else { $cellRange = explode('!',$this->_dataSource); if (count($cellRange) > 1) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Chart/Exception.php b/htdocs/includes/phpexcel/PHPExcel/Chart/Exception.php index 984d5f91ddb..ecf3c43824e 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Chart/Exception.php +++ b/htdocs/includes/phpexcel/PHPExcel/Chart/Exception.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Chart - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,9 +31,9 @@ * * @category PHPExcel * @package PHPExcel_Chart - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Chart_Exception extends Exception { +class PHPExcel_Chart_Exception extends PHPExcel_Exception { /** * Error handler callback * diff --git a/htdocs/includes/phpexcel/PHPExcel/Chart/Layout.php b/htdocs/includes/phpexcel/PHPExcel/Chart/Layout.php index d128382c16f..d749dfedce2 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Chart/Layout.php +++ b/htdocs/includes/phpexcel/PHPExcel/Chart/Layout.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Chart - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Chart - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Chart_Layout { @@ -167,9 +167,11 @@ class PHPExcel_Chart_Layout * Set Layout Target * * @param Layout Target $value + * @return PHPExcel_Chart_Layout */ public function setLayoutTarget($value) { $this->_layoutTarget = $value; + return $this; } /** @@ -185,9 +187,11 @@ class PHPExcel_Chart_Layout * Set X-Mode * * @param X-Mode $value + * @return PHPExcel_Chart_Layout */ public function setXMode($value) { $this->_xMode = $value; + return $this; } /** @@ -196,16 +200,18 @@ class PHPExcel_Chart_Layout * @return string */ public function getYMode() { - return $this->_xMode; + return $this->_yMode; } /** * Set Y-Mode * * @param Y-Mode $value + * @return PHPExcel_Chart_Layout */ public function setYMode($value) { - $this->_xMode = $value; + $this->_yMode = $value; + return $this; } /** @@ -221,9 +227,11 @@ class PHPExcel_Chart_Layout * Set X-Position * * @param X-Position $value + * @return PHPExcel_Chart_Layout */ public function setXPosition($value) { $this->_xPos = $value; + return $this; } /** @@ -239,9 +247,11 @@ class PHPExcel_Chart_Layout * Set Y-Position * * @param Y-Position $value + * @return PHPExcel_Chart_Layout */ public function setYPosition($value) { $this->_yPos = $value; + return $this; } /** @@ -257,9 +267,11 @@ class PHPExcel_Chart_Layout * Set Width * * @param Width $value + * @return PHPExcel_Chart_Layout */ public function setWidth($value) { $this->_width = $value; + return $this; } /** @@ -275,9 +287,11 @@ class PHPExcel_Chart_Layout * Set Height * * @param Height $value + * @return PHPExcel_Chart_Layout */ public function setHeight($value) { $this->_height = $value; + return $this; } @@ -295,9 +309,11 @@ class PHPExcel_Chart_Layout * Specifies that legend keys should be shown in data labels. * * @param boolean $value Show legend key + * @return PHPExcel_Chart_Layout */ public function setShowLegendKey($value) { $this->_showLegendKey = $value; + return $this; } /** @@ -314,9 +330,11 @@ class PHPExcel_Chart_Layout * Specifies that the value should be shown in data labels. * * @param boolean $value Show val + * @return PHPExcel_Chart_Layout */ public function setShowVal($value) { $this->_showVal = $value; + return $this; } /** @@ -333,9 +351,11 @@ class PHPExcel_Chart_Layout * Specifies that the category name should be shown in data labels. * * @param boolean $value Show cat name + * @return PHPExcel_Chart_Layout */ public function setShowCatName($value) { $this->_showCatName = $value; + return $this; } /** @@ -351,10 +371,12 @@ class PHPExcel_Chart_Layout * Set show ser name * Specifies that the series name should be shown in data labels. * - * @param boolean $value Show ser name + * @param boolean $value Show series name + * @return PHPExcel_Chart_Layout */ public function setShowSerName($value) { $this->_showSerName = $value; + return $this; } /** @@ -371,9 +393,11 @@ class PHPExcel_Chart_Layout * Specifies that the percentage should be shown in data labels. * * @param boolean $value Show percentage + * @return PHPExcel_Chart_Layout */ public function setShowPercent($value) { $this->_showPercent = $value; + return $this; } /** @@ -390,9 +414,11 @@ class PHPExcel_Chart_Layout * Specifies that the bubble size should be shown in data labels. * * @param boolean $value Show bubble size + * @return PHPExcel_Chart_Layout */ public function setShowBubbleSize($value) { $this->_showBubbleSize = $value; + return $this; } /** @@ -409,9 +435,11 @@ class PHPExcel_Chart_Layout * Specifies that leader lines should be shown in data labels. * * @param boolean $value Show leader lines + * @return PHPExcel_Chart_Layout */ public function setShowLeaderLines($value) { $this->_showLeaderLines = $value; + return $this; } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Chart/Legend.php b/htdocs/includes/phpexcel/PHPExcel/Chart/Legend.php index 0ccd77e958d..4b7c6449aab 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Chart/Legend.php +++ b/htdocs/includes/phpexcel/PHPExcel/Chart/Legend.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Chart - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Chart - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Chart_Legend { diff --git a/htdocs/includes/phpexcel/PHPExcel/Chart/PlotArea.php b/htdocs/includes/phpexcel/PHPExcel/Chart/PlotArea.php index 134ee59550a..237d29b0e25 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Chart/PlotArea.php +++ b/htdocs/includes/phpexcel/PHPExcel/Chart/PlotArea.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Chart - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Chart - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Chart_PlotArea { @@ -110,10 +110,13 @@ class PHPExcel_Chart_PlotArea /** * Set Plot Series * - * @param array of PHPExcel_Chart_DataSeries + * @param [PHPExcel_Chart_DataSeries] + * @return PHPExcel_Chart_PlotArea */ public function setPlotSeries($plotSeries = array()) { $this->_plotSeries = $plotSeries; + + return $this; } public function refresh(PHPExcel_Worksheet $worksheet) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Chart/Renderer/jpgraph.php b/htdocs/includes/phpexcel/PHPExcel/Chart/Renderer/jpgraph.php index 889fd9fce08..14ba2a04152 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Chart/Renderer/jpgraph.php +++ b/htdocs/includes/phpexcel/PHPExcel/Chart/Renderer/jpgraph.php @@ -3,7 +3,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Chart - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @package PHPExcel_Chart_Renderer + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -35,7 +35,7 @@ require_once(PHPExcel_Settings::getChartRendererPath().'/jpgraph.php'); * * @category PHPExcel * @package PHPExcel_Chart_Renderer - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Chart_Renderer_jpgraph { @@ -107,13 +107,11 @@ class PHPExcel_Chart_Renderer_jpgraph $testCurrentIndex = 0; foreach($datasetLabels as $i => $datasetLabel) { - array_reverse($datasetLabel); - if (is_array($datasetLabel)) { if ($rotation == 'bar') { - $datasetLabel = array_reverse($datasetLabel); $datasetLabels[$i] = implode(" ",$datasetLabel); } else { + $datasetLabel = array_reverse($datasetLabel); $datasetLabels[$i] = implode("\n",$datasetLabel); } } else { @@ -519,19 +517,37 @@ class PHPExcel_Chart_Renderer_jpgraph private function _renderPlotStock($groupID) { $seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); $plotOrder = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotOrder(); - $seriesPlots = array(); $dataValues = array(); - // Loop through each data series in turn - for($i = 0; $i < $seriesCount; ++$i) { - $dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues(); - $dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); - - foreach($dataValuesX as $j => $dataValueX) - $dataValues[$j][$plotOrder[$i]] = $dataValueX; + // Loop through each data series in turn and build the plot arrays + foreach($plotOrder as $i => $v) { + $dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($v)->getDataValues(); + foreach($dataValuesX as $j => $dataValueX) { + $dataValues[$plotOrder[$i]][$j] = $dataValueX; + } + } + if(empty($dataValues)) { + return; } - $seriesPlot = new StockPlot($dataValues); + $dataValuesPlot = array(); + // Flatten the plot arrays to a single dimensional array to work with jpgraph + for($j = 0; $j < count($dataValues[0]); $j++) { + for($i = 0; $i < $seriesCount; $i++) { + $dataValuesPlot[] = $dataValues[$i][$j]; + } + } + + // Set the x-axis labels + $labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount()); + if ($labelCount > 0) { + $datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues(); + $datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount); + $this->_graph->xaxis->SetTickLabels($datasetLabels); + } + + $seriesPlot = new StockPlot($dataValuesPlot); + $seriesPlot->SetWidth(20); $this->_graph->Add($seriesPlot); } // function _renderPlotStock() @@ -683,9 +699,9 @@ class PHPExcel_Chart_Renderer_jpgraph private function _renderStockChart($groupCount) { require_once('jpgraph_stock.php'); - $this->_renderCartesianPlotArea(); + $this->_renderCartesianPlotArea('intint'); - for($groupID = 0; $groupID < $groupCount; ++$i) { + for($groupID = 0; $groupID < $groupCount; ++$groupID) { $this->_renderPlotStock($groupID); } } // function _renderStockChart() diff --git a/htdocs/includes/phpexcel/PHPExcel/Chart/Title.php b/htdocs/includes/phpexcel/PHPExcel/Chart/Title.php index ef26f465825..415551b3f0f 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Chart/Title.php +++ b/htdocs/includes/phpexcel/PHPExcel/Chart/Title.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Chart - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Chart - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Chart_Title { @@ -72,9 +72,12 @@ class PHPExcel_Chart_Title * Set caption * * @param string $caption + * @return PHPExcel_Chart_Title */ public function setCaption($caption = null) { $this->_caption = $caption; + + return $this; } /** diff --git a/htdocs/includes/phpexcel/PHPExcel/Comment.php b/htdocs/includes/phpexcel/PHPExcel/Comment.php index 4ba239f4b7c..a2422c60e9e 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Comment.php +++ b/htdocs/includes/phpexcel/PHPExcel/Comment.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.8.0, 2014-03-02 */ @@ -31,85 +31,85 @@ * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Comment implements PHPExcel_IComparable { - /** - * Author - * - * @var string - */ - private $_author; + /** + * Author + * + * @var string + */ + private $_author; - /** - * Rich text comment - * - * @var PHPExcel_RichText - */ - private $_text; + /** + * Rich text comment + * + * @var PHPExcel_RichText + */ + private $_text; - /** - * Comment width (CSS style, i.e. XXpx or YYpt) - * - * @var string - */ - private $_width = '96pt'; + /** + * Comment width (CSS style, i.e. XXpx or YYpt) + * + * @var string + */ + private $_width = '96pt'; - /** - * Left margin (CSS style, i.e. XXpx or YYpt) - * - * @var string - */ - private $_marginLeft = '59.25pt'; + /** + * Left margin (CSS style, i.e. XXpx or YYpt) + * + * @var string + */ + private $_marginLeft = '59.25pt'; - /** - * Top margin (CSS style, i.e. XXpx or YYpt) - * - * @var string - */ - private $_marginTop = '1.5pt'; + /** + * Top margin (CSS style, i.e. XXpx or YYpt) + * + * @var string + */ + private $_marginTop = '1.5pt'; - /** - * Visible - * - * @var boolean - */ - private $_visible = false; + /** + * Visible + * + * @var boolean + */ + private $_visible = false; - /** - * Comment height (CSS style, i.e. XXpx or YYpt) - * - * @var string - */ - private $_height = '55.5pt'; + /** + * Comment height (CSS style, i.e. XXpx or YYpt) + * + * @var string + */ + private $_height = '55.5pt'; - /** - * Comment fill color - * - * @var PHPExcel_Style_Color - */ - private $_fillColor; + /** + * Comment fill color + * + * @var PHPExcel_Style_Color + */ + private $_fillColor; - /** - * Alignment - * - * @var string - */ - private $_alignment; + /** + * Alignment + * + * @var string + */ + private $_alignment; /** * Create a new PHPExcel_Comment * - * @throws Exception + * @throws PHPExcel_Exception */ public function __construct() { - // Initialise variables - $this->_author = 'Author'; - $this->_text = new PHPExcel_RichText(); - $this->_fillColor = new PHPExcel_Style_Color('FFFFFFE1'); - $this->_alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; + // Initialise variables + $this->_author = 'Author'; + $this->_text = new PHPExcel_RichText(); + $this->_fillColor = new PHPExcel_Style_Color('FFFFFFE1'); + $this->_alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; } /** @@ -118,7 +118,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable * @return string */ public function getAuthor() { - return $this->_author; + return $this->_author; } /** @@ -127,10 +127,10 @@ class PHPExcel_Comment implements PHPExcel_IComparable * @param string $pValue * @return PHPExcel_Comment */ - public function setAuthor($pValue = '') { - $this->_author = $pValue; - return $this; - } + public function setAuthor($pValue = '') { + $this->_author = $pValue; + return $this; + } /** * Get Rich text comment @@ -138,7 +138,7 @@ class PHPExcel_Comment implements PHPExcel_IComparable * @return PHPExcel_RichText */ public function getText() { - return $this->_text; + return $this->_text; } /** @@ -148,8 +148,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable * @return PHPExcel_Comment */ public function setText(PHPExcel_RichText $pValue) { - $this->_text = $pValue; - return $this; + $this->_text = $pValue; + return $this; } /** @@ -268,8 +268,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable * @return PHPExcel_Comment */ public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) { - $this->_alignment = $pValue; - return $this; + $this->_alignment = $pValue; + return $this; } /** @@ -278,40 +278,50 @@ class PHPExcel_Comment implements PHPExcel_IComparable * @return string */ public function getAlignment() { - return $this->_alignment; + return $this->_alignment; } - /** - * Get hash code - * - * @return string Hash code - */ - public function getHashCode() { - return md5( - $this->_author - . $this->_text->getHashCode() - . $this->_width - . $this->_height - . $this->_marginLeft - . $this->_marginTop - . ($this->_visible ? 1 : 0) - . $this->_fillColor->getHashCode() - . $this->_alignment - . __CLASS__ - ); + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + return md5( + $this->_author + . $this->_text->getHashCode() + . $this->_width + . $this->_height + . $this->_marginLeft + . $this->_marginTop + . ($this->_visible ? 1 : 0) + . $this->_fillColor->getHashCode() + . $this->_alignment + . __CLASS__ + ); + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } + + /** + * Convert to string + * + * @return string + */ + public function __toString() { + return $this->_text->getPlainText(); } - /** - * Implement PHP __clone to create a deep clone, not just a shallow copy. - */ - public function __clone() { - $vars = get_object_vars($this); - foreach ($vars as $key => $value) { - if (is_object($value)) { - $this->$key = clone $value; - } else { - $this->$key = $value; - } - } - } } diff --git a/htdocs/includes/phpexcel/PHPExcel/DocumentProperties.php b/htdocs/includes/phpexcel/PHPExcel/DocumentProperties.php index 1f4cad247ca..2f1fa1ede7d 100644 --- a/htdocs/includes/phpexcel/PHPExcel/DocumentProperties.php +++ b/htdocs/includes/phpexcel/PHPExcel/DocumentProperties.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,571 +18,570 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PHPExcel - * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @category PHPExcel + * @package PHPExcel + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.8.0, 2014-03-02 */ /** * PHPExcel_DocumentProperties * - * @category PHPExcel - * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @category PHPExcel + * @package PHPExcel + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_DocumentProperties { - /** constants */ - const PROPERTY_TYPE_BOOLEAN = 'b'; - const PROPERTY_TYPE_INTEGER = 'i'; - const PROPERTY_TYPE_FLOAT = 'f'; - const PROPERTY_TYPE_DATE = 'd'; - const PROPERTY_TYPE_STRING = 's'; - const PROPERTY_TYPE_UNKNOWN = 'u'; + /** constants */ + const PROPERTY_TYPE_BOOLEAN = 'b'; + const PROPERTY_TYPE_INTEGER = 'i'; + const PROPERTY_TYPE_FLOAT = 'f'; + const PROPERTY_TYPE_DATE = 'd'; + const PROPERTY_TYPE_STRING = 's'; + const PROPERTY_TYPE_UNKNOWN = 'u'; + + /** + * Creator + * + * @var string + */ + private $_creator = 'Unknown Creator'; + + /** + * LastModifiedBy + * + * @var string + */ + private $_lastModifiedBy; + + /** + * Created + * + * @var datetime + */ + private $_created; + + /** + * Modified + * + * @var datetime + */ + private $_modified; + + /** + * Title + * + * @var string + */ + private $_title = 'Untitled Spreadsheet'; + + /** + * Description + * + * @var string + */ + private $_description = ''; + + /** + * Subject + * + * @var string + */ + private $_subject = ''; + + /** + * Keywords + * + * @var string + */ + private $_keywords = ''; + + /** + * Category + * + * @var string + */ + private $_category = ''; + + /** + * Manager + * + * @var string + */ + private $_manager = ''; + + /** + * Company + * + * @var string + */ + private $_company = 'Microsoft Corporation'; + + /** + * Custom Properties + * + * @var string + */ + private $_customProperties = array(); - /** - * Creator - * - * @var string - */ - private $_creator = 'Unknown Creator'; + /** + * Create a new PHPExcel_DocumentProperties + */ + public function __construct() + { + // Initialise values + $this->_lastModifiedBy = $this->_creator; + $this->_created = time(); + $this->_modified = time(); + } - /** - * LastModifiedBy - * - * @var string - */ - private $_lastModifiedBy; + /** + * Get Creator + * + * @return string + */ + public function getCreator() { + return $this->_creator; + } - /** - * Created - * - * @var datetime - */ - private $_created; + /** + * Set Creator + * + * @param string $pValue + * @return PHPExcel_DocumentProperties + */ + public function setCreator($pValue = '') { + $this->_creator = $pValue; + return $this; + } - /** - * Modified - * - * @var datetime - */ - private $_modified; + /** + * Get Last Modified By + * + * @return string + */ + public function getLastModifiedBy() { + return $this->_lastModifiedBy; + } - /** - * Title - * - * @var string - */ - private $_title = 'Untitled Spreadsheet'; + /** + * Set Last Modified By + * + * @param string $pValue + * @return PHPExcel_DocumentProperties + */ + public function setLastModifiedBy($pValue = '') { + $this->_lastModifiedBy = $pValue; + return $this; + } - /** - * Description - * - * @var string - */ - private $_description = ''; + /** + * Get Created + * + * @return datetime + */ + public function getCreated() { + return $this->_created; + } - /** - * Subject - * - * @var string - */ - private $_subject = ''; + /** + * Set Created + * + * @param datetime $pValue + * @return PHPExcel_DocumentProperties + */ + public function setCreated($pValue = null) { + if ($pValue === NULL) { + $pValue = time(); + } elseif (is_string($pValue)) { + if (is_numeric($pValue)) { + $pValue = intval($pValue); + } else { + $pValue = strtotime($pValue); + } + } - /** - * Keywords - * - * @var string - */ - private $_keywords = ''; + $this->_created = $pValue; + return $this; + } - /** - * Category - * - * @var string - */ - private $_category = ''; + /** + * Get Modified + * + * @return datetime + */ + public function getModified() { + return $this->_modified; + } - /** - * Manager - * - * @var string - */ - private $_manager = ''; + /** + * Set Modified + * + * @param datetime $pValue + * @return PHPExcel_DocumentProperties + */ + public function setModified($pValue = null) { + if ($pValue === NULL) { + $pValue = time(); + } elseif (is_string($pValue)) { + if (is_numeric($pValue)) { + $pValue = intval($pValue); + } else { + $pValue = strtotime($pValue); + } + } - /** - * Company - * - * @var string - */ - private $_company = 'Microsoft Corporation'; + $this->_modified = $pValue; + return $this; + } - /** - * Custom Properties - * - * @var string - */ - private $_customProperties = array(); + /** + * Get Title + * + * @return string + */ + public function getTitle() { + return $this->_title; + } + /** + * Set Title + * + * @param string $pValue + * @return PHPExcel_DocumentProperties + */ + public function setTitle($pValue = '') { + $this->_title = $pValue; + return $this; + } - /** - * Create a new PHPExcel_DocumentProperties - */ - public function __construct() - { - // Initialise values - $this->_lastModifiedBy = $this->_creator; - $this->_created = time(); - $this->_modified = time(); - } + /** + * Get Description + * + * @return string + */ + public function getDescription() { + return $this->_description; + } - /** - * Get Creator - * - * @return string - */ - public function getCreator() { - return $this->_creator; - } + /** + * Set Description + * + * @param string $pValue + * @return PHPExcel_DocumentProperties + */ + public function setDescription($pValue = '') { + $this->_description = $pValue; + return $this; + } - /** - * Set Creator - * - * @param string $pValue - * @return PHPExcel_DocumentProperties - */ - public function setCreator($pValue = '') { - $this->_creator = $pValue; - return $this; - } + /** + * Get Subject + * + * @return string + */ + public function getSubject() { + return $this->_subject; + } - /** - * Get Last Modified By - * - * @return string - */ - public function getLastModifiedBy() { - return $this->_lastModifiedBy; - } + /** + * Set Subject + * + * @param string $pValue + * @return PHPExcel_DocumentProperties + */ + public function setSubject($pValue = '') { + $this->_subject = $pValue; + return $this; + } - /** - * Set Last Modified By - * - * @param string $pValue - * @return PHPExcel_DocumentProperties - */ - public function setLastModifiedBy($pValue = '') { - $this->_lastModifiedBy = $pValue; - return $this; - } + /** + * Get Keywords + * + * @return string + */ + public function getKeywords() { + return $this->_keywords; + } - /** - * Get Created - * - * @return datetime - */ - public function getCreated() { - return $this->_created; - } + /** + * Set Keywords + * + * @param string $pValue + * @return PHPExcel_DocumentProperties + */ + public function setKeywords($pValue = '') { + $this->_keywords = $pValue; + return $this; + } - /** - * Set Created - * - * @param datetime $pValue - * @return PHPExcel_DocumentProperties - */ - public function setCreated($pValue = null) { - if ($pValue === NULL) { - $pValue = time(); - } elseif (is_string($pValue)) { - if (is_numeric($pValue)) { - $pValue = intval($pValue); - } else { - $pValue = strtotime($pValue); - } - } + /** + * Get Category + * + * @return string + */ + public function getCategory() { + return $this->_category; + } - $this->_created = $pValue; - return $this; - } + /** + * Set Category + * + * @param string $pValue + * @return PHPExcel_DocumentProperties + */ + public function setCategory($pValue = '') { + $this->_category = $pValue; + return $this; + } - /** - * Get Modified - * - * @return datetime - */ - public function getModified() { - return $this->_modified; - } + /** + * Get Company + * + * @return string + */ + public function getCompany() { + return $this->_company; + } - /** - * Set Modified - * - * @param datetime $pValue - * @return PHPExcel_DocumentProperties - */ - public function setModified($pValue = null) { - if ($pValue === NULL) { - $pValue = time(); - } elseif (is_string($pValue)) { - if (is_numeric($pValue)) { - $pValue = intval($pValue); - } else { - $pValue = strtotime($pValue); - } - } + /** + * Set Company + * + * @param string $pValue + * @return PHPExcel_DocumentProperties + */ + public function setCompany($pValue = '') { + $this->_company = $pValue; + return $this; + } - $this->_modified = $pValue; - return $this; - } + /** + * Get Manager + * + * @return string + */ + public function getManager() { + return $this->_manager; + } - /** - * Get Title - * - * @return string - */ - public function getTitle() { - return $this->_title; - } + /** + * Set Manager + * + * @param string $pValue + * @return PHPExcel_DocumentProperties + */ + public function setManager($pValue = '') { + $this->_manager = $pValue; + return $this; + } - /** - * Set Title - * - * @param string $pValue - * @return PHPExcel_DocumentProperties - */ - public function setTitle($pValue = '') { - $this->_title = $pValue; - return $this; - } + /** + * Get a List of Custom Property Names + * + * @return array of string + */ + public function getCustomProperties() { + return array_keys($this->_customProperties); + } - /** - * Get Description - * - * @return string - */ - public function getDescription() { - return $this->_description; - } + /** + * Check if a Custom Property is defined + * + * @param string $propertyName + * @return boolean + */ + public function isCustomPropertySet($propertyName) { + return isset($this->_customProperties[$propertyName]); + } - /** - * Set Description - * - * @param string $pValue - * @return PHPExcel_DocumentProperties - */ - public function setDescription($pValue = '') { - $this->_description = $pValue; - return $this; - } + /** + * Get a Custom Property Value + * + * @param string $propertyName + * @return string + */ + public function getCustomPropertyValue($propertyName) { + if (isset($this->_customProperties[$propertyName])) { + return $this->_customProperties[$propertyName]['value']; + } - /** - * Get Subject - * - * @return string - */ - public function getSubject() { - return $this->_subject; - } + } - /** - * Set Subject - * - * @param string $pValue - * @return PHPExcel_DocumentProperties - */ - public function setSubject($pValue = '') { - $this->_subject = $pValue; - return $this; - } + /** + * Get a Custom Property Type + * + * @param string $propertyName + * @return string + */ + public function getCustomPropertyType($propertyName) { + if (isset($this->_customProperties[$propertyName])) { + return $this->_customProperties[$propertyName]['type']; + } - /** - * Get Keywords - * - * @return string - */ - public function getKeywords() { - return $this->_keywords; - } + } - /** - * Set Keywords - * - * @param string $pValue - * @return PHPExcel_DocumentProperties - */ - public function setKeywords($pValue = '') { - $this->_keywords = $pValue; - return $this; - } + /** + * Set a Custom Property + * + * @param string $propertyName + * @param mixed $propertyValue + * @param string $propertyType + * 'i' : Integer + * 'f' : Floating Point + * 's' : String + * 'd' : Date/Time + * 'b' : Boolean + * @return PHPExcel_DocumentProperties + */ + public function setCustomProperty($propertyName,$propertyValue='',$propertyType=NULL) { + if (($propertyType === NULL) || (!in_array($propertyType,array(self::PROPERTY_TYPE_INTEGER, + self::PROPERTY_TYPE_FLOAT, + self::PROPERTY_TYPE_STRING, + self::PROPERTY_TYPE_DATE, + self::PROPERTY_TYPE_BOOLEAN)))) { + if ($propertyValue === NULL) { + $propertyType = self::PROPERTY_TYPE_STRING; + } elseif (is_float($propertyValue)) { + $propertyType = self::PROPERTY_TYPE_FLOAT; + } elseif(is_int($propertyValue)) { + $propertyType = self::PROPERTY_TYPE_INTEGER; + } elseif (is_bool($propertyValue)) { + $propertyType = self::PROPERTY_TYPE_BOOLEAN; + } else { + $propertyType = self::PROPERTY_TYPE_STRING; + } + } - /** - * Get Category - * - * @return string - */ - public function getCategory() { - return $this->_category; - } + $this->_customProperties[$propertyName] = array('value' => $propertyValue, 'type' => $propertyType); + return $this; + } - /** - * Set Category - * - * @param string $pValue - * @return PHPExcel_DocumentProperties - */ - public function setCategory($pValue = '') { - $this->_category = $pValue; - return $this; - } + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } - /** - * Get Company - * - * @return string - */ - public function getCompany() { - return $this->_company; - } + public static function convertProperty($propertyValue,$propertyType) { + switch ($propertyType) { + case 'empty' : // Empty + return ''; + break; + case 'null' : // Null + return NULL; + break; + case 'i1' : // 1-Byte Signed Integer + case 'i2' : // 2-Byte Signed Integer + case 'i4' : // 4-Byte Signed Integer + case 'i8' : // 8-Byte Signed Integer + case 'int' : // Integer + return (int) $propertyValue; + break; + case 'ui1' : // 1-Byte Unsigned Integer + case 'ui2' : // 2-Byte Unsigned Integer + case 'ui4' : // 4-Byte Unsigned Integer + case 'ui8' : // 8-Byte Unsigned Integer + case 'uint' : // Unsigned Integer + return abs((int) $propertyValue); + break; + case 'r4' : // 4-Byte Real Number + case 'r8' : // 8-Byte Real Number + case 'decimal' : // Decimal + return (float) $propertyValue; + break; + case 'lpstr' : // LPSTR + case 'lpwstr' : // LPWSTR + case 'bstr' : // Basic String + return $propertyValue; + break; + case 'date' : // Date and Time + case 'filetime' : // File Time + return strtotime($propertyValue); + break; + case 'bool' : // Boolean + return ($propertyValue == 'true') ? True : False; + break; + case 'cy' : // Currency + case 'error' : // Error Status Code + case 'vector' : // Vector + case 'array' : // Array + case 'blob' : // Binary Blob + case 'oblob' : // Binary Blob Object + case 'stream' : // Binary Stream + case 'ostream' : // Binary Stream Object + case 'storage' : // Binary Storage + case 'ostorage' : // Binary Storage Object + case 'vstream' : // Binary Versioned Stream + case 'clsid' : // Class ID + case 'cf' : // Clipboard Data + return $propertyValue; + break; + } + return $propertyValue; + } - /** - * Set Company - * - * @param string $pValue - * @return PHPExcel_DocumentProperties - */ - public function setCompany($pValue = '') { - $this->_company = $pValue; - return $this; - } - - /** - * Get Manager - * - * @return string - */ - public function getManager() { - return $this->_manager; - } - - /** - * Set Manager - * - * @param string $pValue - * @return PHPExcel_DocumentProperties - */ - public function setManager($pValue = '') { - $this->_manager = $pValue; - return $this; - } - - /** - * Get a List of Custom Property Names - * - * @return array of string - */ - public function getCustomProperties() { - return array_keys($this->_customProperties); - } - - /** - * Check if a Custom Property is defined - * - * @param string $propertyName - * @return boolean - */ - public function isCustomPropertySet($propertyName) { - return isset($this->_customProperties[$propertyName]); - } - - /** - * Get a Custom Property Value - * - * @param string $propertyName - * @return string - */ - public function getCustomPropertyValue($propertyName) { - if (isset($this->_customProperties[$propertyName])) { - return $this->_customProperties[$propertyName]['value']; - } - - } - - /** - * Get a Custom Property Type - * - * @param string $propertyName - * @return string - */ - public function getCustomPropertyType($propertyName) { - if (isset($this->_customProperties[$propertyName])) { - return $this->_customProperties[$propertyName]['type']; - } - - } - - /** - * Set a Custom Property - * - * @param string $propertyName - * @param mixed $propertyValue - * @param string $propertyType - * 'i' : Integer - * 'f' : Floating Point - * 's' : String - * 'd' : Date/Time - * 'b' : Boolean - * @return PHPExcel_DocumentProperties - */ - public function setCustomProperty($propertyName,$propertyValue='',$propertyType=NULL) { - if (($propertyType === NULL) || (!in_array($propertyType,array(self::PROPERTY_TYPE_INTEGER, - self::PROPERTY_TYPE_FLOAT, - self::PROPERTY_TYPE_STRING, - self::PROPERTY_TYPE_DATE, - self::PROPERTY_TYPE_BOOLEAN)))) { - if ($propertyValue === NULL) { - $propertyType = self::PROPERTY_TYPE_STRING; - } elseif (is_float($propertyValue)) { - $propertyType = self::PROPERTY_TYPE_FLOAT; - } elseif(is_int($propertyValue)) { - $propertyType = self::PROPERTY_TYPE_INTEGER; - } elseif (is_bool($propertyValue)) { - $propertyType = self::PROPERTY_TYPE_BOOLEAN; - } else { - $propertyType = self::PROPERTY_TYPE_STRING; - } - } - - $this->_customProperties[$propertyName] = array('value' => $propertyValue, 'type' => $propertyType); - return $this; - } - - /** - * Implement PHP __clone to create a deep clone, not just a shallow copy. - */ - public function __clone() { - $vars = get_object_vars($this); - foreach ($vars as $key => $value) { - if (is_object($value)) { - $this->$key = clone $value; - } else { - $this->$key = $value; - } - } - } - - public static function convertProperty($propertyValue,$propertyType) { - switch ($propertyType) { - case 'empty' : // Empty - return ''; - break; - case 'null' : // Null - return NULL; - break; - case 'i1' : // 1-Byte Signed Integer - case 'i2' : // 2-Byte Signed Integer - case 'i4' : // 4-Byte Signed Integer - case 'i8' : // 8-Byte Signed Integer - case 'int' : // Integer - return (int) $propertyValue; - break; - case 'ui1' : // 1-Byte Unsigned Integer - case 'ui2' : // 2-Byte Unsigned Integer - case 'ui4' : // 4-Byte Unsigned Integer - case 'ui8' : // 8-Byte Unsigned Integer - case 'uint' : // Unsigned Integer - return abs((int) $propertyValue); - break; - case 'r4' : // 4-Byte Real Number - case 'r8' : // 8-Byte Real Number - case 'decimal' : // Decimal - return (float) $propertyValue; - break; - case 'lpstr' : // LPSTR - case 'lpwstr' : // LPWSTR - case 'bstr' : // Basic String - return $propertyValue; - break; - case 'date' : // Date and Time - case 'filetime' : // File Time - return strtotime($propertyValue); - break; - case 'bool' : // Boolean - return ($propertyValue == 'true') ? True : False; - break; - case 'cy' : // Currency - case 'error' : // Error Status Code - case 'vector' : // Vector - case 'array' : // Array - case 'blob' : // Binary Blob - case 'oblob' : // Binary Blob Object - case 'stream' : // Binary Stream - case 'ostream' : // Binary Stream Object - case 'storage' : // Binary Storage - case 'ostorage' : // Binary Storage Object - case 'vstream' : // Binary Versioned Stream - case 'clsid' : // Class ID - case 'cf' : // Clipboard Data - return $propertyValue; - break; - } - return $propertyValue; - } - - public static function convertPropertyType($propertyType) { - switch ($propertyType) { - case 'i1' : // 1-Byte Signed Integer - case 'i2' : // 2-Byte Signed Integer - case 'i4' : // 4-Byte Signed Integer - case 'i8' : // 8-Byte Signed Integer - case 'int' : // Integer - case 'ui1' : // 1-Byte Unsigned Integer - case 'ui2' : // 2-Byte Unsigned Integer - case 'ui4' : // 4-Byte Unsigned Integer - case 'ui8' : // 8-Byte Unsigned Integer - case 'uint' : // Unsigned Integer - return self::PROPERTY_TYPE_INTEGER; - break; - case 'r4' : // 4-Byte Real Number - case 'r8' : // 8-Byte Real Number - case 'decimal' : // Decimal - return self::PROPERTY_TYPE_FLOAT; - break; - case 'empty' : // Empty - case 'null' : // Null - case 'lpstr' : // LPSTR - case 'lpwstr' : // LPWSTR - case 'bstr' : // Basic String - return self::PROPERTY_TYPE_STRING; - break; - case 'date' : // Date and Time - case 'filetime' : // File Time - return self::PROPERTY_TYPE_DATE; - break; - case 'bool' : // Boolean - return self::PROPERTY_TYPE_BOOLEAN; - break; - case 'cy' : // Currency - case 'error' : // Error Status Code - case 'vector' : // Vector - case 'array' : // Array - case 'blob' : // Binary Blob - case 'oblob' : // Binary Blob Object - case 'stream' : // Binary Stream - case 'ostream' : // Binary Stream Object - case 'storage' : // Binary Storage - case 'ostorage' : // Binary Storage Object - case 'vstream' : // Binary Versioned Stream - case 'clsid' : // Class ID - case 'cf' : // Clipboard Data - return self::PROPERTY_TYPE_UNKNOWN; - break; - } - return self::PROPERTY_TYPE_UNKNOWN; - } + public static function convertPropertyType($propertyType) { + switch ($propertyType) { + case 'i1' : // 1-Byte Signed Integer + case 'i2' : // 2-Byte Signed Integer + case 'i4' : // 4-Byte Signed Integer + case 'i8' : // 8-Byte Signed Integer + case 'int' : // Integer + case 'ui1' : // 1-Byte Unsigned Integer + case 'ui2' : // 2-Byte Unsigned Integer + case 'ui4' : // 4-Byte Unsigned Integer + case 'ui8' : // 8-Byte Unsigned Integer + case 'uint' : // Unsigned Integer + return self::PROPERTY_TYPE_INTEGER; + break; + case 'r4' : // 4-Byte Real Number + case 'r8' : // 8-Byte Real Number + case 'decimal' : // Decimal + return self::PROPERTY_TYPE_FLOAT; + break; + case 'empty' : // Empty + case 'null' : // Null + case 'lpstr' : // LPSTR + case 'lpwstr' : // LPWSTR + case 'bstr' : // Basic String + return self::PROPERTY_TYPE_STRING; + break; + case 'date' : // Date and Time + case 'filetime' : // File Time + return self::PROPERTY_TYPE_DATE; + break; + case 'bool' : // Boolean + return self::PROPERTY_TYPE_BOOLEAN; + break; + case 'cy' : // Currency + case 'error' : // Error Status Code + case 'vector' : // Vector + case 'array' : // Array + case 'blob' : // Binary Blob + case 'oblob' : // Binary Blob Object + case 'stream' : // Binary Stream + case 'ostream' : // Binary Stream Object + case 'storage' : // Binary Storage + case 'ostorage' : // Binary Storage Object + case 'vstream' : // Binary Versioned Stream + case 'clsid' : // Class ID + case 'cf' : // Clipboard Data + return self::PROPERTY_TYPE_UNKNOWN; + break; + } + return self::PROPERTY_TYPE_UNKNOWN; + } } diff --git a/htdocs/includes/phpexcel/PHPExcel/DocumentSecurity.php b/htdocs/includes/phpexcel/PHPExcel/DocumentSecurity.php index 32bcb93035d..340504e8f18 100644 --- a/htdocs/includes/phpexcel/PHPExcel/DocumentSecurity.php +++ b/htdocs/includes/phpexcel/PHPExcel/DocumentSecurity.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_DocumentSecurity { diff --git a/htdocs/includes/phpexcel/PHPExcel/Exception.php b/htdocs/includes/phpexcel/PHPExcel/Exception.php index 454eaaa21b1..683e9099d8c 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Exception.php +++ b/htdocs/includes/phpexcel/PHPExcel/Exception.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.8.0, 2014-03-02 */ @@ -31,22 +31,22 @@ * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Exception extends Exception { - /** - * Error handler callback - * - * @param mixed $code - * @param mixed $string - * @param mixed $file - * @param mixed $line - * @param mixed $context - */ - public static function errorHandlerCallback($code, $string, $file, $line, $context) { - $e = new self($string, $code); - $e->line = $line; - $e->file = $file; - throw $e; - } + /** + * Error handler callback + * + * @param mixed $code + * @param mixed $string + * @param mixed $file + * @param mixed $line + * @param mixed $context + */ + public static function errorHandlerCallback($code, $string, $file, $line, $context) { + $e = new self($string, $code); + $e->line = $line; + $e->file = $file; + throw $e; + } } diff --git a/htdocs/includes/phpexcel/PHPExcel/HashTable.php b/htdocs/includes/phpexcel/PHPExcel/HashTable.php index ca15e6e7a79..7a9205e5b95 100644 --- a/htdocs/includes/phpexcel/PHPExcel/HashTable.php +++ b/htdocs/includes/phpexcel/PHPExcel/HashTable.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_HashTable { @@ -53,7 +53,7 @@ class PHPExcel_HashTable * Create a new PHPExcel_HashTable * * @param PHPExcel_IComparable[] $pSource Optional source array to create HashTable from - * @throws Exception + * @throws PHPExcel_Exception */ public function __construct($pSource = null) { @@ -67,14 +67,14 @@ class PHPExcel_HashTable * Add HashTable items from source * * @param PHPExcel_IComparable[] $pSource Source array to create HashTable from - * @throws Exception + * @throws PHPExcel_Exception */ public function addFromSource($pSource = null) { // Check if an array was passed if ($pSource == null) { return; } else if (!is_array($pSource)) { - throw new Exception('Invalid array parameter passed.'); + throw new PHPExcel_Exception('Invalid array parameter passed.'); } foreach ($pSource as $item) { @@ -86,7 +86,7 @@ class PHPExcel_HashTable * Add HashTable item * * @param PHPExcel_IComparable $pSource Item to add - * @throws Exception + * @throws PHPExcel_Exception */ public function add(PHPExcel_IComparable $pSource = null) { $hash = $pSource->getHashCode(); @@ -100,7 +100,7 @@ class PHPExcel_HashTable * Remove HashTable item * * @param PHPExcel_IComparable $pSource Item to remove - * @throws Exception + * @throws PHPExcel_Exception */ public function remove(PHPExcel_IComparable $pSource = null) { $hash = $pSource->getHashCode(); diff --git a/htdocs/includes/phpexcel/PHPExcel/IComparable.php b/htdocs/includes/phpexcel/PHPExcel/IComparable.php index 1c87f398cf4..6b1e18aa901 100644 --- a/htdocs/includes/phpexcel/PHPExcel/IComparable.php +++ b/htdocs/includes/phpexcel/PHPExcel/IComparable.php @@ -18,9 +18,9 @@ * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -29,7 +29,7 @@ * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ interface PHPExcel_IComparable { diff --git a/htdocs/includes/phpexcel/PHPExcel/IOFactory.php b/htdocs/includes/phpexcel/PHPExcel/IOFactory.php index eeeb2af93a1..69ec8b69531 100644 --- a/htdocs/includes/phpexcel/PHPExcel/IOFactory.php +++ b/htdocs/includes/phpexcel/PHPExcel/IOFactory.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -40,7 +40,7 @@ if (!defined('PHPEXCEL_ROOT')) { * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_IOFactory { @@ -96,13 +96,13 @@ class PHPExcel_IOFactory * @static * @access public * @param array $value - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public static function setSearchLocations($value) { if (is_array($value)) { self::$_searchLocations = $value; } else { - throw new Exception('Invalid parameter passed.'); + throw new PHPExcel_Reader_Exception('Invalid parameter passed.'); } } // function setSearchLocations() @@ -127,7 +127,7 @@ class PHPExcel_IOFactory * @param PHPExcel $phpExcel * @param string $writerType Example: Excel2007 * @return PHPExcel_Writer_IWriter - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public static function createWriter(PHPExcel $phpExcel, $writerType = '') { // Search type @@ -146,7 +146,7 @@ class PHPExcel_IOFactory } // Nothing found... - throw new Exception("No $searchType found for type $writerType"); + throw new PHPExcel_Reader_Exception("No $searchType found for type $writerType"); } // function createWriter() /** @@ -156,7 +156,7 @@ class PHPExcel_IOFactory * @access public * @param string $readerType Example: Excel2007 * @return PHPExcel_Reader_IReader - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public static function createReader($readerType = '') { // Search type @@ -175,7 +175,7 @@ class PHPExcel_IOFactory } // Nothing found... - throw new Exception("No $searchType found for type $readerType"); + throw new PHPExcel_Reader_Exception("No $searchType found for type $readerType"); } // function createReader() /** @@ -183,9 +183,9 @@ class PHPExcel_IOFactory * * @static * @access public - * @param string $pFileName The name of the spreadsheet file + * @param string $pFilename The name of the spreadsheet file * @return PHPExcel - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public static function load($pFilename) { $reader = self::createReaderForFile($pFilename); @@ -197,9 +197,9 @@ class PHPExcel_IOFactory * * @static * @access public - * @param string $pFileName The name of the spreadsheet file to identify + * @param string $pFilename The name of the spreadsheet file to identify * @return string - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public static function identify($pFilename) { $reader = self::createReaderForFile($pFilename); @@ -214,9 +214,9 @@ class PHPExcel_IOFactory * * @static * @access public - * @param string $pFileName The name of the spreadsheet file + * @param string $pFilename The name of the spreadsheet file * @return PHPExcel_Reader_IReader - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public static function createReaderForFile($pFilename) { @@ -283,6 +283,6 @@ class PHPExcel_IOFactory } } - throw new Exception('Unable to identify a reader for this file'); + throw new PHPExcel_Reader_Exception('Unable to identify a reader for this file'); } // function createReaderForFile() } diff --git a/htdocs/includes/phpexcel/PHPExcel/NamedRange.php b/htdocs/includes/phpexcel/PHPExcel/NamedRange.php index 3debd41a184..3ad5caabd46 100644 --- a/htdocs/includes/phpexcel/PHPExcel/NamedRange.php +++ b/htdocs/includes/phpexcel/PHPExcel/NamedRange.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_NamedRange { @@ -78,12 +78,13 @@ class PHPExcel_NamedRange * @param string $pRange * @param bool $pLocalOnly * @param PHPExcel_Worksheet|null $pScope Scope. Only applies when $pLocalOnly = true. Null for global scope. + * @throws PHPExcel_Exception */ public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null) { // Validate data if (($pName === NULL) || ($pWorksheet === NULL) || ($pRange === NULL)) { - throw new Exception('Parameters can not be null.'); + throw new PHPExcel_Exception('Parameters can not be null.'); } // Set local members diff --git a/htdocs/includes/phpexcel/PHPExcel/Reader/Abstract.php b/htdocs/includes/phpexcel/PHPExcel/Reader/Abstract.php new file mode 100644 index 00000000000..0d5180c6e3e --- /dev/null +++ b/htdocs/includes/phpexcel/PHPExcel/Reader/Abstract.php @@ -0,0 +1,227 @@ +_readDataOnly; + } + + /** + * Set read data only + * Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information. + * Set to false (the default) to advise the Reader to read both data and formatting for cells. + * + * @param boolean $pValue + * + * @return PHPExcel_Reader_IReader + */ + public function setReadDataOnly($pValue = FALSE) { + $this->_readDataOnly = $pValue; + return $this; + } + + /** + * Read charts in workbook? + * If this is true, then the Reader will include any charts that exist in the workbook. + * Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value. + * If false (the default) it will ignore any charts defined in the workbook file. + * + * @return boolean + */ + public function getIncludeCharts() { + return $this->_includeCharts; + } + + /** + * Set read charts in workbook + * Set to true, to advise the Reader to include any charts that exist in the workbook. + * Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value. + * Set to false (the default) to discard charts. + * + * @param boolean $pValue + * + * @return PHPExcel_Reader_IReader + */ + public function setIncludeCharts($pValue = FALSE) { + $this->_includeCharts = (boolean) $pValue; + return $this; + } + + /** + * Get which sheets to load + * Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null + * indicating that all worksheets in the workbook should be loaded. + * + * @return mixed + */ + public function getLoadSheetsOnly() + { + return $this->_loadSheetsOnly; + } + + /** + * Set which sheets to load + * + * @param mixed $value + * This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name. + * If NULL, then it tells the Reader to read all worksheets in the workbook + * + * @return PHPExcel_Reader_IReader + */ + public function setLoadSheetsOnly($value = NULL) + { + $this->_loadSheetsOnly = is_array($value) ? + $value : array($value); + return $this; + } + + /** + * Set all sheets to load + * Tells the Reader to load all worksheets from the workbook. + * + * @return PHPExcel_Reader_IReader + */ + public function setLoadAllSheets() + { + $this->_loadSheetsOnly = NULL; + return $this; + } + + /** + * Read filter + * + * @return PHPExcel_Reader_IReadFilter + */ + public function getReadFilter() { + return $this->_readFilter; + } + + /** + * Set read filter + * + * @param PHPExcel_Reader_IReadFilter $pValue + * @return PHPExcel_Reader_IReader + */ + public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) { + $this->_readFilter = $pValue; + return $this; + } + + /** + * Open file for reading + * + * @param string $pFilename + * @throws PHPExcel_Reader_Exception + * @return resource + */ + protected function _openFile($pFilename) + { + // Check if file exists + if (!file_exists($pFilename) || !is_readable($pFilename)) { + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + } + + // Open file + $this->_fileHandle = fopen($pFilename, 'r'); + if ($this->_fileHandle === FALSE) { + throw new PHPExcel_Reader_Exception("Could not open file " . $pFilename . " for reading."); + } + } + + /** + * Can the current PHPExcel_Reader_IReader read the file? + * + * @param string $pFilename + * @return boolean + * @throws PHPExcel_Reader_Exception + */ + public function canRead($pFilename) + { + // Check if file exists + try { + $this->_openFile($pFilename); + } catch (Exception $e) { + return FALSE; + } + + $readable = $this->_isValidFormat(); + fclose ($this->_fileHandle); + return $readable; + } + +} diff --git a/htdocs/includes/phpexcel/PHPExcel/Reader/CSV.php b/htdocs/includes/phpexcel/PHPExcel/Reader/CSV.php index 2739e3c4136..8bf7b848195 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Reader/CSV.php +++ b/htdocs/includes/phpexcel/PHPExcel/Reader/CSV.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -40,9 +40,9 @@ if (!defined('PHPEXCEL_ROOT')) { * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader +class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader { /** * Input encoding @@ -92,144 +92,104 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader */ private $_contiguous = false; - /** * Row counter for loading rows contiguously * - * @access private * @var int */ private $_contiguousRow = -1; - /** - * PHPExcel_Reader_IReadFilter instance - * - * @access private - * @var PHPExcel_Reader_IReadFilter - */ - private $_readFilter = null; - /** * Create a new PHPExcel_Reader_CSV */ public function __construct() { $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); - } // function __construct() - + } /** - * Can the current PHPExcel_Reader_IReader read the file? + * Validate that the current file is a CSV file * - * @access public - * @param string $pFileName * @return boolean - * @throws Exception */ - public function canRead($pFilename) + protected function _isValidFormat() { - // Check if file exists - if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); - } - - return true; - } // function canRead() - - - /** - * Read filter - * - * @access public - * @return PHPExcel_Reader_IReadFilter - */ - public function getReadFilter() { - return $this->_readFilter; - } // function getReadFilter() - - - /** - * Set read filter - * - * @access public - * @param PHPExcel_Reader_IReadFilter $pValue - */ - public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) { - $this->_readFilter = $pValue; - return $this; - } // function setReadFilter() - + return TRUE; + } /** * Set input encoding * - * @access public * @param string $pValue Input encoding */ public function setInputEncoding($pValue = 'UTF-8') { $this->_inputEncoding = $pValue; return $this; - } // function setInputEncoding() - + } /** * Get input encoding * - * @access public * @return string */ public function getInputEncoding() { return $this->_inputEncoding; - } // function getInputEncoding() - + } /** - * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) + * Move filepointer past any BOM marker * - * @access public - * @param string $pFilename - * @throws Exception */ - public function listWorksheetInfo($pFilename) + protected function _skipBOM() { - // Check if file exists - if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); - } + rewind($this->_fileHandle); - // Open file - $fileHandle = fopen($pFilename, 'r'); - if ($fileHandle === false) { - throw new Exception("Could not open file " . $pFilename . " for reading."); - } - - // Skip BOM, if any switch ($this->_inputEncoding) { case 'UTF-8': - fgets($fileHandle, 4) == "\xEF\xBB\xBF" ? - fseek($fileHandle, 3) : fseek($fileHandle, 0); + fgets($this->_fileHandle, 4) == "\xEF\xBB\xBF" ? + fseek($this->_fileHandle, 3) : fseek($this->_fileHandle, 0); break; case 'UTF-16LE': - fgets($fileHandle, 3) == "\xFF\xFE" ? - fseek($fileHandle, 2) : fseek($fileHandle, 0); + fgets($this->_fileHandle, 3) == "\xFF\xFE" ? + fseek($this->_fileHandle, 2) : fseek($this->_fileHandle, 0); break; case 'UTF-16BE': - fgets($fileHandle, 3) == "\xFE\xFF" ? - fseek($fileHandle, 2) : fseek($fileHandle, 0); + fgets($this->_fileHandle, 3) == "\xFE\xFF" ? + fseek($this->_fileHandle, 2) : fseek($this->_fileHandle, 0); break; case 'UTF-32LE': - fgets($fileHandle, 5) == "\xFF\xFE\x00\x00" ? - fseek($fileHandle, 4) : fseek($fileHandle, 0); + fgets($this->_fileHandle, 5) == "\xFF\xFE\x00\x00" ? + fseek($this->_fileHandle, 4) : fseek($this->_fileHandle, 0); break; case 'UTF-32BE': - fgets($fileHandle, 5) == "\x00\x00\xFE\xFF" ? - fseek($fileHandle, 4) : fseek($fileHandle, 0); + fgets($this->_fileHandle, 5) == "\x00\x00\xFE\xFF" ? + fseek($this->_fileHandle, 4) : fseek($this->_fileHandle, 0); break; default: break; } + } + + /** + * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) + * + * @param string $pFilename + * @throws PHPExcel_Reader_Exception + */ + public function listWorksheetInfo($pFilename) + { + // Open file + $this->_openFile($pFilename); + if (!$this->_isValidFormat()) { + fclose ($this->_fileHandle); + throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); + } + $fileHandle = $this->_fileHandle; + + // Skip BOM, if any + $this->_skipBOM(); $escapeEnclosures = array( "\\" . $this->_enclosure, $this->_enclosure . $this->_enclosure ); @@ -255,14 +215,12 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader return $worksheetInfo; } - /** * Loads PHPExcel from file * - * @access public * @param string $pFilename * @return PHPExcel - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function load($pFilename) { @@ -271,65 +229,37 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader // Load into this instance return $this->loadIntoExisting($pFilename, $objPHPExcel); - } // function load() - + } /** * Loads PHPExcel from file into PHPExcel instance * - * @access public * @param string $pFilename * @param PHPExcel $objPHPExcel * @return PHPExcel - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) { - // Check if file exists - if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); - } - - // Create new PHPExcel - while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) { - $objPHPExcel->createSheet(); - } - $sheet = $objPHPExcel->setActiveSheetIndex( $this->_sheetIndex ); - $lineEnding = ini_get('auto_detect_line_endings'); ini_set('auto_detect_line_endings', true); // Open file - $fileHandle = fopen($pFilename, 'r'); - if ($fileHandle === false) { - throw new Exception("Could not open file $pFilename for reading."); + $this->_openFile($pFilename); + if (!$this->_isValidFormat()) { + fclose ($this->_fileHandle); + throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); } + $fileHandle = $this->_fileHandle; // Skip BOM, if any - switch ($this->_inputEncoding) { - case 'UTF-8': - fgets($fileHandle, 4) == "\xEF\xBB\xBF" ? - fseek($fileHandle, 3) : fseek($fileHandle, 0); - break; - case 'UTF-16LE': - fgets($fileHandle, 3) == "\xFF\xFE" ? - fseek($fileHandle, 2) : fseek($fileHandle, 0); - break; - case 'UTF-16BE': - fgets($fileHandle, 3) == "\xFE\xFF" ? - fseek($fileHandle, 2) : fseek($fileHandle, 0); - break; - case 'UTF-32LE': - fgets($fileHandle, 5) == "\xFF\xFE\x00\x00" ? - fseek($fileHandle, 4) : fseek($fileHandle, 0); - break; - case 'UTF-32BE': - fgets($fileHandle, 5) == "\x00\x00\xFE\xFF" ? - fseek($fileHandle, 4) : fseek($fileHandle, 0); - break; - default: - break; + $this->_skipBOM(); + + // Create new PHPExcel object + while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) { + $objPHPExcel->createSheet(); } + $sheet = $objPHPExcel->setActiveSheetIndex($this->_sheetIndex); $escapeEnclosures = array( "\\" . $this->_enclosure, $this->_enclosure . $this->_enclosure @@ -373,48 +303,40 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader // Return return $objPHPExcel; - } // function loadIntoExisting() - + } /** * Get delimiter * - * @access public * @return string */ public function getDelimiter() { return $this->_delimiter; - } // function getDelimiter() - + } /** * Set delimiter * - * @access public * @param string $pValue Delimiter, defaults to , * @return PHPExcel_Reader_CSV */ public function setDelimiter($pValue = ',') { $this->_delimiter = $pValue; return $this; - } // function setDelimiter() - + } /** * Get enclosure * - * @access public * @return string */ public function getEnclosure() { return $this->_enclosure; - } // function getEnclosure() - + } /** * Set enclosure * - * @access public * @param string $pValue Enclosure, defaults to " * @return PHPExcel_Reader_CSV */ @@ -424,82 +346,70 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader } $this->_enclosure = $pValue; return $this; - } // function setEnclosure() - + } /** * Get line ending * - * @access public * @return string */ public function getLineEnding() { return $this->_lineEnding; - } // function getLineEnding() - + } /** * Set line ending * - * @access public * @param string $pValue Line ending, defaults to OS line ending (PHP_EOL) * @return PHPExcel_Reader_CSV */ public function setLineEnding($pValue = PHP_EOL) { $this->_lineEnding = $pValue; return $this; - } // function setLineEnding() - + } /** * Get sheet index * - * @access public - * @return int + * @return integer */ public function getSheetIndex() { return $this->_sheetIndex; - } // function getSheetIndex() - + } /** * Set sheet index * - * @access public - * @param int $pValue Sheet index + * @param integer $pValue Sheet index * @return PHPExcel_Reader_CSV */ public function setSheetIndex($pValue = 0) { $this->_sheetIndex = $pValue; return $this; - } // function setSheetIndex() - + } /** * Set Contiguous * - * @access public - * @param string $pValue Input encoding + * @param boolean $contiguous */ - public function setContiguous($contiguous = false) + public function setContiguous($contiguous = FALSE) { - $this->_contiguous = (bool)$contiguous; + $this->_contiguous = (bool) $contiguous; if (!$contiguous) { - $this->_contiguousRow = -1; + $this->_contiguousRow = -1; } return $this; - } // function setInputEncoding() - + } /** * Get Contiguous * - * @access public * @return boolean */ public function getContiguous() { return $this->_contiguous; - } // function getSheetIndex() + } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Reader/DefaultReadFilter.php b/htdocs/includes/phpexcel/PHPExcel/Reader/DefaultReadFilter.php index 276b974eecc..228ed10877a 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Reader/DefaultReadFilter.php +++ b/htdocs/includes/phpexcel/PHPExcel/Reader/DefaultReadFilter.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -40,7 +40,7 @@ if (!defined('PHPEXCEL_ROOT')) { * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Reader_DefaultReadFilter implements PHPExcel_Reader_IReadFilter { diff --git a/htdocs/includes/phpexcel/PHPExcel/Reader/Excel2003XML.php b/htdocs/includes/phpexcel/PHPExcel/Reader/Excel2003XML.php index 33ffe6dcb3f..ce1f31d6772 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Reader/Excel2003XML.php +++ b/htdocs/includes/phpexcel/PHPExcel/Reader/Excel2003XML.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -40,24 +40,10 @@ if (!defined('PHPEXCEL_ROOT')) { * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader +class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader { - /** - * Read data only? - * - * @var boolean - */ - private $_readDataOnly = false; - - /** - * Restict which sheets should be loaded? - * - * @var array - */ - private $_loadSheetsOnly = null; - /** * Formats * @@ -65,13 +51,6 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader */ private $_styles = array(); - /** - * PHPExcel_Reader_IReadFilter instance - * - * @var PHPExcel_Reader_IReadFilter - */ - private $_readFilter = null; - /** * Character set used in the file * @@ -88,93 +67,12 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader } - /** - * Read data only? - * - * @return boolean - */ - public function getReadDataOnly() { - return $this->_readDataOnly; - } - - - /** - * Set read data only - * - * @param boolean $pValue - * @return PHPExcel_Reader_Excel2003XML - */ - public function setReadDataOnly($pValue = false) { - $this->_readDataOnly = $pValue; - return $this; - } - - - /** - * Get which sheets to load - * - * @return mixed - */ - public function getLoadSheetsOnly() - { - return $this->_loadSheetsOnly; - } - - - /** - * Set which sheets to load - * - * @param mixed $value - * @return PHPExcel_Reader_Excel2003XML - */ - public function setLoadSheetsOnly($value = null) - { - $this->_loadSheetsOnly = is_array($value) ? - $value : array($value); - return $this; - } - - - /** - * Set all sheets to load - * - * @return PHPExcel_Reader_Excel2003XML - */ - public function setLoadAllSheets() - { - $this->_loadSheetsOnly = null; - return $this; - } - - - /** - * Read filter - * - * @return PHPExcel_Reader_IReadFilter - */ - public function getReadFilter() { - return $this->_readFilter; - } - - - /** - * Set read filter - * - * @param PHPExcel_Reader_IReadFilter $pValue - * @return PHPExcel_Reader_Excel2003XML - */ - public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) { - $this->_readFilter = $pValue; - return $this; - } - - /** * Can the current PHPExcel_Reader_IReader read the file? * - * @param string $pFileName + * @param string $pFilename * @return boolean - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function canRead($pFilename) { @@ -194,15 +92,13 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader '' ); - // Check if file exists - if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); - } - + // Open file + $this->_openFile($pFilename); + $fileHandle = $this->_fileHandle; + // Read sample data (first 2 KB will do) - $fh = fopen($pFilename, 'r'); - $data = fread($fh, 2048); - fclose($fh); + $data = fread($fileHandle, 2048); + fclose($fileHandle); $valid = true; foreach($signature as $match) { @@ -227,21 +123,21 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object * * @param string $pFilename - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function listWorksheetNames($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } if (!$this->canRead($pFilename)) { - throw new Exception($pFilename . " is an Invalid Spreadsheet file."); + throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); } $worksheetNames = array(); - $xml = simplexml_load_file($pFilename); + $xml = simplexml_load_file($pFilename, 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); $namespaces = $xml->getNamespaces(true); $xml_ss = $xml->children($namespaces['ss']); @@ -258,18 +154,18 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) * * @param string $pFilename - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function listWorksheetInfo($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } $worksheetInfo = array(); - $xml = simplexml_load_file($pFilename); + $xml = simplexml_load_file($pFilename, 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); $namespaces = $xml->getNamespaces(true); $worksheetID = 1; @@ -330,7 +226,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader * * @param string $pFilename * @return PHPExcel - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function load($pFilename) { @@ -392,7 +288,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader * @param string $pFilename * @param PHPExcel $objPHPExcel * @return PHPExcel - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) { @@ -427,14 +323,14 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader // Check if file exists if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } if (!$this->canRead($pFilename)) { - throw new Exception($pFilename . " is an Invalid Spreadsheet file."); + throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); } - $xml = simplexml_load_file($pFilename); + $xml = simplexml_load_file($pFilename, 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); $namespaces = $xml->getNamespaces(true); $docProps = $objPHPExcel->getProperties(); diff --git a/htdocs/includes/phpexcel/PHPExcel/Reader/Excel2007.php b/htdocs/includes/phpexcel/PHPExcel/Reader/Excel2007.php index fbb9158ebd3..d8344ac7a29 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Reader/Excel2007.php +++ b/htdocs/includes/phpexcel/PHPExcel/Reader/Excel2007.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -40,42 +40,10 @@ if (!defined('PHPEXCEL_ROOT')) { * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader +class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader { - /** - * Read data only? - * Identifies whether the Reader should only read data values for cells, and ignore any formatting information; - * or whether it should read both data and formatting - * - * @var boolean - */ - private $_readDataOnly = FALSE; - - /** - * Read charts that are defined in the workbook? - * Identifies whether the Reader should read the definitions for any charts that exist in the workbook; - * - * @var boolean - */ - private $_includeCharts = FALSE; - - /** - * Restrict which sheets should be loaded? - * This property holds an array of worksheet names to be loaded. If null, then all worksheets will be loaded. - * - * @var array of string - */ - private $_loadSheetsOnly = NULL; - - /** - * PHPExcel_Reader_IReadFilter instance - * - * @var PHPExcel_Reader_IReadFilter - */ - private $_readFilter = NULL; - /** * PHPExcel_ReferenceHelper instance * @@ -100,152 +68,33 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader } - /** - * Read data only? - * If this is true, then the Reader will only read data values for cells, it will not read any formatting information. - * If false (the default) it will read data and formatting. - * - * @return boolean - */ - public function getReadDataOnly() { - return $this->_readDataOnly; - } - - - /** - * Set read data only - * Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information. - * Set to false (the default) to advise the Reader to read both data and formatting for cells. - * - * @param boolean $pValue - * - * @return PHPExcel_Reader_Excel2007 - */ - public function setReadDataOnly($pValue = FALSE) { - $this->_readDataOnly = $pValue; - return $this; - } - - - /** - * Read charts in workbook? - * If this is true, then the Reader will include any charts that exist in the workbook. - * Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value. - * If false (the default) it will ignore any charts defined in the workbook file. - * - * @return boolean - */ - public function getIncludeCharts() { - return $this->_includeCharts; - } - - - /** - * Set read charts in workbook - * Set to true, to advise the Reader to include any charts that exist in the workbook. - * Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value. - * Set to false (the default) to discard charts. - * - * @param boolean $pValue - * - * @return PHPExcel_Reader_Excel2007 - */ - public function setIncludeCharts($pValue = FALSE) { - $this->_includeCharts = (boolean) $pValue; - return $this; - } - - - /** - * Get which sheets to load - * Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null - * indicating that all worksheets in the workbook should be loaded. - * - * @return mixed - */ - public function getLoadSheetsOnly() - { - return $this->_loadSheetsOnly; - } - - - /** - * Set which sheets to load - * - * @param mixed $value - * This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name. - * If NULL, then it tells the Reader to read all worksheets in the workbook - * - * @return PHPExcel_Reader_Excel2007 - */ - public function setLoadSheetsOnly($value = NULL) - { - $this->_loadSheetsOnly = is_array($value) ? - $value : array($value); - return $this; - } - - - /** - * Set all sheets to load - * Tells the Reader to load all worksheets from the workbook. - * - * @return PHPExcel_Reader_Excel2007 - */ - public function setLoadAllSheets() - { - $this->_loadSheetsOnly = NULL; - return $this; - } - - - /** - * Read filter - * - * @return PHPExcel_Reader_IReadFilter - */ - public function getReadFilter() { - return $this->_readFilter; - } - - - /** - * Set read filter - * - * @param PHPExcel_Reader_IReadFilter $pValue - * @return PHPExcel_Reader_Excel2007 - */ - public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) { - $this->_readFilter = $pValue; - return $this; - } - - /** * Can the current PHPExcel_Reader_IReader read the file? * - * @param string $pFileName + * @param string $pFilename * @return boolean - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function canRead($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } + $zipClass = PHPExcel_Settings::getZipClass(); + // Check if zip class exists - if (!class_exists('ZipArchive',FALSE)) { - throw new Exception("ZipArchive library is not enabled"); - } +// if (!class_exists($zipClass, FALSE)) { +// throw new PHPExcel_Reader_Exception($zipClass . " library is not enabled"); +// } $xl = false; // Load file - $zip = new ZipArchive; + $zip = new $zipClass; if ($zip->open($pFilename) === true) { // check if it is an OOXML archive - $rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels")); + $rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); if ($rels !== false) { foreach ($rels->Relationship as $rel) { switch ($rel["Type"]) { @@ -265,29 +114,77 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader } + /** + * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object + * + * @param string $pFilename + * @throws PHPExcel_Reader_Exception + */ + public function listWorksheetNames($pFilename) + { + // Check if file exists + if (!file_exists($pFilename)) { + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + } + + $worksheetNames = array(); + + $zipClass = PHPExcel_Settings::getZipClass(); + + $zip = new $zipClass; + $zip->open($pFilename); + + // The files we're looking at here are small enough that simpleXML is more efficient than XMLReader + $rels = simplexml_load_string( + $this->_getFromZipArchive($zip, "_rels/.rels", 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()) + ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + foreach ($rels->Relationship as $rel) { + switch ($rel["Type"]) { + case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument": + $xmlWorkbook = simplexml_load_string( + $this->_getFromZipArchive($zip, "{$rel['Target']}", 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()) + ); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); + + if ($xmlWorkbook->sheets) { + foreach ($xmlWorkbook->sheets->sheet as $eleSheet) { + // Check if sheet should be skipped + $worksheetNames[] = (string) $eleSheet["name"]; + } + } + } + } + + $zip->close(); + + return $worksheetNames; + } + + /** * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) * * @param string $pFilename - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function listWorksheetInfo($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } $worksheetInfo = array(); - $zip = new ZipArchive; + $zipClass = PHPExcel_Settings::getZipClass(); + + $zip = new $zipClass; $zip->open($pFilename); - $rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); foreach ($rels->Relationship as $rel) { if ($rel["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument") { $dir = dirname($rel["Target"]); - $relsWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $relsWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); $relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships"); $worksheets = array(); @@ -297,36 +194,40 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader } } - $xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); + $xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); if ($xmlWorkbook->sheets) { $dir = dirname($rel["Target"]); foreach ($xmlWorkbook->sheets->sheet as $eleSheet) { - $tmpInfo = array(); - $tmpInfo['worksheetName'] = (string) $eleSheet["name"]; - $tmpInfo['lastColumnLetter'] = 'A'; - $tmpInfo['lastColumnIndex'] = 0; - $tmpInfo['totalRows'] = 0; - $tmpInfo['totalColumns'] = 0; + $tmpInfo = array( + 'worksheetName' => (string) $eleSheet["name"], + 'lastColumnLetter' => 'A', + 'lastColumnIndex' => 0, + 'totalRows' => 0, + 'totalColumns' => 0, + ); $fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")]; - $xmlSheet = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$fileWorksheet")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); - if ($xmlSheet && $xmlSheet->sheetData && $xmlSheet->sheetData->row) { - foreach ($xmlSheet->sheetData->row as $row) { - foreach ($row->c as $c) { - $r = (string) $c["r"]; - $coordinates = PHPExcel_Cell::coordinateFromString($r); - $rowIndex = $coordinates[1]; - $columnIndex = PHPExcel_Cell::columnIndexFromString($coordinates[0]) - 1; + $xml = new XMLReader(); + $res = $xml->open('zip://'.PHPExcel_Shared_File::realpath($pFilename).'#'."$dir/$fileWorksheet", null, PHPExcel_Settings::getLibXmlLoaderOptions()); + $xml->setParserProperty(2,true); - $tmpInfo['totalRows'] = max($tmpInfo['totalRows'], $rowIndex); - $tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex); - } + $currCells = 0; + while ($xml->read()) { + if ($xml->name == 'row' && $xml->nodeType == XMLReader::ELEMENT) { + $row = $xml->getAttribute('r'); + $tmpInfo['totalRows'] = $row; + $tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'],$currCells); + $currCells = 0; + } elseif ($xml->name == 'c' && $xml->nodeType == XMLReader::ELEMENT) { + $currCells++; } } + $tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'],$currCells); + $xml->close(); + $tmpInfo['lastColumnIndex'] = $tmpInfo['totalColumns'] - 1; $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']); - $tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1; $worksheetInfo[] = $tmpInfo; } @@ -341,7 +242,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader private static function _castToBool($c) { -// echo 'Initial Cast to Boolean
'; +// echo 'Initial Cast to Boolean', PHP_EOL; $value = isset($c->v) ? (string) $c->v : NULL; if ($value == '0') { return FALSE; @@ -355,48 +256,46 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader private static function _castToError($c) { -// echo 'Initial Cast to Error
'; +// echo 'Initial Cast to Error', PHP_EOL; return isset($c->v) ? (string) $c->v : NULL; } // function _castToError() private static function _castToString($c) { -// echo 'Initial Cast to String
'; +// echo 'Initial Cast to String, PHP_EOL; return isset($c->v) ? (string) $c->v : NULL; } // function _castToString() private function _castToFormula($c,$r,&$cellDataType,&$value,&$calculatedValue,&$sharedFormulas,$castBaseType) { -// echo 'Formula
'; -// echo '$c->f is '.$c->f.'
'; +// echo 'Formula', PHP_EOL; +// echo '$c->f is ', $c->f, PHP_EOL; $cellDataType = 'f'; $value = "={$c->f}"; $calculatedValue = self::$castBaseType($c); // Shared formula? if (isset($c->f['t']) && strtolower((string)$c->f['t']) == 'shared') { -// echo 'SHARED FORMULA
'; +// echo 'SHARED FORMULA', PHP_EOL; $instance = (string)$c->f['si']; -// echo 'Instance ID = '.$instance.'
'; +// echo 'Instance ID = ', $instance, PHP_EOL; // -// echo 'Shared Formula Array:
';
+//			echo 'Shared Formula Array:', PHP_EOL;
 //			print_r($sharedFormulas);
-//			echo '
'; if (!isset($sharedFormulas[(string)$c->f['si']])) { -// echo 'SETTING NEW SHARED FORMULA
'; -// echo 'Master is '.$r.'
'; -// echo 'Formula is '.$value.'
'; +// echo 'SETTING NEW SHARED FORMULA', PHP_EOL; +// echo 'Master is ', $r, PHP_EOL; +// echo 'Formula is ', $value, PHP_EOL; $sharedFormulas[$instance] = array( 'master' => $r, 'formula' => $value ); -// echo 'New Shared Formula Array:
';
+//				echo 'New Shared Formula Array:', PHP_EOL;
 //				print_r($sharedFormulas);
-//				echo '
'; } else { -// echo 'GETTING SHARED FORMULA
'; -// echo 'Master is '.$sharedFormulas[$instance]['master'].'
'; -// echo 'Formula is '.$sharedFormulas[$instance]['formula'].'
'; +// echo 'GETTING SHARED FORMULA', PHP_EOL; +// echo 'Master is ', $sharedFormulas[$instance]['master'], PHP_EOL; +// echo 'Formula is ', $sharedFormulas[$instance]['formula'], PHP_EOL; $master = PHPExcel_Cell::coordinateFromString($sharedFormulas[$instance]['master']); $current = PHPExcel_Cell::coordinateFromString($r); @@ -409,13 +308,13 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader $difference[0], $difference[1] ); -// echo 'Adjusted Formula is '.$value.'
'; +// echo 'Adjusted Formula is ', $value, PHP_EOL; } } } - public function _getFromZipArchive(ZipArchive $archive, $fileName = '') + public function _getFromZipArchive($archive, $fileName = '') { // Root-relative paths if (strpos($fileName, '//') !== false) @@ -435,56 +334,17 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader } - /** - * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object - * - * @param string $pFilename - * @throws Exception - */ - public function listWorksheetNames($pFilename) - { - // Check if file exists - if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); - } - - $worksheetNames = array(); - - $zip = new ZipArchive; - $zip->open($pFilename); - - $rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); - foreach ($rels->Relationship as $rel) { - switch ($rel["Type"]) { - case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument": - $xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); - - if ($xmlWorkbook->sheets) { - foreach ($xmlWorkbook->sheets->sheet as $eleSheet) { - // Check if sheet should be skipped - $worksheetNames[] = (string) $eleSheet["name"]; - } - } - } - } - - $zip->close(); - - return $worksheetNames; - } - - /** * Loads PHPExcel from file * * @param string $pFilename - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function load($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } // Initialisations @@ -494,18 +354,21 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader $excel->removeCellStyleXfByIndex(0); // remove the default style $excel->removeCellXfByIndex(0); // remove the default style } - $zip = new ZipArchive; + + $zipClass = PHPExcel_Settings::getZipClass(); + + $zip = new $zipClass; $zip->open($pFilename); // Read the theme first, because we need the colour scheme when reading the styles - $wbRels = simplexml_load_string($this->_getFromZipArchive($zip, "xl/_rels/workbook.xml.rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $wbRels = simplexml_load_string($this->_getFromZipArchive($zip, "xl/_rels/workbook.xml.rels"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); foreach ($wbRels->Relationship as $rel) { switch ($rel["Type"]) { case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme": $themeOrderArray = array('lt1','dk1','lt2','dk2'); $themeOrderAdditional = count($themeOrderArray); - $xmlTheme = simplexml_load_string($this->_getFromZipArchive($zip, "xl/{$rel['Target']}")); + $xmlTheme = simplexml_load_string($this->_getFromZipArchive($zip, "xl/{$rel['Target']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); if (is_object($xmlTheme)) { $xmlThemeName = $xmlTheme->attributes(); $xmlTheme = $xmlTheme->children("http://schemas.openxmlformats.org/drawingml/2006/main"); @@ -535,11 +398,11 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader } } - $rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); foreach ($rels->Relationship as $rel) { switch ($rel["Type"]) { case "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties": - $xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); + $xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); if (is_object($xmlCore)) { $xmlCore->registerXPathNamespace("dc", "http://purl.org/dc/elements/1.1/"); $xmlCore->registerXPathNamespace("dcterms", "http://purl.org/dc/terms/"); @@ -558,7 +421,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader break; case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties": - $xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); + $xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); if (is_object($xmlCore)) { $docProps = $excel->getProperties(); if (isset($xmlCore->Company)) @@ -569,7 +432,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader break; case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties": - $xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); + $xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); if (is_object($xmlCore)) { $docProps = $excel->getProperties(); foreach ($xmlCore as $xmlProperty) { @@ -586,15 +449,21 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader } } break; - + //Ribbon + case "http://schemas.microsoft.com/office/2006/relationships/ui/extensibility": + $customUI = $rel['Target']; + if(!is_null($customUI)){ + $this->_readRibbon($excel, $customUI, $zip); + } + break; case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument": $dir = dirname($rel["Target"]); - $relsWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $relsWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); $relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships"); $sharedStrings = array(); $xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings']")); - $xmlStrings = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$xpath[Target]")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); + $xmlStrings = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$xpath[Target]"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); if (isset($xmlStrings) && isset($xmlStrings->si)) { foreach ($xmlStrings->si as $val) { if (isset($val->t)) { @@ -606,16 +475,34 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader } $worksheets = array(); + $macros = $customUI = NULL; foreach ($relsWorkbook->Relationship as $ele) { - if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet") { + switch($ele['Type']){ + case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet": $worksheets[(string) $ele["Id"]] = $ele["Target"]; + break; + // a vbaProject ? (: some macros) + case "http://schemas.microsoft.com/office/2006/relationships/vbaProject": + $macros = $ele["Target"]; + break; } } + if(!is_null($macros)){ + $macrosCode = $this->_getFromZipArchive($zip, 'xl/vbaProject.bin');//vbaProject.bin always in 'xl' dir and always named vbaProject.bin + if($macrosCode !== false){ + $excel->setMacrosCode($macrosCode); + $excel->setHasMacros(true); + //short-circuit : not reading vbaProject.bin.rel to get Signature =>allways vbaProjectSignature.bin in 'xl' dir + $Certificate = $this->_getFromZipArchive($zip, 'xl/vbaProjectSignature.bin'); + if($Certificate !== false) + $excel->setMacrosCertificate($Certificate); + } + } $styles = array(); $cellStyles = array(); $xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']")); - $xmlStyles = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$xpath[Target]")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); + $xmlStyles = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$xpath[Target]"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); $numFmts = null; if ($xmlStyles && $xmlStyles->numFmts[0]) { $numFmts = $xmlStyles->numFmts[0]; @@ -640,6 +527,10 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader $numFmt = PHPExcel_Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]); } } + $quotePrefix = false; + if (isset($xf["quotePrefix"])) { + $quotePrefix = (boolean) $xf["quotePrefix"]; + } //$numFmt = str_replace('mm', 'i', $numFmt); //$numFmt = str_replace('h', 'H', $numFmt); @@ -650,6 +541,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader "border" => $xmlStyles->borders->border[intval($xf["borderId"])], "alignment" => $xf->alignment, "protection" => $xf->protection, + "quotePrefix" => $quotePrefix, ); $styles[] = $style; @@ -677,6 +569,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader "border" => $xmlStyles->borders->border[intval($xf["borderId"])], "alignment" => $xf->alignment, "protection" => $xf->protection, + "quotePrefix" => $quotePrefix, ); $cellStyles[] = $cellStyle; @@ -713,14 +606,13 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader } } - $xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); + $xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); // Set base date if ($xmlWorkbook->workbookPr) { PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900); if (isset($xmlWorkbook->workbookPr['date1904'])) { - $date1904 = (string)$xmlWorkbook->workbookPr['date1904']; - if ($date1904 == "true" || $date1904 == "1") { + if (self::boolean((string) $xmlWorkbook->workbookPr['date1904'])) { PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904); } } @@ -757,7 +649,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader // reverse $docSheet->setTitle((string) $eleSheet["name"],false); $fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")]; - $xmlSheet = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$fileWorksheet")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); + $xmlSheet = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$fileWorksheet"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main"); $sharedFormulas = array(); @@ -779,15 +671,15 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader } if (isset($xmlSheet->sheetViews->sheetView['showGridLines'])) { - $docSheet->setShowGridLines((string)$xmlSheet->sheetViews->sheetView['showGridLines'] ? true : false); + $docSheet->setShowGridLines(self::boolean((string)$xmlSheet->sheetViews->sheetView['showGridLines'])); } if (isset($xmlSheet->sheetViews->sheetView['showRowColHeaders'])) { - $docSheet->setShowRowColHeaders((string)$xmlSheet->sheetViews->sheetView['showRowColHeaders'] ? true : false); + $docSheet->setShowRowColHeaders(self::boolean((string)$xmlSheet->sheetViews->sheetView['showRowColHeaders'])); } if (isset($xmlSheet->sheetViews->sheetView['rightToLeft'])) { - $docSheet->setRightToLeft((string)$xmlSheet->sheetViews->sheetView['rightToLeft'] ? true : false); + $docSheet->setRightToLeft(self::boolean((string)$xmlSheet->sheetViews->sheetView['rightToLeft'])); } if (isset($xmlSheet->sheetViews->sheetView->pane)) { @@ -825,31 +717,38 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader $docSheet->getTabColor()->setARGB( (string)$xmlSheet->sheetPr->tabColor['rgb'] ); } } - + if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr['codeName'])) { + $docSheet->setCodeName((string) $xmlSheet->sheetPr['codeName']); + } if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->outlinePr)) { - if (isset($xmlSheet->sheetPr->outlinePr['summaryRight']) && $xmlSheet->sheetPr->outlinePr['summaryRight'] == false) { - $docSheet->setShowSummaryRight(false); + if (isset($xmlSheet->sheetPr->outlinePr['summaryRight']) && + !self::boolean((string) $xmlSheet->sheetPr->outlinePr['summaryRight'])) { + $docSheet->setShowSummaryRight(FALSE); } else { - $docSheet->setShowSummaryRight(true); + $docSheet->setShowSummaryRight(TRUE); } - if (isset($xmlSheet->sheetPr->outlinePr['summaryBelow']) && $xmlSheet->sheetPr->outlinePr['summaryBelow'] == false) { - $docSheet->setShowSummaryBelow(false); + if (isset($xmlSheet->sheetPr->outlinePr['summaryBelow']) && + !self::boolean((string) $xmlSheet->sheetPr->outlinePr['summaryBelow'])) { + $docSheet->setShowSummaryBelow(FALSE); } else { - $docSheet->setShowSummaryBelow(true); + $docSheet->setShowSummaryBelow(TRUE); } } if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->pageSetUpPr)) { - if (isset($xmlSheet->sheetPr->pageSetUpPr['fitToPage']) && $xmlSheet->sheetPr->pageSetUpPr['fitToPage'] == false) { - $docSheet->getPageSetup()->setFitToPage(false); + if (isset($xmlSheet->sheetPr->pageSetUpPr['fitToPage']) && + !self::boolean((string) $xmlSheet->sheetPr->pageSetUpPr['fitToPage'])) { + $docSheet->getPageSetup()->setFitToPage(FALSE); } else { - $docSheet->getPageSetup()->setFitToPage(true); + $docSheet->getPageSetup()->setFitToPage(TRUE); } } if (isset($xmlSheet->sheetFormatPr)) { - if (isset($xmlSheet->sheetFormatPr['customHeight']) && ((string)$xmlSheet->sheetFormatPr['customHeight'] == '1' || strtolower((string)$xmlSheet->sheetFormatPr['customHeight']) == 'true') && isset($xmlSheet->sheetFormatPr['defaultRowHeight'])) { + if (isset($xmlSheet->sheetFormatPr['customHeight']) && + self::boolean((string) $xmlSheet->sheetFormatPr['customHeight']) && + isset($xmlSheet->sheetFormatPr['defaultRowHeight'])) { $docSheet->getDefaultRowDimension()->setRowHeight( (float)$xmlSheet->sheetFormatPr['defaultRowHeight'] ); } if (isset($xmlSheet->sheetFormatPr['defaultColWidth'])) { @@ -863,18 +762,19 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader if (isset($xmlSheet->cols) && !$this->_readDataOnly) { foreach ($xmlSheet->cols->col as $col) { - for ($i = intval($col["min"]) - 1; $i < intval($col["max"]); ++$i) { + for ($i = intval($col["min"]) - 1; $i < intval($col["max"]); ++$i) { if ($col["style"] && !$this->_readDataOnly) { $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setXfIndex(intval($col["style"])); } - if ($col["bestFit"]) { - //$docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setAutoSize(true); + if (self::boolean($col["bestFit"])) { + //$docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setAutoSize(TRUE); } - if ($col["hidden"]) { - $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setVisible(false); + if (self::boolean($col["hidden"])) { + // echo PHPExcel_Cell::stringFromColumnIndex($i),': HIDDEN COLUMN',PHP_EOL; + $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setVisible(FALSE); } - if ($col["collapsed"]) { - $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setCollapsed(true); + if (self::boolean($col["collapsed"])) { + $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setCollapsed(TRUE); } if ($col["outlineLevel"] > 0) { $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setOutlineLevel(intval($col["outlineLevel"])); @@ -889,19 +789,19 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader } if (isset($xmlSheet->printOptions) && !$this->_readDataOnly) { - if ($xmlSheet->printOptions['gridLinesSet'] == 'true' && $xmlSheet->printOptions['gridLinesSet'] == '1') { - $docSheet->setShowGridlines(true); + if (self::boolean((string) $xmlSheet->printOptions['gridLinesSet'])) { + $docSheet->setShowGridlines(TRUE); } - if ($xmlSheet->printOptions['gridLines'] == 'true' || $xmlSheet->printOptions['gridLines'] == '1') { - $docSheet->setPrintGridlines(true); + if (self::boolean((string) $xmlSheet->printOptions['gridLines'])) { + $docSheet->setPrintGridlines(TRUE); } - if ($xmlSheet->printOptions['horizontalCentered']) { - $docSheet->getPageSetup()->setHorizontalCentered(true); + if (self::boolean((string) $xmlSheet->printOptions['horizontalCentered'])) { + $docSheet->getPageSetup()->setHorizontalCentered(TRUE); } - if ($xmlSheet->printOptions['verticalCentered']) { - $docSheet->getPageSetup()->setVerticalCentered(true); + if (self::boolean((string) $xmlSheet->printOptions['verticalCentered'])) { + $docSheet->getPageSetup()->setVerticalCentered(TRUE); } } @@ -910,11 +810,11 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader if ($row["ht"] && !$this->_readDataOnly) { $docSheet->getRowDimension(intval($row["r"]))->setRowHeight(floatval($row["ht"])); } - if ($row["hidden"] && !$this->_readDataOnly) { - $docSheet->getRowDimension(intval($row["r"]))->setVisible(false); + if (self::boolean($row["hidden"]) && !$this->_readDataOnly) { + $docSheet->getRowDimension(intval($row["r"]))->setVisible(FALSE); } - if ($row["collapsed"]) { - $docSheet->getRowDimension(intval($row["r"]))->setCollapsed(true); + if (self::boolean($row["collapsed"])) { + $docSheet->getRowDimension(intval($row["r"]))->setCollapsed(TRUE); } if ($row["outlineLevel"] > 0) { $docSheet->getRowDimension(intval($row["r"]))->setOutlineLevel(intval($row["outlineLevel"])); @@ -938,15 +838,15 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader } } - // echo 'Reading cell '.$coordinates[0].$coordinates[1].'
'; + // echo 'Reading cell ', $coordinates[0], $coordinates[1], PHP_EOL; // print_r($c); - // echo '
'; - // echo 'Cell Data Type is '.$cellDataType.': '; + // echo PHP_EOL; + // echo 'Cell Data Type is ', $cellDataType, ': '; // // Read cell! switch ($cellDataType) { case "s": - // echo 'String
'; + // echo 'String', PHP_EOL; if ((string)$c->v != '') { $value = $sharedStrings[intval($c->v)]; @@ -959,7 +859,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader break; case "b": - // echo 'Boolean
'; + // echo 'Boolean', PHP_EOL; if (!isset($c->f)) { $value = self::_castToBool($c); } else { @@ -970,41 +870,41 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader $att = $c->f; $docSheet->getCell($r)->setFormulaAttributes($att); } - // echo '$calculatedValue = '.$calculatedValue.'
'; + // echo '$calculatedValue = ', $calculatedValue, PHP_EOL; } break; case "inlineStr": - // echo 'Inline String
'; + // echo 'Inline String', PHP_EOL; $value = $this->_parseRichText($c->is); break; case "e": - // echo 'Error
'; + // echo 'Error', PHP_EOL; if (!isset($c->f)) { $value = self::_castToError($c); } else { // Formula $this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToError'); - // echo '$calculatedValue = '.$calculatedValue.'
'; + // echo '$calculatedValue = ', $calculatedValue, PHP_EOL; } break; default: - // echo 'Default
'; + // echo 'Default', PHP_EOL; if (!isset($c->f)) { - // echo 'Not a Formula
'; + // echo 'Not a Formula', PHP_EOL; $value = self::_castToString($c); } else { - // echo 'Treat as Formula
'; + // echo 'Treat as Formula', PHP_EOL; // Formula $this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToString'); - // echo '$calculatedValue = '.$calculatedValue.'
'; + // echo '$calculatedValue = ', $calculatedValue, PHP_EOL; } break; } - // echo 'Value is '.$value.'
'; + // echo 'Value is ', $value, PHP_EOL; // Check for numeric values if (is_numeric($value) && $cellDataType != 's') { @@ -1091,12 +991,12 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) { foreach ($aKeys as $key) { $method = "set" . ucfirst($key); - $docSheet->getProtection()->$method($xmlSheet->sheetProtection[$key] == "true"); + $docSheet->getProtection()->$method(self::boolean((string) $xmlSheet->sheetProtection[$key])); } } if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) { - $docSheet->getProtection()->setPassword((string) $xmlSheet->sheetProtection["password"], true); + $docSheet->getProtection()->setPassword((string) $xmlSheet->sheetProtection["password"], TRUE); if ($xmlSheet->protectedRanges->protectedRange) { foreach ($xmlSheet->protectedRanges->protectedRange as $protectedRange) { $docSheet->protectCells((string) $protectedRange["sqref"], (string) $protectedRange["password"], true); @@ -1233,16 +1133,16 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader $docPageSetup->setPaperSize(intval($xmlSheet->pageSetup["paperSize"])); } if (isset($xmlSheet->pageSetup["scale"])) { - $docPageSetup->setScale(intval($xmlSheet->pageSetup["scale"]), false); + $docPageSetup->setScale(intval($xmlSheet->pageSetup["scale"]), FALSE); } if (isset($xmlSheet->pageSetup["fitToHeight"]) && intval($xmlSheet->pageSetup["fitToHeight"]) >= 0) { - $docPageSetup->setFitToHeight(intval($xmlSheet->pageSetup["fitToHeight"]), false); + $docPageSetup->setFitToHeight(intval($xmlSheet->pageSetup["fitToHeight"]), FALSE); } if (isset($xmlSheet->pageSetup["fitToWidth"]) && intval($xmlSheet->pageSetup["fitToWidth"]) >= 0) { - $docPageSetup->setFitToWidth(intval($xmlSheet->pageSetup["fitToWidth"]), false); + $docPageSetup->setFitToWidth(intval($xmlSheet->pageSetup["fitToWidth"]), FALSE); } if (isset($xmlSheet->pageSetup["firstPageNumber"]) && isset($xmlSheet->pageSetup["useFirstPageNumber"]) && - ((string)$xmlSheet->pageSetup["useFirstPageNumber"] == 'true' || (string)$xmlSheet->pageSetup["useFirstPageNumber"] == '1')) { + self::boolean((string) $xmlSheet->pageSetup["useFirstPageNumber"])) { $docPageSetup->setFirstPageNumber(intval($xmlSheet->pageSetup["firstPageNumber"])); } } @@ -1251,28 +1151,28 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader $docHeaderFooter = $docSheet->getHeaderFooter(); if (isset($xmlSheet->headerFooter["differentOddEven"]) && - ((string)$xmlSheet->headerFooter["differentOddEven"] == 'true' || (string)$xmlSheet->headerFooter["differentOddEven"] == '1')) { - $docHeaderFooter->setDifferentOddEven(true); + self::boolean((string)$xmlSheet->headerFooter["differentOddEven"])) { + $docHeaderFooter->setDifferentOddEven(TRUE); } else { - $docHeaderFooter->setDifferentOddEven(false); + $docHeaderFooter->setDifferentOddEven(FALSE); } if (isset($xmlSheet->headerFooter["differentFirst"]) && - ((string)$xmlSheet->headerFooter["differentFirst"] == 'true' || (string)$xmlSheet->headerFooter["differentFirst"] == '1')) { - $docHeaderFooter->setDifferentFirst(true); + self::boolean((string)$xmlSheet->headerFooter["differentFirst"])) { + $docHeaderFooter->setDifferentFirst(TRUE); } else { - $docHeaderFooter->setDifferentFirst(false); + $docHeaderFooter->setDifferentFirst(FALSE); } if (isset($xmlSheet->headerFooter["scaleWithDoc"]) && - ((string)$xmlSheet->headerFooter["scaleWithDoc"] == 'false' || (string)$xmlSheet->headerFooter["scaleWithDoc"] == '0')) { - $docHeaderFooter->setScaleWithDocument(false); + !self::boolean((string)$xmlSheet->headerFooter["scaleWithDoc"])) { + $docHeaderFooter->setScaleWithDocument(FALSE); } else { - $docHeaderFooter->setScaleWithDocument(true); + $docHeaderFooter->setScaleWithDocument(TRUE); } if (isset($xmlSheet->headerFooter["alignWithMargins"]) && - ((string)$xmlSheet->headerFooter["alignWithMargins"] == 'false' || (string)$xmlSheet->headerFooter["alignWithMargins"] == '0')) { - $docHeaderFooter->setAlignWithMargins(false); + !self::boolean((string)$xmlSheet->headerFooter["alignWithMargins"])) { + $docHeaderFooter->setAlignWithMargins(FALSE); } else { - $docHeaderFooter->setAlignWithMargins(true); + $docHeaderFooter->setAlignWithMargins(TRUE); } $docHeaderFooter->setOddHeader((string) $xmlSheet->headerFooter->oddHeader); @@ -1334,7 +1234,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader if (!$this->_readDataOnly) { // Locate hyperlink relations if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { - $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") , 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); foreach ($relsWorksheet->Relationship as $ele) { if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink") { $hyperlinks[(string)$ele["Id"]] = (string)$ele["Target"]; @@ -1351,9 +1251,12 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader foreach (PHPExcel_Cell::extractAllCellReferencesInRange($hyperlink['ref']) as $cellReference) { $cell = $docSheet->getCell( $cellReference ); if (isset($linkRel['id'])) { - $cell->getHyperlink()->setUrl( $hyperlinks[ (string)$linkRel['id'] ] ); - } - if (isset($hyperlink['location'])) { + $hyperlinkUrl = $hyperlinks[ (string)$linkRel['id'] ]; + if (isset($hyperlink['location'])) { + $hyperlinkUrl .= '#' . (string) $hyperlink['location']; + } + $cell->getHyperlink()->setUrl($hyperlinkUrl); + } elseif (isset($hyperlink['location'])) { $cell->getHyperlink()->setUrl( 'sheet://' . (string)$hyperlink['location'] ); } @@ -1372,7 +1275,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader if (!$this->_readDataOnly) { // Locate comment relations if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { - $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") , 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); foreach ($relsWorksheet->Relationship as $ele) { if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") { $comments[(string)$ele["Id"]] = (string)$ele["Target"]; @@ -1387,7 +1290,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader foreach ($comments as $relName => $relPath) { // Load comments file $relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath); - $commentsFile = simplexml_load_string($this->_getFromZipArchive($zip, $relPath) ); + $commentsFile = simplexml_load_string($this->_getFromZipArchive($zip, $relPath) , 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); // Utility variables $authors = array(); @@ -1408,7 +1311,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader foreach ($vmlComments as $relName => $relPath) { // Load VML comments file $relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath); - $vmlCommentsFile = simplexml_load_string( $this->_getFromZipArchive($zip, $relPath) ); + $vmlCommentsFile = simplexml_load_string( $this->_getFromZipArchive($zip, $relPath) , 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); $vmlCommentsFile->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); $shapes = $vmlCommentsFile->xpath('//v:shape'); @@ -1459,7 +1362,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader // Header/footer images if ($xmlSheet && $xmlSheet->legacyDrawingHF && !$this->_readDataOnly) { if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { - $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") , 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); $vmlRelationship = ''; foreach ($relsWorksheet->Relationship as $ele) { @@ -1470,7 +1373,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader if ($vmlRelationship != '') { // Fetch linked images - $relsVML = simplexml_load_string($this->_getFromZipArchive($zip, dirname($vmlRelationship) . '/_rels/' . basename($vmlRelationship) . '.rels' )); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $relsVML = simplexml_load_string($this->_getFromZipArchive($zip, dirname($vmlRelationship) . '/_rels/' . basename($vmlRelationship) . '.rels' ), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); $drawings = array(); foreach ($relsVML->Relationship as $ele) { if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") { @@ -1479,16 +1382,16 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader } // Fetch VML document - $vmlDrawing = simplexml_load_string($this->_getFromZipArchive($zip, $vmlRelationship)); + $vmlDrawing = simplexml_load_string($this->_getFromZipArchive($zip, $vmlRelationship), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); $vmlDrawing->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); $hfImages = array(); $shapes = $vmlDrawing->xpath('//v:shape'); - foreach ($shapes as $shape) { + foreach ($shapes as $idx => $shape) { $shape->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); $imageData = $shape->xpath('//v:imagedata'); - $imageData = $imageData[0]; + $imageData = $imageData[$idx]; $imageData = $imageData->attributes('urn:schemas-microsoft-com:office:office'); $style = self::toCSSArray( (string)$shape['style'] ); @@ -1498,11 +1401,13 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader $hfImages[ (string)$shape['id'] ]->setName( (string)$imageData['title'] ); } - $hfImages[ (string)$shape['id'] ]->setPath("zip://$pFilename#" . $drawings[(string)$imageData['relid']], false); + $hfImages[ (string)$shape['id'] ]->setPath("zip://".PHPExcel_Shared_File::realpath($pFilename)."#" . $drawings[(string)$imageData['relid']], false); $hfImages[ (string)$shape['id'] ]->setResizeProportional(false); $hfImages[ (string)$shape['id'] ]->setWidth($style['width']); $hfImages[ (string)$shape['id'] ]->setHeight($style['height']); - $hfImages[ (string)$shape['id'] ]->setOffsetX($style['margin-left']); + if (isset($style['margin-left'])) { + $hfImages[ (string)$shape['id'] ]->setOffsetX($style['margin-left']); + } $hfImages[ (string)$shape['id'] ]->setOffsetY($style['margin-top']); $hfImages[ (string)$shape['id'] ]->setResizeProportional(true); } @@ -1514,9 +1419,9 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader } -// TODO: Autoshapes from twoCellAnchors! + // TODO: Autoshapes from twoCellAnchors! if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) { - $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") , 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); $drawings = array(); foreach ($relsWorksheet->Relationship as $ele) { if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing") { @@ -1526,7 +1431,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader if ($xmlSheet->drawing && !$this->_readDataOnly) { foreach ($xmlSheet->drawing as $drawing) { $fileDrawing = $drawings[(string) self::array_item($drawing->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")]; - $relsDrawing = simplexml_load_string($this->_getFromZipArchive($zip, dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $relsDrawing = simplexml_load_string($this->_getFromZipArchive($zip, dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels") , 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships"); $images = array(); if ($relsDrawing && $relsDrawing->Relationship) { @@ -1542,7 +1447,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader } } } - $xmlDrawing = simplexml_load_string($this->_getFromZipArchive($zip, $fileDrawing))->children("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"); + $xmlDrawing = simplexml_load_string($this->_getFromZipArchive($zip, $fileDrawing), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions())->children("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"); if ($xmlDrawing->oneCellAnchor) { foreach ($xmlDrawing->oneCellAnchor as $oneCellAnchor) { @@ -1553,7 +1458,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader $objDrawing = new PHPExcel_Worksheet_Drawing; $objDrawing->setName((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name")); $objDrawing->setDescription((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr")); - $objDrawing->setPath("zip://$pFilename#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); + $objDrawing->setPath("zip://".PHPExcel_Shared_File::realpath($pFilename)."#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); $objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex((string) $oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1)); $objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff)); $objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff)); @@ -1593,7 +1498,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader $objDrawing = new PHPExcel_Worksheet_Drawing; $objDrawing->setName((string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name")); $objDrawing->setDescription((string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr")); - $objDrawing->setPath("zip://$pFilename#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); + $objDrawing->setPath("zip://".PHPExcel_Shared_File::realpath($pFilename)."#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false); $objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1)); $objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff)); $objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff)); @@ -1679,13 +1584,14 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader // Set print titles foreach ($extractedRange as $range) { $matches = array(); + $range = str_replace('$', '', $range); // check for repeating columns, e g. 'A:A' or 'A:D' - if (preg_match('/^([A-Z]+)\:([A-Z]+)$/', $range, $matches)) { + if (preg_match('/!?([A-Z]+)\:([A-Z]+)$/', $range, $matches)) { $docSheet->getPageSetup()->setColumnsToRepeatAtLeft(array($matches[1], $matches[2])); } // check for repeating rows, e.g. '1:1' or '1:5' - elseif (preg_match('/^(\d+)\:(\d+)$/', $range, $matches)) { + elseif (preg_match('/!?(\d+)\:(\d+)$/', $range, $matches)) { $docSheet->getPageSetup()->setRowsToRepeatAtTop(array($matches[1], $matches[2])); } } @@ -1697,6 +1603,9 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader foreach($rangeSets as $rangeSet) { $range = explode('!', $rangeSet); // FIXME: what if sheetname contains exclamation mark? $rangeSet = isset($range[1]) ? $range[1] : $range[0]; + if (strpos($rangeSet, ':') === FALSE) { + $rangeSet = $rangeSet . ':' . $rangeSet; + } $newRangeSets[] = str_replace('$', '', $rangeSet); } $docSheet->getPageSetup()->setPrintArea(implode(',',$newRangeSets)); @@ -1742,15 +1651,16 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader break; default: - $range = explode('!', (string)$definedName); - if (count($range) == 2) { - $range[0] = str_replace("''", "'", $range[0]); - $range[0] = str_replace("'", "", $range[0]); - if ($worksheet = $docSheet->getParent()->getSheetByName($range[0])) { - $extractedRange = str_replace('$', '', $range[1]); - $scope = $docSheet->getParent()->getSheet((string)$definedName['localSheetId']); - - $excel->addNamedRange( new PHPExcel_NamedRange((string)$definedName['name'], $worksheet, $extractedRange, true, $scope) ); + if ($mapSheetId[(integer) $definedName['localSheetId']] !== null) { + $range = explode('!', (string)$definedName); + if (count($range) == 2) { + $range[0] = str_replace("''", "'", $range[0]); + $range[0] = str_replace("'", "", $range[0]); + if ($worksheet = $docSheet->getParent()->getSheetByName($range[0])) { + $extractedRange = str_replace('$', '', $range[1]); + $scope = $docSheet->getParent()->getSheet($mapSheetId[(integer) $definedName['localSheetId']]); + $excel->addNamedRange( new PHPExcel_NamedRange((string)$definedName['name'], $worksheet, $extractedRange, true, $scope) ); + } } } break; @@ -1780,7 +1690,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader } } - if (!$this->_readDataOnly) { + if ((!$this->_readDataOnly) || (!empty($this->_loadSheetsOnly))) { // active sheet index $activeTab = intval($xmlWorkbook->bookViews->workbookView["activeTab"]); // refers to old sheet index @@ -1801,13 +1711,13 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader if (!$this->_readDataOnly) { - $contentTypes = simplexml_load_string($this->_getFromZipArchive($zip, "[Content_Types].xml")); + $contentTypes = simplexml_load_string($this->_getFromZipArchive($zip, "[Content_Types].xml"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); foreach ($contentTypes->Override as $contentType) { switch ($contentType["ContentType"]) { case "application/vnd.openxmlformats-officedocument.drawingml.chart+xml": if ($this->_includeCharts) { $chartEntryRef = ltrim($contentType['PartName'],'/'); - $chartElements = simplexml_load_string($this->_getFromZipArchive($zip, $chartEntryRef)); + $chartElements = simplexml_load_string($this->_getFromZipArchive($zip, $chartEntryRef), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); $objChart = PHPExcel_Reader_Excel2007_Chart::readChart($chartElements,basename($chartEntryRef,'.xml')); // echo 'Chart ',$chartEntryRef,'
'; @@ -1880,13 +1790,13 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader $docStyle->getFont()->setName((string) $style->font->name["val"]); $docStyle->getFont()->setSize((string) $style->font->sz["val"]); if (isset($style->font->b)) { - $docStyle->getFont()->setBold(!isset($style->font->b["val"]) || $style->font->b["val"] == 'true' || $style->font->b["val"] == '1'); + $docStyle->getFont()->setBold(!isset($style->font->b["val"]) || self::boolean((string) $style->font->b["val"])); } if (isset($style->font->i)) { - $docStyle->getFont()->setItalic(!isset($style->font->i["val"]) || $style->font->i["val"] == 'true' || $style->font->i["val"] == '1'); + $docStyle->getFont()->setItalic(!isset($style->font->i["val"]) || self::boolean((string) $style->font->i["val"])); } if (isset($style->font->strike)) { - $docStyle->getFont()->setStrikethrough(!isset($style->font->strike["val"]) || $style->font->strike["val"] == 'true' || $style->font->strike["val"] == '1'); + $docStyle->getFont()->setStrikethrough(!isset($style->font->strike["val"]) || self::boolean((string) $style->font->strike["val"])); } $docStyle->getFont()->getColor()->setARGB(self::_readColor($style->font->color)); @@ -1934,21 +1844,15 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader // border if (isset($style->border)) { - $diagonalUp = false; - $diagonalDown = false; - if ($style->border["diagonalUp"] == 'true' || $style->border["diagonalUp"] == 1) { - $diagonalUp = true; - } - if ($style->border["diagonalDown"] == 'true' || $style->border["diagonalDown"] == 1) { - $diagonalDown = true; - } - if ($diagonalUp == false && $diagonalDown == false) { + $diagonalUp = self::boolean((string) $style->border["diagonalUp"]); + $diagonalDown = self::boolean((string) $style->border["diagonalDown"]); + if (!$diagonalUp && !$diagonalDown) { $docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_NONE); - } elseif ($diagonalUp == true && $diagonalDown == false) { + } elseif ($diagonalUp && !$diagonalDown) { $docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_UP); - } elseif ($diagonalUp == false && $diagonalDown == true) { + } elseif (!$diagonalUp && $diagonalDown) { $docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_DOWN); - } elseif ($diagonalUp == true && $diagonalDown == true) { + } else { $docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_BOTH); } self::_readBorder($docStyle->getBorders()->getLeft(), $style->border->left); @@ -1971,15 +1875,15 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader } $docStyle->getAlignment()->setTextRotation(intval($textRotation)); - $docStyle->getAlignment()->setWrapText( (string)$style->alignment["wrapText"] == "true" || (string)$style->alignment["wrapText"] == "1" ); - $docStyle->getAlignment()->setShrinkToFit( (string)$style->alignment["shrinkToFit"] == "true" || (string)$style->alignment["shrinkToFit"] == "1" ); + $docStyle->getAlignment()->setWrapText(self::boolean((string) $style->alignment["wrapText"])); + $docStyle->getAlignment()->setShrinkToFit(self::boolean((string) $style->alignment["shrinkToFit"])); $docStyle->getAlignment()->setIndent( intval((string)$style->alignment["indent"]) > 0 ? intval((string)$style->alignment["indent"]) : 0 ); } // protection if (isset($style->protection)) { if (isset($style->protection['locked'])) { - if ((string)$style->protection['locked'] == 'true') { + if (self::boolean((string) $style->protection['locked'])) { $docStyle->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_PROTECTED); } else { $docStyle->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED); @@ -1987,13 +1891,18 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader } if (isset($style->protection['hidden'])) { - if ((string)$style->protection['hidden'] == 'true') { + if (self::boolean((string) $style->protection['hidden'])) { $docStyle->getProtection()->setHidden(PHPExcel_Style_Protection::PROTECTION_PROTECTED); } else { $docStyle->getProtection()->setHidden(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED); } } } + + // top-level style settings + if (isset($style->quotePrefix)) { + $docStyle->setQuotePrefix($style->quotePrefix); + } } @@ -2032,23 +1941,23 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader $objText->getFont()->setColor( new PHPExcel_Style_Color( self::_readColor($run->rPr->color) ) ); } - if ( (isset($run->rPr->b["val"]) && ((string) $run->rPr->b["val"] == 'true' || (string) $run->rPr->b["val"] == '1')) - || (isset($run->rPr->b) && !isset($run->rPr->b["val"])) ) { - $objText->getFont()->setBold(true); + if ((isset($run->rPr->b["val"]) && self::boolean((string) $run->rPr->b["val"])) || + (isset($run->rPr->b) && !isset($run->rPr->b["val"]))) { + $objText->getFont()->setBold(TRUE); } - if ( (isset($run->rPr->i["val"]) && ((string) $run->rPr->i["val"] == 'true' || (string) $run->rPr->i["val"] == '1')) - || (isset($run->rPr->i) && !isset($run->rPr->i["val"])) ) { - $objText->getFont()->setItalic(true); + if ((isset($run->rPr->i["val"]) && self::boolean((string) $run->rPr->i["val"])) || + (isset($run->rPr->i) && !isset($run->rPr->i["val"]))) { + $objText->getFont()->setItalic(TRUE); } if (isset($run->rPr->vertAlign) && isset($run->rPr->vertAlign["val"])) { $vertAlign = strtolower((string)$run->rPr->vertAlign["val"]); if ($vertAlign == 'superscript') { - $objText->getFont()->setSuperScript(true); + $objText->getFont()->setSuperScript(TRUE); } if ($vertAlign == 'subscript') { - $objText->getFont()->setSubScript(true); + $objText->getFont()->setSubScript(TRUE); } } @@ -2058,9 +1967,9 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader $objText->getFont()->setUnderline((string)$run->rPr->u["val"]); } - if ( (isset($run->rPr->strike["val"]) && ((string) $run->rPr->strike["val"] == 'true' || (string) $run->rPr->strike["val"] == '1')) - || (isset($run->rPr->strike) && !isset($run->rPr->strike["val"])) ) { - $objText->getFont()->setStrikethrough(true); + if ((isset($run->rPr->strike["val"]) && self::boolean((string) $run->rPr->strike["val"])) || + (isset($run->rPr->strike) && !isset($run->rPr->strike["val"]))) { + $objText->getFont()->setStrikethrough(TRUE); } } } @@ -2069,6 +1978,43 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader return $value; } + private function _readRibbon($excel, $customUITarget, $zip) + { + $baseDir = dirname($customUITarget); + $nameCustomUI = basename($customUITarget); + // get the xml file (ribbon) + $localRibbon = $this->_getFromZipArchive($zip, $customUITarget); + $customUIImagesNames = array(); + $customUIImagesBinaries = array(); + // something like customUI/_rels/customUI.xml.rels + $pathRels = $baseDir . '/_rels/' . $nameCustomUI . '.rels'; + $dataRels = $this->_getFromZipArchive($zip, $pathRels); + if ($dataRels) { + // exists and not empty if the ribbon have some pictures (other than internal MSO) + $UIRels = simplexml_load_string($dataRels, 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); + if ($UIRels) { + // we need to save id and target to avoid parsing customUI.xml and "guess" if it's a pseudo callback who load the image + foreach ($UIRels->Relationship as $ele) { + if ($ele["Type"] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image') { + // an image ? + $customUIImagesNames[(string) $ele['Id']] = (string)$ele['Target']; + $customUIImagesBinaries[(string)$ele['Target']] = $this->_getFromZipArchive($zip, $baseDir . '/' . (string) $ele['Target']); + } + } + } + } + if ($localRibbon) { + $excel->setRibbonXMLData($customUITarget, $localRibbon); + if (count($customUIImagesNames) > 0 && count($customUIImagesBinaries) > 0) { + $excel->setRibbonBinObjects($customUIImagesNames, $customUIImagesBinaries); + } else { + $excel->setRibbonBinObjects(NULL); + } + } else { + $excel->setRibbonXMLData(NULL); + $excel->setRibbonBinObjects(NULL); + } + } private static function array_item($array, $key = 0) { return (isset($array[$key]) ? $array[$key] : null); @@ -2109,4 +2055,15 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader return $style; } + + private static function boolean($value = NULL) + { + if (is_object($value)) { + $value = (string) $value; + } + if (is_numeric($value)) { + return (bool) $value; + } + return ($value === 'true' || $value === 'TRUE'); + } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Reader/Excel2007/Chart.php b/htdocs/includes/phpexcel/PHPExcel/Reader/Excel2007/Chart.php index f4d38bdb44a..0de88acb120 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Reader/Excel2007/Chart.php +++ b/htdocs/includes/phpexcel/PHPExcel/Reader/Excel2007/Chart.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,10 +19,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Reader_Excel5 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @package PHPExcel_Reader_Excel2007 + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ /** @@ -30,7 +30,7 @@ * * @category PHPExcel * @package PHPExcel_Reader_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Reader_Excel2007_Chart { @@ -42,7 +42,7 @@ class PHPExcel_Reader_Excel2007_Chart } elseif ($format == 'integer') { return (integer) $attributes[$name]; } elseif ($format == 'boolean') { - return (boolean) ($attributes[$name] == '0') ? false : true; + return (boolean) ($attributes[$name] === '0' || $attributes[$name] !== 'true') ? false : true; } else { return (float) $attributes[$name]; } @@ -347,6 +347,10 @@ class PHPExcel_Reader_Excel2007_Chart } } + if (empty($seriesVal)) { + $seriesVal = NULL; + } + return array( 'formatCode' => $formatCode, 'pointCount' => $pointCount, 'dataValues' => $seriesVal diff --git a/htdocs/includes/phpexcel/PHPExcel/Reader/Excel2007/Theme.php b/htdocs/includes/phpexcel/PHPExcel/Reader/Excel2007/Theme.php index 6b38fa79fb9..820fa96db89 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Reader/Excel2007/Theme.php +++ b/htdocs/includes/phpexcel/PHPExcel/Reader/Excel2007/Theme.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Reader_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Reader_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Reader_Excel2007_Theme { diff --git a/htdocs/includes/phpexcel/PHPExcel/Reader/Excel5.php b/htdocs/includes/phpexcel/PHPExcel/Reader/Excel5.php index 535654243c2..91e0fa086f7 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Reader/Excel5.php +++ b/htdocs/includes/phpexcel/PHPExcel/Reader/Excel5.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Reader_Excel5 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ // Original file header of ParseXL (used as the base for this class): @@ -73,9 +73,9 @@ if (!defined('PHPEXCEL_ROOT')) { * * @category PHPExcel * @package PHPExcel_Reader_Excel5 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader +class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader { // ParseXL definitions const XLS_BIFF8 = 0x0600; @@ -156,32 +156,16 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader const XLS_Type_RANGEPROTECTION = 0x0868; const XLS_Type_SHEETLAYOUT = 0x0862; const XLS_Type_XFEXT = 0x087d; + const XLS_Type_PAGELAYOUTVIEW = 0x088b; const XLS_Type_UNKNOWN = 0xffff; - - /** - * Read data only? - * Identifies whether the Reader should only read data values for cells, and ignore any formatting information; - * or whether it should read both data and formatting - * - * @var boolean - */ - private $_readDataOnly = false; - - /** - * Restrict which sheets should be loaded? - * This property holds an array of worksheet names to be loaded. If null, then all worksheets will be loaded. - * - * @var array of string - */ - private $_loadSheetsOnly = null; - - /** - * PHPExcel_Reader_IReadFilter instance - * - * @var PHPExcel_Reader_IReadFilter - */ - private $_readFilter = null; + // Encryption type + const MS_BIFF_CRYPTO_NONE = 0; + const MS_BIFF_CRYPTO_XOR = 1; + const MS_BIFF_CRYPTO_RC4 = 2; + + // Size of stream blocks when using RC4 encryption + const REKEY_BLOCK = 0x400; /** * Summary Information stream data. @@ -402,6 +386,40 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader */ private $_sharedFormulaParts; + /** + * The type of encryption in use + * + * @var int + */ + private $_encryption = 0; + + /** + * The position in the stream after which contents are encrypted + * + * @var int + */ + private $_encryptionStartPos = false; + + /** + * The current RC4 decryption object + * + * @var PHPExcel_Reader_Excel5_RC4 + */ + private $_rc4Key = null; + + /** + * The position in the stream that the RC4 decryption object was left at + * + * @var int + */ + private $_rc4Pos = 0; + + /** + * The current MD5 context state + * + * @var string + */ + private $_md5Ctxt = null; /** * Create a new PHPExcel_Reader_Excel5 instance @@ -411,112 +429,18 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader } - /** - * Read data only? - * If this is true, then the Reader will only read data values for cells, it will not read any formatting information. - * If false (the default) it will read data and formatting. - * - * @return boolean - */ - public function getReadDataOnly() - { - return $this->_readDataOnly; - } - - - /** - * Set read data only - * Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information. - * Set to false (the default) to advise the Reader to read both data and formatting for cells. - * - * @param boolean $pValue - * - * @return PHPExcel_Reader_Excel5 - */ - public function setReadDataOnly($pValue = false) - { - $this->_readDataOnly = $pValue; - return $this; - } - - - /** - * Get which sheets to load - * Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null - * indicating that all worksheets in the workbook should be loaded. - * - * @return mixed - */ - public function getLoadSheetsOnly() - { - return $this->_loadSheetsOnly; - } - - - /** - * Set which sheets to load - * - * @param mixed $value - * This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name. - * If NULL, then it tells the Reader to read all worksheets in the workbook - * - * @return PHPExcel_Reader_Excel5 - */ - public function setLoadSheetsOnly($value = null) - { - $this->_loadSheetsOnly = is_array($value) ? - $value : array($value); - return $this; - } - - - /** - * Set all sheets to load - * Tells the Reader to load all worksheets from the workbook. - * - * @return PHPExcel_Reader_Excel5 - */ - public function setLoadAllSheets() - { - $this->_loadSheetsOnly = null; - return $this; - } - - - /** - * Read filter - * - * @return PHPExcel_Reader_IReadFilter - */ - public function getReadFilter() { - return $this->_readFilter; - } - - - /** - * Set read filter - * - * @param PHPExcel_Reader_IReadFilter $pValue - * @return PHPExcel_Reader_Excel5 - */ - public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) { - $this->_readFilter = $pValue; - return $this; - } - - /** * Can the current PHPExcel_Reader_IReader read the file? * - * @param string $pFileName + * @param string $pFilename * @return boolean - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function canRead($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } try { @@ -526,8 +450,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader // get excel data $res = $ole->read($pFilename); return true; - - } catch (Exception $e) { + } catch (PHPExcel_Exception $e) { return false; } } @@ -537,13 +460,13 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object * * @param string $pFilename - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function listWorksheetNames($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } $worksheetNames = array(); @@ -586,13 +509,13 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) * * @param string $pFilename - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function listWorksheetInfo($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } $worksheetInfo = array(); @@ -649,7 +572,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader case self::XLS_Type_BOOLERR: case self::XLS_Type_LABEL: $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -681,7 +604,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader * * @param string $pFilename * @return PHPExcel - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function load($pFilename) { @@ -903,6 +826,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader case self::XLS_Type_MSODRAWING: $this->_readMsoDrawing(); break; case self::XLS_Type_OBJ: $this->_readObj(); break; case self::XLS_Type_WINDOW2: $this->_readWindow2(); break; + case self::XLS_Type_PAGELAYOUTVIEW: $this->_readPageLayoutView(); break; case self::XLS_Type_SCL: $this->_readScl(); break; case self::XLS_Type_PANE: $this->_readPane(); break; case self::XLS_Type_SELECTION: $this->_readSelection(); break; @@ -1073,7 +997,6 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader case pack('C', 0x06): // print area // in general, formula looks like this: Foo!$C$7:$J$66,Bar!$A$1:$IV$2 - $ranges = explode(',', $definedName['formula']); // FIXME: what if sheetname contains comma? $extractedRanges = array(); @@ -1083,9 +1006,12 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader // Bar!$A$1:$IV$2 $explodes = explode('!', $range); // FIXME: what if sheetname contains exclamation mark? - $sheetName = $explodes[0]; + $sheetName = trim($explodes[0], "'"); if (count($explodes) == 2) { + if (strpos($explodes[1], ':') === FALSE) { + $explodes[1] = $explodes[1] . ':' . $explodes[1]; + } $extractedRanges[] = str_replace('$', '', $explodes[1]); // C7:J66 } } @@ -1166,7 +1092,63 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader return $this->_phpExcel; } + + /** + * Read record data from stream, decrypting as required + * + * @param string $data Data stream to read from + * @param int $pos Position to start reading from + * @param int $length Record data length + * + * @return string Record data + */ + private function _readRecordData($data, $pos, $len) + { + $data = substr($data, $pos, $len); + + // File not encrypted, or record before encryption start point + if ($this->_encryption == self::MS_BIFF_CRYPTO_NONE || $pos < $this->_encryptionStartPos) { + return $data; + } + + $recordData = ''; + if ($this->_encryption == self::MS_BIFF_CRYPTO_RC4) { + $oldBlock = floor($this->_rc4Pos / self::REKEY_BLOCK); + $block = floor($pos / self::REKEY_BLOCK); + $endBlock = floor(($pos + $len) / self::REKEY_BLOCK); + + // Spin an RC4 decryptor to the right spot. If we have a decryptor sitting + // at a point earlier in the current block, re-use it as we can save some time. + if ($block != $oldBlock || $pos < $this->_rc4Pos || !$this->_rc4Key) { + $this->_rc4Key = $this->_makeKey($block, $this->_md5Ctxt); + $step = $pos % self::REKEY_BLOCK; + } else { + $step = $pos - $this->_rc4Pos; + } + $this->_rc4Key->RC4(str_repeat("\0", $step)); + + // Decrypt record data (re-keying at the end of every block) + while ($block != $endBlock) { + $step = self::REKEY_BLOCK - ($pos % self::REKEY_BLOCK); + $recordData .= $this->_rc4Key->RC4(substr($data, 0, $step)); + $data = substr($data, $step); + $pos += $step; + $len -= $step; + $block++; + $this->_rc4Key = $this->_makeKey($block, $this->_md5Ctxt); + } + $recordData .= $this->_rc4Key->RC4(substr($data, 0, $len)); + + // Keep track of the position of this decryptor. + // We'll try and re-use it later if we can to speed things up + $this->_rc4Pos = $pos + $len; + + } elseif ($this->_encryption == self::MS_BIFF_CRYPTO_XOR) { + throw new PHPExcel_Reader_Exception('XOr encryption not supported'); + } + return $recordData; + } /** * Use OLE reader to extract the relevant data streams from the OLE file @@ -1519,7 +1501,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readDefault() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); -// $recordData = substr($this->_data, $this->_pos + 4, $length); +// $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -1534,7 +1516,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader { // echo 'Read Cell Annotation
'; $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -1596,7 +1578,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readTextObject() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -1648,7 +1630,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader case self::XLS_WorkbookGlobals: $version = self::_GetInt2d($recordData, 0); if (($version != self::XLS_BIFF8) && ($version != self::XLS_BIFF7)) { - throw new Exception('Cannot read this Excel file. Version is too old.'); + throw new PHPExcel_Reader_Exception('Cannot read this Excel file. Version is too old.'); } $this->_version = $version; break; @@ -1680,18 +1662,156 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader * * -- "OpenOffice.org's Documentation of the Microsoft * Excel File Format" + * + * The decryption functions and objects used from here on in + * are based on the source of Spreadsheet-ParseExcel: + * http://search.cpan.org/~jmcnamara/Spreadsheet-ParseExcel/ */ private function _readFilepass() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); -// $recordData = substr($this->_data, $this->_pos + 4, $length); + if ($length != 54) { + throw new PHPExcel_Reader_Exception('Unexpected file pass record length'); + } + + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + // move stream pointer to next record $this->_pos += 4 + $length; + + if (!$this->_verifyPassword( + 'VelvetSweatshop', + substr($recordData, 6, 16), + substr($recordData, 22, 16), + substr($recordData, 38, 16), + $this->_md5Ctxt + )) { + throw new PHPExcel_Reader_Exception('Decryption password incorrect'); + } + + $this->_encryption = self::MS_BIFF_CRYPTO_RC4; - throw new Exception('Cannot read encrypted file'); + // Decryption required from the record after next onwards + $this->_encryptionStartPos = $this->_pos + self::_GetInt2d($this->_data, $this->_pos + 2); } + /** + * Make an RC4 decryptor for the given block + * + * @var int $block Block for which to create decrypto + * @var string $valContext MD5 context state + * + * @return PHPExcel_Reader_Excel5_RC4 + */ + private function _makeKey($block, $valContext) + { + $pwarray = str_repeat("\0", 64); + + for ($i = 0; $i < 5; $i++) { + $pwarray[$i] = $valContext[$i]; + } + + $pwarray[5] = chr($block & 0xff); + $pwarray[6] = chr(($block >> 8) & 0xff); + $pwarray[7] = chr(($block >> 16) & 0xff); + $pwarray[8] = chr(($block >> 24) & 0xff); + + $pwarray[9] = "\x80"; + $pwarray[56] = "\x48"; + + $md5 = new PHPExcel_Reader_Excel5_MD5(); + $md5->add($pwarray); + + $s = $md5->getContext(); + return new PHPExcel_Reader_Excel5_RC4($s); + } + + /** + * Verify RC4 file password + * + * @var string $password Password to check + * @var string $docid Document id + * @var string $salt_data Salt data + * @var string $hashedsalt_data Hashed salt data + * @var string &$valContext Set to the MD5 context of the value + * + * @return bool Success + */ + private function _verifyPassword($password, $docid, $salt_data, $hashedsalt_data, &$valContext) + { + $pwarray = str_repeat("\0", 64); + + for ($i = 0; $i < strlen($password); $i++) { + $o = ord(substr($password, $i, 1)); + $pwarray[2 * $i] = chr($o & 0xff); + $pwarray[2 * $i + 1] = chr(($o >> 8) & 0xff); + } + $pwarray[2 * $i] = chr(0x80); + $pwarray[56] = chr(($i << 4) & 0xff); + + $md5 = new PHPExcel_Reader_Excel5_MD5(); + $md5->add($pwarray); + + $mdContext1 = $md5->getContext(); + + $offset = 0; + $keyoffset = 0; + $tocopy = 5; + + $md5->reset(); + + while ($offset != 16) { + if ((64 - $offset) < 5) { + $tocopy = 64 - $offset; + } + + for ($i = 0; $i <= $tocopy; $i++) { + $pwarray[$offset + $i] = $mdContext1[$keyoffset + $i]; + } + + $offset += $tocopy; + + if ($offset == 64) { + $md5->add($pwarray); + $keyoffset = $tocopy; + $tocopy = 5 - $tocopy; + $offset = 0; + continue; + } + + $keyoffset = 0; + $tocopy = 5; + for ($i = 0; $i < 16; $i++) { + $pwarray[$offset + $i] = $docid[$i]; + } + $offset += 16; + } + + $pwarray[16] = "\x80"; + for ($i = 0; $i < 47; $i++) { + $pwarray[17 + $i] = "\0"; + } + $pwarray[56] = "\x80"; + $pwarray[57] = "\x0a"; + + $md5->add($pwarray); + $valContext = $md5->getContext(); + + $key = $this->_makeKey(0, $valContext); + + $salt = $key->RC4($salt_data); + $hashedsalt = $key->RC4($hashedsalt_data); + + $salt .= "\x80" . str_repeat("\0", 47); + $salt[56] = "\x80"; + + $md5->reset(); + $md5->add($salt); + $mdContext2 = $md5->getContext(); + + return $mdContext2 == $hashedsalt; + } /** * CODEPAGE @@ -1705,7 +1825,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readCodepage() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -1732,7 +1852,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readDateMode() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -1751,7 +1871,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readFont() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -1849,7 +1969,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readFormat() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -1887,7 +2007,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readXf() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -1951,6 +2071,9 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader case 3: $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); break; + case 4: + $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_FILL); + break; case 5: $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY); break; @@ -2170,7 +2293,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readXfExt() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -2347,7 +2470,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readStyle() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -2388,7 +2511,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readPalette() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -2421,14 +2544,15 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readSheet() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + + // offset: 0; size: 4; absolute stream position of the BOF record of the sheet + // NOTE: not encrypted + $rec_offset = self::_GetInt4d($this->_data, $this->_pos + 4); // move stream pointer to next record $this->_pos += 4 + $length; - // offset: 0; size: 4; absolute stream position of the BOF record of the sheet - $rec_offset = self::_GetInt4d($recordData, 0); - // offset: 4; size: 1; sheet state switch (ord($recordData{4})) { case 0x00: $sheetState = PHPExcel_Worksheet::SHEETSTATE_VISIBLE; break; @@ -2464,7 +2588,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readExternalBook() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -2528,7 +2652,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readExternName() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -2563,7 +2687,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readExternSheet() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -2600,7 +2724,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readDefinedName() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -2635,7 +2759,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader try { $formula = $this->_getFormulaFromStructure($formulaStructure); - } catch (Exception $e) { + } catch (PHPExcel_Exception $e) { $formula = ''; } @@ -2862,7 +2986,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readPrintGridlines() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -2881,7 +3005,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readDefaultRowHeight() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -2899,7 +3023,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readSheetPr() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -2926,7 +3050,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readHorizontalPageBreaks() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -2955,7 +3079,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readVerticalPageBreaks() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -2983,7 +3107,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readHeader() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3011,7 +3135,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readFooter() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3038,7 +3162,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readHcenter() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3058,7 +3182,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readVcenter() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3078,7 +3202,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readLeftMargin() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3096,7 +3220,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readRightMargin() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3114,7 +3238,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readTopMargin() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3132,7 +3256,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readBottomMargin() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3150,7 +3274,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readPageSetup() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3208,7 +3332,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readProtect() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3231,7 +3355,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readScenProtect() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3255,7 +3379,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readObjectProtect() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3279,7 +3403,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readPassword() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3298,7 +3422,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readDefColWidth() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3317,7 +3441,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readColInfo() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3376,7 +3500,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readRow() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3446,7 +3570,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readRk() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3491,7 +3615,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readLabelSst() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3569,7 +3693,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readMulRk() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3624,7 +3748,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readNumber() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3666,7 +3790,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readFormula() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3777,12 +3901,12 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader // add cell value. If we can read formula, populate with formula, otherwise just used cached value try { if ($this->_version != self::XLS_BIFF8) { - throw new Exception('Not BIFF8. Can only read BIFF8 formulas'); + throw new PHPExcel_Reader_Exception('Not BIFF8. Can only read BIFF8 formulas'); } $formula = $this->_getFormulaFromStructure($formulaStructure); // get formula in human language $cell->setValueExplicit('=' . $formula, PHPExcel_Cell_DataType::TYPE_FORMULA); - } catch (Exception $e) { + } catch (PHPExcel_Exception $e) { $cell->setValueExplicit($value, $dataType); } } else { @@ -3807,7 +3931,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readSharedFmla() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3840,7 +3964,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readString() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3868,7 +3992,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readBoolErr() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3927,7 +4051,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readMulBlank() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -3969,7 +4093,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readLabel() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -4012,7 +4136,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readBlank() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -4059,7 +4183,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readObj() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -4104,7 +4228,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readWindow2() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -4112,6 +4236,22 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader // offset: 0; size: 2; option flags $options = self::_GetInt2d($recordData, 0); + // offset: 2; size: 2; index to first visible row + $firstVisibleRow = self::_GetInt2d($recordData, 2); + + // offset: 4; size: 2; index to first visible colum + $firstVisibleColumn = self::_GetInt2d($recordData, 4); + if ($this->_version === self::XLS_BIFF8) { + // offset: 8; size: 2; not used + // offset: 10; size: 2; cached magnification factor in page break preview (in percent); 0 = Default (60%) + // offset: 12; size: 2; cached magnification factor in normal view (in percent); 0 = Default (100%) + // offset: 14; size: 4; not used + $zoomscaleInPageBreakPreview = self::_GetInt2d($recordData, 10); + if ($zoomscaleInPageBreakPreview === 0) $zoomscaleInPageBreakPreview = 60; + $zoomscaleInNormalView = self::_GetInt2d($recordData, 12); + if ($zoomscaleInNormalView === 0) $zoomscaleInNormalView = 100; + } + // bit: 1; mask: 0x0002; 0 = do not show gridlines, 1 = show gridlines $showGridlines = (bool) ((0x0002 & $options) >> 1); $this->_phpSheet->setShowGridlines($showGridlines); @@ -4131,8 +4271,62 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader if ($isActive) { $this->_phpExcel->setActiveSheetIndex($this->_phpExcel->getIndex($this->_phpSheet)); } + + // bit: 11; mask: 0x0800; 0 = normal view, 1 = page break view + $isPageBreakPreview = (bool) ((0x0800 & $options) >> 11); + + //FIXME: set $firstVisibleRow and $firstVisibleColumn + + if ($this->_phpSheet->getSheetView()->getView() !== PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT) { + //NOTE: this setting is inferior to page layout view(Excel2007-) + $view = $isPageBreakPreview? PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW : + PHPExcel_Worksheet_SheetView::SHEETVIEW_NORMAL; + $this->_phpSheet->getSheetView()->setView($view); + if ($this->_version === self::XLS_BIFF8) { + $zoomScale = $isPageBreakPreview? $zoomscaleInPageBreakPreview : $zoomscaleInNormalView; + $this->_phpSheet->getSheetView()->setZoomScale($zoomScale); + $this->_phpSheet->getSheetView()->setZoomScaleNormal($zoomscaleInNormalView); + } + } } + /** + * Read PLV Record(Created by Excel2007 or upper) + */ + private function _readPageLayoutView(){ + $length = self::_GetInt2d($this->_data, $this->_pos + 2); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); + + // move stream pointer to next record + $this->_pos += 4 + $length; + + //var_dump(unpack("vrt/vgrbitFrt/V2reserved/vwScalePLV/vgrbit", $recordData)); + + // offset: 0; size: 2; rt + //->ignore + $rt = self::_GetInt2d($recordData, 0); + // offset: 2; size: 2; grbitfr + //->ignore + $grbitFrt = self::_GetInt2d($recordData, 2); + // offset: 4; size: 8; reserved + //->ignore + + // offset: 12; size 2; zoom scale + $wScalePLV = self::_GetInt2d($recordData, 12); + // offset: 14; size 2; grbit + $grbit = self::_GetInt2d($recordData, 14); + + // decomprise grbit + $fPageLayoutView = $grbit & 0x01; + $fRulerVisible = ($grbit >> 1) & 0x01; //no support + $fWhitespaceHidden = ($grbit >> 3) & 0x01; //no support + + if ($fPageLayoutView === 1) { + $this->_phpSheet->getSheetView()->setView(PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT); + $this->_phpSheet->getSheetView()->setZoomScale($wScalePLV); //set by Excel2007 only if SHEETVIEW_PAGE_LAYOUT + } + //otherwise, we cannot know whether SHEETVIEW_PAGE_LAYOUT or SHEETVIEW_PAGE_BREAK_PREVIEW. + } /** * Read SCL record @@ -4140,7 +4334,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readScl() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -4162,7 +4356,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readPane() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -4190,7 +4384,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readSelection() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -4267,7 +4461,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readMergedCells() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -4290,7 +4484,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readHyperLink() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer forward to next record $this->_pos += 4 + $length; @@ -4299,7 +4493,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader // offset: 0; size: 8; cell range address of all cells containing this hyperlink try { $cellRange = $this->_readBIFF8CellRangeAddressFixed($recordData, 0, 8); - } catch (Exception $e) { + } catch (PHPExcel_Exception $e) { return; } @@ -4466,7 +4660,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readDataValidations() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer forward to next record $this->_pos += 4 + $length; @@ -4479,7 +4673,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readDataValidation() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer forward to next record $this->_pos += 4 + $length; @@ -4583,7 +4777,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader if ($type == PHPExcel_Cell_DataValidation::TYPE_LIST) { $formula1 = str_replace(chr(0), ',', $formula1); } - } catch (Exception $e) { + } catch (PHPExcel_Exception $e) { return; } $offset += $sz1; @@ -4600,7 +4794,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader $formula2 = pack('v', $sz2) . $formula2; // prepend the length try { $formula2 = $this->_getFormulaFromStructure($formula2); - } catch (Exception $e) { + } catch (PHPExcel_Exception $e) { return; } $offset += $sz2; @@ -4639,7 +4833,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readSheetLayout() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -4679,7 +4873,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readSheetProtection() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -4780,7 +4974,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readRangeProtection() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // move stream pointer to next record $this->_pos += 4 + $length; @@ -4812,7 +5006,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader for ($i = 0; $i < $cref; ++$i) { try { $cellRange = $this->_readBIFF8CellRangeAddressFixed(substr($recordData, 27 + 8 * $i, 8)); - } catch (Exception $e) { + } catch (PHPExcel_Exception $e) { return; } $cellRanges[] = $cellRange; @@ -4924,7 +5118,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader private function _readContinue() { $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $recordData = substr($this->_data, $this->_pos + 4, $length); + $recordData = $this->_readRecordData($this->_data, $this->_pos + 4, $length); // check if we are reading drawing data // this is in case a free CONTINUE record occurs in other circumstances we are unaware of @@ -4989,7 +5183,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader $identifier = self::_GetInt2d($this->_data, $this->_pos); // offset: 2; size: 2; length $length = self::_GetInt2d($this->_data, $this->_pos + 2); - $data .= substr($this->_data, $this->_pos + 4, $length); + $data .= $this->_readRecordData($this->_data, $this->_pos + 4, $length); $spliceOffsets[$i] = $spliceOffsets[$i - 1] + $length; @@ -5244,7 +5438,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader * @param string Formula data * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas * @return array - * @throws Exception + * @throws PHPExcel_Reader_Exception */ private function _getNextToken($formulaData, $baseCell = 'A1') { @@ -5345,7 +5539,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader $spacetype = 'type5'; break; default: - throw new Exception('Unrecognized space type in tAttrSpace token'); + throw new PHPExcel_Reader_Exception('Unrecognized space type in tAttrSpace token'); break; } // offset: 3; size: 1; number of inserted spaces/carriage returns @@ -5354,7 +5548,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader $data = array('spacetype' => $spacetype, 'spacecount' => $spacecount); break; default: - throw new Exception('Unrecognized attribute flag in tAttr token'); + throw new PHPExcel_Reader_Exception('Unrecognized attribute flag in tAttr token'); break; } break; @@ -5559,7 +5753,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader case 360: $function = 'PHONETIC'; $args = 1; break; case 368: $function = 'BAHTTEXT'; $args = 1; break; default: - throw new Exception('Unrecognized function in formula'); + throw new PHPExcel_Reader_Exception('Unrecognized function in formula'); break; } $data = array('function' => $function, 'args' => $args); @@ -5663,7 +5857,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader case 366: $function = 'STDEVA'; break; case 367: $function = 'VARA'; break; default: - throw new Exception('Unrecognized function in formula'); + throw new PHPExcel_Reader_Exception('Unrecognized function in formula'); break; } $data = array('function' => $function, 'args' => $args); @@ -5764,7 +5958,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader $cellAddress = $this->_readBIFF8CellAddress(substr($formulaData, 3, 4)); $data = "$sheetRange!$cellAddress"; - } catch (Exception $e) { + } catch (PHPExcel_Exception $e) { // deleted sheet reference $data = '#REF!'; } @@ -5783,7 +5977,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader $cellRangeAddress = $this->_readBIFF8CellRangeAddress(substr($formulaData, 3, 8)); $data = "$sheetRange!$cellRangeAddress"; - } catch (Exception $e) { + } catch (PHPExcel_Exception $e) { // deleted sheet reference $data = '#REF!'; } @@ -5791,7 +5985,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader break; // Unknown cases // don't know how to deal with default: - throw new Exception('Unrecognized token ' . sprintf('%02X', $id) . ' in formula'); + throw new PHPExcel_Reader_Exception('Unrecognized token ' . sprintf('%02X', $id) . ' in formula'); break; } @@ -5885,7 +6079,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader * * @param string $subData * @return string - * @throws Exception + * @throws PHPExcel_Reader_Exception */ private function _readBIFF5CellRangeAddressFixed($subData) { @@ -5903,7 +6097,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader // check values if ($fr > $lr || $fc > $lc) { - throw new Exception('Not a cell range address'); + throw new PHPExcel_Reader_Exception('Not a cell range address'); } // column index to letter @@ -5924,7 +6118,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader * * @param string $subData * @return string - * @throws Exception + * @throws PHPExcel_Reader_Exception */ private function _readBIFF8CellRangeAddressFixed($subData) { @@ -5942,7 +6136,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader // check values if ($fr > $lr || $fc > $lc) { - throw new Exception('Not a cell range address'); + throw new PHPExcel_Reader_Exception('Not a cell range address'); } // column index to letter @@ -6152,11 +6346,11 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader * Get a sheet range like Sheet1:Sheet3 from REF index * Note: If there is only one sheet in the range, one gets e.g Sheet1 * It can also happen that the REF structure uses the -1 (FFFF) code to indicate deleted sheets, - * in which case an exception is thrown + * in which case an PHPExcel_Reader_Exception is thrown * * @param int $index * @return string|false - * @throws Exception + * @throws PHPExcel_Reader_Exception */ private function _readSheetRangeByRefIndex($index) { @@ -6168,7 +6362,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader case 'internal': // check if we have a deleted 3d reference if ($this->_ref[$index]['firstSheetIndex'] == 0xFFFF or $this->_ref[$index]['lastSheetIndex'] == 0xFFFF) { - throw new Exception('Deleted sheet reference'); + throw new PHPExcel_Reader_Exception('Deleted sheet reference'); } // we have normal sheet range (collapsed or uncollapsed) @@ -6198,7 +6392,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader default: // TODO: external sheet support - throw new Exception('Excel5 reader only supports internal sheets in fomulas'); + throw new PHPExcel_Reader_Exception('Excel5 reader only supports internal sheets in fomulas'); break; } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Reader/Excel5/Escher.php b/htdocs/includes/phpexcel/PHPExcel/Reader/Excel5/Escher.php index e167655ffd6..3ed82c62ae6 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Reader/Excel5/Escher.php +++ b/htdocs/includes/phpexcel/PHPExcel/Reader/Excel5/Escher.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Reader_Excel5 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ /** @@ -30,7 +30,7 @@ * * @category PHPExcel * @package PHPExcel_Reader_Excel5 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Reader_Excel5_Escher { diff --git a/htdocs/includes/phpexcel/PHPExcel/Reader/Excel5/MD5.php b/htdocs/includes/phpexcel/PHPExcel/Reader/Excel5/MD5.php new file mode 100644 index 00000000000..946d5a0da70 --- /dev/null +++ b/htdocs/includes/phpexcel/PHPExcel/Reader/Excel5/MD5.php @@ -0,0 +1,221 @@ +reset(); + } + + + /** + * Reset the MD5 stream context + */ + public function reset() + { + $this->a = 0x67452301; + $this->b = 0xEFCDAB89; + $this->c = 0x98BADCFE; + $this->d = 0x10325476; + } + + + /** + * Get MD5 stream context + * + * @return string + */ + public function getContext() + { + $s = ''; + foreach (array('a', 'b', 'c', 'd') as $i) { + $v = $this->{$i}; + $s .= chr($v & 0xff); + $s .= chr(($v >> 8) & 0xff); + $s .= chr(($v >> 16) & 0xff); + $s .= chr(($v >> 24) & 0xff); + } + + return $s; + } + + + /** + * Add data to context + * + * @param string $data Data to add + */ + public function add($data) + { + $words = array_values(unpack('V16', $data)); + + $A = $this->a; + $B = $this->b; + $C = $this->c; + $D = $this->d; + + $F = array('PHPExcel_Reader_Excel5_MD5','F'); + $G = array('PHPExcel_Reader_Excel5_MD5','G'); + $H = array('PHPExcel_Reader_Excel5_MD5','H'); + $I = array('PHPExcel_Reader_Excel5_MD5','I'); + + /* ROUND 1 */ + self::step($F, $A, $B, $C, $D, $words[0], 7, 0xd76aa478); + self::step($F, $D, $A, $B, $C, $words[1], 12, 0xe8c7b756); + self::step($F, $C, $D, $A, $B, $words[2], 17, 0x242070db); + self::step($F, $B, $C, $D, $A, $words[3], 22, 0xc1bdceee); + self::step($F, $A, $B, $C, $D, $words[4], 7, 0xf57c0faf); + self::step($F, $D, $A, $B, $C, $words[5], 12, 0x4787c62a); + self::step($F, $C, $D, $A, $B, $words[6], 17, 0xa8304613); + self::step($F, $B, $C, $D, $A, $words[7], 22, 0xfd469501); + self::step($F, $A, $B, $C, $D, $words[8], 7, 0x698098d8); + self::step($F, $D, $A, $B, $C, $words[9], 12, 0x8b44f7af); + self::step($F, $C, $D, $A, $B, $words[10], 17, 0xffff5bb1); + self::step($F, $B, $C, $D, $A, $words[11], 22, 0x895cd7be); + self::step($F, $A, $B, $C, $D, $words[12], 7, 0x6b901122); + self::step($F, $D, $A, $B, $C, $words[13], 12, 0xfd987193); + self::step($F, $C, $D, $A, $B, $words[14], 17, 0xa679438e); + self::step($F, $B, $C, $D, $A, $words[15], 22, 0x49b40821); + + /* ROUND 2 */ + self::step($G, $A, $B, $C, $D, $words[1], 5, 0xf61e2562); + self::step($G, $D, $A, $B, $C, $words[6], 9, 0xc040b340); + self::step($G, $C, $D, $A, $B, $words[11], 14, 0x265e5a51); + self::step($G, $B, $C, $D, $A, $words[0], 20, 0xe9b6c7aa); + self::step($G, $A, $B, $C, $D, $words[5], 5, 0xd62f105d); + self::step($G, $D, $A, $B, $C, $words[10], 9, 0x02441453); + self::step($G, $C, $D, $A, $B, $words[15], 14, 0xd8a1e681); + self::step($G, $B, $C, $D, $A, $words[4], 20, 0xe7d3fbc8); + self::step($G, $A, $B, $C, $D, $words[9], 5, 0x21e1cde6); + self::step($G, $D, $A, $B, $C, $words[14], 9, 0xc33707d6); + self::step($G, $C, $D, $A, $B, $words[3], 14, 0xf4d50d87); + self::step($G, $B, $C, $D, $A, $words[8], 20, 0x455a14ed); + self::step($G, $A, $B, $C, $D, $words[13], 5, 0xa9e3e905); + self::step($G, $D, $A, $B, $C, $words[2], 9, 0xfcefa3f8); + self::step($G, $C, $D, $A, $B, $words[7], 14, 0x676f02d9); + self::step($G, $B, $C, $D, $A, $words[12], 20, 0x8d2a4c8a); + + /* ROUND 3 */ + self::step($H, $A, $B, $C, $D, $words[5], 4, 0xfffa3942); + self::step($H, $D, $A, $B, $C, $words[8], 11, 0x8771f681); + self::step($H, $C, $D, $A, $B, $words[11], 16, 0x6d9d6122); + self::step($H, $B, $C, $D, $A, $words[14], 23, 0xfde5380c); + self::step($H, $A, $B, $C, $D, $words[1], 4, 0xa4beea44); + self::step($H, $D, $A, $B, $C, $words[4], 11, 0x4bdecfa9); + self::step($H, $C, $D, $A, $B, $words[7], 16, 0xf6bb4b60); + self::step($H, $B, $C, $D, $A, $words[10], 23, 0xbebfbc70); + self::step($H, $A, $B, $C, $D, $words[13], 4, 0x289b7ec6); + self::step($H, $D, $A, $B, $C, $words[0], 11, 0xeaa127fa); + self::step($H, $C, $D, $A, $B, $words[3], 16, 0xd4ef3085); + self::step($H, $B, $C, $D, $A, $words[6], 23, 0x04881d05); + self::step($H, $A, $B, $C, $D, $words[9], 4, 0xd9d4d039); + self::step($H, $D, $A, $B, $C, $words[12], 11, 0xe6db99e5); + self::step($H, $C, $D, $A, $B, $words[15], 16, 0x1fa27cf8); + self::step($H, $B, $C, $D, $A, $words[2], 23, 0xc4ac5665); + + /* ROUND 4 */ + self::step($I, $A, $B, $C, $D, $words[0], 6, 0xf4292244); + self::step($I, $D, $A, $B, $C, $words[7], 10, 0x432aff97); + self::step($I, $C, $D, $A, $B, $words[14], 15, 0xab9423a7); + self::step($I, $B, $C, $D, $A, $words[5], 21, 0xfc93a039); + self::step($I, $A, $B, $C, $D, $words[12], 6, 0x655b59c3); + self::step($I, $D, $A, $B, $C, $words[3], 10, 0x8f0ccc92); + self::step($I, $C, $D, $A, $B, $words[10], 15, 0xffeff47d); + self::step($I, $B, $C, $D, $A, $words[1], 21, 0x85845dd1); + self::step($I, $A, $B, $C, $D, $words[8], 6, 0x6fa87e4f); + self::step($I, $D, $A, $B, $C, $words[15], 10, 0xfe2ce6e0); + self::step($I, $C, $D, $A, $B, $words[6], 15, 0xa3014314); + self::step($I, $B, $C, $D, $A, $words[13], 21, 0x4e0811a1); + self::step($I, $A, $B, $C, $D, $words[4], 6, 0xf7537e82); + self::step($I, $D, $A, $B, $C, $words[11], 10, 0xbd3af235); + self::step($I, $C, $D, $A, $B, $words[2], 15, 0x2ad7d2bb); + self::step($I, $B, $C, $D, $A, $words[9], 21, 0xeb86d391); + + $this->a = ($this->a + $A) & 0xffffffff; + $this->b = ($this->b + $B) & 0xffffffff; + $this->c = ($this->c + $C) & 0xffffffff; + $this->d = ($this->d + $D) & 0xffffffff; + } + + + private static function F($X, $Y, $Z) + { + return (($X & $Y) | ((~ $X) & $Z)); // X AND Y OR NOT X AND Z + } + + + private static function G($X, $Y, $Z) + { + return (($X & $Z) | ($Y & (~ $Z))); // X AND Z OR Y AND NOT Z + } + + + private static function H($X, $Y, $Z) + { + return ($X ^ $Y ^ $Z); // X XOR Y XOR Z + } + + + private static function I($X, $Y, $Z) + { + return ($Y ^ ($X | (~ $Z))) ; // Y XOR (X OR NOT Z) + } + + + private static function step($func, &$A, $B, $C, $D, $M, $s, $t) + { + $A = ($A + call_user_func($func, $B, $C, $D) + $M + $t) & 0xffffffff; + $A = self::rotate($A, $s); + $A = ($B + $A) & 0xffffffff; + } + + + private static function rotate($decimal, $bits) + { + $binary = str_pad(decbin($decimal), 32, "0", STR_PAD_LEFT); + return bindec(substr($binary, $bits).substr($binary, 0, $bits)); + } +} \ No newline at end of file diff --git a/htdocs/includes/phpexcel/PHPExcel/Reader/Excel5/RC4.php b/htdocs/includes/phpexcel/PHPExcel/Reader/Excel5/RC4.php new file mode 100644 index 00000000000..dc6327c0490 --- /dev/null +++ b/htdocs/includes/phpexcel/PHPExcel/Reader/Excel5/RC4.php @@ -0,0 +1,88 @@ +i = 0; $this->i < 256; $this->i++) { + $this->s[$this->i] = $this->i; + } + + $this->j = 0; + for ($this->i = 0; $this->i < 256; $this->i++) { + $this->j = ($this->j + $this->s[$this->i] + ord($key[$this->i % $len])) % 256; + $t = $this->s[$this->i]; + $this->s[$this->i] = $this->s[$this->j]; + $this->s[$this->j] = $t; + } + $this->i = $this->j = 0; + } + + /** + * Symmetric decryption/encryption function + * + * @param string $data Data to encrypt/decrypt + * + * @return string + */ + public function RC4($data) + { + $len = strlen($data); + for ($c = 0; $c < $len; $c++) { + $this->i = ($this->i + 1) % 256; + $this->j = ($this->j + $this->s[$this->i]) % 256; + $t = $this->s[$this->i]; + $this->s[$this->i] = $this->s[$this->j]; + $this->s[$this->j] = $t; + + $t = ($this->s[$this->i] + $this->s[$this->j]) % 256; + + $data[$c] = chr(ord($data[$c]) ^ $this->s[$t]); + } + return $data; + } +} diff --git a/htdocs/includes/phpexcel/PHPExcel/Reader/Exception.php b/htdocs/includes/phpexcel/PHPExcel/Reader/Exception.php new file mode 100644 index 00000000000..f42a1aafca2 --- /dev/null +++ b/htdocs/includes/phpexcel/PHPExcel/Reader/Exception.php @@ -0,0 +1,52 @@ +line = $line; + $e->file = $file; + throw $e; + } +} diff --git a/htdocs/includes/phpexcel/PHPExcel/Reader/Gnumeric.php b/htdocs/includes/phpexcel/PHPExcel/Reader/Gnumeric.php index 5d82f22924f..6db7c4969ee 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Reader/Gnumeric.php +++ b/htdocs/includes/phpexcel/PHPExcel/Reader/Gnumeric.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -40,27 +40,10 @@ if (!defined('PHPEXCEL_ROOT')) { * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader +class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader { - /** - * Read data only? - * Identifies whether the Reader should only read data values for cells, and ignore any formatting information; - * or whether it should read both data and formatting - * - * @var boolean - */ - private $_readDataOnly = false; - - /** - * Restrict which sheets should be loaded? - * This property holds an array of worksheet names to be loaded. If null, then all worksheets will be loaded. - * - * @var array of string - */ - private $_loadSheetsOnly = null; - /** * Formats * @@ -77,13 +60,6 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader private $_referenceHelper = null; - /** - * PHPExcel_Reader_IReadFilter instance - * - * @var PHPExcel_Reader_IReadFilter - */ - private $_readFilter = null; - /** * Create a new PHPExcel_Reader_Gnumeric @@ -94,115 +70,23 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader } - /** - * Read data only? - * If this is true, then the Reader will only read data values for cells, it will not read any formatting information. - * If false (the default) it will read data and formatting. - * - * @return boolean - */ - public function getReadDataOnly() { - return $this->_readDataOnly; - } - - - /** - * Set read data only - * Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information. - * Set to false (the default) to advise the Reader to read both data and formatting for cells. - * - * @param boolean $pValue - * - * @return PHPExcel_Reader_Gnumeric - */ - public function setReadDataOnly($pValue = false) { - $this->_readDataOnly = $pValue; - return $this; - } - - - /** - * Get which sheets to load - * Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null - * indicating that all worksheets in the workbook should be loaded. - * - * @return mixed - */ - public function getLoadSheetsOnly() - { - return $this->_loadSheetsOnly; - } - - - /** - * Set which sheets to load - * - * @param mixed $value - * This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name. - * If NULL, then it tells the Reader to read all worksheets in the workbook - * - * @return PHPExcel_Reader_Gnumeric - */ - public function setLoadSheetsOnly($value = null) - { - $this->_loadSheetsOnly = is_array($value) ? - $value : array($value); - return $this; - } - - - /** - * Set all sheets to load - * Tells the Reader to load all worksheets from the workbook. - * - * @return PHPExcel_Reader_Gnumeric - */ - public function setLoadAllSheets() - { - $this->_loadSheetsOnly = null; - return $this; - } - - - /** - * Read filter - * - * @return PHPExcel_Reader_IReadFilter - */ - public function getReadFilter() { - return $this->_readFilter; - } - - - /** - * Set read filter - * - * @param PHPExcel_Reader_IReadFilter $pValue - * @return PHPExcel_Reader_Gnumeric - */ - public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) { - $this->_readFilter = $pValue; - return $this; - } - - /** * Can the current PHPExcel_Reader_IReader read the file? * - * @param string $pFileName + * @param string $pFilename * @return boolean - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function canRead($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } // Check if gzlib functions are available if (!function_exists('gzread')) { - throw new Exception("gzlib library is not enabled"); + throw new PHPExcel_Reader_Exception("gzlib library is not enabled"); } // Read signature data (first 3 bytes) @@ -218,50 +102,87 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader } + /** + * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object + * + * @param string $pFilename + * @throws PHPExcel_Reader_Exception + */ + public function listWorksheetNames($pFilename) + { + // Check if file exists + if (!file_exists($pFilename)) { + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + } + + $xml = new XMLReader(); + $xml->open( + 'compress.zlib://'.realpath($pFilename), null, PHPExcel_Settings::getLibXmlLoaderOptions() + ); + $xml->setParserProperty(2,true); + + $worksheetNames = array(); + while ($xml->read()) { + if ($xml->name == 'gnm:SheetName' && $xml->nodeType == XMLReader::ELEMENT) { + $xml->read(); // Move onto the value node + $worksheetNames[] = (string) $xml->value; + } elseif ($xml->name == 'gnm:Sheets') { + // break out of the loop once we've got our sheet names rather than parse the entire file + break; + } + } + + return $worksheetNames; + } + + /** * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) * * @param string $pFilename - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function listWorksheetInfo($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } - $gFileData = $this->_gzfileGetContents($pFilename); - - $xml = simplexml_load_string($gFileData); - $namespacesMeta = $xml->getNamespaces(true); - - $gnmXML = $xml->children($namespacesMeta['gnm']); + $xml = new XMLReader(); + $xml->open( + 'compress.zlib://'.realpath($pFilename), null, PHPExcel_Settings::getLibXmlLoaderOptions() + ); + $xml->setParserProperty(2,true); $worksheetInfo = array(); + while ($xml->read()) { + if ($xml->name == 'gnm:Sheet' && $xml->nodeType == XMLReader::ELEMENT) { + $tmpInfo = array( + 'worksheetName' => '', + 'lastColumnLetter' => 'A', + 'lastColumnIndex' => 0, + 'totalRows' => 0, + 'totalColumns' => 0, + ); - foreach ($gnmXML->Sheets->Sheet as $sheet) { - $tmpInfo = array(); - $tmpInfo['worksheetName'] = (string) $sheet->Name; - $tmpInfo['lastColumnLetter'] = 'A'; - $tmpInfo['lastColumnIndex'] = 0; - $tmpInfo['totalRows'] = 0; - $tmpInfo['totalColumns'] = 0; - - foreach ($sheet->Cells->Cell as $cell) { - $cellAttributes = $cell->attributes(); - - $rowIndex = (int) $cellAttributes->Row + 1; - $columnIndex = (int) $cellAttributes->Col; - - $tmpInfo['totalRows'] = max($tmpInfo['totalRows'], $rowIndex); - $tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex); + while ($xml->read()) { + if ($xml->name == 'gnm:Name' && $xml->nodeType == XMLReader::ELEMENT) { + $xml->read(); // Move onto the value node + $tmpInfo['worksheetName'] = (string) $xml->value; + } elseif ($xml->name == 'gnm:MaxCol' && $xml->nodeType == XMLReader::ELEMENT) { + $xml->read(); // Move onto the value node + $tmpInfo['lastColumnIndex'] = (int) $xml->value; + $tmpInfo['totalColumns'] = (int) $xml->value + 1; + } elseif ($xml->name == 'gnm:MaxRow' && $xml->nodeType == XMLReader::ELEMENT) { + $xml->read(); // Move onto the value node + $tmpInfo['totalRows'] = (int) $xml->value + 1; + break; + } + } + $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']); + $worksheetInfo[] = $tmpInfo; } - - $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']); - $tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1; - - $worksheetInfo[] = $tmpInfo; } return $worksheetInfo; @@ -286,7 +207,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader * * @param string $pFilename * @return PHPExcel - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function load($pFilename) { @@ -298,49 +219,19 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader } - /** - * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object - * - * @param string $pFilename - * @throws Exception - */ - public function listWorksheetNames($pFilename) - { - // Check if file exists - if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); - } - - $gFileData = $this->_gzfileGetContents($pFilename); - - $xml = simplexml_load_string($gFileData); - $namespacesMeta = $xml->getNamespaces(true); - - $gnmXML = $xml->children($namespacesMeta['gnm']); - - $worksheetNames = array(); - - foreach($gnmXML->Sheets->Sheet as $sheet) { - $worksheetNames[] = (string) $sheet->Name; - } - - return $worksheetNames; - } - - /** * Loads PHPExcel from file into PHPExcel instance * * @param string $pFilename * @param PHPExcel $objPHPExcel * @return PHPExcel - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) { // Check if file exists if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } $timezoneObj = new DateTimeZone('Europe/London'); @@ -352,7 +243,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader // echo htmlentities($gFileData,ENT_QUOTES,'UTF-8'); // echo '
'; // - $xml = simplexml_load_string($gFileData); + $xml = simplexml_load_string($gFileData, 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); $namespacesMeta = $xml->getNamespaces(true); // var_dump($namespacesMeta); @@ -620,7 +511,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader // We still set the number format mask for date/time values, even if _readDataOnly is true if ((!$this->_readDataOnly) || - (PHPExcel_Shared_Date::isDateTimeFormatCode($styleArray['numberformat']['code']))) { + (PHPExcel_Shared_Date::isDateTimeFormatCode((string) $styleAttributes['Format']))) { $styleArray = array(); $styleArray['numberformat']['code'] = (string) $styleAttributes['Format']; // If _readDataOnly is false, we set all formatting information diff --git a/htdocs/includes/phpexcel/PHPExcel/Reader/HTML.php b/htdocs/includes/phpexcel/PHPExcel/Reader/HTML.php index d6068eaa4f4..1696471029d 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Reader/HTML.php +++ b/htdocs/includes/phpexcel/PHPExcel/Reader/HTML.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -40,9 +40,9 @@ if (!defined('PHPEXCEL_ROOT')) { * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader +class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader { /** * Input encoding @@ -100,13 +100,6 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader ), // Bottom border ); - /** - * PHPExcel_Reader_IReadFilter instance - * - * @var PHPExcel_Reader_IReadFilter - */ - private $_readFilter = null; - /** * Create a new PHPExcel_Reader_HTML @@ -116,25 +109,20 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader } /** - * Can the current PHPExcel_Reader_IReader read the file? + * Validate that the current file is an HTML file * - * @param string $pFileName - * @return boolean - * @throws Exception + * @return boolean */ - public function canRead($pFilename) + protected function _isValidFormat() { - // Check if file exists - if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + // Reading 2048 bytes should be enough to validate that the format is HTML + $data = fread($this->_fileHandle, 2048); + if ((strpos($data, '<') !== FALSE) && + (strlen($data) !== strlen(strip_tags($data)))) { + return TRUE; } - // Read sample data (first 2 KB will do) - $fh = fopen($pFilename, 'r'); - $data = fread($fh, 2048); - fclose($fh); - - return true; + return FALSE; } /** @@ -142,7 +130,7 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader * * @param string $pFilename * @return PHPExcel - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function load($pFilename) { @@ -153,25 +141,6 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader return $this->loadIntoExisting($pFilename, $objPHPExcel); } - /** - * Read filter - * - * @return PHPExcel_Reader_IReadFilter - */ - public function getReadFilter() { - return $this->_readFilter; - } - - /** - * Set read filter - * - * @param PHPExcel_Reader_IReadFilter $pValue - */ - public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) { - $this->_readFilter = $pValue; - return $this; - } - /** * Set input encoding * @@ -222,7 +191,7 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader // Simple String content if (trim($cellContent) > '') { // Only actually write it if there's content in the string - echo 'FLUSH CELL: ' , $column , $row , ' => ' , $cellContent , '
'; +// echo 'FLUSH CELL: ' , $column , $row , ' => ' , $cellContent , '
'; // Write to worksheet to be done here... // ... we return the cell so we can mess about with styles more easily $cell = $sheet->setCellValue($column.$row,$cellContent,true); @@ -238,7 +207,7 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader private function _processDomElement(DOMNode $element, $sheet, &$row, &$column, &$cellContent){ foreach($element->childNodes as $child){ - if ($child instanceOf DOMText) { + if ($child instanceof DOMText) { $domText = preg_replace('/\s+/',' ',trim($child->nodeValue)); if (is_string($cellContent)) { // simply append the text if the cell content is a plain text string @@ -247,12 +216,12 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader // but if we have a rich text run instead, we need to append it correctly // TODO } - } elseif($child instanceOf DOMElement) { - echo 'DOM ELEMENT: ' , strtoupper($child->nodeName) , '
'; + } elseif($child instanceof DOMElement) { +// echo 'DOM ELEMENT: ' , strtoupper($child->nodeName) , '
'; $attributeArray = array(); foreach($child->attributes as $attribute) { - echo 'ATTRIBUTE: ' , $attribute->name , ' => ' , $attribute->value , '
'; +// echo 'ATTRIBUTE: ' , $attribute->name , ' => ' , $attribute->value , '
'; $attributeArray[$attribute->name] = $attribute->value; } @@ -280,13 +249,13 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader case 'em' : case 'strong': case 'b' : - echo 'STYLING, SPAN OR DIV
'; +// echo 'STYLING, SPAN OR DIV
'; if ($cellContent > '') $cellContent .= ' '; $this->_processDomElement($child,$sheet,$row,$column,$cellContent); if ($cellContent > '') $cellContent .= ' '; - echo 'END OF STYLING, SPAN OR DIV
'; +// echo 'END OF STYLING, SPAN OR DIV
'; break; case 'hr' : $this->_flushCell($sheet,$column,$row,$cellContent); @@ -307,14 +276,14 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader $this->_flushCell($sheet,$column,$row,$cellContent); ++$row; } - echo 'HARD LINE BREAK: ' , '
'; +// echo 'HARD LINE BREAK: ' , '
'; break; case 'a' : - echo 'START OF HYPERLINK: ' , '
'; +// echo 'START OF HYPERLINK: ' , '
'; foreach($attributeArray as $attributeName => $attributeValue) { switch($attributeName) { case 'href': - echo 'Link to ' , $attributeValue , '
'; +// echo 'Link to ' , $attributeValue , '
'; $sheet->getCell($column.$row)->getHyperlink()->setUrl($attributeValue); if (isset($this->_formats[$child->nodeName])) { $sheet->getStyle($column.$row)->applyFromArray($this->_formats[$child->nodeName]); @@ -324,7 +293,7 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader } $cellContent .= ' '; $this->_processDomElement($child,$sheet,$row,$column,$cellContent); - echo 'END OF HYPERLINK:' , '
'; +// echo 'END OF HYPERLINK:' , '
'; break; case 'h1' : case 'h2' : @@ -338,17 +307,17 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader if ($this->_tableLevel > 0) { // If we're inside a table, replace with a \n $cellContent .= "\n"; - echo 'LIST ENTRY: ' , '
'; +// echo 'LIST ENTRY: ' , '
'; $this->_processDomElement($child,$sheet,$row,$column,$cellContent); - echo 'END OF LIST ENTRY:' , '
'; +// echo 'END OF LIST ENTRY:' , '
'; } else { if ($cellContent > '') { $this->_flushCell($sheet,$column,$row,$cellContent); $row += 2; } - echo 'START OF PARAGRAPH: ' , '
'; +// echo 'START OF PARAGRAPH: ' , '
'; $this->_processDomElement($child,$sheet,$row,$column,$cellContent); - echo 'END OF PARAGRAPH:' , '
'; +// echo 'END OF PARAGRAPH:' , '
'; $this->_flushCell($sheet,$column,$row,$cellContent); if (isset($this->_formats[$child->nodeName])) { @@ -363,17 +332,17 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader if ($this->_tableLevel > 0) { // If we're inside a table, replace with a \n $cellContent .= "\n"; - echo 'LIST ENTRY: ' , '
'; +// echo 'LIST ENTRY: ' , '
'; $this->_processDomElement($child,$sheet,$row,$column,$cellContent); - echo 'END OF LIST ENTRY:' , '
'; +// echo 'END OF LIST ENTRY:' , '
'; } else { if ($cellContent > '') { $this->_flushCell($sheet,$column,$row,$cellContent); } ++$row; - echo 'LIST ENTRY: ' , '
'; +// echo 'LIST ENTRY: ' , '
'; $this->_processDomElement($child,$sheet,$row,$column,$cellContent); - echo 'END OF LIST ENTRY:' , '
'; +// echo 'END OF LIST ENTRY:' , '
'; $this->_flushCell($sheet,$column,$row,$cellContent); $column = 'A'; } @@ -381,11 +350,11 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader case 'table' : $this->_flushCell($sheet,$column,$row,$cellContent); $column = $this->_setTableStartColumn($column); - echo 'START OF TABLE LEVEL ' , $this->_tableLevel , '
'; +// echo 'START OF TABLE LEVEL ' , $this->_tableLevel , '
'; if ($this->_tableLevel > 1) --$row; $this->_processDomElement($child,$sheet,$row,$column,$cellContent); - echo 'END OF TABLE LEVEL ' , $this->_tableLevel , '
'; +// echo 'END OF TABLE LEVEL ' , $this->_tableLevel , '
'; $column = $this->_releaseTableStartColumn(); if ($this->_tableLevel > 1) { ++$column; @@ -401,15 +370,15 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader ++$row; $column = $this->_getTableStartColumn(); $cellContent = ''; - echo 'START OF TABLE ' , $this->_tableLevel , ' ROW
'; +// echo 'START OF TABLE ' , $this->_tableLevel , ' ROW
'; $this->_processDomElement($child,$sheet,$row,$column,$cellContent); - echo 'END OF TABLE ' , $this->_tableLevel , ' ROW
'; +// echo 'END OF TABLE ' , $this->_tableLevel , ' ROW
'; break; case 'th' : case 'td' : - echo 'START OF TABLE ' , $this->_tableLevel , ' CELL
'; +// echo 'START OF TABLE ' , $this->_tableLevel , ' CELL
'; $this->_processDomElement($child,$sheet,$row,$column,$cellContent); - echo 'END OF TABLE ' , $this->_tableLevel , ' CELL
'; +// echo 'END OF TABLE ' , $this->_tableLevel , ' CELL
'; $this->_flushCell($sheet,$column,$row,$cellContent); ++$column; break; @@ -433,18 +402,18 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader * @param string $pFilename * @param PHPExcel $objPHPExcel * @return PHPExcel - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) { - // Check if file exists - if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); - } - - if (!is_file($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! The given file is not a regular file."); + // Open file to validate + $this->_openFile($pFilename); + if (!$this->_isValidFormat()) { + fclose ($this->_fileHandle); + throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid HTML file."); } + // Close after validating + fclose ($this->_fileHandle); // Create new PHPExcel while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) { @@ -454,10 +423,10 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader // Create a new DOM object $dom = new domDocument; - // Load the HTML file into the DOM object - $loaded = $dom->loadHTMLFile($pFilename); - if ($loaded === false) { - throw new Exception('Failed to load ',$pFilename,' as a DOM Document'); + // Reload the HTML file into the DOM object + $loaded = $dom->loadHTMLFile($pFilename, PHPExcel_Settings::getLibXmlLoaderOptions()); + if ($loaded === FALSE) { + throw new PHPExcel_Reader_Exception('Failed to load ',$pFilename,' as a DOM Document'); } // Discard white space @@ -469,8 +438,8 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader $content = ''; $this->_processDomElement($dom,$objPHPExcel->getActiveSheet(),$row,$column,$content); - echo '
'; - var_dump($this->_dataArray); +// echo '
'; +// var_dump($this->_dataArray); // Return return $objPHPExcel; diff --git a/htdocs/includes/phpexcel/PHPExcel/Reader/IReadFilter.php b/htdocs/includes/phpexcel/PHPExcel/Reader/IReadFilter.php index 50e92c8045a..5a691a5fb77 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Reader/IReadFilter.php +++ b/htdocs/includes/phpexcel/PHPExcel/Reader/IReadFilter.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ interface PHPExcel_Reader_IReadFilter { diff --git a/htdocs/includes/phpexcel/PHPExcel/Reader/IReader.php b/htdocs/includes/phpexcel/PHPExcel/Reader/IReader.php index 1c9884730b8..6c3e878e9f6 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Reader/IReader.php +++ b/htdocs/includes/phpexcel/PHPExcel/Reader/IReader.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,14 +31,14 @@ * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ interface PHPExcel_Reader_IReader { /** * Can the current PHPExcel_Reader_IReader read the file? * - * @param string $pFileName + * @param string $pFilename * @return boolean */ public function canRead($pFilename); @@ -46,8 +46,8 @@ interface PHPExcel_Reader_IReader /** * Loads PHPExcel from file * - * @param string $pFileName - * @throws Exception + * @param string $pFilename + * @throws PHPExcel_Reader_Exception */ public function load($pFilename); } diff --git a/htdocs/includes/phpexcel/PHPExcel/Reader/OOCalc.php b/htdocs/includes/phpexcel/PHPExcel/Reader/OOCalc.php index 22ad1173b4f..8ad7061ce90 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Reader/OOCalc.php +++ b/htdocs/includes/phpexcel/PHPExcel/Reader/OOCalc.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -40,27 +40,10 @@ if (!defined('PHPEXCEL_ROOT')) { * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader +class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader { - /** - * Read data only? - * Identifies whether the Reader should only read data values for cells, and ignore any formatting information; - * or whether it should read both data and formatting - * - * @var boolean - */ - private $_readDataOnly = false; - - /** - * Restrict which sheets should be loaded? - * This property holds an array of worksheet names to be loaded. If null, then all worksheets will be loaded. - * - * @var array of string - */ - private $_loadSheetsOnly = null; - /** * Formats * @@ -68,13 +51,6 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader */ private $_styles = array(); - /** - * PHPExcel_Reader_IReadFilter instance - * - * @var PHPExcel_Reader_IReadFilter - */ - private $_readFilter = null; - /** * Create a new PHPExcel_Reader_OOCalc @@ -84,126 +60,48 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader } - /** - * Read data only? - * If this is true, then the Reader will only read data values for cells, it will not read any formatting information. - * If false (the default) it will read data and formatting. - * - * @return boolean - */ - public function getReadDataOnly() { - return $this->_readDataOnly; - } - - - /** - * Set read data only - * Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information. - * Set to false (the default) to advise the Reader to read both data and formatting for cells. - * - * @param boolean $pValue - * @return PHPExcel_Reader_OOCalc - */ - public function setReadDataOnly($pValue = false) { - $this->_readDataOnly = $pValue; - return $this; - } - - - /** - * Get which sheets to load - * Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null - * indicating that all worksheets in the workbook should be loaded. - * - * @return mixed - */ - public function getLoadSheetsOnly() - { - return $this->_loadSheetsOnly; - } - - - /** - * Set which sheets to load - * - * @param mixed $value - * This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name. - * If NULL, then it tells the Reader to read all worksheets in the workbook - * - * @return PHPExcel_Reader_OOCalc - */ - public function setLoadSheetsOnly($value = null) - { - $this->_loadSheetsOnly = is_array($value) ? - $value : array($value); - return $this; - } - - - /** - * Set all sheets to load - * Tells the Reader to load all worksheets from the workbook. - * - * @return PHPExcel_Reader_OOCalc - */ - public function setLoadAllSheets() - { - $this->_loadSheetsOnly = null; - return $this; - } - - - /** - * Read filter - * - * @return PHPExcel_Reader_IReadFilter - */ - public function getReadFilter() { - return $this->_readFilter; - } - - - /** - * Set read filter - * - * @param PHPExcel_Reader_IReadFilter $pValue - * @return PHPExcel_Reader_OOCalc - */ - public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) { - $this->_readFilter = $pValue; - return $this; - } - - /** * Can the current PHPExcel_Reader_IReader read the file? * - * @param string $pFileName + * @param string $pFilename * @return boolean - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function canRead($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } + $zipClass = PHPExcel_Settings::getZipClass(); + // Check if zip class exists - if (!class_exists('ZipArchive',FALSE)) { - throw new Exception("ZipArchive library is not enabled"); - } +// if (!class_exists($zipClass, FALSE)) { +// throw new PHPExcel_Reader_Exception($zipClass . " library is not enabled"); +// } + $mimeType = 'UNKNOWN'; // Load file - $zip = new ZipArchive; + $zip = new $zipClass; if ($zip->open($pFilename) === true) { // check if it is an OOXML archive $stat = $zip->statName('mimetype'); if ($stat && ($stat['size'] <= 255)) { $mimeType = $zip->getFromName($stat['name']); - } else { - $zip->close(); - return FALSE; + } elseif($stat = $zip->statName('META-INF/manifest.xml')) { + $xml = simplexml_load_string($zip->getFromName('META-INF/manifest.xml'), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); + $namespacesContent = $xml->getNamespaces(true); + if (isset($namespacesContent['manifest'])) { + $manifest = $xml->children($namespacesContent['manifest']); + foreach($manifest as $manifestDataSet) { + $manifestAttributes = $manifestDataSet->attributes($namespacesContent['manifest']); + if ($manifestAttributes->{'full-path'} == '/') { + $mimeType = (string) $manifestAttributes->{'media-type'}; + break; + } + } + } } $zip->close(); @@ -219,30 +117,46 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object * * @param string $pFilename - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function listWorksheetNames($pFilename) { // Check if file exists if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + } + + $zipClass = PHPExcel_Settings::getZipClass(); + + $zip = new $zipClass; + if (!$zip->open($pFilename)) { + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! Error opening file."); } $worksheetNames = array(); - $zip = new ZipArchive; - if ($zip->open($pFilename) === true) { + $xml = new XMLReader(); + $res = $xml->open('zip://'.realpath($pFilename).'#content.xml', null, PHPExcel_Settings::getLibXmlLoaderOptions()); + $xml->setParserProperty(2,true); - $xml = simplexml_load_string($zip->getFromName("content.xml")); - $namespacesContent = $xml->getNamespaces(true); - - $workbook = $xml->children($namespacesContent['office']); - foreach($workbook->body->spreadsheet as $workbookData) { - $workbookData = $workbookData->children($namespacesContent['table']); - foreach($workbookData->table as $worksheetDataSet) { - $worksheetDataAttributes = $worksheetDataSet->attributes($namespacesContent['table']); - - $worksheetNames[] = $worksheetDataAttributes['name']; + // Step into the first level of content of the XML + $xml->read(); + while ($xml->read()) { + // Quickly jump through to the office:body node + while ($xml->name !== 'office:body') { + if ($xml->isEmptyElement) + $xml->read(); + else + $xml->next(); + } + // Now read each node until we find our first table:table node + while ($xml->read()) { + if ($xml->name == 'table:table' && $xml->nodeType == XMLReader::ELEMENT) { + // Loop through each table:table node reading the table:name attribute for each worksheet name + do { + $worksheetNames[] = $xml->getAttribute('table:name'); + $xml->next(); + } while ($xml->name == 'table:table' && $xml->nodeType == XMLReader::ELEMENT); } } } @@ -251,12 +165,137 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader } + /** + * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) + * + * @param string $pFilename + * @throws PHPExcel_Reader_Exception + */ + public function listWorksheetInfo($pFilename) + { + // Check if file exists + if (!file_exists($pFilename)) { + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); + } + + $worksheetInfo = array(); + + $zipClass = PHPExcel_Settings::getZipClass(); + + $zip = new $zipClass; + if (!$zip->open($pFilename)) { + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! Error opening file."); + } + + $xml = new XMLReader(); + $res = $xml->open('zip://'.realpath($pFilename).'#content.xml', null, PHPExcel_Settings::getLibXmlLoaderOptions()); + $xml->setParserProperty(2,true); + + // Step into the first level of content of the XML + $xml->read(); + while ($xml->read()) { + // Quickly jump through to the office:body node + while ($xml->name !== 'office:body') { + if ($xml->isEmptyElement) + $xml->read(); + else + $xml->next(); + } + // Now read each node until we find our first table:table node + while ($xml->read()) { + if ($xml->name == 'table:table' && $xml->nodeType == XMLReader::ELEMENT) { + $worksheetNames[] = $xml->getAttribute('table:name'); + + $tmpInfo = array( + 'worksheetName' => $xml->getAttribute('table:name'), + 'lastColumnLetter' => 'A', + 'lastColumnIndex' => 0, + 'totalRows' => 0, + 'totalColumns' => 0, + ); + + // Loop through each child node of the table:table element reading + $currCells = 0; + do { + $xml->read(); + if ($xml->name == 'table:table-row' && $xml->nodeType == XMLReader::ELEMENT) { + $rowspan = $xml->getAttribute('table:number-rows-repeated'); + $rowspan = empty($rowspan) ? 1 : $rowspan; + $tmpInfo['totalRows'] += $rowspan; + $tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'],$currCells); + $currCells = 0; + // Step into the row + $xml->read(); + do { + if ($xml->name == 'table:table-cell' && $xml->nodeType == XMLReader::ELEMENT) { + if (!$xml->isEmptyElement) { + $currCells++; + $xml->next(); + } else { + $xml->read(); + } + } elseif ($xml->name == 'table:covered-table-cell' && $xml->nodeType == XMLReader::ELEMENT) { + $mergeSize = $xml->getAttribute('table:number-columns-repeated'); + $currCells += $mergeSize; + $xml->read(); + } + } while ($xml->name != 'table:table-row'); + } + } while ($xml->name != 'table:table'); + + $tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'],$currCells); + $tmpInfo['lastColumnIndex'] = $tmpInfo['totalColumns'] - 1; + $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']); + $worksheetInfo[] = $tmpInfo; + } + } + +// foreach($workbookData->table as $worksheetDataSet) { +// $worksheetData = $worksheetDataSet->children($namespacesContent['table']); +// $worksheetDataAttributes = $worksheetDataSet->attributes($namespacesContent['table']); +// +// $rowIndex = 0; +// foreach ($worksheetData as $key => $rowData) { +// switch ($key) { +// case 'table-row' : +// $rowDataTableAttributes = $rowData->attributes($namespacesContent['table']); +// $rowRepeats = (isset($rowDataTableAttributes['number-rows-repeated'])) ? +// $rowDataTableAttributes['number-rows-repeated'] : 1; +// $columnIndex = 0; +// +// foreach ($rowData as $key => $cellData) { +// $cellDataTableAttributes = $cellData->attributes($namespacesContent['table']); +// $colRepeats = (isset($cellDataTableAttributes['number-columns-repeated'])) ? +// $cellDataTableAttributes['number-columns-repeated'] : 1; +// $cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']); +// if (isset($cellDataOfficeAttributes['value-type'])) { +// $tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex + $colRepeats - 1); +// $tmpInfo['totalRows'] = max($tmpInfo['totalRows'], $rowIndex + $rowRepeats); +// } +// $columnIndex += $colRepeats; +// } +// $rowIndex += $rowRepeats; +// break; +// } +// } +// +// $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']); +// $tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1; +// +// } +// } + } + + return $worksheetInfo; + } + + /** * Loads PHPExcel from file * * @param string $pFilename * @return PHPExcel - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function load($pFilename) { @@ -280,441 +319,376 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader } - /** - * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) - * - * @param string $pFilename - * @throws Exception - */ - public function listWorksheetInfo($pFilename) - { - // Check if file exists - if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); - } - - $worksheetInfo = array(); - - $zip = new ZipArchive; - if ($zip->open($pFilename) === true) { - - $xml = simplexml_load_string($zip->getFromName("content.xml")); - $namespacesContent = $xml->getNamespaces(true); - - $workbook = $xml->children($namespacesContent['office']); - foreach($workbook->body->spreadsheet as $workbookData) { - $workbookData = $workbookData->children($namespacesContent['table']); - foreach($workbookData->table as $worksheetDataSet) { - $worksheetData = $worksheetDataSet->children($namespacesContent['table']); - $worksheetDataAttributes = $worksheetDataSet->attributes($namespacesContent['table']); - - $tmpInfo = array(); - $tmpInfo['worksheetName'] = (string) $worksheetDataAttributes['name']; - $tmpInfo['lastColumnLetter'] = 'A'; - $tmpInfo['lastColumnIndex'] = 0; - $tmpInfo['totalRows'] = 0; - $tmpInfo['totalColumns'] = 0; - - $rowIndex = 0; - foreach ($worksheetData as $key => $rowData) { - switch ($key) { - case 'table-row' : - $rowDataTableAttributes = $rowData->attributes($namespacesContent['table']); - $rowRepeats = (isset($rowDataTableAttributes['number-rows-repeated'])) ? - $rowDataTableAttributes['number-rows-repeated'] : 1; - $columnIndex = 0; - - foreach ($rowData as $key => $cellData) { - $cellDataTableAttributes = $cellData->attributes($namespacesContent['table']); - $colRepeats = (isset($cellDataTableAttributes['number-columns-repeated'])) ? - $cellDataTableAttributes['number-columns-repeated'] : 1; - $cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']); - if (isset($cellDataOfficeAttributes['value-type'])) { - $tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex + $colRepeats - 1); - $tmpInfo['totalRows'] = max($tmpInfo['totalRows'], $rowIndex + $rowRepeats); - } - $columnIndex += $colRepeats; - } - $rowIndex += $rowRepeats; - break; - } - } - - $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']); - $tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1; - - $worksheetInfo[] = $tmpInfo; - } - } - } - - return $worksheetInfo; - } - - /** * Loads PHPExcel from file into PHPExcel instance * * @param string $pFilename * @param PHPExcel $objPHPExcel * @return PHPExcel - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) { // Check if file exists if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist."); } $timezoneObj = new DateTimeZone('Europe/London'); $GMT = new DateTimeZone('UTC'); - $zip = new ZipArchive; - if ($zip->open($pFilename) === true) { -// echo '

Meta Information

'; - $xml = simplexml_load_string($zip->getFromName("meta.xml")); - $namespacesMeta = $xml->getNamespaces(true); -// echo '
';
-//			print_r($namespacesMeta);
-//			echo '

'; + $zipClass = PHPExcel_Settings::getZipClass(); - $docProps = $objPHPExcel->getProperties(); - $officeProperty = $xml->children($namespacesMeta['office']); - foreach($officeProperty as $officePropertyData) { - $officePropertyDC = array(); - if (isset($namespacesMeta['dc'])) { - $officePropertyDC = $officePropertyData->children($namespacesMeta['dc']); - } - foreach($officePropertyDC as $propertyName => $propertyValue) { - switch ($propertyName) { - case 'title' : - $docProps->setTitle($propertyValue); - break; - case 'subject' : - $docProps->setSubject($propertyValue); - break; - case 'creator' : - $docProps->setCreator($propertyValue); - $docProps->setLastModifiedBy($propertyValue); - break; - case 'date' : - $creationDate = strtotime($propertyValue); - $docProps->setCreated($creationDate); - $docProps->setModified($creationDate); - break; - case 'description' : - $docProps->setDescription($propertyValue); - break; - } - } - $officePropertyMeta = array(); - if (isset($namespacesMeta['dc'])) { - $officePropertyMeta = $officePropertyData->children($namespacesMeta['meta']); - } - foreach($officePropertyMeta as $propertyName => $propertyValue) { - $propertyValueAttributes = $propertyValue->attributes($namespacesMeta['meta']); - switch ($propertyName) { - case 'initial-creator' : - $docProps->setCreator($propertyValue); - break; - case 'keyword' : - $docProps->setKeywords($propertyValue); - break; - case 'creation-date' : - $creationDate = strtotime($propertyValue); - $docProps->setCreated($creationDate); - break; - case 'user-defined' : - $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING; - foreach ($propertyValueAttributes as $key => $value) { - if ($key == 'name') { - $propertyValueName = (string) $value; - } elseif($key == 'value-type') { - switch ($value) { - case 'date' : - $propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue,'date'); - $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE; - break; - case 'boolean' : - $propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue,'bool'); - $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN; - break; - case 'float' : - $propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue,'r4'); - $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT; - break; - default : - $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING; - } - } - } - $docProps->setCustomProperty($propertyValueName,$propertyValue,$propertyValueType); - break; - } + $zip = new $zipClass; + if (!$zip->open($pFilename)) { + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! Error opening file."); + } + +// echo '

Meta Information

'; + $xml = simplexml_load_string($zip->getFromName("meta.xml"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); + $namespacesMeta = $xml->getNamespaces(true); +// echo '
';
+//		print_r($namespacesMeta);
+//		echo '

'; + + $docProps = $objPHPExcel->getProperties(); + $officeProperty = $xml->children($namespacesMeta['office']); + foreach($officeProperty as $officePropertyData) { + $officePropertyDC = array(); + if (isset($namespacesMeta['dc'])) { + $officePropertyDC = $officePropertyData->children($namespacesMeta['dc']); + } + foreach($officePropertyDC as $propertyName => $propertyValue) { + $propertyValue = (string) $propertyValue; + switch ($propertyName) { + case 'title' : + $docProps->setTitle($propertyValue); + break; + case 'subject' : + $docProps->setSubject($propertyValue); + break; + case 'creator' : + $docProps->setCreator($propertyValue); + $docProps->setLastModifiedBy($propertyValue); + break; + case 'date' : + $creationDate = strtotime($propertyValue); + $docProps->setCreated($creationDate); + $docProps->setModified($creationDate); + break; + case 'description' : + $docProps->setDescription($propertyValue); + break; } } - - -// echo '

Workbook Content

'; - $xml = simplexml_load_string($zip->getFromName("content.xml")); - $namespacesContent = $xml->getNamespaces(true); -// echo '
';
-//			print_r($namespacesContent);
-//			echo '

'; - - $workbook = $xml->children($namespacesContent['office']); - foreach($workbook->body->spreadsheet as $workbookData) { - $workbookData = $workbookData->children($namespacesContent['table']); - $worksheetID = 0; - foreach($workbookData->table as $worksheetDataSet) { - $worksheetData = $worksheetDataSet->children($namespacesContent['table']); -// print_r($worksheetData); -// echo '
'; - $worksheetDataAttributes = $worksheetDataSet->attributes($namespacesContent['table']); -// print_r($worksheetDataAttributes); -// echo '
'; - if ((isset($this->_loadSheetsOnly)) && (isset($worksheetDataAttributes['name'])) && - (!in_array($worksheetDataAttributes['name'], $this->_loadSheetsOnly))) { - continue; - } - -// echo '

Worksheet '.$worksheetDataAttributes['name'].'

'; - // Create new Worksheet - $objPHPExcel->createSheet(); - $objPHPExcel->setActiveSheetIndex($worksheetID); - if (isset($worksheetDataAttributes['name'])) { - $worksheetName = (string) $worksheetDataAttributes['name']; - // Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in - // formula cells... during the load, all formulae should be correct, and we're simply - // bringing the worksheet name in line with the formula, not the reverse - $objPHPExcel->getActiveSheet()->setTitle($worksheetName,false); - } - - $rowID = 1; - foreach($worksheetData as $key => $rowData) { -// echo ''.$key.'
'; - switch ($key) { - case 'table-header-rows': - foreach ($rowData as $key=>$cellData) { - $rowData = $cellData; - break; + $officePropertyMeta = array(); + if (isset($namespacesMeta['dc'])) { + $officePropertyMeta = $officePropertyData->children($namespacesMeta['meta']); + } + foreach($officePropertyMeta as $propertyName => $propertyValue) { + $propertyValueAttributes = $propertyValue->attributes($namespacesMeta['meta']); + $propertyValue = (string) $propertyValue; + switch ($propertyName) { + case 'initial-creator' : + $docProps->setCreator($propertyValue); + break; + case 'keyword' : + $docProps->setKeywords($propertyValue); + break; + case 'creation-date' : + $creationDate = strtotime($propertyValue); + $docProps->setCreated($creationDate); + break; + case 'user-defined' : + $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING; + foreach ($propertyValueAttributes as $key => $value) { + if ($key == 'name') { + $propertyValueName = (string) $value; + } elseif($key == 'value-type') { + switch ($value) { + case 'date' : + $propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue,'date'); + $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE; + break; + case 'boolean' : + $propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue,'bool'); + $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN; + break; + case 'float' : + $propertyValue = PHPExcel_DocumentProperties::convertProperty($propertyValue,'r4'); + $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT; + break; + default : + $propertyValueType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING; + } } - case 'table-row' : - $rowDataTableAttributes = $rowData->attributes($namespacesContent['table']); - $rowRepeats = (isset($rowDataTableAttributes['number-rows-repeated'])) ? - $rowDataTableAttributes['number-rows-repeated'] : 1; - $columnID = 'A'; - foreach($rowData as $key => $cellData) { - if ($this->getReadFilter() !== NULL) { - if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) { - continue; - } + } + $docProps->setCustomProperty($propertyValueName,$propertyValue,$propertyValueType); + break; + } + } + } + + +// echo '

Workbook Content

'; + $xml = simplexml_load_string($zip->getFromName("content.xml"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); + $namespacesContent = $xml->getNamespaces(true); +// echo '
';
+//		print_r($namespacesContent);
+//		echo '

'; + + $workbook = $xml->children($namespacesContent['office']); + foreach($workbook->body->spreadsheet as $workbookData) { + $workbookData = $workbookData->children($namespacesContent['table']); + $worksheetID = 0; + foreach($workbookData->table as $worksheetDataSet) { + $worksheetData = $worksheetDataSet->children($namespacesContent['table']); +// print_r($worksheetData); +// echo '
'; + $worksheetDataAttributes = $worksheetDataSet->attributes($namespacesContent['table']); +// print_r($worksheetDataAttributes); +// echo '
'; + if ((isset($this->_loadSheetsOnly)) && (isset($worksheetDataAttributes['name'])) && + (!in_array($worksheetDataAttributes['name'], $this->_loadSheetsOnly))) { + continue; + } + +// echo '

Worksheet '.$worksheetDataAttributes['name'].'

'; + // Create new Worksheet + $objPHPExcel->createSheet(); + $objPHPExcel->setActiveSheetIndex($worksheetID); + if (isset($worksheetDataAttributes['name'])) { + $worksheetName = (string) $worksheetDataAttributes['name']; + // Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in + // formula cells... during the load, all formulae should be correct, and we're simply + // bringing the worksheet name in line with the formula, not the reverse + $objPHPExcel->getActiveSheet()->setTitle($worksheetName,false); + } + + $rowID = 1; + foreach($worksheetData as $key => $rowData) { +// echo ''.$key.'
'; + switch ($key) { + case 'table-header-rows': + foreach ($rowData as $key=>$cellData) { + $rowData = $cellData; + break; + } + case 'table-row' : + $rowDataTableAttributes = $rowData->attributes($namespacesContent['table']); + $rowRepeats = (isset($rowDataTableAttributes['number-rows-repeated'])) ? + $rowDataTableAttributes['number-rows-repeated'] : 1; + $columnID = 'A'; + foreach($rowData as $key => $cellData) { + if ($this->getReadFilter() !== NULL) { + if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) { + continue; } + } -// echo ''.$columnID.$rowID.'
'; - $cellDataText = (isset($namespacesContent['text'])) ? - $cellData->children($namespacesContent['text']) : - ''; - $cellDataOffice = $cellData->children($namespacesContent['office']); - $cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']); - $cellDataTableAttributes = $cellData->attributes($namespacesContent['table']); +// echo ''.$columnID.$rowID.'
'; + $cellDataText = (isset($namespacesContent['text'])) ? + $cellData->children($namespacesContent['text']) : + ''; + $cellDataOffice = $cellData->children($namespacesContent['office']); + $cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']); + $cellDataTableAttributes = $cellData->attributes($namespacesContent['table']); -// echo 'Office Attributes: '; -// print_r($cellDataOfficeAttributes); -// echo '
Table Attributes: '; -// print_r($cellDataTableAttributes); -// echo '
Cell Data Text'; -// print_r($cellDataText); -// echo '
'; +// echo 'Office Attributes: '; +// print_r($cellDataOfficeAttributes); +// echo '
Table Attributes: '; +// print_r($cellDataTableAttributes); +// echo '
Cell Data Text'; +// print_r($cellDataText); +// echo '
'; // - $type = $formatting = $hyperlink = null; - $hasCalculatedValue = false; - $cellDataFormula = ''; - if (isset($cellDataTableAttributes['formula'])) { - $cellDataFormula = $cellDataTableAttributes['formula']; - $hasCalculatedValue = true; - } + $type = $formatting = $hyperlink = null; + $hasCalculatedValue = false; + $cellDataFormula = ''; + if (isset($cellDataTableAttributes['formula'])) { + $cellDataFormula = $cellDataTableAttributes['formula']; + $hasCalculatedValue = true; + } - if (isset($cellDataOffice->annotation)) { -// echo 'Cell has comment
'; - $annotationText = $cellDataOffice->annotation->children($namespacesContent['text']); - $textArray = array(); - foreach($annotationText as $t) { - foreach($t->span as $text) { - $textArray[] = (string)$text; - } + if (isset($cellDataOffice->annotation)) { +// echo 'Cell has comment
'; + $annotationText = $cellDataOffice->annotation->children($namespacesContent['text']); + $textArray = array(); + foreach($annotationText as $t) { + foreach($t->span as $text) { + $textArray[] = (string)$text; } - $text = implode("\n",$textArray); -// echo $text,'
'; - $objPHPExcel->getActiveSheet()->getComment( $columnID.$rowID ) -// ->setAuthor( $author ) - ->setText($this->_parseRichText($text) ); } + $text = implode("\n",$textArray); +// echo $text,'
'; + $objPHPExcel->getActiveSheet()->getComment( $columnID.$rowID ) +// ->setAuthor( $author ) + ->setText($this->_parseRichText($text) ); + } if (isset($cellDataText->p)) { - // Consolidate if there are multiple p records (maybe with spans as well) - $dataArray = array(); - // Text can have multiple text:p and within those, multiple text:span. - // text:p newlines, but text:span does not. - // Also, here we assume there is no text data is span fields are specified, since - // we have no way of knowing proper positioning anyway. - foreach ($cellDataText->p as $pData) { - if (isset($pData->span)) { - // span sections do not newline, so we just create one large string here - $spanSection = ""; - foreach ($pData->span as $spanData) { - $spanSection .= $spanData; + // Consolidate if there are multiple p records (maybe with spans as well) + $dataArray = array(); + // Text can have multiple text:p and within those, multiple text:span. + // text:p newlines, but text:span does not. + // Also, here we assume there is no text data is span fields are specified, since + // we have no way of knowing proper positioning anyway. + foreach ($cellDataText->p as $pData) { + if (isset($pData->span)) { + // span sections do not newline, so we just create one large string here + $spanSection = ""; + foreach ($pData->span as $spanData) { + $spanSection .= $spanData; + } + array_push($dataArray, $spanSection); + } else { + array_push($dataArray, $pData); + } + } + $allCellDataText = implode($dataArray, "\n"); + +// echo 'Value Type is '.$cellDataOfficeAttributes['value-type'].'
'; + switch ($cellDataOfficeAttributes['value-type']) { + case 'string' : + $type = PHPExcel_Cell_DataType::TYPE_STRING; + $dataValue = $allCellDataText; + if (isset($dataValue->a)) { + $dataValue = $dataValue->a; + $cellXLinkAttributes = $dataValue->attributes($namespacesContent['xlink']); + $hyperlink = $cellXLinkAttributes['href']; } - array_push($dataArray, $spanSection); - } else { - array_push($dataArray, $pData); - } - } - $allCellDataText = implode($dataArray, "\n"); - -// echo 'Value Type is '.$cellDataOfficeAttributes['value-type'].'
'; - switch ($cellDataOfficeAttributes['value-type']) { - case 'string' : - $type = PHPExcel_Cell_DataType::TYPE_STRING; - $dataValue = $allCellDataText; - if (isset($dataValue->a)) { - $dataValue = $dataValue->a; - $cellXLinkAttributes = $dataValue->attributes($namespacesContent['xlink']); - $hyperlink = $cellXLinkAttributes['href']; - } - break; - case 'boolean' : - $type = PHPExcel_Cell_DataType::TYPE_BOOL; - $dataValue = ($allCellDataText == 'TRUE') ? True : False; - break; - case 'percentage' : - $type = PHPExcel_Cell_DataType::TYPE_NUMERIC; - $dataValue = (float) $cellDataOfficeAttributes['value']; - if (floor($dataValue) == $dataValue) { - $dataValue = (integer) $dataValue; - } - $formatting = PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00; - break; - case 'currency' : - $type = PHPExcel_Cell_DataType::TYPE_NUMERIC; - $dataValue = (float) $cellDataOfficeAttributes['value']; - if (floor($dataValue) == $dataValue) { - $dataValue = (integer) $dataValue; - } - $formatting = PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE; - break; - case 'float' : - $type = PHPExcel_Cell_DataType::TYPE_NUMERIC; - $dataValue = (float) $cellDataOfficeAttributes['value']; - if (floor($dataValue) == $dataValue) { - if ($dataValue = (integer) $dataValue) - $dataValue = (integer) $dataValue; - else - $dataValue = (float) $dataValue; - } - break; - case 'date' : - $type = PHPExcel_Cell_DataType::TYPE_NUMERIC; - $dateObj = new DateTime($cellDataOfficeAttributes['date-value'], $GMT); - $dateObj->setTimeZone($timezoneObj); - list($year,$month,$day,$hour,$minute,$second) = explode(' ',$dateObj->format('Y m d H i s')); - $dataValue = PHPExcel_Shared_Date::FormattedPHPToExcel($year,$month,$day,$hour,$minute,$second); - if ($dataValue != floor($dataValue)) { - $formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15.' '.PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4; - } else { - $formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15; - } - break; - case 'time' : - $type = PHPExcel_Cell_DataType::TYPE_NUMERIC; - $dataValue = PHPExcel_Shared_Date::PHPToExcel(strtotime('01-01-1970 '.implode(':',sscanf($cellDataOfficeAttributes['time-value'],'PT%dH%dM%dS')))); - $formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4; - break; - } -// echo 'Data value is '.$dataValue.'
'; -// if ($hyperlink !== NULL) { -// echo 'Hyperlink is '.$hyperlink.'
'; -// } - } else { - $type = PHPExcel_Cell_DataType::TYPE_NULL; - $dataValue = NULL; - } - - if ($hasCalculatedValue) { - $type = PHPExcel_Cell_DataType::TYPE_FORMULA; -// echo 'Formula: '.$cellDataFormula.'
'; - $cellDataFormula = substr($cellDataFormula,strpos($cellDataFormula,':=')+1); - $temp = explode('"',$cellDataFormula); - $tKey = false; - foreach($temp as &$value) { - // Only replace in alternate array entries (i.e. non-quoted blocks) - if ($tKey = !$tKey) { - $value = preg_replace('/\[\.(.*):\.(.*)\]/Ui','$1:$2',$value); - $value = preg_replace('/\[\.(.*)\]/Ui','$1',$value); - $value = PHPExcel_Calculation::_translateSeparator(';',',',$value,$inBraces); - } - } - unset($value); - // Then rebuild the formula string - $cellDataFormula = implode('"',$temp); -// echo 'Adjusted Formula: '.$cellDataFormula.'
'; - } - - $colRepeats = (isset($cellDataTableAttributes['number-columns-repeated'])) ? - $cellDataTableAttributes['number-columns-repeated'] : 1; - if ($type !== NULL) { - for ($i = 0; $i < $colRepeats; ++$i) { - if ($i > 0) { - ++$columnID; - } - if ($type !== PHPExcel_Cell_DataType::TYPE_NULL) { - for ($rowAdjust = 0; $rowAdjust < $rowRepeats; ++$rowAdjust) { - $rID = $rowID + $rowAdjust; - $objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue),$type); - if ($hasCalculatedValue) { -// echo 'Forumla result is '.$dataValue.'
'; - $objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->setCalculatedValue($dataValue); - } - if ($formatting !== NULL) { - $objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode($formatting); - } else { - $objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_GENERAL); - } - if ($hyperlink !== NULL) { - $objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->getHyperlink()->setUrl($hyperlink); - } + break; + case 'boolean' : + $type = PHPExcel_Cell_DataType::TYPE_BOOL; + $dataValue = ($allCellDataText == 'TRUE') ? True : False; + break; + case 'percentage' : + $type = PHPExcel_Cell_DataType::TYPE_NUMERIC; + $dataValue = (float) $cellDataOfficeAttributes['value']; + if (floor($dataValue) == $dataValue) { + $dataValue = (integer) $dataValue; } - } - } + $formatting = PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00; + break; + case 'currency' : + $type = PHPExcel_Cell_DataType::TYPE_NUMERIC; + $dataValue = (float) $cellDataOfficeAttributes['value']; + if (floor($dataValue) == $dataValue) { + $dataValue = (integer) $dataValue; + } + $formatting = PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE; + break; + case 'float' : + $type = PHPExcel_Cell_DataType::TYPE_NUMERIC; + $dataValue = (float) $cellDataOfficeAttributes['value']; + if (floor($dataValue) == $dataValue) { + if ($dataValue == (integer) $dataValue) + $dataValue = (integer) $dataValue; + else + $dataValue = (float) $dataValue; + } + break; + case 'date' : + $type = PHPExcel_Cell_DataType::TYPE_NUMERIC; + $dateObj = new DateTime($cellDataOfficeAttributes['date-value'], $GMT); + $dateObj->setTimeZone($timezoneObj); + list($year,$month,$day,$hour,$minute,$second) = explode(' ',$dateObj->format('Y m d H i s')); + $dataValue = PHPExcel_Shared_Date::FormattedPHPToExcel($year,$month,$day,$hour,$minute,$second); + if ($dataValue != floor($dataValue)) { + $formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15.' '.PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4; + } else { + $formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15; + } + break; + case 'time' : + $type = PHPExcel_Cell_DataType::TYPE_NUMERIC; + $dataValue = PHPExcel_Shared_Date::PHPToExcel(strtotime('01-01-1970 '.implode(':',sscanf($cellDataOfficeAttributes['time-value'],'PT%dH%dM%dS')))); + $formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4; + break; } - - // Merged cells - if ((isset($cellDataTableAttributes['number-columns-spanned'])) || (isset($cellDataTableAttributes['number-rows-spanned']))) { - if (($type !== PHPExcel_Cell_DataType::TYPE_NULL) || (!$this->_readDataOnly)) { - $columnTo = $columnID; - if (isset($cellDataTableAttributes['number-columns-spanned'])) { - $columnTo = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cellDataTableAttributes['number-columns-spanned'] -2); - } - $rowTo = $rowID; - if (isset($cellDataTableAttributes['number-rows-spanned'])) { - $rowTo = $rowTo + $cellDataTableAttributes['number-rows-spanned'] - 1; - } - $cellRange = $columnID.$rowID.':'.$columnTo.$rowTo; - $objPHPExcel->getActiveSheet()->mergeCells($cellRange); - } - } - - ++$columnID; +// echo 'Data value is '.$dataValue.'
'; +// if ($hyperlink !== NULL) { +// echo 'Hyperlink is '.$hyperlink.'
'; +// } + } else { + $type = PHPExcel_Cell_DataType::TYPE_NULL; + $dataValue = NULL; } - $rowID += $rowRepeats; - break; - } - } - ++$worksheetID; - } - } + if ($hasCalculatedValue) { + $type = PHPExcel_Cell_DataType::TYPE_FORMULA; +// echo 'Formula: ', $cellDataFormula, PHP_EOL; + $cellDataFormula = substr($cellDataFormula,strpos($cellDataFormula,':=')+1); + $temp = explode('"',$cellDataFormula); + $tKey = false; + foreach($temp as &$value) { + // Only replace in alternate array entries (i.e. non-quoted blocks) + if ($tKey = !$tKey) { + $value = preg_replace('/\[([^\.]+)\.([^\.]+):\.([^\.]+)\]/Ui','$1!$2:$3',$value); // Cell range reference in another sheet + $value = preg_replace('/\[([^\.]+)\.([^\.]+)\]/Ui','$1!$2',$value); // Cell reference in another sheet + $value = preg_replace('/\[\.([^\.]+):\.([^\.]+)\]/Ui','$1:$2',$value); // Cell range reference + $value = preg_replace('/\[\.([^\.]+)\]/Ui','$1',$value); // Simple cell reference + $value = PHPExcel_Calculation::_translateSeparator(';',',',$value,$inBraces); + } + } + unset($value); + // Then rebuild the formula string + $cellDataFormula = implode('"',$temp); +// echo 'Adjusted Formula: ', $cellDataFormula, PHP_EOL; + } + + $colRepeats = (isset($cellDataTableAttributes['number-columns-repeated'])) ? + $cellDataTableAttributes['number-columns-repeated'] : 1; + if ($type !== NULL) { + for ($i = 0; $i < $colRepeats; ++$i) { + if ($i > 0) { + ++$columnID; + } + if ($type !== PHPExcel_Cell_DataType::TYPE_NULL) { + for ($rowAdjust = 0; $rowAdjust < $rowRepeats; ++$rowAdjust) { + $rID = $rowID + $rowAdjust; + $objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue),$type); + if ($hasCalculatedValue) { +// echo 'Forumla result is '.$dataValue.'
'; + $objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->setCalculatedValue($dataValue); + } + if ($formatting !== NULL) { + $objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode($formatting); + } else { + $objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_GENERAL); + } + if ($hyperlink !== NULL) { + $objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->getHyperlink()->setUrl($hyperlink); + } + } + } + } + } + + // Merged cells + if ((isset($cellDataTableAttributes['number-columns-spanned'])) || (isset($cellDataTableAttributes['number-rows-spanned']))) { + if (($type !== PHPExcel_Cell_DataType::TYPE_NULL) || (!$this->_readDataOnly)) { + $columnTo = $columnID; + if (isset($cellDataTableAttributes['number-columns-spanned'])) { + $columnTo = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cellDataTableAttributes['number-columns-spanned'] -2); + } + $rowTo = $rowID; + if (isset($cellDataTableAttributes['number-rows-spanned'])) { + $rowTo = $rowTo + $cellDataTableAttributes['number-rows-spanned'] - 1; + } + $cellRange = $columnID.$rowID.':'.$columnTo.$rowTo; + $objPHPExcel->getActiveSheet()->mergeCells($cellRange); + } + } + + ++$columnID; + } + $rowID += $rowRepeats; + break; + } + } + ++$worksheetID; + } } // Return diff --git a/htdocs/includes/phpexcel/PHPExcel/Reader/SYLK.php b/htdocs/includes/phpexcel/PHPExcel/Reader/SYLK.php index 47d5703f56b..cd87ce56c10 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Reader/SYLK.php +++ b/htdocs/includes/phpexcel/PHPExcel/Reader/SYLK.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -40,9 +40,9 @@ if (!defined('PHPEXCEL_ROOT')) { * * @category PHPExcel * @package PHPExcel_Reader - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader +class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader { /** * Input encoding @@ -72,14 +72,6 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader */ private $_format = 0; - /** - * PHPExcel_Reader_IReadFilter instance - * - * @var PHPExcel_Reader_IReadFilter - */ - private $_readFilter = null; - - /** * Create a new PHPExcel_Reader_SYLK */ @@ -87,63 +79,31 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); } - /** - * Can the current PHPExcel_Reader_IReader read the file? + * Validate that the current file is a SYLK file * - * @param string $pFileName - * @return boolean - * @throws Exception + * @return boolean */ - public function canRead($pFilename) + protected function _isValidFormat() { - // Check if file exists - if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); - } - // Read sample data (first 2 KB will do) - $fh = fopen($pFilename, 'r'); - $data = fread($fh, 2048); - fclose($fh); + $data = fread($this->_fileHandle, 2048); // Count delimiters in file $delimiterCount = substr_count($data, ';'); if ($delimiterCount < 1) { - return false; + return FALSE; } // Analyze first line looking for ID; signature $lines = explode("\n", $data); if (substr($lines[0],0,4) != 'ID;P') { - return false; + return FALSE; } - return true; + return TRUE; } - - /** - * Read filter - * - * @return PHPExcel_Reader_IReadFilter - */ - public function getReadFilter() { - return $this->_readFilter; - } - - - /** - * Set read filter - * - * @param PHPExcel_Reader_IReadFilter $pValue - */ - public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) { - $this->_readFilter = $pValue; - return $this; - } - - /** * Set input encoding * @@ -155,7 +115,6 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader return $this; } - /** * Get input encoding * @@ -166,25 +125,22 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader return $this->_inputEncoding; } - /** * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) * * @param string $pFilename - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function listWorksheetInfo($pFilename) { - // Check if file exists - if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); - } - // Open file - $fileHandle = fopen($pFilename, 'r'); - if ($fileHandle === false) { - throw new Exception("Could not open file " . $pFilename . " for reading."); + $this->_openFile($pFilename); + if (!$this->_isValidFormat()) { + fclose ($this->_fileHandle); + throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); } + $fileHandle = $this->_fileHandle; + rewind($fileHandle); $worksheetInfo = array(); $worksheetInfo[0]['worksheetName'] = 'Worksheet'; @@ -206,7 +162,7 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader // explode each row at semicolons while taking into account that literal semicolon (;) // is escaped like this (;;) - $rowData = explode("\t",str_replace('?',';',str_replace(';',"\t",str_replace(';;','?',rtrim($rowData))))); + $rowData = explode("\t",str_replace('¤',';',str_replace(';',"\t",str_replace(';;','¤',rtrim($rowData))))); $dataType = array_shift($rowData); if ($dataType == 'C') { @@ -238,13 +194,12 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader return $worksheetInfo; } - /** * Loads PHPExcel from file * * @param string $pFilename * @return PHPExcel - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function load($pFilename) { @@ -255,21 +210,24 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader return $this->loadIntoExisting($pFilename, $objPHPExcel); } - /** * Loads PHPExcel from file into PHPExcel instance * * @param string $pFilename * @param PHPExcel $objPHPExcel * @return PHPExcel - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) { - // Check if file exists - if (!file_exists($pFilename)) { - throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); + // Open file + $this->_openFile($pFilename); + if (!$this->_isValidFormat()) { + fclose ($this->_fileHandle); + throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); } + $fileHandle = $this->_fileHandle; + rewind($fileHandle); // Create new PHPExcel while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) { @@ -280,12 +238,6 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader $fromFormats = array('\-', '\ '); $toFormats = array('-', ' '); - // Open file - $fileHandle = fopen($pFilename, 'r'); - if ($fileHandle === false) { - throw new Exception("Could not open file $pFilename for reading."); - } - // Loop through file $rowData = array(); $column = $row = ''; @@ -433,7 +385,9 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader } if (($formatStyle > '') && ($column > '') && ($row > '')) { $columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1); - $objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->_formats[$formatStyle]); + if (isset($this->_formats[$formatStyle])) { + $objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->_formats[$formatStyle]); + } } if ((!empty($styleData)) && ($column > '') && ($row > '')) { $columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1); @@ -473,7 +427,6 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader return $objPHPExcel; } - /** * Get sheet index * @@ -483,7 +436,6 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader return $this->_sheetIndex; } - /** * Set sheet index * diff --git a/htdocs/includes/phpexcel/PHPExcel/ReferenceHelper.php b/htdocs/includes/phpexcel/PHPExcel/ReferenceHelper.php index 9113591297a..402f2b472a6 100644 --- a/htdocs/includes/phpexcel/PHPExcel/ReferenceHelper.php +++ b/htdocs/includes/phpexcel/PHPExcel/ReferenceHelper.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_ReferenceHelper { @@ -69,30 +69,336 @@ class PHPExcel_ReferenceHelper } /** - * Insert a new column, updating all possible related data + * Compare two column addresses + * Intended for use as a Callback function for sorting column addresses by column * - * @param int $pBefore Insert before this one - * @param int $pNumCols Number of columns to insert - * @param int $pNumRows Number of rows to insert - * @throws Exception + * @param string $a First column to test (e.g. 'AA') + * @param string $b Second column to test (e.g. 'Z') + * @return integer */ - public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, PHPExcel_Worksheet $pSheet = null) { + public static function columnSort($a, $b) { + return strcasecmp(strlen($a) . $a, strlen($b) . $b); + } + + /** + * Compare two column addresses + * Intended for use as a Callback function for reverse sorting column addresses by column + * + * @param string $a First column to test (e.g. 'AA') + * @param string $b Second column to test (e.g. 'Z') + * @return integer + */ + public static function columnReverseSort($a, $b) { + return 1 - strcasecmp(strlen($a) . $a, strlen($b) . $b); + } + + /** + * Compare two cell addresses + * Intended for use as a Callback function for sorting cell addresses by column and row + * + * @param string $a First cell to test (e.g. 'AA1') + * @param string $b Second cell to test (e.g. 'Z1') + * @return integer + */ + public static function cellSort($a, $b) { + sscanf($a,'%[A-Z]%d', $ac, $ar); + sscanf($b,'%[A-Z]%d', $bc, $br); + + if ($ar == $br) { + return strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc); + } + return ($ar < $br) ? -1 : 1; + } + + /** + * Compare two cell addresses + * Intended for use as a Callback function for sorting cell addresses by column and row + * + * @param string $a First cell to test (e.g. 'AA1') + * @param string $b Second cell to test (e.g. 'Z1') + * @return integer + */ + public static function cellReverseSort($a, $b) { + sscanf($a,'%[A-Z]%d', $ac, $ar); + sscanf($b,'%[A-Z]%d', $bc, $br); + + if ($ar == $br) { + return 1 - strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc); + } + return ($ar < $br) ? 1 : -1; + } + + /** + * Test whether a cell address falls within a defined range of cells + * + * @param string $cellAddress Address of the cell we're testing + * @param integer $beforeRow Number of the row we're inserting/deleting before + * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) + * @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before + * @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion) + * @return boolean + */ + private static function cellAddressInDeleteRange($cellAddress, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols) { + list($cellColumn, $cellRow) = PHPExcel_Cell::coordinateFromString($cellAddress); + $cellColumnIndex = PHPExcel_Cell::columnIndexFromString($cellColumn); + // Is cell within the range of rows/columns if we're deleting + if ($pNumRows < 0 && + ($cellRow >= ($beforeRow + $pNumRows)) && + ($cellRow < $beforeRow)) { + return TRUE; + } elseif ($pNumCols < 0 && + ($cellColumnIndex >= ($beforeColumnIndex + $pNumCols)) && + ($cellColumnIndex < $beforeColumnIndex)) { + return TRUE; + } + return FALSE; + } + + /** + * Update page breaks when inserting/deleting rows/columns + * + * @param PHPExcel_Worksheet $pSheet The worksheet that we're editing + * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') + * @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before + * @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion) + * @param integer $beforeRow Number of the row we're inserting/deleting before + * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) + */ + protected function _adjustPageBreaks(PHPExcel_Worksheet $pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + { + $aBreaks = $pSheet->getBreaks(); + ($pNumCols > 0 || $pNumRows > 0) ? + uksort($aBreaks, array('PHPExcel_ReferenceHelper','cellReverseSort')) : + uksort($aBreaks, array('PHPExcel_ReferenceHelper','cellSort')); + + foreach ($aBreaks as $key => $value) { + if (self::cellAddressInDeleteRange($key, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)) { + // If we're deleting, then clear any defined breaks that are within the range + // of rows/columns that we're deleting + $pSheet->setBreak($key, PHPExcel_Worksheet::BREAK_NONE); + } else { + // Otherwise update any affected breaks by inserting a new break at the appropriate point + // and removing the old affected break + $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); + if ($key != $newReference) { + $pSheet->setBreak($newReference, $value) + ->setBreak($key, PHPExcel_Worksheet::BREAK_NONE); + } + } + } + } + + /** + * Update cell comments when inserting/deleting rows/columns + * + * @param PHPExcel_Worksheet $pSheet The worksheet that we're editing + * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') + * @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before + * @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion) + * @param integer $beforeRow Number of the row we're inserting/deleting before + * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) + */ + protected function _adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + { + $aComments = $pSheet->getComments(); + $aNewComments = array(); // the new array of all comments + + foreach ($aComments as $key => &$value) { + // Any comments inside a deleted range will be ignored + if (!self::cellAddressInDeleteRange($key, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)) { + // Otherwise build a new array of comments indexed by the adjusted cell reference + $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); + $aNewComments[$newReference] = $value; + } + } + // Replace the comments array with the new set of comments + $pSheet->setComments($aNewComments); + } + + /** + * Update hyperlinks when inserting/deleting rows/columns + * + * @param PHPExcel_Worksheet $pSheet The worksheet that we're editing + * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') + * @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before + * @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion) + * @param integer $beforeRow Number of the row we're inserting/deleting before + * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) + */ + protected function _adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + { + $aHyperlinkCollection = $pSheet->getHyperlinkCollection(); + ($pNumCols > 0 || $pNumRows > 0) ? + uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : + uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellSort')); + + foreach ($aHyperlinkCollection as $key => $value) { + $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); + if ($key != $newReference) { + $pSheet->setHyperlink( $newReference, $value ); + $pSheet->setHyperlink( $key, null ); + } + } + } + + /** + * Update data validations when inserting/deleting rows/columns + * + * @param PHPExcel_Worksheet $pSheet The worksheet that we're editing + * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') + * @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before + * @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion) + * @param integer $beforeRow Number of the row we're inserting/deleting before + * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) + */ + protected function _adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + { + $aDataValidationCollection = $pSheet->getDataValidationCollection(); + ($pNumCols > 0 || $pNumRows > 0) ? + uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : + uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellSort')); + foreach ($aDataValidationCollection as $key => $value) { + $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); + if ($key != $newReference) { + $pSheet->setDataValidation( $newReference, $value ); + $pSheet->setDataValidation( $key, null ); + } + } + } + + /** + * Update merged cells when inserting/deleting rows/columns + * + * @param PHPExcel_Worksheet $pSheet The worksheet that we're editing + * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') + * @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before + * @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion) + * @param integer $beforeRow Number of the row we're inserting/deleting before + * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) + */ + protected function _adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + { + $aMergeCells = $pSheet->getMergeCells(); + $aNewMergeCells = array(); // the new array of all merge cells + foreach ($aMergeCells as $key => &$value) { + $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); + $aNewMergeCells[$newReference] = $newReference; + } + $pSheet->setMergeCells($aNewMergeCells); // replace the merge cells array + } + + /** + * Update protected cells when inserting/deleting rows/columns + * + * @param PHPExcel_Worksheet $pSheet The worksheet that we're editing + * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') + * @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before + * @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion) + * @param integer $beforeRow Number of the row we're inserting/deleting before + * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) + */ + protected function _adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + { + $aProtectedCells = $pSheet->getProtectedCells(); + ($pNumCols > 0 || $pNumRows > 0) ? + uksort($aProtectedCells, array('PHPExcel_ReferenceHelper','cellReverseSort')) : + uksort($aProtectedCells, array('PHPExcel_ReferenceHelper','cellSort')); + foreach ($aProtectedCells as $key => $value) { + $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); + if ($key != $newReference) { + $pSheet->protectCells( $newReference, $value, true ); + $pSheet->unprotectCells( $key ); + } + } + } + + /** + * Update column dimensions when inserting/deleting rows/columns + * + * @param PHPExcel_Worksheet $pSheet The worksheet that we're editing + * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') + * @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before + * @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion) + * @param integer $beforeRow Number of the row we're inserting/deleting before + * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) + */ + protected function _adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + { + $aColumnDimensions = array_reverse($pSheet->getColumnDimensions(), true); + if (!empty($aColumnDimensions)) { + foreach ($aColumnDimensions as $objColumnDimension) { + $newReference = $this->updateCellReference($objColumnDimension->getColumnIndex() . '1', $pBefore, $pNumCols, $pNumRows); + list($newReference) = PHPExcel_Cell::coordinateFromString($newReference); + if ($objColumnDimension->getColumnIndex() != $newReference) { + $objColumnDimension->setColumnIndex($newReference); + } + } + $pSheet->refreshColumnDimensions(); + } + } + + /** + * Update row dimensions when inserting/deleting rows/columns + * + * @param PHPExcel_Worksheet $pSheet The worksheet that we're editing + * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') + * @param integer $beforeColumnIndex Index number of the column we're inserting/deleting before + * @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion) + * @param integer $beforeRow Number of the row we're inserting/deleting before + * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) + */ + protected function _adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + { + $aRowDimensions = array_reverse($pSheet->getRowDimensions(), true); + if (!empty($aRowDimensions)) { + foreach ($aRowDimensions as $objRowDimension) { + $newReference = $this->updateCellReference('A' . $objRowDimension->getRowIndex(), $pBefore, $pNumCols, $pNumRows); + list(, $newReference) = PHPExcel_Cell::coordinateFromString($newReference); + if ($objRowDimension->getRowIndex() != $newReference) { + $objRowDimension->setRowIndex($newReference); + } + } + $pSheet->refreshRowDimensions(); + + $copyDimension = $pSheet->getRowDimension($beforeRow - 1); + for ($i = $beforeRow; $i <= $beforeRow - 1 + $pNumRows; ++$i) { + $newDimension = $pSheet->getRowDimension($i); + $newDimension->setRowHeight($copyDimension->getRowHeight()); + $newDimension->setVisible($copyDimension->getVisible()); + $newDimension->setOutlineLevel($copyDimension->getOutlineLevel()); + $newDimension->setCollapsed($copyDimension->getCollapsed()); + } + } + } + + /** + * Insert a new column or row, updating all possible related data + * + * @param string $pBefore Insert before this cell address (e.g. 'A1') + * @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion) + * @param integer $pNumRows Number of rows to insert/delete (negative values indicate deletion) + * @param PHPExcel_Worksheet $pSheet The worksheet that we're editing + * @throws PHPExcel_Exception + */ + public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, PHPExcel_Worksheet $pSheet = NULL) + { + $remove = ($pNumCols < 0 || $pNumRows < 0); $aCellCollection = $pSheet->getCellCollection(); // Get coordinates of $pBefore $beforeColumn = 'A'; $beforeRow = 1; - list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString( $pBefore ); - + list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString($pBefore); + $beforeColumnIndex = PHPExcel_Cell::columnIndexFromString($beforeColumn); // Clear cells if we are removing columns or rows $highestColumn = $pSheet->getHighestColumn(); $highestRow = $pSheet->getHighestRow(); // 1. Clear column strips if we are removing columns - if ($pNumCols < 0 && PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2 + $pNumCols > 0) { + if ($pNumCols < 0 && $beforeColumnIndex - 2 + $pNumCols > 0) { for ($i = 1; $i <= $highestRow - 1; ++$i) { - for ($j = PHPExcel_Cell::columnIndexFromString($beforeColumn) - 1 + $pNumCols; $j <= PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2; ++$j) { + for ($j = $beforeColumnIndex - 1 + $pNumCols; $j <= $beforeColumnIndex - 2; ++$j) { $coordinate = PHPExcel_Cell::stringFromColumnIndex($j) . $i; $pSheet->removeConditionalStyles($coordinate); if ($pSheet->cellExists($coordinate)) { @@ -105,7 +411,7 @@ class PHPExcel_ReferenceHelper // 2. Clear row strips if we are removing rows if ($pNumRows < 0 && $beforeRow - 1 + $pNumRows > 0) { - for ($i = PHPExcel_Cell::columnIndexFromString($beforeColumn) - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) { + for ($i = $beforeColumnIndex - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) { for ($j = $beforeRow + $pNumRows; $j <= $beforeRow - 1; ++$j) { $coordinate = PHPExcel_Cell::stringFromColumnIndex($i) . $j; $pSheet->removeConditionalStyles($coordinate); @@ -117,21 +423,28 @@ class PHPExcel_ReferenceHelper } } - // Loop through cells, bottom-up, and change cell coordinates - while (($cellID = ($pNumCols < 0 || $pNumRows < 0) ? array_shift($aCellCollection) : array_pop($aCellCollection))) { + if($remove) { + // It's faster to reverse and pop than to use unshift, especially with large cell collections + $aCellCollection = array_reverse($aCellCollection); + } + while ($cellID = array_pop($aCellCollection)) { $cell = $pSheet->getCell($cellID); + $cellIndex = PHPExcel_Cell::columnIndexFromString($cell->getColumn()); + + if ($cellIndex-1 + $pNumCols < 0) { + continue; + } // New coordinates - $newCoordinates = PHPExcel_Cell::stringFromColumnIndex( PHPExcel_Cell::columnIndexFromString($cell->getColumn()) - 1 + $pNumCols ) . ($cell->getRow() + $pNumRows); + $newCoordinates = PHPExcel_Cell::stringFromColumnIndex($cellIndex-1 + $pNumCols) . ($cell->getRow() + $pNumRows); // Should the cell be updated? Move value and cellXf index from one cell to another. - if ((PHPExcel_Cell::columnIndexFromString( $cell->getColumn() ) >= PHPExcel_Cell::columnIndexFromString($beforeColumn)) && + if (($cellIndex >= $beforeColumnIndex) && ($cell->getRow() >= $beforeRow)) { // Update cell styles $pSheet->getCell($newCoordinates)->setXfIndex($cell->getXfIndex()); - $cell->setXfIndex(0); // Insert this cell at its new location if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) { @@ -145,7 +458,7 @@ class PHPExcel_ReferenceHelper } // Clear the original cell - $pSheet->getCell($cell->getCoordinate())->setValue(''); + $pSheet->getCellCacheController()->deleteCacheData($cellID); } else { /* We don't need to update styles for rows/columns before our insertion position, @@ -159,21 +472,20 @@ class PHPExcel_ReferenceHelper } } - // Duplicate styles for the newly inserted cells $highestColumn = $pSheet->getHighestColumn(); $highestRow = $pSheet->getHighestRow(); - if ($pNumCols > 0 && PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2 > 0) { + if ($pNumCols > 0 && $beforeColumnIndex - 2 > 0) { for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) { // Style - $coordinate = PHPExcel_Cell::stringFromColumnIndex( PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2 ) . $i; + $coordinate = PHPExcel_Cell::stringFromColumnIndex( $beforeColumnIndex - 2 ) . $i; if ($pSheet->cellExists($coordinate)) { $xfIndex = $pSheet->getCell($coordinate)->getXfIndex(); $conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ? $pSheet->getConditionalStyles($coordinate) : false; - for ($j = PHPExcel_Cell::columnIndexFromString($beforeColumn) - 1; $j <= PHPExcel_Cell::columnIndexFromString($beforeColumn) - 2 + $pNumCols; ++$j) { + for ($j = $beforeColumnIndex - 1; $j <= $beforeColumnIndex - 2 + $pNumCols; ++$j) { $pSheet->getCellByColumnAndRow($j, $i)->setXfIndex($xfIndex); if ($conditionalStyles) { $cloned = array(); @@ -189,7 +501,7 @@ class PHPExcel_ReferenceHelper } if ($pNumRows > 0 && $beforeRow - 1 > 0) { - for ($i = PHPExcel_Cell::columnIndexFromString($beforeColumn) - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) { + for ($i = $beforeColumnIndex - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) { // Style $coordinate = PHPExcel_Cell::stringFromColumnIndex($i) . ($beforeRow - 1); @@ -211,105 +523,29 @@ class PHPExcel_ReferenceHelper } } - // Update worksheet: column dimensions - $aColumnDimensions = array_reverse($pSheet->getColumnDimensions(), true); - if (!empty($aColumnDimensions)) { - foreach ($aColumnDimensions as $objColumnDimension) { - $newReference = $this->updateCellReference($objColumnDimension->getColumnIndex() . '1', $pBefore, $pNumCols, $pNumRows); - list($newReference) = PHPExcel_Cell::coordinateFromString($newReference); - if ($objColumnDimension->getColumnIndex() != $newReference) { - $objColumnDimension->setColumnIndex($newReference); - } - } - $pSheet->refreshColumnDimensions(); - } - + $this->_adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); // Update worksheet: row dimensions - $aRowDimensions = array_reverse($pSheet->getRowDimensions(), true); - if (!empty($aRowDimensions)) { - foreach ($aRowDimensions as $objRowDimension) { - $newReference = $this->updateCellReference('A' . $objRowDimension->getRowIndex(), $pBefore, $pNumCols, $pNumRows); - list(, $newReference) = PHPExcel_Cell::coordinateFromString($newReference); - if ($objRowDimension->getRowIndex() != $newReference) { - $objRowDimension->setRowIndex($newReference); - } - } - $pSheet->refreshRowDimensions(); + $this->_adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); - $copyDimension = $pSheet->getRowDimension($beforeRow - 1); - for ($i = $beforeRow; $i <= $beforeRow - 1 + $pNumRows; ++$i) { - $newDimension = $pSheet->getRowDimension($i); - $newDimension->setRowHeight($copyDimension->getRowHeight()); - $newDimension->setVisible($copyDimension->getVisible()); - $newDimension->setOutlineLevel($copyDimension->getOutlineLevel()); - $newDimension->setCollapsed($copyDimension->getCollapsed()); - } - } + // Update worksheet: page breaks + $this->_adjustPageBreaks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); - - // Update worksheet: breaks - $aBreaks = array_reverse($pSheet->getBreaks(), true); - foreach ($aBreaks as $key => $value) { - $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); - if ($key != $newReference) { - $pSheet->setBreak( $newReference, $value ); - $pSheet->setBreak( $key, PHPExcel_Worksheet::BREAK_NONE ); - } - } - - // Update worksheet: comments - $aComments = $pSheet->getComments(); - $aNewComments = array(); // the new array of all comments - foreach ($aComments as $key => &$value) { - $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); - $aNewComments[$newReference] = $value; - } - $pSheet->setComments($aNewComments); // replace the comments array + // Update worksheet: comments + $this->_adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); // Update worksheet: hyperlinks - $aHyperlinkCollection = array_reverse($pSheet->getHyperlinkCollection(), true); - foreach ($aHyperlinkCollection as $key => $value) { - $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); - if ($key != $newReference) { - $pSheet->setHyperlink( $newReference, $value ); - $pSheet->setHyperlink( $key, null ); - } - } - + $this->_adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); // Update worksheet: data validations - $aDataValidationCollection = array_reverse($pSheet->getDataValidationCollection(), true); - foreach ($aDataValidationCollection as $key => $value) { - $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); - if ($key != $newReference) { - $pSheet->setDataValidation( $newReference, $value ); - $pSheet->setDataValidation( $key, null ); - } - } - + $this->_adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); // Update worksheet: merge cells - $aMergeCells = $pSheet->getMergeCells(); - $aNewMergeCells = array(); // the new array of all merge cells - foreach ($aMergeCells as $key => &$value) { - $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); - $aNewMergeCells[$newReference] = $newReference; - } - $pSheet->setMergeCells($aNewMergeCells); // replace the merge cells array - + $this->_adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); // Update worksheet: protected cells - $aProtectedCells = array_reverse($pSheet->getProtectedCells(), true); - foreach ($aProtectedCells as $key => $value) { - $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); - if ($key != $newReference) { - $pSheet->protectCells( $newReference, $value, true ); - $pSheet->unprotectCells( $key ); - } - } - + $this->_adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); // Update worksheet: autofilter $autoFilter = $pSheet->getAutoFilter(); @@ -318,7 +554,7 @@ class PHPExcel_ReferenceHelper if ($pNumCols != 0) { $autoFilterColumns = array_keys($autoFilter->getColumns()); if (count($autoFilterColumns) > 0) { - list($column,$row) = sscanf($pBefore,'%[A-Z]%d'); + sscanf($pBefore,'%[A-Z]%d', $column, $row); $columnIndex = PHPExcel_Cell::columnIndexFromString($column); list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($autoFilterRange); if ($columnIndex <= $rangeEnd[0]) { @@ -369,19 +605,16 @@ class PHPExcel_ReferenceHelper $pSheet->setAutoFilter( $this->updateCellReference($autoFilterRange, $pBefore, $pNumCols, $pNumRows) ); } - // Update worksheet: freeze pane if ($pSheet->getFreezePane() != '') { $pSheet->freezePane( $this->updateCellReference($pSheet->getFreezePane(), $pBefore, $pNumCols, $pNumRows) ); } - // Page setup if ($pSheet->getPageSetup()->isPrintAreaSet()) { $pSheet->getPageSetup()->setPrintArea( $this->updateCellReference($pSheet->getPageSetup()->getPrintArea(), $pBefore, $pNumCols, $pNumRows) ); } - // Update worksheet: drawings $aDrawings = $pSheet->getDrawingCollection(); foreach ($aDrawings as $objDrawing) { @@ -391,7 +624,6 @@ class PHPExcel_ReferenceHelper } } - // Update workbook: named ranges if (count($pSheet->getParent()->getNamedRanges()) > 0) { foreach ($pSheet->getParent()->getNamedRanges() as $namedRange) { @@ -414,8 +646,9 @@ class PHPExcel_ReferenceHelper * @param int $pBefore Insert before this one * @param int $pNumCols Number of columns to insert * @param int $pNumRows Number of rows to insert + * @param string $sheetName Worksheet name/title * @return string Updated formula - * @throws Exception + * @throws PHPExcel_Exception */ public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '') { // Update cell references in the formula @@ -445,7 +678,7 @@ class PHPExcel_ReferenceHelper $cellIndex = $column.$row; $newCellTokens[$cellIndex] = preg_quote($toString); - $cellTokens[$cellIndex] = '/(? 0) { foreach($matches as $match) { $fromString = ($match[2] > '') ? $match[2].'!' : ''; $fromString .= $match[3]; - $modified3 = $this->updateCellReference($match[3],$pBefore,$pNumCols,$pNumRows); + $modified3 = $this->updateCellReference($match[3],$pBefore,$pNumCols,$pNumRows); if ($match[3] !== $modified3) { if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) { $toString = ($match[2] > '') ? $match[2].'!' : ''; @@ -518,19 +752,23 @@ class PHPExcel_ReferenceHelper // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more $column = PHPExcel_Cell::columnIndexFromString(trim($column,'$')) + 100000; $row = trim($row,'$') + 10000000; - $cellIndex = $column.$row; + $cellIndex = $row . $column; $newCellTokens[$cellIndex] = preg_quote($toString); - $cellTokens[$cellIndex] = '/(? 0) { - krsort($cellTokens); - krsort($newCellTokens); - // Update cell references in the formula + if ($pNumCols > 0 || $pNumRows > 0) { + krsort($cellTokens); + krsort($newCellTokens); + } else { + ksort($cellTokens); + ksort($newCellTokens); + } // Update cell references in the formula $formulaBlock = str_replace('\\','',preg_replace($cellTokens,$newCellTokens,$formulaBlock)); } } @@ -549,7 +787,7 @@ class PHPExcel_ReferenceHelper * @param int $pNumCols Number of columns to increment * @param int $pNumRows Number of rows to increment * @return string Updated cell range - * @throws Exception + * @throws PHPExcel_Exception */ public function updateCellReference($pCellRange = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) { // Is it in another worksheet? Will not have to update anything. @@ -603,7 +841,7 @@ class PHPExcel_ReferenceHelper * @param int $pNumCols Number of columns to increment * @param int $pNumRows Number of rows to increment * @return string Updated cell range - * @throws Exception + * @throws PHPExcel_Exception */ private function _updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) { if (strpos($pCellRange,':') !== false || strpos($pCellRange, ',') !== false) { @@ -628,7 +866,7 @@ class PHPExcel_ReferenceHelper // Recreate range string return PHPExcel_Cell::buildRange($range); } else { - throw new Exception("Only cell ranges may be passed to this method."); + throw new PHPExcel_Exception("Only cell ranges may be passed to this method."); } } @@ -640,7 +878,7 @@ class PHPExcel_ReferenceHelper * @param int $pNumCols Number of columns to increment * @param int $pNumRows Number of rows to increment * @return string Updated cell reference - * @throws Exception + * @throws PHPExcel_Exception */ private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) { if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) { @@ -653,7 +891,6 @@ class PHPExcel_ReferenceHelper // Verify which parts should be updated $updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') && PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn)); - $updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') && $newRow >= $beforeRow); @@ -670,16 +907,16 @@ class PHPExcel_ReferenceHelper // Return new reference return $newColumn . $newRow; } else { - throw new Exception("Only single cell references may be passed to this method."); + throw new PHPExcel_Exception("Only single cell references may be passed to this method."); } } /** * __clone implementation. Cloning should not be allowed in a Singleton! * - * @throws Exception + * @throws PHPExcel_Exception */ public final function __clone() { - throw new Exception("Cloning a Singleton is not allowed!"); + throw new PHPExcel_Exception("Cloning a Singleton is not allowed!"); } } diff --git a/htdocs/includes/phpexcel/PHPExcel/RichText.php b/htdocs/includes/phpexcel/PHPExcel/RichText.php index 17af169cdd6..2f172a0512b 100644 --- a/htdocs/includes/phpexcel/PHPExcel/RichText.php +++ b/htdocs/includes/phpexcel/PHPExcel/RichText.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_RichText - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.8.0, 2014-03-02 */ @@ -31,81 +31,81 @@ * * @category PHPExcel * @package PHPExcel_RichText - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_RichText implements PHPExcel_IComparable { - /** - * Rich text elements - * - * @var PHPExcel_RichText_ITextElement[] - */ - private $_richTextElements; + /** + * Rich text elements + * + * @var PHPExcel_RichText_ITextElement[] + */ + private $_richTextElements; /** * Create a new PHPExcel_RichText instance * - * @param PHPExcel_Cell $pParent - * @throws Exception + * @param PHPExcel_Cell $pCell + * @throws PHPExcel_Exception */ public function __construct(PHPExcel_Cell $pCell = null) { - // Initialise variables - $this->_richTextElements = array(); + // Initialise variables + $this->_richTextElements = array(); - // Rich-Text string attached to cell? - if ($pCell !== NULL) { - // Add cell text and style - if ($pCell->getValue() != "") { - $objRun = new PHPExcel_RichText_Run($pCell->getValue()); - $objRun->setFont(clone $pCell->getParent()->getStyle($pCell->getCoordinate())->getFont()); - $this->addText($objRun); - } + // Rich-Text string attached to cell? + if ($pCell !== NULL) { + // Add cell text and style + if ($pCell->getValue() != "") { + $objRun = new PHPExcel_RichText_Run($pCell->getValue()); + $objRun->setFont(clone $pCell->getParent()->getStyle($pCell->getCoordinate())->getFont()); + $this->addText($objRun); + } - // Set parent value - $pCell->setValueExplicit($this, PHPExcel_Cell_DataType::TYPE_STRING); - } + // Set parent value + $pCell->setValueExplicit($this, PHPExcel_Cell_DataType::TYPE_STRING); + } } /** * Add text * - * @param PHPExcel_RichText_ITextElement $pText Rich text element - * @throws Exception + * @param PHPExcel_RichText_ITextElement $pText Rich text element + * @throws PHPExcel_Exception * @return PHPExcel_RichText */ public function addText(PHPExcel_RichText_ITextElement $pText = null) { - $this->_richTextElements[] = $pText; - return $this; + $this->_richTextElements[] = $pText; + return $this; } /** * Create text * - * @param string $pText Text - * @return PHPExcel_RichText_TextElement - * @throws Exception + * @param string $pText Text + * @return PHPExcel_RichText_TextElement + * @throws PHPExcel_Exception */ public function createText($pText = '') { - $objText = new PHPExcel_RichText_TextElement($pText); - $this->addText($objText); - return $objText; + $objText = new PHPExcel_RichText_TextElement($pText); + $this->addText($objText); + return $objText; } /** * Create text run * - * @param string $pText Text - * @return PHPExcel_RichText_Run - * @throws Exception + * @param string $pText Text + * @return PHPExcel_RichText_Run + * @throws PHPExcel_Exception */ public function createTextRun($pText = '') { - $objText = new PHPExcel_RichText_Run($pText); - $this->addText($objText); - return $objText; + $objText = new PHPExcel_RichText_Run($pText); + $this->addText($objText); + return $objText; } /** @@ -115,16 +115,16 @@ class PHPExcel_RichText implements PHPExcel_IComparable */ public function getPlainText() { - // Return value - $returnValue = ''; + // Return value + $returnValue = ''; - // Loop through all PHPExcel_RichText_ITextElement - foreach ($this->_richTextElements as $text) { - $returnValue .= $text->getText(); - } + // Loop through all PHPExcel_RichText_ITextElement + foreach ($this->_richTextElements as $text) { + $returnValue .= $text->getText(); + } - // Return - return $returnValue; + // Return + return $returnValue; } /** @@ -132,8 +132,9 @@ class PHPExcel_RichText implements PHPExcel_IComparable * * @return string */ - public function __toString() { - return $this->getPlainText(); + public function __toString() + { + return $this->getPlainText(); } /** @@ -143,54 +144,56 @@ class PHPExcel_RichText implements PHPExcel_IComparable */ public function getRichTextElements() { - return $this->_richTextElements; + return $this->_richTextElements; } /** * Set Rich Text elements * - * @param PHPExcel_RichText_ITextElement[] $pElements Array of elements - * @throws Exception + * @param PHPExcel_RichText_ITextElement[] $pElements Array of elements + * @throws PHPExcel_Exception * @return PHPExcel_RichText */ public function setRichTextElements($pElements = null) { - if (is_array($pElements)) { - $this->_richTextElements = $pElements; - } else { - throw new Exception("Invalid PHPExcel_RichText_ITextElement[] array passed."); - } - return $this; + if (is_array($pElements)) { + $this->_richTextElements = $pElements; + } else { + throw new PHPExcel_Exception("Invalid PHPExcel_RichText_ITextElement[] array passed."); + } + return $this; } - /** - * Get hash code - * - * @return string Hash code - */ - public function getHashCode() { - $hashElements = ''; - foreach ($this->_richTextElements as $element) { - $hashElements .= $element->getHashCode(); - } + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() + { + $hashElements = ''; + foreach ($this->_richTextElements as $element) { + $hashElements .= $element->getHashCode(); + } - return md5( - $hashElements - . __CLASS__ - ); + return md5( + $hashElements + . __CLASS__ + ); } - /** - * Implement PHP __clone to create a deep clone, not just a shallow copy. - */ - public function __clone() { - $vars = get_object_vars($this); - foreach ($vars as $key => $value) { - if (is_object($value)) { - $this->$key = clone $value; - } else { - $this->$key = $value; - } - } - } + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } } diff --git a/htdocs/includes/phpexcel/PHPExcel/RichText/ITextElement.php b/htdocs/includes/phpexcel/PHPExcel/RichText/ITextElement.php index 4c658637f62..ec19498d06c 100644 --- a/htdocs/includes/phpexcel/PHPExcel/RichText/ITextElement.php +++ b/htdocs/includes/phpexcel/PHPExcel/RichText/ITextElement.php @@ -18,9 +18,9 @@ * * @category PHPExcel * @package PHPExcel_RichText - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -29,7 +29,7 @@ * * @category PHPExcel * @package PHPExcel_RichText - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ interface PHPExcel_RichText_ITextElement { diff --git a/htdocs/includes/phpexcel/PHPExcel/RichText/Run.php b/htdocs/includes/phpexcel/PHPExcel/RichText/Run.php index 9e33786c195..71545fc2e39 100644 --- a/htdocs/includes/phpexcel/PHPExcel/RichText/Run.php +++ b/htdocs/includes/phpexcel/PHPExcel/RichText/Run.php @@ -18,9 +18,9 @@ * * @category PHPExcel * @package PHPExcel_RichText - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -29,7 +29,7 @@ * * @category PHPExcel * @package PHPExcel_RichText - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_RichText_Run extends PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement { @@ -65,7 +65,7 @@ class PHPExcel_RichText_Run extends PHPExcel_RichText_TextElement implements PHP * Set font * * @param PHPExcel_Style_Font $pFont Font - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_RichText_ITextElement */ public function setFont(PHPExcel_Style_Font $pFont = null) { diff --git a/htdocs/includes/phpexcel/PHPExcel/RichText/TextElement.php b/htdocs/includes/phpexcel/PHPExcel/RichText/TextElement.php index 5b9edd07ee4..3593c6e19c0 100644 --- a/htdocs/includes/phpexcel/PHPExcel/RichText/TextElement.php +++ b/htdocs/includes/phpexcel/PHPExcel/RichText/TextElement.php @@ -18,9 +18,9 @@ * * @category PHPExcel * @package PHPExcel_RichText - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -29,7 +29,7 @@ * * @category PHPExcel * @package PHPExcel_RichText - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement { diff --git a/htdocs/includes/phpexcel/PHPExcel/Settings.php b/htdocs/includes/phpexcel/PHPExcel/Settings.php index 6659b90e956..b89961320e4 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Settings.php +++ b/htdocs/includes/phpexcel/PHPExcel/Settings.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,313 +20,368 @@ * * @category PHPExcel * @package PHPExcel_Settings - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.8.0, 2014-03-02 */ /** PHPExcel root directory */ if (!defined('PHPEXCEL_ROOT')) { - /** - * @ignore - */ - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../'); - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); + /** + * @ignore + */ + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../'); + require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); } class PHPExcel_Settings { - /** constants */ - /** Available Zip library classes */ - const PCLZIP = 'PHPExcel_Shared_ZipArchive'; - const ZIPARCHIVE = 'ZipArchive'; + /** constants */ + /** Available Zip library classes */ + const PCLZIP = 'PHPExcel_Shared_ZipArchive'; + const ZIPARCHIVE = 'ZipArchive'; - /** Optional Chart Rendering libraries */ - const CHART_RENDERER_JPGRAPH = 'jpgraph'; + /** Optional Chart Rendering libraries */ + const CHART_RENDERER_JPGRAPH = 'jpgraph'; - /** Optional PDF Rendering libraries */ + /** Optional PDF Rendering libraries */ const PDF_RENDERER_TCPDF = 'tcPDF'; const PDF_RENDERER_DOMPDF = 'DomPDF'; - const PDF_RENDERER_MPDF = 'mPDF'; + const PDF_RENDERER_MPDF = 'mPDF'; - private static $_chartRenderers = array( - self::CHART_RENDERER_JPGRAPH, - ); + private static $_chartRenderers = array( + self::CHART_RENDERER_JPGRAPH, + ); - private static $_pdfRenderers = array( - self::PDF_RENDERER_TCPDF, - self::PDF_RENDERER_DOMPDF, - self::PDF_RENDERER_MPDF, - ); + private static $_pdfRenderers = array( + self::PDF_RENDERER_TCPDF, + self::PDF_RENDERER_DOMPDF, + self::PDF_RENDERER_MPDF, + ); - /** - * Name of the class used for Zip file management - * e.g. - * ZipArchive - * - * @var string - */ - private static $_zipClass = self::ZIPARCHIVE; + /** + * Name of the class used for Zip file management + * e.g. + * ZipArchive + * + * @var string + */ + private static $_zipClass = self::ZIPARCHIVE; - /** - * Name of the external Library used for rendering charts - * e.g. - * jpgraph - * - * @var string - */ - private static $_chartRendererName = NULL; + /** + * Name of the external Library used for rendering charts + * e.g. + * jpgraph + * + * @var string + */ + private static $_chartRendererName = NULL; - /** - * Directory Path to the external Library used for rendering charts - * - * @var string - */ - private static $_chartRendererPath = NULL; + /** + * Directory Path to the external Library used for rendering charts + * + * @var string + */ + private static $_chartRendererPath = NULL; - /** - * Name of the external Library used for rendering PDF files - * e.g. - * mPDF - * - * @var string - */ - private static $_pdfRendererName = NULL; + /** + * Name of the external Library used for rendering PDF files + * e.g. + * mPDF + * + * @var string + */ + private static $_pdfRendererName = NULL; - /** - * Directory Path to the external Library used for rendering PDF files - * - * @var string - */ - private static $_pdfRendererPath = NULL; + /** + * Directory Path to the external Library used for rendering PDF files + * + * @var string + */ + private static $_pdfRendererPath = NULL; + + /** + * Default options for libxml loader + * + * @var int + */ + private static $_libXmlLoaderOptions = null; + + /** + * Set the Zip handler Class that PHPExcel should use for Zip file management (PCLZip or ZipArchive) + * + * @param string $zipClass The Zip handler class that PHPExcel should use for Zip file management + * e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive + * @return boolean Success or failure + */ + public static function setZipClass($zipClass) + { + if (($zipClass === self::PCLZIP) || + ($zipClass === self::ZIPARCHIVE)) { + self::$_zipClass = $zipClass; + return TRUE; + } + return FALSE; + } // function setZipClass() - /** - * Set the Zip handler Class that PHPExcel should use for Zip file management (PCLZip or ZipArchive) - * - * @param string $zipClass The Zip handler class that PHPExcel should use for Zip file management - * e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive - * @return boolean Success or failure - */ - public static function setZipClass($zipClass) { - if (($zipClass === self::PCLZIP) || - ($zipClass === self::ZIPARCHIVE)) { - self::$_zipClass = $zipClass; - return TRUE; - } - return FALSE; - } // function setZipClass() + /** + * Return the name of the Zip handler Class that PHPExcel is configured to use (PCLZip or ZipArchive) + * or Zip file management + * + * @return string Name of the Zip handler Class that PHPExcel is configured to use + * for Zip file management + * e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive + */ + public static function getZipClass() + { + return self::$_zipClass; + } // function getZipClass() - /** - * Return the name of the Zip handler Class that PHPExcel is configured to use (PCLZip or ZipArchive) - * for Zip file management - * - * @return string Name of the Zip handler Class that PHPExcel is configured to use - * for Zip file management - * e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive - */ - public static function getZipClass() { - return self::$_zipClass; - } // function getZipClass() + /** + * Return the name of the method that is currently configured for cell cacheing + * + * @return string Name of the cacheing method + */ + public static function getCacheStorageMethod() + { + return PHPExcel_CachedObjectStorageFactory::getCacheStorageMethod(); + } // function getCacheStorageMethod() - /** - * Return the name of the method that is currently configured for cell cacheing - * - * @return string Name of the cacheing method - */ - public static function getCacheStorageMethod() { - return PHPExcel_CachedObjectStorageFactory::getCacheStorageMethod(); - } // function getCacheStorageMethod() + /** + * Return the name of the class that is currently being used for cell cacheing + * + * @return string Name of the class currently being used for cacheing + */ + public static function getCacheStorageClass() + { + return PHPExcel_CachedObjectStorageFactory::getCacheStorageClass(); + } // function getCacheStorageClass() - /** - * Return the name of the class that is currently being used for cell cacheing - * - * @return string Name of the class currently being used for cacheing - */ - public static function getCacheStorageClass() { - return PHPExcel_CachedObjectStorageFactory::getCacheStorageClass(); - } // function getCacheStorageClass() + /** + * Set the method that should be used for cell cacheing + * + * @param string $method Name of the cacheing method + * @param array $arguments Optional configuration arguments for the cacheing method + * @return boolean Success or failure + */ + public static function setCacheStorageMethod( + $method = PHPExcel_CachedObjectStorageFactory::cache_in_memory, + $arguments = array() + ) + { + return PHPExcel_CachedObjectStorageFactory::initialize($method, $arguments); + } // function setCacheStorageMethod() - /** - * Set the method that should be used for cell cacheing - * - * @param string $method Name of the cacheing method - * @param array $arguments Optional configuration arguments for the cacheing method - * @return boolean Success or failure - */ - public static function setCacheStorageMethod($method = PHPExcel_CachedObjectStorageFactory::cache_in_memory, - $arguments = array()) { - return PHPExcel_CachedObjectStorageFactory::initialize($method, $arguments); - } // function setCacheStorageMethod() + /** + * Set the locale code to use for formula translations and any special formatting + * + * @param string $locale The locale code to use (e.g. "fr" or "pt_br" or "en_uk") + * @return boolean Success or failure + */ + public static function setLocale($locale='en_us') + { + return PHPExcel_Calculation::getInstance()->setLocale($locale); + } // function setLocale() - /** - * Set the locale code to use for formula translations and any special formatting - * - * @param string $locale The locale code to use (e.g. "fr" or "pt_br" or "en_uk") - * @return boolean Success or failure - */ - public static function setLocale($locale='en_us') { - return PHPExcel_Calculation::getInstance()->setLocale($locale); - } // function setLocale() + /** + * Set details of the external library that PHPExcel should use for rendering charts + * + * @param string $libraryName Internal reference name of the library + * e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH + * @param string $libraryBaseDir Directory path to the library's base folder + * + * @return boolean Success or failure + */ + public static function setChartRenderer($libraryName, $libraryBaseDir) + { + if (!self::setChartRendererName($libraryName)) + return FALSE; + return self::setChartRendererPath($libraryBaseDir); + } // function setChartRenderer() - /** - * Set details of the external library that PHPExcel should use for rendering charts - * - * @param string $libraryName Internal reference name of the library - * e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH - * @param string $libraryBaseDir Directory path to the library's base folder - * @return boolean Success or failure - */ - public static function setChartRenderer($libraryName, $libraryBaseDir) { - if (!self::setChartRendererName($libraryName)) - return FALSE; - return self::setChartRendererPath($libraryBaseDir); - } // function setChartRenderer() + /** + * Identify to PHPExcel the external library to use for rendering charts + * + * @param string $libraryName Internal reference name of the library + * e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH + * + * @return boolean Success or failure + */ + public static function setChartRendererName($libraryName) + { + if (!in_array($libraryName,self::$_chartRenderers)) { + return FALSE; + } + + self::$_chartRendererName = $libraryName; + + return TRUE; + } // function setChartRendererName() - /** - * Identify to PHPExcel the external library to use for rendering charts - * - * @param string $libraryName Internal reference name of the library - * e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH - * @return boolean Success or failure - */ - public static function setChartRendererName($libraryName) { - if (!in_array($libraryName,self::$_chartRenderers)) { - return FALSE; - } + /** + * Tell PHPExcel where to find the external library to use for rendering charts + * + * @param string $libraryBaseDir Directory path to the library's base folder + * @return boolean Success or failure + */ + public static function setChartRendererPath($libraryBaseDir) + { + if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) { + return FALSE; + } + self::$_chartRendererPath = $libraryBaseDir; - self::$_chartRendererName = $libraryName; - - return TRUE; - } // function setChartRendererName() + return TRUE; + } // function setChartRendererPath() - /** - * Tell PHPExcel where to find the external library to use for rendering charts - * - * @param string $libraryBaseDir Directory path to the library's base folder - * @return boolean Success or failure - */ - public static function setChartRendererPath($libraryBaseDir) { - if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) { - return FALSE; - } - self::$_chartRendererPath = $libraryBaseDir; - - return TRUE; - } // function setChartRendererPath() + /** + * Return the Chart Rendering Library that PHPExcel is currently configured to use (e.g. jpgraph) + * + * @return string|NULL Internal reference name of the Chart Rendering Library that PHPExcel is + * currently configured to use + * e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH + */ + public static function getChartRendererName() + { + return self::$_chartRendererName; + } // function getChartRendererName() - /** - * Return the Chart Rendering Library that PHPExcel is currently configured to use (e.g. jpgraph) - * - * @return string|NULL Internal reference name of the Chart Rendering Library that PHPExcel is - * currently configured to use - * e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH - */ - public static function getChartRendererName() { - return self::$_chartRendererName; - } // function getChartRendererName() + /** + * Return the directory path to the Chart Rendering Library that PHPExcel is currently configured to use + * + * @return string|NULL Directory Path to the Chart Rendering Library that PHPExcel is + * currently configured to use + */ + public static function getChartRendererPath() + { + return self::$_chartRendererPath; + } // function getChartRendererPath() - /** - * Return the directory path to the Chart Rendering Library that PHPExcel is currently configured to use - * - * @return string|NULL Directory Path to the Chart Rendering Library that PHPExcel is - * currently configured to use - */ - public static function getChartRendererPath() { - return self::$_chartRendererPath; - } // function getChartRendererPath() + /** + * Set details of the external library that PHPExcel should use for rendering PDF files + * + * @param string $libraryName Internal reference name of the library + * e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF, + * PHPExcel_Settings::PDF_RENDERER_DOMPDF + * or PHPExcel_Settings::PDF_RENDERER_MPDF + * @param string $libraryBaseDir Directory path to the library's base folder + * + * @return boolean Success or failure + */ + public static function setPdfRenderer($libraryName, $libraryBaseDir) + { + if (!self::setPdfRendererName($libraryName)) + return FALSE; + return self::setPdfRendererPath($libraryBaseDir); + } // function setPdfRenderer() - /** - * Set details of the external library that PHPExcel should use for rendering PDF files - * - * @param string $libraryName Internal reference name of the library - * e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF, - * PHPExcel_Settings::PDF_RENDERER_DOMPDF - * or PHPExcel_Settings::PDF_RENDERER_MPDF - * @param string $libraryBaseDir Directory path to the library's base folder - * @return boolean Success or failure - */ - public static function setPdfRenderer($libraryName, $libraryBaseDir) { - if (!self::setPdfRendererName($libraryName)) - return FALSE; - return self::setPdfRendererPath($libraryBaseDir); - } // function setPdfRenderer() + /** + * Identify to PHPExcel the external library to use for rendering PDF files + * + * @param string $libraryName Internal reference name of the library + * e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF, + * PHPExcel_Settings::PDF_RENDERER_DOMPDF + * or PHPExcel_Settings::PDF_RENDERER_MPDF + * + * @return boolean Success or failure + */ + public static function setPdfRendererName($libraryName) + { + if (!in_array($libraryName,self::$_pdfRenderers)) { + return FALSE; + } + + self::$_pdfRendererName = $libraryName; + + return TRUE; + } // function setPdfRendererName() - /** - * Identify to PHPExcel the external library to use for rendering PDF files - * - * @param string $libraryName Internal reference name of the library - * e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF, - * PHPExcel_Settings::PDF_RENDERER_DOMPDF - * or PHPExcel_Settings::PDF_RENDERER_MPDF - * @return boolean Success or failure - */ - public static function setPdfRendererName($libraryName) { - if (!in_array($libraryName,self::$_pdfRenderers)) { - return FALSE; - } + /** + * Tell PHPExcel where to find the external library to use for rendering PDF files + * + * @param string $libraryBaseDir Directory path to the library's base folder + * @return boolean Success or failure + */ + public static function setPdfRendererPath($libraryBaseDir) + { + if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) { + return FALSE; + } + self::$_pdfRendererPath = $libraryBaseDir; - self::$_pdfRendererName = $libraryName; - - return TRUE; - } // function setPdfRendererName() + return TRUE; + } // function setPdfRendererPath() - /** - * Tell PHPExcel where to find the external library to use for rendering PDF files - * - * @param string $libraryBaseDir Directory path to the library's base folder - * @return boolean Success or failure - */ - public static function setPdfRendererPath($libraryBaseDir) { - if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) { - return FALSE; - } - self::$_pdfRendererPath = $libraryBaseDir; + /** + * Return the PDF Rendering Library that PHPExcel is currently configured to use (e.g. dompdf) + * + * @return string|NULL Internal reference name of the PDF Rendering Library that PHPExcel is + * currently configured to use + * e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF, + * PHPExcel_Settings::PDF_RENDERER_DOMPDF + * or PHPExcel_Settings::PDF_RENDERER_MPDF + */ + public static function getPdfRendererName() + { + return self::$_pdfRendererName; + } // function getPdfRendererName() - return TRUE; - } // function setPdfRendererPath() + /** + * Return the directory path to the PDF Rendering Library that PHPExcel is currently configured to use + * + * @return string|NULL Directory Path to the PDF Rendering Library that PHPExcel is + * currently configured to use + */ + public static function getPdfRendererPath() + { + return self::$_pdfRendererPath; + } // function getPdfRendererPath() + /** + * Set default options for libxml loader + * + * @param int $options Default options for libxml loader + */ + public static function setLibXmlLoaderOptions($options = null) + { + if (is_null($options)) { + $options = LIBXML_DTDLOAD | LIBXML_DTDATTR; + } + @libxml_disable_entity_loader($options == (LIBXML_DTDLOAD | LIBXML_DTDATTR)); + self::$_libXmlLoaderOptions = $options; + } // function setLibXmlLoaderOptions - /** - * Return the PDF Rendering Library that PHPExcel is currently configured to use (e.g. dompdf) - * - * @return string|NULL Internal reference name of the PDF Rendering Library that PHPExcel is - * currently configured to use - * e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF, - * PHPExcel_Settings::PDF_RENDERER_DOMPDF - * or PHPExcel_Settings::PDF_RENDERER_MPDF - */ - public static function getPdfRendererName() { - return self::$_pdfRendererName; - } // function getPdfRendererName() - - - /** - * Return the directory path to the PDF Rendering Library that PHPExcel is currently configured to use - * - * @return string|NULL Directory Path to the PDF Rendering Library that PHPExcel is - * currently configured to use - */ - public static function getPdfRendererPath() { - return self::$_pdfRendererPath; - } // function getPdfRendererPath() - -} \ No newline at end of file + /** + * Get default options for libxml loader. + * Defaults to LIBXML_DTDLOAD | LIBXML_DTDATTR when not set explicitly. + * + * @return int Default options for libxml loader + */ + public static function getLibXmlLoaderOptions() + { + if (is_null(self::$_libXmlLoaderOptions)) { + self::setLibXmlLoaderOptions(LIBXML_DTDLOAD | LIBXML_DTDATTR); + } + @libxml_disable_entity_loader($options == (LIBXML_DTDLOAD | LIBXML_DTDATTR)); + return self::$_libXmlLoaderOptions; + } // function getLibXmlLoaderOptions +} diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/CodePage.php b/htdocs/includes/phpexcel/PHPExcel/Shared/CodePage.php index 5660e116ce0..2807ab37381 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/CodePage.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/CodePage.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Shared - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Shared_CodePage { @@ -39,16 +39,16 @@ class PHPExcel_Shared_CodePage * Convert Microsoft Code Page Identifier to Code Page Name which iconv * and mbstring understands * - * @param int $number Microsoft Code Page Indentifier + * @param integer $codePage Microsoft Code Page Indentifier * @return string Code Page Name - * @throws Exception + * @throws PHPExcel_Exception */ - public static function NumberToName($codePage = '1252') + public static function NumberToName($codePage = 1252) { switch ($codePage) { case 367: return 'ASCII'; break; // ASCII case 437: return 'CP437'; break; // OEM US - case 720: throw new Exception('Code page 720 not supported.'); + case 720: throw new PHPExcel_Exception('Code page 720 not supported.'); break; // OEM Arabic case 737: return 'CP737'; break; // OEM Greek case 775: return 'CP775'; break; // OEM Baltic @@ -85,17 +85,18 @@ class PHPExcel_Shared_CodePage case 10000: return 'MAC'; break; // Apple Roman case 10006: return 'MACGREEK'; break; // Macintosh Greek case 10007: return 'MACCYRILLIC'; break; // Macintosh Cyrillic + case 10008: return 'CP936'; break; // Macintosh - Simplified Chinese (GB 2312) case 10029: return 'MACCENTRALEUROPE'; break; // Macintosh Central Europe case 10079: return 'MACICELAND'; break; // Macintosh Icelandic case 10081: return 'MACTURKISH'; break; // Macintosh Turkish case 32768: return 'MAC'; break; // Apple Roman - case 32769: throw new Exception('Code page 32769 not supported.'); + case 32769: throw new PHPExcel_Exception('Code page 32769 not supported.'); break; // ANSI Latin I (BIFF2-BIFF3) case 65000: return 'UTF-7'; break; // Unicode (UTF-7) case 65001: return 'UTF-8'; break; // Unicode (UTF-8) } - throw new Exception('Unknown codepage: ' . $codePage); + throw new PHPExcel_Exception('Unknown codepage: ' . $codePage); } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/Date.php b/htdocs/includes/phpexcel/PHPExcel/Shared/Date.php index 2c1ab0088ba..7fe4f4207ef 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/Date.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/Date.php @@ -3,7 +3,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -21,9 +21,9 @@ * * @category PHPExcel * @package PHPExcel_Shared - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -32,7 +32,7 @@ * * @category PHPExcel * @package PHPExcel_Shared - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Shared_Date { @@ -58,36 +58,40 @@ class PHPExcel_Shared_Date 'Sep' => 'September', 'Oct' => 'October', 'Nov' => 'November', - 'Dec' => 'December' + 'Dec' => 'December', ); + /* + * Names of the months of the year, indexed by shortname + * Planned usage for locale settings + * + * @public + * @var string[] + */ + public static $_numberSuffixes = array( 'st', + 'nd', + 'rd', + 'th', + ); + /* * Base calendar year to use for calculations * * @private * @var int */ - private static $ExcelBaseDate = self::CALENDAR_WINDOWS_1900; - - /* - * Object type for PHP Date/Time values - * - * @private - * @var string - */ - public static $dateTimeObjectType = 'DateTime'; - + protected static $_excelBaseDate = self::CALENDAR_WINDOWS_1900; /** * Set the Excel calendar (Windows 1900 or Mac 1904) * - * @param integer $baseDate Excel base date + * @param integer $baseDate Excel base date (1900 or 1904) * @return boolean Success or failure */ public static function setExcelCalendar($baseDate) { if (($baseDate == self::CALENDAR_WINDOWS_1900) || ($baseDate == self::CALENDAR_MAC_1904)) { - self::$ExcelBaseDate = $baseDate; + self::$_excelBaseDate = $baseDate; return TRUE; } return FALSE; @@ -97,33 +101,36 @@ class PHPExcel_Shared_Date /** * Return the Excel calendar (Windows 1900 or Mac 1904) * - * @return integer $baseDate Excel base date + * @return integer Excel base date (1900 or 1904) */ public static function getExcelCalendar() { - return self::$ExcelBaseDate; + return self::$_excelBaseDate; } // function getExcelCalendar() /** - * Convert a date from Excel to PHP + * Convert a date from Excel to PHP * - * @param long $dateValue Excel date/time value - * @return long PHP serialized date/time + * @param long $dateValue Excel date/time value + * @param boolean $adjustToTimezone Flag indicating whether $dateValue should be treated as + * a UST timestamp, or adjusted to UST + * @param string $timezone The timezone for finding the adjustment from UST + * @return long PHP serialized date/time */ - public static function ExcelToPHP($dateValue = 0) { - if (self::$ExcelBaseDate == self::CALENDAR_WINDOWS_1900) { - $myExcelBaseDate = 25569; + public static function ExcelToPHP($dateValue = 0, $adjustToTimezone = FALSE, $timezone = NULL) { + if (self::$_excelBaseDate == self::CALENDAR_WINDOWS_1900) { + $my_excelBaseDate = 25569; // Adjust for the spurious 29-Feb-1900 (Day 60) if ($dateValue < 60) { - --$myExcelBaseDate; + --$my_excelBaseDate; } } else { - $myExcelBaseDate = 24107; + $my_excelBaseDate = 24107; } // Perform conversion if ($dateValue >= 1) { - $utcDays = $dateValue - $myExcelBaseDate; + $utcDays = $dateValue - $my_excelBaseDate; $returnValue = round($utcDays * 86400); if (($returnValue <= PHP_INT_MAX) && ($returnValue >= -PHP_INT_MAX)) { $returnValue = (integer) $returnValue; @@ -135,16 +142,20 @@ class PHPExcel_Shared_Date $returnValue = (integer) gmmktime($hours, $mins, $secs); } + $timezoneAdjustment = ($adjustToTimezone) ? + PHPExcel_Shared_TimeZone::getTimezoneAdjustment($timezone, $returnValue) : + 0; + // Return - return $returnValue; + return $returnValue + $timezoneAdjustment; } // function ExcelToPHP() /** * Convert a date from Excel to a PHP Date/Time object * - * @param long $dateValue Excel date/time value - * @return long PHP date/time object + * @param integer $dateValue Excel date/time value + * @return integer PHP date/time object */ public static function ExcelToPHPObject($dateValue = 0) { $dateTime = self::ExcelToPHP($dateValue); @@ -162,17 +173,20 @@ class PHPExcel_Shared_Date /** - * Convert a date from PHP to Excel + * Convert a date from PHP to Excel * - * @param mixed $dateValue PHP serialized date/time or date object - * @return mixed Excel date/time value - * or boolean FALSE on failure + * @param mixed $dateValue PHP serialized date/time or date object + * @param boolean $adjustToTimezone Flag indicating whether $dateValue should be treated as + * a UST timestamp, or adjusted to UST + * @param string $timezone The timezone for finding the adjustment from UST + * @return mixed Excel date/time value + * or boolean FALSE on failure */ - public static function PHPToExcel($dateValue = 0) { + public static function PHPToExcel($dateValue = 0, $adjustToTimezone = FALSE, $timezone = NULL) { $saveTimeZone = date_default_timezone_get(); date_default_timezone_set('UTC'); $retValue = FALSE; - if ((is_object($dateValue)) && ($dateValue instanceof self::$dateTimeObjectType)) { + if ((is_object($dateValue)) && ($dateValue instanceof DateTime)) { $retValue = self::FormattedPHPToExcel( $dateValue->format('Y'), $dateValue->format('m'), $dateValue->format('d'), $dateValue->format('H'), $dateValue->format('i'), $dateValue->format('s') ); @@ -199,16 +213,16 @@ class PHPExcel_Shared_Date * @return long Excel date/time value */ public static function FormattedPHPToExcel($year, $month, $day, $hours=0, $minutes=0, $seconds=0) { - if (self::$ExcelBaseDate == self::CALENDAR_WINDOWS_1900) { + if (self::$_excelBaseDate == self::CALENDAR_WINDOWS_1900) { // // Fudge factor for the erroneous fact that the year 1900 is treated as a Leap Year in MS Excel // This affects every date following 28th February 1900 // $excel1900isLeapYear = TRUE; if (($year == 1900) && ($month <= 2)) { $excel1900isLeapYear = FALSE; } - $myExcelBaseDate = 2415020; + $my_excelBaseDate = 2415020; } else { - $myExcelBaseDate = 2416481; + $my_excelBaseDate = 2416481; $excel1900isLeapYear = FALSE; } @@ -223,7 +237,7 @@ class PHPExcel_Shared_Date // Calculate the Julian Date, then subtract the Excel base date (JD 2415020 = 31-Dec-1899 Giving Excel Date of 0) $century = substr($year,0,2); $decade = substr($year,2,2); - $excelDate = floor((146097 * $century) / 4) + floor((1461 * $decade) / 4) + floor((153 * $month + 2) / 5) + $day + 1721119 - $myExcelBaseDate + $excel1900isLeapYear; + $excelDate = floor((146097 * $century) / 4) + floor((1461 * $decade) / 4) + floor((153 * $month + 2) / 5) + $day + 1721119 - $my_excelBaseDate + $excel1900isLeapYear; $excelTime = (($hours * 3600) + ($minutes * 60) + $seconds) / 86400; @@ -239,7 +253,7 @@ class PHPExcel_Shared_Date */ public static function isDateTime(PHPExcel_Cell $pCell) { return self::isDateTimeFormat( - $pCell->getParent()->getStyle( + $pCell->getWorksheet()->getStyle( $pCell->getCoordinate() )->getNumberFormat() ); @@ -266,11 +280,14 @@ class PHPExcel_Shared_Date * @return boolean */ public static function isDateTimeFormatCode($pFormatCode = '') { + if (strtolower($pFormatCode) === strtolower(PHPExcel_Style_NumberFormat::FORMAT_GENERAL)) + // "General" contains an epoch letter 'e', so we trap for it explicitly here (case-insensitive check) + return FALSE; + if (preg_match('/[0#]E[+-]0/i', $pFormatCode)) + // Scientific format + return FALSE; // Switch on formatcode switch ($pFormatCode) { - // General contains an epoch letter 'e', so we trap for it explicitly here - case PHPExcel_Style_NumberFormat::FORMAT_GENERAL: - return FALSE; // Explicitly defined date formats case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD: case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2: @@ -306,10 +323,11 @@ class PHPExcel_Shared_Date // We might also have a format mask containing quoted strings... // we don't want to test for any of our characters within the quoted blocks if (strpos($pFormatCode,'"') !== FALSE) { - $i = FALSE; + $segMatcher = FALSE; foreach(explode('"',$pFormatCode) as $subVal) { // Only test in alternate array entries (the non-quoted blocks) - if (($i = !$i) && (preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i',$subVal))) { + if (($segMatcher = !$segMatcher) && + (preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i',$subVal))) { return TRUE; } } @@ -353,4 +371,23 @@ class PHPExcel_Shared_Date } + public static function monthStringToNumber($month) { + $monthIndex = 1; + foreach(self::$_monthNames as $shortMonthName => $longMonthName) { + if (($month === $longMonthName) || ($month === $shortMonthName)) { + return $monthIndex; + } + ++$monthIndex; + } + return $month; + } + + public static function dayStringToNumber($day) { + $strippedDayValue = (str_replace(self::$_numberSuffixes,'',$day)); + if (is_numeric($strippedDayValue)) { + return $strippedDayValue; + } + return $day; + } + } diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/Drawing.php b/htdocs/includes/phpexcel/PHPExcel/Shared/Drawing.php index 9401000dd8a..1d7af16bdc5 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/Drawing.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/Drawing.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Shared - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Shared_Drawing { diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/Escher.php b/htdocs/includes/phpexcel/PHPExcel/Shared/Escher.php index ecd8216aa4c..983cbdaa029 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/Escher.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/Escher.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared_Escher - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ /** @@ -30,7 +30,7 @@ * * @category PHPExcel * @package PHPExcel_Shared_Escher - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Shared_Escher { diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DgContainer.php b/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DgContainer.php index adbe429dbbc..3ec564c5663 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DgContainer.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DgContainer.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared_Escher - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ /** @@ -30,7 +30,7 @@ * * @category PHPExcel * @package PHPExcel_Shared_Escher - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Shared_Escher_DgContainer { diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DgContainer/SpgrContainer.php b/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DgContainer/SpgrContainer.php index ea0235e8bfa..651eaf0eef5 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DgContainer/SpgrContainer.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DgContainer/SpgrContainer.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared_Escher - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ /** @@ -30,7 +30,7 @@ * * @category PHPExcel * @package PHPExcel_Shared_Escher - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer { diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php b/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php index cb4988c8494..dde115401ca 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared_Escher - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ /** @@ -30,7 +30,7 @@ * * @category PHPExcel * @package PHPExcel_Shared_Escher - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer { diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DggContainer.php b/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DggContainer.php index 4fddbdf3fd6..bf5f61f266c 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DggContainer.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DggContainer.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared_Escher - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ /** @@ -30,7 +30,7 @@ * * @category PHPExcel * @package PHPExcel_Shared_Escher - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Shared_Escher_DggContainer { diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php b/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php index 428c76e6a41..d16bfc76e8c 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared_Escher - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ /** @@ -30,7 +30,7 @@ * * @category PHPExcel * @package PHPExcel_Shared_Escher - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer { diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php b/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php index 1f10ae1767d..ea3c52a3772 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared_Escher - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ /** @@ -30,7 +30,7 @@ * * @category PHPExcel * @package PHPExcel_Shared_Escher - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE { diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php b/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php index 0d28a6bf561..802ce6d943e 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared_Escher - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ /** @@ -30,7 +30,7 @@ * * @category PHPExcel * @package PHPExcel_Shared_Escher - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip { diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/Excel5.php b/htdocs/includes/phpexcel/PHPExcel/Shared/Excel5.php index 629f621c8e3..927dace9aca 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/Excel5.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/Excel5.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ /** @@ -30,7 +30,7 @@ * * @category PHPExcel * @package PHPExcel_Shared - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Shared_Excel5 { @@ -40,7 +40,7 @@ class PHPExcel_Shared_Excel5 * This holds for Arial 10 * * @param PHPExcel_Worksheet $sheet The sheet - * @param integer $col The column + * @param string $col The column * @return integer The width in pixels */ public static function sizeCol($sheet, $col = 'A') @@ -136,9 +136,9 @@ class PHPExcel_Shared_Excel5 * * @param PHPExcel_Worksheet $sheet * @param string $startColumn - * @param integer $startOffset Offset within start cell measured in 1/1024 of the cell width + * @param integer $startOffsetX Offset within start cell measured in 1/1024 of the cell width * @param string $endColumn - * @param integer $endOffset Offset within end cell measured in 1/1024 of the cell width + * @param integer $endOffsetX Offset within end cell measured in 1/1024 of the cell width * @return integer Horizontal measured in pixels */ public static function getDistanceX(PHPExcel_Worksheet $sheet, $startColumn = 'A', $startOffsetX = 0, $endColumn = 'A', $endOffsetX = 0) @@ -166,10 +166,10 @@ class PHPExcel_Shared_Excel5 * The distanceY is found as sum of all the spanning rows minus two offsets * * @param PHPExcel_Worksheet $sheet - * @param string $startRow (1-based) - * @param integer $startOffset Offset within start cell measured in 1/256 of the cell height - * @param string $endRow (1-based) - * @param integer $endOffset Offset within end cell measured in 1/256 of the cell height + * @param integer $startRow (1-based) + * @param integer $startOffsetY Offset within start cell measured in 1/256 of the cell height + * @param integer $endRow (1-based) + * @param integer $endOffsetY Offset within end cell measured in 1/256 of the cell height * @return integer Vertical distance measured in pixels */ public static function getDistanceY(PHPExcel_Worksheet $sheet, $startRow = 1, $startOffsetY = 0, $endRow = 1, $endOffsetY = 0) diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/File.php b/htdocs/includes/phpexcel/PHPExcel/Shared/File.php index 575ac3cd22c..70756a0446a 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/File.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/File.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,10 +31,39 @@ * * @category PHPExcel * @package PHPExcel_Shared - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Shared_File { + /* + * Use Temp or File Upload Temp for temporary files + * + * @protected + * @var boolean + */ + protected static $_useUploadTempDirectory = FALSE; + + + /** + * Set the flag indicating whether the File Upload Temp directory should be used for temporary files + * + * @param boolean $useUploadTempDir Use File Upload Temporary directory (true or false) + */ + public static function setUseUploadTempDirectory($useUploadTempDir = FALSE) { + self::$_useUploadTempDirectory = (boolean) $useUploadTempDir; + } // function setUseUploadTempDirectory() + + + /** + * Get the flag indicating whether the File Upload Temp directory should be used for temporary files + * + * @return boolean Use File Upload Temporary directory (true or false) + */ + public static function getUseUploadTempDirectory() { + return self::$_useUploadTempDirectory; + } // function getUseUploadTempDirectory() + + /** * Verify if a file exists * @@ -105,9 +134,19 @@ class PHPExcel_Shared_File */ public static function sys_get_temp_dir() { + if (self::$_useUploadTempDirectory) { + // use upload-directory when defined to allow running on environments having very restricted + // open_basedir configs + if (ini_get('upload_tmp_dir') !== FALSE) { + if ($temp = ini_get('upload_tmp_dir')) { + if (file_exists($temp)) + return realpath($temp); + } + } + } + // sys_get_temp_dir is only available since PHP 5.2.1 // http://php.net/manual/en/function.sys-get-temp-dir.php#94119 - if ( !function_exists('sys_get_temp_dir')) { if ($temp = getenv('TMP') ) { if ((!empty($temp)) && (file_exists($temp))) { return realpath($temp); } diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/Font.php b/htdocs/includes/phpexcel/PHPExcel/Shared/Font.php index 3d0662e8830..203d4ecb4e3 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/Font.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/Font.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Shared - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Shared_Font { @@ -244,11 +244,11 @@ class PHPExcel_Shared_Font /** * Calculate an (approximate) OpenXML column width, based on font size and text contained * - * @param int $fontSize Font size (in pixels or points) - * @param bool $fontSizeInPixels Is the font size specified in pixels (true) or in points (false) ? - * @param string $cellText Text to calculate width - * @param int $rotation Rotation angle - * @return int Column width + * @param PHPExcel_Style_Font $font Font object + * @param PHPExcel_RichText|string $cellText Text to calculate width + * @param integer $rotation Rotation angle + * @param PHPExcel_Style_Font|NULL $defaultFont Font object + * @return integer Column width */ public static function calculateColumnWidth(PHPExcel_Style_Font $font, $cellText = '', $rotation = 0, PHPExcel_Style_Font $defaultFont = null) { @@ -271,7 +271,7 @@ class PHPExcel_Shared_Font try { // If autosize method is set to 'approx', use approximation if (self::$autoSizeMethod == self::AUTOSIZE_METHOD_APPROX) { - throw new Exception('AutoSize method is set to approx'); + throw new PHPExcel_Exception('AutoSize method is set to approx'); } // Width of text in pixels excl. padding @@ -280,7 +280,7 @@ class PHPExcel_Shared_Font // Excel adds some padding, use 1.07 of the width of an 'n' glyph $columnWidth += ceil(self::getTextWidthPixelsExact('0', $font, 0) * 1.07); // pixels incl. padding - } catch (Exception $e) { + } catch (PHPExcel_Exception $e) { // Width of text in pixels excl. padding, approximation $columnWidth = self::getTextWidthPixelsApprox($cellText, $font, $rotation); @@ -302,11 +302,11 @@ class PHPExcel_Shared_Font * @param PHPExcel_Style_Font * @param int $rotation * @return int - * @throws Exception + * @throws PHPExcel_Exception */ public static function getTextWidthPixelsExact($text, PHPExcel_Style_Font $font, $rotation = 0) { if (!function_exists('imagettfbbox')) { - throw new Exception('GD library needs to be enabled'); + throw new PHPExcel_Exception('GD library needs to be enabled'); } // font size should really be supplied in pixels in GD2, @@ -425,7 +425,7 @@ class PHPExcel_Shared_Font */ public static function getTrueTypeFontFileFromFont($font) { if (!file_exists(self::$trueTypeFontPath) || !is_dir(self::$trueTypeFontPath)) { - throw new Exception('Valid directory to TrueType Font files not specified'); + throw new PHPExcel_Exception('Valid directory to TrueType Font files not specified'); } $name = $font->getName(); @@ -530,7 +530,7 @@ class PHPExcel_Shared_Font break; default: - throw new Exception('Unknown font name "'. $name .'". Cannot map to TrueType font file'); + throw new PHPExcel_Exception('Unknown font name "'. $name .'". Cannot map to TrueType font file'); break; } @@ -538,7 +538,7 @@ class PHPExcel_Shared_Font // Check if file actually exists if (!file_exists($fontFile)) { - throw New Exception('TrueType Font file not found'); + throw New PHPExcel_Exception('TrueType Font file not found'); } return $fontFile; diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/CholeskyDecomposition.php b/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/CholeskyDecomposition.php index 9d064f9e63a..cfbaa53bc8d 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/CholeskyDecomposition.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/CholeskyDecomposition.php @@ -73,7 +73,7 @@ class CholeskyDecomposition { } } } else { - throw new Exception(JAMAError(ArgumentTypeException)); + throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException)); } } // function __construct() @@ -136,13 +136,13 @@ class CholeskyDecomposition { return new Matrix($X, $this->m, $nx); } else { - throw new Exception(JAMAError(MatrixSPDException)); + throw new PHPExcel_Calculation_Exception(JAMAError(MatrixSPDException)); } } else { - throw new Exception(JAMAError(MatrixDimensionException)); + throw new PHPExcel_Calculation_Exception(JAMAError(MatrixDimensionException)); } } else { - throw new Exception(JAMAError(ArgumentTypeException)); + throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException)); } } // function solve() diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/LUDecomposition.php b/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/LUDecomposition.php index 6c797a6ce00..08e500cf75a 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/LUDecomposition.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/LUDecomposition.php @@ -115,7 +115,7 @@ class PHPExcel_Shared_JAMA_LUDecomposition { } } } else { - throw new Exception(PHPExcel_Shared_JAMA_Matrix::ArgumentTypeException); + throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::ArgumentTypeException); } } // function __construct() @@ -208,7 +208,7 @@ class PHPExcel_Shared_JAMA_LUDecomposition { } return $d; } else { - throw new Exception(PHPExcel_Shared_JAMA_Matrix::MatrixDimensionException); + throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::MatrixDimensionException); } } // function det() @@ -218,8 +218,8 @@ class PHPExcel_Shared_JAMA_LUDecomposition { * * @param $B A Matrix with as many rows as A and any number of columns. * @return X so that L*U*X = B(piv,:) - * @exception IllegalArgumentException Matrix row dimensions must agree. - * @exception RuntimeException Matrix is singular. + * @PHPExcel_Calculation_Exception IllegalArgumentException Matrix row dimensions must agree. + * @PHPExcel_Calculation_Exception RuntimeException Matrix is singular. */ public function solve($B) { if ($B->getRowDimension() == $this->m) { @@ -248,10 +248,10 @@ class PHPExcel_Shared_JAMA_LUDecomposition { } return $X; } else { - throw new Exception(self::MatrixSingularException); + throw new PHPExcel_Calculation_Exception(self::MatrixSingularException); } } else { - throw new Exception(self::MatrixSquareException); + throw new PHPExcel_Calculation_Exception(self::MatrixSquareException); } } // function solve() diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/Matrix.php b/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/Matrix.php index aae40e4c57a..b893a447a8e 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/Matrix.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/Matrix.php @@ -102,15 +102,15 @@ class PHPExcel_Shared_JAMA_Matrix { } } } else { - throw new Exception(self::ArrayLengthException); + throw new PHPExcel_Calculation_Exception(self::ArrayLengthException); } break; default: - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); break; } } else { - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); } } // function __construct() @@ -177,8 +177,8 @@ class PHPExcel_Shared_JAMA_Matrix { //A($i0...; $j0...) case 'integer,integer': list($i0, $j0) = $args; - if ($i0 >= 0) { $m = $this->m - $i0; } else { throw new Exception(self::ArgumentBoundsException); } - if ($j0 >= 0) { $n = $this->n - $j0; } else { throw new Exception(self::ArgumentBoundsException); } + if ($i0 >= 0) { $m = $this->m - $i0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } + if ($j0 >= 0) { $n = $this->n - $j0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } $R = new PHPExcel_Shared_JAMA_Matrix($m, $n); for($i = $i0; $i < $this->m; ++$i) { for($j = $j0; $j < $this->n; ++$j) { @@ -190,8 +190,8 @@ class PHPExcel_Shared_JAMA_Matrix { //A($i0...$iF; $j0...$jF) case 'integer,integer,integer,integer': list($i0, $iF, $j0, $jF) = $args; - if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) { $m = $iF - $i0; } else { throw new Exception(self::ArgumentBoundsException); } - if (($jF > $j0) && ($this->n >= $jF) && ($j0 >= 0)) { $n = $jF - $j0; } else { throw new Exception(self::ArgumentBoundsException); } + if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) { $m = $iF - $i0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } + if (($jF > $j0) && ($this->n >= $jF) && ($j0 >= 0)) { $n = $jF - $j0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } $R = new PHPExcel_Shared_JAMA_Matrix($m+1, $n+1); for($i = $i0; $i <= $iF; ++$i) { for($j = $j0; $j <= $jF; ++$j) { @@ -203,8 +203,8 @@ class PHPExcel_Shared_JAMA_Matrix { //$R = array of row indices; $C = array of column indices case 'array,array': list($RL, $CL) = $args; - if (count($RL) > 0) { $m = count($RL); } else { throw new Exception(self::ArgumentBoundsException); } - if (count($CL) > 0) { $n = count($CL); } else { throw new Exception(self::ArgumentBoundsException); } + if (count($RL) > 0) { $m = count($RL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } + if (count($CL) > 0) { $n = count($CL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } $R = new PHPExcel_Shared_JAMA_Matrix($m, $n); for($i = 0; $i < $m; ++$i) { for($j = 0; $j < $n; ++$j) { @@ -216,8 +216,8 @@ class PHPExcel_Shared_JAMA_Matrix { //$RL = array of row indices; $CL = array of column indices case 'array,array': list($RL, $CL) = $args; - if (count($RL) > 0) { $m = count($RL); } else { throw new Exception(self::ArgumentBoundsException); } - if (count($CL) > 0) { $n = count($CL); } else { throw new Exception(self::ArgumentBoundsException); } + if (count($RL) > 0) { $m = count($RL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } + if (count($CL) > 0) { $n = count($CL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } $R = new PHPExcel_Shared_JAMA_Matrix($m, $n); for($i = 0; $i < $m; ++$i) { for($j = 0; $j < $n; ++$j) { @@ -229,8 +229,8 @@ class PHPExcel_Shared_JAMA_Matrix { //A($i0...$iF); $CL = array of column indices case 'integer,integer,array': list($i0, $iF, $CL) = $args; - if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) { $m = $iF - $i0; } else { throw new Exception(self::ArgumentBoundsException); } - if (count($CL) > 0) { $n = count($CL); } else { throw new Exception(self::ArgumentBoundsException); } + if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) { $m = $iF - $i0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } + if (count($CL) > 0) { $n = count($CL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } $R = new PHPExcel_Shared_JAMA_Matrix($m, $n); for($i = $i0; $i < $iF; ++$i) { for($j = 0; $j < $n; ++$j) { @@ -242,8 +242,8 @@ class PHPExcel_Shared_JAMA_Matrix { //$RL = array of row indices case 'array,integer,integer': list($RL, $j0, $jF) = $args; - if (count($RL) > 0) { $m = count($RL); } else { throw new Exception(self::ArgumentBoundsException); } - if (($jF >= $j0) && ($this->n >= $jF) && ($j0 >= 0)) { $n = $jF - $j0; } else { throw new Exception(self::ArgumentBoundsException); } + if (count($RL) > 0) { $m = count($RL); } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } + if (($jF >= $j0) && ($this->n >= $jF) && ($j0 >= 0)) { $n = $jF - $j0; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentBoundsException); } $R = new PHPExcel_Shared_JAMA_Matrix($m, $n+1); for($i = 0; $i < $m; ++$i) { for($j = $j0; $j <= $jF; ++$j) { @@ -253,11 +253,11 @@ class PHPExcel_Shared_JAMA_Matrix { return $R; break; default: - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); break; } } else { - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); } } // function getMatrix() @@ -274,10 +274,10 @@ class PHPExcel_Shared_JAMA_Matrix { if (($this->m == $B->getRowDimension()) && ($this->n == $B->getColumnDimension())) { return true; } else { - throw new Exception(self::MatrixDimensionException); + throw new PHPExcel_Calculation_Exception(self::MatrixDimensionException); } } else { - throw new Exception(self::ArgumentTypeException); + throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } } // function checkMatrixDimensions() @@ -345,7 +345,7 @@ class PHPExcel_Shared_JAMA_Matrix { return $this->getMatrix($i0, 0, $i0 + 1, $this->n); } } else { - throw new Exception(self::ArgumentTypeException); + throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } } // function getMatrixByRow() @@ -366,7 +366,7 @@ class PHPExcel_Shared_JAMA_Matrix { return $this->getMatrix(0, $j0, $this->m, $j0 + 1); } } else { - throw new Exception(self::ArgumentTypeException); + throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } } // function getMatrixByCol() @@ -428,13 +428,13 @@ class PHPExcel_Shared_JAMA_Matrix { switch($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); } + if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } break; case 'array': $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); break; default: - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); break; } $this->checkMatrixDimensions($M); @@ -445,7 +445,7 @@ class PHPExcel_Shared_JAMA_Matrix { } return $M; } else { - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); } } // function plus() @@ -464,13 +464,13 @@ class PHPExcel_Shared_JAMA_Matrix { switch($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); } + if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } break; case 'array': $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); break; default: - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); break; } $this->checkMatrixDimensions($M); @@ -495,7 +495,7 @@ class PHPExcel_Shared_JAMA_Matrix { } return $this; } else { - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); } } // function plusEquals() @@ -514,13 +514,13 @@ class PHPExcel_Shared_JAMA_Matrix { switch($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); } + if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } break; case 'array': $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); break; default: - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); break; } $this->checkMatrixDimensions($M); @@ -531,7 +531,7 @@ class PHPExcel_Shared_JAMA_Matrix { } return $M; } else { - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); } } // function minus() @@ -550,13 +550,13 @@ class PHPExcel_Shared_JAMA_Matrix { switch($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); } + if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } break; case 'array': $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); break; default: - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); break; } $this->checkMatrixDimensions($M); @@ -581,7 +581,7 @@ class PHPExcel_Shared_JAMA_Matrix { } return $this; } else { - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); } } // function minusEquals() @@ -601,13 +601,13 @@ class PHPExcel_Shared_JAMA_Matrix { switch($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); } + if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } break; case 'array': $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); break; default: - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); break; } $this->checkMatrixDimensions($M); @@ -618,7 +618,7 @@ class PHPExcel_Shared_JAMA_Matrix { } return $M; } else { - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); } } // function arrayTimes() @@ -638,13 +638,13 @@ class PHPExcel_Shared_JAMA_Matrix { switch($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); } + if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } break; case 'array': $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); break; default: - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); break; } $this->checkMatrixDimensions($M); @@ -669,7 +669,7 @@ class PHPExcel_Shared_JAMA_Matrix { } return $this; } else { - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); } } // function arrayTimesEquals() @@ -689,13 +689,13 @@ class PHPExcel_Shared_JAMA_Matrix { switch($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); } + if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } break; case 'array': $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); break; default: - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); break; } $this->checkMatrixDimensions($M); @@ -725,7 +725,7 @@ class PHPExcel_Shared_JAMA_Matrix { } return $M; } else { - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); } } // function arrayRightDivide() @@ -745,13 +745,13 @@ class PHPExcel_Shared_JAMA_Matrix { switch($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); } + if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } break; case 'array': $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); break; default: - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); break; } $this->checkMatrixDimensions($M); @@ -762,7 +762,7 @@ class PHPExcel_Shared_JAMA_Matrix { } return $M; } else { - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); } } // function arrayRightDivideEquals() @@ -782,13 +782,13 @@ class PHPExcel_Shared_JAMA_Matrix { switch($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); } + if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } break; case 'array': $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); break; default: - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); break; } $this->checkMatrixDimensions($M); @@ -799,7 +799,7 @@ class PHPExcel_Shared_JAMA_Matrix { } return $M; } else { - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); } } // function arrayLeftDivide() @@ -819,13 +819,13 @@ class PHPExcel_Shared_JAMA_Matrix { switch($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); } + if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } break; case 'array': $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); break; default: - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); break; } $this->checkMatrixDimensions($M); @@ -836,7 +836,7 @@ class PHPExcel_Shared_JAMA_Matrix { } return $M; } else { - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); } } // function arrayLeftDivideEquals() @@ -855,7 +855,7 @@ class PHPExcel_Shared_JAMA_Matrix { switch($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $B = $args[0]; } else { throw new Exception(self::ArgumentTypeException); } + if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $B = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } if ($this->n == $B->m) { $C = new PHPExcel_Shared_JAMA_Matrix($this->m, $B->n); for($j = 0; $j < $B->n; ++$j) { @@ -873,7 +873,7 @@ class PHPExcel_Shared_JAMA_Matrix { } return $C; } else { - throw new Exception(JAMAError(MatrixDimensionMismatch)); + throw new PHPExcel_Calculation_Exception(JAMAError(MatrixDimensionMismatch)); } break; case 'array': @@ -891,7 +891,7 @@ class PHPExcel_Shared_JAMA_Matrix { } return $C; } else { - throw new Exception(JAMAError(MatrixDimensionMismatch)); + throw new PHPExcel_Calculation_Exception(JAMAError(MatrixDimensionMismatch)); } return $M; break; @@ -923,11 +923,11 @@ class PHPExcel_Shared_JAMA_Matrix { return $C; break; default: - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); break; } } else { - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); } } // function times() @@ -946,13 +946,13 @@ class PHPExcel_Shared_JAMA_Matrix { switch($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); } + if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } break; case 'array': $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); break; default: - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); break; } $this->checkMatrixDimensions($M); @@ -977,7 +977,7 @@ class PHPExcel_Shared_JAMA_Matrix { } return $this; } else { - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); } } // function power() @@ -996,12 +996,12 @@ class PHPExcel_Shared_JAMA_Matrix { switch($match) { case 'object': - if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); } + if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException); } case 'array': $M = new PHPExcel_Shared_JAMA_Matrix($args[0]); break; default: - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); break; } $this->checkMatrixDimensions($M); @@ -1012,7 +1012,7 @@ class PHPExcel_Shared_JAMA_Matrix { } return $this; } else { - throw new Exception(self::PolymorphicArgumentException); + throw new PHPExcel_Calculation_Exception(self::PolymorphicArgumentException); } } // function concat() diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/QRDecomposition.php b/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/QRDecomposition.php index 49293d7eca7..7538462987d 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/QRDecomposition.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/QRDecomposition.php @@ -88,7 +88,7 @@ class PHPExcel_Shared_JAMA_QRDecomposition { $this->Rdiag[$k] = -$nrm; } } else { - throw new Exception(PHPExcel_Shared_JAMA_Matrix::ArgumentTypeException); + throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::ArgumentTypeException); } } // function __construct() @@ -224,10 +224,10 @@ class PHPExcel_Shared_JAMA_QRDecomposition { $X = new PHPExcel_Shared_JAMA_Matrix($X); return ($X->getMatrix(0, $this->n-1, 0, $nx)); } else { - throw new Exception(self::MatrixRankException); + throw new PHPExcel_Calculation_Exception(self::MatrixRankException); } } else { - throw new Exception(PHPExcel_Shared_JAMA_Matrix::MatrixDimensionException); + throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::MatrixDimensionException); } } // function solve() diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/LMQuadTest.php b/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/LMQuadTest.php deleted file mode 100644 index 2f316de9730..00000000000 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/LMQuadTest.php +++ /dev/null @@ -1,116 +0,0 @@ -val($x[$i], $a); - print("Quad ".$c.",".$r." -> ".$y[$i]."
"); - $s[$i] = 1.; - ++$i; - } - } - print("quad x= "); - - $qx = new Matrix($x); - $qx->print(10, 2); - - print("quad y= "); - $qy = new Matrix($y, $npts); - $qy->print(10, 2); - - $o[0] = $x; - $o[1] = $a; - $o[2] = $y; - $o[3] = $s; - - return $o; - } // function testdata() - -} // class LMQuadTest diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/LagrangeInterpolation.php b/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/LagrangeInterpolation.php deleted file mode 100644 index 5b742861350..00000000000 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/LagrangeInterpolation.php +++ /dev/null @@ -1,59 +0,0 @@ -solve($b); - - return $s->getRowPackedCopy(); - } // function findPolynomialFactors() - -} // class LagrangeInterpolation - - -$x = array(2.0, 1.0, 3.0); -$y = array(3.0, 4.0, 7.0); - -$li = new LagrangeInterpolation; -$f = $li->findPolynomialFactors($x, $y); - - -for ($i = 0; $i < 3; ++$i) { - echo $f[$i]."
"; -} diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/LagrangeInterpolation2.php b/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/LagrangeInterpolation2.php deleted file mode 100644 index e7529c5f162..00000000000 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/LagrangeInterpolation2.php +++ /dev/null @@ -1,59 +0,0 @@ -solve($b); - - return $s->getRowPackedCopy(); - } // function findPolynomialFactors() - -} // class LagrangeInterpolation - - -$x = array(2.0, 1.0, 3.0); -$y = array(3.0, 4.0, 7.0); - -$li = new LagrangeInterpolation; -$f = $li->findPolynomialFactors($x, $y); - -for ($i = 0; $i < 3; ++$i) { - echo $f[$i]."
"; -} diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/LevenbergMarquardt.php b/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/LevenbergMarquardt.php deleted file mode 100644 index 7cfd5f89976..00000000000 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/LevenbergMarquardt.php +++ /dev/null @@ -1,185 +0,0 @@ -val($x[$i], $a); - $d = $d / $s[$i]; - $sum = $sum + ($d*$d); - } - - return $sum; - } // function chiSquared() - - - /** - * Minimize E = sum {(y[k] - f(x[k],a)) / s[k]}^2 - * The individual errors are optionally scaled by s[k]. - * Note that LMfunc implements the value and gradient of f(x,a), - * NOT the value and gradient of E with respect to a! - * - * @param x array of domain points, each may be multidimensional - * @param y corresponding array of values - * @param a the parameters/state of the model - * @param vary false to indicate the corresponding a[k] is to be held fixed - * @param s2 sigma^2 for point i - * @param lambda blend between steepest descent (lambda high) and - * jump to bottom of quadratic (lambda zero). - * Start with 0.001. - * @param termepsilon termination accuracy (0.01) - * @param maxiter stop and return after this many iterations if not done - * @param verbose set to zero (no prints), 1, 2 - * - * @return the new lambda for future iterations. - * Can use this and maxiter to interleave the LM descent with some other - * task, setting maxiter to something small. - */ - function solve($x, $a, $y, $s, $vary, $f, $lambda, $termepsilon, $maxiter, $verbose) { - $npts = count($y); - $nparm = count($a); - - if ($verbose > 0) { - print("solve x[".count($x)."][".count($x[0])."]"); - print(" a[".count($a)."]"); - println(" y[".count(length)."]"); - } - - $e0 = $this->chiSquared($x, $a, $y, $s, $f); - - //double lambda = 0.001; - $done = false; - - // g = gradient, H = hessian, d = step to minimum - // H d = -g, solve for d - $H = array(); - $g = array(); - - //double[] d = new double[nparm]; - - $oos2 = array(); - - for($i = 0; $i < $npts; ++$i) { - $oos2[$i] = 1./($s[$i]*$s[$i]); - } - $iter = 0; - $term = 0; // termination count test - - do { - ++$iter; - - // hessian approximation - for( $r = 0; $r < $nparm; ++$r) { - for( $c = 0; $c < $nparm; ++$c) { - for( $i = 0; $i < $npts; ++$i) { - if ($i == 0) $H[$r][$c] = 0.; - $xi = $x[$i]; - $H[$r][$c] += ($oos2[$i] * $f->grad($xi, $a, $r) * $f->grad($xi, $a, $c)); - } //npts - } //c - } //r - - // boost diagonal towards gradient descent - for( $r = 0; $r < $nparm; ++$r) - $H[$r][$r] *= (1. + $lambda); - - // gradient - for( $r = 0; $r < $nparm; ++$r) { - for( $i = 0; $i < $npts; ++$i) { - if ($i == 0) $g[$r] = 0.; - $xi = $x[$i]; - $g[$r] += ($oos2[$i] * ($y[$i]-$f->val($xi,$a)) * $f->grad($xi, $a, $r)); - } - } //npts - - // scale (for consistency with NR, not necessary) - if ($false) { - for( $r = 0; $r < $nparm; ++$r) { - $g[$r] = -0.5 * $g[$r]; - for( $c = 0; $c < $nparm; ++$c) { - $H[$r][$c] *= 0.5; - } - } - } - - // solve H d = -g, evaluate error at new location - //double[] d = DoubleMatrix.solve(H, g); -// double[] d = (new Matrix(H)).lu().solve(new Matrix(g, nparm)).getRowPackedCopy(); - //double[] na = DoubleVector.add(a, d); -// double[] na = (new Matrix(a, nparm)).plus(new Matrix(d, nparm)).getRowPackedCopy(); -// double e1 = chiSquared(x, na, y, s, f); - -// if (verbose > 0) { -// System.out.println("\n\niteration "+iter+" lambda = "+lambda); -// System.out.print("a = "); -// (new Matrix(a, nparm)).print(10, 2); -// if (verbose > 1) { -// System.out.print("H = "); -// (new Matrix(H)).print(10, 2); -// System.out.print("g = "); -// (new Matrix(g, nparm)).print(10, 2); -// System.out.print("d = "); -// (new Matrix(d, nparm)).print(10, 2); -// } -// System.out.print("e0 = " + e0 + ": "); -// System.out.print("moved from "); -// (new Matrix(a, nparm)).print(10, 2); -// System.out.print("e1 = " + e1 + ": "); -// if (e1 < e0) { -// System.out.print("to "); -// (new Matrix(na, nparm)).print(10, 2); -// } else { -// System.out.println("move rejected"); -// } -// } - - // termination test (slightly different than NR) -// if (Math.abs(e1-e0) > termepsilon) { -// term = 0; -// } else { -// term++; -// if (term == 4) { -// System.out.println("terminating after " + iter + " iterations"); -// done = true; -// } -// } -// if (iter >= maxiter) done = true; - - // in the C++ version, found that changing this to e1 >= e0 - // was not a good idea. See comment there. - // -// if (e1 > e0 || Double.isNaN(e1)) { // new location worse than before -// lambda *= 10.; -// } else { // new location better, accept new parameters -// lambda *= 0.1; -// e0 = e1; -// // simply assigning a = na will not get results copied back to caller -// for( int i = 0; i < nparm; i++ ) { -// if (vary[i]) a[i] = na[i]; -// } -// } - } while(!$done); - - return $lambda; - } // function solve() - -} // class LevenbergMarquardt diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/MagicSquareExample.php b/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/MagicSquareExample.php deleted file mode 100644 index e6c93d05b20..00000000000 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/MagicSquareExample.php +++ /dev/null @@ -1,182 +0,0 @@ -magic($p); - $M = array(); - for ($j = 0; $j < $p; ++$j) { - for ($i = 0; $i < $p; ++$i) { - $aij = $A->get($i,$j); - $M[$i][$j] = $aij; - $M[$i][$j+$p] = $aij + 2*$p*$p; - $M[$i+$p][$j] = $aij + 3*$p*$p; - $M[$i+$p][$j+$p] = $aij + $p*$p; - } - } - - for ($i = 0; $i < $p; ++$i) { - for ($j = 0; $j < $k; ++$j) { - $t = $M[$i][$j]; - $M[$i][$j] = $M[$i+$p][$j]; - $M[$i+$p][$j] = $t; - } - for ($j = $n-$k+1; $j < $n; ++$j) { - $t = $M[$i][$j]; - $M[$i][$j] = $M[$i+$p][$j]; - $M[$i+$p][$j] = $t; - } - } - - $t = $M[$k][0]; $M[$k][0] = $M[$k+$p][0]; $M[$k+$p][0] = $t; - $t = $M[$k][$k]; $M[$k][$k] = $M[$k+$p][$k]; $M[$k+$p][$k] = $t; - - } - - return new Matrix($M); - - } - - /** - * Simple function to replicate PHP 5 behaviour - */ - function microtime_float() { - list($usec, $sec) = explode(" ", microtime()); - return ((float)$usec + (float)$sec); - } - - /** - * Tests LU, QR, SVD and symmetric Eig decompositions. - * - * n = order of magic square. - * trace = diagonal sum, should be the magic sum, (n^3 + n)/2. - * max_eig = maximum eigenvalue of (A + A')/2, should equal trace. - * rank = linear algebraic rank, should equal n if n is odd, - * be less than n if n is even. - * cond = L_2 condition number, ratio of singular values. - * lu_res = test of LU factorization, norm1(L*U-A(p,:))/(n*eps). - * qr_res = test of QR factorization, norm1(Q*R-A)/(n*eps). - */ - function main() { - ?> -

Test of Matrix Class, using magic squares.

-

See MagicSquareExample.main() for an explanation.

- - - - - - - - - - - microtime_float(); - $eps = pow(2.0,-52.0); - for ($n = 3; $n <= 6; ++$n) { - echo ""; - - echo ""; - - $M = $this->magic($n); - $t = (int) $M->trace(); - - echo ""; - - $O = $M->plus($M->transpose()); - $E = new EigenvalueDecomposition($O->times(0.5)); - $d = $E->getRealEigenvalues(); - - echo ""; - - $r = $M->rank(); - - echo ""; - - $c = $M->cond(); - - if ($c < 1/$eps) - echo ""; - else - echo ""; - - $LU = new LUDecomposition($M); - $L = $LU->getL(); - $U = $LU->getU(); - $p = $LU->getPivot(); - // Java version: R = L.times(U).minus(M.getMatrix(p,0,n-1)); - $S = $L->times($U); - $R = $S->minus($M->getMatrix($p,0,$n-1)); - $res = $R->norm1()/($n*$eps); - - echo ""; - - $QR = new QRDecomposition($M); - $Q = $QR->getQ(); - $R = $QR->getR(); - $S = $Q->times($R); - $R = $S->minus($M); - $res = $R->norm1()/($n*$eps); - - echo ""; - - echo ""; - - } - echo "
ntracemax_eigrankcondlu_resqr_res
$n$t".$d[$n-1]."".$r."".sprintf("%.3f",$c)."Inf".sprintf("%.3f",$res)."".sprintf("%.3f",$res)."
"; - echo "
"; - - $stop_time = $this->microtime_float(); - $etime = $stop_time - $start_time; - - echo "

Elapsed time is ". sprintf("%.4f",$etime) ." seconds.

"; - - } - -} - -$magic = new MagicSquareExample(); -$magic->main(); - -?> diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/Stats.php b/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/Stats.php deleted file mode 100644 index 38bc4b7d86c..00000000000 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/Stats.php +++ /dev/null @@ -1,1605 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id: Stats.php,v 1.15 2003/06/01 11:40:30 jmcastagnetto Exp $ -// - -include_once 'PEAR.php'; - -/** -* @package Math_Stats -*/ - -// Constants for defining the statistics to calculate /*{{{*/ -/** -* STATS_BASIC to generate the basic descriptive statistics -*/ -define('STATS_BASIC', 1); -/** -* STATS_FULL to generate also higher moments, mode, median, etc. -*/ -define('STATS_FULL', 2); -/*}}}*/ - -// Constants describing the data set format /*{{{*/ -/** -* STATS_DATA_SIMPLE for an array of numeric values. This is the default. -* e.g. $data = array(2,3,4,5,1,1,6); -*/ -define('STATS_DATA_SIMPLE', 0); -/** -* STATS_DATA_CUMMULATIVE for an associative array of frequency values, -* where in each array entry, the index is the data point and the -* value the count (frequency): -* e.g. $data = array(3=>4, 2.3=>5, 1.25=>6, 0.5=>3) -*/ -define('STATS_DATA_CUMMULATIVE', 1); -/*}}}*/ - -// Constants defining how to handle nulls /*{{{*/ -/** -* STATS_REJECT_NULL, reject data sets with null values. This is the default. -* Any non-numeric value is considered a null in this context. -*/ -define('STATS_REJECT_NULL', -1); -/** -* STATS_IGNORE_NULL, ignore null values and prune them from the data. -* Any non-numeric value is considered a null in this context. -*/ -define('STATS_IGNORE_NULL', -2); -/** -* STATS_USE_NULL_AS_ZERO, assign the value of 0 (zero) to null values. -* Any non-numeric value is considered a null in this context. -*/ -define('STATS_USE_NULL_AS_ZERO', -3); -/*}}}*/ - -/** -* A class to calculate descriptive statistics from a data set. -* Data sets can be simple arrays of data, or a cummulative hash. -* The second form is useful when passing large data set, -* for example the data set: -* -*
-* $data1 = array (1,2,1,1,1,1,3,3,4.1,3,2,2,4.1,1,1,2,3,3,2,2,1,1,2,2);
-* 
-* -* can be epxressed more compactly as: -* -*
-* $data2 = array('1'=>9, '2'=>8, '3'=>5, '4.1'=>2);
-* 
-* -* Example of use: -* -*
-* include_once 'Math/Stats.php';
-* $s = new Math_Stats();
-* $s->setData($data1);
-* // or
-* // $s->setData($data2, STATS_DATA_CUMMULATIVE);
-* $stats = $s->calcBasic();
-* echo 'Mean: '.$stats['mean'].' StDev: '.$stats['stdev'].' 
\n'; -* -* // using data with nulls -* // first ignoring them: -* $data3 = array(1.2, 'foo', 2.4, 3.1, 4.2, 3.2, null, 5.1, 6.2); -* $s->setNullOption(STATS_IGNORE_NULL); -* $s->setData($data3); -* $stats3 = $s->calcFull(); -* -* // and then assuming nulls == 0 -* $s->setNullOption(STATS_USE_NULL_AS_ZERO); -* $s->setData($data3); -* $stats3 = $s->calcFull(); -*
-* -* Originally this class was part of NumPHP (Numeric PHP package) -* -* @author Jesus M. Castagnetto -* @version 0.8 -* @access public -* @package Math_Stats -*/ -class Base {/*{{{*/ - // properties /*{{{*/ - - /** - * The simple or cummulative data set. - * Null by default. - * - * @access private - * @var array - */ - public $_data = null; - - /** - * Expanded data set. Only set when cummulative data - * is being used. Null by default. - * - * @access private - * @var array - */ - public $_dataExpanded = null; - - /** - * Flag for data type, one of STATS_DATA_SIMPLE or - * STATS_DATA_CUMMULATIVE. Null by default. - * - * @access private - * @var int - */ - public $_dataOption = null; - - /** - * Flag for null handling options. One of STATS_REJECT_NULL, - * STATS_IGNORE_NULL or STATS_USE_NULL_AS_ZERO - * - * @access private - * @var int - */ - public $_nullOption; - - /** - * Array for caching result values, should be reset - * when using setData() - * - * @access private - * @var array - */ - public $_calculatedValues = array(); - - /*}}}*/ - - /** - * Constructor for the class - * - * @access public - * @param optional int $nullOption how to handle null values - * @return object Math_Stats - */ - function Math_Stats($nullOption=STATS_REJECT_NULL) {/*{{{*/ - $this->_nullOption = $nullOption; - }/*}}}*/ - - /** - * Sets and verifies the data, checking for nulls and using - * the current null handling option - * - * @access public - * @param array $arr the data set - * @param optional int $opt data format: STATS_DATA_CUMMULATIVE or STATS_DATA_SIMPLE (default) - * @return mixed true on success, a PEAR_Error object otherwise - */ - function setData($arr, $opt=STATS_DATA_SIMPLE) {/*{{{*/ - if (!is_array($arr)) { - return PEAR::raiseError('invalid data, an array of numeric data was expected'); - } - $this->_data = null; - $this->_dataExpanded = null; - $this->_dataOption = null; - $this->_calculatedValues = array(); - if ($opt == STATS_DATA_SIMPLE) { - $this->_dataOption = $opt; - $this->_data = array_values($arr); - } else if ($opt == STATS_DATA_CUMMULATIVE) { - $this->_dataOption = $opt; - $this->_data = $arr; - $this->_dataExpanded = array(); - } - return $this->_validate(); - }/*}}}*/ - - /** - * Returns the data which might have been modified - * according to the current null handling options. - * - * @access public - * @param boolean $expanded whether to return a expanded list, default is false - * @return mixed array of data on success, a PEAR_Error object otherwise - * @see _validate() - */ - function getData($expanded=false) {/*{{{*/ - if ($this->_data == null) { - return PEAR::raiseError('data has not been set'); - } - if ($this->_dataOption == STATS_DATA_CUMMULATIVE && $expanded) { - return $this->_dataExpanded; - } else { - return $this->_data; - } - }/*}}}*/ - - /** - * Sets the null handling option. - * Must be called before assigning a new data set containing null values - * - * @access public - * @return mixed true on success, a PEAR_Error object otherwise - * @see _validate() - */ - function setNullOption($nullOption) {/*{{{*/ - if ($nullOption == STATS_REJECT_NULL - || $nullOption == STATS_IGNORE_NULL - || $nullOption == STATS_USE_NULL_AS_ZERO) { - $this->_nullOption = $nullOption; - return true; - } else { - return PEAR::raiseError('invalid null handling option expecting: '. - 'STATS_REJECT_NULL, STATS_IGNORE_NULL or STATS_USE_NULL_AS_ZERO'); - } - }/*}}}*/ - - /** - * Transforms the data by substracting each entry from the mean and - * dividing by its standard deviation. This will reset all pre-calculated - * values to their original (unset) defaults. - * - * @access public - * @return mixed true on success, a PEAR_Error object otherwise - * @see mean() - * @see stDev() - * @see setData() - */ - function studentize() {/*{{{*/ - $mean = $this->mean(); - if (PEAR::isError($mean)) { - return $mean; - } - $std = $this->stDev(); - if (PEAR::isError($std)) { - return $std; - } - if ($std == 0) { - return PEAR::raiseError('cannot studentize data, standard deviation is zero.'); - } - $arr = array(); - if ($this->_dataOption == STATS_DATA_CUMMULATIVE) { - foreach ($this->_data as $val=>$freq) { - $newval = ($val - $mean) / $std; - $arr["$newval"] = $freq; - } - } else { - foreach ($this->_data as $val) { - $newval = ($val - $mean) / $std; - $arr[] = $newval; - } - } - return $this->setData($arr, $this->_dataOption); - }/*}}}*/ - - /** - * Transforms the data by substracting each entry from the mean. - * This will reset all pre-calculated values to their original (unset) defaults. - * - * @access public - * @return mixed true on success, a PEAR_Error object otherwise - * @see mean() - * @see setData() - */ - function center() {/*{{{*/ - $mean = $this->mean(); - if (PEAR::isError($mean)) { - return $mean; - } - $arr = array(); - if ($this->_dataOption == STATS_DATA_CUMMULATIVE) { - foreach ($this->_data as $val=>$freq) { - $newval = $val - $mean; - $arr["$newval"] = $freq; - } - } else { - foreach ($this->_data as $val) { - $newval = $val - $mean; - $arr[] = $newval; - } - } - return $this->setData($arr, $this->_dataOption); - }/*}}}*/ - - /** - * Calculates the basic or full statistics for the data set - * - * @access public - * @param int $mode one of STATS_BASIC or STATS_FULL - * @param boolean $returnErrorObject whether the raw PEAR_Error (when true, default), - * or only the error message will be returned (when false), if an error happens. - * @return mixed an associative array of statistics on success, a PEAR_Error object otherwise - * @see calcBasic() - * @see calcFull() - */ - function calc($mode, $returnErrorObject=true) {/*{{{*/ - if ($this->_data == null) { - return PEAR::raiseError('data has not been set'); - } - if ($mode == STATS_BASIC) { - return $this->calcBasic($returnErrorObject); - } elseif ($mode == STATS_FULL) { - return $this->calcFull($returnErrorObject); - } else { - return PEAR::raiseError('incorrect mode, expected STATS_BASIC or STATS_FULL'); - } - }/*}}}*/ - - /** - * Calculates a basic set of statistics - * - * @access public - * @param boolean $returnErrorObject whether the raw PEAR_Error (when true, default), - * or only the error message will be returned (when false), if an error happens. - * @return mixed an associative array of statistics on success, a PEAR_Error object otherwise - * @see calc() - * @see calcFull() - */ - function calcBasic($returnErrorObject=true) {/*{{{*/ - return array ( - 'min' => $this->__format($this->min(), $returnErrorObject), - 'max' => $this->__format($this->max(), $returnErrorObject), - 'sum' => $this->__format($this->sum(), $returnErrorObject), - 'sum2' => $this->__format($this->sum2(), $returnErrorObject), - 'count' => $this->__format($this->count(), $returnErrorObject), - 'mean' => $this->__format($this->mean(), $returnErrorObject), - 'stdev' => $this->__format($this->stDev(), $returnErrorObject), - 'variance' => $this->__format($this->variance(), $returnErrorObject), - 'range' => $this->__format($this->range(), $returnErrorObject) - ); - }/*}}}*/ - - /** - * Calculates a full set of statistics - * - * @access public - * @param boolean $returnErrorObject whether the raw PEAR_Error (when true, default), - * or only the error message will be returned (when false), if an error happens. - * @return mixed an associative array of statistics on success, a PEAR_Error object otherwise - * @see calc() - * @see calcBasic() - */ - function calcFull($returnErrorObject=true) {/*{{{*/ - return array ( - 'min' => $this->__format($this->min(), $returnErrorObject), - 'max' => $this->__format($this->max(), $returnErrorObject), - 'sum' => $this->__format($this->sum(), $returnErrorObject), - 'sum2' => $this->__format($this->sum2(), $returnErrorObject), - 'count' => $this->__format($this->count(), $returnErrorObject), - 'mean' => $this->__format($this->mean(), $returnErrorObject), - 'median' => $this->__format($this->median(), $returnErrorObject), - 'mode' => $this->__format($this->mode(), $returnErrorObject), - 'midrange' => $this->__format($this->midrange(), $returnErrorObject), - 'geometric_mean' => $this->__format($this->geometricMean(), $returnErrorObject), - 'harmonic_mean' => $this->__format($this->harmonicMean(), $returnErrorObject), - 'stdev' => $this->__format($this->stDev(), $returnErrorObject), - 'absdev' => $this->__format($this->absDev(), $returnErrorObject), - 'variance' => $this->__format($this->variance(), $returnErrorObject), - 'range' => $this->__format($this->range(), $returnErrorObject), - 'std_error_of_mean' => $this->__format($this->stdErrorOfMean(), $returnErrorObject), - 'skewness' => $this->__format($this->skewness(), $returnErrorObject), - 'kurtosis' => $this->__format($this->kurtosis(), $returnErrorObject), - 'coeff_of_variation' => $this->__format($this->coeffOfVariation(), $returnErrorObject), - 'sample_central_moments' => array ( - 1 => $this->__format($this->sampleCentralMoment(1), $returnErrorObject), - 2 => $this->__format($this->sampleCentralMoment(2), $returnErrorObject), - 3 => $this->__format($this->sampleCentralMoment(3), $returnErrorObject), - 4 => $this->__format($this->sampleCentralMoment(4), $returnErrorObject), - 5 => $this->__format($this->sampleCentralMoment(5), $returnErrorObject) - ), - 'sample_raw_moments' => array ( - 1 => $this->__format($this->sampleRawMoment(1), $returnErrorObject), - 2 => $this->__format($this->sampleRawMoment(2), $returnErrorObject), - 3 => $this->__format($this->sampleRawMoment(3), $returnErrorObject), - 4 => $this->__format($this->sampleRawMoment(4), $returnErrorObject), - 5 => $this->__format($this->sampleRawMoment(5), $returnErrorObject) - ), - 'frequency' => $this->__format($this->frequency(), $returnErrorObject), - 'quartiles' => $this->__format($this->quartiles(), $returnErrorObject), - 'interquartile_range' => $this->__format($this->interquartileRange(), $returnErrorObject), - 'interquartile_mean' => $this->__format($this->interquartileMean(), $returnErrorObject), - 'quartile_deviation' => $this->__format($this->quartileDeviation(), $returnErrorObject), - 'quartile_variation_coefficient' => $this->__format($this->quartileVariationCoefficient(), $returnErrorObject), - 'quartile_skewness_coefficient' => $this->__format($this->quartileSkewnessCoefficient(), $returnErrorObject) - ); - }/*}}}*/ - - /** - * Calculates the minimum of a data set. - * Handles cummulative data sets correctly - * - * @access public - * @return mixed the minimum value on success, a PEAR_Error object otherwise - * @see calc() - * @see max() - */ - function min() {/*{{{*/ - if ($this->_data == null) { - return PEAR::raiseError('data has not been set'); - } - if (!array_key_exists('min', $this->_calculatedValues)) { - if ($this->_dataOption == STATS_DATA_CUMMULATIVE) { - $min = min(array_keys($this->_data)); - } else { - $min = min($this->_data); - } - $this->_calculatedValues['min'] = $min; - } - return $this->_calculatedValues['min']; - }/*}}}*/ - - /** - * Calculates the maximum of a data set. - * Handles cummulative data sets correctly - * - * @access public - * @return mixed the maximum value on success, a PEAR_Error object otherwise - * @see calc() - * @see min() - */ - function max() {/*{{{*/ - if ($this->_data == null) { - return PEAR::raiseError('data has not been set'); - } - if (!array_key_exists('max', $this->_calculatedValues)) { - if ($this->_dataOption == STATS_DATA_CUMMULATIVE) { - $max = max(array_keys($this->_data)); - } else { - $max = max($this->_data); - } - $this->_calculatedValues['max'] = $max; - } - return $this->_calculatedValues['max']; - }/*}}}*/ - - /** - * Calculates SUM { xi } - * Handles cummulative data sets correctly - * - * @access public - * @return mixed the sum on success, a PEAR_Error object otherwise - * @see calc() - * @see sum2() - * @see sumN() - */ - function sum() {/*{{{*/ - if (!array_key_exists('sum', $this->_calculatedValues)) { - $sum = $this->sumN(1); - if (PEAR::isError($sum)) { - return $sum; - } else { - $this->_calculatedValues['sum'] = $sum; - } - } - return $this->_calculatedValues['sum']; - }/*}}}*/ - - /** - * Calculates SUM { (xi)^2 } - * Handles cummulative data sets correctly - * - * @access public - * @return mixed the sum on success, a PEAR_Error object otherwise - * @see calc() - * @see sum() - * @see sumN() - */ - function sum2() {/*{{{*/ - if (!array_key_exists('sum2', $this->_calculatedValues)) { - $sum2 = $this->sumN(2); - if (PEAR::isError($sum2)) { - return $sum2; - } else { - $this->_calculatedValues['sum2'] = $sum2; - } - } - return $this->_calculatedValues['sum2']; - }/*}}}*/ - - /** - * Calculates SUM { (xi)^n } - * Handles cummulative data sets correctly - * - * @access public - * @param numeric $n the exponent - * @return mixed the sum on success, a PEAR_Error object otherwise - * @see calc() - * @see sum() - * @see sum2() - */ - function sumN($n) {/*{{{*/ - if ($this->_data == null) { - return PEAR::raiseError('data has not been set'); - } - $sumN = 0; - if ($this->_dataOption == STATS_DATA_CUMMULATIVE) { - foreach($this->_data as $val=>$freq) { - $sumN += $freq * pow((double)$val, (double)$n); - } - } else { - foreach($this->_data as $val) { - $sumN += pow((double)$val, (double)$n); - } - } - return $sumN; - }/*}}}*/ - - /** - * Calculates PROD { (xi) }, (the product of all observations) - * Handles cummulative data sets correctly - * - * @access public - * @return mixed the product on success, a PEAR_Error object otherwise - * @see productN() - */ - function product() {/*{{{*/ - if (!array_key_exists('product', $this->_calculatedValues)) { - $product = $this->productN(1); - if (PEAR::isError($product)) { - return $product; - } else { - $this->_calculatedValues['product'] = $product; - } - } - return $this->_calculatedValues['product']; - }/*}}}*/ - - /** - * Calculates PROD { (xi)^n }, which is the product of all observations - * Handles cummulative data sets correctly - * - * @access public - * @param numeric $n the exponent - * @return mixed the product on success, a PEAR_Error object otherwise - * @see product() - */ - function productN($n) {/*{{{*/ - if ($this->_data == null) { - return PEAR::raiseError('data has not been set'); - } - $prodN = 1.0; - if ($this->_dataOption == STATS_DATA_CUMMULATIVE) { - foreach($this->_data as $val=>$freq) { - if ($val == 0) { - return 0.0; - } - $prodN *= $freq * pow((double)$val, (double)$n); - } - } else { - foreach($this->_data as $val) { - if ($val == 0) { - return 0.0; - } - $prodN *= pow((double)$val, (double)$n); - } - } - return $prodN; - - }/*}}}*/ - - /** - * Calculates the number of data points in the set - * Handles cummulative data sets correctly - * - * @access public - * @return mixed the count on success, a PEAR_Error object otherwise - * @see calc() - */ - function count() {/*{{{*/ - if ($this->_data == null) { - return PEAR::raiseError('data has not been set'); - } - if (!array_key_exists('count', $this->_calculatedValues)) { - if ($this->_dataOption == STATS_DATA_CUMMULATIVE) { - $count = count($this->_dataExpanded); - } else { - $count = count($this->_data); - } - $this->_calculatedValues['count'] = $count; - } - return $this->_calculatedValues['count']; - }/*}}}*/ - - /** - * Calculates the mean (average) of the data points in the set - * Handles cummulative data sets correctly - * - * @access public - * @return mixed the mean value on success, a PEAR_Error object otherwise - * @see calc() - * @see sum() - * @see count() - */ - function mean() {/*{{{*/ - if (!array_key_exists('mean', $this->_calculatedValues)) { - $sum = $this->sum(); - if (PEAR::isError($sum)) { - return $sum; - } - $count = $this->count(); - if (PEAR::isError($count)) { - return $count; - } - $this->_calculatedValues['mean'] = $sum / $count; - } - return $this->_calculatedValues['mean']; - }/*}}}*/ - - /** - * Calculates the range of the data set = max - min - * - * @access public - * @return mixed the value of the range on success, a PEAR_Error object otherwise. - */ - function range() {/*{{{*/ - if (!array_key_exists('range', $this->_calculatedValues)) { - $min = $this->min(); - if (PEAR::isError($min)) { - return $min; - } - $max = $this->max(); - if (PEAR::isError($max)) { - return $max; - } - $this->_calculatedValues['range'] = $max - $min; - } - return $this->_calculatedValues['range']; - - }/*}}}*/ - - /** - * Calculates the variance (unbiased) of the data points in the set - * Handles cummulative data sets correctly - * - * @access public - * @return mixed the variance value on success, a PEAR_Error object otherwise - * @see calc() - * @see __sumdiff() - * @see count() - */ - function variance() {/*{{{*/ - if (!array_key_exists('variance', $this->_calculatedValues)) { - $variance = $this->__calcVariance(); - if (PEAR::isError($variance)) { - return $variance; - } - $this->_calculatedValues['variance'] = $variance; - } - return $this->_calculatedValues['variance']; - }/*}}}*/ - - /** - * Calculates the standard deviation (unbiased) of the data points in the set - * Handles cummulative data sets correctly - * - * @access public - * @return mixed the standard deviation on success, a PEAR_Error object otherwise - * @see calc() - * @see variance() - */ - function stDev() {/*{{{*/ - if (!array_key_exists('stDev', $this->_calculatedValues)) { - $variance = $this->variance(); - if (PEAR::isError($variance)) { - return $variance; - } - $this->_calculatedValues['stDev'] = sqrt($variance); - } - return $this->_calculatedValues['stDev']; - }/*}}}*/ - - /** - * Calculates the variance (unbiased) of the data points in the set - * given a fixed mean (average) value. Not used in calcBasic(), calcFull() - * or calc(). - * Handles cummulative data sets correctly - * - * @access public - * @param numeric $mean the fixed mean value - * @return mixed the variance on success, a PEAR_Error object otherwise - * @see __sumdiff() - * @see count() - * @see variance() - */ - function varianceWithMean($mean) {/*{{{*/ - return $this->__calcVariance($mean); - }/*}}}*/ - - /** - * Calculates the standard deviation (unbiased) of the data points in the set - * given a fixed mean (average) value. Not used in calcBasic(), calcFull() - * or calc(). - * Handles cummulative data sets correctly - * - * @access public - * @param numeric $mean the fixed mean value - * @return mixed the standard deviation on success, a PEAR_Error object otherwise - * @see varianceWithMean() - * @see stDev() - */ - function stDevWithMean($mean) {/*{{{*/ - $varianceWM = $this->varianceWithMean($mean); - if (PEAR::isError($varianceWM)) { - return $varianceWM; - } - return sqrt($varianceWM); - }/*}}}*/ - - /** - * Calculates the absolute deviation of the data points in the set - * Handles cummulative data sets correctly - * - * @access public - * @return mixed the absolute deviation on success, a PEAR_Error object otherwise - * @see calc() - * @see __sumabsdev() - * @see count() - * @see absDevWithMean() - */ - function absDev() {/*{{{*/ - if (!array_key_exists('absDev', $this->_calculatedValues)) { - $absDev = $this->__calcAbsoluteDeviation(); - if (PEAR::isError($absdev)) { - return $absdev; - } - $this->_calculatedValues['absDev'] = $absDev; - } - return $this->_calculatedValues['absDev']; - }/*}}}*/ - - /** - * Calculates the absolute deviation of the data points in the set - * given a fixed mean (average) value. Not used in calcBasic(), calcFull() - * or calc(). - * Handles cummulative data sets correctly - * - * @access public - * @param numeric $mean the fixed mean value - * @return mixed the absolute deviation on success, a PEAR_Error object otherwise - * @see __sumabsdev() - * @see absDev() - */ - function absDevWithMean($mean) {/*{{{*/ - return $this->__calcAbsoluteDeviation($mean); - }/*}}}*/ - - /** - * Calculates the skewness of the data distribution in the set - * The skewness measures the degree of asymmetry of a distribution, - * and is related to the third central moment of a distribution. - * A normal distribution has a skewness = 0 - * A distribution with a tail off towards the high end of the scale - * (positive skew) has a skewness > 0 - * A distribution with a tail off towards the low end of the scale - * (negative skew) has a skewness < 0 - * Handles cummulative data sets correctly - * - * @access public - * @return mixed the skewness value on success, a PEAR_Error object otherwise - * @see __sumdiff() - * @see count() - * @see stDev() - * @see calc() - */ - function skewness() {/*{{{*/ - if (!array_key_exists('skewness', $this->_calculatedValues)) { - $count = $this->count(); - if (PEAR::isError($count)) { - return $count; - } - $stDev = $this->stDev(); - if (PEAR::isError($stDev)) { - return $stDev; - } - $sumdiff3 = $this->__sumdiff(3); - if (PEAR::isError($sumdiff3)) { - return $sumdiff3; - } - $this->_calculatedValues['skewness'] = ($sumdiff3 / ($count * pow($stDev, 3))); - } - return $this->_calculatedValues['skewness']; - }/*}}}*/ - - /** - * Calculates the kurtosis of the data distribution in the set - * The kurtosis measures the degrees of peakedness of a distribution. - * It is also called the "excess" or "excess coefficient", and is - * a normalized form of the fourth central moment of a distribution. - * A normal distributions has kurtosis = 0 - * A narrow and peaked (leptokurtic) distribution has a - * kurtosis > 0 - * A flat and wide (platykurtic) distribution has a kurtosis < 0 - * Handles cummulative data sets correctly - * - * @access public - * @return mixed the kurtosis value on success, a PEAR_Error object otherwise - * @see __sumdiff() - * @see count() - * @see stDev() - * @see calc() - */ - function kurtosis() {/*{{{*/ - if (!array_key_exists('kurtosis', $this->_calculatedValues)) { - $count = $this->count(); - if (PEAR::isError($count)) { - return $count; - } - $stDev = $this->stDev(); - if (PEAR::isError($stDev)) { - return $stDev; - } - $sumdiff4 = $this->__sumdiff(4); - if (PEAR::isError($sumdiff4)) { - return $sumdiff4; - } - $this->_calculatedValues['kurtosis'] = ($sumdiff4 / ($count * pow($stDev, 4))) - 3; - } - return $this->_calculatedValues['kurtosis']; - }/*}}}*/ - - /** - * Calculates the median of a data set. - * The median is the value such that half of the points are below it - * in a sorted data set. - * If the number of values is odd, it is the middle item. - * If the number of values is even, is the average of the two middle items. - * Handles cummulative data sets correctly - * - * @access public - * @return mixed the median value on success, a PEAR_Error object otherwise - * @see count() - * @see calc() - */ - function median() {/*{{{*/ - if ($this->_data == null) { - return PEAR::raiseError('data has not been set'); - } - if (!array_key_exists('median', $this->_calculatedValues)) { - if ($this->_dataOption == STATS_DATA_CUMMULATIVE) { - $arr =& $this->_dataExpanded; - } else { - $arr =& $this->_data; - } - $n = $this->count(); - if (PEAR::isError($n)) { - return $n; - } - $h = intval($n / 2); - if ($n % 2 == 0) { - $median = ($arr[$h] + $arr[$h - 1]) / 2; - } else { - $median = $arr[$h + 1]; - } - $this->_calculatedValues['median'] = $median; - } - return $this->_calculatedValues['median']; - }/*}}}*/ - - /** - * Calculates the mode of a data set. - * The mode is the value with the highest frequency in the data set. - * There can be more than one mode. - * Handles cummulative data sets correctly - * - * @access public - * @return mixed an array of mode value on success, a PEAR_Error object otherwise - * @see frequency() - * @see calc() - */ - function mode() {/*{{{*/ - if ($this->_data == null) { - return PEAR::raiseError('data has not been set'); - } - if (!array_key_exists('mode', $this->_calculatedValues)) { - if ($this->_dataOption == STATS_DATA_CUMMULATIVE) { - $arr = $this->_data; - } else { - $arr = $this->frequency(); - } - arsort($arr); - $mcount = 1; - foreach ($arr as $val=>$freq) { - if ($mcount == 1) { - $mode = array($val); - $mfreq = $freq; - ++$mcount; - continue; - } - if ($mfreq == $freq) - $mode[] = $val; - if ($mfreq > $freq) - break; - } - $this->_calculatedValues['mode'] = $mode; - } - return $this->_calculatedValues['mode']; - }/*}}}*/ - - /** - * Calculates the midrange of a data set. - * The midrange is the average of the minimum and maximum of the data set. - * Handles cummulative data sets correctly - * - * @access public - * @return mixed the midrange value on success, a PEAR_Error object otherwise - * @see min() - * @see max() - * @see calc() - */ - function midrange() {/*{{{*/ - if (!array_key_exists('midrange', $this->_calculatedValues)) { - $min = $this->min(); - if (PEAR::isError($min)) { - return $min; - } - $max = $this->max(); - if (PEAR::isError($max)) { - return $max; - } - $this->_calculatedValues['midrange'] = (($max + $min) / 2); - } - return $this->_calculatedValues['midrange']; - }/*}}}*/ - - /** - * Calculates the geometrical mean of the data points in the set - * Handles cummulative data sets correctly - * - * @access public - * @return mixed the geometrical mean value on success, a PEAR_Error object otherwise - * @see calc() - * @see product() - * @see count() - */ - function geometricMean() {/*{{{*/ - if (!array_key_exists('geometricMean', $this->_calculatedValues)) { - $count = $this->count(); - if (PEAR::isError($count)) { - return $count; - } - $prod = $this->product(); - if (PEAR::isError($prod)) { - return $prod; - } - if ($prod == 0.0) { - return 0.0; - } - if ($prod < 0) { - return PEAR::raiseError('The product of the data set is negative, geometric mean undefined.'); - } - $this->_calculatedValues['geometricMean'] = pow($prod , 1 / $count); - } - return $this->_calculatedValues['geometricMean']; - }/*}}}*/ - - /** - * Calculates the harmonic mean of the data points in the set - * Handles cummulative data sets correctly - * - * @access public - * @return mixed the harmonic mean value on success, a PEAR_Error object otherwise - * @see calc() - * @see count() - */ - function harmonicMean() {/*{{{*/ - if ($this->_data == null) { - return PEAR::raiseError('data has not been set'); - } - if (!array_key_exists('harmonicMean', $this->_calculatedValues)) { - $count = $this->count(); - if (PEAR::isError($count)) { - return $count; - } - $invsum = 0.0; - if ($this->_dataOption == STATS_DATA_CUMMULATIVE) { - foreach($this->_data as $val=>$freq) { - if ($val == 0) { - return PEAR::raiseError('cannot calculate a '. - 'harmonic mean with data values of zero.'); - } - $invsum += $freq / $val; - } - } else { - foreach($this->_data as $val) { - if ($val == 0) { - return PEAR::raiseError('cannot calculate a '. - 'harmonic mean with data values of zero.'); - } - $invsum += 1 / $val; - } - } - $this->_calculatedValues['harmonicMean'] = $count / $invsum; - } - return $this->_calculatedValues['harmonicMean']; - }/*}}}*/ - - /** - * Calculates the nth central moment (m{n}) of a data set. - * - * The definition of a sample central moment is: - * - * m{n} = 1/N * SUM { (xi - avg)^n } - * - * where: N = sample size, avg = sample mean. - * - * @access public - * @param integer $n moment to calculate - * @return mixed the numeric value of the moment on success, PEAR_Error otherwise - */ - function sampleCentralMoment($n) {/*{{{*/ - if (!is_int($n) || $n < 1) { - return PEAR::isError('moment must be a positive integer >= 1.'); - } - - if ($n == 1) { - return 0; - } - $count = $this->count(); - if (PEAR::isError($count)) { - return $count; - } - if ($count == 0) { - return PEAR::raiseError("Cannot calculate {$n}th sample moment, ". - 'there are zero data entries'); - } - $sum = $this->__sumdiff($n); - if (PEAR::isError($sum)) { - return $sum; - } - return ($sum / $count); - }/*}}}*/ - - /** - * Calculates the nth raw moment (m{n}) of a data set. - * - * The definition of a sample central moment is: - * - * m{n} = 1/N * SUM { xi^n } - * - * where: N = sample size, avg = sample mean. - * - * @access public - * @param integer $n moment to calculate - * @return mixed the numeric value of the moment on success, PEAR_Error otherwise - */ - function sampleRawMoment($n) {/*{{{*/ - if (!is_int($n) || $n < 1) { - return PEAR::isError('moment must be a positive integer >= 1.'); - } - - $count = $this->count(); - if (PEAR::isError($count)) { - return $count; - } - if ($count == 0) { - return PEAR::raiseError("Cannot calculate {$n}th raw moment, ". - 'there are zero data entries.'); - } - $sum = $this->sumN($n); - if (PEAR::isError($sum)) { - return $sum; - } - return ($sum / $count); - }/*}}}*/ - - - /** - * Calculates the coefficient of variation of a data set. - * The coefficient of variation measures the spread of a set of data - * as a proportion of its mean. It is often expressed as a percentage. - * Handles cummulative data sets correctly - * - * @access public - * @return mixed the coefficient of variation on success, a PEAR_Error object otherwise - * @see stDev() - * @see mean() - * @see calc() - */ - function coeffOfVariation() {/*{{{*/ - if (!array_key_exists('coeffOfVariation', $this->_calculatedValues)) { - $mean = $this->mean(); - if (PEAR::isError($mean)) { - return $mean; - } - if ($mean == 0.0) { - return PEAR::raiseError('cannot calculate the coefficient '. - 'of variation, mean of sample is zero'); - } - $stDev = $this->stDev(); - if (PEAR::isError($stDev)) { - return $stDev; - } - - $this->_calculatedValues['coeffOfVariation'] = $stDev / $mean; - } - return $this->_calculatedValues['coeffOfVariation']; - }/*}}}*/ - - /** - * Calculates the standard error of the mean. - * It is the standard deviation of the sampling distribution of - * the mean. The formula is: - * - * S.E. Mean = SD / (N)^(1/2) - * - * This formula does not assume a normal distribution, and shows - * that the size of the standard error of the mean is inversely - * proportional to the square root of the sample size. - * - * @access public - * @return mixed the standard error of the mean on success, a PEAR_Error object otherwise - * @see stDev() - * @see count() - * @see calc() - */ - function stdErrorOfMean() {/*{{{*/ - if (!array_key_exists('stdErrorOfMean', $this->_calculatedValues)) { - $count = $this->count(); - if (PEAR::isError($count)) { - return $count; - } - $stDev = $this->stDev(); - if (PEAR::isError($stDev)) { - return $stDev; - } - $this->_calculatedValues['stdErrorOfMean'] = $stDev / sqrt($count); - } - return $this->_calculatedValues['stdErrorOfMean']; - }/*}}}*/ - - /** - * Calculates the value frequency table of a data set. - * Handles cummulative data sets correctly - * - * @access public - * @return mixed an associative array of value=>frequency items on success, a PEAR_Error object otherwise - * @see min() - * @see max() - * @see calc() - */ - function frequency() {/*{{{*/ - if ($this->_data == null) { - return PEAR::raiseError('data has not been set'); - } - if (!array_key_exists('frequency', $this->_calculatedValues)) { - if ($this->_dataOption == STATS_DATA_CUMMULATIVE) { - $freq = $this->_data; - } else { - $freq = array(); - foreach ($this->_data as $val) { - $freq["$val"]++; - } - ksort($freq); - } - $this->_calculatedValues['frequency'] = $freq; - } - return $this->_calculatedValues['frequency']; - }/*}}}*/ - - /** - * The quartiles are defined as the values that divide a sorted - * data set into four equal-sized subsets, and correspond to the - * 25th, 50th, and 75th percentiles. - * - * @access public - * @return mixed an associative array of quartiles on success, a PEAR_Error otherwise - * @see percentile() - */ - function quartiles() {/*{{{*/ - if (!array_key_exists('quartiles', $this->_calculatedValues)) { - $q1 = $this->percentile(25); - if (PEAR::isError($q1)) { - return $q1; - } - $q2 = $this->percentile(50); - if (PEAR::isError($q2)) { - return $q2; - } - $q3 = $this->percentile(75); - if (PEAR::isError($q3)) { - return $q3; - } - $this->_calculatedValues['quartiles'] = array ( - '25' => $q1, - '50' => $q2, - '75' => $q3 - ); - } - return $this->_calculatedValues['quartiles']; - }/*}}}*/ - - /** - * The interquartile mean is defined as the mean of the values left - * after discarding the lower 25% and top 25% ranked values, i.e.: - * - * interquart mean = mean() - * - * where: P = percentile - * - * @todo need to double check the equation - * @access public - * @return mixed a numeric value on success, a PEAR_Error otherwise - * @see quartiles() - */ - function interquartileMean() {/*{{{*/ - if (!array_key_exists('interquartileMean', $this->_calculatedValues)) { - $quart = $this->quartiles(); - if (PEAR::isError($quart)) { - return $quart; - } - $q3 = $quart['75']; - $q1 = $quart['25']; - $sum = 0; - $n = 0; - foreach ($this->getData(true) as $val) { - if ($val >= $q1 && $val <= $q3) { - $sum += $val; - ++$n; - } - } - if ($n == 0) { - return PEAR::raiseError('error calculating interquartile mean, '. - 'empty interquartile range of values.'); - } - $this->_calculatedValues['interquartileMean'] = $sum / $n; - } - return $this->_calculatedValues['interquartileMean']; - }/*}}}*/ - - /** - * The interquartile range is the distance between the 75th and 25th - * percentiles. Basically the range of the middle 50% of the data set, - * and thus is not affected by outliers or extreme values. - * - * interquart range = P(75) - P(25) - * - * where: P = percentile - * - * @access public - * @return mixed a numeric value on success, a PEAR_Error otherwise - * @see quartiles() - */ - function interquartileRange() {/*{{{*/ - if (!array_key_exists('interquartileRange', $this->_calculatedValues)) { - $quart = $this->quartiles(); - if (PEAR::isError($quart)) { - return $quart; - } - $q3 = $quart['75']; - $q1 = $quart['25']; - $this->_calculatedValues['interquartileRange'] = $q3 - $q1; - } - return $this->_calculatedValues['interquartileRange']; - }/*}}}*/ - - /** - * The quartile deviation is half of the interquartile range value - * - * quart dev = (P(75) - P(25)) / 2 - * - * where: P = percentile - * - * @access public - * @return mixed a numeric value on success, a PEAR_Error otherwise - * @see quartiles() - * @see interquartileRange() - */ - function quartileDeviation() {/*{{{*/ - if (!array_key_exists('quartileDeviation', $this->_calculatedValues)) { - $iqr = $this->interquartileRange(); - if (PEAR::isError($iqr)) { - return $iqr; - } - $this->_calculatedValues['quartileDeviation'] = $iqr / 2; - } - return $this->_calculatedValues['quartileDeviation']; - }/*}}}*/ - - /** - * The quartile variation coefficient is defines as follows: - * - * quart var coeff = 100 * (P(75) - P(25)) / (P(75) + P(25)) - * - * where: P = percentile - * - * @todo need to double check the equation - * @access public - * @return mixed a numeric value on success, a PEAR_Error otherwise - * @see quartiles() - */ - function quartileVariationCoefficient() {/*{{{*/ - if (!array_key_exists('quartileVariationCoefficient', $this->_calculatedValues)) { - $quart = $this->quartiles(); - if (PEAR::isError($quart)) { - return $quart; - } - $q3 = $quart['75']; - $q1 = $quart['25']; - $d = $q3 - $q1; - $s = $q3 + $q1; - $this->_calculatedValues['quartileVariationCoefficient'] = 100 * $d / $s; - } - return $this->_calculatedValues['quartileVariationCoefficient']; - }/*}}}*/ - - /** - * The quartile skewness coefficient (also known as Bowley Skewness), - * is defined as follows: - * - * quart skewness coeff = (P(25) - 2*P(50) + P(75)) / (P(75) - P(25)) - * - * where: P = percentile - * - * @todo need to double check the equation - * @access public - * @return mixed a numeric value on success, a PEAR_Error otherwise - * @see quartiles() - */ - function quartileSkewnessCoefficient() {/*{{{*/ - if (!array_key_exists('quartileSkewnessCoefficient', $this->_calculatedValues)) { - $quart = $this->quartiles(); - if (PEAR::isError($quart)) { - return $quart; - } - $q3 = $quart['75']; - $q2 = $quart['50']; - $q1 = $quart['25']; - $d = $q3 - 2*$q2 + $q1; - $s = $q3 - $q1; - $this->_calculatedValues['quartileSkewnessCoefficient'] = $d / $s; - } - return $this->_calculatedValues['quartileSkewnessCoefficient']; - }/*}}}*/ - - /** - * The pth percentile is the value such that p% of the a sorted data set - * is smaller than it, and (100 - p)% of the data is larger. - * - * A quick algorithm to pick the appropriate value from a sorted data - * set is as follows: - * - * - Count the number of values: n - * - Calculate the position of the value in the data list: i = p * (n + 1) - * - if i is an integer, return the data at that position - * - if i < 1, return the minimum of the data set - * - if i > n, return the maximum of the data set - * - otherwise, average the entries at adjacent positions to i - * - * The median is the 50th percentile value. - * - * @todo need to double check generality of the algorithm - * - * @access public - * @param numeric $p the percentile to estimate, e.g. 25 for 25th percentile - * @return mixed a numeric value on success, a PEAR_Error otherwise - * @see quartiles() - * @see median() - */ - function percentile($p) {/*{{{*/ - $count = $this->count(); - if (PEAR::isError($count)) { - return $count; - } - if ($this->_dataOption == STATS_DATA_CUMMULATIVE) { - $data =& $this->_dataExpanded; - } else { - $data =& $this->_data; - } - $obsidx = $p * ($count + 1) / 100; - if (intval($obsidx) == $obsidx) { - return $data[($obsidx - 1)]; - } elseif ($obsidx < 1) { - return $data[0]; - } elseif ($obsidx > $count) { - return $data[($count - 1)]; - } else { - $left = floor($obsidx - 1); - $right = ceil($obsidx - 1); - return ($data[$left] + $data[$right]) / 2; - } - }/*}}}*/ - - // private methods - - /** - * Utility function to calculate: SUM { (xi - mean)^n } - * - * @access private - * @param numeric $power the exponent - * @param optional double $mean the data set mean value - * @return mixed the sum on success, a PEAR_Error object otherwise - * - * @see stDev() - * @see variaceWithMean(); - * @see skewness(); - * @see kurtosis(); - */ - function __sumdiff($power, $mean=null) {/*{{{*/ - if ($this->_data == null) { - return PEAR::raiseError('data has not been set'); - } - if (is_null($mean)) { - $mean = $this->mean(); - if (PEAR::isError($mean)) { - return $mean; - } - } - $sdiff = 0; - if ($this->_dataOption == STATS_DATA_CUMMULATIVE) { - foreach ($this->_data as $val=>$freq) { - $sdiff += $freq * pow((double)($val - $mean), (double)$power); - } - } else { - foreach ($this->_data as $val) - $sdiff += pow((double)($val - $mean), (double)$power); - } - return $sdiff; - }/*}}}*/ - - /** - * Utility function to calculate the variance with or without - * a fixed mean - * - * @access private - * @param $mean the fixed mean to use, null as default - * @return mixed a numeric value on success, a PEAR_Error otherwise - * @see variance() - * @see varianceWithMean() - */ - function __calcVariance($mean = null) {/*{{{*/ - if ($this->_data == null) { - return PEAR::raiseError('data has not been set'); - } - $sumdiff2 = $this->__sumdiff(2, $mean); - if (PEAR::isError($sumdiff2)) { - return $sumdiff2; - } - $count = $this->count(); - if (PEAR::isError($count)) { - return $count; - } - if ($count == 1) { - return PEAR::raiseError('cannot calculate variance of a singe data point'); - } - return ($sumdiff2 / ($count - 1)); - }/*}}}*/ - - /** - * Utility function to calculate the absolute deviation with or without - * a fixed mean - * - * @access private - * @param $mean the fixed mean to use, null as default - * @return mixed a numeric value on success, a PEAR_Error otherwise - * @see absDev() - * @see absDevWithMean() - */ - function __calcAbsoluteDeviation($mean = null) {/*{{{*/ - if ($this->_data == null) { - return PEAR::raiseError('data has not been set'); - } - $count = $this->count(); - if (PEAR::isError($count)) { - return $count; - } - $sumabsdev = $this->__sumabsdev($mean); - if (PEAR::isError($sumabsdev)) { - return $sumabsdev; - } - return $sumabsdev / $count; - }/*}}}*/ - - /** - * Utility function to calculate: SUM { | xi - mean | } - * - * @access private - * @param optional double $mean the mean value for the set or population - * @return mixed the sum on success, a PEAR_Error object otherwise - * - * @see absDev() - * @see absDevWithMean() - */ - function __sumabsdev($mean=null) {/*{{{*/ - if ($this->_data == null) { - return PEAR::raiseError('data has not been set'); - } - if (is_null($mean)) { - $mean = $this->mean(); - } - $sdev = 0; - if ($this->_dataOption == STATS_DATA_CUMMULATIVE) { - foreach ($this->_data as $val=>$freq) { - $sdev += $freq * abs($val - $mean); - } - } else { - foreach ($this->_data as $val) { - $sdev += abs($val - $mean); - } - } - return $sdev; - }/*}}}*/ - - /** - * Utility function to format a PEAR_Error to be used by calc(), - * calcBasic() and calcFull() - * - * @access private - * @param mixed $v value to be formatted - * @param boolean $returnErrorObject whether the raw PEAR_Error (when true, default), - * or only the error message will be returned (when false) - * @return mixed if the value is a PEAR_Error object, and $useErrorObject - * is false, then a string with the error message will be returned, - * otherwise the value will not be modified and returned as passed. - */ - function __format($v, $useErrorObject=true) {/*{{{*/ - if (PEAR::isError($v) && $useErrorObject == false) { - return $v->getMessage(); - } else { - return $v; - } - }/*}}}*/ - - /** - * Utility function to validate the data and modify it - * according to the current null handling option - * - * @access private - * @return mixed true on success, a PEAR_Error object otherwise - * - * @see setData() - */ - function _validate() {/*{{{*/ - $flag = ($this->_dataOption == STATS_DATA_CUMMULATIVE); - foreach ($this->_data as $key=>$value) { - $d = ($flag) ? $key : $value; - $v = ($flag) ? $value : $key; - if (!is_numeric($d)) { - switch ($this->_nullOption) { - case STATS_IGNORE_NULL : - unset($this->_data["$key"]); - break; - case STATS_USE_NULL_AS_ZERO: - if ($flag) { - unset($this->_data["$key"]); - $this->_data[0] += $v; - } else { - $this->_data[$key] = 0; - } - break; - case STATS_REJECT_NULL : - default: - return PEAR::raiseError('data rejected, contains NULL values'); - break; - } - } - } - if ($flag) { - ksort($this->_data); - $this->_dataExpanded = array(); - foreach ($this->_data as $val=>$freq) { - $this->_dataExpanded = array_pad($this->_dataExpanded, count($this->_dataExpanded) + $freq, $val); - } - sort($this->_dataExpanded); - } else { - sort($this->_data); - } - return true; - }/*}}}*/ - -}/*}}}*/ - -// vim: ts=4:sw=4:et: -// vim6: fdl=1: fdm=marker: - -?> diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/benchmark.php b/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/benchmark.php deleted file mode 100644 index 1b963b46be2..00000000000 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/benchmark.php +++ /dev/null @@ -1,263 +0,0 @@ -stat->setData($times); - $stats = $this->stat->calcFull(); - - echo '
'; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo '
n:' . $stats['count'] . '
Mean:' . $stats['mean'] . '
Min.:' . $stats['min'] . '
Max.:' . $stats['max'] . '
σ:' . $stats['stdev'] . '
Variance:' . $stats['variance'] . '
Range:' . $stats['range'] . '
'; - - return $stats; - } // function displayStats() - - - function runEig($n = 4, $t = 100) { - $times = array(); - - for ($i = 0; $i < $t; ++$i) { - $M = Matrix::random($n, $n); - $start_time = $this->microtime_float(); - $E = new EigenvalueDecomposition($M); - $stop_time = $this->microtime_float(); - $times[] = $stop_time - $start_time; - } - - return $times; - } // function runEig() - - - function runLU($n = 4, $t = 100) { - $times = array(); - - for ($i = 0; $i < $t; ++$i) { - $M = Matrix::random($n, $n); - $start_time = $this->microtime_float(); - $E = new LUDecomposition($M); - $stop_time = $this->microtime_float(); - $times[] = $stop_time - $start_time; - } - - return $times; - } // function runLU() - - - function runQR($n = 4, $t = 100) { - $times = array(); - - for ($i = 0; $i < $t; ++$i) { - $M = Matrix::random($n, $n); - $start_time = $this->microtime_float(); - $E = new QRDecomposition($M); - $stop_time = $this->microtime_float(); - $times[] = $stop_time - $start_time; - } - - return $times; - } // function runQR() - - - function runCholesky($n = 4, $t = 100) { - $times = array(); - - for ($i = 0; $i < $t; ++$i) { - $M = Matrix::random($n, $n); - $start_time = $this->microtime_float(); - $E = new CholeskyDecomposition($M); - $stop_time = $this->microtime_float(); - $times[] = $stop_time - $start_time; - } - - return $times; - } // function runCholesky() - - - function runSVD($n = 4, $t = 100) { - $times = array(); - - for ($i = 0; $i < $t; ++$i) { - $M = Matrix::random($n, $n); - $start_time = $this->microtime_float(); - $E = new SingularValueDecomposition($M); - $stop_time = $this->microtime_float(); - $times[] = $stop_time - $start_time; - } - - return $times; - } // function runSVD() - - - function run() { - $n = 8; - $t = 16; - $sum = 0; - echo "Cholesky decomposition: $t random {$n}x{$n} matrices
"; - $r = $this->displayStats($this->runCholesky($n, $t)); - $sum += $r['mean'] * $n; - - echo '
'; - - echo "Eigenvalue decomposition: $t random {$n}x{$n} matrices
"; - $r = $this->displayStats($this->runEig($n, $t)); - $sum += $r['mean'] * $n; - - echo '
'; - - echo "LU decomposition: $t random {$n}x{$n} matrices
"; - $r = $this->displayStats($this->runLU($n, $t)); - $sum += $r['mean'] * $n; - - echo '
'; - - echo "QR decomposition: $t random {$n}x{$n} matrices
"; - $r = $this->displayStats($this->runQR($n, $t)); - $sum += $r['mean'] * $n; - - echo '
'; - - echo "Singular Value decomposition: $t random {$n}x{$n} matrices
"; - $r = $this->displayStats($this->runSVD($n, $t)); - $sum += $r['mean'] * $n; - - return $sum; - } // function run() - - - public function __construct() { - $this->stat = new Base(); - } // function Benchmark() - -} // class Benchmark (end MagicSquareExample) - - -$benchmark = new Benchmark(); - -switch($_REQUEST['decomposition']) { - case 'cholesky': - $m = array(); - for ($i = 2; $i <= 8; $i *= 2) { - $t = 32 / $i; - echo "Cholesky decomposition: $t random {$i}x{$i} matrices
"; - $s = $benchmark->displayStats($benchmark->runCholesky($i, $t)); - $m[$i] = $s['mean']; - echo "
"; - } - echo '
';
-		foreach($m as $x => $y) {
-			echo "$x\t" . 1000*$y . "\n";
-		}
-		echo '
'; - break; - case 'eigenvalue': - $m = array(); - for ($i = 2; $i <= 8; $i *= 2) { - $t = 32 / $i; - echo "Eigenvalue decomposition: $t random {$i}x{$i} matrices
"; - $s = $benchmark->displayStats($benchmark->runEig($i, $t)); - $m[$i] = $s['mean']; - echo "
"; - } - echo '
';
-		foreach($m as $x => $y) {
-			echo "$x\t" . 1000*$y . "\n";
-		}
-		echo '
'; - break; - case 'lu': - $m = array(); - for ($i = 2; $i <= 8; $i *= 2) { - $t = 32 / $i; - echo "LU decomposition: $t random {$i}x{$i} matrices
"; - $s = $benchmark->displayStats($benchmark->runLU($i, $t)); - $m[$i] = $s['mean']; - echo "
"; - } - echo '
';
-		foreach($m as $x => $y) {
-			echo "$x\t" . 1000*$y . "\n";
-		}
-		echo '
'; - break; - case 'qr': - $m = array(); - for ($i = 2; $i <= 8; $i *= 2) { - $t = 32 / $i; - echo "QR decomposition: $t random {$i}x{$i} matrices
"; - $s = $benchmark->displayStats($benchmark->runQR($i, $t)); - $m[$i] = $s['mean']; - echo "
"; - } - echo '
';
-		foreach($m as $x => $y) {
-			echo "$x\t" . 1000*$y . "\n";
-		}
-		echo '
'; - break; - case 'svd': - $m = array(); - for($i = 2; $i <= 8; $i *= 2) { - $t = 32 / $i; - echo "Singular value decomposition: $t random {$i}x{$i} matrices
"; - $s = $benchmark->displayStats($benchmark->runSVD($i, $t)); - $m[$i] = $s['mean']; - echo "
"; - } - echo '
';
-		foreach($m as $x => $y) {
-			echo "$x\t" . 1000*$y . "\n";
-		}
-		echo '
'; - break; - case 'all': - $s = $benchmark->run(); - print("
Total: {$s}s
"); - break; - default: - ?> - - $n+1 -*/ -function polyfit($X, $Y, $n) { - for ($i = 0; $i < sizeof($X); ++$i) - for ($j = 0; $j <= $n; ++$j) - $A[$i][$j] = pow($X[$i], $j); - for ($i=0; $i < sizeof($Y); ++$i) - $B[$i] = array($Y[$i]); - $matrixA = new Matrix($A); - $matrixB = new Matrix($B); - $C = $matrixA->solve($matrixB); - return $C->getMatrix(0, $n, 0, 1); -} - -function printpoly( $C = null ) { - for($i = $C->m - 1; $i >= 0; --$i) { - $r = $C->get($i, 0); - if ( abs($r) <= pow(10, -9) ) - $r = 0; - if ($i == $C->m - 1) - echo $r . "x$i"; - else if ($i < $C->m - 1) - echo " + " . $r . "x$i"; - else if ($i == 0) - echo " + " . $r; - } -} - -$X = array(0,1,2,3,4,5); -$Y = array(4,3,12,67,228, 579); -$points = new Matrix(array($X, $Y)); -$points->toHTML(); -printpoly(polyfit($X, $Y, 4)); - -echo '
'; - -$X = array(0,1,2,3,4,5); -$Y = array(1,2,5,10,17, 26); -$points = new Matrix(array($X, $Y)); -$points->toHTML(); -printpoly(polyfit($X, $Y, 2)); - -echo '
'; - -$X = array(0,1,2,3,4,5,6); -$Y = array(-90,-104,-178,-252,-26, 1160, 4446); -$points = new Matrix(array($X, $Y)); -$points->toHTML(); -printpoly(polyfit($X, $Y, 5)); - -echo '
'; - -$X = array(0,1,2,3,4); -$Y = array(mt_rand(0, 10), mt_rand(40, 80), mt_rand(240, 400), mt_rand(1800, 2215), mt_rand(8000, 9000)); -$points = new Matrix(array($X, $Y)); -$points->toHTML(); -printpoly(polyfit($X, $Y, 3)); -?> diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/tile.php b/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/tile.php deleted file mode 100644 index 7a47ea57b2a..00000000000 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/examples/tile.php +++ /dev/null @@ -1,78 +0,0 @@ -getArray(); - print_r($xArray); - - $countRow = 0; - $countColumn = 0; - - $m = $X->getRowDimension(); - $n = $X->getColumnDimension(); - - if( $rowWise<1 || $colWise<1 ){ - die("tile : Array index is out-of-bound."); - } - - $newRowDim = $m*$rowWise; - $newColDim = $n*$colWise; - - $result = array(); - - for($i=0 ; $i<$newRowDim; ++$i) { - - $holder = array(); - - for($j=0 ; $j<$newColDim ; ++$j) { - - $holder[$j] = $xArray[$countRow][$countColumn++]; - - // reset the column-index to zero to avoid reference to out-of-bound index in xArray[][] - - if($countColumn == $n) { $countColumn = 0; } - - } // end for - - ++$countRow; - - // reset the row-index to zero to avoid reference to out-of-bound index in xArray[][] - - if($countRow == $m) { $countRow = 0; } - - $result[$i] = $holder; - - } // end for - - return new Matrix($result); - -} - - -$X =array(1,2,3,4,5,6,7,8,9); -$nRow = 3; -$nCol = 3; -$tiled_matrix = tile(new Matrix($X), $nRow, $nCol); -echo "
";
-print_r($tiled_matrix);
-echo "
"; -?> diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/tests/TestMatrix.php b/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/tests/TestMatrix.php deleted file mode 100644 index 5290ceb5af2..00000000000 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/tests/TestMatrix.php +++ /dev/null @@ -1,415 +0,0 @@ -Testing constructors and constructor-like methods...

"; - - $A = new Matrix($columnwise, 3); - if($A instanceof Matrix) { - $this->try_success("Column-packed constructor..."); - } else - $errorCount = $this->try_failure($errorCount, "Column-packed constructor...", "Unable to construct Matrix"); - - $T = new Matrix($tvals); - if($T instanceof Matrix) - $this->try_success("2D array constructor..."); - else - $errorCount = $this->try_failure($errorCount, "2D array constructor...", "Unable to construct Matrix"); - - $A = new Matrix($columnwise, $validID); - $B = new Matrix($avals); - $tmp = $B->get(0,0); - $avals[0][0] = 0.0; - $C = $B->minus($A); - $avals[0][0] = $tmp; - $B = Matrix::constructWithCopy($avals); - $tmp = $B->get(0,0); - $avals[0][0] = 0.0; - /** check that constructWithCopy behaves properly **/ - if ( ( $tmp - $B->get(0,0) ) != 0.0 ) - $errorCount = $this->try_failure($errorCount,"constructWithCopy... ","copy not effected... data visible outside"); - else - $this->try_success("constructWithCopy... ",""); - - $I = new Matrix($ivals); - if ( $this->checkMatrices($I,Matrix::identity(3,4)) ) - $this->try_success("identity... ",""); - else - $errorCount = $this->try_failure($errorCount,"identity... ","identity Matrix not successfully created"); - - /** - * Access Methods: - * - * getColumnDimension() - * getRowDimension() - * getArray() - * getArrayCopy() - * getColumnPackedCopy() - * getRowPackedCopy() - * get(int,int) - * getMatrix(int,int,int,int) - * getMatrix(int,int,int[]) - * getMatrix(int[],int,int) - * getMatrix(int[],int[]) - * set(int,int,double) - * setMatrix(int,int,int,int,Matrix) - * setMatrix(int,int,int[],Matrix) - * setMatrix(int[],int,int,Matrix) - * setMatrix(int[],int[],Matrix) - */ - print "

Testing access methods...

"; - - $B = new Matrix($avals); - if($B->getRowDimension() == $rows) - $this->try_success("getRowDimension..."); - else - $errorCount = $this->try_failure($errorCount, "getRowDimension..."); - - if($B->getColumnDimension() == $cols) - $this->try_success("getColumnDimension..."); - else - $errorCount = $this->try_failure($errorCount, "getColumnDimension..."); - - $barray = $B->getArray(); - if($this->checkArrays($barray, $avals)) - $this->try_success("getArray..."); - else - $errorCount = $this->try_failure($errorCount, "getArray..."); - - $bpacked = $B->getColumnPackedCopy(); - if($this->checkArrays($bpacked, $columnwise)) - $this->try_success("getColumnPackedCopy..."); - else - $errorCount = $this->try_failure($errorCount, "getColumnPackedCopy..."); - - $bpacked = $B->getRowPackedCopy(); - if($this->checkArrays($bpacked, $rowwise)) - $this->try_success("getRowPackedCopy..."); - else - $errorCount = $this->try_failure($errorCount, "getRowPackedCopy..."); - - /** - * Array-like methods: - * minus - * minusEquals - * plus - * plusEquals - * arrayLeftDivide - * arrayLeftDivideEquals - * arrayRightDivide - * arrayRightDivideEquals - * arrayTimes - * arrayTimesEquals - * uminus - */ - print "

Testing array-like methods...

"; - - /** - * I/O methods: - * read - * print - * serializable: - * writeObject - * readObject - */ - print "

Testing I/O methods...

"; - - /** - * Test linear algebra methods - */ - echo "

Testing linear algebra methods...

"; - - $A = new Matrix($columnwise, 3); - if( $this->checkMatrices($A->transpose(), $T) ) - $this->try_success("Transpose check..."); - else - $errorCount = $this->try_failure($errorCount, "Transpose check...", "Matrices are not equal"); - - if($this->checkScalars($A->norm1(), $columnsummax)) - $this->try_success("Maximum column sum..."); - else - $errorCount = $this->try_failure($errorCount, "Maximum column sum...", "Incorrect: " . $A->norm1() . " != " . $columnsummax); - - if($this->checkScalars($A->normInf(), $rowsummax)) - $this->try_success("Maximum row sum..."); - else - $errorCount = $this->try_failure($errorCount, "Maximum row sum...", "Incorrect: " . $A->normInf() . " != " . $rowsummax ); - - if($this->checkScalars($A->normF(), sqrt($sumofsquares))) - $this->try_success("Frobenius norm..."); - else - $errorCount = $this->try_failure($errorCount, "Frobenius norm...", "Incorrect:" . $A->normF() . " != " . sqrt($sumofsquares)); - - if($this->checkScalars($A->trace(), $sumofdiagonals)) - $this->try_success("Matrix trace..."); - else - $errorCount = $this->try_failure($errorCount, "Matrix trace...", "Incorrect: " . $A->trace() . " != " . $sumofdiagonals); - - $B = $A->getMatrix(0, $A->getRowDimension(), 0, $A->getRowDimension()); - if( $B->det() == 0 ) - $this->try_success("Matrix determinant..."); - else - $errorCount = $this->try_failure($errorCount, "Matrix determinant...", "Incorrect: " . $B->det() . " != " . 0); - - $A = new Matrix($columnwise,3); - $SQ = new Matrix($square); - if ($this->checkMatrices($SQ, $A->times($A->transpose()))) - $this->try_success("times(Matrix)..."); - else { - $errorCount = $this->try_failure($errorCount, "times(Matrix)...", "Unable to multiply matrices"); - $SQ->toHTML(); - $AT->toHTML(); - } - - $A = new Matrix($columnwise, 4); - - $QR = $A->qr(); - $R = $QR->getR(); - $Q = $QR->getQ(); - if($this->checkMatrices($A, $Q->times($R))) - $this->try_success("QRDecomposition...",""); - else - $errorCount = $this->try_failure($errorCount,"QRDecomposition...","incorrect qr decomposition calculation"); - - $A = new Matrix($columnwise, 4); - $SVD = $A->svd(); - $U = $SVD->getU(); - $S = $SVD->getS(); - $V = $SVD->getV(); - if ($this->checkMatrices($A, $U->times($S->times($V->transpose())))) - $this->try_success("SingularValueDecomposition...",""); - else - $errorCount = $this->try_failure($errorCount,"SingularValueDecomposition...","incorrect singular value decomposition calculation"); - - $n = $A->getColumnDimension(); - $A = $A->getMatrix(0,$n-1,0,$n-1); - $A->set(0,0,0.); - - $LU = $A->lu(); - $L = $LU->getL(); - if ( $this->checkMatrices($A->getMatrix($LU->getPivot(),0,$n-1), $L->times($LU->getU())) ) - $this->try_success("LUDecomposition...",""); - else - $errorCount = $this->try_failure($errorCount,"LUDecomposition...","incorrect LU decomposition calculation"); - - $X = $A->inverse(); - if ( $this->checkMatrices($A->times($X),Matrix::identity(3,3)) ) - $this->try_success("inverse()...",""); - else - $errorCount = $this->try_failure($errorCount, "inverse()...","incorrect inverse calculation"); - - $DEF = new Matrix($rankdef); - if($this->checkScalars($DEF->rank(), min($DEF->getRowDimension(), $DEF->getColumnDimension())-1)) - $this->try_success("Rank..."); - else - $this->try_failure("Rank...", "incorrect rank calculation"); - - $B = new Matrix($condmat); - $SVD = $B->svd(); - $singularvalues = $SVD->getSingularValues(); - if($this->checkScalars($B->cond(), $singularvalues[0]/$singularvalues[min($B->getRowDimension(), $B->getColumnDimension())-1])) - $this->try_success("Condition number..."); - else - $this->try_failure("Condition number...", "incorrect condition number calculation"); - - $SUB = new Matrix($subavals); - $O = new Matrix($SUB->getRowDimension(),1,1.0); - $SOL = new Matrix($sqSolution); - $SQ = $SUB->getMatrix(0,$SUB->getRowDimension()-1,0,$SUB->getRowDimension()-1); - if ( $this->checkMatrices($SQ->solve($SOL),$O) ) - $this->try_success("solve()...",""); - else - $errorCount = $this->try_failure($errorCount,"solve()...","incorrect lu solve calculation"); - - $A = new Matrix($pvals); - $Chol = $A->chol(); - $L = $Chol->getL(); - if ( $this->checkMatrices($A, $L->times($L->transpose())) ) - $this->try_success("CholeskyDecomposition...",""); - else - $errorCount = $this->try_failure($errorCount,"CholeskyDecomposition...","incorrect Cholesky decomposition calculation"); - - $X = $Chol->solve(Matrix::identity(3,3)); - if ( $this->checkMatrices($A->times($X), Matrix::identity(3,3)) ) - $this->try_success("CholeskyDecomposition solve()...",""); - else - $errorCount = $this->try_failure($errorCount,"CholeskyDecomposition solve()...","incorrect Choleskydecomposition solve calculation"); - - $Eig = $A->eig(); - $D = $Eig->getD(); - $V = $Eig->getV(); - if( $this->checkMatrices($A->times($V),$V->times($D)) ) - $this->try_success("EigenvalueDecomposition (symmetric)...",""); - else - $errorCount = $this->try_failure($errorCount,"EigenvalueDecomposition (symmetric)...","incorrect symmetric Eigenvalue decomposition calculation"); - - $A = new Matrix($evals); - $Eig = $A->eig(); - $D = $Eig->getD(); - $V = $Eig->getV(); - if ( $this->checkMatrices($A->times($V),$V->times($D)) ) - $this->try_success("EigenvalueDecomposition (nonsymmetric)...",""); - else - $errorCount = $this->try_failure($errorCount,"EigenvalueDecomposition (nonsymmetric)...","incorrect nonsymmetric Eigenvalue decomposition calculation"); - - print("{$errorCount} total errors."); - } - - /** - * Print appropriate messages for successful outcome try - * @param string $s - * @param string $e - */ - function try_success($s, $e = "") { - print "> ". $s ."success
"; - if ($e != "") - print "> Message: ". $e ."
"; - } - - /** - * Print appropriate messages for unsuccessful outcome try - * @param int $count - * @param string $s - * @param string $e - * @return int incremented counter - */ - function try_failure($count, $s, $e="") { - print "> ". $s ."*** failure ***
> Message: ". $e ."
"; - return ++$count; - } - - /** - * Print appropriate messages for unsuccessful outcome try - * @param int $count - * @param string $s - * @param string $e - * @return int incremented counter - */ - function try_warning($count, $s, $e="") { - print "> ". $s ."*** warning ***
> Message: ". $e ."
"; - return ++$count; - } - - /** - * Check magnitude of difference of "scalars". - * @param float $x - * @param float $y - */ - function checkScalars($x, $y) { - $eps = pow(2.0,-52.0); - if ($x == 0 & abs($y) < 10*$eps) return; - if ($y == 0 & abs($x) < 10*$eps) return; - if (abs($x-$y) > 10 * $eps * max(abs($x),abs($y))) - return false; - else - return true; - } - - /** - * Check norm of difference of "vectors". - * @param float $x[] - * @param float $y[] - */ - function checkVectors($x, $y) { - $nx = count($x); - $ny = count($y); - if ($nx == $ny) - for($i=0; $i < $nx; ++$i) - $this->checkScalars($x[$i],$y[$i]); - else - die("Attempt to compare vectors of different lengths"); - } - - /** - * Check norm of difference of "arrays". - * @param float $x[][] - * @param float $y[][] - */ - function checkArrays($x, $y) { - $A = new Matrix($x); - $B = new Matrix($y); - return $this->checkMatrices($A,$B); - } - - /** - * Check norm of difference of "matrices". - * @param matrix $X - * @param matrix $Y - */ - function checkMatrices($X = null, $Y = null) { - if( $X == null || $Y == null ) - return false; - - $eps = pow(2.0,-52.0); - if ($X->norm1() == 0. & $Y->norm1() < 10*$eps) return true; - if ($Y->norm1() == 0. & $X->norm1() < 10*$eps) return true; - - $A = $X->minus($Y); - - if ($A->norm1() > 1000 * $eps * max($X->norm1(),$Y->norm1())) - die("The norm of (X-Y) is too large: ".$A->norm1()); - else - return true; - } - -} - -$test = new TestMatrix; -?> diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/utils/Maths.php b/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/utils/Maths.php index f5e2a372165..aa09a8bbbfa 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/utils/Maths.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/JAMA/utils/Maths.php @@ -35,7 +35,7 @@ function hypot() { if (is_numeric($d)) { $s += pow($d, 2); } else { - throw new Exception(JAMAError(ArgumentTypeException)); + throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException)); } } return sqrt($s); diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/OLE.php b/htdocs/includes/phpexcel/PHPExcel/Shared/OLE.php index a5c8dd1d000..9796282a806 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/OLE.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/OLE.php @@ -97,18 +97,18 @@ class PHPExcel_Shared_OLE { $fh = fopen($file, "r"); if (!$fh) { - throw new Exception("Can't open file $file"); + throw new PHPExcel_Reader_Exception("Can't open file $file"); } $this->_file_handle = $fh; $signature = fread($fh, 8); if ("\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" != $signature) { - throw new Exception("File doesn't seem to be an OLE container."); + throw new PHPExcel_Reader_Exception("File doesn't seem to be an OLE container."); } fseek($fh, 28); if (fread($fh, 2) != "\xFE\xFF") { // This shouldn't be a problem in practice - throw new Exception("Only Little-Endian encoding is supported."); + throw new PHPExcel_Reader_Exception("Only Little-Endian encoding is supported."); } // Size of blocks and short blocks in bytes $this->bigBlockSize = pow(2, self::_readInt2($fh)); diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/OLE/ChainedBlockStream.php b/htdocs/includes/phpexcel/PHPExcel/Shared/OLE/ChainedBlockStream.php index 4e233ad0436..3dcd7e1dad0 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/OLE/ChainedBlockStream.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/OLE/ChainedBlockStream.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (C) 2006 - 2012 PHPExcel + * Copyright (C) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,7 +22,7 @@ * @package PHPExcel_Shared_OLE * @copyright Copyright (c) 2006 - 2007 Christian Schmidt * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ /** @@ -161,14 +161,15 @@ class PHPExcel_Shared_OLE_ChainedBlockStream */ public function stream_eof() { - $eof = $this->pos >= strlen($this->data); - // Workaround for bug in PHP 5.0.x: http://bugs.php.net/27508 - if (version_compare(PHP_VERSION, '5.0', '>=') && - version_compare(PHP_VERSION, '5.1', '<')) { - - $eof = !$eof; - } - return $eof; +// As we don't support below 5.2 anymore, this is simply redundancy and overhead +// $eof = $this->pos >= strlen($this->data); +// // Workaround for bug in PHP 5.0.x: http://bugs.php.net/27508 +// if (version_compare(PHP_VERSION, '5.0', '>=') && +// version_compare(PHP_VERSION, '5.1', '<')) { +// $eof = !$eof; +// } +// return $eof; + return $this->pos >= strlen($this->data); } /** diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/OLE/PPS/Root.php b/htdocs/includes/phpexcel/PHPExcel/Shared/OLE/PPS/Root.php index 7046a0a3aeb..8c6dcda078a 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/OLE/PPS/Root.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/OLE/PPS/Root.php @@ -84,13 +84,13 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS $this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root"); $this->_FILEH_ = fopen($this->_tmp_filename,"w+b"); if ($this->_FILEH_ == false) { - throw new Exception("Can't create temporary file."); + throw new PHPExcel_Writer_Exception("Can't create temporary file."); } } else { $this->_FILEH_ = fopen($filename, "wb"); } if ($this->_FILEH_ == false) { - throw new Exception("Can't open $filename. It may be in use or protected."); + throw new PHPExcel_Writer_Exception("Can't open $filename. It may be in use or protected."); } // Make an array of PPS's (for Save) $aList = array(); diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/OLERead.php b/htdocs/includes/phpexcel/PHPExcel/Shared/OLERead.php index 2a5eb7d7a12..c4cb7da3064 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/OLERead.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/OLERead.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,12 +20,13 @@ * * @category PHPExcel * @package PHPExcel_Shared - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ -define('IDENTIFIER_OLE', pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1)); +defined('IDENTIFIER_OLE') || + define('IDENTIFIER_OLE', pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1)); class PHPExcel_Shared_OLERead { private $data = ''; @@ -70,23 +71,27 @@ class PHPExcel_Shared_OLERead { * Read the file * * @param $sFileName string Filename - * @throws Exception + * @throws PHPExcel_Reader_Exception */ public function read($sFileName) { // Check if file exists and is readable if(!is_readable($sFileName)) { - throw new Exception("Could not open " . $sFileName . " for reading! File does not exist, or it is not readable."); + throw new PHPExcel_Reader_Exception("Could not open " . $sFileName . " for reading! File does not exist, or it is not readable."); + } + + // Get the file identifier + // Don't bother reading the whole file until we know it's a valid OLE file + $this->data = file_get_contents($sFileName, FALSE, NULL, 0, 8); + + // Check OLE identifier + if ($this->data != self::IDENTIFIER_OLE) { + throw new PHPExcel_Reader_Exception('The filename ' . $sFileName . ' is not recognised as an OLE file'); } // Get the file data $this->data = file_get_contents($sFileName); - // Check OLE identifier - if (substr($this->data, 0, 8) != self::IDENTIFIER_OLE) { - throw new Exception('The filename ' . $sFileName . ' is not recognised as an OLE file'); - } - // Total number of sectors used for the SAT $this->numBigBlockDepotBlocks = self::_GetInt4d($this->data, self::NUM_BIG_BLOCK_DEPOT_BLOCKS_POS); @@ -131,34 +136,26 @@ class PHPExcel_Shared_OLERead { } } - $pos = $index = 0; - $this->bigBlockChain = array(); - + $pos = 0; + $this->bigBlockChain = ''; $bbs = self::BIG_BLOCK_SIZE / 4; for ($i = 0; $i < $this->numBigBlockDepotBlocks; ++$i) { $pos = ($bigBlockDepotBlocks[$i] + 1) * self::BIG_BLOCK_SIZE; - for ($j = 0 ; $j < $bbs; ++$j) { - $this->bigBlockChain[$index] = self::_GetInt4d($this->data, $pos); - $pos += 4 ; - ++$index; - } + $this->bigBlockChain .= substr($this->data, $pos, 4*$bbs); + $pos += 4*$bbs; } - $pos = $index = 0; + $pos = 0; $sbdBlock = $this->sbdStartBlock; - $this->smallBlockChain = array(); - + $this->smallBlockChain = ''; while ($sbdBlock != -2) { $pos = ($sbdBlock + 1) * self::BIG_BLOCK_SIZE; - for ($j = 0; $j < $bbs; ++$j) { - $this->smallBlockChain[$index] = self::_GetInt4d($this->data, $pos); - $pos += 4; - ++$index; - } + $this->smallBlockChain .= substr($this->data, $pos, 4*$bbs); + $pos += 4*$bbs; - $sbdBlock = $this->bigBlockChain[$sbdBlock]; + $sbdBlock = self::_GetInt4d($this->bigBlockChain, $sbdBlock*4); } // read the directory stream @@ -190,7 +187,7 @@ class PHPExcel_Shared_OLERead { $pos = $block * self::SMALL_BLOCK_SIZE; $streamData .= substr($rootdata, $pos, self::SMALL_BLOCK_SIZE); - $block = $this->smallBlockChain[$block]; + $block = self::_GetInt4d($this->smallBlockChain, $block*4); } return $streamData; @@ -207,7 +204,7 @@ class PHPExcel_Shared_OLERead { while ($block != -2) { $pos = ($block + 1) * self::BIG_BLOCK_SIZE; $streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE); - $block = $this->bigBlockChain[$block]; + $block = self::_GetInt4d($this->bigBlockChain, $block*4); } return $streamData; @@ -228,7 +225,7 @@ class PHPExcel_Shared_OLERead { while ($block != -2) { $pos = ($block + 1) * self::BIG_BLOCK_SIZE; $data .= substr($this->data, $pos, self::BIG_BLOCK_SIZE); - $block = $this->bigBlockChain[$block]; + $block = self::_GetInt4d($this->bigBlockChain, $block*4); } return $data; } @@ -259,19 +256,22 @@ class PHPExcel_Shared_OLERead { $name = str_replace("\x00", "", substr($d,0,$nameSize)); + $this->props[] = array ( 'name' => $name, 'type' => $type, 'startBlock' => $startBlock, 'size' => $size); + // tmp helper to simplify checks + $upName = strtoupper($name); + // Workbook directory entry (BIFF5 uses Book, BIFF8 uses Workbook) - if (($name == 'Workbook') || ($name == 'Book') || ($name == 'WORKBOOK') || ($name == 'BOOK')) { + if (($upName === 'WORKBOOK') || ($upName === 'BOOK')) { $this->wrkbook = count($this->props) - 1; } - - // Root entry - if ($name == 'Root Entry' || $name == 'ROOT ENTRY' || $name == 'R') { + else if ( $upName === 'ROOT ENTRY' || $upName === 'R') { + // Root entry $this->rootentry = count($this->props) - 1; } diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/PasswordHasher.php b/htdocs/includes/phpexcel/PHPExcel/Shared/PasswordHasher.php index 65317d55b43..4f505a2aca6 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/PasswordHasher.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/PasswordHasher.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Shared - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Shared_PasswordHasher { @@ -46,17 +46,16 @@ class PHPExcel_Shared_PasswordHasher * @return string Hashed password */ public static function hashPassword($pPassword = '') { - $password = 0x0000; - $i = 1; // char position + $password = 0x0000; + $charPos = 1; // char position // split the plain text password in its component characters $chars = preg_split('//', $pPassword, -1, PREG_SPLIT_NO_EMPTY); foreach ($chars as $char) { - $value = ord($char) << $i; // shifted ASCII value - $rotated_bits = $value >> 15; // rotated bits beyond bit 15 - $value &= 0x7fff; // first 15 bits - $password ^= ($value | $rotated_bits); - ++$i; + $value = ord($char) << $charPos++; // shifted ASCII value + $rotated_bits = $value >> 15; // rotated bits beyond bit 15 + $value &= 0x7fff; // first 15 bits + $password ^= ($value | $rotated_bits); } $password ^= strlen($pPassword); diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/String.php b/htdocs/includes/phpexcel/PHPExcel/Shared/String.php index a62a681662a..49d217a5cbd 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/String.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/String.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Shared - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Shared_String { @@ -403,7 +403,7 @@ class PHPExcel_Shared_String * @return boolean */ public static function IsUTF8($value = '') { - return utf8_encode(utf8_decode($value)) === $value; + return $string === '' || preg_match('/^./su', $string) === 1; } /** @@ -427,14 +427,14 @@ class PHPExcel_Shared_String * although this will give wrong results for non-ASCII strings * see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect. 2.5.3 * - * @param string $value UTF-8 encoded string + * @param string $value UTF-8 encoded string + * @param mixed[] $arrcRuns Details of rich text runs in $value * @return string */ public static function UTF8toBIFF8UnicodeShort($value, $arrcRuns = array()) { // character count $ln = self::CountCharacters($value, 'UTF-8'); - // option flags if(empty($arrcRuns)){ $opt = (self::getIsIconvEnabled() || self::getIsMbstringEnabled()) ? @@ -444,10 +444,10 @@ class PHPExcel_Shared_String $data .= self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8'); } else { - $data = pack('vC', $ln, 0x08); + $data = pack('vC', $ln, 0x09); $data .= pack('v', count($arrcRuns)); // characters - $data .= $value; + $data .= self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8'); foreach ($arrcRuns as $cRun){ $data .= pack('v', $cRun['strlen']); $data .= pack('v', $cRun['fontidx']); @@ -483,7 +483,7 @@ class PHPExcel_Shared_String } /** - * Convert string from one encoding to another. First try iconv, then mbstring, or no convertion + * Convert string from one encoding to another. First try mbstring, then iconv, finally strlen * * @param string $value * @param string $to Encoding to convert to, e.g. 'UTF-8' @@ -493,14 +493,13 @@ class PHPExcel_Shared_String public static function ConvertEncoding($value, $to, $from) { if (self::getIsIconvEnabled()) { - $value = iconv($from, $to, $value); - return $value; + return iconv($from, $to, $value); } if (self::getIsMbstringEnabled()) { - $value = mb_convert_encoding($value, $to, $from); - return $value; + return mb_convert_encoding($value, $to, $from); } + if($from == 'UTF-16LE'){ return self::utf16_decode($value, false); }else if($from == 'UTF-16BE'){ @@ -525,7 +524,7 @@ class PHPExcel_Shared_String * @author Rasmus Andersson {@link http://rasmusandersson.se/} * @author vadik56 */ - public static function utf16_decode( $str, $bom_be=true ) { + public static function utf16_decode($str, $bom_be = TRUE) { if( strlen($str) < 2 ) return $str; $c0 = ord($str{0}); $c1 = ord($str{1}); @@ -550,40 +549,82 @@ class PHPExcel_Shared_String */ public static function CountCharacters($value, $enc = 'UTF-8') { - if (self::getIsIconvEnabled()) { - return iconv_strlen($value, $enc); - } - if (self::getIsMbstringEnabled()) { return mb_strlen($value, $enc); } + if (self::getIsIconvEnabled()) { + return iconv_strlen($value, $enc); + } + // else strlen return strlen($value); } /** - * Get a substring of a UTF-8 encoded string + * Get a substring of a UTF-8 encoded string. First try mbstring, then iconv, finally strlen * * @param string $pValue UTF-8 encoded string - * @param int $start Start offset - * @param int $length Maximum number of characters in substring + * @param int $pStart Start offset + * @param int $pLength Maximum number of characters in substring * @return string */ public static function Substring($pValue = '', $pStart = 0, $pLength = 0) { - if (self::getIsIconvEnabled()) { - return iconv_substr($pValue, $pStart, $pLength, 'UTF-8'); - } - if (self::getIsMbstringEnabled()) { return mb_substr($pValue, $pStart, $pLength, 'UTF-8'); } + if (self::getIsIconvEnabled()) { + return iconv_substr($pValue, $pStart, $pLength, 'UTF-8'); + } + // else substr return substr($pValue, $pStart, $pLength); } + /** + * Convert a UTF-8 encoded string to upper case + * + * @param string $pValue UTF-8 encoded string + * @return string + */ + public static function StrToUpper($pValue = '') + { + if (function_exists('mb_convert_case')) { + return mb_convert_case($pValue, MB_CASE_UPPER, "UTF-8"); + } + return strtoupper($pValue); + } + + /** + * Convert a UTF-8 encoded string to lower case + * + * @param string $pValue UTF-8 encoded string + * @return string + */ + public static function StrToLower($pValue = '') + { + if (function_exists('mb_convert_case')) { + return mb_convert_case($pValue, MB_CASE_LOWER, "UTF-8"); + } + return strtolower($pValue); + } + + /** + * Convert a UTF-8 encoded string to title/proper case + * (uppercase every first character in each word, lower case all other characters) + * + * @param string $pValue UTF-8 encoded string + * @return string + */ + public static function StrToTitle($pValue = '') + { + if (function_exists('mb_convert_case')) { + return mb_convert_case($pValue, MB_CASE_TITLE, "UTF-8"); + } + return ucwords($pValue); + } /** * Identify whether a string contains a fractional numeric value, @@ -646,6 +687,11 @@ class PHPExcel_Shared_String $localeconv = localeconv(); self::$_thousandsSeparator = ($localeconv['thousands_sep'] != '') ? $localeconv['thousands_sep'] : $localeconv['mon_thousands_sep']; + + if (self::$_thousandsSeparator == '') { + // Default to . + self::$_thousandsSeparator = ','; + } } return self::$_thousandsSeparator; } diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/TimeZone.php b/htdocs/includes/phpexcel/PHPExcel/Shared/TimeZone.php new file mode 100644 index 00000000000..d5fa2ade694 --- /dev/null +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/TimeZone.php @@ -0,0 +1,140 @@ +getTransitions(); + $transitions = array(); + foreach($allTransitions as $key => $transition) { + if ($transition['ts'] > $timestamp) { + $transitions[] = ($key > 0) ? $allTransitions[$key - 1] : $transition; + break; + } + if (empty($transitions)) { + $transitions[] = end($allTransitions); + } + } + + return $transitions; + } + + /** + * Return the Timezone offset used for date/time conversions to/from UST + * This requires both the timezone and the calculated date/time to allow for local DST + * + * @param string $timezone The timezone for finding the adjustment to UST + * @param integer $timestamp PHP date/time value + * @return integer Number of seconds for timezone adjustment + * @throws PHPExcel_Exception + */ + public static function getTimeZoneAdjustment($timezone, $timestamp) { + if ($timezone !== NULL) { + if (!self::_validateTimezone($timezone)) { + throw new PHPExcel_Exception("Invalid timezone " . $timezone); + } + } else { + $timezone = self::$_timezone; + } + + if ($timezone == 'UST') { + return 0; + } + + $objTimezone = new DateTimeZone($timezone); + if (version_compare(PHP_VERSION, '5.3.0') >= 0) { + $transitions = $objTimezone->getTransitions($timestamp,$timestamp); + } else { + $transitions = self::_getTimezoneTransitions($objTimezone, $timestamp); + } + + return (count($transitions) > 0) ? $transitions[0]['offset'] : 0; + } + +} diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/XMLWriter.php b/htdocs/includes/phpexcel/PHPExcel/Shared/XMLWriter.php index 403c0996adb..0b0b5539d47 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/XMLWriter.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/XMLWriter.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ if (!defined('DATE_W3C')) { @@ -39,7 +39,7 @@ if (!defined('DEBUGMODE_ENABLED')) { * * @category PHPExcel * @package PHPExcel_Shared - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Shared_XMLWriter extends XMLWriter { /** Temporary storage method */ diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/ZipArchive.php b/htdocs/includes/phpexcel/PHPExcel/Shared/ZipArchive.php index 56d7c391854..ab551afe946 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/ZipArchive.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/ZipArchive.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared_ZipArchive - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ if (!defined('PCLZIP_TEMPORARY_DIR')) { @@ -36,7 +36,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/PCLZip/pclzip.lib.php'; * * @category PHPExcel * @package PHPExcel_Shared_ZipArchive - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Shared_ZipArchive { @@ -105,10 +105,71 @@ class PHPExcel_Shared_ZipArchive PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"] ); if ($res == 0) { - throw new Exception("Error zipping files : " . $this->_zip->errorInfo(true)); + throw new PHPExcel_Writer_Exception("Error zipping files : " . $this->_zip->errorInfo(true)); } unlink($this->_tempDir.'/'.$filenameParts["basename"]); } + /** + * Find if given fileName exist in archive (Emulate ZipArchive locateName()) + * + * @param string $fileName Filename for the file in zip archive + * @return boolean + */ + public function locateName($fileName) + { + $list = $this->_zip->listContent(); + $listCount = count($list); + $list_index = -1; + for ($i = 0; $i < $listCount; ++$i) { + if (strtolower($list[$i]["filename"]) == strtolower($fileName) || + strtolower($list[$i]["stored_filename"]) == strtolower($fileName)) { + $list_index = $i; + break; + } + } + return ($list_index > -1); + } + + /** + * Extract file from archive by given fileName (Emulate ZipArchive getFromName()) + * + * @param string $fileName Filename for the file in zip archive + * @return string $contents File string contents + */ + public function getFromName($fileName) + { + $list = $this->_zip->listContent(); + $listCount = count($list); + $list_index = -1; + for ($i = 0; $i < $listCount; ++$i) { + if (strtolower($list[$i]["filename"]) == strtolower($fileName) || + strtolower($list[$i]["stored_filename"]) == strtolower($fileName)) { + $list_index = $i; + break; + } + } + + $extracted = ""; + if ($list_index != -1) { + $extracted = $this->_zip->extractByIndex($list_index, PCLZIP_OPT_EXTRACT_AS_STRING); + } else { + $filename = substr($fileName, 1); + $list_index = -1; + for ($i = 0; $i < $listCount; ++$i) { + if (strtolower($list[$i]["filename"]) == strtolower($fileName) || + strtolower($list[$i]["stored_filename"]) == strtolower($fileName)) { + $list_index = $i; + break; + } + } + $extracted = $this->_zip->extractByIndex($list_index, PCLZIP_OPT_EXTRACT_AS_STRING); + } + if ((is_array($extracted)) && ($extracted != 0)) { + $contents = $extracted[0]["content"]; + } + + return $contents; + } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/ZipStreamWrapper.php b/htdocs/includes/phpexcel/PHPExcel/Shared/ZipStreamWrapper.php index 58d7e020a1c..696072bb0bd 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/ZipStreamWrapper.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/ZipStreamWrapper.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Shared - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Shared_ZipStreamWrapper { /** @@ -82,7 +82,7 @@ class PHPExcel_Shared_ZipStreamWrapper { public function stream_open($path, $mode, $options, &$opened_path) { // Check for mode if ($mode{0} != 'r') { - throw new Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.'); + throw new PHPExcel_Reader_Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.'); } $pos = strrpos($path, '#'); @@ -100,6 +100,24 @@ class PHPExcel_Shared_ZipStreamWrapper { return true; } + /** + * Implements support for fstat(). + * + * @return boolean + */ + public function statName() { + return $this->_fileNameInArchive; + } + + /** + * Implements support for fstat(). + * + * @return boolean + */ + public function url_stat() { + return $this->statName( $this->_fileNameInArchive ); + } + /** * Implements support for fstat(). * diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/trend/bestFitClass.php b/htdocs/includes/phpexcel/PHPExcel/Shared/trend/bestFitClass.php index d86424f1a0d..088ce067cb1 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/trend/bestFitClass.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/trend/bestFitClass.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared_Trend - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Shared_Trend - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Best_Fit { diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/trend/exponentialBestFitClass.php b/htdocs/includes/phpexcel/PHPExcel/Shared/trend/exponentialBestFitClass.php index cc44678bea8..44c7aee8519 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/trend/exponentialBestFitClass.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/trend/exponentialBestFitClass.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared_Trend - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -34,7 +34,7 @@ require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php'); * * @category PHPExcel * @package PHPExcel_Shared_Trend - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit { diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/trend/linearBestFitClass.php b/htdocs/includes/phpexcel/PHPExcel/Shared/trend/linearBestFitClass.php index 9aa44fec24e..00da841168f 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/trend/linearBestFitClass.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/trend/linearBestFitClass.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared_Trend - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -34,7 +34,7 @@ require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php'); * * @category PHPExcel * @package PHPExcel_Shared_Trend - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit { diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/trend/logarithmicBestFitClass.php b/htdocs/includes/phpexcel/PHPExcel/Shared/trend/logarithmicBestFitClass.php index 38aaa880381..ac9c1e200bf 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/trend/logarithmicBestFitClass.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/trend/logarithmicBestFitClass.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared_Trend - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -34,7 +34,7 @@ require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php'); * * @category PHPExcel * @package PHPExcel_Shared_Trend - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit { diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/trend/polynomialBestFitClass.php b/htdocs/includes/phpexcel/PHPExcel/Shared/trend/polynomialBestFitClass.php index 7c05faf61be..a5079752927 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/trend/polynomialBestFitClass.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/trend/polynomialBestFitClass.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared_Trend - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -35,7 +35,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/Matrix.php'; * * @category PHPExcel * @package PHPExcel_Shared_Trend - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit { diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/trend/powerBestFitClass.php b/htdocs/includes/phpexcel/PHPExcel/Shared/trend/powerBestFitClass.php index 20b36741e3f..158e0c4592e 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/trend/powerBestFitClass.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/trend/powerBestFitClass.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared_Trend - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -34,7 +34,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php'; * * @category PHPExcel * @package PHPExcel_Shared_Trend - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit { diff --git a/htdocs/includes/phpexcel/PHPExcel/Shared/trend/trendClass.php b/htdocs/includes/phpexcel/PHPExcel/Shared/trend/trendClass.php index 63ccc04c311..d891a7dc6ca 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Shared/trend/trendClass.php +++ b/htdocs/includes/phpexcel/PHPExcel/Shared/trend/trendClass.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Shared_Trend - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -38,7 +38,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/polynomialBestFitClass.php'; * * @category PHPExcel * @package PHPExcel_Shared_Trend - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class trendClass { diff --git a/htdocs/includes/phpexcel/PHPExcel/Style.php b/htdocs/includes/phpexcel/PHPExcel/Style.php index 2fdef0e4cc9..715ae11319c 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Style.php +++ b/htdocs/includes/phpexcel/PHPExcel/Style.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Style - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.8.0, 2014-03-02 */ @@ -31,197 +31,147 @@ * * @category PHPExcel * @package PHPExcel_Style - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Style implements PHPExcel_IComparable +class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable { - /** - * Font - * - * @var PHPExcel_Style_Font - */ - private $_font; + /** + * Font + * + * @var PHPExcel_Style_Font + */ + protected $_font; - /** - * Fill - * - * @var PHPExcel_Style_Fill - */ - private $_fill; + /** + * Fill + * + * @var PHPExcel_Style_Fill + */ + protected $_fill; - /** - * Borders - * - * @var PHPExcel_Style_Borders - */ - private $_borders; + /** + * Borders + * + * @var PHPExcel_Style_Borders + */ + protected $_borders; - /** - * Alignment - * - * @var PHPExcel_Style_Alignment - */ - private $_alignment; + /** + * Alignment + * + * @var PHPExcel_Style_Alignment + */ + protected $_alignment; - /** - * Number Format - * - * @var PHPExcel_Style_NumberFormat - */ - private $_numberFormat; + /** + * Number Format + * + * @var PHPExcel_Style_NumberFormat + */ + protected $_numberFormat; - /** - * Conditional styles - * - * @var PHPExcel_Style_Conditional[] - */ - private $_conditionalStyles; + /** + * Conditional styles + * + * @var PHPExcel_Style_Conditional[] + */ + protected $_conditionalStyles; - /** - * Protection - * - * @var PHPExcel_Style_Protection - */ - private $_protection; + /** + * Protection + * + * @var PHPExcel_Style_Protection + */ + protected $_protection; - /** - * Style supervisor? - * - * @var boolean - */ - private $_isSupervisor; + /** + * Index of style in collection. Only used for real style. + * + * @var int + */ + protected $_index; - /** - * Parent. Only used for style supervisor - * - * @var PHPExcel - */ - private $_parent; - - /** - * Index of style in collection. Only used for real style. - * - * @var int - */ - private $_index; + /** + * Use Quote Prefix when displaying in cell editor. Only used for real style. + * + * @var boolean + */ + protected $_quotePrefix = false; /** * Create a new PHPExcel_Style - * - * @param boolean $isSupervisor Flag indicating if this is a supervisor or not - * Leave this value at default unless you understand exactly what - * its ramifications are - * @param boolean $isConditional Flag indicating if this is a conditional style or not - * Leave this value at default unless you understand exactly what - * its ramifications are + * + * @param boolean $isSupervisor Flag indicating if this is a supervisor or not + * Leave this value at default unless you understand exactly what + * its ramifications are + * @param boolean $isConditional Flag indicating if this is a conditional style or not + * Leave this value at default unless you understand exactly what + * its ramifications are */ public function __construct($isSupervisor = false, $isConditional = false) { - // Supervisor? - $this->_isSupervisor = $isSupervisor; + // Supervisor? + $this->_isSupervisor = $isSupervisor; - // Initialise values - $this->_conditionalStyles = array(); - $this->_font = new PHPExcel_Style_Font($isSupervisor, $isConditional); - $this->_fill = new PHPExcel_Style_Fill($isSupervisor, $isConditional); - $this->_borders = new PHPExcel_Style_Borders($isSupervisor, $isConditional); - $this->_alignment = new PHPExcel_Style_Alignment($isSupervisor, $isConditional); - $this->_numberFormat = new PHPExcel_Style_NumberFormat($isSupervisor, $isConditional); - $this->_protection = new PHPExcel_Style_Protection($isSupervisor, $isConditional); + // Initialise values + $this->_conditionalStyles = array(); + $this->_font = new PHPExcel_Style_Font($isSupervisor, $isConditional); + $this->_fill = new PHPExcel_Style_Fill($isSupervisor, $isConditional); + $this->_borders = new PHPExcel_Style_Borders($isSupervisor, $isConditional); + $this->_alignment = new PHPExcel_Style_Alignment($isSupervisor, $isConditional); + $this->_numberFormat = new PHPExcel_Style_NumberFormat($isSupervisor, $isConditional); + $this->_protection = new PHPExcel_Style_Protection($isSupervisor, $isConditional); - // bind parent if we are a supervisor - if ($isSupervisor) { - $this->_font->bindParent($this); - $this->_fill->bindParent($this); - $this->_borders->bindParent($this); - $this->_alignment->bindParent($this); - $this->_numberFormat->bindParent($this); - $this->_protection->bindParent($this); - } + // bind parent if we are a supervisor + if ($isSupervisor) { + $this->_font->bindParent($this); + $this->_fill->bindParent($this); + $this->_borders->bindParent($this); + $this->_alignment->bindParent($this); + $this->_numberFormat->bindParent($this); + $this->_protection->bindParent($this); + } + } + + /** + * Get the shared style component for the currently active cell in currently active sheet. + * Only used for style supervisor + * + * @return PHPExcel_Style + */ + public function getSharedComponent() + { + $activeSheet = $this->getActiveSheet(); + $selectedCell = $this->getActiveCell(); // e.g. 'A1' + + if ($activeSheet->cellExists($selectedCell)) { + $xfIndex = $activeSheet->getCell($selectedCell)->getXfIndex(); + } else { + $xfIndex = 0; + } + + return $this->_parent->getCellXfByIndex($xfIndex); + } + + /** + * Get parent. Only used for style supervisor + * + * @return PHPExcel + */ + public function getParent() + { + return $this->_parent; } /** - * Bind parent. Only used for supervisor + * Build style array from subcomponents * - * @param PHPExcel $parent - * @return PHPExcel_Style + * @param array $array + * @return array */ - public function bindParent($parent) + public function getStyleArray($array) { - $this->_parent = $parent; - return $this; - } - - /** - * Is this a supervisor or a real style component? - * - * @return boolean - */ - public function getIsSupervisor() - { - return $this->_isSupervisor; - } - - /** - * Get the shared style component for the currently active cell in currently active sheet. - * Only used for style supervisor - * - * @return PHPExcel_Style - */ - public function getSharedComponent() - { - $activeSheet = $this->getActiveSheet(); - $selectedCell = $this->getActiveCell(); // e.g. 'A1' - - if ($activeSheet->cellExists($selectedCell)) { - $xfIndex = $activeSheet->getCell($selectedCell)->getXfIndex(); - } else { - $xfIndex = 0; - } - - return $this->_parent->getCellXfByIndex($xfIndex); - } - - /** - * Get the currently active sheet. Only used for supervisor - * - * @return PHPExcel_Worksheet - */ - public function getActiveSheet() - { - return $this->_parent->getActiveSheet(); - } - - /** - * Get the currently active cell coordinate in currently active sheet. - * Only used for supervisor - * - * @return string E.g. 'A1' - */ - public function getSelectedCells() - { - return $this->_parent->getActiveSheet()->getSelectedCells(); - } - - /** - * Get the currently active cell coordinate in currently active sheet. - * Only used for supervisor - * - * @return string E.g. 'A1' - */ - public function getActiveCell() - { - return $this->_parent->getActiveSheet()->getActiveCell(); - } - - /** - * Get parent. Only used for style supervisor - * - * @return PHPExcel - */ - public function getParent() - { - return $this->_parent; + return array('quotePrefix' => $array); } /** @@ -229,321 +179,327 @@ class PHPExcel_Style implements PHPExcel_IComparable * * * $objPHPExcel->getActiveSheet()->getStyle('B2')->applyFromArray( - * array( - * 'font' => array( - * 'name' => 'Arial', - * 'bold' => true, - * 'italic' => false, - * 'underline' => PHPExcel_Style_Font::UNDERLINE_DOUBLE, - * 'strike' => false, - * 'color' => array( - * 'rgb' => '808080' - * ) - * ), - * 'borders' => array( - * 'bottom' => array( - * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, - * 'color' => array( - * 'rgb' => '808080' - * ) - * ), - * 'top' => array( - * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, - * 'color' => array( - * 'rgb' => '808080' - * ) - * ) - * ) - * ) + * array( + * 'font' => array( + * 'name' => 'Arial', + * 'bold' => true, + * 'italic' => false, + * 'underline' => PHPExcel_Style_Font::UNDERLINE_DOUBLE, + * 'strike' => false, + * 'color' => array( + * 'rgb' => '808080' + * ) + * ), + * 'borders' => array( + * 'bottom' => array( + * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, + * 'color' => array( + * 'rgb' => '808080' + * ) + * ), + * 'top' => array( + * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, + * 'color' => array( + * 'rgb' => '808080' + * ) + * ) + * ), + * 'quotePrefix' => true + * ) * ); * * - * @param array $pStyles Array containing style information - * @param boolean $pAdvanced Advanced mode for setting borders. - * @throws Exception + * @param array $pStyles Array containing style information + * @param boolean $pAdvanced Advanced mode for setting borders. + * @throws PHPExcel_Exception * @return PHPExcel_Style */ - public function applyFromArray($pStyles = null, $pAdvanced = true) { - if (is_array($pStyles)) { - if ($this->_isSupervisor) { + public function applyFromArray($pStyles = null, $pAdvanced = true) + { + if (is_array($pStyles)) { + if ($this->_isSupervisor) { - $pRange = $this->getSelectedCells(); + $pRange = $this->getSelectedCells(); - // Uppercase coordinate - $pRange = strtoupper($pRange); + // Uppercase coordinate + $pRange = strtoupper($pRange); - // Is it a cell range or a single cell? - if (strpos($pRange, ':') === false) { - $rangeA = $pRange; - $rangeB = $pRange; - } else { - list($rangeA, $rangeB) = explode(':', $pRange); - } + // Is it a cell range or a single cell? + if (strpos($pRange, ':') === false) { + $rangeA = $pRange; + $rangeB = $pRange; + } else { + list($rangeA, $rangeB) = explode(':', $pRange); + } - // Calculate range outer borders - $rangeStart = PHPExcel_Cell::coordinateFromString($rangeA); - $rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB); + // Calculate range outer borders + $rangeStart = PHPExcel_Cell::coordinateFromString($rangeA); + $rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB); - // Translate column into index - $rangeStart[0] = PHPExcel_Cell::columnIndexFromString($rangeStart[0]) - 1; - $rangeEnd[0] = PHPExcel_Cell::columnIndexFromString($rangeEnd[0]) - 1; + // Translate column into index + $rangeStart[0] = PHPExcel_Cell::columnIndexFromString($rangeStart[0]) - 1; + $rangeEnd[0] = PHPExcel_Cell::columnIndexFromString($rangeEnd[0]) - 1; - // Make sure we can loop upwards on rows and columns - if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) { - $tmp = $rangeStart; - $rangeStart = $rangeEnd; - $rangeEnd = $tmp; - } + // Make sure we can loop upwards on rows and columns + if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) { + $tmp = $rangeStart; + $rangeStart = $rangeEnd; + $rangeEnd = $tmp; + } - // ADVANCED MODE: + // ADVANCED MODE: - if ($pAdvanced && isset($pStyles['borders'])) { + if ($pAdvanced && isset($pStyles['borders'])) { - // 'allborders' is a shorthand property for 'outline' and 'inside' and - // it applies to components that have not been set explicitly - if (isset($pStyles['borders']['allborders'])) { - foreach (array('outline', 'inside') as $component) { - if (!isset($pStyles['borders'][$component])) { - $pStyles['borders'][$component] = $pStyles['borders']['allborders']; - } - } - unset($pStyles['borders']['allborders']); // not needed any more - } + // 'allborders' is a shorthand property for 'outline' and 'inside' and + // it applies to components that have not been set explicitly + if (isset($pStyles['borders']['allborders'])) { + foreach (array('outline', 'inside') as $component) { + if (!isset($pStyles['borders'][$component])) { + $pStyles['borders'][$component] = $pStyles['borders']['allborders']; + } + } + unset($pStyles['borders']['allborders']); // not needed any more + } - // 'outline' is a shorthand property for 'top', 'right', 'bottom', 'left' - // it applies to components that have not been set explicitly - if (isset($pStyles['borders']['outline'])) { - foreach (array('top', 'right', 'bottom', 'left') as $component) { - if (!isset($pStyles['borders'][$component])) { - $pStyles['borders'][$component] = $pStyles['borders']['outline']; - } - } - unset($pStyles['borders']['outline']); // not needed any more - } + // 'outline' is a shorthand property for 'top', 'right', 'bottom', 'left' + // it applies to components that have not been set explicitly + if (isset($pStyles['borders']['outline'])) { + foreach (array('top', 'right', 'bottom', 'left') as $component) { + if (!isset($pStyles['borders'][$component])) { + $pStyles['borders'][$component] = $pStyles['borders']['outline']; + } + } + unset($pStyles['borders']['outline']); // not needed any more + } - // 'inside' is a shorthand property for 'vertical' and 'horizontal' - // it applies to components that have not been set explicitly - if (isset($pStyles['borders']['inside'])) { - foreach (array('vertical', 'horizontal') as $component) { - if (!isset($pStyles['borders'][$component])) { - $pStyles['borders'][$component] = $pStyles['borders']['inside']; - } - } - unset($pStyles['borders']['inside']); // not needed any more - } + // 'inside' is a shorthand property for 'vertical' and 'horizontal' + // it applies to components that have not been set explicitly + if (isset($pStyles['borders']['inside'])) { + foreach (array('vertical', 'horizontal') as $component) { + if (!isset($pStyles['borders'][$component])) { + $pStyles['borders'][$component] = $pStyles['borders']['inside']; + } + } + unset($pStyles['borders']['inside']); // not needed any more + } - // width and height characteristics of selection, 1, 2, or 3 (for 3 or more) - $xMax = min($rangeEnd[0] - $rangeStart[0] + 1, 3); - $yMax = min($rangeEnd[1] - $rangeStart[1] + 1, 3); + // width and height characteristics of selection, 1, 2, or 3 (for 3 or more) + $xMax = min($rangeEnd[0] - $rangeStart[0] + 1, 3); + $yMax = min($rangeEnd[1] - $rangeStart[1] + 1, 3); - // loop through up to 3 x 3 = 9 regions - for ($x = 1; $x <= $xMax; ++$x) { - // start column index for region - $colStart = ($x == 3) ? - PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0]) - : PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] + $x - 1); + // loop through up to 3 x 3 = 9 regions + for ($x = 1; $x <= $xMax; ++$x) { + // start column index for region + $colStart = ($x == 3) ? + PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0]) + : PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] + $x - 1); - // end column index for region - $colEnd = ($x == 1) ? - PHPExcel_Cell::stringFromColumnIndex($rangeStart[0]) - : PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0] - $xMax + $x); + // end column index for region + $colEnd = ($x == 1) ? + PHPExcel_Cell::stringFromColumnIndex($rangeStart[0]) + : PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0] - $xMax + $x); - for ($y = 1; $y <= $yMax; ++$y) { + for ($y = 1; $y <= $yMax; ++$y) { - // which edges are touching the region - $edges = array(); + // which edges are touching the region + $edges = array(); - // are we at left edge - if ($x == 1) { - $edges[] = 'left'; - } + // are we at left edge + if ($x == 1) { + $edges[] = 'left'; + } - // are we at right edge - if ($x == $xMax) { - $edges[] = 'right'; - } + // are we at right edge + if ($x == $xMax) { + $edges[] = 'right'; + } - // are we at top edge? - if ($y == 1) { - $edges[] = 'top'; - } + // are we at top edge? + if ($y == 1) { + $edges[] = 'top'; + } - // are we at bottom edge? - if ($y == $yMax) { - $edges[] = 'bottom'; - } + // are we at bottom edge? + if ($y == $yMax) { + $edges[] = 'bottom'; + } - // start row index for region - $rowStart = ($y == 3) ? - $rangeEnd[1] : $rangeStart[1] + $y - 1; + // start row index for region + $rowStart = ($y == 3) ? + $rangeEnd[1] : $rangeStart[1] + $y - 1; - // end row index for region - $rowEnd = ($y == 1) ? - $rangeStart[1] : $rangeEnd[1] - $yMax + $y; + // end row index for region + $rowEnd = ($y == 1) ? + $rangeStart[1] : $rangeEnd[1] - $yMax + $y; - // build range for region - $range = $colStart . $rowStart . ':' . $colEnd . $rowEnd; + // build range for region + $range = $colStart . $rowStart . ':' . $colEnd . $rowEnd; - // retrieve relevant style array for region - $regionStyles = $pStyles; - unset($regionStyles['borders']['inside']); + // retrieve relevant style array for region + $regionStyles = $pStyles; + unset($regionStyles['borders']['inside']); - // what are the inner edges of the region when looking at the selection - $innerEdges = array_diff( array('top', 'right', 'bottom', 'left'), $edges ); + // what are the inner edges of the region when looking at the selection + $innerEdges = array_diff( array('top', 'right', 'bottom', 'left'), $edges ); - // inner edges that are not touching the region should take the 'inside' border properties if they have been set - foreach ($innerEdges as $innerEdge) { - switch ($innerEdge) { - case 'top': - case 'bottom': - // should pick up 'horizontal' border property if set - if (isset($pStyles['borders']['horizontal'])) { - $regionStyles['borders'][$innerEdge] = $pStyles['borders']['horizontal']; - } else { - unset($regionStyles['borders'][$innerEdge]); - } - break; - case 'left': - case 'right': - // should pick up 'vertical' border property if set - if (isset($pStyles['borders']['vertical'])) { - $regionStyles['borders'][$innerEdge] = $pStyles['borders']['vertical']; - } else { - unset($regionStyles['borders'][$innerEdge]); - } - break; - } - } + // inner edges that are not touching the region should take the 'inside' border properties if they have been set + foreach ($innerEdges as $innerEdge) { + switch ($innerEdge) { + case 'top': + case 'bottom': + // should pick up 'horizontal' border property if set + if (isset($pStyles['borders']['horizontal'])) { + $regionStyles['borders'][$innerEdge] = $pStyles['borders']['horizontal']; + } else { + unset($regionStyles['borders'][$innerEdge]); + } + break; + case 'left': + case 'right': + // should pick up 'vertical' border property if set + if (isset($pStyles['borders']['vertical'])) { + $regionStyles['borders'][$innerEdge] = $pStyles['borders']['vertical']; + } else { + unset($regionStyles['borders'][$innerEdge]); + } + break; + } + } - // apply region style to region by calling applyFromArray() in simple mode - $this->getActiveSheet()->getStyle($range)->applyFromArray($regionStyles, false); - } - } - return $this; - } + // apply region style to region by calling applyFromArray() in simple mode + $this->getActiveSheet()->getStyle($range)->applyFromArray($regionStyles, false); + } + } + return $this; + } - // SIMPLE MODE: + // SIMPLE MODE: - // Selection type, inspect - if (preg_match('/^[A-Z]+1:[A-Z]+1048576$/', $pRange)) { - $selectionType = 'COLUMN'; - } else if (preg_match('/^A[0-9]+:XFD[0-9]+$/', $pRange)) { - $selectionType = 'ROW'; - } else { - $selectionType = 'CELL'; - } + // Selection type, inspect + if (preg_match('/^[A-Z]+1:[A-Z]+1048576$/', $pRange)) { + $selectionType = 'COLUMN'; + } else if (preg_match('/^A[0-9]+:XFD[0-9]+$/', $pRange)) { + $selectionType = 'ROW'; + } else { + $selectionType = 'CELL'; + } - // First loop through columns, rows, or cells to find out which styles are affected by this operation - switch ($selectionType) { - case 'COLUMN': - $oldXfIndexes = array(); - for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { - $oldXfIndexes[$this->getActiveSheet()->getColumnDimensionByColumn($col)->getXfIndex()] = true; - } - break; + // First loop through columns, rows, or cells to find out which styles are affected by this operation + switch ($selectionType) { + case 'COLUMN': + $oldXfIndexes = array(); + for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { + $oldXfIndexes[$this->getActiveSheet()->getColumnDimensionByColumn($col)->getXfIndex()] = true; + } + break; - case 'ROW': - $oldXfIndexes = array(); - for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { - if ($this->getActiveSheet()->getRowDimension($row)->getXfIndex() == null) { - $oldXfIndexes[0] = true; // row without explicit style should be formatted based on default style - } else { - $oldXfIndexes[$this->getActiveSheet()->getRowDimension($row)->getXfIndex()] = true; - } - } - break; + case 'ROW': + $oldXfIndexes = array(); + for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { + if ($this->getActiveSheet()->getRowDimension($row)->getXfIndex() == null) { + $oldXfIndexes[0] = true; // row without explicit style should be formatted based on default style + } else { + $oldXfIndexes[$this->getActiveSheet()->getRowDimension($row)->getXfIndex()] = true; + } + } + break; - case 'CELL': - $oldXfIndexes = array(); - for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { - for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { - $oldXfIndexes[$this->getActiveSheet()->getCellByColumnAndRow($col, $row)->getXfIndex()] = true; - } - } - break; - } + case 'CELL': + $oldXfIndexes = array(); + for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { + for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { + $oldXfIndexes[$this->getActiveSheet()->getCellByColumnAndRow($col, $row)->getXfIndex()] = true; + } + } + break; + } - // clone each of the affected styles, apply the style arrray, and add the new styles to the workbook - $workbook = $this->getActiveSheet()->getParent(); - foreach ($oldXfIndexes as $oldXfIndex => $dummy) { - $style = $workbook->getCellXfByIndex($oldXfIndex); - $newStyle = clone $style; - $newStyle->applyFromArray($pStyles); + // clone each of the affected styles, apply the style array, and add the new styles to the workbook + $workbook = $this->getActiveSheet()->getParent(); + foreach ($oldXfIndexes as $oldXfIndex => $dummy) { + $style = $workbook->getCellXfByIndex($oldXfIndex); + $newStyle = clone $style; + $newStyle->applyFromArray($pStyles); - if ($existingStyle = $workbook->getCellXfByHashCode($newStyle->getHashCode())) { - // there is already such cell Xf in our collection - $newXfIndexes[$oldXfIndex] = $existingStyle->getIndex(); - } else { - // we don't have such a cell Xf, need to add - $workbook->addCellXf($newStyle); - $newXfIndexes[$oldXfIndex] = $newStyle->getIndex(); - } - } + if ($existingStyle = $workbook->getCellXfByHashCode($newStyle->getHashCode())) { + // there is already such cell Xf in our collection + $newXfIndexes[$oldXfIndex] = $existingStyle->getIndex(); + } else { + // we don't have such a cell Xf, need to add + $workbook->addCellXf($newStyle); + $newXfIndexes[$oldXfIndex] = $newStyle->getIndex(); + } + } - // Loop through columns, rows, or cells again and update the XF index - switch ($selectionType) { - case 'COLUMN': - for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { - $columnDimension = $this->getActiveSheet()->getColumnDimensionByColumn($col); - $oldXfIndex = $columnDimension->getXfIndex(); - $columnDimension->setXfIndex($newXfIndexes[$oldXfIndex]); - } - break; + // Loop through columns, rows, or cells again and update the XF index + switch ($selectionType) { + case 'COLUMN': + for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { + $columnDimension = $this->getActiveSheet()->getColumnDimensionByColumn($col); + $oldXfIndex = $columnDimension->getXfIndex(); + $columnDimension->setXfIndex($newXfIndexes[$oldXfIndex]); + } + break; - case 'ROW': - for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { - $rowDimension = $this->getActiveSheet()->getRowDimension($row); - $oldXfIndex = $rowDimension->getXfIndex() === null ? - 0 : $rowDimension->getXfIndex(); // row without explicit style should be formatted based on default style - $rowDimension->setXfIndex($newXfIndexes[$oldXfIndex]); - } - break; + case 'ROW': + for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { + $rowDimension = $this->getActiveSheet()->getRowDimension($row); + $oldXfIndex = $rowDimension->getXfIndex() === null ? + 0 : $rowDimension->getXfIndex(); // row without explicit style should be formatted based on default style + $rowDimension->setXfIndex($newXfIndexes[$oldXfIndex]); + } + break; - case 'CELL': - for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { - for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { - $cell = $this->getActiveSheet()->getCellByColumnAndRow($col, $row); - $oldXfIndex = $cell->getXfIndex(); - $cell->setXfIndex($newXfIndexes[$oldXfIndex]); - } - } - break; - } + case 'CELL': + for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { + for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { + $cell = $this->getActiveSheet()->getCellByColumnAndRow($col, $row); + $oldXfIndex = $cell->getXfIndex(); + $cell->setXfIndex($newXfIndexes[$oldXfIndex]); + } + } + break; + } - } else { - // not a supervisor, just apply the style array directly on style object - if (array_key_exists('fill', $pStyles)) { - $this->getFill()->applyFromArray($pStyles['fill']); - } - if (array_key_exists('font', $pStyles)) { - $this->getFont()->applyFromArray($pStyles['font']); - } - if (array_key_exists('borders', $pStyles)) { - $this->getBorders()->applyFromArray($pStyles['borders']); - } - if (array_key_exists('alignment', $pStyles)) { - $this->getAlignment()->applyFromArray($pStyles['alignment']); - } - if (array_key_exists('numberformat', $pStyles)) { - $this->getNumberFormat()->applyFromArray($pStyles['numberformat']); - } - if (array_key_exists('protection', $pStyles)) { - $this->getProtection()->applyFromArray($pStyles['protection']); - } - } - } else { - throw new Exception("Invalid style array passed."); - } - return $this; - } + } else { + // not a supervisor, just apply the style array directly on style object + if (array_key_exists('fill', $pStyles)) { + $this->getFill()->applyFromArray($pStyles['fill']); + } + if (array_key_exists('font', $pStyles)) { + $this->getFont()->applyFromArray($pStyles['font']); + } + if (array_key_exists('borders', $pStyles)) { + $this->getBorders()->applyFromArray($pStyles['borders']); + } + if (array_key_exists('alignment', $pStyles)) { + $this->getAlignment()->applyFromArray($pStyles['alignment']); + } + if (array_key_exists('numberformat', $pStyles)) { + $this->getNumberFormat()->applyFromArray($pStyles['numberformat']); + } + if (array_key_exists('protection', $pStyles)) { + $this->getProtection()->applyFromArray($pStyles['protection']); + } + if (array_key_exists('quotePrefix', $pStyles)) { + $this->_quotePrefix = $pStyles['quotePrefix']; + } + } + } else { + throw new PHPExcel_Exception("Invalid style array passed."); + } + return $this; + } /** * Get Fill * * @return PHPExcel_Style_Fill */ - public function getFill() { - return $this->_fill; + public function getFill() + { + return $this->_fill; } /** @@ -551,29 +507,31 @@ class PHPExcel_Style implements PHPExcel_IComparable * * @return PHPExcel_Style_Font */ - public function getFont() { - return $this->_font; + public function getFont() + { + return $this->_font; } - /** - * Set font - * - * @param PHPExcel_Style_Font $font - * @return PHPExcel_Style - */ - public function setFont(PHPExcel_Style_Font $font) - { - $this->_font = $font; - return $this; - } + /** + * Set font + * + * @param PHPExcel_Style_Font $font + * @return PHPExcel_Style + */ + public function setFont(PHPExcel_Style_Font $font) + { + $this->_font = $font; + return $this; + } /** * Get Borders * * @return PHPExcel_Style_Borders */ - public function getBorders() { - return $this->_borders; + public function getBorders() + { + return $this->_borders; } /** @@ -581,8 +539,9 @@ class PHPExcel_Style implements PHPExcel_IComparable * * @return PHPExcel_Style_Alignment */ - public function getAlignment() { - return $this->_alignment; + public function getAlignment() + { + return $this->_alignment; } /** @@ -590,8 +549,9 @@ class PHPExcel_Style implements PHPExcel_IComparable * * @return PHPExcel_Style_NumberFormat */ - public function getNumberFormat() { - return $this->_numberFormat; + public function getNumberFormat() + { + return $this->_numberFormat; } /** @@ -599,21 +559,23 @@ class PHPExcel_Style implements PHPExcel_IComparable * * @return PHPExcel_Style_Conditional[] */ - public function getConditionalStyles() { - return $this->getActiveSheet()->getConditionalStyles($this->getActiveCell()); + public function getConditionalStyles() + { + return $this->getActiveSheet()->getConditionalStyles($this->getActiveCell()); } /** * Set Conditional Styles. Only used on supervisor. * - * @param PHPExcel_Style_Conditional[] $pValue Array of condtional styles + * @param PHPExcel_Style_Conditional[] $pValue Array of condtional styles * @return PHPExcel_Style */ - public function setConditionalStyles($pValue = null) { - if (is_array($pValue)) { - $this->getActiveSheet()->setConditionalStyles($this->getSelectedCells(), $pValue); - } - return $this; + public function setConditionalStyles($pValue = null) + { + if (is_array($pValue)) { + $this->getActiveSheet()->setConditionalStyles($this->getSelectedCells(), $pValue); + } + return $this; } /** @@ -621,64 +583,86 @@ class PHPExcel_Style implements PHPExcel_IComparable * * @return PHPExcel_Style_Protection */ - public function getProtection() { - return $this->_protection; + public function getProtection() + { + return $this->_protection; } - /** - * Get hash code - * - * @return string Hash code - */ - public function getHashCode() { - $hashConditionals = ''; - foreach ($this->_conditionalStyles as $conditional) { - $hashConditionals .= $conditional->getHashCode(); - } - - return md5( - $this->_fill->getHashCode() - . $this->_font->getHashCode() - . $this->_borders->getHashCode() - . $this->_alignment->getHashCode() - . $this->_numberFormat->getHashCode() - . $hashConditionals - . $this->_protection->getHashCode() - . __CLASS__ - ); + /** + * Get quote prefix + * + * @return boolean + */ + public function getQuotePrefix() + { + if ($this->_isSupervisor) { + return $this->getSharedComponent()->getQuotePrefix(); + } + return $this->_quotePrefix; } - /** - * Get own index in style collection - * - * @return int - */ - public function getIndex() - { - return $this->_index; - } + /** + * Set quote prefix + * + * @param boolean $pValue + */ + public function setQuotePrefix($pValue) + { + if ($pValue == '') { + $pValue = false; + } + if ($this->_isSupervisor) { + $styleArray = array('quotePrefix' => $pValue); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->_quotePrefix = (boolean) $pValue; + } + return $this; + } - /** - * Set own index in style collection - * - * @param int $pValue - */ - public function setIndex($pValue) - { - $this->_index = $pValue; - } + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() + { + $hashConditionals = ''; + foreach ($this->_conditionalStyles as $conditional) { + $hashConditionals .= $conditional->getHashCode(); + } + + return md5( + $this->_fill->getHashCode() + . $this->_font->getHashCode() + . $this->_borders->getHashCode() + . $this->_alignment->getHashCode() + . $this->_numberFormat->getHashCode() + . $hashConditionals + . $this->_protection->getHashCode() + . ($this->_quotePrefix ? 't' : 'f') + . __CLASS__ + ); + } + + /** + * Get own index in style collection + * + * @return int + */ + public function getIndex() + { + return $this->_index; + } + + /** + * Set own index in style collection + * + * @param int $pValue + */ + public function setIndex($pValue) + { + $this->_index = $pValue; + } - /** - * Implement PHP __clone to create a deep clone, not just a shallow copy. - */ - public function __clone() { - $vars = get_object_vars($this); - foreach ($vars as $key => $value) { - if ((is_object($value)) && ($key != '_parent')) { - $this->$key = clone $value; - } else { - $this->$key = $value; - } - } - } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Style/Alignment.php b/htdocs/includes/phpexcel/PHPExcel/Style/Alignment.php index 81ca387c5be..0d9e076799e 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Style/Alignment.php +++ b/htdocs/includes/phpexcel/PHPExcel/Style/Alignment.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Style - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,9 +31,9 @@ * * @category PHPExcel * @package PHPExcel_Style - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Style_Alignment implements PHPExcel_IComparable +class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable { /* Horizontal alignment styles */ const HORIZONTAL_GENERAL = 'general'; @@ -42,75 +42,57 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable const HORIZONTAL_CENTER = 'center'; const HORIZONTAL_CENTER_CONTINUOUS = 'centerContinuous'; const HORIZONTAL_JUSTIFY = 'justify'; + const HORIZONTAL_FILL = 'fill'; + const HORIZONTAL_DISTRIBUTED = 'distributed'; // Excel2007 only /* Vertical alignment styles */ const VERTICAL_BOTTOM = 'bottom'; const VERTICAL_TOP = 'top'; const VERTICAL_CENTER = 'center'; const VERTICAL_JUSTIFY = 'justify'; + const VERTICAL_DISTRIBUTED = 'distributed'; // Excel2007 only /** * Horizontal * * @var string */ - private $_horizontal = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; + protected $_horizontal = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; /** * Vertical * * @var string */ - private $_vertical = PHPExcel_Style_Alignment::VERTICAL_BOTTOM; + protected $_vertical = PHPExcel_Style_Alignment::VERTICAL_BOTTOM; /** * Text rotation * * @var int */ - private $_textRotation = 0; + protected $_textRotation = 0; /** * Wrap text * * @var boolean */ - private $_wrapText = false; + protected $_wrapText = FALSE; /** * Shrink to fit * * @var boolean */ - private $_shrinkToFit = false; + protected $_shrinkToFit = FALSE; /** * Indent - only possible with horizontal alignment left and right * * @var int */ - private $_indent = 0; - - /** - * Parent Borders - * - * @var _parentPropertyName string - */ - private $_parentPropertyName; - - /** - * Supervisor? - * - * @var boolean - */ - private $_isSupervisor; - - /** - * Parent. Only used for supervisor - * - * @var PHPExcel_Style - */ - private $_parent; + protected $_indent = 0; /** * Create a new PHPExcel_Style_Alignment @@ -122,10 +104,10 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable * Leave this value at default unless you understand exactly what * its ramifications are */ - public function __construct($isSupervisor = false, $isConditional = false) + public function __construct($isSupervisor = FALSE, $isConditional = FALSE) { // Supervisor? - $this->_isSupervisor = $isSupervisor; + parent::__construct($isSupervisor); if ($isConditional) { $this->_horizontal = NULL; @@ -134,28 +116,6 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable } } - /** - * Bind parent. Only used for supervisor - * - * @param PHPExcel $parent - * @return PHPExcel_Style_Alignment - */ - public function bindParent($parent) - { - $this->_parent = $parent; - return $this; - } - - /** - * Is this a supervisor or a real style component? - * - * @return boolean - */ - public function getIsSupervisor() - { - return $this->_isSupervisor; - } - /** * Get the shared style component for the currently active cell in currently active sheet. * Only used for style supervisor @@ -167,38 +127,6 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable return $this->_parent->getSharedComponent()->getAlignment(); } - /** - * Get the currently active sheet. Only used for supervisor - * - * @return PHPExcel_Worksheet - */ - public function getActiveSheet() - { - return $this->_parent->getActiveSheet(); - } - - /** - * Get the currently active cell coordinate in currently active sheet. - * Only used for supervisor - * - * @return string E.g. 'A1' - */ - public function getSelectedCells() - { - return $this->getActiveSheet()->getSelectedCells(); - } - - /** - * Get the currently active cell coordinate in currently active sheet. - * Only used for supervisor - * - * @return string E.g. 'A1' - */ - public function getActiveCell() - { - return $this->getActiveSheet()->getActiveCell(); - } - /** * Build style array from subcomponents * @@ -219,41 +147,42 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable * 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER, * 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER, * 'rotation' => 0, - * 'wrap' => true + * 'wrap' => TRUE * ) * ); * * * @param array $pStyles Array containing style information - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Style_Alignment */ - public function applyFromArray($pStyles = null) { + public function applyFromArray($pStyles = NULL) { if (is_array($pStyles)) { if ($this->_isSupervisor) { - $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); + $this->getActiveSheet()->getStyle($this->getSelectedCells()) + ->applyFromArray($this->getStyleArray($pStyles)); } else { - if (array_key_exists('horizontal', $pStyles)) { + if (isset($pStyles['horizontal'])) { $this->setHorizontal($pStyles['horizontal']); } - if (array_key_exists('vertical', $pStyles)) { + if (isset($pStyles['vertical'])) { $this->setVertical($pStyles['vertical']); } - if (array_key_exists('rotation', $pStyles)) { + if (isset($pStyles['rotation'])) { $this->setTextRotation($pStyles['rotation']); } - if (array_key_exists('wrap', $pStyles)) { + if (isset($pStyles['wrap'])) { $this->setWrapText($pStyles['wrap']); } - if (array_key_exists('shrinkToFit', $pStyles)) { + if (isset($pStyles['shrinkToFit'])) { $this->setShrinkToFit($pStyles['shrinkToFit']); } - if (array_key_exists('indent', $pStyles)) { + if (isset($pStyles['indent'])) { $this->setIndent($pStyles['indent']); } } } else { - throw new Exception("Invalid style array passed."); + throw new PHPExcel_Exception("Invalid style array passed."); } return $this; } @@ -339,7 +268,7 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable * Set TextRotation * * @param int $pValue - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Style_Alignment */ public function setTextRotation($pValue = 0) { @@ -357,7 +286,7 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable $this->_textRotation = $pValue; } } else { - throw new Exception("Text rotation should be a value between -90 and 90."); + throw new PHPExcel_Exception("Text rotation should be a value between -90 and 90."); } return $this; @@ -381,9 +310,9 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable * @param boolean $pValue * @return PHPExcel_Style_Alignment */ - public function setWrapText($pValue = false) { + public function setWrapText($pValue = FALSE) { if ($pValue == '') { - $pValue = false; + $pValue = FALSE; } if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('wrap' => $pValue)); @@ -412,9 +341,9 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable * @param boolean $pValue * @return PHPExcel_Style_Alignment */ - public function setShrinkToFit($pValue = false) { + public function setShrinkToFit($pValue = FALSE) { if ($pValue == '') { - $pValue = false; + $pValue = FALSE; } if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('shrinkToFit' => $pValue)); @@ -445,7 +374,9 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable */ public function setIndent($pValue = 0) { if ($pValue > 0) { - if ($this->getHorizontal() != self::HORIZONTAL_GENERAL && $this->getHorizontal() != self::HORIZONTAL_LEFT && $this->getHorizontal() != self::HORIZONTAL_RIGHT) { + if ($this->getHorizontal() != self::HORIZONTAL_GENERAL && + $this->getHorizontal() != self::HORIZONTAL_LEFT && + $this->getHorizontal() != self::HORIZONTAL_RIGHT) { $pValue = 0; // indent not supported } } @@ -478,17 +409,4 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable ); } - /** - * Implement PHP __clone to create a deep clone, not just a shallow copy. - */ - public function __clone() { - $vars = get_object_vars($this); - foreach ($vars as $key => $value) { - if ((is_object($value)) && ($key != '_parent')) { - $this->$key = clone $value; - } else { - $this->$key = $value; - } - } - } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Style/Border.php b/htdocs/includes/phpexcel/PHPExcel/Style/Border.php index 6f8767fb277..3b7eba9af9c 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Style/Border.php +++ b/htdocs/includes/phpexcel/PHPExcel/Style/Border.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Style - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,9 +31,9 @@ * * @category PHPExcel * @package PHPExcel_Style - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Style_Border implements PHPExcel_IComparable +class PHPExcel_Style_Border extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable { /* Border style */ const BORDER_NONE = 'none'; @@ -56,35 +56,21 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable * * @var string */ - private $_borderStyle = PHPExcel_Style_Border::BORDER_NONE; + protected $_borderStyle = PHPExcel_Style_Border::BORDER_NONE; /** * Border color * * @var PHPExcel_Style_Color */ - private $_color; - - /** - * Supervisor? - * - * @var boolean - */ - private $_isSupervisor; - - /** - * Parent. Only used for supervisor - * - * @var PHPExcel_Style_Borders - */ - private $_parent; + protected $_color; /** * Parent property name * * @var string */ - private $_parentPropertyName; + protected $_parentPropertyName; /** * Create a new PHPExcel_Style_Border @@ -96,10 +82,10 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable * Leave this value at default unless you understand exactly what * its ramifications are */ - public function __construct($isSupervisor = false, $isConditional = false) + public function __construct($isSupervisor = FALSE, $isConditional = FALSE) { // Supervisor? - $this->_isSupervisor = $isSupervisor; + parent::__construct($isSupervisor); // Initialise values $this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor); @@ -117,29 +103,19 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable * @param string $parentPropertyName * @return PHPExcel_Style_Border */ - public function bindParent($parent, $parentPropertyName) + public function bindParent($parent, $parentPropertyName=NULL) { $this->_parent = $parent; $this->_parentPropertyName = $parentPropertyName; return $this; } - /** - * Is this a supervisor or a real style component? - * - * @return boolean - */ - public function getIsSupervisor() - { - return $this->_isSupervisor; - } - /** * Get the shared style component for the currently active cell in currently active sheet. * Only used for style supervisor * * @return PHPExcel_Style_Border - * @throws Exception + * @throws PHPExcel_Exception */ public function getSharedComponent() { @@ -149,64 +125,22 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable case '_inside': case '_outline': case '_vertical': - throw new Exception('Cannot get shared component for a pseudo-border.'); + throw new PHPExcel_Exception('Cannot get shared component for a pseudo-border.'); break; - case '_bottom': - return $this->_parent->getSharedComponent()->getBottom(); - break; - + return $this->_parent->getSharedComponent()->getBottom(); break; case '_diagonal': - return $this->_parent->getSharedComponent()->getDiagonal(); - break; - + return $this->_parent->getSharedComponent()->getDiagonal(); break; case '_left': - return $this->_parent->getSharedComponent()->getLeft(); - break; - + return $this->_parent->getSharedComponent()->getLeft(); break; case '_right': - return $this->_parent->getSharedComponent()->getRight(); - break; - + return $this->_parent->getSharedComponent()->getRight(); break; case '_top': - return $this->_parent->getSharedComponent()->getTop(); - break; + return $this->_parent->getSharedComponent()->getTop(); break; } } - /** - * Get the currently active sheet. Only used for supervisor - * - * @return PHPExcel_Worksheet - */ - public function getActiveSheet() - { - return $this->_parent->getActiveSheet(); - } - - /** - * Get the currently active cell coordinate in currently active sheet. - * Only used for supervisor - * - * @return string E.g. 'A1' - */ - public function getSelectedCells() - { - return $this->getActiveSheet()->getSelectedCells(); - } - - /** - * Get the currently active cell coordinate in currently active sheet. - * Only used for supervisor - * - * @return string E.g. 'A1' - */ - public function getActiveCell() - { - return $this->getActiveSheet()->getActiveCell(); - } - /** * Build style array from subcomponents * @@ -217,44 +151,25 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable { switch ($this->_parentPropertyName) { case '_allBorders': - $key = 'allborders'; - break; - + $key = 'allborders'; break; case '_bottom': - $key = 'bottom'; - break; - + $key = 'bottom'; break; case '_diagonal': - $key = 'diagonal'; - break; - + $key = 'diagonal'; break; case '_horizontal': - $key = 'horizontal'; - break; - + $key = 'horizontal'; break; case '_inside': - $key = 'inside'; - break; - + $key = 'inside'; break; case '_left': - $key = 'left'; - break; - + $key = 'left'; break; case '_outline': - $key = 'outline'; - break; - + $key = 'outline'; break; case '_right': - $key = 'right'; - break; - + $key = 'right'; break; case '_top': - $key = 'top'; - break; - + $key = 'top'; break; case '_vertical': - $key = 'vertical'; - break; + $key = 'vertical'; break; } return $this->_parent->getStyleArray(array($key => $array)); } @@ -274,7 +189,7 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable * * * @param array $pStyles Array containing style information - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Style_Border */ public function applyFromArray($pStyles = null) { @@ -282,15 +197,15 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable if ($this->_isSupervisor) { $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); } else { - if (array_key_exists('style', $pStyles)) { + if (isset($pStyles['style'])) { $this->setBorderStyle($pStyles['style']); } - if (array_key_exists('color', $pStyles)) { + if (isset($pStyles['color'])) { $this->getColor()->applyFromArray($pStyles['color']); } } } else { - throw new Exception("Invalid style array passed."); + throw new PHPExcel_Exception("Invalid style array passed."); } return $this; } @@ -310,13 +225,17 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable /** * Set Border style * - * @param string $pValue + * @param string|boolean $pValue + * When passing a boolean, FALSE equates PHPExcel_Style_Border::BORDER_NONE + * and TRUE to PHPExcel_Style_Border::BORDER_MEDIUM * @return PHPExcel_Style_Border */ public function setBorderStyle($pValue = PHPExcel_Style_Border::BORDER_NONE) { - if ($pValue == '') { + if (empty($pValue)) { $pValue = PHPExcel_Style_Border::BORDER_NONE; + } elseif(is_bool($pValue) && $pValue) { + $pValue = PHPExcel_Style_Border::BORDER_MEDIUM; } if ($this->_isSupervisor) { $styleArray = $this->getStyleArray(array('style' => $pValue)); @@ -340,7 +259,7 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable * Set Border Color * * @param PHPExcel_Style_Color $pValue - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Style_Border */ public function setColor(PHPExcel_Style_Color $pValue = null) { @@ -372,17 +291,4 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable ); } - /** - * Implement PHP __clone to create a deep clone, not just a shallow copy. - */ - public function __clone() { - $vars = get_object_vars($this); - foreach ($vars as $key => $value) { - if ((is_object($value)) && ($key != '_parent')) { - $this->$key = clone $value; - } else { - $this->$key = $value; - } - } - } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Style/Borders.php b/htdocs/includes/phpexcel/PHPExcel/Style/Borders.php index d8a3196e3af..b90838a60dc 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Style/Borders.php +++ b/htdocs/includes/phpexcel/PHPExcel/Style/Borders.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Style - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,9 +31,9 @@ * * @category PHPExcel * @package PHPExcel_Style - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Style_Borders implements PHPExcel_IComparable +class PHPExcel_Style_Borders extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable { /* Diagonal directions */ const DIAGONAL_NONE = 0; @@ -46,98 +46,77 @@ class PHPExcel_Style_Borders implements PHPExcel_IComparable * * @var PHPExcel_Style_Border */ - private $_left; + protected $_left; /** * Right * * @var PHPExcel_Style_Border */ - private $_right; + protected $_right; /** * Top * * @var PHPExcel_Style_Border */ - private $_top; + protected $_top; /** * Bottom * * @var PHPExcel_Style_Border */ - private $_bottom; + protected $_bottom; /** * Diagonal * * @var PHPExcel_Style_Border */ - private $_diagonal; + protected $_diagonal; /** * DiagonalDirection * * @var int */ - private $_diagonalDirection; + protected $_diagonalDirection; /** * All borders psedo-border. Only applies to supervisor. * * @var PHPExcel_Style_Border */ - private $_allBorders; + protected $_allBorders; /** * Outline psedo-border. Only applies to supervisor. * * @var PHPExcel_Style_Border */ - private $_outline; + protected $_outline; /** * Inside psedo-border. Only applies to supervisor. * * @var PHPExcel_Style_Border */ - private $_inside; + protected $_inside; /** * Vertical pseudo-border. Only applies to supervisor. * * @var PHPExcel_Style_Border */ - private $_vertical; + protected $_vertical; /** * Horizontal pseudo-border. Only applies to supervisor. * * @var PHPExcel_Style_Border */ - private $_horizontal; - - /** - * Parent Borders - * - * @var _parentPropertyName string - */ - private $_parentPropertyName; - - /** - * Supervisor? - * - * @var boolean - */ - private $_isSupervisor; - - /** - * Parent. Only used for supervisor - * - * @var PHPExcel_Style - */ - private $_parent; + protected $_horizontal; /** * Create a new PHPExcel_Style_Borders @@ -149,10 +128,10 @@ class PHPExcel_Style_Borders implements PHPExcel_IComparable * Leave this value at default unless you understand exactly what * its ramifications are */ - public function __construct($isSupervisor = false, $isConditional = false) + public function __construct($isSupervisor = FALSE, $isConditional = FALSE) { // Supervisor? - $this->_isSupervisor = $isSupervisor; + parent::__construct($isSupervisor); // Initialise values $this->_left = new PHPExcel_Style_Border($isSupervisor, $isConditional); @@ -165,11 +144,11 @@ class PHPExcel_Style_Borders implements PHPExcel_IComparable // Specially for supervisor if ($isSupervisor) { // Initialize pseudo-borders - $this->_allBorders = new PHPExcel_Style_Border(true); - $this->_outline = new PHPExcel_Style_Border(true); - $this->_inside = new PHPExcel_Style_Border(true); - $this->_vertical = new PHPExcel_Style_Border(true); - $this->_horizontal = new PHPExcel_Style_Border(true); + $this->_allBorders = new PHPExcel_Style_Border(TRUE); + $this->_outline = new PHPExcel_Style_Border(TRUE); + $this->_inside = new PHPExcel_Style_Border(TRUE); + $this->_vertical = new PHPExcel_Style_Border(TRUE); + $this->_horizontal = new PHPExcel_Style_Border(TRUE); // bind parent if we are a supervisor $this->_left->bindParent($this, '_left'); @@ -185,28 +164,6 @@ class PHPExcel_Style_Borders implements PHPExcel_IComparable } } - /** - * Bind parent. Only used for supervisor - * - * @param PHPExcel_Style $parent - * @return PHPExcel_Style_Borders - */ - public function bindParent($parent) - { - $this->_parent = $parent; - return $this; - } - - /** - * Is this a supervisor or a real style component? - * - * @return boolean - */ - public function getIsSupervisor() - { - return $this->_isSupervisor; - } - /** * Get the shared style component for the currently active cell in currently active sheet. * Only used for style supervisor @@ -218,38 +175,6 @@ class PHPExcel_Style_Borders implements PHPExcel_IComparable return $this->_parent->getSharedComponent()->getBorders(); } - /** - * Get the currently active sheet. Only used for supervisor - * - * @return PHPExcel_Worksheet - */ - public function getActiveSheet() - { - return $this->_parent->getActiveSheet(); - } - - /** - * Get the currently active cell coordinate in currently active sheet. - * Only used for supervisor - * - * @return string E.g. 'A1' - */ - public function getSelectedCells() - { - return $this->getActiveSheet()->getSelectedCells(); - } - - /** - * Get the currently active cell coordinate in currently active sheet. - * Only used for supervisor - * - * @return string E.g. 'A1' - */ - public function getActiveCell() - { - return $this->getActiveSheet()->getActiveCell(); - } - /** * Build style array from subcomponents * @@ -296,7 +221,7 @@ class PHPExcel_Style_Borders implements PHPExcel_IComparable * * * @param array $pStyles Array containing style information - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Style_Borders */ public function applyFromArray($pStyles = null) { @@ -330,7 +255,7 @@ class PHPExcel_Style_Borders implements PHPExcel_IComparable } } } else { - throw new Exception("Invalid style array passed."); + throw new PHPExcel_Exception("Invalid style array passed."); } return $this; } @@ -384,11 +309,11 @@ class PHPExcel_Style_Borders implements PHPExcel_IComparable * Get AllBorders (pseudo-border). Only applies to supervisor. * * @return PHPExcel_Style_Border - * @throws Exception + * @throws PHPExcel_Exception */ public function getAllBorders() { if (!$this->_isSupervisor) { - throw new Exception('Can only get pseudo-border for supervisor.'); + throw new PHPExcel_Exception('Can only get pseudo-border for supervisor.'); } return $this->_allBorders; } @@ -397,11 +322,11 @@ class PHPExcel_Style_Borders implements PHPExcel_IComparable * Get Outline (pseudo-border). Only applies to supervisor. * * @return boolean - * @throws Exception + * @throws PHPExcel_Exception */ public function getOutline() { if (!$this->_isSupervisor) { - throw new Exception('Can only get pseudo-border for supervisor.'); + throw new PHPExcel_Exception('Can only get pseudo-border for supervisor.'); } return $this->_outline; } @@ -410,11 +335,11 @@ class PHPExcel_Style_Borders implements PHPExcel_IComparable * Get Inside (pseudo-border). Only applies to supervisor. * * @return boolean - * @throws Exception + * @throws PHPExcel_Exception */ public function getInside() { if (!$this->_isSupervisor) { - throw new Exception('Can only get pseudo-border for supervisor.'); + throw new PHPExcel_Exception('Can only get pseudo-border for supervisor.'); } return $this->_inside; } @@ -423,11 +348,11 @@ class PHPExcel_Style_Borders implements PHPExcel_IComparable * Get Vertical (pseudo-border). Only applies to supervisor. * * @return PHPExcel_Style_Border - * @throws Exception + * @throws PHPExcel_Exception */ public function getVertical() { if (!$this->_isSupervisor) { - throw new Exception('Can only get pseudo-border for supervisor.'); + throw new PHPExcel_Exception('Can only get pseudo-border for supervisor.'); } return $this->_vertical; } @@ -436,11 +361,11 @@ class PHPExcel_Style_Borders implements PHPExcel_IComparable * Get Horizontal (pseudo-border). Only applies to supervisor. * * @return PHPExcel_Style_Border - * @throws Exception + * @throws PHPExcel_Exception */ public function getHorizontal() { if (!$this->_isSupervisor) { - throw new Exception('Can only get pseudo-border for supervisor.'); + throw new PHPExcel_Exception('Can only get pseudo-border for supervisor.'); } return $this->_horizontal; } @@ -496,17 +421,4 @@ class PHPExcel_Style_Borders implements PHPExcel_IComparable ); } - /** - * Implement PHP __clone to create a deep clone, not just a shallow copy. - */ - public function __clone() { - $vars = get_object_vars($this); - foreach ($vars as $key => $value) { - if ((is_object($value)) && ($key != '_parent')) { - $this->$key = clone $value; - } else { - $this->$key = $value; - } - } - } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Style/Color.php b/htdocs/includes/phpexcel/PHPExcel/Style/Color.php index 1c0f3f6808e..4d34504f397 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Style/Color.php +++ b/htdocs/includes/phpexcel/PHPExcel/Style/Color.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Style - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,9 +31,9 @@ * * @category PHPExcel * @package PHPExcel_Style - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Style_Color implements PHPExcel_IComparable +class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable { /* Colors */ const COLOR_BLACK = 'FF000000'; @@ -52,35 +52,21 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable * * @var array */ - private static $_indexedColors; + protected static $_indexedColors; /** * ARGB - Alpha RGB * * @var string */ - private $_argb = NULL; - - /** - * Supervisor? - * - * @var boolean - */ - private $_isSupervisor; - - /** - * Parent. Only used for supervisor - * - * @var mixed - */ - private $_parent; + protected $_argb = NULL; /** * Parent property name * * @var string */ - private $_parentPropertyName; + protected $_parentPropertyName; /** @@ -94,10 +80,10 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable * Leave this value at default unless you understand exactly what * its ramifications are */ - public function __construct($pARGB = PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor = false, $isConditional = false) + public function __construct($pARGB = PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor = FALSE, $isConditional = FALSE) { // Supervisor? - $this->_isSupervisor = $isSupervisor; + parent::__construct($isSupervisor); // Initialise values if (!$isConditional) { @@ -112,23 +98,13 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable * @param string $parentPropertyName * @return PHPExcel_Style_Color */ - public function bindParent($parent, $parentPropertyName) + public function bindParent($parent, $parentPropertyName=NULL) { $this->_parent = $parent; $this->_parentPropertyName = $parentPropertyName; return $this; } - /** - * Is this a supervisor or a real style component? - * - * @return boolean - */ - public function getIsSupervisor() - { - return $this->_isSupervisor; - } - /** * Get the shared style component for the currently active cell in currently active sheet. * Only used for style supervisor @@ -147,38 +123,6 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable } } - /** - * Get the currently active sheet. Only used for supervisor - * - * @return PHPExcel_Worksheet - */ - public function getActiveSheet() - { - return $this->_parent->getActiveSheet(); - } - - /** - * Get the currently active cell coordinate in currently active sheet. - * Only used for supervisor - * - * @return string E.g. 'A1' - */ - public function getSelectedCells() - { - return $this->getActiveSheet()->getSelectedCells(); - } - - /** - * Get the currently active cell coordinate in currently active sheet. - * Only used for supervisor - * - * @return string E.g. 'A1' - */ - public function getActiveCell() - { - return $this->getActiveSheet()->getActiveCell(); - } - /** * Build style array from subcomponents * @@ -210,7 +154,7 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable * * * @param array $pStyles Array containing style information - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Style_Color */ public function applyFromArray($pStyles = NULL) { @@ -226,7 +170,7 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable } } } else { - throw new Exception("Invalid style array passed."); + throw new PHPExcel_Exception("Invalid style array passed."); } return $this; } @@ -319,11 +263,7 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable * @return string The red colour component */ public static function getRed($RGB,$hex=TRUE) { - if (strlen($RGB) == 8) { - return self::_getColourComponent($RGB, 2, $hex); - } elseif (strlen($RGB) == 6) { - return self::_getColourComponent($RGB, 0, $hex); - } + return self::_getColourComponent($RGB, strlen($RGB) - 6, $hex); } /** @@ -335,11 +275,7 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable * @return string The green colour component */ public static function getGreen($RGB,$hex=TRUE) { - if (strlen($RGB) == 8) { - return self::_getColourComponent($RGB, 4, $hex); - } elseif (strlen($RGB) == 6) { - return self::_getColourComponent($RGB, 2, $hex); - } + return self::_getColourComponent($RGB, strlen($RGB) - 4, $hex); } /** @@ -351,11 +287,7 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable * @return string The blue colour component */ public static function getBlue($RGB,$hex=TRUE) { - if (strlen($RGB) == 8) { - return self::_getColourComponent($RGB, 6, $hex); - } elseif (strlen($RGB) == 6) { - return self::_getColourComponent($RGB, 4, $hex); - } + return self::_getColourComponent($RGB, strlen($RGB) - 2, $hex); } /** @@ -494,17 +426,4 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable ); } - /** - * Implement PHP __clone to create a deep clone, not just a shallow copy. - */ - public function __clone() { - $vars = get_object_vars($this); - foreach ($vars as $key => $value) { - if ((is_object($value)) && ($key != '_parent')) { - $this->$key = clone $value; - } else { - $this->$key = $value; - } - } - } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Style/Conditional.php b/htdocs/includes/phpexcel/PHPExcel/Style/Conditional.php index d9f7dd4cf5f..ffd7a9f9b57 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Style/Conditional.php +++ b/htdocs/includes/phpexcel/PHPExcel/Style/Conditional.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Style - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Style - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Style_Conditional implements PHPExcel_IComparable { @@ -238,7 +238,7 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable * Set Style * * @param PHPExcel_Style $pValue - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Style_Conditional */ public function setStyle(PHPExcel_Style $pValue = null) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Style/Fill.php b/htdocs/includes/phpexcel/PHPExcel/Style/Fill.php index afede653c74..1b4d0ad34d1 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Style/Fill.php +++ b/htdocs/includes/phpexcel/PHPExcel/Style/Fill.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Style - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,9 +31,9 @@ * * @category PHPExcel * @package PHPExcel_Style - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Style_Fill implements PHPExcel_IComparable +class PHPExcel_Style_Fill extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable { /* Fill types */ const FILL_NONE = 'none'; @@ -63,49 +63,28 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable * * @var string */ - private $_fillType = PHPExcel_Style_Fill::FILL_NONE; + protected $_fillType = PHPExcel_Style_Fill::FILL_NONE; /** * Rotation * * @var double */ - private $_rotation = 0; + protected $_rotation = 0; /** * Start color * * @var PHPExcel_Style_Color */ - private $_startColor; + protected $_startColor; /** * End color * * @var PHPExcel_Style_Color */ - private $_endColor; - - /** - * Parent Borders - * - * @var _parentPropertyName string - */ - private $_parentPropertyName; - - /** - * Supervisor? - * - * @var boolean - */ - private $_isSupervisor; - - /** - * Parent. Only used for supervisor - * - * @var PHPExcel_Style - */ - private $_parent; + protected $_endColor; /** * Create a new PHPExcel_Style_Fill @@ -117,10 +96,10 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable * Leave this value at default unless you understand exactly what * its ramifications are */ - public function __construct($isSupervisor = false, $isConditional = false) + public function __construct($isSupervisor = FALSE, $isConditional = FALSE) { // Supervisor? - $this->_isSupervisor = $isSupervisor; + parent::__construct($isSupervisor); // Initialise values if ($isConditional) { @@ -136,28 +115,6 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable } } - /** - * Bind parent. Only used for supervisor - * - * @param PHPExcel_Style $parent - * @return PHPExcel_Style_Fill - */ - public function bindParent($parent) - { - $this->_parent = $parent; - return $this; - } - - /** - * Is this a supervisor or a real style component? - * - * @return boolean - */ - public function getIsSupervisor() - { - return $this->_isSupervisor; - } - /** * Get the shared style component for the currently active cell in currently active sheet. * Only used for style supervisor @@ -169,38 +126,6 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable return $this->_parent->getSharedComponent()->getFill(); } - /** - * Get the currently active sheet. Only used for supervisor - * - * @return PHPExcel_Worksheet - */ - public function getActiveSheet() - { - return $this->_parent->getActiveSheet(); - } - - /** - * Get the currently active cell coordinate in currently active sheet. - * Only used for supervisor - * - * @return string E.g. 'A1' - */ - public function getSelectedCells() - { - return $this->getActiveSheet()->getSelectedCells(); - } - - /** - * Get the currently active cell coordinate in currently active sheet. - * Only used for supervisor - * - * @return string E.g. 'A1' - */ - public function getActiveCell() - { - return $this->getActiveSheet()->getActiveCell(); - } - /** * Build style array from subcomponents * @@ -231,7 +156,7 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable * * * @param array $pStyles Array containing style information - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Style_Fill */ public function applyFromArray($pStyles = null) { @@ -256,7 +181,7 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable } } } else { - throw new Exception("Invalid style array passed."); + throw new PHPExcel_Exception("Invalid style array passed."); } return $this; } @@ -330,7 +255,7 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable * Set Start Color * * @param PHPExcel_Style_Color $pValue - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Style_Fill */ public function setStartColor(PHPExcel_Style_Color $pValue = null) { @@ -359,7 +284,7 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable * Set End Color * * @param PHPExcel_Style_Color $pValue - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Style_Fill */ public function setEndColor(PHPExcel_Style_Color $pValue = null) { @@ -393,17 +318,4 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable ); } - /** - * Implement PHP __clone to create a deep clone, not just a shallow copy. - */ - public function __clone() { - $vars = get_object_vars($this); - foreach ($vars as $key => $value) { - if ((is_object($value)) && ($key != '_parent')) { - $this->$key = clone $value; - } else { - $this->$key = $value; - } - } - } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Style/Font.php b/htdocs/includes/phpexcel/PHPExcel/Style/Font.php index 59ae7730956..e89488c2c1c 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Style/Font.php +++ b/htdocs/includes/phpexcel/PHPExcel/Style/Font.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Style - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,9 +31,9 @@ * * @category PHPExcel * @package PHPExcel_Style - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Style_Font implements PHPExcel_IComparable +class PHPExcel_Style_Font extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable { /* Underline types */ const UNDERLINE_NONE = 'none'; @@ -47,84 +47,63 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable * * @var string */ - private $_name = 'Calibri'; + protected $_name = 'Calibri'; /** * Font Size * * @var float */ - private $_size = 11; + protected $_size = 11; /** * Bold * * @var boolean */ - private $_bold = false; + protected $_bold = FALSE; /** * Italic * * @var boolean */ - private $_italic = false; + protected $_italic = FALSE; /** * Superscript * * @var boolean */ - private $_superScript = false; + protected $_superScript = FALSE; /** * Subscript * * @var boolean */ - private $_subScript = false; + protected $_subScript = FALSE; /** * Underline * * @var string */ - private $_underline = self::UNDERLINE_NONE; + protected $_underline = self::UNDERLINE_NONE; /** * Strikethrough * * @var boolean */ - private $_strikethrough = false; + protected $_strikethrough = FALSE; /** * Foreground color * * @var PHPExcel_Style_Color */ - private $_color; - - /** - * Parent Borders - * - * @var _parentPropertyName string - */ - private $_parentPropertyName; - - /** - * Supervisor? - * - * @var boolean - */ - private $_isSupervisor; - - /** - * Parent. Only used for supervisor - * - * @var PHPExcel_Style - */ - private $_parent; + protected $_color; /** * Create a new PHPExcel_Style_Font @@ -136,10 +115,10 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable * Leave this value at default unless you understand exactly what * its ramifications are */ - public function __construct($isSupervisor = false, $isConditional = false) + public function __construct($isSupervisor = FALSE, $isConditional = FALSE) { // Supervisor? - $this->_isSupervisor = $isSupervisor; + parent::__construct($isSupervisor); // Initialise values if ($isConditional) { @@ -161,27 +140,6 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable } } - /** - * Bind parent. Only used for supervisor - * - * @param PHPExcel_Style $parent - * @return PHPExcel_Style_Font - */ - public function bindParent($parent) - { - $this->_parent = $parent; - } - - /** - * Is this a supervisor or a real style component? - * - * @return boolean - */ - public function getIsSupervisor() - { - return $this->_isSupervisor; - } - /** * Get the shared style component for the currently active cell in currently active sheet. * Only used for style supervisor @@ -193,38 +151,6 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable return $this->_parent->getSharedComponent()->getFont(); } - /** - * Get the currently active sheet. Only used for supervisor - * - * @return PHPExcel_Worksheet - */ - public function getActiveSheet() - { - return $this->_parent->getActiveSheet(); - } - - /** - * Get the currently active cell coordinate in currently active sheet. - * Only used for supervisor - * - * @return string E.g. 'A1' - */ - public function getSelectedCells() - { - return $this->getActiveSheet()->getSelectedCells(); - } - - /** - * Get the currently active cell coordinate in currently active sheet. - * Only used for supervisor - * - * @return string E.g. 'A1' - */ - public function getActiveCell() - { - return $this->getActiveSheet()->getActiveCell(); - } - /** * Build style array from subcomponents * @@ -242,12 +168,12 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable * * $objPHPExcel->getActiveSheet()->getStyle('B2')->getFont()->applyFromArray( * array( - * 'name' => 'Arial', - * 'bold' => true, - * 'italic' => false, + * 'name' => 'Arial', + * 'bold' => TRUE, + * 'italic' => FALSE, * 'underline' => PHPExcel_Style_Font::UNDERLINE_DOUBLE, - * 'strike' => false, - * 'color' => array( + * 'strike' => FALSE, + * 'color' => array( * 'rgb' => '808080' * ) * ) @@ -255,7 +181,7 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable * * * @param array $pStyles Array containing style information - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Style_Font */ public function applyFromArray($pStyles = null) { @@ -292,7 +218,7 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable } } } else { - throw new Exception("Invalid style array passed."); + throw new PHPExcel_Exception("Invalid style array passed."); } return $this; } @@ -501,7 +427,7 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable * Set Underline * * @param string|boolean $pValue PHPExcel_Style_Font underline type - * If a boolean is passed, then true equates to UNDERLINE_SINGLE, + * If a boolean is passed, then TRUE equates to UNDERLINE_SINGLE, * false equates to UNDERLINE_NONE * @return PHPExcel_Style_Font */ @@ -520,27 +446,6 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable return $this; } - /** - * Get Striketrough - * - * @deprecated Use getStrikethrough() instead. - * @return boolean - */ - public function getStriketrough() { - return $this->getStrikethrough(); - } - - /** - * Set Striketrough - * - * @deprecated Use setStrikethrough() instead. - * @param boolean $pValue - * @return PHPExcel_Style_Font - */ - public function setStriketrough($pValue = false) { - return $this->setStrikethrough($pValue); - } - /** * Get Strikethrough * @@ -585,7 +490,7 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable * Set Color * * @param PHPExcel_Style_Color $pValue - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Style_Font */ public function setColor(PHPExcel_Style_Color $pValue = null) { @@ -624,17 +529,4 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable ); } - /** - * Implement PHP __clone to create a deep clone, not just a shallow copy. - */ - public function __clone() { - $vars = get_object_vars($this); - foreach ($vars as $key => $value) { - if ((is_object($value)) && ($key != '_parent')) { - $this->$key = clone $value; - } else { - $this->$key = $value; - } - } - } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Style/NumberFormat.php b/htdocs/includes/phpexcel/PHPExcel/Style/NumberFormat.php index 19e064e4de8..e8a978fb28c 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Style/NumberFormat.php +++ b/htdocs/includes/phpexcel/PHPExcel/Style/NumberFormat.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Style - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,9 +31,9 @@ * * @category PHPExcel * @package PHPExcel_Style - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable +class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable { /* Pre-defined formats */ const FORMAT_GENERAL = 'General'; @@ -80,49 +80,28 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable * * @var array */ - private static $_builtInFormats; + protected static $_builtInFormats; /** * Excel built-in number formats (flipped, for faster lookups) * * @var array */ - private static $_flippedBuiltInFormats; + protected static $_flippedBuiltInFormats; /** * Format Code * * @var string */ - private $_formatCode = PHPExcel_Style_NumberFormat::FORMAT_GENERAL; + protected $_formatCode = PHPExcel_Style_NumberFormat::FORMAT_GENERAL; /** * Built-in format Code * * @var string */ - private $_builtInFormatCode = 0; - - /** - * Parent Borders - * - * @var _parentPropertyName string - */ - private $_parentPropertyName; - - /** - * Supervisor? - * - * @var boolean - */ - private $_isSupervisor; - - /** - * Parent. Only used for supervisor - * - * @var PHPExcel_Style - */ - private $_parent; + protected $_builtInFormatCode = 0; /** * Create a new PHPExcel_Style_NumberFormat @@ -134,37 +113,16 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable * Leave this value at default unless you understand exactly what * its ramifications are */ - public function __construct($isSupervisor = false, $isConditional = false) + public function __construct($isSupervisor = FALSE, $isConditional = FALSE) { // Supervisor? - $this->_isSupervisor = $isSupervisor; + parent::__construct($isSupervisor); if ($isConditional) { $this->_formatCode = NULL; } } - /** - * Bind parent. Only used for supervisor - * - * @param PHPExcel_Style $parent - * @return PHPExcel_Style_NumberFormat - */ - public function bindParent($parent) - { - $this->_parent = $parent; - } - - /** - * Is this a supervisor or a real style component? - * - * @return boolean - */ - public function getIsSupervisor() - { - return $this->_isSupervisor; - } - /** * Get the shared style component for the currently active cell in currently active sheet. * Only used for style supervisor @@ -176,38 +134,6 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable return $this->_parent->getSharedComponent()->getNumberFormat(); } - /** - * Get the currently active sheet. Only used for supervisor - * - * @return PHPExcel_Worksheet - */ - public function getActiveSheet() - { - return $this->_parent->getActiveSheet(); - } - - /** - * Get the currently active cell coordinate in currently active sheet. - * Only used for supervisor - * - * @return string E.g. 'A1' - */ - public function getSelectedCells() - { - return $this->getActiveSheet()->getSelectedCells(); - } - - /** - * Get the currently active cell coordinate in currently active sheet. - * Only used for supervisor - * - * @return string E.g. 'A1' - */ - public function getActiveCell() - { - return $this->getActiveSheet()->getActiveCell(); - } - /** * Build style array from subcomponents * @@ -231,7 +157,7 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable * * * @param array $pStyles Array containing style information - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Style_NumberFormat */ public function applyFromArray($pStyles = null) @@ -245,7 +171,7 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable } } } else { - throw new Exception("Invalid style array passed."); + throw new PHPExcel_Exception("Invalid style array passed."); } return $this; } @@ -443,21 +369,6 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable ); } - /** - * Implement PHP __clone to create a deep clone, not just a shallow copy. - */ - public function __clone() - { - $vars = get_object_vars($this); - foreach ($vars as $key => $value) { - if ((is_object($value)) && ($key != '_parent')) { - $this->$key = clone $value; - } else { - $this->$key = $value; - } - } - } - /** * Search/replace values to convert Excel date/time format masks to PHP format masks * @@ -479,8 +390,11 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable 'mmmm' => 'F', // short month name 'mmm' => 'M', - // mm is minutes if time or month w/leading zero + // mm is minutes if time, but can also be month w/leading zero + // so we try to identify times be the inclusion of a : separator in the mask + // It isn't perfect, but the best way I know how ':mm' => ':i', + 'mm:' => 'i:', // month leading zero 'mm' => 'm', // month no leading zero @@ -517,6 +431,108 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable 'h' => 'g' ); + private static function _formatAsDate(&$value, &$format) + { + // dvc: convert Excel formats to PHP date formats + + // strip off first part containing e.g. [$-F800] or [$USD-409] + // general syntax: [$-] + // language info is in hexadecimal + $format = preg_replace('/^(\[\$[A-Z]*-[0-9A-F]*\])/i', '', $format); + + // OpenOffice.org uses upper-case number formats, e.g. 'YYYY', convert to lower-case + $format = strtolower($format); + + $format = strtr($format,self::$_dateFormatReplacements); + if (!strpos($format,'A')) { // 24-hour time format + $format = strtr($format,self::$_dateFormatReplacements24); + } else { // 12-hour time format + $format = strtr($format,self::$_dateFormatReplacements12); + } + + $dateObj = PHPExcel_Shared_Date::ExcelToPHPObject($value); + $value = $dateObj->format($format); + } + + private static function _formatAsPercentage(&$value, &$format) + { + if ($format === self::FORMAT_PERCENTAGE) { + $value = round( (100 * $value), 0) . '%'; + } else { + if (preg_match('/\.[#0]+/i', $format, $m)) { + $s = substr($m[0], 0, 1) . (strlen($m[0]) - 1); + $format = str_replace($m[0], $s, $format); + } + if (preg_match('/^[#0]+/', $format, $m)) { + $format = str_replace($m[0], strlen($m[0]), $format); + } + $format = '%' . str_replace('%', 'f%%', $format); + + $value = sprintf($format, 100 * $value); + } + } + + private static function _formatAsFraction(&$value, &$format) + { + $sign = ($value < 0) ? '-' : ''; + + $integerPart = floor(abs($value)); + $decimalPart = trim(fmod(abs($value),1),'0.'); + $decimalLength = strlen($decimalPart); + $decimalDivisor = pow(10,$decimalLength); + + $GCD = PHPExcel_Calculation_MathTrig::GCD($decimalPart,$decimalDivisor); + + $adjustedDecimalPart = $decimalPart/$GCD; + $adjustedDecimalDivisor = $decimalDivisor/$GCD; + + if ((strpos($format,'0') !== false) || (strpos($format,'#') !== false) || (substr($format,0,3) == '? ?')) { + if ($integerPart == 0) { + $integerPart = ''; + } + $value = "$sign$integerPart $adjustedDecimalPart/$adjustedDecimalDivisor"; + } else { + $adjustedDecimalPart += $integerPart * $adjustedDecimalDivisor; + $value = "$sign$adjustedDecimalPart/$adjustedDecimalDivisor"; + } + } + + private static function _complexNumberFormatMask($number, $mask) { + if (strpos($mask,'.') !== false) { + $numbers = explode('.', $number . '.0'); + $masks = explode('.', $mask . '.0'); + $result1 = self::_complexNumberFormatMask($numbers[0], $masks[0]); + $result2 = strrev(self::_complexNumberFormatMask(strrev($numbers[1]), strrev($masks[1]))); + return $result1 . '.' . $result2; + } + + $r = preg_match_all('/0+/', $mask, $result, PREG_OFFSET_CAPTURE); + if ($r > 1) { + $result = array_reverse($result[0]); + + foreach($result as $block) { + $divisor = 1 . $block[0]; + $size = strlen($block[0]); + $offset = $block[1]; + + $blockValue = sprintf( + '%0' . $size . 'd', + fmod($number, $divisor) + ); + $number = floor($number / $divisor); + $mask = substr_replace($mask,$blockValue, $offset, $size); + } + if ($number > 0) { + $mask = substr_replace($mask, $number, $offset, 0); + } + $result = $mask; + } else { + $result = $number; + } + + return $result; + } + /** * Convert a value in a pre-defined format to a PHP string * @@ -525,7 +541,7 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable * @param array $callBack Callback function for additional formatting of string * @return string Formatted string */ - public static function toFormattedString($value = '', $format = '', $callBack = null) + public static function toFormattedString($value = '0', $format = PHPExcel_Style_NumberFormat::FORMAT_GENERAL, $callBack = null) { // For now we do not treat strings although section 4 of a format code affects strings if (!is_numeric($value)) return $value; @@ -585,46 +601,12 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable // Let's begin inspecting the format and converting the value to a formatted string if (preg_match('/^(\[\$[A-Z]*-[0-9A-F]*\])*[hmsdy]/i', $format)) { // datetime format - // dvc: convert Excel formats to PHP date formats - - // strip off first part containing e.g. [$-F800] or [$USD-409] - // general syntax: [$-] - // language info is in hexadecimal - $format = preg_replace('/^(\[\$[A-Z]*-[0-9A-F]*\])/i', '', $format); - - // OpenOffice.org uses upper-case number formats, e.g. 'YYYY', convert to lower-case - $format = strtolower($format); - - $format = strtr($format,self::$_dateFormatReplacements); - if (!strpos($format,'A')) { // 24-hour time format - $format = strtr($format,self::$_dateFormatReplacements24); - } else { // 12-hour time format - $format = strtr($format,self::$_dateFormatReplacements12); - } - - $dateObj = PHPExcel_Shared_Date::ExcelToPHPObject($value); - $value = $dateObj->format($format); - + self::_formatAsDate($value, $format); } else if (preg_match('/%$/', $format)) { // % number format - if ($format === self::FORMAT_PERCENTAGE) { - $value = round( (100 * $value), 0) . '%'; - } else { - if (preg_match('/\.[#0]+/i', $format, $m)) { - $s = substr($m[0], 0, 1) . (strlen($m[0]) - 1); - $format = str_replace($m[0], $s, $format); - } - if (preg_match('/^[#0]+/', $format, $m)) { - $format = str_replace($m[0], strlen($m[0]), $format); - } - $format = '%' . str_replace('%', 'f%%', $format); - - $value = sprintf($format, 100 * $value); - } - + self::_formatAsPercentage($value, $format); } else { if ($format === self::FORMAT_CURRENCY_EUR_SIMPLE) { $value = 'EUR ' . sprintf('%1.2f', $value); - } else { // In Excel formats, "_" is used to add spacing, which we can't do in HTML $format = preg_replace('/_./', '', $format); @@ -660,25 +642,7 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable if (preg_match('/#?.*\?\/\?/', $format, $m)) { //echo 'Format mask is fractional '.$format.'
'; if ($value != (int)$value) { - $sign = ($value < 0) ? '-' : ''; - - $integerPart = floor(abs($value)); - $decimalPart = trim(fmod(abs($value),1),'0.'); - $decimalLength = strlen($decimalPart); - $decimalDivisor = pow(10,$decimalLength); - - $GCD = PHPExcel_Calculation_MathTrig::GCD($decimalPart,$decimalDivisor); - - $adjustedDecimalPart = $decimalPart/$GCD; - $adjustedDecimalDivisor = $decimalDivisor/$GCD; - - if ((strpos($format,'0') !== false) || (strpos($format,'#') !== false) || (substr($format,0,3) == '? ?')) { - if ($integerPart == 0) { $integerPart = ''; } - $value = "$sign$integerPart $adjustedDecimalPart/$adjustedDecimalDivisor"; - } else { - $adjustedDecimalPart += $integerPart * $adjustedDecimalDivisor; - $value = "$sign$adjustedDecimalPart/$adjustedDecimalDivisor"; - } + self::_formatAsFraction($value, $format); } } else { @@ -688,7 +652,7 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable $value = $value / $scale; // Strip # - $format = preg_replace('/\\#/', '', $format); + $format = preg_replace('/\\#/', '0', $format); $n = "/\[[^\]]+\]/"; $m = preg_replace($n, '', $format); @@ -700,7 +664,6 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable // minimun width of formatted number (including dot) $minWidth = strlen($left) + strlen($dec) + strlen($right); - if ($useThousands) { $value = number_format( $value @@ -708,12 +671,19 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable , PHPExcel_Shared_String::getDecimalSeparator() , PHPExcel_Shared_String::getThousandsSeparator() ); + $value = preg_replace($number_regex, $value, $format); } else { - $sprintf_pattern = "%0$minWidth." . strlen($right) . "f"; - $value = sprintf($sprintf_pattern, $value); + if (preg_match('/[0#]E[+-]0/i', $format)) { + // Scientific format + $value = sprintf('%5.2E', $value); + } elseif (preg_match('/0([^\d\.]+)0/', $format)) { + $value = self::_complexNumberFormatMask($value, $format); + } else { + $sprintf_pattern = "%0$minWidth." . strlen($right) . "f"; + $value = sprintf($sprintf_pattern, $value); + $value = preg_replace($number_regex, $value, $format); + } } - - $value = preg_replace($number_regex, $value, $format); } } if (preg_match('/\[\$(.*)\]/u', $format, $m)) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Style/Protection.php b/htdocs/includes/phpexcel/PHPExcel/Style/Protection.php index 477742bd3f5..8dc1f31ad70 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Style/Protection.php +++ b/htdocs/includes/phpexcel/PHPExcel/Style/Protection.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPExcel * @package PHPExcel_Style - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 1.4.5, 2007-08-23 */ @@ -31,9 +31,9 @@ * * @category PHPExcel * @package PHPExcel_Style - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Style_Protection implements PHPExcel_IComparable +class PHPExcel_Style_Protection extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable { /** Protection styles */ const PROTECTION_INHERIT = 'inherit'; @@ -45,37 +45,16 @@ class PHPExcel_Style_Protection implements PHPExcel_IComparable * * @var string */ - private $_locked; + protected $_locked; /** * Hidden * * @var string */ - private $_hidden; + protected $_hidden; /** - * Parent Borders - * - * @var _parentPropertyName string - */ - private $_parentPropertyName; - - /** - * Supervisor? - * - * @var boolean - */ - private $_isSupervisor; - - /** - * Parent. Only used for supervisor - * - * @var PHPExcel_Style - */ - private $_parent; - - /** * Create a new PHPExcel_Style_Protection * * @param boolean $isSupervisor Flag indicating if this is a supervisor or not @@ -85,10 +64,10 @@ class PHPExcel_Style_Protection implements PHPExcel_IComparable * Leave this value at default unless you understand exactly what * its ramifications are */ - public function __construct($isSupervisor = false, $isConditional = false) + public function __construct($isSupervisor = FALSE, $isConditional = FALSE) { // Supervisor? - $this->_isSupervisor = $isSupervisor; + parent::__construct($isSupervisor); // Initialise values if (!$isConditional) { @@ -97,28 +76,6 @@ class PHPExcel_Style_Protection implements PHPExcel_IComparable } } - /** - * Bind parent. Only used for supervisor - * - * @param PHPExcel_Style $parent - * @return PHPExcel_Style_Protection - */ - public function bindParent($parent) - { - $this->_parent = $parent; - return $this; - } - - /** - * Is this a supervisor or a real style component? - * - * @return boolean - */ - public function getIsSupervisor() - { - return $this->_isSupervisor; - } - /** * Get the shared style component for the currently active cell in currently active sheet. * Only used for style supervisor @@ -130,38 +87,6 @@ class PHPExcel_Style_Protection implements PHPExcel_IComparable return $this->_parent->getSharedComponent()->getProtection(); } - /** - * Get the currently active sheet. Only used for supervisor - * - * @return PHPExcel_Worksheet - */ - public function getActiveSheet() - { - return $this->_parent->getActiveSheet(); - } - - /** - * Get the currently active cell coordinate in currently active sheet. - * Only used for supervisor - * - * @return string E.g. 'A1' - */ - public function getSelectedCells() - { - return $this->getActiveSheet()->getSelectedCells(); - } - - /** - * Get the currently active cell coordinate in currently active sheet. - * Only used for supervisor - * - * @return string E.g. 'A1' - */ - public function getActiveCell() - { - return $this->getActiveSheet()->getActiveCell(); - } - /** * Build style array from subcomponents * @@ -177,27 +102,32 @@ class PHPExcel_Style_Protection implements PHPExcel_IComparable * Apply styles from array * * - * $objPHPExcel->getActiveSheet()->getStyle('B2')->getLocked()->applyFromArray( array('locked' => true, 'hidden' => false) ); + * $objPHPExcel->getActiveSheet()->getStyle('B2')->getLocked()->applyFromArray( + * array( + * 'locked' => TRUE, + * 'hidden' => FALSE + * ) + * ); * * * @param array $pStyles Array containing style information - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Style_Protection */ - public function applyFromArray($pStyles = null) { + public function applyFromArray($pStyles = NULL) { if (is_array($pStyles)) { if ($this->_isSupervisor) { $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); } else { - if (array_key_exists('locked', $pStyles)) { + if (isset($pStyles['locked'])) { $this->setLocked($pStyles['locked']); } - if (array_key_exists('hidden', $pStyles)) { + if (isset($pStyles['hidden'])) { $this->setHidden($pStyles['hidden']); } } } else { - throw new Exception("Invalid style array passed."); + throw new PHPExcel_Exception("Invalid style array passed."); } return $this; } @@ -274,17 +204,4 @@ class PHPExcel_Style_Protection implements PHPExcel_IComparable ); } - /** - * Implement PHP __clone to create a deep clone, not just a shallow copy. - */ - public function __clone() { - $vars = get_object_vars($this); - foreach ($vars as $key => $value) { - if ((is_object($value)) && ($key != '_parent')) { - $this->$key = clone $value; - } else { - $this->$key = $value; - } - } - } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Style/Supervisor.php b/htdocs/includes/phpexcel/PHPExcel/Style/Supervisor.php new file mode 100644 index 00000000000..c2ce9c035ab --- /dev/null +++ b/htdocs/includes/phpexcel/PHPExcel/Style/Supervisor.php @@ -0,0 +1,132 @@ +_isSupervisor = $isSupervisor; + } + + /** + * Bind parent. Only used for supervisor + * + * @param PHPExcel $parent + * @return PHPExcel_Style_Supervisor + */ + public function bindParent($parent, $parentPropertyName=NULL) + { + $this->_parent = $parent; + return $this; + } + + /** + * Is this a supervisor or a cell style component? + * + * @return boolean + */ + public function getIsSupervisor() + { + return $this->_isSupervisor; + } + + /** + * Get the currently active sheet. Only used for supervisor + * + * @return PHPExcel_Worksheet + */ + public function getActiveSheet() + { + return $this->_parent->getActiveSheet(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor + * + * @return string E.g. 'A1' + */ + public function getSelectedCells() + { + return $this->getActiveSheet()->getSelectedCells(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor + * + * @return string E.g. 'A1' + */ + public function getActiveCell() + { + return $this->getActiveSheet()->getActiveCell(); + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if ((is_object($value)) && ($key != '_parent')) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/htdocs/includes/phpexcel/PHPExcel/Worksheet.php b/htdocs/includes/phpexcel/PHPExcel/Worksheet.php index 17ed5da962b..682ad9838ea 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Worksheet.php +++ b/htdocs/includes/phpexcel/PHPExcel/Worksheet.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,10 +19,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.8.0, 2014-03-02 */ @@ -30,779 +30,2846 @@ * PHPExcel_Worksheet * * @category PHPExcel - * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @package PHPExcel_Worksheet + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet implements PHPExcel_IComparable { - /* Break types */ - const BREAK_NONE = 0; - const BREAK_ROW = 1; - const BREAK_COLUMN = 2; + /* Break types */ + const BREAK_NONE = 0; + const BREAK_ROW = 1; + const BREAK_COLUMN = 2; - /* Sheet state */ - const SHEETSTATE_VISIBLE = 'visible'; - const SHEETSTATE_HIDDEN = 'hidden'; - const SHEETSTATE_VERYHIDDEN = 'veryHidden'; + /* Sheet state */ + const SHEETSTATE_VISIBLE = 'visible'; + const SHEETSTATE_HIDDEN = 'hidden'; + const SHEETSTATE_VERYHIDDEN = 'veryHidden'; + + /** + * Invalid characters in sheet title + * + * @var array + */ + private static $_invalidCharacters = array('*', ':', '/', '\\', '?', '[', ']'); + + /** + * Parent spreadsheet + * + * @var PHPExcel + */ + private $_parent; + + /** + * Cacheable collection of cells + * + * @var PHPExcel_CachedObjectStorage_xxx + */ + private $_cellCollection = null; + + /** + * Collection of row dimensions + * + * @var PHPExcel_Worksheet_RowDimension[] + */ + private $_rowDimensions = array(); + + /** + * Default row dimension + * + * @var PHPExcel_Worksheet_RowDimension + */ + private $_defaultRowDimension = null; + + /** + * Collection of column dimensions + * + * @var PHPExcel_Worksheet_ColumnDimension[] + */ + private $_columnDimensions = array(); + + /** + * Default column dimension + * + * @var PHPExcel_Worksheet_ColumnDimension + */ + private $_defaultColumnDimension = null; + + /** + * Collection of drawings + * + * @var PHPExcel_Worksheet_BaseDrawing[] + */ + private $_drawingCollection = null; + + /** + * Collection of Chart objects + * + * @var PHPExcel_Chart[] + */ + private $_chartCollection = array(); + + /** + * Worksheet title + * + * @var string + */ + private $_title; + + /** + * Sheet state + * + * @var string + */ + private $_sheetState; + + /** + * Page setup + * + * @var PHPExcel_Worksheet_PageSetup + */ + private $_pageSetup; + + /** + * Page margins + * + * @var PHPExcel_Worksheet_PageMargins + */ + private $_pageMargins; + + /** + * Page header/footer + * + * @var PHPExcel_Worksheet_HeaderFooter + */ + private $_headerFooter; + + /** + * Sheet view + * + * @var PHPExcel_Worksheet_SheetView + */ + private $_sheetView; + + /** + * Protection + * + * @var PHPExcel_Worksheet_Protection + */ + private $_protection; + + /** + * Collection of styles + * + * @var PHPExcel_Style[] + */ + private $_styles = array(); + + /** + * Conditional styles. Indexed by cell coordinate, e.g. 'A1' + * + * @var array + */ + private $_conditionalStylesCollection = array(); + + /** + * Is the current cell collection sorted already? + * + * @var boolean + */ + private $_cellCollectionIsSorted = false; + + /** + * Collection of breaks + * + * @var array + */ + private $_breaks = array(); + + /** + * Collection of merged cell ranges + * + * @var array + */ + private $_mergeCells = array(); + + /** + * Collection of protected cell ranges + * + * @var array + */ + private $_protectedCells = array(); + + /** + * Autofilter Range and selection + * + * @var PHPExcel_Worksheet_AutoFilter + */ + private $_autoFilter = NULL; + + /** + * Freeze pane + * + * @var string + */ + private $_freezePane = ''; + + /** + * Show gridlines? + * + * @var boolean + */ + private $_showGridlines = true; + + /** + * Print gridlines? + * + * @var boolean + */ + private $_printGridlines = false; + + /** + * Show row and column headers? + * + * @var boolean + */ + private $_showRowColHeaders = true; + + /** + * Show summary below? (Row/Column outline) + * + * @var boolean + */ + private $_showSummaryBelow = true; + + /** + * Show summary right? (Row/Column outline) + * + * @var boolean + */ + private $_showSummaryRight = true; + + /** + * Collection of comments + * + * @var PHPExcel_Comment[] + */ + private $_comments = array(); + + /** + * Active cell. (Only one!) + * + * @var string + */ + private $_activeCell = 'A1'; + + /** + * Selected cells + * + * @var string + */ + private $_selectedCells = 'A1'; + + /** + * Cached highest column + * + * @var string + */ + private $_cachedHighestColumn = 'A'; + + /** + * Cached highest row + * + * @var int + */ + private $_cachedHighestRow = 1; + + /** + * Right-to-left? + * + * @var boolean + */ + private $_rightToLeft = false; + + /** + * Hyperlinks. Indexed by cell coordinate, e.g. 'A1' + * + * @var array + */ + private $_hyperlinkCollection = array(); + + /** + * Data validation objects. Indexed by cell coordinate, e.g. 'A1' + * + * @var array + */ + private $_dataValidationCollection = array(); + + /** + * Tab color + * + * @var PHPExcel_Style_Color + */ + private $_tabColor; + + /** + * Dirty flag + * + * @var boolean + */ + private $_dirty = true; + + /** + * Hash + * + * @var string + */ + private $_hash = null; + + /** + * CodeName + * + * @var string + */ + private $_codeName = null; /** - * Invalid characters in sheet title - * - * @var array - */ - private static $_invalidCharacters = array('*', ':', '/', '\\', '?', '[', ']'); + * Create a new worksheet + * + * @param PHPExcel $pParent + * @param string $pTitle + */ + public function __construct(PHPExcel $pParent = null, $pTitle = 'Worksheet') + { + // Set parent and title + $this->_parent = $pParent; + $this->setTitle($pTitle, FALSE); + // setTitle can change $pTitle + $this->setCodeName($this->getTitle()); + $this->setSheetState(PHPExcel_Worksheet::SHEETSTATE_VISIBLE); - /** - * Parent spreadsheet - * - * @var PHPExcel - */ - private $_parent; + $this->_cellCollection = PHPExcel_CachedObjectStorageFactory::getInstance($this); - /** - * Cacheable collection of cells - * - * @var PHPExcel_CachedObjectStorage_xxx - */ - private $_cellCollection = null; + // Set page setup + $this->_pageSetup = new PHPExcel_Worksheet_PageSetup(); - /** - * Collection of row dimensions - * - * @var PHPExcel_Worksheet_RowDimension[] - */ - private $_rowDimensions = array(); + // Set page margins + $this->_pageMargins = new PHPExcel_Worksheet_PageMargins(); - /** - * Default row dimension - * - * @var PHPExcel_Worksheet_RowDimension - */ - private $_defaultRowDimension = null; + // Set page header/footer + $this->_headerFooter = new PHPExcel_Worksheet_HeaderFooter(); - /** - * Collection of column dimensions - * - * @var PHPExcel_Worksheet_ColumnDimension[] - */ - private $_columnDimensions = array(); + // Set sheet view + $this->_sheetView = new PHPExcel_Worksheet_SheetView(); - /** - * Default column dimension - * - * @var PHPExcel_Worksheet_ColumnDimension - */ - private $_defaultColumnDimension = null; + // Drawing collection + $this->_drawingCollection = new ArrayObject(); - /** - * Collection of drawings - * - * @var PHPExcel_Worksheet_BaseDrawing[] - */ - private $_drawingCollection = null; + // Chart collection + $this->_chartCollection = new ArrayObject(); - /** - * Collection of Chart objects - * - * @var PHPExcel_Chart[] - */ - private $_chartCollection = array(); + // Protection + $this->_protection = new PHPExcel_Worksheet_Protection(); - /** - * Worksheet title - * - * @var string - */ - private $_title; + // Default row dimension + $this->_defaultRowDimension = new PHPExcel_Worksheet_RowDimension(NULL); - /** - * Sheet state - * - * @var string - */ - private $_sheetState; + // Default column dimension + $this->_defaultColumnDimension = new PHPExcel_Worksheet_ColumnDimension(NULL); - /** - * Page setup - * - * @var PHPExcel_Worksheet_PageSetup - */ - private $_pageSetup; - - /** - * Page margins - * - * @var PHPExcel_Worksheet_PageMargins - */ - private $_pageMargins; - - /** - * Page header/footer - * - * @var PHPExcel_Worksheet_HeaderFooter - */ - private $_headerFooter; - - /** - * Sheet view - * - * @var PHPExcel_Worksheet_SheetView - */ - private $_sheetView; - - /** - * Protection - * - * @var PHPExcel_Worksheet_Protection - */ - private $_protection; - - /** - * Collection of styles - * - * @var PHPExcel_Style[] - */ - private $_styles = array(); - - /** - * Conditional styles. Indexed by cell coordinate, e.g. 'A1' - * - * @var array - */ - private $_conditionalStylesCollection = array(); - - /** - * Is the current cell collection sorted already? - * - * @var boolean - */ - private $_cellCollectionIsSorted = false; - - /** - * Collection of breaks - * - * @var array - */ - private $_breaks = array(); - - /** - * Collection of merged cell ranges - * - * @var array - */ - private $_mergeCells = array(); - - /** - * Collection of protected cell ranges - * - * @var array - */ - private $_protectedCells = array(); - - /** - * Autofilter Range and selection - * - * @var PHPExcel_Worksheet_AutoFilter - */ - private $_autoFilter = NULL; - - /** - * Freeze pane - * - * @var string - */ - private $_freezePane = ''; - - /** - * Show gridlines? - * - * @var boolean - */ - private $_showGridlines = true; - - /** - * Print gridlines? - * - * @var boolean - */ - private $_printGridlines = false; - - /** - * Show row and column headers? - * - * @var boolean - */ - private $_showRowColHeaders = true; - - /** - * Show summary below? (Row/Column outline) - * - * @var boolean - */ - private $_showSummaryBelow = true; - - /** - * Show summary right? (Row/Column outline) - * - * @var boolean - */ - private $_showSummaryRight = true; - - /** - * Collection of comments - * - * @var PHPExcel_Comment[] - */ - private $_comments = array(); - - /** - * Active cell. (Only one!) - * - * @var string - */ - private $_activeCell = 'A1'; - - /** - * Selected cells - * - * @var string - */ - private $_selectedCells = 'A1'; - - /** - * Cached highest column - * - * @var string - */ - private $_cachedHighestColumn = 'A'; - - /** - * Cached highest row - * - * @var int - */ - private $_cachedHighestRow = 1; - - /** - * Right-to-left? - * - * @var boolean - */ - private $_rightToLeft = false; - - /** - * Hyperlinks. Indexed by cell coordinate, e.g. 'A1' - * - * @var array - */ - private $_hyperlinkCollection = array(); - - /** - * Data validation objects. Indexed by cell coordinate, e.g. 'A1' - * - * @var array - */ - private $_dataValidationCollection = array(); - - /** - * Tab color - * - * @var PHPExcel_Style_Color - */ - private $_tabColor; - - /** - * Dirty flag - * - * @var boolean - */ - private $_dirty = true; - - /** - * Hash - * - * @var string - */ - private $_hash = null; - - /** - * Create a new worksheet - * - * @param PHPExcel $pParent - * @param string $pTitle - */ - public function __construct(PHPExcel $pParent = null, $pTitle = 'Worksheet') - { - // Set parent and title - $this->_parent = $pParent; - $this->setTitle($pTitle, FALSE); - $this->setSheetState(PHPExcel_Worksheet::SHEETSTATE_VISIBLE); - - $this->_cellCollection = PHPExcel_CachedObjectStorageFactory::getInstance($this); - - // Set page setup - $this->_pageSetup = new PHPExcel_Worksheet_PageSetup(); - - // Set page margins - $this->_pageMargins = new PHPExcel_Worksheet_PageMargins(); - - // Set page header/footer - $this->_headerFooter = new PHPExcel_Worksheet_HeaderFooter(); - - // Set sheet view - $this->_sheetView = new PHPExcel_Worksheet_SheetView(); - - // Drawing collection - $this->_drawingCollection = new ArrayObject(); - - // Chart collection - $this->_chartCollection = new ArrayObject(); - - // Protection - $this->_protection = new PHPExcel_Worksheet_Protection(); - - // Default row dimension - $this->_defaultRowDimension = new PHPExcel_Worksheet_RowDimension(NULL); - - // Default column dimension - $this->_defaultColumnDimension = new PHPExcel_Worksheet_ColumnDimension(NULL); - - $this->_autoFilter = new PHPExcel_Worksheet_AutoFilter(NULL, $this); - } + $this->_autoFilter = new PHPExcel_Worksheet_AutoFilter(NULL, $this); + } - /** - * Disconnect all cells from this PHPExcel_Worksheet object, - * typically so that the worksheet object can be unset - * - */ + /** + * Disconnect all cells from this PHPExcel_Worksheet object, + * typically so that the worksheet object can be unset + * + */ public function disconnectCells() { - $this->_cellCollection->unsetWorksheetCells(); - $this->_cellCollection = null; + if ( $this->_cellCollection !== NULL){ + $this->_cellCollection->unsetWorksheetCells(); + $this->_cellCollection = NULL; + } + // detach ourself from the workbook, so that it can then delete this worksheet successfully + $this->_parent = null; + } - // detach ourself from the workbook, so that it can then delete this worksheet successfully - $this->_parent = null; + /** + * Code to execute when this worksheet is unset() + * + */ + function __destruct() { + PHPExcel_Calculation::getInstance($this->_parent) + ->clearCalculationCacheForWorksheet($this->_title); + + $this->disconnectCells(); } - /** - * Return the cache controller for the cell collection - * - * @return PHPExcel_CachedObjectStorage_xxx - */ + /** + * Return the cache controller for the cell collection + * + * @return PHPExcel_CachedObjectStorage_xxx + */ public function getCellCacheController() { - return $this->_cellCollection; - } // function getCellCacheController() + return $this->_cellCollection; + } // function getCellCacheController() - /** - * Get array of invalid characters for sheet title - * - * @return array - */ - public static function getInvalidCharacters() - { - return self::$_invalidCharacters; - } + /** + * Get array of invalid characters for sheet title + * + * @return array + */ + public static function getInvalidCharacters() + { + return self::$_invalidCharacters; + } - /** - * Check sheet title for valid Excel syntax - * - * @param string $pValue The string to check - * @return string The valid string - * @throws Exception - */ - private static function _checkSheetTitle($pValue) - { - // Some of the printable ASCII characters are invalid: * : / \ ? [ ] - if (str_replace(self::$_invalidCharacters, '', $pValue) !== $pValue) { - throw new Exception('Invalid character found in sheet title'); - } + /** + * Check sheet code name for valid Excel syntax + * + * @param string $pValue The string to check + * @return string The valid string + * @throws Exception + */ + private static function _checkSheetCodeName($pValue) + { + $CharCount = PHPExcel_Shared_String::CountCharacters($pValue); + if ($CharCount == 0) { + throw new PHPExcel_Exception('Sheet code name cannot be empty.'); + } + // Some of the printable ASCII characters are invalid: * : / \ ? [ ] and first and last characters cannot be a "'" + if ((str_replace(self::$_invalidCharacters, '', $pValue) !== $pValue) || + (PHPExcel_Shared_String::Substring($pValue,-1,1)=='\'') || + (PHPExcel_Shared_String::Substring($pValue,0,1)=='\'')) { + throw new PHPExcel_Exception('Invalid character found in sheet code name'); + } + + // Maximum 31 characters allowed for sheet title + if ($CharCount > 31) { + throw new PHPExcel_Exception('Maximum 31 characters allowed in sheet code name.'); + } + + return $pValue; + } - // Maximum 31 characters allowed for sheet title - if (PHPExcel_Shared_String::CountCharacters($pValue) > 31) { - throw new Exception('Maximum 31 characters allowed in sheet title.'); - } + /** + * Check sheet title for valid Excel syntax + * + * @param string $pValue The string to check + * @return string The valid string + * @throws PHPExcel_Exception + */ + private static function _checkSheetTitle($pValue) + { + // Some of the printable ASCII characters are invalid: * : / \ ? [ ] + if (str_replace(self::$_invalidCharacters, '', $pValue) !== $pValue) { + throw new PHPExcel_Exception('Invalid character found in sheet title'); + } - return $pValue; - } + // Maximum 31 characters allowed for sheet title + if (PHPExcel_Shared_String::CountCharacters($pValue) > 31) { + throw new PHPExcel_Exception('Maximum 31 characters allowed in sheet title.'); + } - /** - * Get collection of cells - * - * @param boolean $pSorted Also sort the cell collection? - * @return PHPExcel_Cell[] - */ - public function getCellCollection($pSorted = true) - { - if ($pSorted) { - // Re-order cell collection - return $this->sortCellCollection(); - } - if ($this->_cellCollection !== NULL) { - return $this->_cellCollection->getCellList(); - } - return array(); - } + return $pValue; + } - /** - * Sort collection of cells - * - * @return PHPExcel_Worksheet - */ - public function sortCellCollection() - { - if ($this->_cellCollection !== NULL) { - return $this->_cellCollection->getSortedCellList(); - } - return array(); - } + /** + * Get collection of cells + * + * @param boolean $pSorted Also sort the cell collection? + * @return PHPExcel_Cell[] + */ + public function getCellCollection($pSorted = true) + { + if ($pSorted) { + // Re-order cell collection + return $this->sortCellCollection(); + } + if ($this->_cellCollection !== NULL) { + return $this->_cellCollection->getCellList(); + } + return array(); + } - /** - * Get collection of row dimensions - * - * @return PHPExcel_Worksheet_RowDimension[] - */ - public function getRowDimensions() - { - return $this->_rowDimensions; - } + /** + * Sort collection of cells + * + * @return PHPExcel_Worksheet + */ + public function sortCellCollection() + { + if ($this->_cellCollection !== NULL) { + return $this->_cellCollection->getSortedCellList(); + } + return array(); + } - /** - * Get default row dimension - * - * @return PHPExcel_Worksheet_RowDimension - */ - public function getDefaultRowDimension() - { - return $this->_defaultRowDimension; - } + /** + * Get collection of row dimensions + * + * @return PHPExcel_Worksheet_RowDimension[] + */ + public function getRowDimensions() + { + return $this->_rowDimensions; + } - /** - * Get collection of column dimensions - * - * @return PHPExcel_Worksheet_ColumnDimension[] - */ - public function getColumnDimensions() - { - return $this->_columnDimensions; - } + /** + * Get default row dimension + * + * @return PHPExcel_Worksheet_RowDimension + */ + public function getDefaultRowDimension() + { + return $this->_defaultRowDimension; + } - /** - * Get default column dimension - * - * @return PHPExcel_Worksheet_ColumnDimension - */ - public function getDefaultColumnDimension() - { - return $this->_defaultColumnDimension; - } + /** + * Get collection of column dimensions + * + * @return PHPExcel_Worksheet_ColumnDimension[] + */ + public function getColumnDimensions() + { + return $this->_columnDimensions; + } - /** - * Get collection of drawings - * - * @return PHPExcel_Worksheet_BaseDrawing[] - */ - public function getDrawingCollection() - { - return $this->_drawingCollection; - } + /** + * Get default column dimension + * + * @return PHPExcel_Worksheet_ColumnDimension + */ + public function getDefaultColumnDimension() + { + return $this->_defaultColumnDimension; + } - /** - * Get collection of charts - * - * @return PHPExcel_Chart[] - */ - public function getChartCollection() - { - return $this->_chartCollection; - } + /** + * Get collection of drawings + * + * @return PHPExcel_Worksheet_BaseDrawing[] + */ + public function getDrawingCollection() + { + return $this->_drawingCollection; + } - /** - * Add chart - * - * @param PHPExcel_Chart $pChart - * @param int|null $iChartIndex Index where chart should go (0,1,..., or null for last) - * @return PHPExcel_Chart - * @throws Exception - */ - public function addChart(PHPExcel_Chart $pChart = null, $iChartIndex = null) - { - $pChart->setWorksheet($this); - if (is_null($iChartIndex)) { - $this->_chartCollection[] = $pChart; - } else { - // Insert the chart at the requested index - array_splice($this->_chartCollection, $iChartIndex, 0, array($pChart)); - } + /** + * Get collection of charts + * + * @return PHPExcel_Chart[] + */ + public function getChartCollection() + { + return $this->_chartCollection; + } - return $pChart; - } + /** + * Add chart + * + * @param PHPExcel_Chart $pChart + * @param int|null $iChartIndex Index where chart should go (0,1,..., or null for last) + * @return PHPExcel_Chart + */ + public function addChart(PHPExcel_Chart $pChart = null, $iChartIndex = null) + { + $pChart->setWorksheet($this); + if (is_null($iChartIndex)) { + $this->_chartCollection[] = $pChart; + } else { + // Insert the chart at the requested index + array_splice($this->_chartCollection, $iChartIndex, 0, array($pChart)); + } - /** - * Return the count of charts on this worksheet - * - * @return int The number of charts - * @throws Exception - */ - public function getChartCount() - { - return count($this->_chartCollection); - } + return $pChart; + } - /** - * Get a chart by its index position - * - * @param string $index Chart index position - * @return false|PHPExcel_Chart - * @throws Exception - */ - public function getChartByIndex($index = null) - { - $chartCount = count($this->_chartCollection); - if ($chartCount == 0) { - return false; - } - if (is_null($index)) { - $index = --$chartCount; - } - if (!isset($this->_chartCollection[$index])) { - return false; - } + /** + * Return the count of charts on this worksheet + * + * @return int The number of charts + */ + public function getChartCount() + { + return count($this->_chartCollection); + } - return $this->_chartCollection[$index]; - } + /** + * Get a chart by its index position + * + * @param string $index Chart index position + * @return false|PHPExcel_Chart + * @throws PHPExcel_Exception + */ + public function getChartByIndex($index = null) + { + $chartCount = count($this->_chartCollection); + if ($chartCount == 0) { + return false; + } + if (is_null($index)) { + $index = --$chartCount; + } + if (!isset($this->_chartCollection[$index])) { + return false; + } - /** - * Return an array of the names of charts on this worksheet - * - * @return string[] The names of charts - * @throws Exception - */ - public function getChartNames() - { - $chartNames = array(); - foreach($this->_chartCollection as $chart) { - $chartNames[] = $chart->getName(); - } - return $chartNames; - } + return $this->_chartCollection[$index]; + } - /** - * Get a chart by name - * - * @param string $chartName Chart name - * @return false|PHPExcel_Chart - * @throws Exception - */ - public function getChartByName($chartName = '') - { - $chartCount = count($this->_chartCollection); - if ($chartCount == 0) { - return false; - } - foreach($this->_chartCollection as $index => $chart) { - if ($chart->getName() == $chartName) { - return $this->_chartCollection[$index]; - } - } - return false; - } + /** + * Return an array of the names of charts on this worksheet + * + * @return string[] The names of charts + * @throws PHPExcel_Exception + */ + public function getChartNames() + { + $chartNames = array(); + foreach($this->_chartCollection as $chart) { + $chartNames[] = $chart->getName(); + } + return $chartNames; + } - /** - * Refresh column dimensions - * - * @return PHPExcel_Worksheet - */ - public function refreshColumnDimensions() - { - $currentColumnDimensions = $this->getColumnDimensions(); - $newColumnDimensions = array(); + /** + * Get a chart by name + * + * @param string $chartName Chart name + * @return false|PHPExcel_Chart + * @throws PHPExcel_Exception + */ + public function getChartByName($chartName = '') + { + $chartCount = count($this->_chartCollection); + if ($chartCount == 0) { + return false; + } + foreach($this->_chartCollection as $index => $chart) { + if ($chart->getName() == $chartName) { + return $this->_chartCollection[$index]; + } + } + return false; + } - foreach ($currentColumnDimensions as $objColumnDimension) { - $newColumnDimensions[$objColumnDimension->getColumnIndex()] = $objColumnDimension; - } + /** + * Refresh column dimensions + * + * @return PHPExcel_Worksheet + */ + public function refreshColumnDimensions() + { + $currentColumnDimensions = $this->getColumnDimensions(); + $newColumnDimensions = array(); - $this->_columnDimensions = $newColumnDimensions; + foreach ($currentColumnDimensions as $objColumnDimension) { + $newColumnDimensions[$objColumnDimension->getColumnIndex()] = $objColumnDimension; + } - return $this; - } + $this->_columnDimensions = $newColumnDimensions; - /** - * Refresh row dimensions - * - * @return PHPExcel_Worksheet - */ - public function refreshRowDimensions() - { - $currentRowDimensions = $this->getRowDimensions(); - $newRowDimensions = array(); + return $this; + } - foreach ($currentRowDimensions as $objRowDimension) { - $newRowDimensions[$objRowDimension->getRowIndex()] = $objRowDimension; - } + /** + * Refresh row dimensions + * + * @return PHPExcel_Worksheet + */ + public function refreshRowDimensions() + { + $currentRowDimensions = $this->getRowDimensions(); + $newRowDimensions = array(); - $this->_rowDimensions = $newRowDimensions; + foreach ($currentRowDimensions as $objRowDimension) { + $newRowDimensions[$objRowDimension->getRowIndex()] = $objRowDimension; + } - return $this; - } + $this->_rowDimensions = $newRowDimensions; - /** - * Calculate worksheet dimension - * - * @return string String containing the dimension of this worksheet - */ - public function calculateWorksheetDimension() - { - // Return - return 'A1' . ':' . $this->getHighestColumn() . $this->getHighestRow(); - } + return $this; + } - /** - * Calculate worksheet data dimension - * - * @return string String containing the dimension of this worksheet that actually contain data - */ - public function calculateWorksheetDataDimension() - { - // Return - return 'A1' . ':' . $this->getHighestDataColumn() . $this->getHighestDataRow(); - } + /** + * Calculate worksheet dimension + * + * @return string String containing the dimension of this worksheet + */ + public function calculateWorksheetDimension() + { + // Return + return 'A1' . ':' . $this->getHighestColumn() . $this->getHighestRow(); + } - /** - * Calculate widths for auto-size columns - * - * @param boolean $calculateMergeCells Calculate merge cell width - * @return PHPExcel_Worksheet; - */ - public function calculateColumnWidths($calculateMergeCells = false) - { - // initialize $autoSizes array - $autoSizes = array(); - foreach ($this->getColumnDimensions() as $colDimension) { - if ($colDimension->getAutoSize()) { - $autoSizes[$colDimension->getColumnIndex()] = -1; - } - } + /** + * Calculate worksheet data dimension + * + * @return string String containing the dimension of this worksheet that actually contain data + */ + public function calculateWorksheetDataDimension() + { + // Return + return 'A1' . ':' . $this->getHighestDataColumn() . $this->getHighestDataRow(); + } - // There is only something to do if there are some auto-size columns - if (!empty($autoSizes)) { + /** + * Calculate widths for auto-size columns + * + * @param boolean $calculateMergeCells Calculate merge cell width + * @return PHPExcel_Worksheet; + */ + public function calculateColumnWidths($calculateMergeCells = false) + { + // initialize $autoSizes array + $autoSizes = array(); + foreach ($this->getColumnDimensions() as $colDimension) { + if ($colDimension->getAutoSize()) { + $autoSizes[$colDimension->getColumnIndex()] = -1; + } + } - // build list of cells references that participate in a merge - $isMergeCell = array(); - foreach ($this->getMergeCells() as $cells) { - foreach (PHPExcel_Cell::extractAllCellReferencesInRange($cells) as $cellReference) { - $isMergeCell[$cellReference] = true; - } - } + // There is only something to do if there are some auto-size columns + if (!empty($autoSizes)) { - // loop through all cells in the worksheet - foreach ($this->getCellCollection(false) as $cellID) { - $cell = $this->getCell($cellID); - if (isset($autoSizes[$cell->getColumn()])) { - // Determine width if cell does not participate in a merge - if (!isset($isMergeCell[$cell->getCoordinate()])) { - // Calculated value - $cellValue = $cell->getCalculatedValue(); + // build list of cells references that participate in a merge + $isMergeCell = array(); + foreach ($this->getMergeCells() as $cells) { + foreach (PHPExcel_Cell::extractAllCellReferencesInRange($cells) as $cellReference) { + $isMergeCell[$cellReference] = true; + } + } - // To formatted string - $cellValue = PHPExcel_Style_NumberFormat::toFormattedString($cellValue, $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode()); - - $autoSizes[$cell->getColumn()] = max( - (float)$autoSizes[$cell->getColumn()], - (float)PHPExcel_Shared_Font::calculateColumnWidth( - $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont(), - $cellValue, - $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getAlignment()->getTextRotation(), - $this->getDefaultStyle()->getFont() - ) + // loop through all cells in the worksheet + foreach ($this->getCellCollection(false) as $cellID) { + $cell = $this->getCell($cellID); + if (isset($autoSizes[$this->_cellCollection->getCurrentColumn()])) { + // Determine width if cell does not participate in a merge + if (!isset($isMergeCell[$this->_cellCollection->getCurrentAddress()])) { + // Calculated value + // To formatted string + $cellValue = PHPExcel_Style_NumberFormat::toFormattedString( + $cell->getCalculatedValue(), + $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode() ); - } - } - } - // adjust column widths - foreach ($autoSizes as $columnIndex => $width) { - if ($width == -1) $width = $this->getDefaultColumnDimension()->getWidth(); - $this->getColumnDimension($columnIndex)->setWidth($width); - } - } + $autoSizes[$this->_cellCollection->getCurrentColumn()] = max( + (float) $autoSizes[$this->_cellCollection->getCurrentColumn()], + (float)PHPExcel_Shared_Font::calculateColumnWidth( + $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont(), + $cellValue, + $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getAlignment()->getTextRotation(), + $this->getDefaultStyle()->getFont() + ) + ); + } + } + } - return $this; - } + // adjust column widths + foreach ($autoSizes as $columnIndex => $width) { + if ($width == -1) $width = $this->getDefaultColumnDimension()->getWidth(); + $this->getColumnDimension($columnIndex)->setWidth($width); + } + } - /** - * Get parent - * - * @return PHPExcel - */ + return $this; + } + + /** + * Get parent + * + * @return PHPExcel + */ public function getParent() { - return $this->_parent; - } + return $this->_parent; + } - /** - * Re-bind parent - * - * @param PHPExcel $parent - * @return PHPExcel_Worksheet - */ + /** + * Re-bind parent + * + * @param PHPExcel $parent + * @return PHPExcel_Worksheet + */ public function rebindParent(PHPExcel $parent) { - $namedRanges = $this->_parent->getNamedRanges(); - foreach ($namedRanges as $namedRange) { - $parent->addNamedRange($namedRange); - } + if ($this->_parent !== null) { + $namedRanges = $this->_parent->getNamedRanges(); + foreach ($namedRanges as $namedRange) { + $parent->addNamedRange($namedRange); + } - $this->_parent->removeSheetByIndex( - $this->_parent->getIndex($this) + $this->_parent->removeSheetByIndex( + $this->_parent->getIndex($this) + ); + } + $this->_parent = $parent; + + return $this; + } + + /** + * Get title + * + * @return string + */ + public function getTitle() + { + return $this->_title; + } + + /** + * Set title + * + * @param string $pValue String containing the dimension of this worksheet + * @param string $updateFormulaCellReferences boolean Flag indicating whether cell references in formulae should + * be updated to reflect the new sheet name. + * This should be left as the default true, unless you are + * certain that no formula cells on any worksheet contain + * references to this worksheet + * @return PHPExcel_Worksheet + */ + public function setTitle($pValue = 'Worksheet', $updateFormulaCellReferences = true) + { + // Is this a 'rename' or not? + if ($this->getTitle() == $pValue) { + return $this; + } + + // Syntax check + self::_checkSheetTitle($pValue); + + // Old title + $oldTitle = $this->getTitle(); + + if ($this->_parent) { + // Is there already such sheet name? + if ($this->_parent->sheetNameExists($pValue)) { + // Use name, but append with lowest possible integer + + if (PHPExcel_Shared_String::CountCharacters($pValue) > 29) { + $pValue = PHPExcel_Shared_String::Substring($pValue,0,29); + } + $i = 1; + while ($this->_parent->sheetNameExists($pValue . ' ' . $i)) { + ++$i; + if ($i == 10) { + if (PHPExcel_Shared_String::CountCharacters($pValue) > 28) { + $pValue = PHPExcel_Shared_String::Substring($pValue,0,28); + } + } elseif ($i == 100) { + if (PHPExcel_Shared_String::CountCharacters($pValue) > 27) { + $pValue = PHPExcel_Shared_String::Substring($pValue,0,27); + } + } + } + + $altTitle = $pValue . ' ' . $i; + return $this->setTitle($altTitle,$updateFormulaCellReferences); + } + } + + // Set title + $this->_title = $pValue; + $this->_dirty = true; + + if ($this->_parent) { + // New title + $newTitle = $this->getTitle(); + PHPExcel_Calculation::getInstance($this->_parent) + ->renameCalculationCacheForWorksheet($oldTitle, $newTitle); + if ($updateFormulaCellReferences) + PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->_parent, $oldTitle, $newTitle); + } + + return $this; + } + + /** + * Get sheet state + * + * @return string Sheet state (visible, hidden, veryHidden) + */ + public function getSheetState() { + return $this->_sheetState; + } + + /** + * Set sheet state + * + * @param string $value Sheet state (visible, hidden, veryHidden) + * @return PHPExcel_Worksheet + */ + public function setSheetState($value = PHPExcel_Worksheet::SHEETSTATE_VISIBLE) { + $this->_sheetState = $value; + return $this; + } + + /** + * Get page setup + * + * @return PHPExcel_Worksheet_PageSetup + */ + public function getPageSetup() + { + return $this->_pageSetup; + } + + /** + * Set page setup + * + * @param PHPExcel_Worksheet_PageSetup $pValue + * @return PHPExcel_Worksheet + */ + public function setPageSetup(PHPExcel_Worksheet_PageSetup $pValue) + { + $this->_pageSetup = $pValue; + return $this; + } + + /** + * Get page margins + * + * @return PHPExcel_Worksheet_PageMargins + */ + public function getPageMargins() + { + return $this->_pageMargins; + } + + /** + * Set page margins + * + * @param PHPExcel_Worksheet_PageMargins $pValue + * @return PHPExcel_Worksheet + */ + public function setPageMargins(PHPExcel_Worksheet_PageMargins $pValue) + { + $this->_pageMargins = $pValue; + return $this; + } + + /** + * Get page header/footer + * + * @return PHPExcel_Worksheet_HeaderFooter + */ + public function getHeaderFooter() + { + return $this->_headerFooter; + } + + /** + * Set page header/footer + * + * @param PHPExcel_Worksheet_HeaderFooter $pValue + * @return PHPExcel_Worksheet + */ + public function setHeaderFooter(PHPExcel_Worksheet_HeaderFooter $pValue) + { + $this->_headerFooter = $pValue; + return $this; + } + + /** + * Get sheet view + * + * @return PHPExcel_Worksheet_SheetView + */ + public function getSheetView() + { + return $this->_sheetView; + } + + /** + * Set sheet view + * + * @param PHPExcel_Worksheet_SheetView $pValue + * @return PHPExcel_Worksheet + */ + public function setSheetView(PHPExcel_Worksheet_SheetView $pValue) + { + $this->_sheetView = $pValue; + return $this; + } + + /** + * Get Protection + * + * @return PHPExcel_Worksheet_Protection + */ + public function getProtection() + { + return $this->_protection; + } + + /** + * Set Protection + * + * @param PHPExcel_Worksheet_Protection $pValue + * @return PHPExcel_Worksheet + */ + public function setProtection(PHPExcel_Worksheet_Protection $pValue) + { + $this->_protection = $pValue; + $this->_dirty = true; + + return $this; + } + + /** + * Get highest worksheet column + * + * @param string $row Return the data highest column for the specified row, + * or the highest column of any row if no row number is passed + * @return string Highest column name + */ + public function getHighestColumn($row = null) + { + if ($row == null) { + return $this->_cachedHighestColumn; + } + return $this->getHighestDataColumn($row); + } + + /** + * Get highest worksheet column that contains data + * + * @param string $row Return the highest data column for the specified row, + * or the highest data column of any row if no row number is passed + * @return string Highest column name that contains data + */ + public function getHighestDataColumn($row = null) + { + return $this->_cellCollection->getHighestColumn($row); + } + + /** + * Get highest worksheet row + * + * @param string $column Return the highest data row for the specified column, + * or the highest row of any column if no column letter is passed + * @return int Highest row number + */ + public function getHighestRow($column = null) + { + if ($column == null) { + return $this->_cachedHighestRow; + } + return $this->getHighestDataRow($column); + } + + /** + * Get highest worksheet row that contains data + * + * @param string $column Return the highest data row for the specified column, + * or the highest data row of any column if no column letter is passed + * @return string Highest row number that contains data + */ + public function getHighestDataRow($column = null) + { + return $this->_cellCollection->getHighestRow($column); + } + + /** + * Get highest worksheet column and highest row that have cell records + * + * @return array Highest column name and highest row number + */ + public function getHighestRowAndColumn() + { + return $this->_cellCollection->getHighestRowAndColumn(); + } + + /** + * Set a cell value + * + * @param string $pCoordinate Coordinate of the cell + * @param mixed $pValue Value of the cell + * @param bool $returnCell Return the worksheet (false, default) or the cell (true) + * @return PHPExcel_Worksheet|PHPExcel_Cell Depending on the last parameter being specified + */ + public function setCellValue($pCoordinate = 'A1', $pValue = null, $returnCell = false) + { + $cell = $this->getCell($pCoordinate)->setValue($pValue); + return ($returnCell) ? $cell : $this; + } + + /** + * Set a cell value by using numeric cell coordinates + * + * @param string $pColumn Numeric column coordinate of the cell (A = 0) + * @param string $pRow Numeric row coordinate of the cell + * @param mixed $pValue Value of the cell + * @param bool $returnCell Return the worksheet (false, default) or the cell (true) + * @return PHPExcel_Worksheet|PHPExcel_Cell Depending on the last parameter being specified + */ + public function setCellValueByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $returnCell = false) + { + $cell = $this->getCellByColumnAndRow($pColumn, $pRow)->setValue($pValue); + return ($returnCell) ? $cell : $this; + } + + /** + * Set a cell value + * + * @param string $pCoordinate Coordinate of the cell + * @param mixed $pValue Value of the cell + * @param string $pDataType Explicit data type + * @param bool $returnCell Return the worksheet (false, default) or the cell (true) + * @return PHPExcel_Worksheet|PHPExcel_Cell Depending on the last parameter being specified + */ + public function setCellValueExplicit($pCoordinate = 'A1', $pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING, $returnCell = false) + { + // Set value + $cell = $this->getCell($pCoordinate)->setValueExplicit($pValue, $pDataType); + return ($returnCell) ? $cell : $this; + } + + /** + * Set a cell value by using numeric cell coordinates + * + * @param string $pColumn Numeric column coordinate of the cell + * @param string $pRow Numeric row coordinate of the cell + * @param mixed $pValue Value of the cell + * @param string $pDataType Explicit data type + * @param bool $returnCell Return the worksheet (false, default) or the cell (true) + * @return PHPExcel_Worksheet|PHPExcel_Cell Depending on the last parameter being specified + */ + public function setCellValueExplicitByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING, $returnCell = false) + { + $cell = $this->getCellByColumnAndRow($pColumn, $pRow)->setValueExplicit($pValue, $pDataType); + return ($returnCell) ? $cell : $this; + } + + /** + * Get cell at a specific coordinate + * + * @param string $pCoordinate Coordinate of the cell + * @throws PHPExcel_Exception + * @return PHPExcel_Cell Cell that was found + */ + public function getCell($pCoordinate = 'A1') + { + // Check cell collection + if ($this->_cellCollection->isDataSet($pCoordinate)) { + return $this->_cellCollection->getCacheData($pCoordinate); + } + + // Worksheet reference? + if (strpos($pCoordinate, '!') !== false) { + $worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pCoordinate, true); + return $this->_parent->getSheetByName($worksheetReference[0])->getCell($worksheetReference[1]); + } + + // Named range? + if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) && + (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) { + $namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this); + if ($namedRange !== NULL) { + $pCoordinate = $namedRange->getRange(); + return $namedRange->getWorksheet()->getCell($pCoordinate); + } + } + + // Uppercase coordinate + $pCoordinate = strtoupper($pCoordinate); + + if (strpos($pCoordinate, ':') !== false || strpos($pCoordinate, ',') !== false) { + throw new PHPExcel_Exception('Cell coordinate can not be a range of cells.'); + } elseif (strpos($pCoordinate, '$') !== false) { + throw new PHPExcel_Exception('Cell coordinate must not be absolute.'); + } + + // Create new cell object + return $this->_createNewCell($pCoordinate); + } + + /** + * Get cell at a specific coordinate by using numeric cell coordinates + * + * @param string $pColumn Numeric column coordinate of the cell + * @param string $pRow Numeric row coordinate of the cell + * @return PHPExcel_Cell Cell that was found + */ + public function getCellByColumnAndRow($pColumn = 0, $pRow = 1) + { + $columnLetter = PHPExcel_Cell::stringFromColumnIndex($pColumn); + $coordinate = $columnLetter . $pRow; + + if ($this->_cellCollection->isDataSet($coordinate)) { + return $this->_cellCollection->getCacheData($coordinate); + } + + return $this->_createNewCell($coordinate); + } + + /** + * Create a new cell at the specified coordinate + * + * @param string $pCoordinate Coordinate of the cell + * @return PHPExcel_Cell Cell that was created + */ + private function _createNewCell($pCoordinate) + { + $cell = $this->_cellCollection->addCacheData( + $pCoordinate, + new PHPExcel_Cell( + NULL, + PHPExcel_Cell_DataType::TYPE_NULL, + $this + ) ); - $this->_parent = $parent; + $this->_cellCollectionIsSorted = false; - return $this; + // Coordinates + $aCoordinates = PHPExcel_Cell::coordinateFromString($pCoordinate); + if (PHPExcel_Cell::columnIndexFromString($this->_cachedHighestColumn) < PHPExcel_Cell::columnIndexFromString($aCoordinates[0])) + $this->_cachedHighestColumn = $aCoordinates[0]; + $this->_cachedHighestRow = max($this->_cachedHighestRow, $aCoordinates[1]); + + // Cell needs appropriate xfIndex from dimensions records + // but don't create dimension records if they don't already exist + $rowDimension = $this->getRowDimension($aCoordinates[1], FALSE); + $columnDimension = $this->getColumnDimension($aCoordinates[0], FALSE); + + if ($rowDimension !== NULL && $rowDimension->getXfIndex() > 0) { + // then there is a row dimension with explicit style, assign it to the cell + $cell->setXfIndex($rowDimension->getXfIndex()); + } elseif ($columnDimension !== NULL && $columnDimension->getXfIndex() > 0) { + // then there is a column dimension, assign it to the cell + $cell->setXfIndex($columnDimension->getXfIndex()); + } + + return $cell; } + + /** + * Does the cell at a specific coordinate exist? + * + * @param string $pCoordinate Coordinate of the cell + * @throws PHPExcel_Exception + * @return boolean + */ + public function cellExists($pCoordinate = 'A1') + { + // Worksheet reference? + if (strpos($pCoordinate, '!') !== false) { + $worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pCoordinate, true); + return $this->_parent->getSheetByName($worksheetReference[0])->cellExists($worksheetReference[1]); + } - /** - * Get title - * - * @return string - */ - public function getTitle() - { - return $this->_title; - } + // Named range? + if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) && + (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) { + $namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this); + if ($namedRange !== NULL) { + $pCoordinate = $namedRange->getRange(); + if ($this->getHashCode() != $namedRange->getWorksheet()->getHashCode()) { + if (!$namedRange->getLocalOnly()) { + return $namedRange->getWorksheet()->cellExists($pCoordinate); + } else { + throw new PHPExcel_Exception('Named range ' . $namedRange->getName() . ' is not accessible from within sheet ' . $this->getTitle()); + } + } + } + else { return false; } + } - /** - * Set title + // Uppercase coordinate + $pCoordinate = strtoupper($pCoordinate); + + if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) { + throw new PHPExcel_Exception('Cell coordinate can not be a range of cells.'); + } elseif (strpos($pCoordinate,'$') !== false) { + throw new PHPExcel_Exception('Cell coordinate must not be absolute.'); + } else { + // Coordinates + $aCoordinates = PHPExcel_Cell::coordinateFromString($pCoordinate); + + // Cell exists? + return $this->_cellCollection->isDataSet($pCoordinate); + } + } + + /** + * Cell at a specific coordinate by using numeric cell coordinates exists? + * + * @param string $pColumn Numeric column coordinate of the cell + * @param string $pRow Numeric row coordinate of the cell + * @return boolean + */ + public function cellExistsByColumnAndRow($pColumn = 0, $pRow = 1) + { + return $this->cellExists(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); + } + + /** + * Get row dimension at a specific row + * + * @param int $pRow Numeric index of the row + * @return PHPExcel_Worksheet_RowDimension + */ + public function getRowDimension($pRow = 1, $create = TRUE) + { + // Found + $found = null; + + // Get row dimension + if (!isset($this->_rowDimensions[$pRow])) { + if (!$create) + return NULL; + $this->_rowDimensions[$pRow] = new PHPExcel_Worksheet_RowDimension($pRow); + + $this->_cachedHighestRow = max($this->_cachedHighestRow,$pRow); + } + return $this->_rowDimensions[$pRow]; + } + + /** + * Get column dimension at a specific column + * + * @param string $pColumn String index of the column + * @return PHPExcel_Worksheet_ColumnDimension + */ + public function getColumnDimension($pColumn = 'A', $create = TRUE) + { + // Uppercase coordinate + $pColumn = strtoupper($pColumn); + + // Fetch dimensions + if (!isset($this->_columnDimensions[$pColumn])) { + if (!$create) + return NULL; + $this->_columnDimensions[$pColumn] = new PHPExcel_Worksheet_ColumnDimension($pColumn); + + if (PHPExcel_Cell::columnIndexFromString($this->_cachedHighestColumn) < PHPExcel_Cell::columnIndexFromString($pColumn)) + $this->_cachedHighestColumn = $pColumn; + } + return $this->_columnDimensions[$pColumn]; + } + + /** + * Get column dimension at a specific column by using numeric cell coordinates + * + * @param string $pColumn Numeric column coordinate of the cell + * @return PHPExcel_Worksheet_ColumnDimension + */ + public function getColumnDimensionByColumn($pColumn = 0) + { + return $this->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($pColumn)); + } + + /** + * Get styles + * + * @return PHPExcel_Style[] + */ + public function getStyles() + { + return $this->_styles; + } + + /** + * Get default style of workbook. + * + * @deprecated + * @return PHPExcel_Style + * @throws PHPExcel_Exception + */ + public function getDefaultStyle() + { + return $this->_parent->getDefaultStyle(); + } + + /** + * Set default style - should only be used by PHPExcel_IReader implementations! + * + * @deprecated + * @param PHPExcel_Style $pValue + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function setDefaultStyle(PHPExcel_Style $pValue) + { + $this->_parent->getDefaultStyle()->applyFromArray(array( + 'font' => array( + 'name' => $pValue->getFont()->getName(), + 'size' => $pValue->getFont()->getSize(), + ), + )); + return $this; + } + + /** + * Get style for cell + * + * @param string $pCellCoordinate Cell coordinate to get style for + * @return PHPExcel_Style + * @throws PHPExcel_Exception + */ + public function getStyle($pCellCoordinate = 'A1') + { + // set this sheet as active + $this->_parent->setActiveSheetIndex($this->_parent->getIndex($this)); + + // set cell coordinate as active + $this->setSelectedCells($pCellCoordinate); + + return $this->_parent->getCellXfSupervisor(); + } + + /** + * Get conditional styles for a cell + * + * @param string $pCoordinate + * @return PHPExcel_Style_Conditional[] + */ + public function getConditionalStyles($pCoordinate = 'A1') + { + if (!isset($this->_conditionalStylesCollection[$pCoordinate])) { + $this->_conditionalStylesCollection[$pCoordinate] = array(); + } + return $this->_conditionalStylesCollection[$pCoordinate]; + } + + /** + * Do conditional styles exist for this cell? + * + * @param string $pCoordinate + * @return boolean + */ + public function conditionalStylesExists($pCoordinate = 'A1') + { + if (isset($this->_conditionalStylesCollection[$pCoordinate])) { + return true; + } + return false; + } + + /** + * Removes conditional styles for a cell + * + * @param string $pCoordinate + * @return PHPExcel_Worksheet + */ + public function removeConditionalStyles($pCoordinate = 'A1') + { + unset($this->_conditionalStylesCollection[$pCoordinate]); + return $this; + } + + /** + * Get collection of conditional styles + * + * @return array + */ + public function getConditionalStylesCollection() + { + return $this->_conditionalStylesCollection; + } + + /** + * Set conditional styles + * + * @param $pCoordinate string E.g. 'A1' + * @param $pValue PHPExcel_Style_Conditional[] + * @return PHPExcel_Worksheet + */ + public function setConditionalStyles($pCoordinate = 'A1', $pValue) + { + $this->_conditionalStylesCollection[$pCoordinate] = $pValue; + return $this; + } + + /** + * Get style for cell by using numeric cell coordinates + * + * @param int $pColumn Numeric column coordinate of the cell + * @param int $pRow Numeric row coordinate of the cell + * @return PHPExcel_Style + */ + public function getStyleByColumnAndRow($pColumn = 0, $pRow = 1) + { + return $this->getStyle(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); + } + + /** + * Set shared cell style to a range of cells + * + * Please note that this will overwrite existing cell styles for cells in range! + * + * @deprecated + * @param PHPExcel_Style $pSharedCellStyle Cell style to share + * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function setSharedStyle(PHPExcel_Style $pSharedCellStyle = null, $pRange = '') + { + $this->duplicateStyle($pSharedCellStyle, $pRange); + return $this; + } + + /** + * Duplicate cell style to a range of cells + * + * Please note that this will overwrite existing cell styles for cells in range! + * + * @param PHPExcel_Style $pCellStyle Cell style to duplicate + * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function duplicateStyle(PHPExcel_Style $pCellStyle = null, $pRange = '') + { + // make sure we have a real style and not supervisor + $style = $pCellStyle->getIsSupervisor() ? $pCellStyle->getSharedComponent() : $pCellStyle; + + // Add the style to the workbook if necessary + $workbook = $this->_parent; + if ($existingStyle = $this->_parent->getCellXfByHashCode($pCellStyle->getHashCode())) { + // there is already such cell Xf in our collection + $xfIndex = $existingStyle->getIndex(); + } else { + // we don't have such a cell Xf, need to add + $workbook->addCellXf($pCellStyle); + $xfIndex = $pCellStyle->getIndex(); + } + + // Calculate range outer borders + list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($pRange . ':' . $pRange); + + // Make sure we can loop upwards on rows and columns + if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) { + $tmp = $rangeStart; + $rangeStart = $rangeEnd; + $rangeEnd = $tmp; + } + + // Loop through cells and apply styles + for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { + for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { + $this->getCell(PHPExcel_Cell::stringFromColumnIndex($col - 1) . $row)->setXfIndex($xfIndex); + } + } + + return $this; + } + + /** + * Duplicate conditional style to a range of cells + * + * Please note that this will overwrite existing cell styles for cells in range! + * + * @param array of PHPExcel_Style_Conditional $pCellStyle Cell style to duplicate + * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function duplicateConditionalStyle(array $pCellStyle = null, $pRange = '') + { + foreach($pCellStyle as $cellStyle) { + if (!($cellStyle instanceof PHPExcel_Style_Conditional)) { + throw new PHPExcel_Exception('Style is not a conditional style'); + } + } + + // Calculate range outer borders + list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($pRange . ':' . $pRange); + + // Make sure we can loop upwards on rows and columns + if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) { + $tmp = $rangeStart; + $rangeStart = $rangeEnd; + $rangeEnd = $tmp; + } + + // Loop through cells and apply styles + for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { + for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { + $this->setConditionalStyles(PHPExcel_Cell::stringFromColumnIndex($col - 1) . $row, $pCellStyle); + } + } + + return $this; + } + + /** + * Duplicate cell style array to a range of cells + * + * Please note that this will overwrite existing cell styles for cells in range, + * if they are in the styles array. For example, if you decide to set a range of + * cells to font bold, only include font bold in the styles array. + * + * @deprecated + * @param array $pStyles Array containing style information + * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") + * @param boolean $pAdvanced Advanced mode for setting borders. + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function duplicateStyleArray($pStyles = null, $pRange = '', $pAdvanced = true) + { + $this->getStyle($pRange)->applyFromArray($pStyles, $pAdvanced); + return $this; + } + + /** + * Set break on a cell + * + * @param string $pCell Cell coordinate (e.g. A1) + * @param int $pBreak Break type (type of PHPExcel_Worksheet::BREAK_*) + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function setBreak($pCell = 'A1', $pBreak = PHPExcel_Worksheet::BREAK_NONE) + { + // Uppercase coordinate + $pCell = strtoupper($pCell); + + if ($pCell != '') { + if ($pBreak == PHPExcel_Worksheet::BREAK_NONE) { + if (isset($this->_breaks[$pCell])) { + unset($this->_breaks[$pCell]); + } + } else { + $this->_breaks[$pCell] = $pBreak; + } + } else { + throw new PHPExcel_Exception('No cell coordinate specified.'); + } + + return $this; + } + + /** + * Set break on a cell by using numeric cell coordinates + * + * @param integer $pColumn Numeric column coordinate of the cell + * @param integer $pRow Numeric row coordinate of the cell + * @param integer $pBreak Break type (type of PHPExcel_Worksheet::BREAK_*) + * @return PHPExcel_Worksheet + */ + public function setBreakByColumnAndRow($pColumn = 0, $pRow = 1, $pBreak = PHPExcel_Worksheet::BREAK_NONE) + { + return $this->setBreak(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow, $pBreak); + } + + /** + * Get breaks + * + * @return array[] + */ + public function getBreaks() + { + return $this->_breaks; + } + + /** + * Set merge on a cell range + * + * @param string $pRange Cell range (e.g. A1:E1) + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function mergeCells($pRange = 'A1:A1') + { + // Uppercase coordinate + $pRange = strtoupper($pRange); + + if (strpos($pRange,':') !== false) { + $this->_mergeCells[$pRange] = $pRange; + + // make sure cells are created + + // get the cells in the range + $aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange); + + // create upper left cell if it does not already exist + $upperLeft = $aReferences[0]; + if (!$this->cellExists($upperLeft)) { + $this->getCell($upperLeft)->setValueExplicit(null, PHPExcel_Cell_DataType::TYPE_NULL); + } + + // create or blank out the rest of the cells in the range + $count = count($aReferences); + for ($i = 1; $i < $count; $i++) { + $this->getCell($aReferences[$i])->setValueExplicit(null, PHPExcel_Cell_DataType::TYPE_NULL); + } + + } else { + throw new PHPExcel_Exception('Merge must be set on a range of cells.'); + } + + return $this; + } + + /** + * Set merge on a cell range by using numeric cell coordinates + * + * @param int $pColumn1 Numeric column coordinate of the first cell + * @param int $pRow1 Numeric row coordinate of the first cell + * @param int $pColumn2 Numeric column coordinate of the last cell + * @param int $pRow2 Numeric row coordinate of the last cell + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function mergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1) + { + $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2; + return $this->mergeCells($cellRange); + } + + /** + * Remove merge on a cell range + * + * @param string $pRange Cell range (e.g. A1:E1) + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function unmergeCells($pRange = 'A1:A1') + { + // Uppercase coordinate + $pRange = strtoupper($pRange); + + if (strpos($pRange,':') !== false) { + if (isset($this->_mergeCells[$pRange])) { + unset($this->_mergeCells[$pRange]); + } else { + throw new PHPExcel_Exception('Cell range ' . $pRange . ' not known as merged.'); + } + } else { + throw new PHPExcel_Exception('Merge can only be removed from a range of cells.'); + } + + return $this; + } + + /** + * Remove merge on a cell range by using numeric cell coordinates + * + * @param int $pColumn1 Numeric column coordinate of the first cell + * @param int $pRow1 Numeric row coordinate of the first cell + * @param int $pColumn2 Numeric column coordinate of the last cell + * @param int $pRow2 Numeric row coordinate of the last cell + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function unmergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1) + { + $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2; + return $this->unmergeCells($cellRange); + } + + /** + * Get merge cells array. + * + * @return array[] + */ + public function getMergeCells() + { + return $this->_mergeCells; + } + + /** + * Set merge cells array for the entire sheet. Use instead mergeCells() to merge + * a single cell range. + * + * @param array + */ + public function setMergeCells($pValue = array()) + { + $this->_mergeCells = $pValue; + + return $this; + } + + /** + * Set protection on a cell range + * + * @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1) + * @param string $pPassword Password to unlock the protection + * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function protectCells($pRange = 'A1', $pPassword = '', $pAlreadyHashed = false) + { + // Uppercase coordinate + $pRange = strtoupper($pRange); + + if (!$pAlreadyHashed) { + $pPassword = PHPExcel_Shared_PasswordHasher::hashPassword($pPassword); + } + $this->_protectedCells[$pRange] = $pPassword; + + return $this; + } + + /** + * Set protection on a cell range by using numeric cell coordinates + * + * @param int $pColumn1 Numeric column coordinate of the first cell + * @param int $pRow1 Numeric row coordinate of the first cell + * @param int $pColumn2 Numeric column coordinate of the last cell + * @param int $pRow2 Numeric row coordinate of the last cell + * @param string $pPassword Password to unlock the protection + * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function protectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1, $pPassword = '', $pAlreadyHashed = false) + { + $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2; + return $this->protectCells($cellRange, $pPassword, $pAlreadyHashed); + } + + /** + * Remove protection on a cell range + * + * @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1) + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function unprotectCells($pRange = 'A1') + { + // Uppercase coordinate + $pRange = strtoupper($pRange); + + if (isset($this->_protectedCells[$pRange])) { + unset($this->_protectedCells[$pRange]); + } else { + throw new PHPExcel_Exception('Cell range ' . $pRange . ' not known as protected.'); + } + return $this; + } + + /** + * Remove protection on a cell range by using numeric cell coordinates + * + * @param int $pColumn1 Numeric column coordinate of the first cell + * @param int $pRow1 Numeric row coordinate of the first cell + * @param int $pColumn2 Numeric column coordinate of the last cell + * @param int $pRow2 Numeric row coordinate of the last cell + * @param string $pPassword Password to unlock the protection + * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function unprotectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1, $pPassword = '', $pAlreadyHashed = false) + { + $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2; + return $this->unprotectCells($cellRange, $pPassword, $pAlreadyHashed); + } + + /** + * Get protected cells + * + * @return array[] + */ + public function getProtectedCells() + { + return $this->_protectedCells; + } + + /** + * Get Autofilter + * + * @return PHPExcel_Worksheet_AutoFilter + */ + public function getAutoFilter() + { + return $this->_autoFilter; + } + + /** + * Set AutoFilter + * + * @param PHPExcel_Worksheet_AutoFilter|string $pValue + * A simple string containing a Cell range like 'A1:E10' is permitted for backward compatibility + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function setAutoFilter($pValue) + { + if (is_string($pValue)) { + $this->_autoFilter->setRange($pValue); + } elseif(is_object($pValue) && ($pValue instanceof PHPExcel_Worksheet_AutoFilter)) { + $this->_autoFilter = $pValue; + } + return $this; + } + + /** + * Set Autofilter Range by using numeric cell coordinates + * + * @param integer $pColumn1 Numeric column coordinate of the first cell + * @param integer $pRow1 Numeric row coordinate of the first cell + * @param integer $pColumn2 Numeric column coordinate of the second cell + * @param integer $pRow2 Numeric row coordinate of the second cell + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function setAutoFilterByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1) + { + return $this->setAutoFilter( + PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 + . ':' . + PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2 + ); + } + + /** + * Remove autofilter + * + * @return PHPExcel_Worksheet + */ + public function removeAutoFilter() + { + $this->_autoFilter->setRange(NULL); + return $this; + } + + /** + * Get Freeze Pane + * + * @return string + */ + public function getFreezePane() + { + return $this->_freezePane; + } + + /** + * Freeze Pane + * + * @param string $pCell Cell (i.e. A2) + * Examples: + * A2 will freeze the rows above cell A2 (i.e row 1) + * B1 will freeze the columns to the left of cell B1 (i.e column A) + * B2 will freeze the rows above and to the left of cell A2 + * (i.e row 1 and column A) + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function freezePane($pCell = '') + { + // Uppercase coordinate + $pCell = strtoupper($pCell); + + if (strpos($pCell,':') === false && strpos($pCell,',') === false) { + $this->_freezePane = $pCell; + } else { + throw new PHPExcel_Exception('Freeze pane can not be set on a range of cells.'); + } + return $this; + } + + /** + * Freeze Pane by using numeric cell coordinates + * + * @param int $pColumn Numeric column coordinate of the cell + * @param int $pRow Numeric row coordinate of the cell + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function freezePaneByColumnAndRow($pColumn = 0, $pRow = 1) + { + return $this->freezePane(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); + } + + /** + * Unfreeze Pane + * + * @return PHPExcel_Worksheet + */ + public function unfreezePane() + { + return $this->freezePane(''); + } + + /** + * Insert a new row, updating all possible related data + * + * @param int $pBefore Insert before this one + * @param int $pNumRows Number of rows to insert + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function insertNewRowBefore($pBefore = 1, $pNumRows = 1) { + if ($pBefore >= 1) { + $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance(); + $objReferenceHelper->insertNewBefore('A' . $pBefore, 0, $pNumRows, $this); + } else { + throw new PHPExcel_Exception("Rows can only be inserted before at least row 1."); + } + return $this; + } + + /** + * Insert a new column, updating all possible related data + * + * @param int $pBefore Insert before this one + * @param int $pNumCols Number of columns to insert + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function insertNewColumnBefore($pBefore = 'A', $pNumCols = 1) { + if (!is_numeric($pBefore)) { + $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance(); + $objReferenceHelper->insertNewBefore($pBefore . '1', $pNumCols, 0, $this); + } else { + throw new PHPExcel_Exception("Column references should not be numeric."); + } + return $this; + } + + /** + * Insert a new column, updating all possible related data + * + * @param int $pBefore Insert before this one (numeric column coordinate of the cell) + * @param int $pNumCols Number of columns to insert + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function insertNewColumnBeforeByIndex($pBefore = 0, $pNumCols = 1) { + if ($pBefore >= 0) { + return $this->insertNewColumnBefore(PHPExcel_Cell::stringFromColumnIndex($pBefore), $pNumCols); + } else { + throw new PHPExcel_Exception("Columns can only be inserted before at least column A (0)."); + } + } + + /** + * Delete a row, updating all possible related data + * + * @param int $pRow Remove starting with this one + * @param int $pNumRows Number of rows to remove + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function removeRow($pRow = 1, $pNumRows = 1) { + if ($pRow >= 1) { + $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance(); + $objReferenceHelper->insertNewBefore('A' . ($pRow + $pNumRows), 0, -$pNumRows, $this); + } else { + throw new PHPExcel_Exception("Rows to be deleted should at least start from row 1."); + } + return $this; + } + + /** + * Remove a column, updating all possible related data + * + * @param int $pColumn Remove starting with this one + * @param int $pNumCols Number of columns to remove + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function removeColumn($pColumn = 'A', $pNumCols = 1) { + if (!is_numeric($pColumn)) { + $pColumn = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($pColumn) - 1 + $pNumCols); + $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance(); + $objReferenceHelper->insertNewBefore($pColumn . '1', -$pNumCols, 0, $this); + } else { + throw new PHPExcel_Exception("Column references should not be numeric."); + } + return $this; + } + + /** + * Remove a column, updating all possible related data + * + * @param int $pColumn Remove starting with this one (numeric column coordinate of the cell) + * @param int $pNumCols Number of columns to remove + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function removeColumnByIndex($pColumn = 0, $pNumCols = 1) { + if ($pColumn >= 0) { + return $this->removeColumn(PHPExcel_Cell::stringFromColumnIndex($pColumn), $pNumCols); + } else { + throw new PHPExcel_Exception("Columns to be deleted should at least start from column 0"); + } + } + + /** + * Show gridlines? + * + * @return boolean + */ + public function getShowGridlines() { + return $this->_showGridlines; + } + + /** + * Set show gridlines + * + * @param boolean $pValue Show gridlines (true/false) + * @return PHPExcel_Worksheet + */ + public function setShowGridlines($pValue = false) { + $this->_showGridlines = $pValue; + return $this; + } + + /** + * Print gridlines? + * + * @return boolean + */ + public function getPrintGridlines() { + return $this->_printGridlines; + } + + /** + * Set print gridlines + * + * @param boolean $pValue Print gridlines (true/false) + * @return PHPExcel_Worksheet + */ + public function setPrintGridlines($pValue = false) { + $this->_printGridlines = $pValue; + return $this; + } + + /** + * Show row and column headers? + * + * @return boolean + */ + public function getShowRowColHeaders() { + return $this->_showRowColHeaders; + } + + /** + * Set show row and column headers + * + * @param boolean $pValue Show row and column headers (true/false) + * @return PHPExcel_Worksheet + */ + public function setShowRowColHeaders($pValue = false) { + $this->_showRowColHeaders = $pValue; + return $this; + } + + /** + * Show summary below? (Row/Column outlining) + * + * @return boolean + */ + public function getShowSummaryBelow() { + return $this->_showSummaryBelow; + } + + /** + * Set show summary below + * + * @param boolean $pValue Show summary below (true/false) + * @return PHPExcel_Worksheet + */ + public function setShowSummaryBelow($pValue = true) { + $this->_showSummaryBelow = $pValue; + return $this; + } + + /** + * Show summary right? (Row/Column outlining) + * + * @return boolean + */ + public function getShowSummaryRight() { + return $this->_showSummaryRight; + } + + /** + * Set show summary right + * + * @param boolean $pValue Show summary right (true/false) + * @return PHPExcel_Worksheet + */ + public function setShowSummaryRight($pValue = true) { + $this->_showSummaryRight = $pValue; + return $this; + } + + /** + * Get comments + * + * @return PHPExcel_Comment[] + */ + public function getComments() + { + return $this->_comments; + } + + /** + * Set comments array for the entire sheet. + * + * @param array of PHPExcel_Comment + * @return PHPExcel_Worksheet + */ + public function setComments($pValue = array()) + { + $this->_comments = $pValue; + + return $this; + } + + /** + * Get comment for cell + * + * @param string $pCellCoordinate Cell coordinate to get comment for + * @return PHPExcel_Comment + * @throws PHPExcel_Exception + */ + public function getComment($pCellCoordinate = 'A1') + { + // Uppercase coordinate + $pCellCoordinate = strtoupper($pCellCoordinate); + + if (strpos($pCellCoordinate,':') !== false || strpos($pCellCoordinate,',') !== false) { + throw new PHPExcel_Exception('Cell coordinate string can not be a range of cells.'); + } else if (strpos($pCellCoordinate,'$') !== false) { + throw new PHPExcel_Exception('Cell coordinate string must not be absolute.'); + } else if ($pCellCoordinate == '') { + throw new PHPExcel_Exception('Cell coordinate can not be zero-length string.'); + } else { + // Check if we already have a comment for this cell. + // If not, create a new comment. + if (isset($this->_comments[$pCellCoordinate])) { + return $this->_comments[$pCellCoordinate]; + } else { + $newComment = new PHPExcel_Comment(); + $this->_comments[$pCellCoordinate] = $newComment; + return $newComment; + } + } + } + + /** + * Get comment for cell by using numeric cell coordinates + * + * @param int $pColumn Numeric column coordinate of the cell + * @param int $pRow Numeric row coordinate of the cell + * @return PHPExcel_Comment + */ + public function getCommentByColumnAndRow($pColumn = 0, $pRow = 1) + { + return $this->getComment(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); + } + + /** + * Get selected cell + * + * @deprecated + * @return string + */ + public function getSelectedCell() + { + return $this->getSelectedCells(); + } + + /** + * Get active cell + * + * @return string Example: 'A1' + */ + public function getActiveCell() + { + return $this->_activeCell; + } + + /** + * Get selected cells + * + * @return string + */ + public function getSelectedCells() + { + return $this->_selectedCells; + } + + /** + * Selected cell + * + * @param string $pCoordinate Cell (i.e. A1) + * @return PHPExcel_Worksheet + */ + public function setSelectedCell($pCoordinate = 'A1') + { + return $this->setSelectedCells($pCoordinate); + } + + /** + * Select a range of cells. + * + * @param string $pCoordinate Cell range, examples: 'A1', 'B2:G5', 'A:C', '3:6' + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function setSelectedCells($pCoordinate = 'A1') + { + // Uppercase coordinate + $pCoordinate = strtoupper($pCoordinate); + + // Convert 'A' to 'A:A' + $pCoordinate = preg_replace('/^([A-Z]+)$/', '${1}:${1}', $pCoordinate); + + // Convert '1' to '1:1' + $pCoordinate = preg_replace('/^([0-9]+)$/', '${1}:${1}', $pCoordinate); + + // Convert 'A:C' to 'A1:C1048576' + $pCoordinate = preg_replace('/^([A-Z]+):([A-Z]+)$/', '${1}1:${2}1048576', $pCoordinate); + + // Convert '1:3' to 'A1:XFD3' + $pCoordinate = preg_replace('/^([0-9]+):([0-9]+)$/', 'A${1}:XFD${2}', $pCoordinate); + + if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) { + list($first, ) = PHPExcel_Cell::splitRange($pCoordinate); + $this->_activeCell = $first[0]; + } else { + $this->_activeCell = $pCoordinate; + } + $this->_selectedCells = $pCoordinate; + return $this; + } + + /** + * Selected cell by using numeric cell coordinates + * + * @param int $pColumn Numeric column coordinate of the cell + * @param int $pRow Numeric row coordinate of the cell + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function setSelectedCellByColumnAndRow($pColumn = 0, $pRow = 1) + { + return $this->setSelectedCells(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); + } + + /** + * Get right-to-left + * + * @return boolean + */ + public function getRightToLeft() { + return $this->_rightToLeft; + } + + /** + * Set right-to-left + * + * @param boolean $value Right-to-left true/false + * @return PHPExcel_Worksheet + */ + public function setRightToLeft($value = false) { + $this->_rightToLeft = $value; + return $this; + } + + /** + * Fill worksheet from values in array + * + * @param array $source Source array + * @param mixed $nullValue Value in source array that stands for blank cell + * @param string $startCell Insert array starting from this cell address as the top left coordinate + * @param boolean $strictNullComparison Apply strict comparison when testing for null values in the array + * @throws PHPExcel_Exception + * @return PHPExcel_Worksheet + */ + public function fromArray($source = null, $nullValue = null, $startCell = 'A1', $strictNullComparison = false) { + if (is_array($source)) { + // Convert a 1-D array to 2-D (for ease of looping) + if (!is_array(end($source))) { + $source = array($source); + } + + // start coordinate + list ($startColumn, $startRow) = PHPExcel_Cell::coordinateFromString($startCell); + + // Loop through $source + foreach ($source as $rowData) { + $currentColumn = $startColumn; + foreach($rowData as $cellValue) { + if ($strictNullComparison) { + if ($cellValue !== $nullValue) { + // Set cell value + $this->getCell($currentColumn . $startRow)->setValue($cellValue); + } + } else { + if ($cellValue != $nullValue) { + // Set cell value + $this->getCell($currentColumn . $startRow)->setValue($cellValue); + } + } + ++$currentColumn; + } + ++$startRow; + } + } else { + throw new PHPExcel_Exception("Parameter \$source should be an array."); + } + return $this; + } + + /** + * Create array from a range of cells + * + * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") + * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist + * @param boolean $calculateFormulas Should formulas be calculated? + * @param boolean $formatData Should formatting be applied to cell values? + * @param boolean $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero + * True - Return rows and columns indexed by their actual row and column IDs + * @return array + */ + public function rangeToArray($pRange = 'A1', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) { + // Returnvalue + $returnValue = array(); + // Identify the range that we need to extract from the worksheet + list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($pRange); + $minCol = PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] -1); + $minRow = $rangeStart[1]; + $maxCol = PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0] -1); + $maxRow = $rangeEnd[1]; + + $maxCol++; + // Loop through rows + $r = -1; + for ($row = $minRow; $row <= $maxRow; ++$row) { + $rRef = ($returnCellRef) ? $row : ++$r; + $c = -1; + // Loop through columns in the current row + for ($col = $minCol; $col != $maxCol; ++$col) { + $cRef = ($returnCellRef) ? $col : ++$c; + // Using getCell() will create a new cell if it doesn't already exist. We don't want that to happen + // so we test and retrieve directly against _cellCollection + if ($this->_cellCollection->isDataSet($col.$row)) { + // Cell exists + $cell = $this->_cellCollection->getCacheData($col.$row); + if ($cell->getValue() !== null) { + if ($cell->getValue() instanceof PHPExcel_RichText) { + $returnValue[$rRef][$cRef] = $cell->getValue()->getPlainText(); + } else { + if ($calculateFormulas) { + $returnValue[$rRef][$cRef] = $cell->getCalculatedValue(); + } else { + $returnValue[$rRef][$cRef] = $cell->getValue(); + } + } + + if ($formatData) { + $style = $this->_parent->getCellXfByIndex($cell->getXfIndex()); + $returnValue[$rRef][$cRef] = PHPExcel_Style_NumberFormat::toFormattedString( + $returnValue[$rRef][$cRef], + ($style && $style->getNumberFormat()) ? + $style->getNumberFormat()->getFormatCode() : + PHPExcel_Style_NumberFormat::FORMAT_GENERAL + ); + } + } else { + // Cell holds a NULL + $returnValue[$rRef][$cRef] = $nullValue; + } + } else { + // Cell doesn't exist + $returnValue[$rRef][$cRef] = $nullValue; + } + } + } + + // Return + return $returnValue; + } + + + /** + * Create array from a range of cells + * + * @param string $pNamedRange Name of the Named Range + * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist + * @param boolean $calculateFormulas Should formulas be calculated? + * @param boolean $formatData Should formatting be applied to cell values? + * @param boolean $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero + * True - Return rows and columns indexed by their actual row and column IDs + * @return array + * @throws PHPExcel_Exception + */ + public function namedRangeToArray($pNamedRange = '', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) { + $namedRange = PHPExcel_NamedRange::resolveRange($pNamedRange, $this); + if ($namedRange !== NULL) { + $pWorkSheet = $namedRange->getWorksheet(); + $pCellRange = $namedRange->getRange(); + + return $pWorkSheet->rangeToArray( $pCellRange, + $nullValue, $calculateFormulas, $formatData, $returnCellRef); + } + + throw new PHPExcel_Exception('Named Range '.$pNamedRange.' does not exist.'); + } + + + /** + * Create array from worksheet + * + * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist + * @param boolean $calculateFormulas Should formulas be calculated? + * @param boolean $formatData Should formatting be applied to cell values? + * @param boolean $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero + * True - Return rows and columns indexed by their actual row and column IDs + * @return array + */ + public function toArray($nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) { + // Garbage collect... + $this->garbageCollect(); + + // Identify the range that we need to extract from the worksheet + $maxCol = $this->getHighestColumn(); + $maxRow = $this->getHighestRow(); + // Return + return $this->rangeToArray( 'A1:'.$maxCol.$maxRow, + $nullValue, $calculateFormulas, $formatData, $returnCellRef); + } + + /** + * Get row iterator + * + * @param integer $startRow The row number at which to start iterating + * @return PHPExcel_Worksheet_RowIterator + */ + public function getRowIterator($startRow = 1) { + return new PHPExcel_Worksheet_RowIterator($this,$startRow); + } + + /** + * Run PHPExcel garabage collector. + * + * @return PHPExcel_Worksheet + */ + public function garbageCollect() { + // Flush cache + $this->_cellCollection->getCacheData('A1'); + // Build a reference table from images +// $imageCoordinates = array(); +// $iterator = $this->getDrawingCollection()->getIterator(); +// while ($iterator->valid()) { +// $imageCoordinates[$iterator->current()->getCoordinates()] = true; +// +// $iterator->next(); +// } +// + // Lookup highest column and highest row if cells are cleaned + $colRow = $this->_cellCollection->getHighestRowAndColumn(); + $highestRow = $colRow['row']; + $highestColumn = PHPExcel_Cell::columnIndexFromString($colRow['column']); + + // Loop through column dimensions + foreach ($this->_columnDimensions as $dimension) { + $highestColumn = max($highestColumn,PHPExcel_Cell::columnIndexFromString($dimension->getColumnIndex())); + } + + // Loop through row dimensions + foreach ($this->_rowDimensions as $dimension) { + $highestRow = max($highestRow,$dimension->getRowIndex()); + } + + // Cache values + if ($highestColumn < 0) { + $this->_cachedHighestColumn = 'A'; + } else { + $this->_cachedHighestColumn = PHPExcel_Cell::stringFromColumnIndex(--$highestColumn); + } + $this->_cachedHighestRow = $highestRow; + + // Return + return $this; + } + + /** + * Get hash code + * + * @return string Hash code + */ + public function getHashCode() { + if ($this->_dirty) { + $this->_hash = md5( $this->_title . + $this->_autoFilter . + ($this->_protection->isProtectionEnabled() ? 't' : 'f') . + __CLASS__ + ); + $this->_dirty = false; + } + return $this->_hash; + } + + /** + * Extract worksheet title from range. + * + * Example: extractSheetTitle("testSheet!A1") ==> 'A1' + * Example: extractSheetTitle("'testSheet 1'!A1", true) ==> array('testSheet 1', 'A1'); + * + * @param string $pRange Range to extract title from + * @param bool $returnRange Return range? (see example) + * @return mixed + */ + public static function extractSheetTitle($pRange, $returnRange = false) { + // Sheet title included? + if (($sep = strpos($pRange, '!')) === false) { + return ''; + } + + if ($returnRange) { + return array( trim(substr($pRange, 0, $sep),"'"), + substr($pRange, $sep + 1) + ); + } + + return substr($pRange, $sep + 1); + } + + /** + * Get hyperlink + * + * @param string $pCellCoordinate Cell coordinate to get hyperlink for + */ + public function getHyperlink($pCellCoordinate = 'A1') + { + // return hyperlink if we already have one + if (isset($this->_hyperlinkCollection[$pCellCoordinate])) { + return $this->_hyperlinkCollection[$pCellCoordinate]; + } + + // else create hyperlink + $this->_hyperlinkCollection[$pCellCoordinate] = new PHPExcel_Cell_Hyperlink(); + return $this->_hyperlinkCollection[$pCellCoordinate]; + } + + /** + * Set hyperlnk + * + * @param string $pCellCoordinate Cell coordinate to insert hyperlink + * @param PHPExcel_Cell_Hyperlink $pHyperlink + * @return PHPExcel_Worksheet + */ + public function setHyperlink($pCellCoordinate = 'A1', PHPExcel_Cell_Hyperlink $pHyperlink = null) + { + if ($pHyperlink === null) { + unset($this->_hyperlinkCollection[$pCellCoordinate]); + } else { + $this->_hyperlinkCollection[$pCellCoordinate] = $pHyperlink; + } + return $this; + } + + /** + * Hyperlink at a specific coordinate exists? + * + * @param string $pCoordinate + * @return boolean + */ + public function hyperlinkExists($pCoordinate = 'A1') + { + return isset($this->_hyperlinkCollection[$pCoordinate]); + } + + /** + * Get collection of hyperlinks + * + * @return PHPExcel_Cell_Hyperlink[] + */ + public function getHyperlinkCollection() + { + return $this->_hyperlinkCollection; + } + + /** + * Get data validation + * + * @param string $pCellCoordinate Cell coordinate to get data validation for + */ + public function getDataValidation($pCellCoordinate = 'A1') + { + // return data validation if we already have one + if (isset($this->_dataValidationCollection[$pCellCoordinate])) { + return $this->_dataValidationCollection[$pCellCoordinate]; + } + + // else create data validation + $this->_dataValidationCollection[$pCellCoordinate] = new PHPExcel_Cell_DataValidation(); + return $this->_dataValidationCollection[$pCellCoordinate]; + } + + /** + * Set data validation + * + * @param string $pCellCoordinate Cell coordinate to insert data validation + * @param PHPExcel_Cell_DataValidation $pDataValidation + * @return PHPExcel_Worksheet + */ + public function setDataValidation($pCellCoordinate = 'A1', PHPExcel_Cell_DataValidation $pDataValidation = null) + { + if ($pDataValidation === null) { + unset($this->_dataValidationCollection[$pCellCoordinate]); + } else { + $this->_dataValidationCollection[$pCellCoordinate] = $pDataValidation; + } + return $this; + } + + /** + * Data validation at a specific coordinate exists? + * + * @param string $pCoordinate + * @return boolean + */ + public function dataValidationExists($pCoordinate = 'A1') + { + return isset($this->_dataValidationCollection[$pCoordinate]); + } + + /** + * Get collection of data validations + * + * @return PHPExcel_Cell_DataValidation[] + */ + public function getDataValidationCollection() + { + return $this->_dataValidationCollection; + } + + /** + * Accepts a range, returning it as a range that falls within the current highest row and column of the worksheet + * + * @param string $range + * @return string Adjusted range value + */ + public function shrinkRangeToFit($range) { + $maxCol = $this->getHighestColumn(); + $maxRow = $this->getHighestRow(); + $maxCol = PHPExcel_Cell::columnIndexFromString($maxCol); + + $rangeBlocks = explode(' ',$range); + foreach ($rangeBlocks as &$rangeSet) { + $rangeBoundaries = PHPExcel_Cell::getRangeBoundaries($rangeSet); + + if (PHPExcel_Cell::columnIndexFromString($rangeBoundaries[0][0]) > $maxCol) { $rangeBoundaries[0][0] = PHPExcel_Cell::stringFromColumnIndex($maxCol); } + if ($rangeBoundaries[0][1] > $maxRow) { $rangeBoundaries[0][1] = $maxRow; } + if (PHPExcel_Cell::columnIndexFromString($rangeBoundaries[1][0]) > $maxCol) { $rangeBoundaries[1][0] = PHPExcel_Cell::stringFromColumnIndex($maxCol); } + if ($rangeBoundaries[1][1] > $maxRow) { $rangeBoundaries[1][1] = $maxRow; } + $rangeSet = $rangeBoundaries[0][0].$rangeBoundaries[0][1].':'.$rangeBoundaries[1][0].$rangeBoundaries[1][1]; + } + unset($rangeSet); + $stRange = implode(' ',$rangeBlocks); + + return $stRange; + } + + /** + * Get tab color + * + * @return PHPExcel_Style_Color + */ + public function getTabColor() + { + if ($this->_tabColor === NULL) + $this->_tabColor = new PHPExcel_Style_Color(); + + return $this->_tabColor; + } + + /** + * Reset tab color + * + * @return PHPExcel_Worksheet + */ + public function resetTabColor() + { + $this->_tabColor = null; + unset($this->_tabColor); + + return $this; + } + + /** + * Tab color set? + * + * @return boolean + */ + public function isTabColorSet() + { + return ($this->_tabColor !== NULL); + } + + /** + * Copy worksheet (!= clone!) + * + * @return PHPExcel_Worksheet + */ + public function copy() { + $copied = clone $this; + + return $copied; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() { + foreach ($this as $key => $val) { + if ($key == '_parent') { + continue; + } + + if (is_object($val) || (is_array($val))) { + if ($key == '_cellCollection') { + $newCollection = clone $this->_cellCollection; + $newCollection->copyCellCollection($this); + $this->_cellCollection = $newCollection; + } elseif ($key == '_drawingCollection') { + $newCollection = clone $this->_drawingCollection; + $this->_drawingCollection = $newCollection; + } elseif (($key == '_autoFilter') && ($this->_autoFilter instanceof PHPExcel_Worksheet_AutoFilter)) { + $newAutoFilter = clone $this->_autoFilter; + $this->_autoFilter = $newAutoFilter; + $this->_autoFilter->setParent($this); + } else { + $this->{$key} = unserialize(serialize($val)); + } + } + } + } +/** + * Define the code name of the sheet * - * @param string $pValue String containing the dimension of this worksheet - * @param string $updateFormulaCellReferences boolean Flag indicating whether cell references in formulae should - * be updated to reflect the new sheet name. - * This should be left as the default true, unless you are - * certain that no formula cells on any worksheet contain - * references to this worksheet - * @return PHPExcel_Worksheet - */ - public function setTitle($pValue = 'Worksheet', $updateFormulaCellReferences = true) - { + * @param null|string Same rule as Title minus space not allowed (but, like Excel, change silently space to underscore) + * @return objWorksheet + * @throws PHPExcel_Exception + */ + public function setCodeName($pValue=null){ // Is this a 'rename' or not? - if ($this->getTitle() == $pValue) { + if ($this->getCodeName() == $pValue) { return $this; } - + $pValue = str_replace(' ', '_', $pValue);//Excel does this automatically without flinching, we are doing the same // Syntax check - self::_checkSheetTitle($pValue); - - // Old title - $oldTitle = $this->getTitle(); + // throw an exception if not valid + self::_checkSheetCodeName($pValue); + // We use the same code that setTitle to find a valid codeName else not using a space (Excel don't like) but a '_' + if ($this->getParent()) { // Is there already such sheet name? - if ($this->getParent()->sheetNameExists($pValue)) { + if ($this->getParent()->sheetCodeNameExists($pValue)) { // Use name, but append with lowest possible integer if (PHPExcel_Shared_String::CountCharacters($pValue) > 29) { $pValue = PHPExcel_Shared_String::Substring($pValue,0,29); } $i = 1; - while ($this->getParent()->sheetNameExists($pValue . ' ' . $i)) { + while ($this->getParent()->sheetCodeNameExists($pValue . '_' . $i)) { ++$i; if ($i == 10) { if (PHPExcel_Shared_String::CountCharacters($pValue) > 28) { @@ -815,1981 +2882,28 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable } } - $altTitle = $pValue . ' ' . $i; - return $this->setTitle($altTitle,$updateFormulaCellReferences); + $pValue = $pValue . '_' . $i;// ok, we have a valid name + //codeName is'nt used in formula : no need to call for an update + //return $this->setTitle($altTitle,$updateFormulaCellReferences); } } - // Set title - $this->_title = $pValue; - $this->_dirty = true; - - if ($this->getParent()) { - // New title - $newTitle = $this->getTitle(); - if ($updateFormulaCellReferences) - PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->getParent(), $oldTitle, $newTitle); - } - + $this->_codeName=$pValue; return $this; } - /** - * Get sheet state + * Return the code name of the sheet * - * @return string Sheet state (visible, hidden, veryHidden) - */ - public function getSheetState() { - return $this->_sheetState; - } - - /** - * Set sheet state - * - * @param string $value Sheet state (visible, hidden, veryHidden) - * @return PHPExcel_Worksheet - */ - public function setSheetState($value = PHPExcel_Worksheet::SHEETSTATE_VISIBLE) { - $this->_sheetState = $value; - return $this; - } - - /** - * Get page setup - * - * @return PHPExcel_Worksheet_PageSetup - */ - public function getPageSetup() - { - return $this->_pageSetup; - } - - /** - * Set page setup - * - * @param PHPExcel_Worksheet_PageSetup $pValue - * @return PHPExcel_Worksheet - */ - public function setPageSetup(PHPExcel_Worksheet_PageSetup $pValue) - { - $this->_pageSetup = $pValue; - return $this; - } - - /** - * Get page margins - * - * @return PHPExcel_Worksheet_PageMargins - */ - public function getPageMargins() - { - return $this->_pageMargins; - } - - /** - * Set page margins - * - * @param PHPExcel_Worksheet_PageMargins $pValue - * @return PHPExcel_Worksheet - */ - public function setPageMargins(PHPExcel_Worksheet_PageMargins $pValue) - { - $this->_pageMargins = $pValue; - return $this; - } - - /** - * Get page header/footer - * - * @return PHPExcel_Worksheet_HeaderFooter - */ - public function getHeaderFooter() - { - return $this->_headerFooter; - } - - /** - * Set page header/footer - * - * @param PHPExcel_Worksheet_HeaderFooter $pValue - * @return PHPExcel_Worksheet - */ - public function setHeaderFooter(PHPExcel_Worksheet_HeaderFooter $pValue) - { - $this->_headerFooter = $pValue; - return $this; - } - - /** - * Get sheet view - * - * @return PHPExcel_Worksheet_HeaderFooter - */ - public function getSheetView() - { - return $this->_sheetView; - } - - /** - * Set sheet view - * - * @param PHPExcel_Worksheet_SheetView $pValue - * @return PHPExcel_Worksheet - */ - public function setSheetView(PHPExcel_Worksheet_SheetView $pValue) - { - $this->_sheetView = $pValue; - return $this; - } - - /** - * Get Protection - * - * @return PHPExcel_Worksheet_Protection - */ - public function getProtection() - { - return $this->_protection; - } - - /** - * Set Protection - * - * @param PHPExcel_Worksheet_Protection $pValue - * @return PHPExcel_Worksheet - */ - public function setProtection(PHPExcel_Worksheet_Protection $pValue) - { - $this->_protection = $pValue; - $this->_dirty = true; - - return $this; - } - - /** - * Get highest worksheet column - * - * @return string Highest column name - */ - public function getHighestColumn() - { - return $this->_cachedHighestColumn; - } - - /** - * Get highest worksheet column that contains data - * - * @return string Highest column name that contains data - */ - public function getHighestDataColumn() - { - return $this->_cellCollection->getHighestColumn(); - } - - /** - * Get highest worksheet row - * - * @return int Highest row number - */ - public function getHighestRow() - { - return $this->_cachedHighestRow; - } - - /** - * Get highest worksheet row that contains data - * - * @return string Highest row number that contains data - */ - public function getHighestDataRow() - { - return $this->_cellCollection->getHighestRow(); - } - - /** - * Get highest worksheet column and highest row that have cell records - * - * @return array Highest column name and highest row number - */ - public function getHighestRowAndColumn() - { - return $this->_cellCollection->getHighestRowAndColumn(); - } - - /** - * Set a cell value - * - * @param string $pCoordinate Coordinate of the cell - * @param mixed $pValue Value of the cell - * @param bool $returnCell Return the worksheet (false, default) or the cell (true) - * @return PHPExcel_Worksheet|PHPExcel_Cell Depending on the last parameter being specified - */ - public function setCellValue($pCoordinate = 'A1', $pValue = null, $returnCell = false) - { - $cell = $this->getCell($pCoordinate)->setValue($pValue); - return ($returnCell) ? $cell : $this; - } - - /** - * Set a cell value by using numeric cell coordinates - * - * @param string $pColumn Numeric column coordinate of the cell - * @param string $pRow Numeric row coordinate of the cell - * @param mixed $pValue Value of the cell - * @param bool $returnCell Return the worksheet (false, default) or the cell (true) - * @return PHPExcel_Worksheet|PHPExcel_Cell Depending on the last parameter being specified - */ - public function setCellValueByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $returnCell = false) - { - $cell = $this->getCell(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow)->setValue($pValue); - return ($returnCell) ? $cell : $this; - } - - /** - * Set a cell value - * - * @param string $pCoordinate Coordinate of the cell - * @param mixed $pValue Value of the cell - * @param string $pDataType Explicit data type - * @param bool $returnCell Return the worksheet (false, default) or the cell (true) - * @return PHPExcel_Worksheet|PHPExcel_Cell Depending on the last parameter being specified - */ - public function setCellValueExplicit($pCoordinate = 'A1', $pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING, $returnCell = false) - { - // Set value - $cell = $this->getCell($pCoordinate)->setValueExplicit($pValue, $pDataType); - return ($returnCell) ? $cell : $this; - } - - /** - * Set a cell value by using numeric cell coordinates - * - * @param string $pColumn Numeric column coordinate of the cell - * @param string $pRow Numeric row coordinate of the cell - * @param mixed $pValue Value of the cell - * @param string $pDataType Explicit data type - * @param bool $returnCell Return the worksheet (false, default) or the cell (true) - * @return PHPExcel_Worksheet|PHPExcel_Cell Depending on the last parameter being specified - */ - public function setCellValueExplicitByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING, $returnCell = false) - { - $cell = $this->getCell(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow)->setValueExplicit($pValue, $pDataType); - return ($returnCell) ? $cell : $this; - } - - /** - * Get cell at a specific coordinate - * - * @param string $pCoordinate Coordinate of the cell - * @throws Exception - * @return PHPExcel_Cell Cell that was found - */ - public function getCell($pCoordinate = 'A1') - { - // Check cell collection - if ($this->_cellCollection->isDataSet($pCoordinate)) { - return $this->_cellCollection->getCacheData($pCoordinate); - } - - // Worksheet reference? - if (strpos($pCoordinate, '!') !== false) { - $worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pCoordinate, true); - return $this->getParent()->getSheetByName($worksheetReference[0])->getCell($worksheetReference[1]); - } - - // Named range? - if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) && - (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) { - $namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this); - if ($namedRange !== NULL) { - $pCoordinate = $namedRange->getRange(); - return $namedRange->getWorksheet()->getCell($pCoordinate); - } - } - - // Uppercase coordinate - $pCoordinate = strtoupper($pCoordinate); - - if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) { - throw new Exception('Cell coordinate can not be a range of cells.'); - } elseif (strpos($pCoordinate,'$') !== false) { - throw new Exception('Cell coordinate must not be absolute.'); - } else { - // Create new cell object - - // Coordinates - $aCoordinates = PHPExcel_Cell::coordinateFromString($pCoordinate); - - $cell = $this->_cellCollection->addCacheData($pCoordinate,new PHPExcel_Cell($aCoordinates[0], $aCoordinates[1], null, PHPExcel_Cell_DataType::TYPE_NULL, $this)); - $this->_cellCollectionIsSorted = false; - - if (PHPExcel_Cell::columnIndexFromString($this->_cachedHighestColumn) < PHPExcel_Cell::columnIndexFromString($aCoordinates[0])) - $this->_cachedHighestColumn = $aCoordinates[0]; - - $this->_cachedHighestRow = max($this->_cachedHighestRow,$aCoordinates[1]); - - // Cell needs appropriate xfIndex - $rowDimensions = $this->getRowDimensions(); - $columnDimensions = $this->getColumnDimensions(); - - if ( isset($rowDimensions[$aCoordinates[1]]) && $rowDimensions[$aCoordinates[1]]->getXfIndex() !== null ) { - // then there is a row dimension with explicit style, assign it to the cell - $cell->setXfIndex($rowDimensions[$aCoordinates[1]]->getXfIndex()); - } else if ( isset($columnDimensions[$aCoordinates[0]]) ) { - // then there is a column dimension, assign it to the cell - $cell->setXfIndex($columnDimensions[$aCoordinates[0]]->getXfIndex()); - } else { - // set to default index - $cell->setXfIndex(0); - } - - return $cell; - } - } - - /** - * Get cell at a specific coordinate by using numeric cell coordinates - * - * @param string $pColumn Numeric column coordinate of the cell - * @param string $pRow Numeric row coordinate of the cell - * @return PHPExcel_Cell Cell that was found - */ - public function getCellByColumnAndRow($pColumn = 0, $pRow = 1) - { - $columnLetter = PHPExcel_Cell::stringFromColumnIndex($pColumn); - $coordinate = $columnLetter . $pRow; - - if (!$this->_cellCollection->isDataSet($coordinate)) { - $cell = $this->_cellCollection->addCacheData($coordinate, new PHPExcel_Cell($columnLetter, $pRow, null, PHPExcel_Cell_DataType::TYPE_NULL, $this)); - $this->_cellCollectionIsSorted = false; - - if (PHPExcel_Cell::columnIndexFromString($this->_cachedHighestColumn) < $pColumn) - $this->_cachedHighestColumn = $columnLetter; - - $this->_cachedHighestRow = max($this->_cachedHighestRow,$pRow); - - return $cell; - } - - return $this->_cellCollection->getCacheData($coordinate); - } - - /** - * Cell at a specific coordinate exists? - * - * @param string $pCoordinate Coordinate of the cell - * @throws Exception - * @return boolean - */ - public function cellExists($pCoordinate = 'A1') - { - // Worksheet reference? - if (strpos($pCoordinate, '!') !== false) { - $worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pCoordinate, true); - return $this->getParent()->getSheetByName($worksheetReference[0])->cellExists($worksheetReference[1]); - } - - // Named range? - if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) && - (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) { - $namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this); - if ($namedRange !== NULL) { - $pCoordinate = $namedRange->getRange(); - if ($this->getHashCode() != $namedRange->getWorksheet()->getHashCode()) { - if (!$namedRange->getLocalOnly()) { - return $namedRange->getWorksheet()->cellExists($pCoordinate); - } else { - throw new Exception('Named range ' . $namedRange->getName() . ' is not accessible from within sheet ' . $this->getTitle()); - } - } - } - } - - // Uppercase coordinate - $pCoordinate = strtoupper($pCoordinate); - - if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) { - throw new Exception('Cell coordinate can not be a range of cells.'); - } elseif (strpos($pCoordinate,'$') !== false) { - throw new Exception('Cell coordinate must not be absolute.'); - } else { - // Coordinates - $aCoordinates = PHPExcel_Cell::coordinateFromString($pCoordinate); - - // Cell exists? - return $this->_cellCollection->isDataSet($pCoordinate); - } - } - - /** - * Cell at a specific coordinate by using numeric cell coordinates exists? - * - * @param string $pColumn Numeric column coordinate of the cell - * @param string $pRow Numeric row coordinate of the cell - * @return boolean - */ - public function cellExistsByColumnAndRow($pColumn = 0, $pRow = 1) - { - return $this->cellExists(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); - } - - /** - * Get row dimension at a specific row - * - * @param int $pRow Numeric index of the row - * @return PHPExcel_Worksheet_RowDimension - */ - public function getRowDimension($pRow = 1) - { - // Found - $found = null; - - // Get row dimension - if (!isset($this->_rowDimensions[$pRow])) { - $this->_rowDimensions[$pRow] = new PHPExcel_Worksheet_RowDimension($pRow); - - $this->_cachedHighestRow = max($this->_cachedHighestRow,$pRow); - } - return $this->_rowDimensions[$pRow]; - } - - /** - * Get column dimension at a specific column - * - * @param string $pColumn String index of the column - * @return PHPExcel_Worksheet_ColumnDimension - */ - public function getColumnDimension($pColumn = 'A') - { - // Uppercase coordinate - $pColumn = strtoupper($pColumn); - - // Fetch dimensions - if (!isset($this->_columnDimensions[$pColumn])) { - $this->_columnDimensions[$pColumn] = new PHPExcel_Worksheet_ColumnDimension($pColumn); - - if (PHPExcel_Cell::columnIndexFromString($this->_cachedHighestColumn) < PHPExcel_Cell::columnIndexFromString($pColumn)) - $this->_cachedHighestColumn = $pColumn; - } - return $this->_columnDimensions[$pColumn]; - } - - /** - * Get column dimension at a specific column by using numeric cell coordinates - * - * @param string $pColumn Numeric column coordinate of the cell - * @return PHPExcel_Worksheet_ColumnDimension - */ - public function getColumnDimensionByColumn($pColumn = 0) - { - return $this->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($pColumn)); - } - - /** - * Get styles - * - * @return PHPExcel_Style[] - */ - public function getStyles() - { - return $this->_styles; - } - - /** - * Get default style of workbork. - * - * @deprecated - * @return PHPExcel_Style - * @throws Exception - */ - public function getDefaultStyle() - { - return $this->_parent->getDefaultStyle(); - } - - /** - * Set default style - should only be used by PHPExcel_IReader implementations! - * - * @deprecated - * @param PHPExcel_Style $pValue - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function setDefaultStyle(PHPExcel_Style $pValue) - { - $this->_parent->getDefaultStyle()->applyFromArray(array( - 'font' => array( - 'name' => $pValue->getFont()->getName(), - 'size' => $pValue->getFont()->getSize(), - ), - )); - return $this; - } - - /** - * Get style for cell - * - * @param string $pCellCoordinate Cell coordinate to get style for - * @return PHPExcel_Style - * @throws Exception - */ - public function getStyle($pCellCoordinate = 'A1') - { - // set this sheet as active - $this->_parent->setActiveSheetIndex($this->_parent->getIndex($this)); - - // set cell coordinate as active - $this->setSelectedCells($pCellCoordinate); - - return $this->_parent->getCellXfSupervisor(); - } - - /** - * Get conditional styles for a cell - * - * @param string $pCoordinate - * @return PHPExcel_Style_Conditional[] - */ - public function getConditionalStyles($pCoordinate = 'A1') - { - if (!isset($this->_conditionalStylesCollection[$pCoordinate])) { - $this->_conditionalStylesCollection[$pCoordinate] = array(); - } - return $this->_conditionalStylesCollection[$pCoordinate]; - } - - /** - * Do conditional styles exist for this cell? - * - * @param string $pCoordinate - * @return boolean - */ - public function conditionalStylesExists($pCoordinate = 'A1') - { - if (isset($this->_conditionalStylesCollection[$pCoordinate])) { - return true; - } - return false; - } - - /** - * Removes conditional styles for a cell - * - * @param string $pCoordinate - * @return PHPExcel_Worksheet - */ - public function removeConditionalStyles($pCoordinate = 'A1') - { - unset($this->_conditionalStylesCollection[$pCoordinate]); - return $this; - } - - /** - * Get collection of conditional styles - * - * @return array - */ - public function getConditionalStylesCollection() - { - return $this->_conditionalStylesCollection; - } - - /** - * Set conditional styles - * - * @param $pCoordinate string E.g. 'A1' - * @param $pValue PHPExcel_Style_Conditional[] - * @return PHPExcel_Worksheet - */ - public function setConditionalStyles($pCoordinate = 'A1', $pValue) - { - $this->_conditionalStylesCollection[$pCoordinate] = $pValue; - return $this; - } - - /** - * Get style for cell by using numeric cell coordinates - * - * @param int $pColumn Numeric column coordinate of the cell - * @param int $pRow Numeric row coordinate of the cell - * @return PHPExcel_Style - */ - public function getStyleByColumnAndRow($pColumn = 0, $pRow = 1) - { - return $this->getStyle(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); - } - - /** - * Set shared cell style to a range of cells - * - * Please note that this will overwrite existing cell styles for cells in range! - * - * @deprecated - * @param PHPExcel_Style $pSharedCellStyle Cell style to share - * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function setSharedStyle(PHPExcel_Style $pSharedCellStyle = null, $pRange = '') - { - $this->duplicateStyle($pSharedCellStyle, $pRange); - return $this; - } - - /** - * Duplicate cell style to a range of cells - * - * Please note that this will overwrite existing cell styles for cells in range! - * - * @param PHPExcel_Style $pCellStyle Cell style to duplicate - * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function duplicateStyle(PHPExcel_Style $pCellStyle = null, $pRange = '') - { - // make sure we have a real style and not supervisor - $style = $pCellStyle->getIsSupervisor() ? $pCellStyle->getSharedComponent() : $pCellStyle; - - // Add the style to the workbook if necessary - $workbook = $this->_parent; - if ($existingStyle = $this->_parent->getCellXfByHashCode($pCellStyle->getHashCode())) { - // there is already such cell Xf in our collection - $xfIndex = $existingStyle->getIndex(); - } else { - // we don't have such a cell Xf, need to add - $workbook->addCellXf($pCellStyle); - $xfIndex = $pCellStyle->getIndex(); - } - - // Uppercase coordinate - $pRange = strtoupper($pRange); - - // Is it a cell range or a single cell? - $rangeA = ''; - $rangeB = ''; - if (strpos($pRange, ':') === false) { - $rangeA = $pRange; - $rangeB = $pRange; - } else { - list($rangeA, $rangeB) = explode(':', $pRange); - } - - // Calculate range outer borders - $rangeStart = PHPExcel_Cell::coordinateFromString($rangeA); - $rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB); - - // Translate column into index - $rangeStart[0] = PHPExcel_Cell::columnIndexFromString($rangeStart[0]) - 1; - $rangeEnd[0] = PHPExcel_Cell::columnIndexFromString($rangeEnd[0]) - 1; - - // Make sure we can loop upwards on rows and columns - if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) { - $tmp = $rangeStart; - $rangeStart = $rangeEnd; - $rangeEnd = $tmp; - } - - // Loop through cells and apply styles - for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { - for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { - $this->getCell(PHPExcel_Cell::stringFromColumnIndex($col) . $row)->setXfIndex($xfIndex); - } - } - - return $this; - } - - /** - * Duplicate conditional style to a range of cells - * - * Please note that this will overwrite existing cell styles for cells in range! - * - * @param array of PHPExcel_Style_Conditional $pCellStyle Cell style to duplicate - * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function duplicateConditionalStyle(array $pCellStyle = null, $pRange = '') - { - foreach($pCellStyle as $cellStyle) { - if (!is_a($cellStyle,'PHPExcel_Style_Conditional')) { - throw new Exception('Style is not a conditional style'); - } - } - - // Uppercase coordinate - $pRange = strtoupper($pRange); - - // Is it a cell range or a single cell? - $rangeA = ''; - $rangeB = ''; - if (strpos($pRange, ':') === false) { - $rangeA = $pRange; - $rangeB = $pRange; - } else { - list($rangeA, $rangeB) = explode(':', $pRange); - } - - // Calculate range outer borders - $rangeStart = PHPExcel_Cell::coordinateFromString($rangeA); - $rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB); - - // Translate column into index - $rangeStart[0] = PHPExcel_Cell::columnIndexFromString($rangeStart[0]) - 1; - $rangeEnd[0] = PHPExcel_Cell::columnIndexFromString($rangeEnd[0]) - 1; - - // Make sure we can loop upwards on rows and columns - if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) { - $tmp = $rangeStart; - $rangeStart = $rangeEnd; - $rangeEnd = $tmp; - } - - // Loop through cells and apply styles - for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { - for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { - $this->setConditionalStyles(PHPExcel_Cell::stringFromColumnIndex($col) . $row, $pCellStyle); - } - } - - return $this; - } - - /** - * Duplicate cell style array to a range of cells - * - * Please note that this will overwrite existing cell styles for cells in range, - * if they are in the styles array. For example, if you decide to set a range of - * cells to font bold, only include font bold in the styles array. - * - * @deprecated - * @param array $pStyles Array containing style information - * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") - * @param boolean $pAdvanced Advanced mode for setting borders. - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function duplicateStyleArray($pStyles = null, $pRange = '', $pAdvanced = true) - { - $this->getStyle($pRange)->applyFromArray($pStyles, $pAdvanced); - return $this; - } - - /** - * Set break on a cell - * - * @param string $pCell Cell coordinate (e.g. A1) - * @param int $pBreak Break type (type of PHPExcel_Worksheet::BREAK_*) - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function setBreak($pCell = 'A1', $pBreak = PHPExcel_Worksheet::BREAK_NONE) - { - // Uppercase coordinate - $pCell = strtoupper($pCell); - - if ($pCell != '') { - $this->_breaks[$pCell] = $pBreak; - } else { - throw new Exception('No cell coordinate specified.'); - } - - return $this; - } - - /** - * Set break on a cell by using numeric cell coordinates - * - * @param integer $pColumn Numeric column coordinate of the cell - * @param integer $pRow Numeric row coordinate of the cell - * @param integer $pBreak Break type (type of PHPExcel_Worksheet::BREAK_*) - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function setBreakByColumnAndRow($pColumn = 0, $pRow = 1, $pBreak = PHPExcel_Worksheet::BREAK_NONE) - { - return $this->setBreak(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow, $pBreak); - } - - /** - * Get breaks - * - * @return array[] - */ - public function getBreaks() - { - return $this->_breaks; - } - - /** - * Set merge on a cell range - * - * @param string $pRange Cell range (e.g. A1:E1) - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function mergeCells($pRange = 'A1:A1') - { - // Uppercase coordinate - $pRange = strtoupper($pRange); - - if (strpos($pRange,':') !== false) { - $this->_mergeCells[$pRange] = $pRange; - - // make sure cells are created - - // get the cells in the range - $aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange); - - // create upper left cell if it does not already exist - $upperLeft = $aReferences[0]; - if (!$this->cellExists($upperLeft)) { - $this->getCell($upperLeft)->setValueExplicit(null, PHPExcel_Cell_DataType::TYPE_NULL); - } - - // create or blank out the rest of the cells in the range - $count = count($aReferences); - for ($i = 1; $i < $count; $i++) { - $this->getCell($aReferences[$i])->setValueExplicit(null, PHPExcel_Cell_DataType::TYPE_NULL); - } - - } else { - throw new Exception('Merge must be set on a range of cells.'); - } - - return $this; - } - - /** - * Set merge on a cell range by using numeric cell coordinates - * - * @param int $pColumn1 Numeric column coordinate of the first cell - * @param int $pRow1 Numeric row coordinate of the first cell - * @param int $pColumn2 Numeric column coordinate of the last cell - * @param int $pRow2 Numeric row coordinate of the last cell - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function mergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1) - { - $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2; - return $this->mergeCells($cellRange); - } - - /** - * Remove merge on a cell range - * - * @param string $pRange Cell range (e.g. A1:E1) - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function unmergeCells($pRange = 'A1:A1') - { - // Uppercase coordinate - $pRange = strtoupper($pRange); - - if (strpos($pRange,':') !== false) { - if (isset($this->_mergeCells[$pRange])) { - unset($this->_mergeCells[$pRange]); - } else { - throw new Exception('Cell range ' . $pRange . ' not known as merged.'); - } - } else { - throw new Exception('Merge can only be removed from a range of cells.'); - } - - return $this; - } - - /** - * Remove merge on a cell range by using numeric cell coordinates - * - * @param int $pColumn1 Numeric column coordinate of the first cell - * @param int $pRow1 Numeric row coordinate of the first cell - * @param int $pColumn2 Numeric column coordinate of the last cell - * @param int $pRow2 Numeric row coordinate of the last cell - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function unmergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1) - { - $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2; - return $this->unmergeCells($cellRange); - } - - /** - * Get merge cells array. - * - * @return array[] - */ - public function getMergeCells() - { - return $this->_mergeCells; - } - - /** - * Set merge cells array for the entire sheet. Use instead mergeCells() to merge - * a single cell range. - * - * @param array - */ - public function setMergeCells($pValue = array()) - { - $this->_mergeCells = $pValue; - - return $this; - } - - /** - * Set protection on a cell range - * - * @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1) - * @param string $pPassword Password to unlock the protection - * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function protectCells($pRange = 'A1', $pPassword = '', $pAlreadyHashed = false) - { - // Uppercase coordinate - $pRange = strtoupper($pRange); - - if (!$pAlreadyHashed) { - $pPassword = PHPExcel_Shared_PasswordHasher::hashPassword($pPassword); - } - $this->_protectedCells[$pRange] = $pPassword; - - return $this; - } - - /** - * Set protection on a cell range by using numeric cell coordinates - * - * @param int $pColumn1 Numeric column coordinate of the first cell - * @param int $pRow1 Numeric row coordinate of the first cell - * @param int $pColumn2 Numeric column coordinate of the last cell - * @param int $pRow2 Numeric row coordinate of the last cell - * @param string $pPassword Password to unlock the protection - * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function protectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1, $pPassword = '', $pAlreadyHashed = false) - { - $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2; - return $this->protectCells($cellRange, $pPassword, $pAlreadyHashed); - } - - /** - * Remove protection on a cell range - * - * @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1) - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function unprotectCells($pRange = 'A1') - { - // Uppercase coordinate - $pRange = strtoupper($pRange); - - if (isset($this->_protectedCells[$pRange])) { - unset($this->_protectedCells[$pRange]); - } else { - throw new Exception('Cell range ' . $pRange . ' not known as protected.'); - } - return $this; - } - - /** - * Remove protection on a cell range by using numeric cell coordinates - * - * @param int $pColumn1 Numeric column coordinate of the first cell - * @param int $pRow1 Numeric row coordinate of the first cell - * @param int $pColumn2 Numeric column coordinate of the last cell - * @param int $pRow2 Numeric row coordinate of the last cell - * @param string $pPassword Password to unlock the protection - * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function unprotectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1, $pPassword = '', $pAlreadyHashed = false) - { - $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2; - return $this->unprotectCells($cellRange, $pPassword, $pAlreadyHashed); - } - - /** - * Get protected cells - * - * @return array[] - */ - public function getProtectedCells() - { - return $this->_protectedCells; - } - - /** - * Get Autofilter - * - * @return PHPExcel_Worksheet_AutoFilter - */ - public function getAutoFilter() - { - return $this->_autoFilter; - } - - /** - * Set AutoFilter - * - * @param PHPExcel_Worksheet_AutoFilter|string $pValue - * A simple string containing a Cell range like 'A1:E10' is permitted for backward compatibility - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function setAutoFilter($pValue) - { - if (is_string($pValue)) { - $this->_autoFilter->setRange($pValue); - } elseif(is_object($pValue) && ($pValue instanceof PHPExcel_Worksheet_AutoFilter)) { - $this->_autoFilter = $pValue; - } - return $this; - } - - /** - * Set Autofilter Range by using numeric cell coordinates - * - * @param int $pColumn1 Numeric column coordinate of the first cell - * @param int $pRow1 Numeric row coordinate of the first cell - * @param int $pColumn2 Numeric column coordinate of the second cell - * @param int $pRow2 Numeric row coordinate of the second cell - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function setAutoFilterByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1) - { - return $this->setAutoFilter( - PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 - . ':' . - PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2 - ); - } - - /** - * Remove autofilter - * - * @return PHPExcel_Worksheet - */ - public function removeAutoFilter() - { - $this->_autoFilter->setRange(NULL); - return $this; - } - - /** - * Get Freeze Pane - * - * @return string - */ - public function getFreezePane() - { - return $this->_freezePane; - } - - /** - * Freeze Pane - * - * @param string $pCell Cell (i.e. A2) - * Examples: - * A2 will freeze the rows above cell A2 (i.e row 1) - * B1 will freeze the columns to the left of cell B1 (i.e column A) - * B2 will freeze the rows above and to the left of cell A2 - * (i.e row 1 and column A) - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function freezePane($pCell = '') - { - // Uppercase coordinate - $pCell = strtoupper($pCell); - - if (strpos($pCell,':') === false && strpos($pCell,',') === false) { - $this->_freezePane = $pCell; - } else { - throw new Exception('Freeze pane can not be set on a range of cells.'); - } - return $this; - } - - /** - * Freeze Pane by using numeric cell coordinates - * - * @param int $pColumn Numeric column coordinate of the cell - * @param int $pRow Numeric row coordinate of the cell - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function freezePaneByColumnAndRow($pColumn = 0, $pRow = 1) - { - return $this->freezePane(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); - } - - /** - * Unfreeze Pane - * - * @return PHPExcel_Worksheet - */ - public function unfreezePane() - { - return $this->freezePane(''); - } - - /** - * Insert a new row, updating all possible related data - * - * @param int $pBefore Insert before this one - * @param int $pNumRows Number of rows to insert - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function insertNewRowBefore($pBefore = 1, $pNumRows = 1) { - if ($pBefore >= 1) { - $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance(); - $objReferenceHelper->insertNewBefore('A' . $pBefore, 0, $pNumRows, $this); - } else { - throw new Exception("Rows can only be inserted before at least row 1."); - } - return $this; - } - - /** - * Insert a new column, updating all possible related data - * - * @param int $pBefore Insert before this one - * @param int $pNumCols Number of columns to insert - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function insertNewColumnBefore($pBefore = 'A', $pNumCols = 1) { - if (!is_numeric($pBefore)) { - $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance(); - $objReferenceHelper->insertNewBefore($pBefore . '1', $pNumCols, 0, $this); - } else { - throw new Exception("Column references should not be numeric."); - } - return $this; - } - - /** - * Insert a new column, updating all possible related data - * - * @param int $pBefore Insert before this one (numeric column coordinate of the cell) - * @param int $pNumCols Number of columns to insert - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function insertNewColumnBeforeByIndex($pBefore = 0, $pNumCols = 1) { - if ($pBefore >= 0) { - return $this->insertNewColumnBefore(PHPExcel_Cell::stringFromColumnIndex($pBefore), $pNumCols); - } else { - throw new Exception("Columns can only be inserted before at least column A (0)."); - } - } - - /** - * Delete a row, updating all possible related data - * - * @param int $pRow Remove starting with this one - * @param int $pNumRows Number of rows to remove - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function removeRow($pRow = 1, $pNumRows = 1) { - if ($pRow >= 1) { - $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance(); - $objReferenceHelper->insertNewBefore('A' . ($pRow + $pNumRows), 0, -$pNumRows, $this); - } else { - throw new Exception("Rows to be deleted should at least start from row 1."); - } - return $this; - } - - /** - * Remove a column, updating all possible related data - * - * @param int $pColumn Remove starting with this one - * @param int $pNumCols Number of columns to remove - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function removeColumn($pColumn = 'A', $pNumCols = 1) { - if (!is_numeric($pColumn)) { - $pColumn = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($pColumn) - 1 + $pNumCols); - $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance(); - $objReferenceHelper->insertNewBefore($pColumn . '1', -$pNumCols, 0, $this); - } else { - throw new Exception("Column references should not be numeric."); - } - return $this; - } - - /** - * Remove a column, updating all possible related data - * - * @param int $pColumn Remove starting with this one (numeric column coordinate of the cell) - * @param int $pNumCols Number of columns to remove - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function removeColumnByIndex($pColumn = 0, $pNumCols = 1) { - if ($pColumn >= 0) { - return $this->removeColumn(PHPExcel_Cell::stringFromColumnIndex($pColumn), $pNumCols); - } else { - throw new Exception("Columns to be deleted should at least start from column 0"); - } - } - - /** - * Show gridlines? - * - * @return boolean - */ - public function getShowGridlines() { - return $this->_showGridlines; - } - - /** - * Set show gridlines - * - * @param boolean $pValue Show gridlines (true/false) - * @return PHPExcel_Worksheet - */ - public function setShowGridlines($pValue = false) { - $this->_showGridlines = $pValue; - return $this; - } - - /** - * Print gridlines? - * - * @return boolean + * @return null|string */ - public function getPrintGridlines() { - return $this->_printGridlines; + public function getCodeName(){ + return $this->_codeName; } - /** - * Set print gridlines - * - * @param boolean $pValue Print gridlines (true/false) - * @return PHPExcel_Worksheet + * Sheet has a code name ? + * @return boolean */ - public function setPrintGridlines($pValue = false) { - $this->_printGridlines = $pValue; - return $this; - } - - /** - * Show row and column headers? - * - * @return boolean - */ - public function getShowRowColHeaders() { - return $this->_showRowColHeaders; - } - - /** - * Set show row and column headers - * - * @param boolean $pValue Show row and column headers (true/false) - * @return PHPExcel_Worksheet - */ - public function setShowRowColHeaders($pValue = false) { - $this->_showRowColHeaders = $pValue; - return $this; - } - - /** - * Show summary below? (Row/Column outlining) - * - * @return boolean - */ - public function getShowSummaryBelow() { - return $this->_showSummaryBelow; - } - - /** - * Set show summary below - * - * @param boolean $pValue Show summary below (true/false) - * @return PHPExcel_Worksheet - */ - public function setShowSummaryBelow($pValue = true) { - $this->_showSummaryBelow = $pValue; - return $this; - } - - /** - * Show summary right? (Row/Column outlining) - * - * @return boolean - */ - public function getShowSummaryRight() { - return $this->_showSummaryRight; - } - - /** - * Set show summary right - * - * @param boolean $pValue Show summary right (true/false) - * @return PHPExcel_Worksheet - */ - public function setShowSummaryRight($pValue = true) { - $this->_showSummaryRight = $pValue; - return $this; - } - - /** - * Get comments - * - * @return PHPExcel_Comment[] - */ - public function getComments() - { - return $this->_comments; - } - - /** - * Set comments array for the entire sheet. - * - * @param array of PHPExcel_Comment - * @return PHPExcel_Worksheet - */ - public function setComments($pValue = array()) - { - $this->_comments = $pValue; - - return $this; - } - - /** - * Get comment for cell - * - * @param string $pCellCoordinate Cell coordinate to get comment for - * @return PHPExcel_Comment - * @throws Exception - */ - public function getComment($pCellCoordinate = 'A1') - { - // Uppercase coordinate - $pCellCoordinate = strtoupper($pCellCoordinate); - - if (strpos($pCellCoordinate,':') !== false || strpos($pCellCoordinate,',') !== false) { - throw new Exception('Cell coordinate string can not be a range of cells.'); - } else if (strpos($pCellCoordinate,'$') !== false) { - throw new Exception('Cell coordinate string must not be absolute.'); - } else if ($pCellCoordinate == '') { - throw new Exception('Cell coordinate can not be zero-length string.'); - } else { - // Check if we already have a comment for this cell. - // If not, create a new comment. - if (isset($this->_comments[$pCellCoordinate])) { - return $this->_comments[$pCellCoordinate]; - } else { - $newComment = new PHPExcel_Comment(); - $this->_comments[$pCellCoordinate] = $newComment; - return $newComment; - } - } - } - - /** - * Get comment for cell by using numeric cell coordinates - * - * @param int $pColumn Numeric column coordinate of the cell - * @param int $pRow Numeric row coordinate of the cell - * @return PHPExcel_Comment - */ - public function getCommentByColumnAndRow($pColumn = 0, $pRow = 1) - { - return $this->getComment(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); - } - - /** - * Get selected cell - * - * @deprecated - * @return string - */ - public function getSelectedCell() - { - return $this->getSelectedCells(); - } - - /** - * Get active cell - * - * @return string Example: 'A1' - */ - public function getActiveCell() - { - return $this->_activeCell; - } - - /** - * Get selected cells - * - * @return string - */ - public function getSelectedCells() - { - return $this->_selectedCells; - } - - /** - * Selected cell - * - * @param string $pCoordinate Cell (i.e. A1) - * @return PHPExcel_Worksheet - */ - public function setSelectedCell($pCoordinate = 'A1') - { - return $this->setSelectedCells($pCoordinate); - } - - /** - * Select a range of cells. - * - * @param string $pCoordinate Cell range, examples: 'A1', 'B2:G5', 'A:C', '3:6' - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function setSelectedCells($pCoordinate = 'A1') - { - // Uppercase coordinate - $pCoordinate = strtoupper($pCoordinate); - - // Convert 'A' to 'A:A' - $pCoordinate = preg_replace('/^([A-Z]+)$/', '${1}:${1}', $pCoordinate); - - // Convert '1' to '1:1' - $pCoordinate = preg_replace('/^([0-9]+)$/', '${1}:${1}', $pCoordinate); - - // Convert 'A:C' to 'A1:C1048576' - $pCoordinate = preg_replace('/^([A-Z]+):([A-Z]+)$/', '${1}1:${2}1048576', $pCoordinate); - - // Convert '1:3' to 'A1:XFD3' - $pCoordinate = preg_replace('/^([0-9]+):([0-9]+)$/', 'A${1}:XFD${2}', $pCoordinate); - - if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) { - list($first, ) = PHPExcel_Cell::splitRange($pCoordinate); - $this->_activeCell = $first[0]; - } else { - $this->_activeCell = $pCoordinate; - } - $this->_selectedCells = $pCoordinate; - return $this; - } - - /** - * Selected cell by using numeric cell coordinates - * - * @param int $pColumn Numeric column coordinate of the cell - * @param int $pRow Numeric row coordinate of the cell - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function setSelectedCellByColumnAndRow($pColumn = 0, $pRow = 1) - { - return $this->setSelectedCells(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); - } - - /** - * Get right-to-left - * - * @return boolean - */ - public function getRightToLeft() { - return $this->_rightToLeft; - } - - /** - * Set right-to-left - * - * @param boolean $value Right-to-left true/false - * @return PHPExcel_Worksheet - */ - public function setRightToLeft($value = false) { - $this->_rightToLeft = $value; - return $this; - } - - /** - * Fill worksheet from values in array - * - * @param array $source Source array - * @param mixed $nullValue Value in source array that stands for blank cell - * @param string $startCell Insert array starting from this cell address as the top left coordinate - * @param boolean $strictNullComparison Apply strict comparison when testing for null values in the array - * @throws Exception - * @return PHPExcel_Worksheet - */ - public function fromArray($source = null, $nullValue = null, $startCell = 'A1', $strictNullComparison = false) { - if (is_array($source)) { - // Convert a 1-D array to 2-D (for ease of looping) - if (!is_array(end($source))) { - $source = array($source); - } - - // start coordinate - list ($startColumn, $startRow) = PHPExcel_Cell::coordinateFromString($startCell); - - // Loop through $source - foreach ($source as $rowData) { - $currentColumn = $startColumn; - foreach($rowData as $cellValue) { - if ($strictNullComparison) { - if ($cellValue !== $nullValue) { - // Set cell value - $this->getCell($currentColumn . $startRow)->setValue($cellValue); - } - } else { - if ($cellValue != $nullValue) { - // Set cell value - $this->getCell($currentColumn . $startRow)->setValue($cellValue); - } - } - ++$currentColumn; - } - ++$startRow; - } - } else { - throw new Exception("Parameter \$source should be an array."); - } - return $this; - } - - /** - * Create array from a range of cells - * - * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") - * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist - * @param boolean $calculateFormulas Should formulas be calculated? - * @param boolean $formatData Should formatting be applied to cell values? - * @param boolean $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero - * True - Return rows and columns indexed by their actual row and column IDs - * @return array - */ - public function rangeToArray($pRange = 'A1', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) { - // Returnvalue - $returnValue = array(); - - // Identify the range that we need to extract from the worksheet - list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($pRange); - $minCol = PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] -1); - $minRow = $rangeStart[1]; - $maxCol = PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0] -1); - $maxRow = $rangeEnd[1]; - - $maxCol++; - - // Loop through rows - $r = -1; - for ($row = $minRow; $row <= $maxRow; ++$row) { - $rRef = ($returnCellRef) ? $row : ++$r; - $c = -1; - // Loop through columns in the current row - for ($col = $minCol; $col != $maxCol; ++$col) { - $cRef = ($returnCellRef) ? $col : ++$c; - // Using getCell() will create a new cell if it doesn't already exist. We don't want that to happen - // so we test and retrieve directly against _cellCollection - if ($this->_cellCollection->isDataSet($col.$row)) { - // Cell exists - $cell = $this->_cellCollection->getCacheData($col.$row); - if ($cell->getValue() !== null) { - if ($cell->getValue() instanceof PHPExcel_RichText) { - $returnValue[$rRef][$cRef] = $cell->getValue()->getPlainText(); - } else { - if ($calculateFormulas) { - $returnValue[$rRef][$cRef] = $cell->getCalculatedValue(); - } else { - $returnValue[$rRef][$cRef] = $cell->getValue(); - } - } - - if ($formatData) { - $style = $this->_parent->getCellXfByIndex($cell->getXfIndex()); - $returnValue[$rRef][$cRef] = PHPExcel_Style_NumberFormat::toFormattedString($returnValue[$rRef][$cRef], $style->getNumberFormat()->getFormatCode()); - } - } else { - // Cell holds a NULL - $returnValue[$rRef][$cRef] = $nullValue; - } - } else { - // Cell doesn't exist - $returnValue[$rRef][$cRef] = $nullValue; - } - } - } - - // Return - return $returnValue; - } - - - /** - * Create array from a range of cells - * - * @param string $pNamedRange Name of the Named Range - * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist - * @param boolean $calculateFormulas Should formulas be calculated? - * @param boolean $formatData Should formatting be applied to cell values? - * @param boolean $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero - * True - Return rows and columns indexed by their actual row and column IDs - * @return array - * @throws Exception - */ - public function namedRangeToArray($pNamedRange = '', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) { - $namedRange = PHPExcel_NamedRange::resolveRange($pNamedRange, $this); - if ($namedRange !== NULL) { - $pWorkSheet = $namedRange->getWorksheet(); - $pCellRange = $namedRange->getRange(); - - return $pWorkSheet->rangeToArray( $pCellRange, - $nullValue, $calculateFormulas, $formatData, $returnCellRef); - } - - throw new Exception('Named Range '.$pNamedRange.' does not exist.'); - } - - - /** - * Create array from worksheet - * - * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist - * @param boolean $calculateFormulas Should formulas be calculated? - * @param boolean $formatData Should formatting be applied to cell values? - * @param boolean $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero - * True - Return rows and columns indexed by their actual row and column IDs - * @return array - */ - public function toArray($nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) { - // Garbage collect... - $this->garbageCollect(); - - // Identify the range that we need to extract from the worksheet - $maxCol = $this->getHighestColumn(); - $maxRow = $this->getHighestRow(); - // Return - return $this->rangeToArray( 'A1:'.$maxCol.$maxRow, - $nullValue, $calculateFormulas, $formatData, $returnCellRef); - } - - /** - * Get row iterator - * - * @param integer $startRow The row number at which to start iterating - * @return PHPExcel_Worksheet_RowIterator - */ - public function getRowIterator($startRow = 1) { - return new PHPExcel_Worksheet_RowIterator($this,$startRow); - } - - /** - * Run PHPExcel garabage collector. - * - * @return PHPExcel_Worksheet - */ - public function garbageCollect() { - // Build a reference table from images -// $imageCoordinates = array(); -// $iterator = $this->getDrawingCollection()->getIterator(); -// while ($iterator->valid()) { -// $imageCoordinates[$iterator->current()->getCoordinates()] = true; -// -// $iterator->next(); -// } -// - // Lookup highest column and highest row if cells are cleaned - $colRow = $this->_cellCollection->getHighestRowAndColumn(); - $highestRow = $colRow['row']; - $highestColumn = PHPExcel_Cell::columnIndexFromString($colRow['column']); - - // Loop through column dimensions - foreach ($this->_columnDimensions as $dimension) { - $highestColumn = max($highestColumn,PHPExcel_Cell::columnIndexFromString($dimension->getColumnIndex())); - } - - // Loop through row dimensions - foreach ($this->_rowDimensions as $dimension) { - $highestRow = max($highestRow,$dimension->getRowIndex()); - } - - // Cache values - if ($highestColumn < 0) { - $this->_cachedHighestColumn = 'A'; - } else { - $this->_cachedHighestColumn = PHPExcel_Cell::stringFromColumnIndex(--$highestColumn); - } - $this->_cachedHighestRow = $highestRow; - - // Return - return $this; - } - - /** - * Get hash code - * - * @return string Hash code - */ - public function getHashCode() { - if ($this->_dirty) { - $this->_hash = md5( $this->_title . - $this->_autoFilter . - ($this->_protection->isProtectionEnabled() ? 't' : 'f') . - __CLASS__ - ); - $this->_dirty = false; - } - return $this->_hash; - } - - /** - * Extract worksheet title from range. - * - * Example: extractSheetTitle("testSheet!A1") ==> 'A1' - * Example: extractSheetTitle("'testSheet 1'!A1", true) ==> array('testSheet 1', 'A1'); - * - * @param string $pRange Range to extract title from - * @param bool $returnRange Return range? (see example) - * @return mixed - */ - public static function extractSheetTitle($pRange, $returnRange = false) { - // Sheet title included? - if (($sep = strpos($pRange, '!')) === false) { - return ''; - } - - if ($returnRange) { - return array( trim(substr($pRange, 0, $sep),"'"), - substr($pRange, $sep + 1) - ); - } - - return substr($pRange, $sep + 1); - } - - /** - * Get hyperlink - * - * @param string $pCellCoordinate Cell coordinate to get hyperlink for - */ - public function getHyperlink($pCellCoordinate = 'A1') - { - // return hyperlink if we already have one - if (isset($this->_hyperlinkCollection[$pCellCoordinate])) { - return $this->_hyperlinkCollection[$pCellCoordinate]; - } - - // else create hyperlink - $this->_hyperlinkCollection[$pCellCoordinate] = new PHPExcel_Cell_Hyperlink(); - return $this->_hyperlinkCollection[$pCellCoordinate]; - } - - /** - * Set hyperlnk - * - * @param string $pCellCoordinate Cell coordinate to insert hyperlink - * @param PHPExcel_Cell_Hyperlink $pHyperlink - * @return PHPExcel_Worksheet - */ - public function setHyperlink($pCellCoordinate = 'A1', PHPExcel_Cell_Hyperlink $pHyperlink = null) - { - if ($pHyperlink === null) { - unset($this->_hyperlinkCollection[$pCellCoordinate]); - } else { - $this->_hyperlinkCollection[$pCellCoordinate] = $pHyperlink; - } - return $this; - } - - /** - * Hyperlink at a specific coordinate exists? - * - * @param string $pCoordinate - * @return boolean - */ - public function hyperlinkExists($pCoordinate = 'A1') - { - return isset($this->_hyperlinkCollection[$pCoordinate]); - } - - /** - * Get collection of hyperlinks - * - * @return PHPExcel_Cell_Hyperlink[] - */ - public function getHyperlinkCollection() - { - return $this->_hyperlinkCollection; - } - - /** - * Get data validation - * - * @param string $pCellCoordinate Cell coordinate to get data validation for - */ - public function getDataValidation($pCellCoordinate = 'A1') - { - // return data validation if we already have one - if (isset($this->_dataValidationCollection[$pCellCoordinate])) { - return $this->_dataValidationCollection[$pCellCoordinate]; - } - - // else create data validation - $this->_dataValidationCollection[$pCellCoordinate] = new PHPExcel_Cell_DataValidation(); - return $this->_dataValidationCollection[$pCellCoordinate]; - } - - /** - * Set data validation - * - * @param string $pCellCoordinate Cell coordinate to insert data validation - * @param PHPExcel_Cell_DataValidation $pDataValidation - * @return PHPExcel_Worksheet - */ - public function setDataValidation($pCellCoordinate = 'A1', PHPExcel_Cell_DataValidation $pDataValidation = null) - { - if ($pDataValidation === null) { - unset($this->_dataValidationCollection[$pCellCoordinate]); - } else { - $this->_dataValidationCollection[$pCellCoordinate] = $pDataValidation; - } - return $this; - } - - /** - * Data validation at a specific coordinate exists? - * - * @param string $pCoordinate - * @return boolean - */ - public function dataValidationExists($pCoordinate = 'A1') - { - return isset($this->_dataValidationCollection[$pCoordinate]); - } - - /** - * Get collection of data validations - * - * @return PHPExcel_Cell_DataValidation[] - */ - public function getDataValidationCollection() - { - return $this->_dataValidationCollection; - } - - /** - * Accepts a range, returning it as a range that falls within the current highest row and column of the worksheet - * - * @param string $range - * @return string Adjusted range value - */ - public function shrinkRangeToFit($range) { - $maxCol = $this->getHighestColumn(); - $maxRow = $this->getHighestRow(); - $maxCol = PHPExcel_Cell::columnIndexFromString($maxCol); - - $rangeBlocks = explode(' ',$range); - foreach ($rangeBlocks as &$rangeSet) { - $rangeBoundaries = PHPExcel_Cell::getRangeBoundaries($rangeSet); - - if (PHPExcel_Cell::columnIndexFromString($rangeBoundaries[0][0]) > $maxCol) { $rangeBoundaries[0][0] = PHPExcel_Cell::stringFromColumnIndex($maxCol); } - if ($rangeBoundaries[0][1] > $maxRow) { $rangeBoundaries[0][1] = $maxRow; } - if (PHPExcel_Cell::columnIndexFromString($rangeBoundaries[1][0]) > $maxCol) { $rangeBoundaries[1][0] = PHPExcel_Cell::stringFromColumnIndex($maxCol); } - if ($rangeBoundaries[1][1] > $maxRow) { $rangeBoundaries[1][1] = $maxRow; } - $rangeSet = $rangeBoundaries[0][0].$rangeBoundaries[0][1].':'.$rangeBoundaries[1][0].$rangeBoundaries[1][1]; - } - unset($rangeSet); - $stRange = implode(' ',$rangeBlocks); - - return $stRange; - } - - - /** - * Get tab color - * - * @return PHPExcel_Style_Color - */ - public function getTabColor() - { - if ($this->_tabColor === NULL) - $this->_tabColor = new PHPExcel_Style_Color(); - - return $this->_tabColor; - } - - /** - * Reset tab color - * - * @return PHPExcel_Worksheet - */ - public function resetTabColor() - { - $this->_tabColor = null; - unset($this->_tabColor); - - return $this; - } - - /** - * Tab color set? - * - * @return boolean - */ - public function isTabColorSet() - { - return ($this->_tabColor !== NULL); - } - - /** - * Copy worksheet (!= clone!) - * - * @return PHPExcel_Worksheet - */ - public function copy() { - $copied = clone $this; - - return $copied; - } - - /** - * Implement PHP __clone to create a deep clone, not just a shallow copy. - */ - public function __clone() { - foreach ($this as $key => $val) { - if ($key == '_parent') { - continue; - } - - if (is_object($val) || (is_array($val))) { - if ($key == '_cellCollection') { - $newCollection = clone $this->_cellCollection; - $newCollection->copyCellCollection($this); - $this->_cellCollection = $newCollection; - } elseif ($key == '_drawingCollection') { - $newCollection = clone $this->_drawingCollection; - $this->_drawingCollection = $newCollection; - } elseif (($key == '_autoFilter') && (is_a($this->_autoFilter,'PHPExcel_Worksheet_AutoFilter'))) { - $newAutoFilter = clone $this->_autoFilter; - $this->_autoFilter = $newAutoFilter; - $this->_autoFilter->setParent($this); - } else { - $this->{$key} = unserialize(serialize($val)); - } - } - } + public function hasCodeName(){ + return !(is_null($this->_codeName)); } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Worksheet/AutoFilter.php b/htdocs/includes/phpexcel/PHPExcel/Worksheet/AutoFilter.php index e6ea6f207a7..03055e10b99 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Worksheet/AutoFilter.php +++ b/htdocs/includes/phpexcel/PHPExcel/Worksheet/AutoFilter.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_AutoFilter { @@ -61,6 +61,9 @@ class PHPExcel_Worksheet_AutoFilter /** * Create a new PHPExcel_Worksheet_AutoFilter + * + * @param string $pRange Cell range (i.e. A1:E10) + * @param PHPExcel_Worksheet $pSheet */ public function __construct($pRange = '', PHPExcel_Worksheet $pSheet = NULL) { @@ -80,7 +83,7 @@ class PHPExcel_Worksheet_AutoFilter /** * Set AutoFilter Parent Worksheet * - * @param PHPExcel_Worksheet + * @param PHPExcel_Worksheet $pSheet * @return PHPExcel_Worksheet_AutoFilter */ public function setParent(PHPExcel_Worksheet $pSheet = NULL) { @@ -243,7 +246,7 @@ class PHPExcel_Worksheet_AutoFilter /** * Clear a specified AutoFilter Column * - * @param string $pColumn Column name (e.g. A) + * @param string $pColumn Column name (e.g. A) * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_AutoFilter */ @@ -347,10 +350,10 @@ class PHPExcel_Worksheet_AutoFilter * Test if cell value is within a set of values defined by a ruleset * * @param mixed $cellValue - * @param mixed[] $dataSet + * @param mixed[] $ruleSet * @return boolean */ - private static function _filterTestInCustomDataSet($cellValue,$ruleSet) + private static function _filterTestInCustomDataSet($cellValue, $ruleSet) { $dataSet = $ruleSet['filterRules']; $join = $ruleSet['join']; @@ -424,10 +427,10 @@ class PHPExcel_Worksheet_AutoFilter * Test if cell date value is matches a set of values defined by a set of months * * @param mixed $cellValue - * @param mixed[] $dataSet + * @param mixed[] $monthSet * @return boolean */ - private static function _filterTestInPeriodDateSet($cellValue,$monthSet) + private static function _filterTestInPeriodDateSet($cellValue, $monthSet) { // Blank cells are always ignored, so return a FALSE if (($cellValue == '') || ($cellValue === NULL)) { @@ -457,7 +460,7 @@ class PHPExcel_Worksheet_AutoFilter * Convert a dynamic rule daterange to a custom filter range expression for ease of calculation * * @param string $dynamicRuleType - * @param PHPExcel_Worksheet_AutoFilter_Column $filterColumn + * @param PHPExcel_Worksheet_AutoFilter_Column &$filterColumn * @return mixed[] */ private function _dynamicFilterDateRange($dynamicRuleType, &$filterColumn) @@ -725,7 +728,7 @@ class PHPExcel_Worksheet_AutoFilter // Date based if ($dynamicRuleType{0} == 'M' || $dynamicRuleType{0} == 'Q') { // Month or Quarter - list($periodType,$period) = sscanf($dynamicRuleType,'%[A-Z]%d'); + sscanf($dynamicRuleType,'%[A-Z]%d', $periodType, $period); if ($periodType == 'M') { $ruleValues = array($period); } else { @@ -826,20 +829,20 @@ class PHPExcel_Worksheet_AutoFilter if (is_object($value)) { if ($key == '_workSheet') { // Detach from worksheet - $this->$key = NULL; + $this->{$key} = NULL; } else { - $this->$key = clone $value; + $this->{$key} = clone $value; } } elseif ((is_array($value)) && ($key == '_columns')) { // The columns array of PHPExcel_Worksheet_AutoFilter objects - $this->$key = array(); + $this->{$key} = array(); foreach ($value as $k => $v) { - $this->$key[$k] = clone $v; + $this->{$key}[$k] = clone $v; // attach the new cloned Column to this new cloned Autofilter object - $this->$key[$k]->setParent($this); + $this->{$key}[$k]->setParent($this); } } else { - $this->$key = $value; + $this->{$key} = $value; } } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Worksheet/AutoFilter/Column.php b/htdocs/includes/phpexcel/PHPExcel/Worksheet/AutoFilter/Column.php index bb70ec672fe..12043d5a0a1 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Worksheet/AutoFilter/Column.php +++ b/htdocs/includes/phpexcel/PHPExcel/Worksheet/AutoFilter/Column.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_AutoFilter_Column { @@ -44,6 +44,11 @@ class PHPExcel_Worksheet_AutoFilter_Column // e.g. filtered by date = TODAY const AUTOFILTER_FILTERTYPE_TOPTENFILTER = 'top10'; + /** + * Types of autofilter rules + * + * @var string[] + */ private static $_filterTypes = array( // Currently we're not handling // colorFilter @@ -59,6 +64,11 @@ class PHPExcel_Worksheet_AutoFilter_Column const AUTOFILTER_COLUMN_JOIN_AND = 'and'; const AUTOFILTER_COLUMN_JOIN_OR = 'or'; + /** + * Join options for autofilter rules + * + * @var string[] + */ private static $_ruleJoins = array( self::AUTOFILTER_COLUMN_JOIN_AND, self::AUTOFILTER_COLUMN_JOIN_OR, @@ -114,6 +124,9 @@ class PHPExcel_Worksheet_AutoFilter_Column /** * Create a new PHPExcel_Worksheet_AutoFilter_Column + * + * @param string $pColumn Column (e.g. A) + * @param PHPExcel_Worksheet_AutoFilter $pParent Autofilter for this column */ public function __construct($pColumn, PHPExcel_Worksheet_AutoFilter $pParent = NULL) { @@ -134,7 +147,7 @@ class PHPExcel_Worksheet_AutoFilter_Column * Set AutoFilter Column Index * * @param string $pColumn Column (e.g. A) - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_AutoFilter_Column */ public function setColumnIndex($pColumn) { @@ -183,7 +196,7 @@ class PHPExcel_Worksheet_AutoFilter_Column * Set AutoFilter Type * * @param string $pFilterType - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_AutoFilter_Column */ public function setFilterType($pFilterType = self::AUTOFILTER_FILTERTYPE_FILTER) { @@ -209,7 +222,7 @@ class PHPExcel_Worksheet_AutoFilter_Column * Set AutoFilter Multiple Rules And/Or * * @param string $pJoin And/Or - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_AutoFilter_Column */ public function setJoin($pJoin = self::AUTOFILTER_COLUMN_JOIN_OR) { @@ -228,7 +241,7 @@ class PHPExcel_Worksheet_AutoFilter_Column * Set AutoFilter Attributes * * @param string[] $pAttributes - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_AutoFilter_Column */ public function setAttributes($pAttributes = array()) { @@ -242,7 +255,7 @@ class PHPExcel_Worksheet_AutoFilter_Column * * @param string $pName Attribute Name * @param string $pValue Attribute Value - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_AutoFilter_Column */ public function setAttribute($pName, $pValue) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Worksheet/AutoFilter/Column/Rule.php b/htdocs/includes/phpexcel/PHPExcel/Worksheet/AutoFilter/Column/Rule.php index 209012ce180..ae33683f708 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Worksheet/AutoFilter/Column/Rule.php +++ b/htdocs/includes/phpexcel/PHPExcel/Worksheet/AutoFilter/Column/Rule.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_AutoFilter_Column_Rule { @@ -269,6 +269,8 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule /** * Create a new PHPExcel_Worksheet_AutoFilter_Column_Rule + * + * @param PHPExcel_Worksheet_AutoFilter_Column $pParent */ public function __construct(PHPExcel_Worksheet_AutoFilter_Column $pParent = NULL) { @@ -288,7 +290,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule * Set AutoFilter Rule Type * * @param string $pRuleType - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_AutoFilter_Column */ public function setRuleType($pRuleType = self::AUTOFILTER_RULETYPE_FILTER) { @@ -314,7 +316,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule * Set AutoFilter Rule Value * * @param string|string[] $pValue - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_AutoFilter_Column_Rule */ public function setValue($pValue = '') { @@ -354,7 +356,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule * Set AutoFilter Rule Operator * * @param string $pOperator - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_AutoFilter_Column_Rule */ public function setOperator($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL) { @@ -382,7 +384,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule * Set AutoFilter Rule Grouping * * @param string $pGrouping - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_AutoFilter_Column_Rule */ public function setGrouping($pGrouping = NULL) { @@ -404,7 +406,7 @@ class PHPExcel_Worksheet_AutoFilter_Column_Rule * @param string $pOperator * @param string|string[] $pValue * @param string $pGrouping - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_AutoFilter_Column_Rule */ public function setRule($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL, $pValue = '', $pGrouping = NULL) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Worksheet/BaseDrawing.php b/htdocs/includes/phpexcel/PHPExcel/Worksheet/BaseDrawing.php index 1e6725a38ad..4db0f8825a9 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Worksheet/BaseDrawing.php +++ b/htdocs/includes/phpexcel/PHPExcel/Worksheet/BaseDrawing.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable { @@ -212,7 +212,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable * * @param PHPExcel_Worksheet $pValue * @param bool $pOverrideOld If a Worksheet has already been assigned, overwrite it and remove image from old Worksheet? - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_BaseDrawing */ public function setWorksheet(PHPExcel_Worksheet $pValue = null, $pOverrideOld = false) { @@ -237,7 +237,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable // Set new PHPExcel_Worksheet $this->setWorksheet($pValue); } else { - throw new Exception("A PHPExcel_Worksheet has already been assigned. Drawings can only exist on one PHPExcel_Worksheet."); + throw new PHPExcel_Exception("A PHPExcel_Worksheet has already been assigned. Drawings can only exist on one PHPExcel_Worksheet."); } } return $this; @@ -440,7 +440,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable * Set Shadow * * @param PHPExcel_Worksheet_Drawing_Shadow $pValue - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_BaseDrawing */ public function setShadow(PHPExcel_Worksheet_Drawing_Shadow $pValue = null) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Worksheet/CellIterator.php b/htdocs/includes/phpexcel/PHPExcel/Worksheet/CellIterator.php index a612d550c62..4b968167a8d 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Worksheet/CellIterator.php +++ b/htdocs/includes/phpexcel/PHPExcel/Worksheet/CellIterator.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -33,7 +33,7 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_CellIterator implements Iterator { diff --git a/htdocs/includes/phpexcel/PHPExcel/Worksheet/ColumnDimension.php b/htdocs/includes/phpexcel/PHPExcel/Worksheet/ColumnDimension.php index 0915a359961..79db1c58ffa 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Worksheet/ColumnDimension.php +++ b/htdocs/includes/phpexcel/PHPExcel/Worksheet/ColumnDimension.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_ColumnDimension { @@ -195,12 +195,12 @@ class PHPExcel_Worksheet_ColumnDimension * Value must be between 0 and 7 * * @param int $pValue - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_ColumnDimension */ public function setOutlineLevel($pValue) { if ($pValue < 0 || $pValue > 7) { - throw new Exception("Outline level must range between 0 and 7."); + throw new PHPExcel_Exception("Outline level must range between 0 and 7."); } $this->_outlineLevel = $pValue; diff --git a/htdocs/includes/phpexcel/PHPExcel/Worksheet/Drawing.php b/htdocs/includes/phpexcel/PHPExcel/Worksheet/Drawing.php index 1d4e4b53fb0..56f0cfde13e 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Worksheet/Drawing.php +++ b/htdocs/includes/phpexcel/PHPExcel/Worksheet/Drawing.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Worksheet_Drawing - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Worksheet_Drawing - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable { @@ -98,7 +98,7 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen * * @param string $pValue File path * @param boolean $pVerifyFile Verify file - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_Drawing */ public function setPath($pValue = '', $pVerifyFile = true) { @@ -111,7 +111,7 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen list($this->_width, $this->_height) = getimagesize($pValue); } } else { - throw new Exception("File $pValue not found!"); + throw new PHPExcel_Exception("File $pValue not found!"); } } else { $this->_path = $pValue; diff --git a/htdocs/includes/phpexcel/PHPExcel/Worksheet/Drawing/Shadow.php b/htdocs/includes/phpexcel/PHPExcel/Worksheet/Drawing/Shadow.php index d4a53733dc3..5df448964b0 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Worksheet/Drawing/Shadow.php +++ b/htdocs/includes/phpexcel/PHPExcel/Worksheet/Drawing/Shadow.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Worksheet_Drawing - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Worksheet_Drawing - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable { @@ -226,7 +226,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable * Set Color * * @param PHPExcel_Style_Color $pValue - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_Drawing_Shadow */ public function setColor(PHPExcel_Style_Color $pValue = null) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Worksheet/HeaderFooter.php b/htdocs/includes/phpexcel/PHPExcel/Worksheet/HeaderFooter.php index e2524e1f951..82d7faf6d4e 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Worksheet/HeaderFooter.php +++ b/htdocs/includes/phpexcel/PHPExcel/Worksheet/HeaderFooter.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -91,7 +91,7 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_HeaderFooter { @@ -392,7 +392,7 @@ class PHPExcel_Worksheet_HeaderFooter * * @param PHPExcel_Worksheet_HeaderFooterDrawing $image * @param string $location - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_HeaderFooter */ public function addImage(PHPExcel_Worksheet_HeaderFooterDrawing $image = null, $location = self::IMAGE_HEADER_LEFT) { @@ -404,7 +404,7 @@ class PHPExcel_Worksheet_HeaderFooter * Remove header/footer image * * @param string $location - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_HeaderFooter */ public function removeImage($location = self::IMAGE_HEADER_LEFT) { @@ -418,12 +418,12 @@ class PHPExcel_Worksheet_HeaderFooter * Set header/footer images * * @param PHPExcel_Worksheet_HeaderFooterDrawing[] $images - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_HeaderFooter */ public function setImages($images) { if (!is_array($images)) { - throw new Exception('Invalid parameter!'); + throw new PHPExcel_Exception('Invalid parameter!'); } $this->_headerFooterImages = $images; diff --git a/htdocs/includes/phpexcel/PHPExcel/Worksheet/HeaderFooterDrawing.php b/htdocs/includes/phpexcel/PHPExcel/Worksheet/HeaderFooterDrawing.php index 94672da4722..1c6f4e19087 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Worksheet/HeaderFooterDrawing.php +++ b/htdocs/includes/phpexcel/PHPExcel/Worksheet/HeaderFooterDrawing.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing implements PHPExcel_IComparable { @@ -296,7 +296,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing * * @param string $pValue File path * @param boolean $pVerifyFile Verify file - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_HeaderFooterDrawing */ public function setPath($pValue = '', $pVerifyFile = true) { @@ -309,7 +309,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing list($this->_width, $this->_height) = getimagesize($pValue); } } else { - throw new Exception("File $pValue not found!"); + throw new PHPExcel_Exception("File $pValue not found!"); } } else { $this->_path = $pValue; diff --git a/htdocs/includes/phpexcel/PHPExcel/Worksheet/MemoryDrawing.php b/htdocs/includes/phpexcel/PHPExcel/Worksheet/MemoryDrawing.php index 223a29f06b0..93266d210c9 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Worksheet/MemoryDrawing.php +++ b/htdocs/includes/phpexcel/PHPExcel/Worksheet/MemoryDrawing.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable { diff --git a/htdocs/includes/phpexcel/PHPExcel/Worksheet/PageMargins.php b/htdocs/includes/phpexcel/PHPExcel/Worksheet/PageMargins.php index 7d31a5f6291..671711ff50e 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Worksheet/PageMargins.php +++ b/htdocs/includes/phpexcel/PHPExcel/Worksheet/PageMargins.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_PageMargins { diff --git a/htdocs/includes/phpexcel/PHPExcel/Worksheet/PageSetup.php b/htdocs/includes/phpexcel/PHPExcel/Worksheet/PageSetup.php index 693f1c6a83f..9512dbe48df 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Worksheet/PageSetup.php +++ b/htdocs/includes/phpexcel/PHPExcel/Worksheet/PageSetup.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -102,7 +102,7 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_PageSetup { @@ -339,7 +339,7 @@ class PHPExcel_Worksheet_PageSetup * @param int? $pValue * @param boolean $pUpdate Update fitToPage so scaling applies rather than fitToHeight / fitToWidth * @return PHPExcel_Worksheet_PageSetup - * @throws Exception + * @throws PHPExcel_Exception */ public function setScale($pValue = 100, $pUpdate = true) { // Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface, @@ -350,7 +350,7 @@ class PHPExcel_Worksheet_PageSetup $this->_fitToPage = false; } } else { - throw new Exception("Scale must not be negative"); + throw new PHPExcel_Exception("Scale must not be negative"); } return $this; } @@ -568,7 +568,7 @@ class PHPExcel_Worksheet_PageSetup * Default behaviour, or a index value of 0, will return all ranges as a comma-separated string * Otherwise, the specific range identified by the value of $index will be returned * Print areas are numbered from 1 - * @throws Exception + * @throws PHPExcel_Exception * @return string */ public function getPrintArea($index = 0) { @@ -579,7 +579,7 @@ class PHPExcel_Worksheet_PageSetup if (isset($printAreas[$index-1])) { return $printAreas[$index-1]; } - throw new Exception("Requested Print Area does not exist"); + throw new PHPExcel_Exception("Requested Print Area does not exist"); } /** @@ -640,15 +640,15 @@ class PHPExcel_Worksheet_PageSetup * Default behaviour, or the "O" method, overwrites existing print area * The "I" method, inserts the new print area before any specified index, or at the end of the list * @return PHPExcel_Worksheet_PageSetup - * @throws Exception + * @throws PHPExcel_Exception */ public function setPrintArea($value, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE) { if (strpos($value,'!') !== false) { - throw new Exception('Cell coordinate must not specify a worksheet.'); + throw new PHPExcel_Exception('Cell coordinate must not specify a worksheet.'); } elseif (strpos($value,':') === false) { - throw new Exception('Cell coordinate must be a range of cells.'); + throw new PHPExcel_Exception('Cell coordinate must be a range of cells.'); } elseif (strpos($value,'$') !== false) { - throw new Exception('Cell coordinate must not be absolute.'); + throw new PHPExcel_Exception('Cell coordinate must not be absolute.'); } $value = strtoupper($value); @@ -661,7 +661,7 @@ class PHPExcel_Worksheet_PageSetup $index = count($printAreas) - abs($index) + 1; } if (($index <= 0) || ($index > count($printAreas))) { - throw new Exception('Invalid index for setting print range.'); + throw new PHPExcel_Exception('Invalid index for setting print range.'); } $printAreas[$index-1] = $value; $this->_printArea = implode(',',$printAreas); @@ -675,13 +675,13 @@ class PHPExcel_Worksheet_PageSetup $index = abs($index) - 1; } if ($index > count($printAreas)) { - throw new Exception('Invalid index for setting print range.'); + throw new PHPExcel_Exception('Invalid index for setting print range.'); } $printAreas = array_merge(array_slice($printAreas,0,$index),array($value),array_slice($printAreas,$index)); $this->_printArea = implode(',',$printAreas); } } else { - throw new Exception('Invalid method for setting print range.'); + throw new PHPExcel_Exception('Invalid method for setting print range.'); } return $this; @@ -698,7 +698,7 @@ class PHPExcel_Worksheet_PageSetup * list. * Print areas are numbered from 1 * @return PHPExcel_Worksheet_PageSetup - * @throws Exception + * @throws PHPExcel_Exception */ public function addPrintArea($value, $index = -1) { return $this->setPrintArea($value, $index, self::SETPRINTRANGE_INSERT); @@ -725,7 +725,7 @@ class PHPExcel_Worksheet_PageSetup * Default behaviour, or the "O" method, overwrites existing print area * The "I" method, inserts the new print area before any specified index, or at the end of the list * @return PHPExcel_Worksheet_PageSetup - * @throws Exception + * @throws PHPExcel_Exception */ public function setPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE) { @@ -746,7 +746,7 @@ class PHPExcel_Worksheet_PageSetup * list. * Print areas are numbered from 1 * @return PHPExcel_Worksheet_PageSetup - * @throws Exception + * @throws PHPExcel_Exception */ public function addPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = -1) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Worksheet/Protection.php b/htdocs/includes/phpexcel/PHPExcel/Worksheet/Protection.php index e7c3436f179..f41dd53a2a0 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Worksheet/Protection.php +++ b/htdocs/includes/phpexcel/PHPExcel/Worksheet/Protection.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_Protection { diff --git a/htdocs/includes/phpexcel/PHPExcel/Worksheet/Row.php b/htdocs/includes/phpexcel/PHPExcel/Worksheet/Row.php index ba9d8530b48..2e9bd132867 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Worksheet/Row.php +++ b/htdocs/includes/phpexcel/PHPExcel/Worksheet/Row.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -33,7 +33,7 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_Row { diff --git a/htdocs/includes/phpexcel/PHPExcel/Worksheet/RowDimension.php b/htdocs/includes/phpexcel/PHPExcel/Worksheet/RowDimension.php index 7bacabd2378..69b7ba813eb 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Worksheet/RowDimension.php +++ b/htdocs/includes/phpexcel/PHPExcel/Worksheet/RowDimension.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_RowDimension { @@ -195,12 +195,12 @@ class PHPExcel_Worksheet_RowDimension * Value must be between 0 and 7 * * @param int $pValue - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_RowDimension */ public function setOutlineLevel($pValue) { if ($pValue < 0 || $pValue > 7) { - throw new Exception("Outline level must range between 0 and 7."); + throw new PHPExcel_Exception("Outline level must range between 0 and 7."); } $this->_outlineLevel = $pValue; diff --git a/htdocs/includes/phpexcel/PHPExcel/Worksheet/RowIterator.php b/htdocs/includes/phpexcel/PHPExcel/Worksheet/RowIterator.php index c8e832ed72c..f2d962f5741 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Worksheet/RowIterator.php +++ b/htdocs/includes/phpexcel/PHPExcel/Worksheet/RowIterator.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -33,7 +33,7 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_RowIterator implements Iterator { diff --git a/htdocs/includes/phpexcel/PHPExcel/Worksheet/SheetView.php b/htdocs/includes/phpexcel/PHPExcel/Worksheet/SheetView.php index bdaf323b264..05fbf286b06 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Worksheet/SheetView.php +++ b/htdocs/includes/phpexcel/PHPExcel/Worksheet/SheetView.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Worksheet - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_SheetView { @@ -96,7 +96,7 @@ class PHPExcel_Worksheet_SheetView * Valid values range from 10 to 400. * * @param int $pValue - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_SheetView */ public function setZoomScale($pValue = 100) { @@ -105,7 +105,7 @@ class PHPExcel_Worksheet_SheetView if (($pValue >= 1) || is_null($pValue)) { $this->_zoomScale = $pValue; } else { - throw new Exception("Scale must be greater than or equal to 1."); + throw new PHPExcel_Exception("Scale must be greater than or equal to 1."); } return $this; } @@ -125,14 +125,14 @@ class PHPExcel_Worksheet_SheetView * Valid values range from 10 to 400. * * @param int $pValue - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_SheetView */ public function setZoomScaleNormal($pValue = 100) { if (($pValue >= 1) || is_null($pValue)) { $this->_zoomScaleNormal = $pValue; } else { - throw new Exception("Scale must be greater than or equal to 1."); + throw new PHPExcel_Exception("Scale must be greater than or equal to 1."); } return $this; } @@ -155,7 +155,7 @@ class PHPExcel_Worksheet_SheetView * 'pageBreakPreview' self::SHEETVIEW_PAGE_BREAK_PREVIEW * * @param string $pValue - * @throws Exception + * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_SheetView */ public function setView($pValue = NULL) { @@ -166,7 +166,7 @@ class PHPExcel_Worksheet_SheetView if (in_array($pValue, self::$_sheetViewTypes)) { $this->_sheetviewType = $pValue; } else { - throw new Exception("Invalid sheetview layout type."); + throw new PHPExcel_Exception("Invalid sheetview layout type."); } return $this; diff --git a/htdocs/includes/phpexcel/PHPExcel/WorksheetIterator.php b/htdocs/includes/phpexcel/PHPExcel/WorksheetIterator.php index 9eff5382dd9..624b49b6208 100644 --- a/htdocs/includes/phpexcel/PHPExcel/WorksheetIterator.php +++ b/htdocs/includes/phpexcel/PHPExcel/WorksheetIterator.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @version 1.8.0, 2014-03-02 */ @@ -33,45 +33,48 @@ * * @category PHPExcel * @package PHPExcel - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_WorksheetIterator implements Iterator { - /** - * Spreadsheet to iterate - * - * @var PHPExcel - */ - private $_subject; + /** + * Spreadsheet to iterate + * + * @var PHPExcel + */ + private $_subject; - /** - * Current iterator position - * - * @var int - */ - private $_position = 0; + /** + * Current iterator position + * + * @var int + */ + private $_position = 0; - /** - * Create a new worksheet iterator - * - * @param PHPExcel $subject - */ - public function __construct(PHPExcel $subject = null) { - // Set subject - $this->_subject = $subject; - } + /** + * Create a new worksheet iterator + * + * @param PHPExcel $subject + */ + public function __construct(PHPExcel $subject = null) + { + // Set subject + $this->_subject = $subject; + } - /** - * Destructor - */ - public function __destruct() { - unset($this->_subject); - } + /** + * Destructor + */ + public function __destruct() + { + unset($this->_subject); + } - /** - * Rewind iterator - */ - public function rewind() { + /** + * Rewind iterator + */ + public function rewind() + { $this->_position = 0; } @@ -80,8 +83,9 @@ class PHPExcel_WorksheetIterator implements Iterator * * @return PHPExcel_Worksheet */ - public function current() { - return $this->_subject->getSheet($this->_position); + public function current() + { + return $this->_subject->getSheet($this->_position); } /** @@ -89,14 +93,16 @@ class PHPExcel_WorksheetIterator implements Iterator * * @return int */ - public function key() { + public function key() + { return $this->_position; } /** * Next value */ - public function next() { + public function next() + { ++$this->_position; } @@ -105,7 +111,8 @@ class PHPExcel_WorksheetIterator implements Iterator * * @return boolean */ - public function valid() { + public function valid() + { return $this->_position < $this->_subject->getSheetCount(); } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Abstract.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Abstract.php new file mode 100644 index 00000000000..7e09ef83a08 --- /dev/null +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Abstract.php @@ -0,0 +1,158 @@ +_includeCharts; + } + + /** + * Set write charts in workbook + * Set to true, to advise the Writer to include any charts that exist in the PHPExcel object. + * Set to false (the default) to ignore charts. + * + * @param boolean $pValue + * @return PHPExcel_Writer_IWriter + */ + public function setIncludeCharts($pValue = FALSE) { + $this->_includeCharts = (boolean) $pValue; + return $this; + } + + /** + * Get Pre-Calculate Formulas flag + * If this is true (the default), then the writer will recalculate all formulae in a workbook when saving, + * so that the pre-calculated values are immediately available to MS Excel or other office spreadsheet + * viewer when opening the file + * If false, then formulae are not calculated on save. This is faster for saving in PHPExcel, but slower + * when opening the resulting file in MS Excel, because Excel has to recalculate the formulae itself + * + * @return boolean + */ + public function getPreCalculateFormulas() { + return $this->_preCalculateFormulas; + } + + /** + * Set Pre-Calculate Formulas + * Set to true (the default) to advise the Writer to calculate all formulae on save + * Set to false to prevent precalculation of formulae on save. + * + * @param boolean $pValue Pre-Calculate Formulas? + * @return PHPExcel_Writer_IWriter + */ + public function setPreCalculateFormulas($pValue = TRUE) { + $this->_preCalculateFormulas = (boolean) $pValue; + return $this; + } + + /** + * Get use disk caching where possible? + * + * @return boolean + */ + public function getUseDiskCaching() { + return $this->_useDiskCaching; + } + + /** + * Set use disk caching where possible? + * + * @param boolean $pValue + * @param string $pDirectory Disk caching directory + * @throws PHPExcel_Writer_Exception when directory does not exist + * @return PHPExcel_Writer_Excel2007 + */ + public function setUseDiskCaching($pValue = FALSE, $pDirectory = NULL) { + $this->_useDiskCaching = $pValue; + + if ($pDirectory !== NULL) { + if (is_dir($pDirectory)) { + $this->_diskCachingDirectory = $pDirectory; + } else { + throw new PHPExcel_Writer_Exception("Directory does not exist: $pDirectory"); + } + } + return $this; + } + + /** + * Get disk caching directory + * + * @return string + */ + public function getDiskCachingDirectory() { + return $this->_diskCachingDirectory; + } +} diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/CSV.php b/htdocs/includes/phpexcel/PHPExcel/Writer/CSV.php index 11a399e3b22..521874f25ed 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/CSV.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/CSV.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,10 +19,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @package PHPExcel_Writer_CSV + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -30,10 +30,10 @@ * PHPExcel_Writer_CSV * * @category PHPExcel - * @package PHPExcel_Writer - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @package PHPExcel_Writer_CSV + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_CSV implements PHPExcel_Writer_IWriter { +class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter { /** * PHPExcel object * @@ -69,13 +69,6 @@ class PHPExcel_Writer_CSV implements PHPExcel_Writer_IWriter { */ private $_sheetIndex = 0; - /** - * Pre-calculate formulas - * - * @var boolean - */ - private $_preCalculateFormulas = true; - /** * Whether to write a BOM (for UTF8). * @@ -103,36 +96,37 @@ class PHPExcel_Writer_CSV implements PHPExcel_Writer_IWriter { * Save PHPExcel to file * * @param string $pFilename - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function save($pFilename = null) { // Fetch sheet $sheet = $this->_phpExcel->getSheet($this->_sheetIndex); - $saveDebugLog = PHPExcel_Calculation::getInstance()->writeDebugLog; - PHPExcel_Calculation::getInstance()->writeDebugLog = false; + $saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog(); + PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE); $saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); // Open file $fileHandle = fopen($pFilename, 'wb+'); if ($fileHandle === false) { - throw new Exception("Could not open file $pFilename for writing."); + throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing."); } if ($this->_excelCompatibility) { - // Write the UTF-16LE BOM code - fwrite($fileHandle, "\xFF\xFE"); // Excel uses UTF-16LE encoding - $this->setEnclosure(); // Default enclosure is " - $this->setDelimiter("\t"); // Excel delimiter is a TAB + fwrite($fileHandle, "\xEF\xBB\xBF"); // Enforce UTF-8 BOM Header + $this->setEnclosure('"'); // Set enclosure to " + $this->setDelimiter(";"); // Set delimiter to a semi-colon + $this->setLineEnding("\r\n"); + fwrite($fileHandle, 'sep=' . $this->getDelimiter() . $this->_lineEnding); } elseif ($this->_useBOM) { - // Write the UTF-8 BOM code + // Write the UTF-8 BOM code if required fwrite($fileHandle, "\xEF\xBB\xBF"); } // Identify the range that we need to extract from the worksheet - $maxCol = $sheet->getHighestColumn(); - $maxRow = $sheet->getHighestRow(); + $maxCol = $sheet->getHighestDataColumn(); + $maxRow = $sheet->getHighestDataRow(); // Write rows to file for($row = 1; $row <= $maxRow; ++$row) { @@ -146,7 +140,7 @@ class PHPExcel_Writer_CSV implements PHPExcel_Writer_IWriter { fclose($fileHandle); PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType); - PHPExcel_Calculation::getInstance()->writeDebugLog = $saveDebugLog; + PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog); } /** @@ -278,7 +272,7 @@ class PHPExcel_Writer_CSV implements PHPExcel_Writer_IWriter { * * @param mixed $pFileHandle PHP filehandle * @param array $pValues Array containing values in a row - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeLine($pFileHandle = null, $pValues = null) { if (is_array($pValues)) { @@ -307,33 +301,10 @@ class PHPExcel_Writer_CSV implements PHPExcel_Writer_IWriter { $line .= $this->_lineEnding; // Write to file - if ($this->_excelCompatibility) { - fwrite($pFileHandle, mb_convert_encoding($line,"UTF-16LE","UTF-8")); - } else { - fwrite($pFileHandle, $line); - } + fwrite($pFileHandle, $line); } else { - throw new Exception("Invalid data row passed to CSV writer."); + throw new PHPExcel_Writer_Exception("Invalid data row passed to CSV writer."); } } - /** - * Get Pre-Calculate Formulas - * - * @return boolean - */ - public function getPreCalculateFormulas() { - return $this->_preCalculateFormulas; - } - - /** - * Set Pre-Calculate Formulas - * - * @param boolean $pValue Pre-Calculate Formulas? - * @return PHPExcel_Writer_CSV - */ - public function setPreCalculateFormulas($pValue = true) { - $this->_preCalculateFormulas = $pValue; - return $this; - } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007.php index 6a1b9887d52..a8f7593c106 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -30,25 +30,21 @@ * PHPExcel_Writer_Excel2007 * * @category PHPExcel - * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @package PHPExcel_Writer_2007 + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter +class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter { - /** - * Write charts that are defined in the workbook? - * Identifies whether the Writer should write definitions for any charts that exist in the PHPExcel object; - * - * @var boolean - */ - private $_includeCharts = false; - /** * Pre-calculate formulas + * Forces PHPExcel to recalculate all formulae in a workbook when saving, so that the pre-calculated values are + * immediately available to MS Excel or other office spreadsheet viewer when opening the file * + * Overrides the default TRUE for this specific writer for performance reasons + * * @var boolean */ - private $_preCalculateFormulas = true; + protected $_preCalculateFormulas = FALSE; /** * Office2003 compatibility @@ -85,6 +81,13 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter */ private $_stylesConditionalHashTable; + /** + * Private unique PHPExcel_Style HashTable + * + * @var PHPExcel_HashTable + */ + private $_styleHashTable; + /** * Private unique PHPExcel_Style_Fill HashTable * @@ -120,20 +123,6 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter */ private $_drawingHashTable; - /** - * Use disk caching where possible? - * - * @var boolean - */ - private $_useDiskCaching = false; - - /** - * Disk caching directory - * - * @var string - */ - private $_diskCachingDirectory = './'; - /** * Create a new PHPExcel_Writer_Excel2007 * @@ -155,6 +144,8 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter 'drawing' => 'PHPExcel_Writer_Excel2007_Drawing', 'comments' => 'PHPExcel_Writer_Excel2007_Comments', 'chart' => 'PHPExcel_Writer_Excel2007_Chart', + 'relsvba' => 'PHPExcel_Writer_Excel2007_RelsVBA', + 'relsribbonobjects' => 'PHPExcel_Writer_Excel2007_RelsRibbon' ); // Initialise writer parts @@ -164,7 +155,8 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter } $hashTablesArray = array( '_stylesConditionalHashTable', '_fillHashTable', '_fontHashTable', - '_bordersHashTable', '_numFmtHashTable', '_drawingHashTable' + '_bordersHashTable', '_numFmtHashTable', '_drawingHashTable', + '_styleHashTable' ); // Set HashTable variables @@ -191,7 +183,7 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter * Save PHPExcel to file * * @param string $pFilename - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function save($pFilename = null) { @@ -208,8 +200,8 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter } } - $saveDebugLog = PHPExcel_Calculation::getInstance()->writeDebugLog; - PHPExcel_Calculation::getInstance()->writeDebugLog = false; + $saveDebugLog = PHPExcel_Calculation::getInstance($this->_spreadSheet)->getDebugLog()->getWriteDebugLog(); + PHPExcel_Calculation::getInstance($this->_spreadSheet)->getDebugLog()->setWriteDebugLog(FALSE); $saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType(); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); @@ -220,6 +212,7 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter } // Create styles dictionaries + $this->_styleHashTable->addFromSource( $this->getWriterPart('Style')->allStyles($this->_spreadSheet) ); $this->_stylesConditionalHashTable->addFromSource( $this->getWriterPart('Style')->allConditionalStyles($this->_spreadSheet) ); $this->_fillHashTable->addFromSource( $this->getWriterPart('Style')->allFills($this->_spreadSheet) ); $this->_fontHashTable->addFromSource( $this->getWriterPart('Style')->allFonts($this->_spreadSheet) ); @@ -245,13 +238,42 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter // Try opening the ZIP file if ($objZip->open($pFilename, $zipOverWrite) !== true) { if ($objZip->open($pFilename, $zipCreate) !== true) { - throw new Exception("Could not open " . $pFilename . " for writing."); + throw new PHPExcel_Writer_Exception("Could not open " . $pFilename . " for writing."); } } // Add [Content_Types].xml to ZIP file $objZip->addFromString('[Content_Types].xml', $this->getWriterPart('ContentTypes')->writeContentTypes($this->_spreadSheet, $this->_includeCharts)); + //if hasMacros, add the vbaProject.bin file, Certificate file(if exists) + if($this->_spreadSheet->hasMacros()){ + $macrosCode=$this->_spreadSheet->getMacrosCode(); + if(!is_null($macrosCode)){// we have the code ? + $objZip->addFromString('xl/vbaProject.bin', $macrosCode);//allways in 'xl', allways named vbaProject.bin + if($this->_spreadSheet->hasMacrosCertificate()){//signed macros ? + // Yes : add the certificate file and the related rels file + $objZip->addFromString('xl/vbaProjectSignature.bin', $this->_spreadSheet->getMacrosCertificate()); + $objZip->addFromString('xl/_rels/vbaProject.bin.rels', + $this->getWriterPart('RelsVBA')->writeVBARelationships($this->_spreadSheet)); + } + } + } + //a custom UI in this workbook ? add it ("base" xml and additional objects (pictures) and rels) + if($this->_spreadSheet->hasRibbon()){ + $tmpRibbonTarget=$this->_spreadSheet->getRibbonXMLData('target'); + $objZip->addFromString($tmpRibbonTarget, $this->_spreadSheet->getRibbonXMLData('data')); + if($this->_spreadSheet->hasRibbonBinObjects()){ + $tmpRootPath=dirname($tmpRibbonTarget).'/'; + $ribbonBinObjects=$this->_spreadSheet->getRibbonBinObjects('data');//the files to write + foreach($ribbonBinObjects as $aPath=>$aContent){ + $objZip->addFromString($tmpRootPath.$aPath, $aContent); + } + //the rels for files + $objZip->addFromString($tmpRootPath.'_rels/'.basename($tmpRibbonTarget).'.rels', + $this->getWriterPart('RelsRibbonObjects')->writeRibbonRelationships($this->_spreadSheet)); + } + } + // Add relationships to ZIP file $objZip->addFromString('_rels/.rels', $this->getWriterPart('Rels')->writeRelationships($this->_spreadSheet)); $objZip->addFromString('xl/_rels/workbook.xml.rels', $this->getWriterPart('Rels')->writeWorkbookRelationships($this->_spreadSheet)); @@ -342,7 +364,6 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter if ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) { $imageContents = null; $imagePath = $this->getDrawingHashTable()->getByIndex($i)->getPath(); - if (strpos($imagePath, 'zip://') !== false) { $imagePath = substr($imagePath, 6); $imagePathSplitted = explode('#', $imagePath); @@ -371,22 +392,22 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter } PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType); - PHPExcel_Calculation::getInstance()->writeDebugLog = $saveDebugLog; + PHPExcel_Calculation::getInstance($this->_spreadSheet)->getDebugLog()->setWriteDebugLog($saveDebugLog); // Close file if ($objZip->close() === false) { - throw new Exception("Could not close zip file $pFilename."); + throw new PHPExcel_Writer_Exception("Could not close zip file $pFilename."); } // If a temporary file was used, copy it to the correct file stream if ($originalFilename != $pFilename) { if (copy($pFilename, $originalFilename) === false) { - throw new Exception("Could not copy temporary zip file $pFilename to $originalFilename."); + throw new PHPExcel_Writer_Exception("Could not copy temporary zip file $pFilename to $originalFilename."); } @unlink($pFilename); } } else { - throw new Exception("PHPExcel object unassigned."); + throw new PHPExcel_Writer_Exception("PHPExcel object unassigned."); } } @@ -394,13 +415,13 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter * Get PHPExcel object * * @return PHPExcel - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function getPHPExcel() { if ($this->_spreadSheet !== null) { return $this->_spreadSheet; } else { - throw new Exception("No PHPExcel assigned."); + throw new PHPExcel_Writer_Exception("No PHPExcel assigned."); } } @@ -408,7 +429,7 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter * Set PHPExcel object * * @param PHPExcel $pPHPExcel PHPExcel object - * @throws Exception + * @throws PHPExcel_Writer_Exception * @return PHPExcel_Writer_Excel2007 */ public function setPHPExcel(PHPExcel $pPHPExcel = null) { @@ -425,6 +446,15 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter return $this->_stringTable; } + /** + * Get PHPExcel_Style HashTable + * + * @return PHPExcel_HashTable + */ + public function getStyleHashTable() { + return $this->_styleHashTable; + } + /** * Get PHPExcel_Style_Conditional HashTable * @@ -479,49 +509,6 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter return $this->_drawingHashTable; } - /** - * Write charts in workbook? - * If this is true, then the Writer will write definitions for any charts that exist in the PHPExcel object. - * If false (the default) it will ignore any charts defined in the PHPExcel object. - * - * @return boolean - */ - public function getIncludeCharts() { - return $this->_includeCharts; - } - - /** - * Set write charts in workbook - * Set to true, to advise the Writer to include any charts that exist in the PHPExcel object. - * Set to false (the default) to ignore charts. - * - * @param boolean $pValue - * - * @return PHPExcel_Writer_Excel2007 - */ - public function setIncludeCharts($pValue = false) { - $this->_includeCharts = (boolean) $pValue; - return $this; - } - - /** - * Get Pre-Calculate Formulas - * - * @return boolean - */ - public function getPreCalculateFormulas() { - return $this->_preCalculateFormulas; - } - - /** - * Set Pre-Calculate Formulas - * - * @param boolean $pValue Pre-Calculate Formulas? - */ - public function setPreCalculateFormulas($pValue = true) { - $this->_preCalculateFormulas = $pValue; - } - /** * Get Office2003 compatibility * @@ -532,7 +519,7 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter } /** - * Set Pre-Calculate Formulas + * Set Office2003 compatibility * * @param boolean $pValue Office2003 compatibility? * @return PHPExcel_Writer_Excel2007 @@ -542,42 +529,4 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter return $this; } - /** - * Get use disk caching where possible? - * - * @return boolean - */ - public function getUseDiskCaching() { - return $this->_useDiskCaching; - } - - /** - * Set use disk caching where possible? - * - * @param boolean $pValue - * @param string $pDirectory Disk caching directory - * @throws Exception Exception when directory does not exist - * @return PHPExcel_Writer_Excel2007 - */ - public function setUseDiskCaching($pValue = false, $pDirectory = null) { - $this->_useDiskCaching = $pValue; - - if ($pDirectory !== NULL) { - if (is_dir($pDirectory)) { - $this->_diskCachingDirectory = $pDirectory; - } else { - throw new Exception("Directory does not exist: $pDirectory"); - } - } - return $this; - } - - /** - * Get disk caching directory - * - * @return string - */ - public function getDiskCachingDirectory() { - return $this->_diskCachingDirectory; - } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Chart.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Chart.php index d181d517b94..526daa92d94 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Chart.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Chart.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPart { @@ -40,7 +40,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel_Chart $pChart * @return string XML Output - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function writeChart(PHPExcel_Chart $pChart = null) { @@ -120,7 +120,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel_Chart_Title $title * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeTitle(PHPExcel_Chart_Title $title = null, $objWriter) { @@ -164,7 +164,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel_Chart_Legend $legend * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter) { @@ -217,7 +217,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * @param PHPExcel_Chart_Title $xAxisLabel * @param PHPExcel_Chart_Title $yAxisLabel * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writePlotArea(PHPExcel_Chart_PlotArea $plotArea, PHPExcel_Chart_Title $xAxisLabel = NULL, @@ -230,6 +230,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa } $id1 = $id2 = 0; + $this->_seriesIndex = 0; $objWriter->startElement('c:plotArea'); $layout = $plotArea->getLayout(); @@ -298,6 +299,20 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->startElement('c:hiLowLines'); $objWriter->endElement(); + + $objWriter->startElement( 'c:upDownBars' ); + + $objWriter->startElement( 'c:gapWidth' ); + $objWriter->writeAttribute('val', 300); + $objWriter->endElement(); + + $objWriter->startElement( 'c:upBars' ); + $objWriter->endElement(); + + $objWriter->startElement( 'c:downBars' ); + $objWriter->endElement(); + + $objWriter->endElement(); } // Generate 2 unique numbers to use for axId values @@ -355,7 +370,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Chart_Layout $chartLayout Chart layout - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeDataLbls($objWriter, $chartLayout) { @@ -410,7 +425,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * @param string $id1 * @param string $id2 * @param boolean $isMultiLevelSeries - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeCatAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries) { @@ -463,13 +478,13 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->endElement(); $objWriter->endElement(); + $layout = $xAxisLabel->getLayout(); + $this->_writeLayout($layout, $objWriter); + $objWriter->startElement('c:overlay'); $objWriter->writeAttribute('val', 0); $objWriter->endElement(); - $layout = $xAxisLabel->getLayout(); - $this->_writeLayout($layout, $objWriter); - $objWriter->endElement(); } @@ -533,7 +548,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * @param string $id1 * @param string $id2 * @param boolean $isMultiLevelSeries - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeValAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries) { @@ -589,15 +604,15 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->endElement(); $objWriter->endElement(); - $objWriter->startElement('c:overlay'); - $objWriter->writeAttribute('val', 0); - $objWriter->endElement(); - if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) { $layout = $yAxisLabel->getLayout(); $this->_writeLayout($layout, $objWriter); } + $objWriter->startElement('c:overlay'); + $objWriter->writeAttribute('val', 0); + $objWriter->endElement(); + $objWriter->endElement(); } @@ -649,7 +664,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel_Chart_PlotArea $plotArea * @return string|array - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private static function _getChartType($plotArea) { @@ -664,7 +679,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa } $chartType = array_unique($chartTypes); if (count($chartTypes) == 0) { - throw new Exception('Chart is not yet implemented'); + throw new PHPExcel_Writer_Exception('Chart is not yet implemented'); } } @@ -681,7 +696,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * @param boolean &$valIsMultiLevelSeries Is value set a multi-series set * @param string &$plotGroupingType Type of grouping for multi-series values * @param PHPExcel_Worksheet $pSheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writePlotGroup( $plotGroup, $groupType, @@ -737,11 +752,11 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->startElement('c:ser'); $objWriter->startElement('c:idx'); - $objWriter->writeAttribute('val', $plotSeriesIdx); + $objWriter->writeAttribute('val', $this->_seriesIndex + $plotSeriesIdx); $objWriter->endElement(); $objWriter->startElement('c:order'); - $objWriter->writeAttribute('val', $plotSeriesRef); + $objWriter->writeAttribute('val', $this->_seriesIndex + $plotSeriesRef); $objWriter->endElement(); if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || @@ -778,10 +793,15 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa } // Formatting for the points - if ($groupType == PHPExcel_Chart_DataSeries::TYPE_LINECHART) { + if (($groupType == PHPExcel_Chart_DataSeries::TYPE_LINECHART) || + ($groupType == PHPExcel_Chart_DataSeries::TYPE_STOCKCHART)) { $objWriter->startElement('c:spPr'); $objWriter->startElement('a:ln'); $objWriter->writeAttribute('w', 12700); + if ($groupType == PHPExcel_Chart_DataSeries::TYPE_STOCKCHART) { + $objWriter->startElement('a:noFill'); + $objWriter->endElement(); + } $objWriter->endElement(); $objWriter->endElement(); } @@ -865,6 +885,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->endElement(); } + + $this->_seriesIndex += $plotSeriesIdx + 1; } /** @@ -872,7 +894,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel_Chart_DataSeriesValues $plotSeriesLabel * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writePlotSeriesLabel($plotSeriesLabel, $objWriter) { @@ -910,7 +932,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * @param string $groupType Type of plot for dataseries * @param string $dataType Datatype of series values * @param PHPExcel_Worksheet $pSheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writePlotSeriesValues( $plotSeriesValues, $objWriter, @@ -1010,7 +1032,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel_Chart_DataSeriesValues $plotSeriesValues * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeBubbles($plotSeriesValues, $objWriter, PHPExcel_Worksheet $pSheet) { @@ -1056,7 +1078,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel_Chart_Layout $layout * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeLayout(PHPExcel_Chart_Layout $layout = NULL, $objWriter) { @@ -1124,7 +1146,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * Write Alternate Content block * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeAlternateContent($objWriter) { @@ -1153,7 +1175,7 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa * Write Printer Settings * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writePrintSettings($objWriter) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Comments.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Comments.php index ec8a2704258..436219c6e90 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Comments.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Comments.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_WriterPart { @@ -40,7 +40,7 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write * * @param PHPExcel_Worksheet $pWorksheet * @return string XML Output - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function writeComments(PHPExcel_Worksheet $pWorksheet = null) { @@ -98,7 +98,7 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write * @param string $pCellReference Cell reference * @param PHPExcel_Comment $pComment Comment * @param array $pAuthors Array of authors - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function _writeComment(PHPExcel_Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', PHPExcel_Comment $pComment = null, $pAuthors = null) { @@ -120,7 +120,7 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write * * @param PHPExcel_Worksheet $pWorksheet * @return string XML Output - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function writeVMLComments(PHPExcel_Worksheet $pWorksheet = null) { @@ -193,7 +193,7 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param string $pCellReference Cell reference * @param PHPExcel_Comment $pComment Comment - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function _writeVMLComment(PHPExcel_Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', PHPExcel_Comment $pComment = null) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/ContentTypes.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/ContentTypes.php index a6ee53c6d02..3c17a169271 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/ContentTypes.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/ContentTypes.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_WriterPart { @@ -41,7 +41,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W * @param PHPExcel $pPHPExcel * @param boolean $includeCharts Flag indicating if we should include drawing details for charts * @return string XML Output - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function writeContentTypes(PHPExcel $pPHPExcel = null, $includeCharts = FALSE) { @@ -86,9 +86,26 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W ); // Workbook - $this->_writeOverrideContentType( - $objWriter, '/xl/workbook.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml' - ); + if($pPHPExcel->hasMacros()){ //Macros in workbook ? + // Yes : not standard content but "macroEnabled" + $this->_writeOverrideContentType( + $objWriter, '/xl/workbook.xml', 'application/vnd.ms-excel.sheet.macroEnabled.main+xml' + ); + //... and define a new type for the VBA project + $this->_writeDefaultContentType( + $objWriter, 'bin', 'application/vnd.ms-office.vbaProject' + ); + if($pPHPExcel->hasMacrosCertificate()){// signed macros ? + // Yes : add needed information + $this->_writeOverrideContentType( + $objWriter, '/xl/vbaProjectSignature.bin', 'application/vnd.ms-office.vbaProjectSignature' + ); + } + }else{// no macros in workbook, so standard type + $this->_writeOverrideContentType( + $objWriter, '/xl/workbook.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml' + ); + } // DocProps $this->_writeOverrideContentType( @@ -178,7 +195,16 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W ); } } - + if($pPHPExcel->hasRibbonBinObjects()){//Some additional objects in the ribbon ? + //we need to write "Extension" but not already write for media content + $tabRibbonTypes=array_diff($pPHPExcel->getRibbonBinObjects('types'), array_keys($aMediaContentTypes)); + foreach($tabRibbonTypes as $aRibbonType){ + $mimeType='image/.'.$aRibbonType;//we wrote $mimeType like customUI Editor + $this->_writeDefaultContentType( + $objWriter, $aRibbonType, $mimeType + ); + } + } $sheetCount = $pPHPExcel->getSheetCount(); for ($i = 0; $i < $sheetCount; ++$i) { if (count($pPHPExcel->getSheet()->getHeaderFooter()->getImages()) > 0) { @@ -205,7 +231,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W * * @param string $pFile Filename * @return string Mime Type - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _getImageMimeType($pFile = '') { @@ -213,7 +239,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W $image = getimagesize($pFile); return image_type_to_mime_type($image[2]); } else { - throw new Exception("File $pFile does not exist"); + throw new PHPExcel_Writer_Exception("File $pFile does not exist"); } } @@ -223,7 +249,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param string $pPartname Part name * @param string $pContentType Content type - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeDefaultContentType(PHPExcel_Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '') { @@ -234,7 +260,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W $objWriter->writeAttribute('ContentType', $pContentType); $objWriter->endElement(); } else { - throw new Exception("Invalid parameters passed."); + throw new PHPExcel_Writer_Exception("Invalid parameters passed."); } } @@ -244,7 +270,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param string $pPartname Part name * @param string $pContentType Content type - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeOverrideContentType(PHPExcel_Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '') { @@ -255,7 +281,7 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W $objWriter->writeAttribute('ContentType', $pContentType); $objWriter->endElement(); } else { - throw new Exception("Invalid parameters passed."); + throw new PHPExcel_Writer_Exception("Invalid parameters passed."); } } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/DocProps.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/DocProps.php index 84dd06bc1f2..cfc308909f0 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/DocProps.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/DocProps.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_WriterPart { @@ -40,7 +40,7 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write * * @param PHPExcel $pPHPExcel * @return string XML Output - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function writeDocPropsApp(PHPExcel $pPHPExcel = null) { @@ -137,7 +137,7 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write * * @param PHPExcel $pPHPExcel * @return string XML Output - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function writeDocPropsCore(PHPExcel $pPHPExcel = null) { @@ -204,7 +204,7 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write * * @param PHPExcel $pPHPExcel * @return string XML Output - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function writeDocPropsCustom(PHPExcel $pPHPExcel = null) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Drawing.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Drawing.php index 9b618c56301..3c52723a41c 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Drawing.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Drawing.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_WriterPart { @@ -42,7 +42,7 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer * @param int &$chartRef Chart ID * @param boolean $includeCharts Flag indicating if we should include drawing details for charts * @return string XML Output - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function writeDrawings(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = FALSE) { @@ -95,7 +95,7 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Chart $pChart * @param int $pRelationId - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function _writeChart(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Chart $pChart = null, $pRelationId = -1) { @@ -167,7 +167,7 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet_BaseDrawing $pDrawing * @param int $pRelationId - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function _writeDrawing(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet_BaseDrawing $pDrawing = null, $pRelationId = -1) { @@ -375,7 +375,7 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer $objWriter->endElement(); } else { - throw new Exception("Invalid parameters passed."); + throw new PHPExcel_Writer_Exception("Invalid parameters passed."); } } @@ -384,7 +384,7 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer * * @param PHPExcel_Worksheet $pWorksheet * @return string XML Output - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function writeVMLHeaderFooterImages(PHPExcel_Worksheet $pWorksheet = null) { @@ -532,7 +532,7 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param string $pReference Reference * @param PHPExcel_Worksheet_HeaderFooterDrawing $pImage Image - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function _writeVMLHeaderFooterImage(PHPExcel_Shared_XMLWriter $objWriter = null, $pReference = '', PHPExcel_Worksheet_HeaderFooterDrawing $pImage = null) { @@ -574,7 +574,7 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer * * @param PHPExcel $pPHPExcel * @return PHPExcel_Worksheet_Drawing[] All drawings in PHPExcel - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function allDrawings(PHPExcel $pPHPExcel = null) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Rels.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Rels.php index ff550a673db..0bdb667c991 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Rels.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Rels.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPart { @@ -40,7 +40,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar * * @param PHPExcel $pPHPExcel * @return string XML Output - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function writeRelationships(PHPExcel $pPHPExcel = null) { @@ -94,6 +94,15 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument', 'xl/workbook.xml' ); + // a custom UI in workbook ? + if($pPHPExcel->hasRibbon()){ + $this->_writeRelationShip( + $objWriter, + 5, + 'http://schemas.microsoft.com/office/2006/relationships/ui/extensibility', + $pPHPExcel->getRibbonXMLData('target') + ); + } $objWriter->endElement(); @@ -106,7 +115,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar * * @param PHPExcel $pPHPExcel * @return string XML Output - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function writeWorkbookRelationships(PHPExcel $pPHPExcel = null) { @@ -159,6 +168,17 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar 'worksheets/sheet' . ($i + 1) . '.xml' ); } + // Relationships for vbaProject if needed + // id : just after the last sheet + if($pPHPExcel->hasMacros()){ + $this->_writeRelationShip( + $objWriter, + ($i + 1 + 3), + 'http://schemas.microsoft.com/office/2006/relationships/vbaProject', + 'vbaProject.bin' + ); + ++$i;//increment i if needed for an another relation + } $objWriter->endElement(); @@ -177,7 +197,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar * @param int $pWorksheetId * @param boolean $includeCharts Flag indicating if we should write charts * @return string XML Output - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function writeWorksheetRelationships(PHPExcel_Worksheet $pWorksheet = null, $pWorksheetId = 1, $includeCharts = FALSE) { @@ -286,7 +306,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar * @param int &$chartRef Chart ID * @param boolean $includeCharts Flag indicating if we should write charts * @return string XML Output - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function writeDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = FALSE) { @@ -350,7 +370,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar * * @param PHPExcel_Worksheet $pWorksheet * @return string XML Output - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function writeHeaderFooterDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null) { @@ -394,7 +414,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar * @param string $pType Relationship type * @param string $pTarget Relationship target * @param string $pTargetMode Relationship target mode - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeRelationship(PHPExcel_Shared_XMLWriter $objWriter = null, $pId = 1, $pType = '', $pTarget = '', $pTargetMode = '') { @@ -411,7 +431,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar $objWriter->endElement(); } else { - throw new Exception("Invalid parameters passed."); + throw new PHPExcel_Writer_Exception("Invalid parameters passed."); } } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/RelsRibbon.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/RelsRibbon.php new file mode 100644 index 00000000000..f924a1d43d1 --- /dev/null +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/RelsRibbon.php @@ -0,0 +1,77 @@ +getParentWriter()->getUseDiskCaching()) { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0','UTF-8','yes'); + + // Relationships + $objWriter->startElement('Relationships'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); + $localRels=$pPHPExcel->getRibbonBinObjects('names'); + if(is_array($localRels)){ + foreach($localRels as $aId=>$aTarget){ + $objWriter->startElement('Relationship'); + $objWriter->writeAttribute('Id', $aId); + $objWriter->writeAttribute('Type', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image'); + $objWriter->writeAttribute('Target', $aTarget); + $objWriter->endElement();//Relationship + } + } + $objWriter->endElement();//Relationships + + // Return + return $objWriter->getData(); + + } + +} diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/RelsVBA.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/RelsVBA.php new file mode 100644 index 00000000000..aecb0b8da3b --- /dev/null +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/RelsVBA.php @@ -0,0 +1,72 @@ +getParentWriter()->getUseDiskCaching()) { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0','UTF-8','yes'); + + // Relationships + $objWriter->startElement('Relationships'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); + $objWriter->startElement('Relationship'); + $objWriter->writeAttribute('Id', 'rId1'); + $objWriter->writeAttribute('Type', 'http://schemas.microsoft.com/office/2006/relationships/vbaProjectSignature'); + $objWriter->writeAttribute('Target', 'vbaProjectSignature.bin'); + $objWriter->endElement();//Relationship + $objWriter->endElement();//Relationships + + // Return + return $objWriter->getData(); + + } + +} diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/StringTable.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/StringTable.php index e9fb6600cd8..0e8a259b1b9 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/StringTable.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/StringTable.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_WriterPart { @@ -41,7 +41,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr * @param PHPExcel_Worksheet $pSheet Worksheet * @param string[] $pExistingTable Existing table to eventually merge with * @return string[] String table for worksheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function createStringTable($pSheet = null, $pExistingTable = null) { @@ -81,7 +81,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr // Return return $aStringTable; } else { - throw new Exception("Invalid PHPExcel_Worksheet object passed."); + throw new PHPExcel_Writer_Exception("Invalid PHPExcel_Worksheet object passed."); } } @@ -90,7 +90,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr * * @param string[] $pStringTable * @return string XML Output - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function writeStringTable($pStringTable = null) { @@ -135,7 +135,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr // Return return $objWriter->getData(); } else { - throw new Exception("Invalid string table array passed."); + throw new PHPExcel_Writer_Exception("Invalid string table array passed."); } } @@ -145,7 +145,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_RichText $pRichText Rich text * @param string $prefix Optional Namespace prefix - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function writeRichText(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_RichText $pRichText = null, $prefix=NULL) { @@ -227,7 +227,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param string|PHPExcel_RichText $pRichText text string or Rich text * @param string $prefix Optional Namespace prefix - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function writeRichTextForCharts(PHPExcel_Shared_XMLWriter $objWriter = null, $pRichText = null, $prefix=NULL) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Style.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Style.php index b24deba9a67..849ad127f58 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Style.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Style.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPart { @@ -40,7 +40,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel $pPHPExcel * @return string XML Output - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function writeStyles(PHPExcel $pPHPExcel = null) { @@ -170,7 +170,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Style_Fill $pFill Fill style - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null) { @@ -190,7 +190,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Style_Fill $pFill Fill style - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeGradientFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null) { @@ -234,7 +234,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Style_Fill $pFill Fill style - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writePatternFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null) { @@ -272,7 +272,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Style_Font $pFont Font style - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeFont(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Font $pFont = null) { @@ -352,7 +352,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Style_Borders $pBorders Borders style - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeBorder(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Borders $pBorders = null) { @@ -389,7 +389,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Style $pStyle Style * @param PHPExcel $pPHPExcel Workbook - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeCellStyleXf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null, PHPExcel $pPHPExcel = null) { @@ -397,6 +397,9 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa $objWriter->startElement('xf'); $objWriter->writeAttribute('xfId', 0); $objWriter->writeAttribute('fontId', (int)$this->getParentWriter()->getFontHashTable()->getIndexForHashCode($pStyle->getFont()->getHashCode())); + if ($pStyle->getQuotePrefix()) { + $objWriter->writeAttribute('quotePrefix', 1); + } if ($pStyle->getNumberFormat()->getBuiltInFormatCode() === false) { $objWriter->writeAttribute('numFmtId', (int)($this->getParentWriter()->getNumFmtHashTable()->getIndexForHashCode($pStyle->getNumberFormat()->getHashCode()) + 164) ); @@ -458,7 +461,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Style $pStyle Style - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeCellStyleDxf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null) { @@ -524,7 +527,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param string $pName Element name * @param PHPExcel_Style_Border $pBorder Border style - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeBorderPr(PHPExcel_Shared_XMLWriter $objWriter = null, $pName = 'left', PHPExcel_Style_Border $pBorder = null) { @@ -548,7 +551,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Style_NumberFormat $pNumberFormat Number Format * @param int $pId Number Format identifier - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeNumFmt(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_NumberFormat $pNumberFormat = null, $pId = 0) { @@ -569,7 +572,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel $pPHPExcel * @return PHPExcel_Style[] All styles in PHPExcel - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function allStyles(PHPExcel $pPHPExcel = null) { @@ -583,7 +586,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel $pPHPExcel * @return PHPExcel_Style_Conditional[] All conditional styles in PHPExcel - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function allConditionalStyles(PHPExcel $pPHPExcel = null) { @@ -607,7 +610,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel $pPHPExcel * @return PHPExcel_Style_Fill[] All fills in PHPExcel - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function allFills(PHPExcel $pPHPExcel = null) { @@ -638,7 +641,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel $pPHPExcel * @return PHPExcel_Style_Font[] All fonts in PHPExcel - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function allFonts(PHPExcel $pPHPExcel = null) { @@ -660,7 +663,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel $pPHPExcel * @return PHPExcel_Style_Borders[] All borders in PHPExcel - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function allBorders(PHPExcel $pPHPExcel = null) { @@ -682,7 +685,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel $pPHPExcel * @return PHPExcel_Style_NumberFormat[] All number formats in PHPExcel - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function allNumberFormats(PHPExcel $pPHPExcel = null) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Theme.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Theme.php index e067efe357e..064c3edcb7a 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Theme.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Theme.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,18 +20,18 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ /** - * PHPExcel_Writer_Excel2007_DocProps + * PHPExcel_Writer_Excel2007_Theme * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPart { @@ -134,7 +134,7 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel $pPHPExcel * @return string XML Output - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function writeTheme(PHPExcel $pPHPExcel = null) { @@ -820,7 +820,7 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa * @param string $latinFont * @param array of string $fontSet * @return string XML Output - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeFonts($objWriter, $latinFont, $fontSet) { @@ -853,7 +853,7 @@ class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPa * * @param PHPExcel_Shared_XMLWriter $objWriter * @return string XML Output - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeColourScheme($objWriter) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Workbook.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Workbook.php index bbd2f927e9e..d1fe666e84f 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Workbook.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Workbook.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_WriterPart { @@ -41,7 +41,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write * @param PHPExcel $pPHPExcel * @param boolean $recalcRequired Indicate whether formulas should be recalculated before writing * @return string XML Output - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function writeWorkbook(PHPExcel $pPHPExcel = null, $recalcRequired = FALSE) { @@ -95,7 +95,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write * Write file version * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeFileVersion(PHPExcel_Shared_XMLWriter $objWriter = null) { @@ -111,7 +111,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write * Write WorkbookPr * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeWorkbookPr(PHPExcel_Shared_XMLWriter $objWriter = null) { @@ -131,7 +131,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel $pPHPExcel - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeBookViews(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null) { @@ -161,7 +161,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel $pPHPExcel - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeWorkbookProtection(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null) { @@ -188,16 +188,20 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param boolean $recalcRequired Indicate whether formulas should be recalculated before writing - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeCalcPr(PHPExcel_Shared_XMLWriter $objWriter = null, $recalcRequired = TRUE) { $objWriter->startElement('calcPr'); - $objWriter->writeAttribute('calcId', '124519'); + // Set the calcid to a higher value than Excel itself will use, otherwise Excel will always recalc + // If MS Excel does do a recalc, then users opening a file in MS Excel will be prompted to save on exit + // because the file has changed + $objWriter->writeAttribute('calcId', '999999'); $objWriter->writeAttribute('calcMode', 'auto'); // fullCalcOnLoad isn't needed if we've recalculating for the save - $objWriter->writeAttribute('fullCalcOnLoad', ($recalcRequired) ? '0' : '1'); + $objWriter->writeAttribute('calcCompleted', ($recalcRequired) ? 1 : 0); + $objWriter->writeAttribute('fullCalcOnLoad', ($recalcRequired) ? 0 : 1); $objWriter->endElement(); } @@ -207,7 +211,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel $pPHPExcel - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeSheets(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null) { @@ -236,7 +240,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write * @param int $pSheetId Sheet id * @param int $pRelId Relationship ID * @param string $sheetState Sheet state (visible, hidden, veryHidden) - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeSheet(PHPExcel_Shared_XMLWriter $objWriter = null, $pSheetname = '', $pSheetId = 1, $pRelId = 1, $sheetState = 'visible') { @@ -251,7 +255,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write $objWriter->writeAttribute('r:id', 'rId' . $pRelId); $objWriter->endElement(); } else { - throw new Exception("Invalid parameters passed."); + throw new PHPExcel_Writer_Exception("Invalid parameters passed."); } } @@ -260,7 +264,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel $pPHPExcel - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeDefinedNames(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null) { @@ -294,7 +298,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel $pPHPExcel - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeNamedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel) { @@ -310,7 +314,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_NamedRange $pNamedRange - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeDefinedNameForNamedRange(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_NamedRange $pNamedRange) { @@ -342,7 +346,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet * @param int $pSheetId - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeDefinedNameForAutofilter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0) { @@ -378,7 +382,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet * @param int $pSheetId - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeDefinedNameForPrintTitles(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0) { @@ -421,7 +425,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet * @param int $pSheetId - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeDefinedNameForPrintArea(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Worksheet.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Worksheet.php index f720af338bf..7d93f5a4e00 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Worksheet.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/Worksheet.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_WriterPart { @@ -42,7 +42,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * @param string[] $pStringTable * @param boolean $includeCharts Flag indicating if we should write charts * @return string XML Output - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function writeWorksheet($pSheet = null, $pStringTable = null, $includeCharts = FALSE) { @@ -132,7 +132,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ // Return return $objWriter->getData(); } else { - throw new Exception("Invalid PHPExcel_Worksheet object passed."); + throw new PHPExcel_Writer_Exception("Invalid PHPExcel_Worksheet object passed."); } } @@ -141,13 +141,19 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeSheetPr(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { // sheetPr $objWriter->startElement('sheetPr'); //$objWriter->writeAttribute('codeName', $pSheet->getTitle()); + if($pSheet->getParent()->hasMacros()){//if the workbook have macros, we need to have codeName for the sheet + if($pSheet->hasCodeName()==false){ + $pSheet->setCodeName($pSheet->getTitle()); + } + $objWriter->writeAttribute('codeName', $pSheet->getCodeName()); + } $autoFilterRange = $pSheet->getAutoFilter()->getRange(); if (!empty($autoFilterRange)) { $objWriter->writeAttribute('filterMode', 1); @@ -182,7 +188,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeDimension(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { @@ -197,7 +203,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeSheetViews(PHPExcel_Shared_XMLWriter $objWriter = NULL, PHPExcel_Worksheet $pSheet = NULL) { @@ -304,7 +310,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeSheetFormatPr(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { @@ -356,7 +362,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeCols(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { @@ -421,7 +427,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeSheetProtection(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { @@ -456,7 +462,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeConditionalFormatting(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { @@ -531,7 +537,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeDataValidations(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { @@ -597,7 +603,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeHyperlinks(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { @@ -638,7 +644,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeProtectedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { @@ -652,7 +658,9 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->startElement('protectedRange'); $objWriter->writeAttribute('name', 'p' . md5($protectedCell)); $objWriter->writeAttribute('sqref', $protectedCell); - $objWriter->writeAttribute('password', $passwordHash); + if (!empty($passwordHash)) { + $objWriter->writeAttribute('password', $passwordHash); + } $objWriter->endElement(); } @@ -665,7 +673,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeMergeCells(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { @@ -690,7 +698,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writePrintOptions(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { @@ -716,7 +724,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writePageMargins(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { @@ -736,7 +744,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeAutoFilter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { @@ -828,7 +836,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writePageSetup(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { @@ -863,7 +871,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeHeaderFooter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { @@ -888,7 +896,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeBreaks(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { @@ -946,7 +954,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet Worksheet * @param string[] $pStringTable String table - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeSheetData(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pStringTable = null) { @@ -1031,7 +1039,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->endElement(); } else { - throw new Exception("Invalid parameters passed."); + throw new PHPExcel_Writer_Exception("Invalid parameters passed."); } } @@ -1043,7 +1051,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * @param PHPExcel_Cell $pCellAddress Cell Address * @param string[] $pStringTable String table * @param string[] $pFlippedStringTable String table (flipped), for faster index searching - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeCell(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pCellAddress = null, $pStringTable = null, $pFlippedStringTable = null) { @@ -1072,12 +1080,9 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->writeAttribute('t', $mappedType); break; case 'f': // Formula - $calculatedValue = null; - if ($this->getParentWriter()->getPreCalculateFormulas()) { - $calculatedValue = $pCell->getCalculatedValue(); - } else { - $calculatedValue = $cellValue; - } + $calculatedValue = ($this->getParentWriter()->getPreCalculateFormulas()) ? + $pCell->getCalculatedValue() : + $cellValue; if (is_string($calculatedValue)) { $objWriter->writeAttribute('t', 'str'); } @@ -1123,7 +1128,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ } if ($this->getParentWriter()->getOffice2003Compatibility() === false) { if ($this->getParentWriter()->getPreCalculateFormulas()) { - $calculatedValue = $pCell->getCalculatedValue(); +// $calculatedValue = $pCell->getCalculatedValue(); if (!is_array($calculatedValue) && substr($calculatedValue, 0, 1) != '#') { $objWriter->writeElement('v', PHPExcel_Shared_String::FormatNumber($calculatedValue)); } else { @@ -1155,7 +1160,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ $objWriter->endElement(); } else { - throw new Exception("Invalid parameters passed."); + throw new PHPExcel_Writer_Exception("Invalid parameters passed."); } } @@ -1165,7 +1170,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet Worksheet * @param boolean $includeCharts Flag indicating if we should include drawing details for charts - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeDrawings(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $includeCharts = FALSE) { @@ -1184,7 +1189,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeLegacyDrawing(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { @@ -1201,7 +1206,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Worksheet $pSheet Worksheet - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _writeLegacyDrawingHF(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/WriterPart.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/WriterPart.php index 3f5069182e2..982117bcf6f 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/WriterPart.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel2007/WriterPart.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel2007 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ abstract class PHPExcel_Writer_Excel2007_WriterPart { @@ -46,7 +46,7 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart * Set parent IWriter object * * @param PHPExcel_Writer_IWriter $pWriter - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function setParentWriter(PHPExcel_Writer_IWriter $pWriter = null) { $this->_parentWriter = $pWriter; @@ -56,13 +56,13 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart * Get parent IWriter object * * @return PHPExcel_Writer_IWriter - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function getParentWriter() { if (!is_null($this->_parentWriter)) { return $this->_parentWriter; } else { - throw new Exception("No parent PHPExcel_Writer_IWriter assigned."); + throw new PHPExcel_Writer_Exception("No parent PHPExcel_Writer_IWriter assigned."); } } @@ -70,7 +70,7 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart * Set parent IWriter object * * @param PHPExcel_Writer_IWriter $pWriter - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function __construct(PHPExcel_Writer_IWriter $pWriter = null) { if (!is_null($pWriter)) { diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5.php index 9297c78baed..3f816fa1f87 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel5 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,17 +31,10 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel5 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_Excel5 implements PHPExcel_Writer_IWriter +class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter { - /** - * Pre-calculate formulas - * - * @var boolean - */ - private $_preCalculateFormulas = true; - /** * PHPExcel object * @@ -120,15 +113,15 @@ class PHPExcel_Writer_Excel5 implements PHPExcel_Writer_IWriter * Save PHPExcel to file * * @param string $pFilename - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function save($pFilename = null) { // garbage collect $this->_phpExcel->garbageCollect(); - $saveDebugLog = PHPExcel_Calculation::getInstance()->writeDebugLog; - PHPExcel_Calculation::getInstance()->writeDebugLog = false; + $saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog(); + PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE); $saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType(); PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL); @@ -196,7 +189,7 @@ class PHPExcel_Writer_Excel5 implements PHPExcel_Writer_IWriter } // add binary data for global workbook stream - $OLE->append( $this->_writerWorkbook->writeWorkbook($worksheetSizes) ); + $OLE->append($this->_writerWorkbook->writeWorkbook($worksheetSizes)); // add binary data for sheet streams for ($i = 0; $i < $countSheets; ++$i) { @@ -233,7 +226,7 @@ class PHPExcel_Writer_Excel5 implements PHPExcel_Writer_IWriter $res = $root->save($pFilename); PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType); - PHPExcel_Calculation::getInstance()->writeDebugLog = $saveDebugLog; + PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog); } /** @@ -241,31 +234,13 @@ class PHPExcel_Writer_Excel5 implements PHPExcel_Writer_IWriter * * @deprecated * @param string $pValue Temporary storage directory - * @throws Exception Exception when directory does not exist + * @throws PHPExcel_Writer_Exception when directory does not exist * @return PHPExcel_Writer_Excel5 */ public function setTempDir($pValue = '') { return $this; } - /** - * Get Pre-Calculate Formulas - * - * @return boolean - */ - public function getPreCalculateFormulas() { - return $this->_preCalculateFormulas; - } - - /** - * Set Pre-Calculate Formulas - * - * @param boolean $pValue Pre-Calculate Formulas? - */ - public function setPreCalculateFormulas($pValue = true) { - $this->_preCalculateFormulas = $pValue; - } - /** * Build the Worksheet Escher objects * @@ -621,7 +596,6 @@ class PHPExcel_Writer_Excel5 implements PHPExcel_Writer_IWriter // GKPIDDSI_CATEGORY : Category if($this->_phpExcel->getProperties()->getCategory()){ $dataProp = $this->_phpExcel->getProperties()->getCategory(); - $dataProp = 'Test result file'; $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02), 'offset' => array('pack' => 'V'), 'type' => array('pack' => 'V', 'data' => 0x1E), @@ -958,4 +932,4 @@ class PHPExcel_Writer_Excel5 implements PHPExcel_Writer_IWriter return $data; } -} \ No newline at end of file +} diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/BIFFwriter.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/BIFFwriter.php index b6782255047..b3e48bc33d5 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/BIFFwriter.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/BIFFwriter.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel5 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ // Original file header of PEAR::Spreadsheet_Excel_Writer_BIFFwriter (used as the base for this class): @@ -65,7 +65,7 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel5 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Writer_Excel5_BIFFwriter { @@ -122,7 +122,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter $byte_order = 1; // Big Endian } else { // Give up. I'll fix this in a later version. - throw new Exception("Required floating point format not supported on this platform."); + throw new PHPExcel_Writer_Exception("Required floating point format not supported on this platform."); } self::$_byte_order = $byte_order; } diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Escher.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Escher.php index 94b769ab92b..7e9b73a3d1b 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Escher.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Escher.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel5 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel5 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Writer_Excel5_Escher { diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Font.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Font.php index f67dd11f048..f2dbab2015b 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Font.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Font.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel5 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -31,7 +31,7 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel5 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Writer_Excel5_Font { diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Parser.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Parser.php index 88b777e0032..04e674a21a2 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Parser.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Parser.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel5 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ // Original file header of PEAR::Spreadsheet_Excel_Writer_Parser (used as the base for this class): @@ -55,7 +55,7 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel5 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Writer_Excel5_Parser { @@ -564,7 +564,7 @@ class PHPExcel_Writer_Excel5_Parser } // TODO: use real error codes - throw new Exception("Unknown token $token"); + throw new PHPExcel_Writer_Exception("Unknown token $token"); } /** @@ -598,7 +598,7 @@ class PHPExcel_Writer_Excel5_Parser // chop away beggining and ending quotes $string = substr($string, 1, strlen($string) - 2); if (strlen($string) > 255) { - throw new Exception("String is too long"); + throw new PHPExcel_Writer_Exception("String is too long"); } return pack('C', $this->ptg['ptgStr']) . PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($string); @@ -644,7 +644,7 @@ class PHPExcel_Writer_Excel5_Parser list($cell1, $cell2) = explode(':', $range); } else { // TODO: use real error codes - throw new Exception("Unknown range separator"); + throw new PHPExcel_Writer_Exception("Unknown range separator"); } // Convert the cell references @@ -660,7 +660,7 @@ class PHPExcel_Writer_Excel5_Parser $ptgArea = pack("C", $this->ptg['ptgAreaA']); } else { // TODO: use real error codes - throw new Exception("Unknown class $class"); + throw new PHPExcel_Writer_Exception("Unknown class $class"); } return $ptgArea . $row1 . $row2 . $col1. $col2; } @@ -702,7 +702,7 @@ class PHPExcel_Writer_Excel5_Parser // } elseif ($class == 2) { // $ptgArea = pack("C", $this->ptg['ptgArea3dA']); // } else { -// throw new Exception("Unknown class $class"); +// throw new PHPExcel_Writer_Exception("Unknown class $class"); // } return $ptgArea . $ext_ref . $row1 . $row2 . $col1. $col2; @@ -732,7 +732,7 @@ class PHPExcel_Writer_Excel5_Parser $ptgRef = pack("C", $this->ptg['ptgRefA']); // } else { // // TODO: use real error codes -// throw new Exception("Unknown class $class"); +// throw new PHPExcel_Writer_Exception("Unknown class $class"); // } return $ptgRef.$row.$col; } @@ -766,7 +766,7 @@ class PHPExcel_Writer_Excel5_Parser // } elseif ($class == 2) { $ptgRef = pack("C", $this->ptg['ptgRef3dA']); // } else { -// throw new Exception("Unknown class $class"); +// throw new PHPExcel_Writer_Exception("Unknown class $class"); // } return $ptgRef . $ext_ref. $row . $col; @@ -812,11 +812,11 @@ class PHPExcel_Writer_Excel5_Parser $sheet1 = $this->_getSheetIndex($sheet_name1); if ($sheet1 == -1) { - throw new Exception("Unknown sheet name $sheet_name1 in formula"); + throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name1 in formula"); } $sheet2 = $this->_getSheetIndex($sheet_name2); if ($sheet2 == -1) { - throw new Exception("Unknown sheet name $sheet_name2 in formula"); + throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name2 in formula"); } // Reverse max and min sheet numbers if necessary @@ -826,7 +826,7 @@ class PHPExcel_Writer_Excel5_Parser } else { // Single sheet name only. $sheet1 = $this->_getSheetIndex($ext_ref); if ($sheet1 == -1) { - throw new Exception("Unknown sheet name $ext_ref in formula"); + throw new PHPExcel_Writer_Exception("Unknown sheet name $ext_ref in formula"); } $sheet2 = $sheet1; } @@ -858,11 +858,11 @@ class PHPExcel_Writer_Excel5_Parser $sheet1 = $this->_getSheetIndex($sheet_name1); if ($sheet1 == -1) { - throw new Exception("Unknown sheet name $sheet_name1 in formula"); + throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name1 in formula"); } $sheet2 = $this->_getSheetIndex($sheet_name2); if ($sheet2 == -1) { - throw new Exception("Unknown sheet name $sheet_name2 in formula"); + throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name2 in formula"); } // Reverse max and min sheet numbers if necessary @@ -872,7 +872,7 @@ class PHPExcel_Writer_Excel5_Parser } else { // Single sheet name only. $sheet1 = $this->_getSheetIndex($ext_ref); if ($sheet1 == -1) { - throw new Exception("Unknown sheet name $ext_ref in formula"); + throw new PHPExcel_Writer_Exception("Unknown sheet name $ext_ref in formula"); } $sheet2 = $sheet1; } @@ -942,11 +942,10 @@ class PHPExcel_Writer_Excel5_Parser $cell = strtoupper($cell); list($row, $col, $row_rel, $col_rel) = $this->_cellToRowcol($cell); if ($col >= 256) { - throw new Exception("Column in: $cell greater than 255"); + throw new PHPExcel_Writer_Exception("Column in: $cell greater than 255"); } - // FIXME: change for BIFF8 - if ($row >= 16384) { - throw new Exception("Row in: $cell greater than 16384 "); + if ($row >= 65536) { + throw new PHPExcel_Writer_Exception("Row in: $cell greater than 65536 "); } // Set the high bits to indicate if row or col are relative. @@ -980,11 +979,11 @@ class PHPExcel_Writer_Excel5_Parser --$row2; // Trick poor inocent Excel $col1 = 0; - $col2 = 16383; // FIXME: maximum possible value for Excel 5 (change this!!!) + $col2 = 65535; // FIXME: maximum possible value for Excel 5 (change this!!!) // FIXME: this changes for BIFF8 - if (($row1 >= 16384) or ($row2 >= 16384)) { - throw new Exception("Row in: $range greater than 16384 "); + if (($row1 >= 65536) or ($row2 >= 65536)) { + throw new PHPExcel_Writer_Exception("Row in: $range greater than 65536 "); } // Set the high bits to indicate if rows are relative. @@ -1373,7 +1372,7 @@ class PHPExcel_Writer_Excel5_Parser $this->_advance(); // eat the "(" $result = $this->_parenthesizedExpression(); if ($this->_current_token != ")") { - throw new Exception("')' token expected."); + throw new PHPExcel_Writer_Exception("')' token expected."); } $this->_advance(); // eat the ")" return $result; @@ -1443,7 +1442,7 @@ class PHPExcel_Writer_Excel5_Parser $result = $this->_func(); return $result; } - throw new Exception("Syntax error: ".$this->_current_token. + throw new PHPExcel_Writer_Exception("Syntax error: ".$this->_current_token. ", lookahead: ".$this->_lookahead. ", current char: ".$this->_current_char); } @@ -1470,7 +1469,7 @@ class PHPExcel_Writer_Excel5_Parser { $this->_advance(); // eat the "," or ";" } else { - throw new Exception("Syntax error: comma expected in ". + throw new PHPExcel_Writer_Exception("Syntax error: comma expected in ". "function $function, arg #{$num_args}"); } $result2 = $this->_condition(); @@ -1482,12 +1481,12 @@ class PHPExcel_Writer_Excel5_Parser ++$num_args; } if (!isset($this->_functions[$function])) { - throw new Exception("Function $function() doesn't exist"); + throw new PHPExcel_Writer_Exception("Function $function() doesn't exist"); } $args = $this->_functions[$function][1]; // If fixed number of args eg. TIME($i,$j,$k). Check that the number of args is valid. if (($args >= 0) and ($args != $num_args)) { - throw new Exception("Incorrect number of arguments in function $function() "); + throw new PHPExcel_Writer_Exception("Incorrect number of arguments in function $function() "); } $result = $this->_createTree($function, $result, $num_args); diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Workbook.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Workbook.php index 2e177ceff90..e14bcba4d37 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Workbook.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Workbook.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel5 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ // Original file header of PEAR::Spreadsheet_Excel_Writer_Workbook (used as the base for this class): @@ -66,7 +66,7 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel5 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter { @@ -317,6 +317,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter } return $fontIndex; } + /** * Alter color palette adding a custom color * @@ -629,7 +630,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter $rowmax = $repeat[1] - 1; } else { $rowmin = 0; - $rowmax = 16383; + $rowmax = 65535; } $this->_writeNameShort( @@ -687,7 +688,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter } $chunk .= $this->writeData($this->_writeDefinedNameBiff8($namedRange->getName(), $formulaData, $scope, false)); - } catch(Exception $e) { + } catch(PHPExcel_Exception $e) { // do nothing } } @@ -835,10 +836,10 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter /** * Write a short NAME record * - * @param string $name - * @param string $sheetIndex 1-based sheet index the defined name applies to. 0 = global - * @param int[][] $range rangeboundaries - * @param bool $isHidden + * @param string $name + * @param string $sheetIndex 1-based sheet index the defined name applies to. 0 = global + * @param integer[][] $rangeBounds range boundaries + * @param boolean $isHidden * @return string Complete binary record data * */ private function _writeShortNameBiff8($name, $sheetIndex = 0, $rangeBounds, $isHidden = false){ @@ -1446,5 +1447,4 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter { $this->_escher = $pValue; } - } diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Worksheet.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Worksheet.php index 9aa5083d915..55da26f3282 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Worksheet.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Worksheet.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel5 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ // Original file header of PEAR::Spreadsheet_Excel_Writer_Worksheet (used as the base for this class): @@ -66,7 +66,7 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel5 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter { @@ -424,7 +424,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter if ($cVal instanceof PHPExcel_RichText) { // $this->_writeString($row, $column, $cVal->getPlainText(), $xfIndex); $arrcRun = array(); - $str_len = strlen($cVal->getPlainText()); + $str_len = PHPExcel_Shared_String::CountCharacters($cVal->getPlainText(), 'UTF-8'); $str_pos = 0; $elements = $cVal->getRichTextElements(); foreach ($elements as $element) { @@ -437,7 +437,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter } $arrcRun[] = array('strlen' => $str_pos, 'fontidx' => $str_fontidx); // Position FROM - $str_pos += strlen($element->getText()); + $str_pos += PHPExcel_Shared_String::CountCharacters($element->getText(), 'UTF-8'); } $this->_writeRichTextString($row, $column, $cVal->getPlainText(), $xfIndex, $arrcRun); } else { @@ -476,12 +476,22 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Append $this->_writeMsoDrawing(); + // Write WINDOW2 record $this->_writeWindow2(); + + // Write PLV record + $this->_writePageLayoutView(); + + // Write ZOOM record $this->_writeZoom(); if ($_phpSheet->getFreezePane()) { $this->_writePanes(); } + + // Write SELECTION record $this->_writeSelection(); + + // Write MergedCellsTable Record $this->_writeMergedCells(); // Hyperlinks @@ -508,9 +518,32 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $this->_writeDataValidity(); $this->_writeSheetLayout(); + + // Write SHEETPROTECTION record $this->_writeSheetProtection(); $this->_writeRangeProtection(); + $arrConditionalStyles = $_phpSheet->getConditionalStylesCollection(); + if(!empty($arrConditionalStyles)){ + $arrConditional = array(); + // @todo CFRule & CFHeader + // Write CFHEADER record + $this->_writeCFHeader(); + // Write ConditionalFormattingTable records + foreach ($arrConditionalStyles as $cellCoordinate => $conditionalStyles) { + foreach ($conditionalStyles as $conditional) { + if($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION + || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS){ + if(!in_array($conditional->getHashCode(), $arrConditional)){ + $arrConditional[] = $conditional->getHashCode(); + // Write CFRULE record + $this->_writeCFRule($conditional); + } + } + } + } + } + $this->_storeEof(); } @@ -642,6 +675,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter { $this->_writeLabelSst($row, $col, $str, $xfIndex); } + /** * Write a LABELSST record or a LABEL record. Which one depends on BIFF version * It differs from _writeString by the writing of rich text strings. @@ -654,7 +688,6 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter private function _writeRichTextString($row, $col, $str, $xfIndex, $arrcRun){ $record = 0x00FD; // Record identifier $length = 0x000A; // Bytes to follow - $str = PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($str, $arrcRun); /* check if string is already present */ @@ -901,7 +934,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter return 0; - } catch (Exception $e) { + } catch (PHPExcel_Exception $e) { // do nothing } @@ -1276,26 +1309,29 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // no support in PHPExcel for selected sheet, therefore sheet is only selected if it is the active sheet $fSelected = ($this->_phpSheet === $this->_phpSheet->getParent()->getActiveSheet()) ? 1 : 0; $fPaged = 1; // 2 + $fPageBreakPreview = $this->_phpSheet->getSheetView()->getView() === PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW; $grbit = $fDspFmla; $grbit |= $fDspGrid << 1; - $grbit |= $fDspRwCol << 2; - $grbit |= $fFrozen << 3; - $grbit |= $fDspZeros << 4; - $grbit |= $fDefaultHdr << 5; - $grbit |= $fArabic << 6; + $grbit |= $fDspRwCol << 2; + $grbit |= $fFrozen << 3; + $grbit |= $fDspZeros << 4; + $grbit |= $fDefaultHdr << 5; + $grbit |= $fArabic << 6; $grbit |= $fDspGuts << 7; $grbit |= $fFrozenNoSplit << 8; - $grbit |= $fSelected << 9; - $grbit |= $fPaged << 10; + $grbit |= $fSelected << 9; + $grbit |= $fPaged << 10; + $grbit |= $fPageBreakPreview << 11; $header = pack("vv", $record, $length); $data = pack("vvv", $grbit, $rwTop, $colLeft); // FIXME !!! $rgbHdr = 0x0040; // Row/column heading and gridline color index - $zoom_factor_page_break = 0x0000; - $zoom_factor_normal = 0x0000; + $zoom_factor_page_break = ($fPageBreakPreview? $this->_phpSheet->getSheetView()->getZoomScale() : 0x0000); + $zoom_factor_normal = $this->_phpSheet->getSheetView()->getZoomScaleNormal(); + $data .= pack("vvvvV", $rgbHdr, 0x0000, $zoom_factor_page_break, $zoom_factor_normal, 0x00000000); $this->_append($header.$data); @@ -2238,10 +2274,10 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $record = 0x0012; // Record identifier $length = 0x0002; // Bytes to follow - $fLock = 1; // Worksheet is protected + $fLock = 1; // Worksheet is protected $header = pack("vv", $record, $length); - $data = pack("v", $fLock); + $data = pack("v", $fLock); $this->_append($header.$data); } @@ -2579,7 +2615,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Open file. $bmp_fd = @fopen($bitmap,"rb"); if (!$bmp_fd) { - throw new Exception("Couldn't import $bitmap"); + throw new PHPExcel_Writer_Exception("Couldn't import $bitmap"); } // Slurp the file into a string. @@ -2587,13 +2623,13 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter // Check that the file is big enough to be a bitmap. if (strlen($data) <= 0x36) { - throw new Exception("$bitmap doesn't contain enough data.\n"); + throw new PHPExcel_Writer_Exception("$bitmap doesn't contain enough data.\n"); } // The first 2 bytes are used to identify the bitmap. $identity = unpack("A2ident", $data); if ($identity['ident'] != "BM") { - throw new Exception("$bitmap doesn't appear to be a valid bitmap image.\n"); + throw new PHPExcel_Writer_Exception("$bitmap doesn't appear to be a valid bitmap image.\n"); } // Remove bitmap data: ID. @@ -2617,20 +2653,20 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $height = $width_and_height[2]; $data = substr($data, 8); if ($width > 0xFFFF) { - throw new Exception("$bitmap: largest image width supported is 65k.\n"); + throw new PHPExcel_Writer_Exception("$bitmap: largest image width supported is 65k.\n"); } if ($height > 0xFFFF) { - throw new Exception("$bitmap: largest image height supported is 65k.\n"); + throw new PHPExcel_Writer_Exception("$bitmap: largest image height supported is 65k.\n"); } // Read and remove the bitmap planes and bpp data. Verify them. $planes_and_bitcount = unpack("v2", substr($data, 0, 4)); $data = substr($data, 4); if ($planes_and_bitcount[2] != 24) { // Bitcount - throw new Exception("$bitmap isn't a 24bit true color bitmap.\n"); + throw new PHPExcel_Writer_Exception("$bitmap isn't a 24bit true color bitmap.\n"); } if ($planes_and_bitcount[1] != 1) { - throw new Exception("$bitmap: only 1 plane supported in bitmap image.\n"); + throw new PHPExcel_Writer_Exception("$bitmap: only 1 plane supported in bitmap image.\n"); } // Read and remove the bitmap compression. Verify compression. @@ -2639,7 +2675,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter //$compression = 0; if ($compression['comp'] != 0) { - throw new Exception("$bitmap: compression not supported in bitmap image.\n"); + throw new PHPExcel_Writer_Exception("$bitmap: compression not supported in bitmap image.\n"); } // Remove bitmap data: data size, hres, vres, colours, imp. colours. @@ -2895,7 +2931,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter $formula1 = $this->_parser->toReversePolish(); $sz1 = strlen($formula1); - } catch(Exception $e) { + } catch(PHPExcel_Exception $e) { $sz1 = 0; $formula1 = ''; } @@ -2906,13 +2942,13 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter try { $formula2 = $dataValidation->getFormula2(); if ($formula2 === '') { - throw new Exception('No formula2'); + throw new PHPExcel_Writer_Exception('No formula2'); } $this->_parser->parse($formula2); $formula2 = $this->_parser->toReversePolish(); $sz2 = strlen($formula2); - } catch(Exception $e) { + } catch(PHPExcel_Exception $e) { $sz2 = 0; $formula2 = ''; } @@ -2951,4 +2987,695 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter return 0; } + /** + * Write PLV Record + */ + private function _writePageLayoutView(){ + $record = 0x088B; // Record identifier + $length = 0x0010; // Bytes to follow + + $rt = 0x088B; // 2 + $grbitFrt = 0x0000; // 2 + $reserved = 0x0000000000000000; // 8 + $wScalvePLV = $this->_phpSheet->getSheetView()->getZoomScale(); // 2 + + // The options flags that comprise $grbit + if($this->_phpSheet->getSheetView()->getView() == PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT){ + $fPageLayoutView = 1; + } else { + $fPageLayoutView = 0; + } + $fRulerVisible = 0; + $fWhitespaceHidden = 0; + + $grbit = $fPageLayoutView; // 2 + $grbit |= $fRulerVisible << 1; + $grbit |= $fWhitespaceHidden << 3; + + $header = pack("vv", $record, $length); + $data = pack("vvVVvv", $rt, $grbitFrt, 0x00000000, 0x00000000, $wScalvePLV, $grbit); + $this->_append($header . $data); + } + + /** + * Write CFRule Record + * @param PHPExcel_Style_Conditional $conditional + */ + private function _writeCFRule(PHPExcel_Style_Conditional $conditional){ + $record = 0x01B1; // Record identifier + + // $type : Type of the CF + // $operatorType : Comparison operator + if($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION){ + $type = 0x02; + $operatorType = 0x00; + } else if($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS){ + $type = 0x01; + + switch ($conditional->getOperatorType()){ + case PHPExcel_Style_Conditional::OPERATOR_NONE: + $operatorType = 0x00; + break; + case PHPExcel_Style_Conditional::OPERATOR_EQUAL: + $operatorType = 0x03; + break; + case PHPExcel_Style_Conditional::OPERATOR_GREATERTHAN: + $operatorType = 0x05; + break; + case PHPExcel_Style_Conditional::OPERATOR_GREATERTHANOREQUAL: + $operatorType = 0x07; + break; + case PHPExcel_Style_Conditional::OPERATOR_LESSTHAN: + $operatorType = 0x06; + break; + case PHPExcel_Style_Conditional::OPERATOR_LESSTHANOREQUAL: + $operatorType = 0x08; + break; + case PHPExcel_Style_Conditional::OPERATOR_NOTEQUAL: + $operatorType = 0x04; + break; + case PHPExcel_Style_Conditional::OPERATOR_BETWEEN: + $operatorType = 0x01; + break; + // not OPERATOR_NOTBETWEEN 0x02 + } + } + + // $szValue1 : size of the formula data for first value or formula + // $szValue2 : size of the formula data for second value or formula + $arrConditions = $conditional->getConditions(); + $numConditions = sizeof($arrConditions); + if($numConditions == 1){ + $szValue1 = ($arrConditions[0] <= 65535 ? 3 : 0x0000); + $szValue2 = 0x0000; + $operand1 = pack('Cv', 0x1E, $arrConditions[0]); + $operand2 = null; + } else if($numConditions == 2 && ($conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BETWEEN)){ + $szValue1 = ($arrConditions[0] <= 65535 ? 3 : 0x0000); + $szValue2 = ($arrConditions[1] <= 65535 ? 3 : 0x0000); + $operand1 = pack('Cv', 0x1E, $arrConditions[0]); + $operand2 = pack('Cv', 0x1E, $arrConditions[1]); + } else { + $szValue1 = 0x0000; + $szValue2 = 0x0000; + $operand1 = null; + $operand2 = null; + } + + // $flags : Option flags + // Alignment + $bAlignHz = ($conditional->getStyle()->getAlignment()->getHorizontal() == null ? 1 : 0); + $bAlignVt = ($conditional->getStyle()->getAlignment()->getVertical() == null ? 1 : 0); + $bAlignWrapTx = ($conditional->getStyle()->getAlignment()->getWrapText() == false ? 1 : 0); + $bTxRotation = ($conditional->getStyle()->getAlignment()->getTextRotation() == null ? 1 : 0); + $bIndent = ($conditional->getStyle()->getAlignment()->getIndent() == 0 ? 1 : 0); + $bShrinkToFit = ($conditional->getStyle()->getAlignment()->getShrinkToFit() == false ? 1 : 0); + if($bAlignHz == 0 || $bAlignVt == 0 || $bAlignWrapTx == 0 || $bTxRotation == 0 || $bIndent == 0 || $bShrinkToFit == 0){ + $bFormatAlign = 1; + } else { + $bFormatAlign = 0; + } + // Protection + $bProtLocked = ($conditional->getStyle()->getProtection()->getLocked() == null ? 1 : 0); + $bProtHidden = ($conditional->getStyle()->getProtection()->getHidden() == null ? 1 : 0); + if($bProtLocked == 0 || $bProtHidden == 0){ + $bFormatProt = 1; + } else { + $bFormatProt = 0; + } + // Border + $bBorderLeft = ($conditional->getStyle()->getBorders()->getLeft()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK + && $conditional->getStyle()->getBorders()->getLeft()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0); + $bBorderRight = ($conditional->getStyle()->getBorders()->getRight()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK + && $conditional->getStyle()->getBorders()->getRight()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0); + $bBorderTop = ($conditional->getStyle()->getBorders()->getTop()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK + && $conditional->getStyle()->getBorders()->getTop()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0); + $bBorderBottom = ($conditional->getStyle()->getBorders()->getBottom()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK + && $conditional->getStyle()->getBorders()->getBottom()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0); + if($bBorderLeft == 0 || $bBorderRight == 0 || $bBorderTop == 0 || $bBorderBottom == 0){ + $bFormatBorder = 1; + } else { + $bFormatBorder = 0; + } + // Pattern + $bFillStyle = ($conditional->getStyle()->getFill()->getFillType() == null ? 0 : 1); + $bFillColor = ($conditional->getStyle()->getFill()->getStartColor()->getARGB() == null ? 0 : 1); + $bFillColorBg = ($conditional->getStyle()->getFill()->getEndColor()->getARGB() == null ? 0 : 1); + if($bFillStyle == 0 || $bFillColor == 0 || $bFillColorBg == 0){ + $bFormatFill = 1; + } else { + $bFormatFill = 0; + } + // Font + if($conditional->getStyle()->getFont()->getName() != null + || $conditional->getStyle()->getFont()->getSize() != null + || $conditional->getStyle()->getFont()->getBold() != null + || $conditional->getStyle()->getFont()->getItalic() != null + || $conditional->getStyle()->getFont()->getSuperScript() != null + || $conditional->getStyle()->getFont()->getSubScript() != null + || $conditional->getStyle()->getFont()->getUnderline() != null + || $conditional->getStyle()->getFont()->getStrikethrough() != null + || $conditional->getStyle()->getFont()->getColor()->getARGB() != null){ + $bFormatFont = 1; + } else { + $bFormatFont = 0; + } + // Alignment + $flags = 0; + $flags |= (1 == $bAlignHz ? 0x00000001 : 0); + $flags |= (1 == $bAlignVt ? 0x00000002 : 0); + $flags |= (1 == $bAlignWrapTx ? 0x00000004 : 0); + $flags |= (1 == $bTxRotation ? 0x00000008 : 0); + // Justify last line flag + $flags |= (1 == 1 ? 0x00000010 : 0); + $flags |= (1 == $bIndent ? 0x00000020 : 0); + $flags |= (1 == $bShrinkToFit ? 0x00000040 : 0); + // Default + $flags |= (1 == 1 ? 0x00000080 : 0); + // Protection + $flags |= (1 == $bProtLocked ? 0x00000100 : 0); + $flags |= (1 == $bProtHidden ? 0x00000200 : 0); + // Border + $flags |= (1 == $bBorderLeft ? 0x00000400 : 0); + $flags |= (1 == $bBorderRight ? 0x00000800 : 0); + $flags |= (1 == $bBorderTop ? 0x00001000 : 0); + $flags |= (1 == $bBorderBottom ? 0x00002000 : 0); + $flags |= (1 == 1 ? 0x00004000 : 0); // Top left to Bottom right border + $flags |= (1 == 1 ? 0x00008000 : 0); // Bottom left to Top right border + // Pattern + $flags |= (1 == $bFillStyle ? 0x00010000 : 0); + $flags |= (1 == $bFillColor ? 0x00020000 : 0); + $flags |= (1 == $bFillColorBg ? 0x00040000 : 0); + $flags |= (1 == 1 ? 0x00380000 : 0); + // Font + $flags |= (1 == $bFormatFont ? 0x04000000 : 0); + // Alignment : + $flags |= (1 == $bFormatAlign ? 0x08000000 : 0); + // Border + $flags |= (1 == $bFormatBorder ? 0x10000000 : 0); + // Pattern + $flags |= (1 == $bFormatFill ? 0x20000000 : 0); + // Protection + $flags |= (1 == $bFormatProt ? 0x40000000 : 0); + // Text direction + $flags |= (1 == 0 ? 0x80000000 : 0); + + // Data Blocks + if($bFormatFont == 1){ + // Font Name + if($conditional->getStyle()->getFont()->getName() == null){ + $dataBlockFont = pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000); + $dataBlockFont .= pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000); + } else { + $dataBlockFont = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($conditional->getStyle()->getFont()->getName()); + } + // Font Size + if($conditional->getStyle()->getFont()->getSize() == null){ + $dataBlockFont .= pack('V', 20 * 11); + } else { + $dataBlockFont .= pack('V', 20 * $conditional->getStyle()->getFont()->getSize()); + } + // Font Options + $dataBlockFont .= pack('V', 0); + // Font weight + if($conditional->getStyle()->getFont()->getBold() == true){ + $dataBlockFont .= pack('v', 0x02BC); + } else { + $dataBlockFont .= pack('v', 0x0190); + } + // Escapement type + if($conditional->getStyle()->getFont()->getSubScript() == true){ + $dataBlockFont .= pack('v', 0x02); + $fontEscapement = 0; + } else if($conditional->getStyle()->getFont()->getSuperScript() == true){ + $dataBlockFont .= pack('v', 0x01); + $fontEscapement = 0; + } else { + $dataBlockFont .= pack('v', 0x00); + $fontEscapement = 1; + } + // Underline type + switch ($conditional->getStyle()->getFont()->getUnderline()){ + case PHPExcel_Style_Font::UNDERLINE_NONE : $dataBlockFont .= pack('C', 0x00); $fontUnderline = 0; break; + case PHPExcel_Style_Font::UNDERLINE_DOUBLE : $dataBlockFont .= pack('C', 0x02); $fontUnderline = 0; break; + case PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING : $dataBlockFont .= pack('C', 0x22); $fontUnderline = 0; break; + case PHPExcel_Style_Font::UNDERLINE_SINGLE : $dataBlockFont .= pack('C', 0x01); $fontUnderline = 0; break; + case PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING : $dataBlockFont .= pack('C', 0x21); $fontUnderline = 0; break; + default : $dataBlockFont .= pack('C', 0x00); $fontUnderline = 1; break; + } + // Not used (3) + $dataBlockFont .= pack('vC', 0x0000, 0x00); + // Font color index + switch ($conditional->getStyle()->getFont()->getColor()->getRGB()) { + case '000000': $colorIdx = 0x08; break; + case 'FFFFFF': $colorIdx = 0x09; break; + case 'FF0000': $colorIdx = 0x0A; break; + case '00FF00': $colorIdx = 0x0B; break; + case '0000FF': $colorIdx = 0x0C; break; + case 'FFFF00': $colorIdx = 0x0D; break; + case 'FF00FF': $colorIdx = 0x0E; break; + case '00FFFF': $colorIdx = 0x0F; break; + case '800000': $colorIdx = 0x10; break; + case '008000': $colorIdx = 0x11; break; + case '000080': $colorIdx = 0x12; break; + case '808000': $colorIdx = 0x13; break; + case '800080': $colorIdx = 0x14; break; + case '008080': $colorIdx = 0x15; break; + case 'C0C0C0': $colorIdx = 0x16; break; + case '808080': $colorIdx = 0x17; break; + case '9999FF': $colorIdx = 0x18; break; + case '993366': $colorIdx = 0x19; break; + case 'FFFFCC': $colorIdx = 0x1A; break; + case 'CCFFFF': $colorIdx = 0x1B; break; + case '660066': $colorIdx = 0x1C; break; + case 'FF8080': $colorIdx = 0x1D; break; + case '0066CC': $colorIdx = 0x1E; break; + case 'CCCCFF': $colorIdx = 0x1F; break; + case '000080': $colorIdx = 0x20; break; + case 'FF00FF': $colorIdx = 0x21; break; + case 'FFFF00': $colorIdx = 0x22; break; + case '00FFFF': $colorIdx = 0x23; break; + case '800080': $colorIdx = 0x24; break; + case '800000': $colorIdx = 0x25; break; + case '008080': $colorIdx = 0x26; break; + case '0000FF': $colorIdx = 0x27; break; + case '00CCFF': $colorIdx = 0x28; break; + case 'CCFFFF': $colorIdx = 0x29; break; + case 'CCFFCC': $colorIdx = 0x2A; break; + case 'FFFF99': $colorIdx = 0x2B; break; + case '99CCFF': $colorIdx = 0x2C; break; + case 'FF99CC': $colorIdx = 0x2D; break; + case 'CC99FF': $colorIdx = 0x2E; break; + case 'FFCC99': $colorIdx = 0x2F; break; + case '3366FF': $colorIdx = 0x30; break; + case '33CCCC': $colorIdx = 0x31; break; + case '99CC00': $colorIdx = 0x32; break; + case 'FFCC00': $colorIdx = 0x33; break; + case 'FF9900': $colorIdx = 0x34; break; + case 'FF6600': $colorIdx = 0x35; break; + case '666699': $colorIdx = 0x36; break; + case '969696': $colorIdx = 0x37; break; + case '003366': $colorIdx = 0x38; break; + case '339966': $colorIdx = 0x39; break; + case '003300': $colorIdx = 0x3A; break; + case '333300': $colorIdx = 0x3B; break; + case '993300': $colorIdx = 0x3C; break; + case '993366': $colorIdx = 0x3D; break; + case '333399': $colorIdx = 0x3E; break; + case '333333': $colorIdx = 0x3F; break; + default: $colorIdx = 0x00; break; + } + $dataBlockFont .= pack('V', $colorIdx); + // Not used (4) + $dataBlockFont .= pack('V', 0x00000000); + // Options flags for modified font attributes + $optionsFlags = 0; + $optionsFlagsBold = ($conditional->getStyle()->getFont()->getBold() == null ? 1 : 0); + $optionsFlags |= (1 == $optionsFlagsBold ? 0x00000002 : 0); + $optionsFlags |= (1 == 1 ? 0x00000008 : 0); + $optionsFlags |= (1 == 1 ? 0x00000010 : 0); + $optionsFlags |= (1 == 0 ? 0x00000020 : 0); + $optionsFlags |= (1 == 1 ? 0x00000080 : 0); + $dataBlockFont .= pack('V', $optionsFlags); + // Escapement type + $dataBlockFont .= pack('V', $fontEscapement); + // Underline type + $dataBlockFont .= pack('V', $fontUnderline); + // Always + $dataBlockFont .= pack('V', 0x00000000); + // Always + $dataBlockFont .= pack('V', 0x00000000); + // Not used (8) + $dataBlockFont .= pack('VV', 0x00000000, 0x00000000); + // Always + $dataBlockFont .= pack('v', 0x0001); + } + if($bFormatAlign == 1){ + $blockAlign = 0; + // Alignment and text break + switch ($conditional->getStyle()->getAlignment()->getHorizontal()){ + case PHPExcel_Style_Alignment::HORIZONTAL_GENERAL : $blockAlign = 0; break; + case PHPExcel_Style_Alignment::HORIZONTAL_LEFT : $blockAlign = 1; break; + case PHPExcel_Style_Alignment::HORIZONTAL_RIGHT : $blockAlign = 3; break; + case PHPExcel_Style_Alignment::HORIZONTAL_CENTER : $blockAlign = 2; break; + case PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS : $blockAlign = 6; break; + case PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY : $blockAlign = 5; break; + } + if($conditional->getStyle()->getAlignment()->getWrapText() == true){ + $blockAlign |= 1 << 3; + } else { + $blockAlign |= 0 << 3; + } + switch ($conditional->getStyle()->getAlignment()->getVertical()){ + case PHPExcel_Style_Alignment::VERTICAL_BOTTOM : $blockAlign = 2 << 4; break; + case PHPExcel_Style_Alignment::VERTICAL_TOP : $blockAlign = 0 << 4; break; + case PHPExcel_Style_Alignment::VERTICAL_CENTER : $blockAlign = 1 << 4; break; + case PHPExcel_Style_Alignment::VERTICAL_JUSTIFY : $blockAlign = 3 << 4; break; + } + $blockAlign |= 0 << 7; + + // Text rotation angle + $blockRotation = $conditional->getStyle()->getAlignment()->getTextRotation(); + + // Indentation + $blockIndent = $conditional->getStyle()->getAlignment()->getIndent(); + if($conditional->getStyle()->getAlignment()->getShrinkToFit() == true){ + $blockIndent |= 1 << 4; + } else { + $blockIndent |= 0 << 4; + } + $blockIndent |= 0 << 6; + + // Relative indentation + $blockIndentRelative = 255; + + $dataBlockAlign = pack('CCvvv', $blockAlign, $blockRotation, $blockIndent, $blockIndentRelative, 0x0000); + } + if($bFormatBorder == 1){ + $blockLineStyle = 0; + switch ($conditional->getStyle()->getBorders()->getLeft()->getBorderStyle()){ + case PHPExcel_Style_Border::BORDER_NONE : $blockLineStyle |= 0x00; break; + case PHPExcel_Style_Border::BORDER_THIN : $blockLineStyle |= 0x01; break; + case PHPExcel_Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02; break; + case PHPExcel_Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03; break; + case PHPExcel_Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04; break; + case PHPExcel_Style_Border::BORDER_THICK : $blockLineStyle |= 0x05; break; + case PHPExcel_Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06; break; + case PHPExcel_Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07; break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08; break; + case PHPExcel_Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09; break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A; break; + case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B; break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C; break; + case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D; break; + } + switch ($conditional->getStyle()->getBorders()->getRight()->getBorderStyle()){ + case PHPExcel_Style_Border::BORDER_NONE : $blockLineStyle |= 0x00 << 4; break; + case PHPExcel_Style_Border::BORDER_THIN : $blockLineStyle |= 0x01 << 4; break; + case PHPExcel_Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02 << 4; break; + case PHPExcel_Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03 << 4; break; + case PHPExcel_Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04 << 4; break; + case PHPExcel_Style_Border::BORDER_THICK : $blockLineStyle |= 0x05 << 4; break; + case PHPExcel_Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06 << 4; break; + case PHPExcel_Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07 << 4; break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08 << 4; break; + case PHPExcel_Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09 << 4; break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A << 4; break; + case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B << 4; break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C << 4; break; + case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D << 4; break; + } + switch ($conditional->getStyle()->getBorders()->getTop()->getBorderStyle()){ + case PHPExcel_Style_Border::BORDER_NONE : $blockLineStyle |= 0x00 << 8; break; + case PHPExcel_Style_Border::BORDER_THIN : $blockLineStyle |= 0x01 << 8; break; + case PHPExcel_Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02 << 8; break; + case PHPExcel_Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03 << 8; break; + case PHPExcel_Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04 << 8; break; + case PHPExcel_Style_Border::BORDER_THICK : $blockLineStyle |= 0x05 << 8; break; + case PHPExcel_Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06 << 8; break; + case PHPExcel_Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07 << 8; break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08 << 8; break; + case PHPExcel_Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09 << 8; break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A << 8; break; + case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B << 8; break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C << 8; break; + case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D << 8; break; + } + switch ($conditional->getStyle()->getBorders()->getBottom()->getBorderStyle()){ + case PHPExcel_Style_Border::BORDER_NONE : $blockLineStyle |= 0x00 << 12; break; + case PHPExcel_Style_Border::BORDER_THIN : $blockLineStyle |= 0x01 << 12; break; + case PHPExcel_Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02 << 12; break; + case PHPExcel_Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03 << 12; break; + case PHPExcel_Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04 << 12; break; + case PHPExcel_Style_Border::BORDER_THICK : $blockLineStyle |= 0x05 << 12; break; + case PHPExcel_Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06 << 12; break; + case PHPExcel_Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07 << 12; break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08 << 12; break; + case PHPExcel_Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09 << 12; break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A << 12; break; + case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B << 12; break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C << 12; break; + case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D << 12; break; + } + //@todo _writeCFRule() => $blockLineStyle => Index Color for left line + //@todo _writeCFRule() => $blockLineStyle => Index Color for right line + //@todo _writeCFRule() => $blockLineStyle => Top-left to bottom-right on/off + //@todo _writeCFRule() => $blockLineStyle => Bottom-left to top-right on/off + $blockColor = 0; + //@todo _writeCFRule() => $blockColor => Index Color for top line + //@todo _writeCFRule() => $blockColor => Index Color for bottom line + //@todo _writeCFRule() => $blockColor => Index Color for diagonal line + switch ($conditional->getStyle()->getBorders()->getDiagonal()->getBorderStyle()){ + case PHPExcel_Style_Border::BORDER_NONE : $blockColor |= 0x00 << 21; break; + case PHPExcel_Style_Border::BORDER_THIN : $blockColor |= 0x01 << 21; break; + case PHPExcel_Style_Border::BORDER_MEDIUM : $blockColor |= 0x02 << 21; break; + case PHPExcel_Style_Border::BORDER_DASHED : $blockColor |= 0x03 << 21; break; + case PHPExcel_Style_Border::BORDER_DOTTED : $blockColor |= 0x04 << 21; break; + case PHPExcel_Style_Border::BORDER_THICK : $blockColor |= 0x05 << 21; break; + case PHPExcel_Style_Border::BORDER_DOUBLE : $blockColor |= 0x06 << 21; break; + case PHPExcel_Style_Border::BORDER_HAIR : $blockColor |= 0x07 << 21; break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockColor |= 0x08 << 21; break; + case PHPExcel_Style_Border::BORDER_DASHDOT : $blockColor |= 0x09 << 21; break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockColor |= 0x0A << 21; break; + case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockColor |= 0x0B << 21; break; + case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockColor |= 0x0C << 21; break; + case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockColor |= 0x0D << 21; break; + } + $dataBlockBorder = pack('vv', $blockLineStyle, $blockColor); + } + if($bFormatFill == 1){ + // Fill Patern Style + $blockFillPatternStyle = 0; + switch ($conditional->getStyle()->getFill()->getFillType()){ + case PHPExcel_Style_Fill::FILL_NONE : $blockFillPatternStyle = 0x00; break; + case PHPExcel_Style_Fill::FILL_SOLID : $blockFillPatternStyle = 0x01; break; + case PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY : $blockFillPatternStyle = 0x02; break; + case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY : $blockFillPatternStyle = 0x03; break; + case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY : $blockFillPatternStyle = 0x04; break; + case PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL : $blockFillPatternStyle = 0x05; break; + case PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL : $blockFillPatternStyle = 0x06; break; + case PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN : $blockFillPatternStyle = 0x07; break; + case PHPExcel_Style_Fill::FILL_PATTERN_DARKUP : $blockFillPatternStyle = 0x08; break; + case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID : $blockFillPatternStyle = 0x09; break; + case PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS : $blockFillPatternStyle = 0x0A; break; + case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL : $blockFillPatternStyle = 0x0B; break; + case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL : $blockFillPatternStyle = 0x0C; break; + case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN : $blockFillPatternStyle = 0x0D; break; + case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP : $blockFillPatternStyle = 0x0E; break; + case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID : $blockFillPatternStyle = 0x0F; break; + case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS : $blockFillPatternStyle = 0x10; break; + case PHPExcel_Style_Fill::FILL_PATTERN_GRAY125 : $blockFillPatternStyle = 0x11; break; + case PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625 : $blockFillPatternStyle = 0x12; break; + case PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR : $blockFillPatternStyle = 0x00; break; // does not exist in BIFF8 + case PHPExcel_Style_Fill::FILL_GRADIENT_PATH : $blockFillPatternStyle = 0x00; break; // does not exist in BIFF8 + default : $blockFillPatternStyle = 0x00; break; + } + // Color + switch ($conditional->getStyle()->getFill()->getStartColor()->getRGB()) { + case '000000': $colorIdxBg = 0x08; break; + case 'FFFFFF': $colorIdxBg = 0x09; break; + case 'FF0000': $colorIdxBg = 0x0A; break; + case '00FF00': $colorIdxBg = 0x0B; break; + case '0000FF': $colorIdxBg = 0x0C; break; + case 'FFFF00': $colorIdxBg = 0x0D; break; + case 'FF00FF': $colorIdxBg = 0x0E; break; + case '00FFFF': $colorIdxBg = 0x0F; break; + case '800000': $colorIdxBg = 0x10; break; + case '008000': $colorIdxBg = 0x11; break; + case '000080': $colorIdxBg = 0x12; break; + case '808000': $colorIdxBg = 0x13; break; + case '800080': $colorIdxBg = 0x14; break; + case '008080': $colorIdxBg = 0x15; break; + case 'C0C0C0': $colorIdxBg = 0x16; break; + case '808080': $colorIdxBg = 0x17; break; + case '9999FF': $colorIdxBg = 0x18; break; + case '993366': $colorIdxBg = 0x19; break; + case 'FFFFCC': $colorIdxBg = 0x1A; break; + case 'CCFFFF': $colorIdxBg = 0x1B; break; + case '660066': $colorIdxBg = 0x1C; break; + case 'FF8080': $colorIdxBg = 0x1D; break; + case '0066CC': $colorIdxBg = 0x1E; break; + case 'CCCCFF': $colorIdxBg = 0x1F; break; + case '000080': $colorIdxBg = 0x20; break; + case 'FF00FF': $colorIdxBg = 0x21; break; + case 'FFFF00': $colorIdxBg = 0x22; break; + case '00FFFF': $colorIdxBg = 0x23; break; + case '800080': $colorIdxBg = 0x24; break; + case '800000': $colorIdxBg = 0x25; break; + case '008080': $colorIdxBg = 0x26; break; + case '0000FF': $colorIdxBg = 0x27; break; + case '00CCFF': $colorIdxBg = 0x28; break; + case 'CCFFFF': $colorIdxBg = 0x29; break; + case 'CCFFCC': $colorIdxBg = 0x2A; break; + case 'FFFF99': $colorIdxBg = 0x2B; break; + case '99CCFF': $colorIdxBg = 0x2C; break; + case 'FF99CC': $colorIdxBg = 0x2D; break; + case 'CC99FF': $colorIdxBg = 0x2E; break; + case 'FFCC99': $colorIdxBg = 0x2F; break; + case '3366FF': $colorIdxBg = 0x30; break; + case '33CCCC': $colorIdxBg = 0x31; break; + case '99CC00': $colorIdxBg = 0x32; break; + case 'FFCC00': $colorIdxBg = 0x33; break; + case 'FF9900': $colorIdxBg = 0x34; break; + case 'FF6600': $colorIdxBg = 0x35; break; + case '666699': $colorIdxBg = 0x36; break; + case '969696': $colorIdxBg = 0x37; break; + case '003366': $colorIdxBg = 0x38; break; + case '339966': $colorIdxBg = 0x39; break; + case '003300': $colorIdxBg = 0x3A; break; + case '333300': $colorIdxBg = 0x3B; break; + case '993300': $colorIdxBg = 0x3C; break; + case '993366': $colorIdxBg = 0x3D; break; + case '333399': $colorIdxBg = 0x3E; break; + case '333333': $colorIdxBg = 0x3F; break; + default: $colorIdxBg = 0x41; break; + } + // Fg Color + switch ($conditional->getStyle()->getFill()->getEndColor()->getRGB()) { + case '000000': $colorIdxFg = 0x08; break; + case 'FFFFFF': $colorIdxFg = 0x09; break; + case 'FF0000': $colorIdxFg = 0x0A; break; + case '00FF00': $colorIdxFg = 0x0B; break; + case '0000FF': $colorIdxFg = 0x0C; break; + case 'FFFF00': $colorIdxFg = 0x0D; break; + case 'FF00FF': $colorIdxFg = 0x0E; break; + case '00FFFF': $colorIdxFg = 0x0F; break; + case '800000': $colorIdxFg = 0x10; break; + case '008000': $colorIdxFg = 0x11; break; + case '000080': $colorIdxFg = 0x12; break; + case '808000': $colorIdxFg = 0x13; break; + case '800080': $colorIdxFg = 0x14; break; + case '008080': $colorIdxFg = 0x15; break; + case 'C0C0C0': $colorIdxFg = 0x16; break; + case '808080': $colorIdxFg = 0x17; break; + case '9999FF': $colorIdxFg = 0x18; break; + case '993366': $colorIdxFg = 0x19; break; + case 'FFFFCC': $colorIdxFg = 0x1A; break; + case 'CCFFFF': $colorIdxFg = 0x1B; break; + case '660066': $colorIdxFg = 0x1C; break; + case 'FF8080': $colorIdxFg = 0x1D; break; + case '0066CC': $colorIdxFg = 0x1E; break; + case 'CCCCFF': $colorIdxFg = 0x1F; break; + case '000080': $colorIdxFg = 0x20; break; + case 'FF00FF': $colorIdxFg = 0x21; break; + case 'FFFF00': $colorIdxFg = 0x22; break; + case '00FFFF': $colorIdxFg = 0x23; break; + case '800080': $colorIdxFg = 0x24; break; + case '800000': $colorIdxFg = 0x25; break; + case '008080': $colorIdxFg = 0x26; break; + case '0000FF': $colorIdxFg = 0x27; break; + case '00CCFF': $colorIdxFg = 0x28; break; + case 'CCFFFF': $colorIdxFg = 0x29; break; + case 'CCFFCC': $colorIdxFg = 0x2A; break; + case 'FFFF99': $colorIdxFg = 0x2B; break; + case '99CCFF': $colorIdxFg = 0x2C; break; + case 'FF99CC': $colorIdxFg = 0x2D; break; + case 'CC99FF': $colorIdxFg = 0x2E; break; + case 'FFCC99': $colorIdxFg = 0x2F; break; + case '3366FF': $colorIdxFg = 0x30; break; + case '33CCCC': $colorIdxFg = 0x31; break; + case '99CC00': $colorIdxFg = 0x32; break; + case 'FFCC00': $colorIdxFg = 0x33; break; + case 'FF9900': $colorIdxFg = 0x34; break; + case 'FF6600': $colorIdxFg = 0x35; break; + case '666699': $colorIdxFg = 0x36; break; + case '969696': $colorIdxFg = 0x37; break; + case '003366': $colorIdxFg = 0x38; break; + case '339966': $colorIdxFg = 0x39; break; + case '003300': $colorIdxFg = 0x3A; break; + case '333300': $colorIdxFg = 0x3B; break; + case '993300': $colorIdxFg = 0x3C; break; + case '993366': $colorIdxFg = 0x3D; break; + case '333399': $colorIdxFg = 0x3E; break; + case '333333': $colorIdxFg = 0x3F; break; + default: $colorIdxFg = 0x40; break; + } + $dataBlockFill = pack('v', $blockFillPatternStyle); + $dataBlockFill .= pack('v', $colorIdxFg | ($colorIdxBg << 7)); + } + if($bFormatProt == 1){ + $dataBlockProtection = 0; + if($conditional->getStyle()->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED){ + $dataBlockProtection = 1; + } + if($conditional->getStyle()->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED){ + $dataBlockProtection = 1 << 1; + } + } + + $data = pack('CCvvVv', $type, $operatorType, $szValue1, $szValue2, $flags, 0x0000); + if($bFormatFont == 1){ // Block Formatting : OK + $data .= $dataBlockFont; + } + if($bFormatAlign == 1){ + $data .= $dataBlockAlign; + } + if($bFormatBorder == 1){ + $data .= $dataBlockBorder; + } + if($bFormatFill == 1){ // Block Formatting : OK + $data .= $dataBlockFill; + } + if($bFormatProt == 1){ + $data .= $dataBlockProtection; + } + if(!is_null($operand1)){ + $data .= $operand1; + } + if(!is_null($operand2)){ + $data .= $operand2; + } + $header = pack('vv', $record, strlen($data)); + $this->_append($header . $data); + } + + /** + * Write CFHeader record + */ + private function _writeCFHeader(){ + $record = 0x01B0; // Record identifier + $length = 0x0016; // Bytes to follow + + $numColumnMin = null; + $numColumnMax = null; + $numRowMin = null; + $numRowMax = null; + $arrConditional = array(); + foreach ($this->_phpSheet->getConditionalStylesCollection() as $cellCoordinate => $conditionalStyles) { + foreach ($conditionalStyles as $conditional) { + if($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION + || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS){ + if(!in_array($conditional->getHashCode(), $arrConditional)){ + $arrConditional[] = $conditional->getHashCode(); + } + // Cells + $arrCoord = PHPExcel_Cell::coordinateFromString($cellCoordinate); + if(!is_numeric($arrCoord[0])){ + $arrCoord[0] = PHPExcel_Cell::columnIndexFromString($arrCoord[0]); + } + if(is_null($numColumnMin) || ($numColumnMin > $arrCoord[0])){ + $numColumnMin = $arrCoord[0]; + } + if(is_null($numColumnMax) || ($numColumnMax < $arrCoord[0])){ + $numColumnMax = $arrCoord[0]; + } + if(is_null($numRowMin) || ($numRowMin > $arrCoord[1])){ + $numRowMin = $arrCoord[1]; + } + if(is_null($numRowMax) || ($numRowMax < $arrCoord[1])){ + $numRowMax = $arrCoord[1]; + } + } + } + } + $needRedraw = 1; + $cellRange = pack('vvvv', $numRowMin-1, $numRowMax-1, $numColumnMin-1, $numColumnMax-1); + + $header = pack('vv', $record, $length); + $data = pack('vv', count($arrConditional), $needRedraw); + $data .= $cellRange; + $data .= pack('v', 0x0001); + $data .= $cellRange; + $this->_append($header . $data); + } } \ No newline at end of file diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Xf.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Xf.php index 06fb1d9d8cf..f803f68346b 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Xf.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Excel5/Xf.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,9 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel5 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ // Original file header of PEAR::Spreadsheet_Excel_Writer_Format (used as the base for this class): @@ -66,7 +66,7 @@ * * @category PHPExcel * @package PHPExcel_Writer_Excel5 - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Writer_Excel5_Xf { @@ -179,7 +179,7 @@ class PHPExcel_Writer_Excel5_Xf // Flags to indicate if attributes have been set. $atr_num = ($this->_numberFormatIndex != 0)?1:0; $atr_fnt = ($this->_fontIndex != 0)?1:0; - $atr_alc = ((int) $this->_style->getAlignment()->getWrapText())?1:0; + $atr_alc = ((int) $this->_style->getAlignment()->getWrapText()) ? 1 : 0; $atr_bdr = (self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) || self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) || self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) || @@ -457,6 +457,7 @@ class PHPExcel_Writer_Excel5_Xf PHPExcel_Style_Alignment::HORIZONTAL_LEFT => 1, PHPExcel_Style_Alignment::HORIZONTAL_CENTER => 2, PHPExcel_Style_Alignment::HORIZONTAL_RIGHT => 3, + PHPExcel_Style_Alignment::HORIZONTAL_FILL => 4, PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY => 5, PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS => 6, ); diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/Exception.php b/htdocs/includes/phpexcel/PHPExcel/Writer/Exception.php new file mode 100644 index 00000000000..e8fe9be783d --- /dev/null +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/Exception.php @@ -0,0 +1,52 @@ +line = $line; + $e->file = $file; + throw $e; + } +} diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/HTML.php b/htdocs/includes/phpexcel/PHPExcel/Writer/HTML.php index f0aafafed34..0f2cc089f6b 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/HTML.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/HTML.php @@ -2,7 +2,7 @@ /** * PHPExcel * - * Copyright (c) 2006 - 2012 PHPExcel + * Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,10 +19,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel - * @package PHPExcel_Writer - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @package PHPExcel_Writer_HTML + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL - * @version 1.7.8, 2012-10-12 + * @version 1.8.0, 2014-03-02 */ @@ -30,10 +30,10 @@ * PHPExcel_Writer_HTML * * @category PHPExcel - * @package PHPExcel_Writer - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) + * @package PHPExcel_Writer_HTML + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ -class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { +class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter { /** * PHPExcel object * @@ -48,13 +48,6 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { */ private $_sheetIndex = 0; - /** - * Pre-calculate formulas - * - * @var boolean - */ - private $_preCalculateFormulas = true; - /** * Images root * @@ -62,6 +55,13 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { */ private $_imagesRoot = '.'; + /** + * embed images, or link to images + * + * @var boolean + */ + private $_embedImages = FALSE; + /** * Use inline CSS? * @@ -146,14 +146,14 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { * Save PHPExcel to file * * @param string $pFilename - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function save($pFilename = null) { // garbage collect $this->_phpExcel->garbageCollect(); - $saveDebugLog = PHPExcel_Calculation::getInstance()->writeDebugLog; - PHPExcel_Calculation::getInstance()->writeDebugLog = false; + $saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog(); + PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE); $saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); @@ -163,7 +163,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { // Open file $fileHandle = fopen($pFilename, 'wb+'); if ($fileHandle === false) { - throw new Exception("Could not open file $pFilename for writing."); + throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing."); } // Write headers @@ -184,7 +184,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { fclose($fileHandle); PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType); - PHPExcel_Calculation::getInstance()->writeDebugLog = $saveDebugLog; + PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog); } /** @@ -300,12 +300,12 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { * * @param boolean $pIncludeStyles Include styles? * @return string - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function generateHTMLHeader($pIncludeStyles = false) { // PHPExcel object known? if (is_null($this->_phpExcel)) { - throw new Exception('Internal PHPExcel object not set to an instance of an object.'); + throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); } // Construct HTML @@ -351,12 +351,12 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { * Generate sheet data * * @return string - * @throws Exception + * @throws PHPExcel_Writer_Exception */ public function generateSheetData() { // PHPExcel object known? if (is_null($this->_phpExcel)) { - throw new Exception('Internal PHPExcel object not set to an instance of an object.'); + throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.'); } // Ensure that Spans have been calculated? @@ -394,7 +394,6 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { // calculate start of

'; + $html .= $this->_writeImageInCell($pSheet, $col.$row); + if ($this->_includeCharts) { + $html .= $this->_writeChartInCell($pSheet, $col.$row); + } + $html .= '
' . PHP_EOL; } else { $style = isset($this->_cssStyles['table']) ? $this->_assembleCSS($this->_cssStyles['table']) : ''; - if ($this->_isPdf && $pSheet->getShowGridLines()) { - $html .= '
' . PHP_EOL; + if ($this->_isPdf && $pSheet->getShowGridlines()) { + $html .= '
' . PHP_EOL; } else { - $html .= '
' . PHP_EOL; + $html .= '
' . PHP_EOL; } } @@ -938,7 +1057,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { /** * Generate table footer * - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _generateTableFooter() { // Construct HTML @@ -956,7 +1075,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { * @param array $pValues Array containing cells in a row * @param int $pRow Row number (0-based) * @return string - * @throws Exception + * @throws PHPExcel_Writer_Exception */ private function _generateRow(PHPExcel_Worksheet $pSheet, $pValues = null, $pRow = 0) { if (is_array($pValues)) { @@ -995,9 +1114,9 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { // Write cells $colNum = 0; - foreach ($pValues as $cell) { + foreach ($pValues as $cellAddress) { + $cell = ($cellAddress > '') ? $pSheet->getCell($cellAddress) : ''; $coordinate = PHPExcel_Cell::stringFromColumnIndex($colNum) . ($pRow + 1); - if (!$this->_useInlineCss) { $cssClass = ''; $cssClass = 'column' . $colNum; @@ -1011,10 +1130,11 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { $rowSpan = 1; // initialize - $cellData = ''; + $cellData = ' '; // PHPExcel_Cell if ($cell instanceof PHPExcel_Cell) { + $cellData = ''; if (is_null($cell->getParent())) { $cell->attach($pSheet); } @@ -1112,6 +1232,13 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { $spans = $this->_isBaseCell[$pSheet->getParent()->getIndex($pSheet)][$pRow + 1][$colNum]; $rowSpan = $spans['rowspan']; $colSpan = $spans['colspan']; + + // Also apply style from last cell in merge to fix borders - + // relies on !important for non-none border declarations in _createCSSStyleBorder + $endCellCoord = PHPExcel_Cell::stringFromColumnIndex($colNum + $colSpan - 1) . ($pRow + $rowSpan); + if (!$this->_useInlineCss) { + $cssClass .= ' style' . $pSheet->getCell($endCellCoord)->getXfIndex(); + } } // Write @@ -1153,7 +1280,12 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { $html .= '>'; // Image? - $html .= $this->_writeImageTagInCell($pSheet, $coordinate); + $html .= $this->_writeImageInCell($pSheet, $coordinate); + + // Chart? + if ($this->_includeCharts) { + $html .= $this->_writeChartInCell($pSheet, $coordinate); + } // Cell data $html .= $cellData; @@ -1172,7 +1304,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { // Return return $html; } else { - throw new Exception("Invalid parameters passed."); + throw new PHPExcel_Writer_Exception("Invalid parameters passed."); } } @@ -1193,26 +1325,6 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { return $string; } - /** - * Get Pre-Calculate Formulas - * - * @return boolean - */ - public function getPreCalculateFormulas() { - return $this->_preCalculateFormulas; - } - - /** - * Set Pre-Calculate Formulas - * - * @param boolean $pValue Pre-Calculate Formulas? - * @return PHPExcel_Writer_HTML - */ - public function setPreCalculateFormulas($pValue = true) { - $this->_preCalculateFormulas = $pValue; - return $this; - } - /** * Get images root * @@ -1233,6 +1345,26 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { return $this; } + /** + * Get embed images + * + * @return boolean + */ + public function getEmbedImages() { + return $this->_embedImages; + } + + /** + * Set embed images + * + * @param boolean $pValue + * @return PHPExcel_Writer_HTML + */ + public function setEmbedImages($pValue = '.') { + $this->_embedImages = $pValue; + return $this; + } + /** * Get use inline CSS? * @@ -1374,4 +1506,27 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter { $this->_spansAreCalculated = true; } + private function _setMargins(PHPExcel_Worksheet $pSheet) { + $htmlPage = '@page { '; + $htmlBody = 'body { '; + + $left = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getLeft()) . 'in; '; + $htmlPage .= 'left-margin: ' . $left; + $htmlBody .= 'left-margin: ' . $left; + $right = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getRight()) . 'in; '; + $htmlPage .= 'right-margin: ' . $right; + $htmlBody .= 'right-margin: ' . $right; + $top = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getTop()) . 'in; '; + $htmlPage .= 'top-margin: ' . $top; + $htmlBody .= 'top-margin: ' . $top; + $bottom = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getBottom()) . 'in; '; + $htmlPage .= 'bottom-margin: ' . $bottom; + $htmlBody .= 'bottom-margin: ' . $bottom; + + $htmlPage .= "}\n"; + $htmlBody .= "}\n"; + + return "\n"; + } + } diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/IWriter.php b/htdocs/includes/phpexcel/PHPExcel/Writer/IWriter.php index af97f0778ce..6974c93c875 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/IWriter.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/IWriter.php @@ -1,45 +1,46 @@ _renderer = new $rendererName($phpExcel); - } + $rendererName = 'PHPExcel_Writer_PDF_' . $pdfLibraryName; + $this->_renderer = new $rendererName($phpExcel); + } + /** + * Magic method to handle direct calls to the configured PDF renderer wrapper class. + * + * @param string $name Renderer library method name + * @param mixed[] $arguments Array of arguments to pass to the renderer method + * @return mixed Returned data from the PDF renderer wrapper method + */ public function __call($name, $arguments) { if ($this->_renderer === NULL) { - throw new Exception("PDF Renderer has not been defined."); + throw new PHPExcel_Writer_Exception("PDF Rendering library has not been defined."); } - return call_user_func_array(array($this->_renderer,$name),$arguments); + return call_user_func_array(array($this->_renderer, $name), $arguments); } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/PDF/Core.php b/htdocs/includes/phpexcel/PHPExcel/Writer/PDF/Core.php index b9154ac6bee..3b281f4e582 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/PDF/Core.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/PDF/Core.php @@ -1,239 +1,364 @@ 'LETTER', // (8.5 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_SMALL => 'LETTER', // (8.5 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_TABLOID => array(792.00,1224.00), // (11 in. by 17 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEDGER => array(1224.00,792.00), // (17 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEGAL => 'LEGAL', // (8.5 in. by 14 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_STATEMENT => array(396.00,612.00), // (5.5 in. by 8.5 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_EXECUTIVE => 'EXECUTIVE', // (7.25 in. by 10.5 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3 => 'A3', // (297 mm by 420 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4 => 'A4', // (210 mm by 297 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_SMALL => 'A4', // (210 mm by 297 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A5 => 'A5', // (148 mm by 210 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_B4 => 'B4', // (250 mm by 353 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_B5 => 'B5', // (176 mm by 250 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_FOLIO => 'FOLIO', // (8.5 in. by 13 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_QUARTO => array(609.45,779.53), // (215 mm by 275 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_1 => array(720.00,1008.00), // (10 in. by 14 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_2 => array(792.00,1224.00), // (11 in. by 17 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_NOTE => 'LETTER', // (8.5 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO9_ENVELOPE => array(279.00,639.00), // (3.875 in. by 8.875 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO10_ENVELOPE => array(297.00,684.00), // (4.125 in. by 9.5 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO11_ENVELOPE => array(324.00,747.00), // (4.5 in. by 10.375 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO12_ENVELOPE => array(342.00,792.00), // (4.75 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO14_ENVELOPE => array(360.00,828.00), // (5 in. by 11.5 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_C => array(1224.00,1584.00), // (17 in. by 22 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_D => array(1584.00,2448.00), // (22 in. by 34 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_E => array(2448.00,3168.00), // (34 in. by 44 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_DL_ENVELOPE => array(311.81,623.62), // (110 mm by 220 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_C5_ENVELOPE => 'C5', // (162 mm by 229 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_C3_ENVELOPE => 'C3', // (324 mm by 458 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_C4_ENVELOPE => 'C4', // (229 mm by 324 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_C6_ENVELOPE => 'C6', // (114 mm by 162 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_C65_ENVELOPE => array(323.15,649.13), // (114 mm by 229 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_B4_ENVELOPE => 'B4', // (250 mm by 353 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_B5_ENVELOPE => 'B5', // (176 mm by 250 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_B6_ENVELOPE => array(498.90,354.33), // (176 mm by 125 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_ITALY_ENVELOPE => array(311.81,651.97), // (110 mm by 230 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_MONARCH_ENVELOPE => array(279.00,540.00), // (3.875 in. by 7.5 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_6_3_4_ENVELOPE => array(261.00,468.00), // (3.625 in. by 6.5 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_US_STANDARD_FANFOLD => array(1071.00,792.00), // (14.875 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_GERMAN_STANDARD_FANFOLD => array(612.00,864.00), // (8.5 in. by 12 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_GERMAN_LEGAL_FANFOLD => 'FOLIO', // (8.5 in. by 13 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_ISO_B4 => 'B4', // (250 mm by 353 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_JAPANESE_DOUBLE_POSTCARD => array(566.93,419.53), // (200 mm by 148 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_1 => array(648.00,792.00), // (9 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_2 => array(720.00,792.00), // (10 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_3 => array(1080.00,792.00), // (15 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_INVITE_ENVELOPE => array(623.62,623.62), // (220 mm by 220 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_EXTRA_PAPER => array(667.80,864.00), // (9.275 in. by 12 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEGAL_EXTRA_PAPER => array(667.80,1080.00), // (9.275 in. by 15 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_TABLOID_EXTRA_PAPER => array(841.68,1296.00), // (11.69 in. by 18 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_EXTRA_PAPER => array(668.98,912.76), // (236 mm by 322 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_TRANSVERSE_PAPER => array(595.80,792.00), // (8.275 in. by 11 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_TRANSVERSE_PAPER => 'A4', // (210 mm by 297 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER => array(667.80,864.00), // (9.275 in. by 12 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_SUPERA_SUPERA_A4_PAPER => array(643.46,1009.13), // (227 mm by 356 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_SUPERB_SUPERB_A3_PAPER => array(864.57,1380.47), // (305 mm by 487 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_PLUS_PAPER => array(612.00,913.68), // (8.5 in. by 12.69 in.) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_PLUS_PAPER => array(595.28,935.43), // (210 mm by 330 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A5_TRANSVERSE_PAPER => 'A5', // (148 mm by 210 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_JIS_B5_TRANSVERSE_PAPER => array(515.91,728.50), // (182 mm by 257 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3_EXTRA_PAPER => array(912.76,1261.42), // (322 mm by 445 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A5_EXTRA_PAPER => array(493.23,666.14), // (174 mm by 235 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_ISO_B5_EXTRA_PAPER => array(569.76,782.36), // (201 mm by 276 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A2_PAPER => 'A2', // (420 mm by 594 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3_TRANSVERSE_PAPER => 'A3', // (297 mm by 420 mm) - PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER => array(912.76,1261.42) // (322 mm by 445 mm) - ); - - /** - * Create a new PHPExcel_Writer_PDF - * - * @param PHPExcel $phpExcel PHPExcel object - */ - public function __construct(PHPExcel $phpExcel) { - parent::__construct($phpExcel); - $this->setUseInlineCss(true); - $this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir(); - } +abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML +{ + /** + * Temporary storage directory + * + * @var string + */ + protected $_tempDir = ''; /** - * Get Font + * Font * - * @return string + * @var string */ - public function getFont() { - return $this->_font; - } - - /** - * Set font. Examples: - * 'arialunicid0-chinese-simplified' - * 'arialunicid0-chinese-traditional' - * 'arialunicid0-korean' - * 'arialunicid0-japanese' - * - * @param string $fontName - */ - public function setFont($fontName) { - $this->_font = $fontName; - return $this; - } + protected $_font = 'freesans'; /** - * Get Paper Size + * Orientation (Over-ride) * - * @return int + * @var string */ - public function getPaperSize() { - return $this->_paperSize; + protected $_orientation = NULL; + + /** + * Paper size (Over-ride) + * + * @var int + */ + protected $_paperSize = NULL; + + + /** + * Temporary storage for Save Array Return type + * + * @var string + */ + private $_saveArrayReturnType; + + /** + * Paper Sizes xRef List + * + * @var array + */ + protected static $_paperSizes = array( + PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER + => 'LETTER', // (8.5 in. by 11 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_SMALL + => 'LETTER', // (8.5 in. by 11 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_TABLOID + => array(792.00, 1224.00), // (11 in. by 17 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEDGER + => array(1224.00, 792.00), // (17 in. by 11 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEGAL + => 'LEGAL', // (8.5 in. by 14 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_STATEMENT + => array(396.00, 612.00), // (5.5 in. by 8.5 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_EXECUTIVE + => 'EXECUTIVE', // (7.25 in. by 10.5 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3 + => 'A3', // (297 mm by 420 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4 + => 'A4', // (210 mm by 297 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_SMALL + => 'A4', // (210 mm by 297 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_A5 + => 'A5', // (148 mm by 210 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_B4 + => 'B4', // (250 mm by 353 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_B5 + => 'B5', // (176 mm by 250 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_FOLIO + => 'FOLIO', // (8.5 in. by 13 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_QUARTO + => array(609.45, 779.53), // (215 mm by 275 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_1 + => array(720.00, 1008.00), // (10 in. by 14 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_2 + => array(792.00, 1224.00), // (11 in. by 17 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_NOTE + => 'LETTER', // (8.5 in. by 11 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO9_ENVELOPE + => array(279.00, 639.00), // (3.875 in. by 8.875 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO10_ENVELOPE + => array(297.00, 684.00), // (4.125 in. by 9.5 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO11_ENVELOPE + => array(324.00, 747.00), // (4.5 in. by 10.375 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO12_ENVELOPE + => array(342.00, 792.00), // (4.75 in. by 11 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO14_ENVELOPE + => array(360.00, 828.00), // (5 in. by 11.5 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_C + => array(1224.00, 1584.00), // (17 in. by 22 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_D + => array(1584.00, 2448.00), // (22 in. by 34 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_E + => array(2448.00, 3168.00), // (34 in. by 44 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_DL_ENVELOPE + => array(311.81, 623.62), // (110 mm by 220 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_C5_ENVELOPE + => 'C5', // (162 mm by 229 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_C3_ENVELOPE + => 'C3', // (324 mm by 458 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_C4_ENVELOPE + => 'C4', // (229 mm by 324 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_C6_ENVELOPE + => 'C6', // (114 mm by 162 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_C65_ENVELOPE + => array(323.15, 649.13), // (114 mm by 229 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_B4_ENVELOPE + => 'B4', // (250 mm by 353 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_B5_ENVELOPE + => 'B5', // (176 mm by 250 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_B6_ENVELOPE + => array(498.90, 354.33), // (176 mm by 125 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_ITALY_ENVELOPE + => array(311.81, 651.97), // (110 mm by 230 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_MONARCH_ENVELOPE + => array(279.00, 540.00), // (3.875 in. by 7.5 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_6_3_4_ENVELOPE + => array(261.00, 468.00), // (3.625 in. by 6.5 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_US_STANDARD_FANFOLD + => array(1071.00, 792.00), // (14.875 in. by 11 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_GERMAN_STANDARD_FANFOLD + => array(612.00, 864.00), // (8.5 in. by 12 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_GERMAN_LEGAL_FANFOLD + => 'FOLIO', // (8.5 in. by 13 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_ISO_B4 + => 'B4', // (250 mm by 353 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_JAPANESE_DOUBLE_POSTCARD + => array(566.93, 419.53), // (200 mm by 148 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_1 + => array(648.00, 792.00), // (9 in. by 11 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_2 + => array(720.00, 792.00), // (10 in. by 11 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_3 + => array(1080.00, 792.00), // (15 in. by 11 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_INVITE_ENVELOPE + => array(623.62, 623.62), // (220 mm by 220 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_EXTRA_PAPER + => array(667.80, 864.00), // (9.275 in. by 12 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEGAL_EXTRA_PAPER + => array(667.80, 1080.00), // (9.275 in. by 15 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_TABLOID_EXTRA_PAPER + => array(841.68, 1296.00), // (11.69 in. by 18 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_EXTRA_PAPER + => array(668.98, 912.76), // (236 mm by 322 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_TRANSVERSE_PAPER + => array(595.80, 792.00), // (8.275 in. by 11 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_TRANSVERSE_PAPER + => 'A4', // (210 mm by 297 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER + => array(667.80, 864.00), // (9.275 in. by 12 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_SUPERA_SUPERA_A4_PAPER + => array(643.46, 1009.13), // (227 mm by 356 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_SUPERB_SUPERB_A3_PAPER + => array(864.57, 1380.47), // (305 mm by 487 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_PLUS_PAPER + => array(612.00, 913.68), // (8.5 in. by 12.69 in.) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_PLUS_PAPER + => array(595.28, 935.43), // (210 mm by 330 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_A5_TRANSVERSE_PAPER + => 'A5', // (148 mm by 210 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_JIS_B5_TRANSVERSE_PAPER + => array(515.91, 728.50), // (182 mm by 257 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3_EXTRA_PAPER + => array(912.76, 1261.42), // (322 mm by 445 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_A5_EXTRA_PAPER + => array(493.23, 666.14), // (174 mm by 235 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_ISO_B5_EXTRA_PAPER + => array(569.76, 782.36), // (201 mm by 276 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_A2_PAPER + => 'A2', // (420 mm by 594 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3_TRANSVERSE_PAPER + => 'A3', // (297 mm by 420 mm) + PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER + => array(912.76, 1261.42) // (322 mm by 445 mm) + ); + + /** + * Create a new PHPExcel_Writer_PDF + * + * @param PHPExcel $phpExcel PHPExcel object + */ + public function __construct(PHPExcel $phpExcel) + { + parent::__construct($phpExcel); + $this->setUseInlineCss(TRUE); + $this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir(); } /** - * Set Paper Size + * Get Font * - * @param int $pValue - * @return PHPExcel_Writer_PDF + * @return string */ - public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER) { - $this->_paperSize = $pValue; - return $this; + public function getFont() + { + return $this->_font; } /** - * Get Orientation + * Set font. Examples: + * 'arialunicid0-chinese-simplified' + * 'arialunicid0-chinese-traditional' + * 'arialunicid0-korean' + * 'arialunicid0-japanese' * - * @return string + * @param string $fontName */ - public function getOrientation() { - return $this->_orientation; + public function setFont($fontName) + { + $this->_font = $fontName; + return $this; } /** - * Set Orientation + * Get Paper Size * - * @param string $pValue - * @return PHPExcel_Writer_PDF + * @return int */ - public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) { - $this->_orientation = $pValue; - return $this; + public function getPaperSize() + { + return $this->_paperSize; } - /** - * Get temporary storage directory - * - * @return string - */ - public function getTempDir() { - return $this->_tempDir; - } + /** + * Set Paper Size + * + * @param string $pValue Paper size + * @return PHPExcel_Writer_PDF + */ + public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER) + { + $this->_paperSize = $pValue; + return $this; + } + + /** + * Get Orientation + * + * @return string + */ + public function getOrientation() + { + return $this->_orientation; + } + + /** + * Set Orientation + * + * @param string $pValue Page orientation + * @return PHPExcel_Writer_PDF + */ + public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) + { + $this->_orientation = $pValue; + return $this; + } + + /** + * Get temporary storage directory + * + * @return string + */ + public function getTempDir() + { + return $this->_tempDir; + } + + /** + * Set temporary storage directory + * + * @param string $pValue Temporary storage directory + * @throws PHPExcel_Writer_Exception when directory does not exist + * @return PHPExcel_Writer_PDF + */ + public function setTempDir($pValue = '') + { + if (is_dir($pValue)) { + $this->_tempDir = $pValue; + } else { + throw new PHPExcel_Writer_Exception("Directory does not exist: $pValue"); + } + return $this; + } + + /** + * Save PHPExcel to PDF file, pre-save + * + * @param string $pFilename Name of the file to save as + * @throws PHPExcel_Writer_Exception + */ + protected function prepareForSave($pFilename = NULL) + { + // garbage collect + $this->_phpExcel->garbageCollect(); + + $this->_saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); + PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); + + // Open file + $fileHandle = fopen($pFilename, 'w'); + if ($fileHandle === FALSE) { + throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing."); + } + + // Set PDF + $this->_isPdf = TRUE; + // Build CSS + $this->buildCSS(TRUE); + + return $fileHandle; + } + + /** + * Save PHPExcel to PDF file, post-save + * + * @param resource $fileHandle + * @throws PHPExcel_Writer_Exception + */ + protected function restoreStateAfterSave($fileHandle) + { + // Close file + fclose($fileHandle); + + PHPExcel_Calculation::setArrayReturnType($this->_saveArrayReturnType); + } - /** - * Set temporary storage directory - * - * @param string $pValue Temporary storage directory - * @throws Exception Exception when directory does not exist - * @return PHPExcel_Writer_PDF - */ - public function setTempDir($pValue = '') { - if (is_dir($pValue)) { - $this->_tempDir = $pValue; - } else { - throw new Exception("Directory does not exist: $pValue"); - } - return $this; - } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/PDF/DomPDF.php b/htdocs/includes/phpexcel/PHPExcel/Writer/PDF/DomPDF.php index a8ab4efd945..111dd36078c 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/PDF/DomPDF.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/PDF/DomPDF.php @@ -1,128 +1,120 @@ _phpExcel->garbageCollect(); + /** + * Save PHPExcel to file + * + * @param string $pFilename Name of the file to save as + * @throws PHPExcel_Writer_Exception + */ + public function save($pFilename = NULL) + { + $fileHandle = parent::prepareForSave($pFilename); - $saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); - PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); + // Default PDF paper size + $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) - // Open file - $fileHandle = fopen($pFilename, 'w'); - if ($fileHandle === false) { - throw new Exception("Could not open file $pFilename for writing."); - } + // Check for paper size and page orientation + if (is_null($this->getSheetIndex())) { + $orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() + == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) + ? 'L' + : 'P'; + $printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize(); + $printMargins = $this->_phpExcel->getSheet(0)->getPageMargins(); + } else { + $orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() + == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) + ? 'L' + : 'P'; + $printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); + $printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins(); + } - // Set PDF - $this->_isPdf = true; - // Build CSS - $this->buildCSS(true); + // Override Page Orientation + if (!is_null($this->getOrientation())) { + $orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) + ? PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT + : $this->getOrientation(); + } + // Override Paper Size + if (!is_null($this->getPaperSize())) { + $printPaperSize = $this->getPaperSize(); + } - // Default PDF paper size - $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) + if (isset(self::$_paperSizes[$printPaperSize])) { + $paperSize = self::$_paperSizes[$printPaperSize]; + } - // Check for paper size and page orientation - if (is_null($this->getSheetIndex())) { - $orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; - $printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize(); - $printMargins = $this->_phpExcel->getSheet(0)->getPageMargins(); - } else { - $orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; - $printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); - $printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins(); - } + $orientation = ($orientation == 'L') ? 'landscape' : 'portrait'; - // Override Page Orientation - if (!is_null($this->getOrientation())) { - $orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) ? - PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT : $this->getOrientation(); - } - // Override Paper Size - if (!is_null($this->getPaperSize())) { - $printPaperSize = $this->getPaperSize(); - } + // Create PDF + $pdf = new DOMPDF(); + $pdf->set_paper(strtolower($paperSize), $orientation); - if (isset(self::$_paperSizes[$printPaperSize])) { - $paperSize = self::$_paperSizes[$printPaperSize]; - } + $pdf->load_html( + $this->generateHTMLHeader(FALSE) . + $this->generateSheetData() . + $this->generateHTMLFooter() + ); + $pdf->render(); - $orientation = ($orientation == 'L') ? 'landscape' : 'portrait'; + // Write to file + fwrite($fileHandle, $pdf->output()); - // Create PDF - $pdf = new DOMPDF(); - $pdf->set_paper(strtolower($paperSize), $orientation); - - $pdf->load_html( - $this->generateHTMLHeader(false) . - $this->generateSheetData() . - $this->generateHTMLFooter() - ); - $pdf->render(); - - // Write to file - fwrite($fileHandle, $pdf->output()); - - // Close file - fclose($fileHandle); - - PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType); - } + parent::restoreStateAfterSave($fileHandle); + } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/PDF/mPDF.php b/htdocs/includes/phpexcel/PHPExcel/Writer/PDF/mPDF.php index 5f9f2a350fc..8e274f4ce79 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/PDF/mPDF.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/PDF/mPDF.php @@ -1,135 +1,130 @@ _phpExcel->garbageCollect(); + /** + * Save PHPExcel to file + * + * @param string $pFilename Name of the file to save as + * @throws PHPExcel_Writer_Exception + */ + public function save($pFilename = NULL) + { + $fileHandle = parent::prepareForSave($pFilename); - $saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); - PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); + // Default PDF paper size + $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) - // Open file - $fileHandle = fopen($pFilename, 'w'); - if ($fileHandle === false) { - throw new Exception("Could not open file $pFilename for writing."); - } + // Check for paper size and page orientation + if (is_null($this->getSheetIndex())) { + $orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() + == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) + ? 'L' + : 'P'; + $printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize(); + $printMargins = $this->_phpExcel->getSheet(0)->getPageMargins(); + } else { + $orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() + == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) + ? 'L' + : 'P'; + $printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); + $printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins(); + } + $this->setOrientation($orientation); - // Set PDF - $this->_isPdf = true; - // Build CSS - $this->buildCSS(true); + // Override Page Orientation + if (!is_null($this->getOrientation())) { + $orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) + ? PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT + : $this->getOrientation(); + } + $orientation = strtoupper($orientation); - // Default PDF paper size - $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) + // Override Paper Size + if (!is_null($this->getPaperSize())) { + $printPaperSize = $this->getPaperSize(); + } - // Check for paper size and page orientation - if (is_null($this->getSheetIndex())) { - $orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; - $printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize(); - $printMargins = $this->_phpExcel->getSheet(0)->getPageMargins(); - } else { - $orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; - $printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); - $printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins(); - } - $this->setOrientation($orientation); + if (isset(self::$_paperSizes[$printPaperSize])) { + $paperSize = self::$_paperSizes[$printPaperSize]; + } - // Override Page Orientation - if (!is_null($this->getOrientation())) { - $orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) ? - PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT : $this->getOrientation(); - } - $orientation = strtoupper($orientation); - - // Override Paper Size - if (!is_null($this->getPaperSize())) { - $printPaperSize = $this->getPaperSize(); - } - - if (isset(self::$_paperSizes[$printPaperSize])) { - $paperSize = self::$_paperSizes[$printPaperSize]; - } - - // Create PDF - $pdf = new mpdf(); - $pdf->_setPageSize(strtoupper($paperSize), $orientation); + // Create PDF + $pdf = new mpdf(); + $ortmp = $orientation; + $pdf->_setPageSize(strtoupper($paperSize), $ortmp); $pdf->DefOrientation = $orientation; - // Document info - $pdf->SetTitle($this->_phpExcel->getProperties()->getTitle()); - $pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator()); - $pdf->SetSubject($this->_phpExcel->getProperties()->getSubject()); - $pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords()); - $pdf->SetCreator($this->_phpExcel->getProperties()->getCreator()); + $pdf->AddPage($orientation); - $pdf->WriteHTML( - $this->generateHTMLHeader(false) . - $this->generateSheetData() . - $this->generateHTMLFooter() - ); + // Document info + $pdf->SetTitle($this->_phpExcel->getProperties()->getTitle()); + $pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator()); + $pdf->SetSubject($this->_phpExcel->getProperties()->getSubject()); + $pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords()); + $pdf->SetCreator($this->_phpExcel->getProperties()->getCreator()); - // Write to file - fwrite($fileHandle, $pdf->Output('','S')); + $pdf->WriteHTML( + $this->generateHTMLHeader(FALSE) . + $this->generateSheetData() . + $this->generateHTMLFooter() + ); - // Close file - fclose($fileHandle); + // Write to file + fwrite($fileHandle, $pdf->Output('', 'S')); - PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType); - } + parent::restoreStateAfterSave($fileHandle); + } } diff --git a/htdocs/includes/phpexcel/PHPExcel/Writer/PDF/tcPDF.php b/htdocs/includes/phpexcel/PHPExcel/Writer/PDF/tcPDF.php index d77ab91a9fc..c3809ec750c 100644 --- a/htdocs/includes/phpexcel/PHPExcel/Writer/PDF/tcPDF.php +++ b/htdocs/includes/phpexcel/PHPExcel/Writer/PDF/tcPDF.php @@ -1,147 +1,136 @@ _phpExcel->garbageCollect(); + /** + * Save PHPExcel to file + * + * @param string $pFilename Name of the file to save as + * @throws PHPExcel_Writer_Exception + */ + public function save($pFilename = NULL) + { + $fileHandle = parent::prepareForSave($pFilename); - $saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); - PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); + // Default PDF paper size + $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) - // Open file - $fileHandle = fopen($pFilename, 'w'); - if ($fileHandle === false) { - throw new Exception("Could not open file $pFilename for writing."); - } + // Check for paper size and page orientation + if (is_null($this->getSheetIndex())) { + $orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() + == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) + ? 'L' + : 'P'; + $printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize(); + $printMargins = $this->_phpExcel->getSheet(0)->getPageMargins(); + } else { + $orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() + == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) + ? 'L' + : 'P'; + $printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); + $printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins(); + } - // Set PDF - $this->_isPdf = true; - // Build CSS - $this->buildCSS(true); + // Override Page Orientation + if (!is_null($this->getOrientation())) { + $orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) + ? 'L' + : 'P'; + } + // Override Paper Size + if (!is_null($this->getPaperSize())) { + $printPaperSize = $this->getPaperSize(); + } - // Default PDF paper size - $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) - - // Check for paper size and page orientation - if (is_null($this->getSheetIndex())) { - $orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; - $printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize(); - $printMargins = $this->_phpExcel->getSheet(0)->getPageMargins(); - } else { - $orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; - $printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); - $printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins(); - } - - // Override Page Orientation - if (!is_null($this->getOrientation())) { - $orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? - 'L' : 'P'; - } - // Override Paper Size - if (!is_null($this->getPaperSize())) { - $printPaperSize = $this->getPaperSize(); - } + if (isset(self::$_paperSizes[$printPaperSize])) { + $paperSize = self::$_paperSizes[$printPaperSize]; + } - if (isset(self::$_paperSizes[$printPaperSize])) { - $paperSize = self::$_paperSizes[$printPaperSize]; - } + // Create PDF + $pdf = new TCPDF($orientation, 'pt', $paperSize); + $pdf->setFontSubsetting(FALSE); + // Set margins, converting inches to points (using 72 dpi) + $pdf->SetMargins($printMargins->getLeft() * 72, $printMargins->getTop() * 72, $printMargins->getRight() * 72); + $pdf->SetAutoPageBreak(TRUE, $printMargins->getBottom() * 72); + $pdf->setPrintHeader(FALSE); + $pdf->setPrintFooter(FALSE); - // Create PDF - $pdf = new TCPDF($orientation, 'pt', $paperSize); - $pdf->setFontSubsetting(false); - // Set margins, converting inches to points (using 72 dpi) - $pdf->SetMargins($printMargins->getLeft() * 72,$printMargins->getTop() * 72,$printMargins->getRight() * 72); - $pdf->SetAutoPageBreak(true,$printMargins->getBottom() * 72); -// $pdf->setHeaderMargin($printMargins->getHeader() * 72); -// $pdf->setFooterMargin($printMargins->getFooter() * 72); + $pdf->AddPage(); - $pdf->setPrintHeader(false); - $pdf->setPrintFooter(false); + // Set the appropriate font + $pdf->SetFont($this->getFont()); + $pdf->writeHTML( + $this->generateHTMLHeader(FALSE) . + $this->generateSheetData() . + $this->generateHTMLFooter() + ); - $pdf->AddPage(); + // Document info + $pdf->SetTitle($this->_phpExcel->getProperties()->getTitle()); + $pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator()); + $pdf->SetSubject($this->_phpExcel->getProperties()->getSubject()); + $pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords()); + $pdf->SetCreator($this->_phpExcel->getProperties()->getCreator()); - // Set the appropriate font - $pdf->SetFont($this->getFont()); - $pdf->writeHTML( - $this->generateHTMLHeader(false) . - $this->generateSheetData() . - $this->generateHTMLFooter() - ); + // Write to file + fwrite($fileHandle, $pdf->output($pFilename, 'S')); - // Document info - $pdf->SetTitle($this->_phpExcel->getProperties()->getTitle()); - $pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator()); - $pdf->SetSubject($this->_phpExcel->getProperties()->getSubject()); - $pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords()); - $pdf->SetCreator($this->_phpExcel->getProperties()->getCreator()); - - // Write to file - fwrite($fileHandle, $pdf->output($pFilename, 'S')); - - // Close file - fclose($fileHandle); - - PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType); - } + parent::restoreStateAfterSave($fileHandle); + } } diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/bg/config b/htdocs/includes/phpexcel/PHPExcel/locale/bg/config new file mode 100644 index 00000000000..d7ecb2b2ab1 --- /dev/null +++ b/htdocs/includes/phpexcel/PHPExcel/locale/bg/config @@ -0,0 +1,49 @@ +## +## PHPExcel +## + +## Copyright (c) 2006 - 2013 PHPExcel +## +## This library is free software; you can redistribute it and/or +## modify it under the terms of the GNU Lesser General Public +## License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## +## This library 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 +## Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public +## License along with this library; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +## +## @category PHPExcel +## @package PHPExcel_Settings +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) +## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL +## @version 1.8.0, 2014-03-02 +## +## + + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = лв + + +## +## Excel Error Codes (For future use) + +## +NULL = #ПРАЗНО! +DIV0 = #ДЕЛ/0! +VALUE = #СТОЙНОСТ! +REF = #РЕФ! +NAME = #ИМЕ? +NUM = #ЧИСЛО! +NA = #Н/Д diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/cs/config b/htdocs/includes/phpexcel/PHPExcel/locale/cs/config index 38a44128e27..af4589b0955 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/cs/config +++ b/htdocs/includes/phpexcel/PHPExcel/locale/cs/config @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/cs/functions b/htdocs/includes/phpexcel/PHPExcel/locale/cs/functions index 992dc37535e..f324759d247 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/cs/functions +++ b/htdocs/includes/phpexcel/PHPExcel/locale/cs/functions @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Calculation -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/ ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/da/config b/htdocs/includes/phpexcel/PHPExcel/locale/da/config index 49292f1cf67..1ddecb936f4 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/da/config +++ b/htdocs/includes/phpexcel/PHPExcel/locale/da/config @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/da/functions b/htdocs/includes/phpexcel/PHPExcel/locale/da/functions index affc19a1ac2..102d57843e7 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/da/functions +++ b/htdocs/includes/phpexcel/PHPExcel/locale/da/functions @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Calculation -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/ ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/de/config b/htdocs/includes/phpexcel/PHPExcel/locale/de/config index 95193498fe6..c9972751661 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/de/config +++ b/htdocs/includes/phpexcel/PHPExcel/locale/de/config @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/de/functions b/htdocs/includes/phpexcel/PHPExcel/locale/de/functions index 1c19c5b22ce..8ce08de4d5d 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/de/functions +++ b/htdocs/includes/phpexcel/PHPExcel/locale/de/functions @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Calculation -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/ ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/en/uk/config b/htdocs/includes/phpexcel/PHPExcel/locale/en/uk/config index 1bcfcb2b79c..dfcc63b0e8f 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/en/uk/config +++ b/htdocs/includes/phpexcel/PHPExcel/locale/en/uk/config @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/es/config b/htdocs/includes/phpexcel/PHPExcel/locale/es/config index 039f5b8c877..0b11eb7af07 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/es/config +++ b/htdocs/includes/phpexcel/PHPExcel/locale/es/config @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/es/functions b/htdocs/includes/phpexcel/PHPExcel/locale/es/functions index 9d47f0e491a..f6e6fd2b6b3 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/es/functions +++ b/htdocs/includes/phpexcel/PHPExcel/locale/es/functions @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Calculation -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/ ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/fi/config b/htdocs/includes/phpexcel/PHPExcel/locale/fi/config index ba274e1d5c2..380f39793d7 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/fi/config +++ b/htdocs/includes/phpexcel/PHPExcel/locale/fi/config @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/fi/functions b/htdocs/includes/phpexcel/PHPExcel/locale/fi/functions index 25e08eacd35..bf60bec0012 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/fi/functions +++ b/htdocs/includes/phpexcel/PHPExcel/locale/fi/functions @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Calculation -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/ ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/fr/config b/htdocs/includes/phpexcel/PHPExcel/locale/fr/config index 8ae183a698a..368b3c3cc3d 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/fr/config +++ b/htdocs/includes/phpexcel/PHPExcel/locale/fr/config @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/fr/functions b/htdocs/includes/phpexcel/PHPExcel/locale/fr/functions index ebb8339b6ac..e85dba5b89a 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/fr/functions +++ b/htdocs/includes/phpexcel/PHPExcel/locale/fr/functions @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Calculation -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/ ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/hu/config b/htdocs/includes/phpexcel/PHPExcel/locale/hu/config index 725b5698f2a..e04151cb8a7 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/hu/config +++ b/htdocs/includes/phpexcel/PHPExcel/locale/hu/config @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/hu/functions b/htdocs/includes/phpexcel/PHPExcel/locale/hu/functions index a3855c066e5..77cae928e60 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/hu/functions +++ b/htdocs/includes/phpexcel/PHPExcel/locale/hu/functions @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Calculation -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/ ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/it/config b/htdocs/includes/phpexcel/PHPExcel/locale/it/config index 5baad5378d6..94499fe2767 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/it/config +++ b/htdocs/includes/phpexcel/PHPExcel/locale/it/config @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/it/functions b/htdocs/includes/phpexcel/PHPExcel/locale/it/functions index 3d092048130..033b9696420 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/it/functions +++ b/htdocs/includes/phpexcel/PHPExcel/locale/it/functions @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Calculation -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/ ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/nl/config b/htdocs/includes/phpexcel/PHPExcel/locale/nl/config index d56b38fdbf7..00c1b0ff592 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/nl/config +++ b/htdocs/includes/phpexcel/PHPExcel/locale/nl/config @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/nl/functions b/htdocs/includes/phpexcel/PHPExcel/locale/nl/functions index 6e941216d13..63800086167 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/nl/functions +++ b/htdocs/includes/phpexcel/PHPExcel/locale/nl/functions @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Calculation -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/ ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/no/config b/htdocs/includes/phpexcel/PHPExcel/locale/no/config index 482e4bc4464..5bf96a1b18a 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/no/config +++ b/htdocs/includes/phpexcel/PHPExcel/locale/no/config @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/no/functions b/htdocs/includes/phpexcel/PHPExcel/locale/no/functions index eb5ae02dd27..917c7f7d79a 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/no/functions +++ b/htdocs/includes/phpexcel/PHPExcel/locale/no/functions @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Calculation -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/ ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/pl/config b/htdocs/includes/phpexcel/PHPExcel/locale/pl/config index 6823761e012..5061311c85d 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/pl/config +++ b/htdocs/includes/phpexcel/PHPExcel/locale/pl/config @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/pl/functions b/htdocs/includes/phpexcel/PHPExcel/locale/pl/functions index 14858433784..14499c05926 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/pl/functions +++ b/htdocs/includes/phpexcel/PHPExcel/locale/pl/functions @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Calculation -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/ ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/pt/br/config b/htdocs/includes/phpexcel/PHPExcel/locale/pt/br/config index b8e696454aa..b4bf7041d22 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/pt/br/config +++ b/htdocs/includes/phpexcel/PHPExcel/locale/pt/br/config @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/pt/br/functions b/htdocs/includes/phpexcel/PHPExcel/locale/pt/br/functions index 11d45f1fd77..a062a7fad51 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/pt/br/functions +++ b/htdocs/includes/phpexcel/PHPExcel/locale/pt/br/functions @@ -1,4 +1,4 @@ -## +## ## Add-in and Automation functions Funções Suplemento e Automação ## GETPIVOTDATA = INFODADOSTABELADINÂMICA ## Retorna os dados armazenados em um relatório de tabela dinâmica diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/pt/config b/htdocs/includes/phpexcel/PHPExcel/locale/pt/config index 595ee96835b..60b422bd4c7 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/pt/config +++ b/htdocs/includes/phpexcel/PHPExcel/locale/pt/config @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/pt/functions b/htdocs/includes/phpexcel/PHPExcel/locale/pt/functions index 05e8bcaea7d..ba4eb471bad 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/pt/functions +++ b/htdocs/includes/phpexcel/PHPExcel/locale/pt/functions @@ -1,4 +1,4 @@ -## +## ## Add-in and Automation functions Funções de Suplemento e Automatização ## GETPIVOTDATA = OBTERDADOSDIN ## Devolve dados armazenados num relatório de Tabela Dinâmica diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/ru/config b/htdocs/includes/phpexcel/PHPExcel/locale/ru/config index aa7e685787b..6f6ace23116 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/ru/config +++ b/htdocs/includes/phpexcel/PHPExcel/locale/ru/config @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/ru/functions b/htdocs/includes/phpexcel/PHPExcel/locale/ru/functions index f37afc2491c..bd636861950 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/ru/functions +++ b/htdocs/includes/phpexcel/PHPExcel/locale/ru/functions @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Calculation -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## Data in this file derived from information provided by web-junior (http://www.web-junior.net/) ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/sv/config b/htdocs/includes/phpexcel/PHPExcel/locale/sv/config index 6a597781650..5d1a9a9fbde 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/sv/config +++ b/htdocs/includes/phpexcel/PHPExcel/locale/sv/config @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/sv/functions b/htdocs/includes/phpexcel/PHPExcel/locale/sv/functions index 27f61e7f834..73b2deb5eb2 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/sv/functions +++ b/htdocs/includes/phpexcel/PHPExcel/locale/sv/functions @@ -1,4 +1,4 @@ -## +## ## Add-in and Automation functions Tilläggs- och automatiseringsfunktioner ## GETPIVOTDATA = HÄMTA.PIVOTDATA ## Returnerar data som lagrats i en pivottabellrapport diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/tr/config b/htdocs/includes/phpexcel/PHPExcel/locale/tr/config index bd75af628ee..de69cf5872c 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/tr/config +++ b/htdocs/includes/phpexcel/PHPExcel/locale/tr/config @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Settings -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## diff --git a/htdocs/includes/phpexcel/PHPExcel/locale/tr/functions b/htdocs/includes/phpexcel/PHPExcel/locale/tr/functions index f8cd30fbd2e..c327bca4265 100644 --- a/htdocs/includes/phpexcel/PHPExcel/locale/tr/functions +++ b/htdocs/includes/phpexcel/PHPExcel/locale/tr/functions @@ -1,7 +1,7 @@ -## +## ## PHPExcel ## -## Copyright (c) 2006 - 2011 PHPExcel +## Copyright (c) 2006 - 2013 PHPExcel ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,9 @@ ## ## @category PHPExcel ## @package PHPExcel_Calculation -## @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel) +## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -## @version 1.7.8, 2012-10-12 +## @version 1.8.0, 2014-03-02 ## ## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/ ## diff --git a/htdocs/includes/phpexcel/changelog.txt b/htdocs/includes/phpexcel/changelog.txt index 3040d3438ca..a87065ab886 100644 --- a/htdocs/includes/phpexcel/changelog.txt +++ b/htdocs/includes/phpexcel/changelog.txt @@ -1,7 +1,7 @@ ************************************************************************************** * PHPExcel * -* Copyright (c) 2006 - 2012 PHPExcel +* Copyright (c) 2006 - 2014 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,61 +17,98 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * -* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) +* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -* @version 1.7.8, 2012-10-12 +* @version 1.8.0, 2014-03-02 ************************************************************************************** --------------------------------------------------------------------------------- -BREAKING CHANGE! As part of the planned changes for handling array formulae in -workbooks, there are some changes that will affect the PHPExcel_Cell object -methods. - -The following methods are now deprecated, and will be removed in version 1.7.9: - getCalculatedValue() The getValue() method will return calculated - values for cells containing formulae instead. - setCalculatedValue() The cell value will always contain the result of a - any formula calculation. - setFormulaAttributes() Will now be determined by the arguments to the - setFormula() method. - getFormulaAttributes() This will be replaced by the getArrayFormulaRange() - method. - -The following methods will be added in version 1.7.9 - getFormula() Use to retrieve a cell formula, will return the cell - value if the cell doesn't contain a formula, or - is not part of an array formula range. - setFormula() Use to set a cell formula. It will still be possible - to set formulae using the setValue() and - setValueExplicit() methods. - calculate() Use to execute a formula calculation to update the - cell value. - isFormula() Use to determine if a cell contains a formula, or is - part of an array formula range or not. - isArrayFormula() Use to determine if a cell contains an array formula, - or is part of an array formula range or not. - getArrayFormulaRange() Use to retrieve an array formula range. - -The following methods will be changed in version 1.7.9 - setValue() The logic behind this will be modified to store - formula values in the new cell property structure, - but it will still perform the same function. - setValueExplicit() The logic behind this will be modified to store - formula values in the new cell property structure, - but it will still perform the same function. - getValue() Will no longer return a formula if the cell contains - a formula, but will return the calculated value - instead. For cells that don't contain a formula, - it will still return the stored value. - getDataType() Will return the datatype of the calculated value for - cells that contain formulae. - setDataType() Error handling will be added to prevent setting a - cell datatype to an inappropriate value. --------------------------------------------------------------------------------- +2014-03-02 (v1.8.0): +- Bugfix: (MBaker) Work item CP19830 - Undefined variable: fileHandle in CSV Reader +- Bugfix: (MBaker) Work item CP19968 - Out of memory in style/supervisor.php +- Bugfix: (MBaker) - Style error with merged cells in PDF Writer +- Bugfix: (MBaker) - Problem with cloning worksheets +- Bugfix: (tavoarcila) Work Item GH-259 - Bug fix reading Open Office files +- Bugfix: (MBaker) Work item CP20397 - Serious bug in absolute cell reference used in shared formula + Would also have affected insert/delete column/row +- Bugfix: (RomanSyroeshko) Work Item GH-267 - CHOOSE() returns "#VALUE!" if the 1st entry is chosen +- Bugfix: (Gemorroj) Work Item GH-268 - When duplicating styles, styles shifted by one column to the right + Fix also applied to duplicating conditional styles +- Bugfix: (IndrekHaav) Work Item GH-212 - Fix for formulae that reference a sheet whose name begins with a digit: + these were erroneously identified as numeric values, causing the parser to throw an undefined variable error. +- Bugfix: (IndrekHaav) Work Item CP16208 - Fixed undefined variable error due to $styleArray being used before it's initialised +- Bugfix: (PowerKiKi) Work Item GH-273 - ISTEXT() return wrong result if referencing an empty but formatted cell +- Bugfix: (PowerKiKi) Work Item GH-270/GH-31 - Binary comparison of strings are case insensitive +- Bugfix: (MBaker) Work Item GH-275 - Insert New Row/Column Before is not correctly updating formula references +- Bugfix: (MBaker) Work Item GH-257 - Passing an array of cells to _generateRow() in the HTML/PDF Writer causes caching problems with last cell in the range +- Bugfix: (MBaker) Work Item GH-193 - Fix to empty worksheet garbage collection when using cell caching +- Bugfix: (Jazzo) Work Item GH-248 - Excel2007 does not correctly mark rows as hidden +- Bugfix: (Roy Shahbazian) Work Item GH-299 - Fixed typo in Chart/Layout set/getYMode() +- Bugfix: (EliuFlorez) Work item GH-279 - Fatal error: Call to a member function cellExists() line: 3327 in calculation.php if referenced worksheet doesn't exist +- Bugfix: (MBaker) Work Item GH-290 - AdvancedValueBinder "Division by zero"-error +- Bugfix: (MBaker) Work Item CP20604 - Adding Sheet to Workbook Bug +- Bugfix: (MBaker) Work item CP20703 - Calculation engine incorrectly evaluates empty cells as #VALUE +- Bugfix: (MBaker) Work item CP20760 - Formula references to cell on another sheet in ODS files +- Bugfix: (MBaker) Work item GH321,GH158,CP17824 - LibreOffice created XLSX files results in an empty file. +- Feature: (amerov) - Implementation of the Excel HLOOKUP() function +- Feature: (MBaker) - Added "Quote Prefix" to style settings (Excel2007 Reader and Writer only) +- Feature: (MBaker) - Added Horizontal FILL alignment for Excel5 and Excel2007 Readers/Writers, and Horizontal DISTRIBUTED alignment for Excel2007 Reader/Writer +- Feature: (trvrnrth) Work Item GH-261 - Add support for reading protected (RC4 encrypted) .xls files +- Feature: (LWol) Work Item GH-252 - Adding support for macros, Ribbon in Excel 2007 +- General: (cdhutch) Work item CP20055 - Remove array_shift in ReferenceHelper::insertNewBefore improves column or row delete speed +- General: (MBaker) - Improve stock chart handling and rendering, with help from Swashata Ghosh +- General: (MBaker) - Fix to calculation properties for Excel2007 so that the opening application will only recalculate on load if it's actually required +- General: (MBaker) - Modified Excel2007 Writer to default preCalculateFormulas to false + Note that autosize columns will still recalculate affected formulae internally +- General: (dresenhista) Work Item GH-242 - Functionality to getHighestRow() for a specified column, and getHighestColumn() for a specified row +- General: (adamriyadi) Work Item GH-247 - Modify PHPExcel_Reader_Excel2007 to use zipClass from PHPExcel_Settings::getZipClass() + This allows the use of PCLZip when reading for people that don't have access to ZipArchive +- General: (infojunkie) Work Item GH-276 - Convert properties to string in OOCalc reader +- Security: (maartenba) Work Item GH-322 - Disable libxml external entity loading by default. + This is to prevent XML External Entity Processing (XXE) injection attacks (see http://websec.io/2012/08/27/Preventing-XEE-in-PHP.html for an explanation of XXE injection). + Reference CVE-2014-2054 -Fixed in develop branch: +2013-06-02 (v1.7.9): +- Feature: (MBaker) Include charts option for HTML Writer +- Feature: (MBaker) Added composer file +- Feature: (MBaker) Added getStyle() method to Cell object +- Bugfix: (Asker) Work item 18777 - Error in PHPEXCEL/Calculation.php script on line 2976 (stack pop check) +- Bugfix: (MBaker) Work item 18794 - CSV files without a file extension being identified as HTML +- Bugfix: (AndreKR) Work item GH-66 - Wrong check for maximum number of rows in Excel5 Writer +- Bugfix: (MBaker) Work item GH-67 - Cache directory for DiscISAM cache storage cannot be set +- Bugfix: (MBaker) Work item 17976 - Fix to Excel2007 Reader for hyperlinks with an anchor fragment (following a #), otherwise they were treated as sheet references +- Bugfix: (MBaker) Work item 18963 - getSheetNames() fails on numeric (floating point style) names with trailing zeroes +- Bugfix: (MBaker) Work item GH-130 - Single cell print area +- General: (kea) Work item GH-69 - Improved AdvancedValueBinder for currency +- General: (MBaker) Work items 17936 and 17840 - Fix for environments where there is no access to /tmp but to upload_tmp_dir + Provided an option to set the sys_get_temp_dir() call to use the upload_tmp_dir; though by default the standard temp directory will still be used +- General: (amironov ) Work item GH-84 - Search style by identity in PHPExcel_Worksheet::duplicateStyle() +- General: (karak) Work item GH-85 - Fill SheetView IO in Excel5 +- General: (cfhay) Work item 18958 - Memory and Speed improvements in PHPExcel_Reader_Excel5 +- General: (MBaker) Work item GH-78 - Modify listWorksheetNames() and listWorksheetInfo to use XMLReader with streamed XML rather than SimpleXML +- General: (dbonsch) Restructuring of PHPExcel Exceptions +- General: (MBaker) Work items 16926 and 15145 - Refactor Calculation Engine from singleton to a Multiton + Ensures that calculation cache is maintained independently for different workbooks +- General: (MBaker) Modify cell's getCalculatedValue() method to return the content of RichText objects rather than the RichText object itself +- Bugfix: (techhead) Work item GH-70 - Fixed formula/formatting bug when removing rows +- Bugfix: (alexgann) Work item GH-63 - Fix to cellExists for non-existent namedRanges +- Bugfix: (MBaker) Work item 18844 - cache_in_memory_gzip "eats" last worksheet line, cache_in_memory doesn't +- Feature: (Progi1984) Work item GH-22 - Sheet View in Excel5 Writer +- Bugfix: (amironov) Work item GH-82 - PHPExcel_Worksheet::getCellCollection() may not return last cached cell +- Bugfix: (teso) Work item 18551 - Rich Text containing UTF-8 characters creating unreadable content with Excel5 Writer +- Bugfix: (MBaker) Work item GH-104 - echo statements in HTML.php +- Feature: (Progi1984) Work item GH-8/CP11704 : Conditional formatting in Excel 5 Writer +- Bugfix: (MBaker) Work item GH-113 - canRead() Error for GoogleDocs ODS files: in ODS files from Google Docs there is no mimetype file +- Bugfix: (MBaker) Work item GH-80 - "Sheet index is out of bounds." Exception +- Bugfix: (ccorliss) Work item GH-105 - Fixed number format fatal error +- Bugfix: (MBaker) - Add DROP TABLE in destructor for SQLite and SQLite3 cache controllers +- Bugfix: (alexgann) Work item GH-154 - Fix merged-cell borders on HTML/PDF output +- Bugfix: (Shanto) Work item GH-161 - Fix: Hyperlinks break when removing rows +- Bugfix: (neclimdul) Work item GH-166 - Fix Extra Table Row From Images and Charts + + +2012-10-12 (v1.7.8): - Special: (kkamkou) Phar builder script to add phar file as a distribution option - Feature: (MBaker) Refactor PDF Writer to allow use with a choice of PDF Rendering library rather than restricting to tcPDF @@ -140,7 +177,7 @@ Fixed in develop branch: - General: (MBaker) Reduce cell caching overhead using dirty flag to ensure that cells are only rewritten to the cache if they have actually been changed - General: (MBaker) Improved memory usage in CSV Writer - General: (MBaker) Improved speed and memory usage in Excel5 Writer -- General: (MBaker) Experimental - +- General: (MBaker) Experimental - Added getHighestDataColumn(), getHighestDataRow(), getHighestRowAndColumn() and calculateWorksheetDataDimension() methods for the worksheet that return the highest row and column that have cell records - General: (MBaker) Change iterators to implement Iterator rather than extend CachingIterator, as a fix for PHP 5.4. changes in SPL - Bugfix: (MBaker) Work item 15459 - Invalid cell coordinate in Autofilter for Excel2007 Writer diff --git a/htdocs/includes/phpexcel/install.txt b/htdocs/includes/phpexcel/install.txt index e52bcda8ef3..3fa420222f5 100644 --- a/htdocs/includes/phpexcel/install.txt +++ b/htdocs/includes/phpexcel/install.txt @@ -7,19 +7,19 @@ * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. -* +* * This library 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 * Lesser General Public License for more details. -* +* * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * -* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) +* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL -* @version 1.7.8, 2012-10-12 +* @version 1.8.0, 2014-03-02 ************************************************************************************** Requirements @@ -59,16 +59,16 @@ Getting started --------------- A good way to get started is to run some of the tests included in the download. -Copy the "Tests" folder next to your "Classes" folder from above so you end up with: +Copy the "Examples" folder next to your "Classes" folder from above so you end up with: -/var/www/Tests/01simple.php -/var/www/Tests/02types.php +/var/www/Examples/01simple.php +/var/www/Examples/02types.php ... Start running the test by pointing your browser to the test scripts: -http://example.com/Tests/01simple.php -http://example.com/Tests/02types.php +http://example.com/Examples/01simple.php +http://example.com/Examples/02types.php ... Note: It may be necessary to modify the include/require statements at the beginning of From dec277f30fed206763dce16dbac5e689e1595000 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Feb 2015 15:53:19 +0100 Subject: [PATCH 60/63] Accept h tags --- htdocs/theme/amarok/ckeditor/config.js | 18 ++++++++++-------- htdocs/theme/auguria/ckeditor/config.js | 14 ++++++++------ htdocs/theme/bureau2crea/ckeditor/config.js | 14 ++++++++------ htdocs/theme/cameleo/ckeditor/config.js | 15 +++++++++------ htdocs/theme/eldy/ckeditor/config.js | 6 +++--- 5 files changed, 38 insertions(+), 29 deletions(-) diff --git a/htdocs/theme/amarok/ckeditor/config.js b/htdocs/theme/amarok/ckeditor/config.js index 4243ac6e57e..97f1c0a0b62 100755 --- a/htdocs/theme/amarok/ckeditor/config.js +++ b/htdocs/theme/amarok/ckeditor/config.js @@ -24,8 +24,8 @@ CKEDITOR.editorConfig = function( config ) config.fullPage = false; // Not a full html page string, just part of it config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)'; //config.contentsCss = '/css/mysitestyles.css'; - config.image_previewText=' '; - + config.image_previewText=' '; // Must no be empty + config.toolbar_Full = [ ['Source','-','Save','NewPage','Preview','-','Templates'], @@ -45,30 +45,33 @@ CKEDITOR.editorConfig = function( config ) ['Maximize', 'ShowBlocks','-','About'] ]; + // Used for mailing fields config.toolbar_dolibarr_mailings = [ ['Source','Maximize'], ['Cut','Copy','Paste','-','SpellChecker'], ['Undo','Redo','-','Find','Replace'], - ['Font','FontSize'], + ['Format','Font','FontSize'], ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], - ['NumberedList','BulletedList','Outdent','Indent'], + ['NumberedList','BulletedList','Outdent','Indent','CreateDiv'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['Link','Unlink','Anchor','Image','Table','HorizontalRule','SpecialChar'] ]; + // Used for notes fields config.toolbar_dolibarr_notes = [ - ['Source'], + ['Source','Maximize'], ['Cut','Copy','Paste','-','SpellChecker'], ['Undo','Redo','-','Find','Replace'], - ['Font','FontSize'], + ['Format','Font','FontSize'], ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], ['NumberedList','BulletedList','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['Link','Unlink','Image','Table','HorizontalRule','SpecialChar'] ]; + // Used for details lines config.toolbar_dolibarr_details = [ ['Source','Maximize'], @@ -77,7 +80,7 @@ CKEDITOR.editorConfig = function( config ) ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], ['NumberedList','BulletedList','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['SpecialChar'] + ['Link','Unlink','SpecialChar'] ]; // Used for mailing fields @@ -86,5 +89,4 @@ CKEDITOR.editorConfig = function( config ) ['Source','Maximize'], ['Find'] ]; - }; diff --git a/htdocs/theme/auguria/ckeditor/config.js b/htdocs/theme/auguria/ckeditor/config.js index fd4a34b0453..97f1c0a0b62 100644 --- a/htdocs/theme/auguria/ckeditor/config.js +++ b/htdocs/theme/auguria/ckeditor/config.js @@ -24,8 +24,8 @@ CKEDITOR.editorConfig = function( config ) config.fullPage = false; // Not a full html page string, just part of it config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)'; //config.contentsCss = '/css/mysitestyles.css'; - config.image_previewText=' '; - + config.image_previewText=' '; // Must no be empty + config.toolbar_Full = [ ['Source','-','Save','NewPage','Preview','-','Templates'], @@ -45,30 +45,33 @@ CKEDITOR.editorConfig = function( config ) ['Maximize', 'ShowBlocks','-','About'] ]; + // Used for mailing fields config.toolbar_dolibarr_mailings = [ ['Source','Maximize'], ['Cut','Copy','Paste','-','SpellChecker'], ['Undo','Redo','-','Find','Replace'], - ['Font','FontSize'], + ['Format','Font','FontSize'], ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], ['NumberedList','BulletedList','Outdent','Indent','CreateDiv'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['Link','Unlink','Anchor','Image','Table','HorizontalRule','SpecialChar'] ]; + // Used for notes fields config.toolbar_dolibarr_notes = [ - ['Source'], + ['Source','Maximize'], ['Cut','Copy','Paste','-','SpellChecker'], ['Undo','Redo','-','Find','Replace'], - ['Font','FontSize'], + ['Format','Font','FontSize'], ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], ['NumberedList','BulletedList','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['Link','Unlink','Image','Table','HorizontalRule','SpecialChar'] ]; + // Used for details lines config.toolbar_dolibarr_details = [ ['Source','Maximize'], @@ -86,5 +89,4 @@ CKEDITOR.editorConfig = function( config ) ['Source','Maximize'], ['Find'] ]; - }; diff --git a/htdocs/theme/bureau2crea/ckeditor/config.js b/htdocs/theme/bureau2crea/ckeditor/config.js index fd4a34b0453..97f1c0a0b62 100644 --- a/htdocs/theme/bureau2crea/ckeditor/config.js +++ b/htdocs/theme/bureau2crea/ckeditor/config.js @@ -24,8 +24,8 @@ CKEDITOR.editorConfig = function( config ) config.fullPage = false; // Not a full html page string, just part of it config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)'; //config.contentsCss = '/css/mysitestyles.css'; - config.image_previewText=' '; - + config.image_previewText=' '; // Must no be empty + config.toolbar_Full = [ ['Source','-','Save','NewPage','Preview','-','Templates'], @@ -45,30 +45,33 @@ CKEDITOR.editorConfig = function( config ) ['Maximize', 'ShowBlocks','-','About'] ]; + // Used for mailing fields config.toolbar_dolibarr_mailings = [ ['Source','Maximize'], ['Cut','Copy','Paste','-','SpellChecker'], ['Undo','Redo','-','Find','Replace'], - ['Font','FontSize'], + ['Format','Font','FontSize'], ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], ['NumberedList','BulletedList','Outdent','Indent','CreateDiv'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['Link','Unlink','Anchor','Image','Table','HorizontalRule','SpecialChar'] ]; + // Used for notes fields config.toolbar_dolibarr_notes = [ - ['Source'], + ['Source','Maximize'], ['Cut','Copy','Paste','-','SpellChecker'], ['Undo','Redo','-','Find','Replace'], - ['Font','FontSize'], + ['Format','Font','FontSize'], ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], ['NumberedList','BulletedList','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['Link','Unlink','Image','Table','HorizontalRule','SpecialChar'] ]; + // Used for details lines config.toolbar_dolibarr_details = [ ['Source','Maximize'], @@ -86,5 +89,4 @@ CKEDITOR.editorConfig = function( config ) ['Source','Maximize'], ['Find'] ]; - }; diff --git a/htdocs/theme/cameleo/ckeditor/config.js b/htdocs/theme/cameleo/ckeditor/config.js index 99d5d33fc5d..97f1c0a0b62 100644 --- a/htdocs/theme/cameleo/ckeditor/config.js +++ b/htdocs/theme/cameleo/ckeditor/config.js @@ -25,7 +25,7 @@ CKEDITOR.editorConfig = function( config ) config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)'; //config.contentsCss = '/css/mysitestyles.css'; config.image_previewText=' '; // Must no be empty - + config.toolbar_Full = [ ['Source','-','Save','NewPage','Preview','-','Templates'], @@ -45,30 +45,33 @@ CKEDITOR.editorConfig = function( config ) ['Maximize', 'ShowBlocks','-','About'] ]; + // Used for mailing fields config.toolbar_dolibarr_mailings = [ ['Source','Maximize'], ['Cut','Copy','Paste','-','SpellChecker'], ['Undo','Redo','-','Find','Replace'], - ['Font','FontSize'], + ['Format','Font','FontSize'], ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], ['NumberedList','BulletedList','Outdent','Indent','CreateDiv'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','Anchor','Image','Table','SpecialChar'] + ['Link','Unlink','Anchor','Image','Table','HorizontalRule','SpecialChar'] ]; + // Used for notes fields config.toolbar_dolibarr_notes = [ - ['Source'], + ['Source','Maximize'], ['Cut','Copy','Paste','-','SpellChecker'], ['Undo','Redo','-','Find','Replace'], - ['Font','FontSize'], + ['Format','Font','FontSize'], ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], ['NumberedList','BulletedList','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','Image','Table','SpecialChar'] + ['Link','Unlink','Image','Table','HorizontalRule','SpecialChar'] ]; + // Used for details lines config.toolbar_dolibarr_details = [ ['Source','Maximize'], diff --git a/htdocs/theme/eldy/ckeditor/config.js b/htdocs/theme/eldy/ckeditor/config.js index 150b75dbd54..97f1c0a0b62 100644 --- a/htdocs/theme/eldy/ckeditor/config.js +++ b/htdocs/theme/eldy/ckeditor/config.js @@ -25,7 +25,7 @@ CKEDITOR.editorConfig = function( config ) config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)'; //config.contentsCss = '/css/mysitestyles.css'; config.image_previewText=' '; // Must no be empty - + config.toolbar_Full = [ ['Source','-','Save','NewPage','Preview','-','Templates'], @@ -51,7 +51,7 @@ CKEDITOR.editorConfig = function( config ) ['Source','Maximize'], ['Cut','Copy','Paste','-','SpellChecker'], ['Undo','Redo','-','Find','Replace'], - ['Font','FontSize'], + ['Format','Font','FontSize'], ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], ['NumberedList','BulletedList','Outdent','Indent','CreateDiv'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], @@ -64,7 +64,7 @@ CKEDITOR.editorConfig = function( config ) ['Source','Maximize'], ['Cut','Copy','Paste','-','SpellChecker'], ['Undo','Redo','-','Find','Replace'], - ['Font','FontSize'], + ['Format','Font','FontSize'], ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], ['NumberedList','BulletedList','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], From 49cb36461c3792756c32160384a89bc357cac422 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Feb 2015 15:54:16 +0100 Subject: [PATCH 61/63] Typo --- htdocs/compta/prelevement/class/bonprelevement.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index b543cac104a..aa1ba197d74 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1629,7 +1629,7 @@ class BonPrelevement extends CommonObject * @param int $nombre 0 or 1 * @param float $total Total * @param string $CrLf End of line character - * @return string String with SEAP Sender + * @return string String with SEPA Sender */ function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n') { // SEPA INITIALISATION From ba80bbb29179d3d4c397687fe3b77607085a6a9c Mon Sep 17 00:00:00 2001 From: Sof Date: Fri, 20 Feb 2015 17:33:58 +0100 Subject: [PATCH 62/63] FIX; Unknown field 'sc.fk_soc' in field list --- htdocs/comm/prospect/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php index 896168baa80..999c212a80d 100644 --- a/htdocs/comm/prospect/list.php +++ b/htdocs/comm/prospect/list.php @@ -197,7 +197,7 @@ $form=new Form($db); $sql = "SELECT s.rowid, s.nom as name, s.zip, s.town, s.datec, s.status as status, s.code_client, s.client,"; $sql.= " st.libelle as stcomm, s.prefix_comm, s.fk_stcomm, s.fk_prospectlevel,"; $sql.= " d.nom as departement"; -if ((!$user->rights->societe->client->voir && !$socid) || $search_sale) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) +if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) $sql .= " FROM ".MAIN_DB_PREFIX."c_stcomm as st"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d on (d.rowid = s.fk_departement)"; From d2da098336e9193f45561e9f301bcc9651266e74 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 21 Feb 2015 10:00:31 +0100 Subject: [PATCH 63/63] Fixed example --- htdocs/conf/conf.php.example | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 681cecf1261..b94893a741a 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -204,7 +204,7 @@ $dolibarr_main_authentication='dolibarr'; //################## // dolibarr_main_force_https -// This parameter allows to force the HTTPS mode. +// This parameter allows to force the HTTPS mode. // 0 = No forced redirect // 1 = Force redirect to https, until SCRIPT_URI start with https into response // 2 = Force redirect to https, until SERVER["HTTPS"] is 'on' into response @@ -212,9 +212,9 @@ $dolibarr_main_authentication='dolibarr'; // Warning: If you enable this parameter, your web server must be configured to // respond URL with https protocol. // According to your web server setup, some values may works and other not. Try -// different values (1,2 or 'http://my.domain.com') if you experience problems. +// different values (1,2 or 'https://my.domain.com') if you experience problems. // Default value: 0 -// Possible values: 0, 1, 2 or 'http://my.domain.com' +// Possible values: 0, 1, 2 or 'https://my.domain.com' // Examples: // $dolibarr_main_force_https='0'; //