~eventum-developers/eventum/trunk

« back to all changes in this revision

Viewing changes to lib/eventum/customer/class.abstract_customer_backend.php

  • Committer: Bryan Alsdorf
  • Date: 2013-08-23 03:50:34 UTC
  • mto: (4033.1.168 eventum-skysql)
  • mto: This revision was merged to the branch mainline in revision 4660.
  • Revision ID: bryan@montyprogram.com-20130823035034-7f5r3pt1xg0xnnhk
Initial commit of CRM migration

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
/* vim: set expandtab tabstop=4 shiftwidth=4 encoding=utf-8: */
3
 
// +----------------------------------------------------------------------+
4
 
// | Eventum - Issue Tracking System                                      |
5
 
// +----------------------------------------------------------------------+
6
 
// | Copyright (c) 2003 - 2008 MySQL AB                                   |
7
 
// | Copyright (c) 2008 - 2010 Sun Microsystem Inc.                       |
8
 
// | Copyright (c) 2011 - 2013 Eventum Team.                              |
9
 
// |                                                                      |
10
 
// | This program is free software; you can redistribute it and/or modify |
11
 
// | it under the terms of the GNU General Public License as published by |
12
 
// | the Free Software Foundation; either version 2 of the License, or    |
13
 
// | (at your option) any later version.                                  |
14
 
// |                                                                      |
15
 
// | This program is distributed in the hope that it will be useful,      |
16
 
// | but WITHOUT ANY WARRANTY; without even the implied warranty of       |
17
 
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        |
18
 
// | GNU General Public License for more details.                         |
19
 
// |                                                                      |
20
 
// | You should have received a copy of the GNU General Public License    |
21
 
// | along with this program; if not, write to:                           |
22
 
// |                                                                      |
23
 
// | Free Software Foundation, Inc.                                       |
24
 
// | 59 Temple Place - Suite 330                                          |
25
 
// | Boston, MA 02111-1307, USA.                                          |
26
 
// +----------------------------------------------------------------------+
27
 
// | Authors: Bryan Alsdorf <bryan@mysql.com>                             |
28
 
// +----------------------------------------------------------------------+
29
 
//
30
 
 
31
 
/**
32
 
 * Abstract class that all customer backends should extend. This is so any new
33
 
 * customer methods added in future releases won't break existing backends.
34
 
 *
35
 
 * @author Bryan Alsdorf <bryan@mysql.com>
36
 
 */
37
 
class Abstract_Customer_Backend
38
 
