function testfetchBillingInformationOK() { $billing = WebfinanceMantis::fetchBillingInformation('2012-08-01', '2012-09-01'); $this->assertType('array', $billing); }
require_once '../inc/main.php'; $title = _('Mantis'); $roles = 'manager,accounting,employee'; require_once '../top.php'; require_once '../../lib/WebfinanceMantis.php'; must_login(); setlocale(LC_NUMERIC, "en_US.UTF8"); ?> <script type="text/javascript" language="javascript" src="/js/ask_confirmation.js"></script> <?php mysql_connect('localhost', 'root') or die(mysql_error()); mysql_query('SET character_set_results = utf8') or die(mysql_error()); $mantis = new WebfinanceMantis(); mysql_select_db('mantis') or die(mysql_error()); ?> <form action="fetchBillingInformation.php"> <select name="month"> <?php $year = isset($_GET['year']) ? $_GET['year'] : strftime('%Y', time()); $month = isset($_GET['month']) ? $_GET['month'] : strftime('%m', time()); for ($i = 1; $i <= 12; $i++) { $month_name = strftime('%B', mktime(0, 0, 0, $i, 1, 1)); $selected = ''; if ($i == $month) { $selected = 'selected'; } echo "<option value=\"{$i}\" {$selected}> {$month_name} </option>\n";
function syncProjectsAttributes() { $support_type2price = WebfinanceMantis::fetchSupportTypes(); // https://github.com/toggl/toggl_api_docs/blob/master/chapters/workspaces.md#get-workspace-projects $url = 'https://www.toggl.com/api/v8/workspaces/' . $this->_wid . '/projects'; // Fetch all projects foreach ($this->query($url, array(), 'GET') as $project) { if (!isset($support_type2price[$project['name']])) { continue; } # Make sure the 'rate' and 'billable' fields are correctly set if (empty($project['rate'])) { $project['rate'] = 0; } if ($project['rate'] != $support_type2price[$project['name']]) { $project_data = array('billable' => TRUE, 'rate' => $support_type2price[$project['name']]); $this->updateProject($project['id'], $project_data); } } }
$prenom = ""; if (isset($_POST['prenom'])) { $prenom = $_POST['prenom']; } $user_data = array("id_user" => $_POST['id_user'], "login" => $login, "first_name" => $prenom, "last_name" => $_POST['nom'], "password" => $_POST['password'], "email" => $emails, "role" => array("client"), "disabled" => "off", "admin" => "off"); if ($User->exists($id_user)) { $User->saveData($user_data); } else { $id_user = $User->createUser($user_data); } } $q = sprintf("UPDATE webfinance_clients SET " . "nom='%s',\n addr1='%s',\n addr2='%s',\n addr3='%s',\n cp='%s',\n\t ville='%s',\n rcs='%s',\n vat='%s',\n capital='%s',\n pays='%s',\n tel='%s',\n fax='%s',\n web='%s',\n\t email='%s',\n\t vat_number='%s',\n siren='%s',\n id_company_type='%d',\n id_user=%d,\n password='******',\n rib_titulaire='%s',\n id_mantis='%d',\n id_toggl='%d',\n supportHoursIncludedInContract='%s',\n language='%s',\n id_business_entity=%d,\n contract_signer = '%s',\n id_contract_signer_role = %d,\n invoice_delivery = '%s'\n WHERE id_client=%d", mysql_real_escape_string($nom), mysql_real_escape_string($addr1), mysql_real_escape_string($addr2), mysql_real_escape_string($addr3), mysql_real_escape_string($cp), mysql_real_escape_string($ville), mysql_real_escape_string($rcs), mysql_real_escape_string($vat), mysql_real_escape_string($capital), mysql_real_escape_string($pays), mysql_real_escape_string(removeSpace($tel)), mysql_real_escape_string(removeSpace($fax)), mysql_real_escape_string($web), mysql_real_escape_string($emails), mysql_real_escape_string($vat_number), mysql_real_escape_string($siren), mysql_real_escape_string($id_company_type), mysql_real_escape_string($_POST['id_user']), mysql_real_escape_string($password), mysql_real_escape_string($rib_titulaire), mysql_real_escape_string($id_mantis), mysql_real_escape_string($id_toggl), mysql_real_escape_string($supportHoursIncludedInContract), mysql_real_escape_string($clt_language), mysql_real_escape_string($id_business_entity), mysql_real_escape_string($contract_signer), mysql_real_escape_string($id_contract_signer_role), mysql_real_escape_string($invoice_delivery), mysql_real_escape_string($id_client)); mysql_query($q) or die(mysql_error()); // Check if we have to rename clients if ($_POST['nom'] != $Client->nom) { // Rename Mantis project $mantis_project = array('name' => $nom, 'view_state' => array('id' => 50)); $mantis = new WebfinanceMantis(); $mantis->updateProject($id_mantis, $mantis_project); // Rename Toggl client $toggl = new WebfinanceToggl(); $toggl->renameClient($id_client, $nom); } if (isset($_SESSION['message'])) { $_SESSION['message'] .= "<br/>" . _('Update customer'); } else { $_SESSION['message'] = _('Update customer'); } logmessage(_('Update customer') . " client:{$id_client} ({$nom})", $id_client); header("Location: /prospection/fiche_prospect.php?id={$id_client}&onglet=" . $focused_onglet); exit;
ini_set('default_socket_timeout', 60); $soap = new SoapClient('https://www.ovh.com/soapi/soapi-re-1.3.wsdl'); $soap->telephonyClick2CallDo($User->prefs->ctc_ovh_login, $User->prefs->ctc_ovh_pass, $User->prefs->ctc_ovh_num, $num, $User->prefs->ctc_ovh_num); } catch (SoapFault $fault) { echo $fault; } exit; } // Create new client if (isset($_GET['action']) && $_GET['action'] == '_new') { $client_name = 'Nouvelle Entreprise_' . time(); mysql_query("INSERT INTO webfinance_clients (nom,date_created) VALUES('{$client_name}', now())") or die(mysql_error()); $_GET['id'] = mysql_insert_id(); // Create Mantis project $mantis_project = array('name' => $client_name, 'view_state' => array('id' => 50)); $mantis = new WebfinanceMantis(); $mantis->createProject($_GET['id'], $mantis_project); // Create Toggl client $toggl = new WebfinanceToggl(); $toggl->createClient($_GET['id'], $client_name); $_SESSION['message'] = _('New customer created'); logmessage(_('Create customer') . " client:" . $_GET['id'], $_GET['id']); } $Client = new Client($_GET['id']); $title = $Client->nom; array_push($extra_js, "/js/onglets.js"); if (!preg_match("/^[0-9]+\$/", $_GET['id'])) { header("Location: /prospection/"); die; } // Onglet affiché par défaut
* 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 <http://www.gnu.org/licenses/>. * */ $roles = 'manager,accounting,employee'; require_once '../../lib/WebfinanceMantis.php'; require_once "../inc/main.php"; $User = new User(); if (!$User->isLogued()) { $_SESSION['came_from'] = $_SERVER['REQUEST_URI']; if ($_SESSION['debug'] == 1) { echo 'Not logged. Debug mode, please <a href="/login.php">log in</a>'; include "bottom.php"; die; } header("Location: /login.php"); die; } $user = $User->getInfos(); if (!$User->isAuthorized($roles)) { header("Location: /welcome.php"); exit; } $mantis = new WebfinanceMantis(); $pdf_file = $mantis->createReport($_GET['year'], $_GET['month'], $_GET['id_client'], 'inline'); unlink($pdf_file);