{
39
 
 
40
 
    /**
41
 
     * Return what business hours a customer falls into. Mainly used for international
42
 
     * customers.
43
 
     *
44
 
     * @access  public
45
 
     * @param   integer $customer_id The customer ID
46
 
     * @return  string The business hours
47
 
     */
48
 
    function getBusinessHours($customer_id)
49
 
    {
50
 
    }
51
 
 
52
 
 
53
 
    /**
54
 
     * Returns a message to be displayed to a customer on the top of the issue creation page.
55
 
     *
56
 
     * @param   array $customer_id Customer ID.
57
 
     */
58
 
    function getNewIssueMessage($customer_id)
59
 
    {
60
 
    }
61
 
 
62
 
 
63
 
    /**
64
 
     * Checks whether the given customer has a support contract that
65
 
     * enforces limits for the minimum first response time or not.
66
 
     *
67
 
     * @access  public
68
 
     * @param   integer $customer_id The customer ID
69
 
     * @param   integer $contract_id The contract ID
70
 
     * @return  boolean
71
 
     */
72
 
    function hasMinimumResponseTime($customer_id, $contract_id = false)
73
 
    {
74
 
    }
75
 
 
76
 
 
77
 
    /**
78
 
     * Returns the minimum first response time in seconds for the
79
 
     * support level associated with the given customer.
80
 
     *
81
 
     * @access  public
82
 
     * @param   integer $customer_id The customer ID
83
 
     * @param   integer $contract_id The contract ID
84
 
     * @return  integer The minimum first response time
85
 
     */
86
 
    function getMinimumResponseTime($customer_id, $contract_id = false)
87
 
    {
88
 
    }
89
 
 
90
 
 
91
 
    /**
92
 
     * Returns the maximum first response time associated with the
93
 
     * support contract of the given customer.
94
 
     *
95
 
     * @access  public
96
 
     * @param   integer $customer_id The customer ID
97
 
     * @param   integer $contract_id The contract ID
98
 
     * @return  integer The maximum first response time, in seconds
99
 
     */
100
 
    function getMaximumFirstResponseTime($customer_id, $contract_id = false)
101
 
    {
102
 
    }
103
 
 
104
 
 
105
 
    /**
106
 
     * Returns an array of incident types
107
 
     *
108
 
     * @return  array An array of incident types.
109
 
     */
110
 
    function getIncidentTypes()
111
 
    {
112
 
        return array();
113
 
    }
114
 
 
115
 
 
116
 
    /**
117
 
     * Returns true if the backend uses support levels, false otherwise
118
 
     *
119
 
     * @access  public
120
 
     * @return  boolean True if the project uses support levels.
121
 
     */
122
 
    function usesSupportLevels()
123
 
    {
124
 
        return false;
125
 
    }
126
 
 
127
 
 
128
 
    /**
129
 
     * Connect to the customer database
130
 
     *
131
 
     * @access  public
132
 
     */
133
 
    function connect()
134
 
    {
135
 
    }
136
 
 
137
 
 
138
 
    /**
139
 
     * Returns the contract status associated with the given customer ID.
140
 
     * Possible return values are 'active', 'in_grace_period' and 'expired'.
141
 
     *
142
 
     * @access  public
143
 
     * @param   integer $customer_id The customer ID
144
 
     * @param   integer $contract_id The contract ID
145
 
     * @return  string The contract status
146
 
     */
147
 
    function getContractStatus($customer_id, $contract_id = false)
148
 
    {
149
 
    }
150
 
 
151
 
 
152
 
    /**
153
 
     * Retrieves the customer titles associated with the given list of issues.
154
 
     *
155
 
     * @access  public
156
 
     * @param   array $result The list of issues
157
 
     * @see     Search::getListing()
158
 
     */
159
 
    function getCustomerTitlesByIssues(&$result)
160
 
    {
161
 
    }
162
 
 
163
 
 
164
 
    /**
165
 
     * Method used to get the details of the given customer.
166
 
     *
167
 
     * @access  public
168
 
     * @param   integer $customer_id The customer ID
169
 
     * @return  array The customer details
170
 
     */
171
 
    function getDetails($customer_id)
172
 
    {
173
 
    }
174
 
 
175
 
 
176
 
    /**
177
 
     * Returns true if this issue has been counted a valid incident
178
 
     *
179
 
     * @see /docs/Customer_API.html
180
 
     * @access  public
181
 
     * @param   integer $issue_id The ID of the issue
182
 
     * @return  boolean True if this is a redeemed incident.
183
 
     */
184
 
    function isRedeemedIncident($issue_id)
185
 
    {
186
 
    }
187
 
 
188
 
 
189
 
    /**
190
 
     * Marks an issue as a redeemed incident.
191
 
     *
192
 
     * @see /docs/Customer_API.html
193
 
     * @access  public
194
 
     * @param   integer $issue_id The ID of the issue
195
 
     */
196
 
    function flagIncident($issue_id)
197
 
    {
198
 
    }
199
 
 
200
 
 
201
 
    /**
202
 
     * Marks an issue as not a redeemed incident.
203
 
     *
204
 
     * @see /docs/Customer_API.html
205
 
     * @access  public
206
 
     * @param   integer $issue_id The ID of the issue
207
 
     */
208
 
    function unflagIncident($issue_id)
209
 
    {
210
 
    }
211
 
 
212
 
 
213
 
    /**
214
 
     * Checks whether the active per-incident contract associated with the given
215
 
     * customer ID has any incidents available to be redeemed.
216
 
     *
217
 
     * @access  public
218
 
     * @param   integer $customer_id The customer ID
219
 
     * @return  boolean
220
 
     */
221
 
    function hasIncidentsLeft($customer_id)
222
 
    {
223
 
    }
224
 
 
225
 
 
226
 
    /**
227
 
     * Checks whether the active contract associated with the given customer ID
228
 
     * is a per-incident contract or not.
229
 
     *
230
 
     * @access  public
231
 
     * @param   integer $customer_id The customer ID
232
 
     * @return  boolean
233
 
     */
234
 
    public function hasPerIncidentContract($customer_id)
235
 
    {
236
 
        return false;
237
 
    }
238
 
 
239
 
 
240
 
    /**
241
 
     * Returns the total number of allowed incidents for the given support
242
 
     * contract ID.
243
 
     *
244
 
     * @access  public
245
 
     * @param   integer $prj_id The project ID
246
 
     * @param   integer $support_no The support contract ID
247
 
     * @return  integer The total number of incidents
248
 
     */
249
 
    function getTotalIncidents($support_no)
250
 
    {
251
 
    }
252
 
 
253
 
 
254
 
    /**
255
 
     * Returns the number of incidents remaining for the given support
256
 
     * contract ID.
257
 
     *
258
 
     * @access  public
259
 
     * @param   integer $support_no The support contract ID
260
 
     * @return  integer The number of incidents remaining.
261
 
     */
262
 
    function getIncidentsRemaining($support_no)
263
 
    {
264
 
    }
265
 
 
266
 
 
267
 
    /**
268
 
     * Method used to send a notice that the per-incident limit being reached.
269
 
     *
270
 
     * @access  public
271
 
     * @param   integer $contact_id The customer contact ID
272
 
     * @param   integer $customer_id The customer ID
273
 
     * @param   boolean $new_issue If the customer just tried to create a new issue.
274
 
     * @return  void
275
 
     */
276
 
    function sendIncidentLimitNotice($contact_id, $customer_id, $new_issue = false)
277
 
    {
278
 
    }
279
 
 
280
 
 
281
 
    /**
282
 
     * Returns a list of customers (companies) in the customer database.
283
 
     *
284
 
     * @access  public
285
 
     * @return  array An associated array of customers.
286
 
     */
287
 
    function getAssocList()
288
 
    {
289
 
    }
290
 
 
291
 
 
292
 
    /**
293
 
     * Method used to get the customer names for the given customer id.
294
 
     *
295
 
     * @access  public
296
 
     * @param   integer $customer_id The customer ID
297
 
     * @return  string The customer name
298
 
     */
299
 
    function getTitle($customer_id)
300
 
    {
301
 
    }
302
 
 
303
 
 
304
 
    /**
305
 
     * Method used to get an associative array of the customer names
306
 
     * for the given list of customer ids.
307
 
     *
308
 
     * @access  public
309
 
     * @param   array $customer_ids The list of customers
310
 
     * @return  array The associative array of customer id => customer name
311
 
     */
312
 
    function getTitles($prj_id, $customer_ids)
313
 
    {
314
 
    }
315
 
 
316
 
 
317
 
    /**
318
 
     * Method used to get the list of email addresses associated with the
319
 
     * contacts of a given customer.
320
 
     *
321
 
     * @access  public
322
 
     * @param   integer $customer_id The customer ID
323
 
     * @return  array The list of email addresses
324
 
     */
325
 
    function getContactEmailAssocList($customer_id)
326
 
    {
327
 
    }
328
 
 
329
 
 
330
 
    /**
331
 
     * Method used to get the customer and customer contact IDs associated
332
 
     * with a given list of email addresses.
333
 
     *
334
 
     * @access  public
335
 
     * @param   array $emails The list of email addresses
336
 
     * @return  array The customer and customer contact ID
337
 
     */
338
 
    function getCustomerIDByEmails($emails)
339
 
    {
340
 
    }
341
 
 
342
 
 
343
 
    /**
344
 
     * Method used to get the overall statistics of issues in the system for a
345
 
     * given customer.
346
 
     *
347
 
     * @access  public
348
 
     * @param   integer $customer_id The customer ID
349
 
     * @return  array The customer related issue statistics
350
 
     */
351
 
    function getOverallStats($customer_id)
352
 
    {
353
 
    }
354
 
 
355
 
 
356
 
    /**
357
 
     * Method used to build the overall customer profile from the information
358
 
     * stored in the customer database.
359
 
     *
360
 
     * @access  public
361
 
     * @param   integer $usr_id The Eventum user ID
362
 
     * @return  array The customer profile information
363
 
     */
364
 
    function getProfile($usr_id)
365
 
    {
366
 
    }
367
 
 
368
 
 
369
 
    /**
370
 
     * Method used to get the contract details for a given customer contact.
371
 
     *
372
 
     * @access  public
373
 
     * @param   integer $contact_id The customer contact ID
374
 
     * @return  array The customer contract details
375
 
     */
376
 
    function getContractDetails($contact_id, $restrict_expiration = TRUE)
377
 
    {
378
 
    }
379
 
 
380
 
 
381
 
    /**
382
 
     * Method used to get the details associated with a customer contact.
383
 
     *
384
 
     * @access  public
385
 
     * @param   integer $contact_id The customer contact ID
386
 
     * @return  array The contact details
387
 
     */
388
 
    function getContactDetails($contact_id)
389
 
    {
390
 
    }
391
 
 
392
 
 
393
 
    /**
394
 
     * Returns the list of customer IDs that are associated with the given
395
 
     * email value (wildcards welcome).
396
 
     *
397
 
     * @access  public
398
 
     * @param   string $email The email value
399
 
     * @return  array The list of customer IDs
400
 
     */
401
 
    function getCustomerIDsLikeEmail($email)
402
 
    {
403
 
    }
404
 
 
405
 
 
406
 
    /**
407
 
     * Method used to notify the customer contact that an existing issue
408
 
     * associated with him was just marked as closed.
409
 
     *
410
 
     * @access  public
411
 
     * @param   integer $issue_id The issue ID
412
 
     * @param   integer $contact_id The customer contact ID
413
 
     * @return  void
414
 
     */
415
 
    function notifyIssueClosed($issue_id, $contact_id)
416
 
    {
417
 
    }
418
 
 
419
 
 
420
 
    /**
421
 
     * Performs a customer lookup and returns the matches, if
422
 
     * appropriate.
423
 
     *
424
 
     * @access  public
425
 
     * @param   string $field The field that we are trying to search against
426
 
     * @param   string $value The value that we are searching for
427
 
     * @param   array  $options An array of options for search
428
 
     * @return  array The list of customers
429
 
     */
430
 
    function lookup($field, $value, $options)
431
 
    {
432
 
    }
433
 
 
434
 
 
435
 
    /**
436
 
     * Method used to notify the customer contact that a new issue was just
437
 
     * created and associated with his Eventum user.
438
 
     *
439
 
     * @access  public
440
 
     * @param   integer $issue_id The issue ID
441
 
     * @param   integer $contact_id The customer contact ID
442
 
     * @return  void
443
 
     */
444
 
    function notifyCustomerIssue($issue_id, $contact_id)
445
 
    {
446
 
    }
447
 
 
448
 
 
449
 
    /**
450
 
     * Method used to get the list of available support levels.
451
 
     *
452
 
     * @access  public
453
 
     * @return  array The list of available support levels
454
 
     */
455
 
    function getSupportLevelAssocList()
456
 
    {
457
 
    }
458
 
 
459
 
 
460
 
    /**
461
 
     * Returns the support level of the current support contract for a given
462
 
     * customer ID.
463
 
     *
464
 
     * @access  public
465
 
     * @param   integer $customer_id The customer ID
466
 
     * @param   integer $contract_id The contract ID
467
 
     * @return  string The support contract level
468
 
     */
469
 
    function getSupportLevelID($customer_id, $contract_id = false)
470
 
    {
471
 
    }
472
 
 
473
 
 
474
 
    /**
475
 
     * Returns the list of customer IDs for a given support contract level.
476
 
     *
477
 
     * @access  public
478
 
     * @param   integer $support_level_id The support level ID
479
 
     * @param   mixed $support_options An integer or array of integers indicating various options to get customers with.
480
 
     * @return  array The list of customer IDs
481
 
     */
482
 
    function getListBySupportLevel($support_level_id, $support_options = false)
483
 
    {
484
 
    }
485
 
 
486
 
 
487
 
    /**
488
 
     * Returns an array of support levels grouped together.
489
 
     *
490
 
     * @access  public
491
 
     * @return  array an array of support levels.
492
 
     */
493
 
    function getGroupedSupportLevels()
494
 
    {
495
 
    }
496
 
 
497
 
 
498
 
    /**
499
 
     * Method used to send an expiration notice.
500
 
     *
501
 
     * @access  public
502
 
     * @param   integer $contact_id The customer contact ID
503
 
     * @param   boolean $is_expired Whether this customer is expired or not
504
 
     * @return  void
505
 
     */
506
 
    function sendExpirationNotice($contact_id, $is_expired = FALSE)
507
 
    {
508
 
    }
509
 
 
510
 
 
511
 
    /**
512
 
     * Checks whether the given technical contact ID is allowed in the current
513
 
     * support contract or not.
514
 
     *
515
 
     * @access  public
516
 
     * @param   integer $customer_contact_id The customer technical contact ID
517
 
     * @return  boolean
518
 
     */
519
 
    function isAllowedSupportContact($customer_contact_id)
520
 
    {
521
 
    }
522
 
 
523
 
 
524
 
    /**
525
 
     * Method used to get the associated customer and customer contact from
526
 
     * a given set of support emails. This is especially useful to automatically
527
 
     * associate an issue to the appropriate customer contact that sent a
528
 
     * support email.
529
 
     *
530
 
     * @access  public
531
 
     * @param   array $sup_ids The list of support email IDs
532
 
     * @return  array The customer and customer contact ID
533
 
     */
534
 
    function getCustomerInfoFromEmails($sup_ids)
535
 
    {
536
 
    }
537
 
 
538
 
 
539
 
    /**
540
 
     * Method used to send an email notification to the sender of a
541
 
     * set of email messages that were manually converted into an
542
 
     * issue.
543
 
     *
544
 
     * @access  public
545
 
     * @param   integer $issue_id The issue ID
546
 
     * @param   array $sup_ids The email IDs
547
 
     * @param   integer $customer_id The customer ID
548
 
     * @return  array The list of recipient emails
549
 
     */
550
 
    function notifyEmailConvertedIntoIssue($issue_id, $sup_ids, $customer_id = FALSE)
551
 
    {
552
 
    }
553
 
 
554
 
 
555
 
    /**
556
 
     * Method used to send an email notification to the sender of an
557
 
     * email message that was automatically converted into an issue.
558
 
     *
559
 
     * @access  public
560
 
     * @param   integer $issue_id The issue ID
561
 
     * @param   string $sender The sender of the email message (and the recipient of this notification)
562
 
     * @param   string $date The arrival date of the email message
563
 
     * @param   string $subject The subject line of the email message
564
 
     * @return  void
565
 
     */
566
 
    function notifyAutoCreatedIssue($issue_id, $sender, $date, $subject)
567
 
    {
568
 
    }
569
 
 
570
 
 
571
 
    /**
572
 
     * Method used to get the customer login grace period (number of days).
573
 
     *
574
 
     * @access  public
575
 
     * @return  integer The customer login grace period
576
 
     */
577
 
    function getExpirationOffset()
578
 
    {
579
 
    }
580
 
 
581
 
 
582
 
    /**
583
 
     * Method used to get the details of the given customer contact.
584
 
     *
585
 
     * @access  public
586
 
     * @param   integer $contact_id The customer contact ID
587
 
     * @return  array The customer details
588
 
     */
589
 
    function getContactLoginDetails($contact_id)
590
 
    {
591
 
    }
592
 
 
593
 
 
594
 
    /**
595
 
     * Returns the end date of the current support contract for a given
596
 
     * customer ID.
597
 
     *
598
 
     * @access  public
599
 
     * @param   integer $customer_id The customer ID
600
 
     * @param   integer $contract_id The contract ID
601
 
     * @return  string The support contract end date
602
 
     */
603
 
    function getContractEndDate($customer_id, $contract_id = false)
604
 
    {
605
 
    }
606
 
 
607
 
 
608
 
    /**
609
 
     * Returns the name and email of the sales account manager of the given customer ID.
610
 
     *
611
 
     * @access  public
612
 
     * @param   integer $customer_id The customer ID
613
 
     * @return  array An array containing the name and email of the sales account manager
614
 
     */
615
 
    function getSalesAccountManager($customer_id)
616
 
    {
617
 
    }
618
 
 
619
 
 
620
 
    /**
621
 
     * Returns the start date of the current support contract for a given
622
 
     * customer ID.
623
 
     *
624
 
     * @access  public
625
 
     * @param   integer $customer_id The customer ID
626
 
     * @param   integer $contract_id The contract ID
627
 
     * @return  string The support contract start date
628
 
     */
629
 
    function getContractStartDate($customer_id, $contract_id = false)
630
 
    {
631
 
    }
632
 
 
633
 
 
634
 
    function getSupportLevelsByIssues(&$result)
635
 
    {
636
 
    }
637
 
}